OSDN Git Service

btrfs: subpage: make alloc_extent_buffer() handle previously uptodate range efficiently
authorQu Wenruo <wqu@suse.com>
Tue, 30 May 2023 01:45:27 +0000 (09:45 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 19 Jun 2023 11:59:31 +0000 (13:59 +0200)
commit5a96341927b097601e1fefc292f0a6e5273e7554
treea9f2c40bd9775b4068812820fe331154bba27c0c
parentb831306b3b7d9202b300f7f6ec32f5be2b4926a3
btrfs: subpage: make alloc_extent_buffer() handle previously uptodate range efficiently

Currently alloc_extent_buffer() would make the extent buffer uptodate if
the corresponding pages are also uptodate.

But this check is only checking PageUptodate, which is fine for regular
cases, but not for subpage cases, as we can have multiple extent buffers
in the same page.

So here we go btrfs_page_test_uptodate() instead.

The old code doesn't cause any problem, but is not efficient, as it
would cause extra metadata read even if the range is already uptodate.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent_io.c