Skip to content

Commit

Permalink
xfs: set XBF_DONE on newly formatted btree block that are ready for w…
Browse files Browse the repository at this point in the history
…riting

The btree bulkloading code calls xfs_buf_delwri_queue_here when it has
finished formatting a new btree block and wants to queue it to be
written to disk.  Once the new btree root has been committed, the blocks
(and hence the buffers) will be accessible to the rest of the
filesystem.  Mark each new buffer as DONE when adding it to the delwri
list so that the next btree traversal can skip reloading the contents
from disk.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
  • Loading branch information
Darrick J. Wong committed Dec 15, 2023
1 parent 13ae04d commit c1e0f8e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fs/xfs/libxfs/xfs_btree_staging.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,12 @@ xfs_btree_bload_drop_buf(
if (*bpp == NULL)
return;

/*
* Mark this buffer XBF_DONE (i.e. uptodate) so that a subsequent
* xfs_buf_read will not pointlessly reread the contents from the disk.
*/
(*bpp)->b_flags |= XBF_DONE;

xfs_buf_delwri_queue_here(*bpp, buffers_list);
xfs_buf_relse(*bpp);
*bpp = NULL;
Expand Down

0 comments on commit c1e0f8e

Please sign in to comment.