Re: [PATCH 10/24] xfs: clean up the buffer iodone callback functions

Dave Chinner
2020-05-25T00:37:31Z

On Fri, May 22, 2020 at 03:26:11PM -0700, Darrick J. Wong wrote:
> On Fri, May 22, 2020 at 01:50:15PM +1000, Dave Chinner wrote:
> > @@ -1188,19 +1146,10 @@ void
> > xfs_buf_inode_iodone(
> > struct xfs_buf *bp)
> > {
> > - struct xfs_buf_log_item *blip = bp->b_log_item;
> > - struct xfs_log_item *lip;
> > -
> > if (xfs_buf_had_callback_errors(bp))
> > return;
> >
> > - /* If there is a buf_log_item attached, run its callback */
> > - if (blip) {
> > - lip = &blip->bli_item;
> > - lip->li_cb(bp, lip);
> > - bp->b_log_item = NULL;
> > - }
> > -
> > + xfs_buf_item_done(bp);
> > xfs_iflush_done(bp);
>
> Just out of curiosity, we still have a reference to bp here even if
> xfs_buf_item_done calls xfs_buf_rele, right?

Yes, the IO still has a reference to the buffer that won't be
released until the xfs_buf_ioend_finish() call is made.

> I think the answer is that yes
> we do still have the reference because the inodes themselves hold references
> to the cluster buffer, right?

That too, but the important one is the IO reference as even the
inode references can go away on completion at this point.

> If so,
> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

Ta.

Cheers,

Dave.

--
Dave Chinner
david@fromorbit.com