]> git.baikalelectronics.ru Git - kernel.git/commitdiff
btrfs: make btrfs_submit_compressed_write take btrfs_inode
authorNikolay Borisov <nborisov@suse.com>
Wed, 3 Jun 2020 05:55:16 +0000 (08:55 +0300)
committerDavid Sterba <dsterba@suse.com>
Mon, 27 Jul 2020 10:55:31 +0000 (12:55 +0200)
Majority of its uses are for btrfs_inode so take it as an argument
directly.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/compression.c
fs/btrfs/compression.h
fs/btrfs/inode.c

index 4f52cd8af517ffa0716985386175b1130cce62ae..c2d5ca583dbf66e99c8e6c1117ee5768cceb880d 100644 (file)
@@ -405,7 +405,7 @@ out:
  * This also checksums the file bytes and gets things ready for
  * the end io hooks.
  */
-blk_status_t btrfs_submit_compressed_write(struct inode *inode, u64 start,
+blk_status_t btrfs_submit_compressed_write(struct btrfs_inode *inode, u64 start,
                                 unsigned long len, u64 disk_start,
                                 unsigned long compressed_len,
                                 struct page **compressed_pages,
@@ -413,7 +413,7 @@ blk_status_t btrfs_submit_compressed_write(struct inode *inode, u64 start,
                                 unsigned int write_flags,
                                 struct cgroup_subsys_state *blkcg_css)
 {
-       struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
+       struct btrfs_fs_info *fs_info = inode->root->fs_info;
        struct bio *bio = NULL;
        struct compressed_bio *cb;
        unsigned long bytes_left;
@@ -421,7 +421,7 @@ blk_status_t btrfs_submit_compressed_write(struct inode *inode, u64 start,
        struct page *page;
        u64 first_byte = disk_start;
        blk_status_t ret;
-       int skip_sum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM;
+       int skip_sum = inode->flags & BTRFS_INODE_NODATASUM;
 
        WARN_ON(!PAGE_ALIGNED(start));
        cb = kmalloc(compressed_bio_size(fs_info, compressed_len), GFP_NOFS);
@@ -429,7 +429,7 @@ blk_status_t btrfs_submit_compressed_write(struct inode *inode, u64 start,
                return BLK_STS_RESOURCE;
        refcount_set(&cb->pending_bios, 0);
        cb->errors = 0;
-       cb->inode = inode;
+       cb->inode = &inode->vfs_inode;
        cb->start = start;
        cb->len = len;
        cb->mirror_num = 0;
@@ -455,7 +455,7 @@ blk_status_t btrfs_submit_compressed_write(struct inode *inode, u64 start,
                int submit = 0;
 
                page = compressed_pages[pg_index];
-               page->mapping = inode->i_mapping;
+               page->mapping = inode->vfs_inode.i_mapping;
                if (bio->bi_iter.bi_size)
                        submit = btrfs_bio_fits_in_stripe(page, PAGE_SIZE, bio,
                                                          0);
@@ -475,8 +475,7 @@ blk_status_t btrfs_submit_compressed_write(struct inode *inode, u64 start,
                        BUG_ON(ret); /* -ENOMEM */
 
                        if (!skip_sum) {
-                               ret = btrfs_csum_one_bio(BTRFS_I(inode), bio,
-                                                        start, 1);
+                               ret = btrfs_csum_one_bio(inode, bio, start, 1);
                                BUG_ON(ret); /* -ENOMEM */
                        }
 
@@ -508,7 +507,7 @@ blk_status_t btrfs_submit_compressed_write(struct inode *inode, u64 start,
        BUG_ON(ret); /* -ENOMEM */
 
        if (!skip_sum) {
-               ret = btrfs_csum_one_bio(BTRFS_I(inode), bio, start, 1);
+               ret = btrfs_csum_one_bio(inode, bio, start, 1);
                BUG_ON(ret); /* -ENOMEM */
        }
 
index 284a3ad313504ba0f141808dc7810061007e131a..9f3dbe372631becf8e290103436814c9f69d3b0c 100644 (file)
@@ -8,6 +8,8 @@
 
 #include <linux/sizes.h>
 
+struct btrfs_inode;
+
 /*
  * We want to make sure that amount of RAM required to uncompress an extent is
  * reasonable, so we limit the total size in ram of a compressed extent to
@@ -88,7 +90,7 @@ int btrfs_decompress_buf2page(const char *buf, unsigned long buf_start,
                              unsigned long total_out, u64 disk_start,
                              struct bio *bio);
 
-blk_status_t btrfs_submit_compressed_write(struct inode *inode, u64 start,
+blk_status_t btrfs_submit_compressed_write(struct btrfs_inode *inode, u64 start,
                                  unsigned long len, u64 disk_start,
                                  unsigned long compressed_len,
                                  struct page **compressed_pages,
index 982fe4cca715b18ab7ba306a9f262674efe189f2..e019800eaab20b5c6bd7f3c58029b0bf979f9fbd 100644 (file)
@@ -887,7 +887,7 @@ retry:
                                NULL, EXTENT_LOCKED | EXTENT_DELALLOC,
                                PAGE_UNLOCK | PAGE_CLEAR_DIRTY |
                                PAGE_SET_WRITEBACK);
-               if (btrfs_submit_compressed_write(inode,
+               if (btrfs_submit_compressed_write(BTRFS_I(inode),
                                    async_extent->start,
                                    async_extent->ram_size,
                                    ins.objectid,