]> git.baikalelectronics.ru Git - kernel.git/commitdiff
btrfs: make btrfs_set_range_writeback() subpage compatible
authorQu Wenruo <wqu@suse.com>
Mon, 31 May 2021 08:50:49 +0000 (16:50 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 21 Jun 2021 13:19:10 +0000 (15:19 +0200)
Function btrfs_set_range_writeback() currently just sets the page
writeback unconditionally.

Change it to call the subpage helper so that we can handle both cases
well.

Since the subpage helpers needs btrfs_fs_info, also change the parameter
to accept btrfs_inode.

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/ctree.h
fs/btrfs/extent_io.c
fs/btrfs/inode.c

index c63980977fa4d919b0a346709a0ebba9bc22b362..82e58f2fbe0af41078dd3af1a5f113dd184b91ef 100644 (file)
@@ -3157,7 +3157,7 @@ void btrfs_split_delalloc_extent(struct inode *inode,
                                 struct extent_state *orig, u64 split);
 int btrfs_bio_fits_in_stripe(struct page *page, size_t size, struct bio *bio,
                             unsigned long bio_flags);
-void btrfs_set_range_writeback(struct extent_io_tree *tree, u64 start, u64 end);
+void btrfs_set_range_writeback(struct btrfs_inode *inode, u64 start, u64 end);
 vm_fault_t btrfs_page_mkwrite(struct vm_fault *vmf);
 int btrfs_readpage(struct file *file, struct page *page);
 void btrfs_evict_inode(struct inode *inode);
index 7dec08156ff0fa5097acedbe4eba210c6eaf2514..2fb26193b7957bf029ffeef8133885472a58e26a 100644 (file)
@@ -3800,7 +3800,6 @@ static noinline_for_stack int __extent_writepage_io(struct btrfs_inode *inode,
                                 int *nr_ret)
 {
        struct btrfs_fs_info *fs_info = inode->root->fs_info;
-       struct extent_io_tree *tree = &inode->io_tree;
        u64 start = page_offset(page);
        u64 end = start + PAGE_SIZE - 1;
        u64 cur = start;
@@ -3879,7 +3878,7 @@ static noinline_for_stack int __extent_writepage_io(struct btrfs_inode *inode,
                        continue;
                }
 
-               btrfs_set_range_writeback(tree, cur, cur + iosize - 1);
+               btrfs_set_range_writeback(inode, cur, cur + iosize - 1);
                if (!PageWriteback(page)) {
                        btrfs_err(inode->root->fs_info,
                                   "page %lu not writeback, cur %llu end %llu",
index 9f7b7110f629eb664692e4f61ba231aaba20b9aa..6d905a7b87d03b68b323646cb9e8fdadab19c07a 100644 (file)
@@ -10234,17 +10234,21 @@ out:
        return ret;
 }
 
-void btrfs_set_range_writeback(struct extent_io_tree *tree, u64 start, u64 end)
+void btrfs_set_range_writeback(struct btrfs_inode *inode, u64 start, u64 end)
 {
-       struct inode *inode = tree->private_data;
+       struct btrfs_fs_info *fs_info = inode->root->fs_info;
        unsigned long index = start >> PAGE_SHIFT;
        unsigned long end_index = end >> PAGE_SHIFT;
        struct page *page;
+       u32 len;
 
+       ASSERT(end + 1 - start <= U32_MAX);
+       len = end + 1 - start;
        while (index <= end_index) {
-               page = find_get_page(inode->i_mapping, index);
+               page = find_get_page(inode->vfs_inode.i_mapping, index);
                ASSERT(page); /* Pages should be in the extent_io_tree */
-               set_page_writeback(page);
+
+               btrfs_page_set_writeback(fs_info, page, start, len);
                put_page(page);
                index++;
        }