]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
btrfs: make extent_write_locked_range() handle subpage writeback correctly
authorQu Wenruo <wqu@suse.com>
Tue, 5 Mar 2024 06:57:58 +0000 (17:27 +1030)
committerDavid Sterba <dsterba@suse.com>
Thu, 11 Jul 2024 13:33:22 +0000 (15:33 +0200)
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>
fs/btrfs/extent_io.c

index bf762b52b3199276a022a5fd62c0005c5f17342e..689643956ea6c9b0172e46de45b9232f18a09976 100644 (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. */
                if (nr == 0) {
-                       set_page_writeback(page);
-                       end_page_writeback(page);
+                       struct folio *folio;
+
+                       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) {
                        btrfs_mark_ordered_io_finished(BTRFS_I(inode), page,