btrfs: make extent_write_locked_range() handle subpage writeback correctly

When extent_write_locked_range() generated an inline extent, it would
set and finish the writeback for the whole page.

Although currently it's safe since subpage disables inline creation,
for the sake of consistency, let it go with subpage helpers to set and
clear the writeback flags.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Qu Wenruo 2024-03-05 17:27:58 +10:30 committed by David Sterba
parent 97713b1a2c
commit a185373e53

View File

@ -2351,8 +2351,11 @@ void extent_write_locked_range(struct inode *inode, struct page *locked_page,
/* Make sure the mapping tag for page dirty gets cleared. */ /* Make sure the mapping tag for page dirty gets cleared. */
if (nr == 0) { if (nr == 0) {
set_page_writeback(page); struct folio *folio;
end_page_writeback(page);
folio = page_folio(page);
btrfs_folio_set_writeback(fs_info, folio, cur, cur_len);
btrfs_folio_clear_writeback(fs_info, folio, cur, cur_len);
} }
if (ret) { if (ret) {
btrfs_mark_ordered_io_finished(BTRFS_I(inode), page, btrfs_mark_ordered_io_finished(BTRFS_I(inode), page,