Re: [PATCH 04/30] xfs: mark inode buffers in cache

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 03, 2020 at 10:57:49AM -0400, Brian Foster wrote:
> On Wed, Jun 03, 2020 at 07:29:18AM +1000, Dave Chinner wrote:
> > On Tue, Jun 02, 2020 at 12:45:35PM -0400, Brian Foster wrote:
> > > On Tue, Jun 02, 2020 at 07:42:25AM +1000, Dave Chinner wrote:
> > > > From: Dave Chinner <dchinner@xxxxxxxxxx>
> > > > 
> > > > Inode buffers always have write IO callbacks, so by marking them
> > > > directly we can avoid needing to attach ->b_iodone functions to
> > > > them. This avoids an indirect call, and makes future modifications
> > > > much simpler.
> > > > 
> > > > This is largely a rearrangement of the code at this point - no IO
> > > > completion functionality changes at this point, just how the
> > > > code is run is modified.
> > > > 
> > > 
> > > Ok, I was initially thinking this patch looked incomplete in that we
> > > continue to set ->b_iodone() on inode buffers even though we'd never
> > > call it. Looking ahead, I see that the next few patches continue to
> > > clean that up to eventually remove ->b_iodone(), so that addresses that.
> > > 
> > > My only other curiosity is that while there may not be any functional
> > > difference, this technically changes callback behavior in that we set
> > > the new flag in some contexts that don't currently attach anything to
> > > the buffer, right? E.g., xfs_trans_inode_alloc_buf() sets the flag on
> > > inode chunk init, which means we can write out an inode buffer without
> > > any attached/flushed inodes.
> > 
> > Yes, it can happen, and it happens before this patch, too, because
> > the AIL can push the buffer log item directly and that does not
> > flush dirty inodes to the buffer before it writes back(*).
> > 
> 
> I was thinking more about cases where there are actually no inodes
> attached.
> 
> > As it is, xfs_buf_inode_iodone() on a buffer with no inode attached
> > if functionally identical to the existing xfs_buf_iodone() callback
> > that would otherwise be done. i.e. it just runs the buffer log item
> > completion callback. Hence the change here rearranges code, but it
> > does not change behaviour at all.
> > 
> 
> Right. That's indicative from the code, but doesn't help me understand
> why the change is made. That's all I'm asking for...
> 
> > (*) this is a double-write bug that this patch set does not address.
> > i.e. buffer log item flushes the buffer without flushing inodes, IO
> > compeletes, then inode flush to the buffer and we do another IO to
> > clean them.  This is addressed by a follow-on patchset that tracks
> > dirty inodes via ordered cluster buffers, such that pushing the
> > buffer always triggers xfs_iflush_cluster() on buffers tagged
> > _XBF_INODES...
> > 
> 
> Ok, interesting (but seems beyond the scope of this series).

It is used in this series in the ail buffer resubmit code to clear
the LI_FAILED state appropriately, because inode items are treated
differently to dquot items once they track the cluster buffer...

> > > Is the intent of that to support future
> > > changes? If so, a note about that in the commit log would be helpful.
> > 
> > That's part of it, as you can see from the (*) above. But the commit
> > log already says "..., and makes future modifications much simpler."
> > Was that insufficient to indicate that it will be used later on?
> > 
> 
> That's a rather vague hint. ;P I was more hoping for something like:
> "While this is largely a refactor of existing functionality, broaden the
> scope of the flag to beyond where inodes are explicitly attached because
> <some actual reason>. This has the effect of possibly invoking the
> callback in cases where it wouldn't have been previously, but this is
> not a functional change because the callback is effectively a no-op when
> inodes are not attached."

Ok.

-Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux