]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
btrfs: make btrfs_truncate_block() to be subpage compatible
authorQu Wenruo <wqu@suse.com>
Mon, 31 May 2021 08:50:51 +0000 (16:50 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 21 Jun 2021 13:19:10 +0000 (15:19 +0200)
btrfs_truncate_block() itself is already mostly subpage compatible, the
only missing part is the page dirtying code.

Currently if we have a sector that needs to be truncated, we set the
sector aligned range delalloc, then set the full page dirty.

The problem is, current subpage code requires subpage dirty bit to be
set, or __extent_writepage_io() won't submit bio, thus leads to ordered
extent never to finish.

So this patch will make btrfs_truncate_block() to call
btrfs_page_set_dirty() helper to replace set_page_dirty() to fix the
problem.

Tested-by: Ritesh Harjani <riteshh@linux.ibm.com> # [ppc64]
Tested-by: Anand Jain <anand.jain@oracle.com> # [aarch64]
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/inode.c

index 6d905a7b87d03b68b323646cb9e8fdadab19c07a..88838ef22413a6d5ce5a337e5bac8e9e4c7e93d5 100644 (file)
@@ -4965,7 +4965,7 @@ again:
                flush_dcache_page(page);
        }
        ClearPageChecked(page);
-       set_page_dirty(page);
+       btrfs_page_set_dirty(fs_info, page, block_start, block_end + 1 - block_start);
        unlock_extent_cached(io_tree, block_start, block_end, &cached_state);
 
        if (only_release_metadata)