On Tue, Aug 18, 2020 at 05:02:51PM -0700, Darrick J. Wong wrote: > On Wed, Aug 12, 2020 at 07:25:48PM +1000, Dave Chinner wrote: > > From: Dave Chinner <dchinner@xxxxxxxxxx> > > > > To move away from using the on disk inode buffers to track and log > > unlinked inodes, we need pointers to track them in memory. Because > > we have arbitrary remove order from the list, it needs to be a > > double linked list. > > > > We start by noting that inodes are always in memory when they are > > active on the unlinked list, and hence we can track these inodes > > without needing to take references to the inodes or store them in > > the list. We cannot, however, use inode locks to protect the inodes > > on the list - the list needs an external lock to serialise all > > inserts and removals. We can use the existing AGI buffer lock for > > this right now as that already serialises all unlinked list > > traversals and modifications. > > > > Hence we can convert the in-memory unlinked list to a simple > > list_head list in the perag. We can use list_empty() to detect an > > empty unlinked list, likewise we can detect the end of the list when > > the inode next pointer points back to the perag list_head. This > > makes insert, remove and traversal. > > > > The only complication here is log recovery of old filesystems that > > have multiple lists. These always remove from the head of the list, > > so we can easily construct just enough of the unlinked list for > > recovery from any list to work correctly. > > > > Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx> > > Hm. This is orthogonal to this patch, but should we get meaner about > failing the mount if the AGI read fails or the unlinked walk fails? I don't think it matters. We can leak the unlinked lists and still have the filesystem operate correctly, so I don't think failing the mount is necessary or desirable (i.e. how many existing filesystems will now suddenly refuse to mount?) Cheers, Dave. -- Dave Chinner david@xxxxxxxxxxxxx