]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
btrfs: make btrfs_is_free_space_inode take btrfs_inode
authorNikolay Borisov <nborisov@suse.com>
Mon, 20 Feb 2017 11:50:35 +0000 (13:50 +0200)
committerDavid Sterba <dsterba@suse.com>
Tue, 28 Feb 2017 10:30:06 +0000 (11:30 +0100)
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/btrfs_inode.h
fs/btrfs/ctree.h
fs/btrfs/extent-tree.c
fs/btrfs/file-item.c
fs/btrfs/inode.c

index 46d117b77bd286202135a9b038cbcf3e18f0e8d6..36eca5464e1b3b733287c7a24cc9c679bba7ca9f 100644 (file)
@@ -243,14 +243,14 @@ static inline void btrfs_i_size_write(struct btrfs_inode *inode, u64 size)
        inode->disk_i_size = size;
 }
 
-static inline bool btrfs_is_free_space_inode(struct inode *inode)
+static inline bool btrfs_is_free_space_inode(struct btrfs_inode *inode)
 {
-       struct btrfs_root *root = BTRFS_I(inode)->root;
+       struct btrfs_root *root = inode->root;
 
        if (root == root->fs_info->tree_root &&
-           btrfs_ino(BTRFS_I(inode)) != BTRFS_BTREE_INODE_OBJECTID)
+           btrfs_ino(inode) != BTRFS_BTREE_INODE_OBJECTID)
                return true;
-       if (BTRFS_I(inode)->location.objectid == BTRFS_FREE_INO_OBJECTID)
+       if (inode->location.objectid == BTRFS_FREE_INO_OBJECTID)
                return true;
        return false;
 }
index 97f84a80b47952cee04e47d7fb10f28047805510..8ab0ce65a21883515e3f234eb5c10f765a000332 100644 (file)
@@ -3123,7 +3123,7 @@ static inline void btrfs_force_ra(struct address_space *mapping,
 }
 
 struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry);
-int btrfs_set_inode_index(struct inode *dir, u64 *index);
+int btrfs_set_inode_index(struct btrfs_inode *dir, u64 *index);
 int btrfs_unlink_inode(struct btrfs_trans_handle *trans,
                       struct btrfs_root *root,
                       struct btrfs_inode *dir, struct btrfs_inode *inode,
index c35b966335543cfa5f499e30efda9d5f6eb554af..b8a172e6561989302f0e1004fbaadeb2f6565f39 100644 (file)
@@ -4148,7 +4148,7 @@ int btrfs_alloc_data_chunk_ondemand(struct inode *inode, u64 bytes)
        /* make sure bytes are sectorsize aligned */
        bytes = ALIGN(bytes, fs_info->sectorsize);
 
-       if (btrfs_is_free_space_inode(inode)) {
+       if (btrfs_is_free_space_inode(BTRFS_I(inode))) {
                need_commit = 0;
                ASSERT(current->journal_info);
        }
@@ -5947,7 +5947,7 @@ int btrfs_delalloc_reserve_metadata(struct inode *inode, u64 num_bytes)
         * If we have a transaction open (can happen if we call truncate_block
         * from truncate), then we need FLUSH_LIMIT so we don't deadlock.
         */
-       if (btrfs_is_free_space_inode(inode)) {
+       if (btrfs_is_free_space_inode(BTRFS_I(inode))) {
                flush = BTRFS_RESERVE_NO_FLUSH;
                delalloc_lock = false;
        } else if (current->journal_info) {
index f7b9a92ad56d1757d4a73b9058b0f1e5b2f68a1a..a8a0dd21708489e0b8379ea3d51702292c140c89 100644 (file)
@@ -214,7 +214,7 @@ static int __btrfs_lookup_bio_sums(struct inode *inode, struct bio *bio,
         * read from the commit root and sidestep a nasty deadlock
         * between reading the free space cache and updating the csum tree.
         */
-       if (btrfs_is_free_space_inode(inode)) {
+       if (btrfs_is_free_space_inode(BTRFS_I(inode))) {
                path->search_commit_root = 1;
                path->skip_locking = 1;
        }
index 4e9407a014d9a49de3868711586d58325f4b4816..a465a927395e894ae88b901fbf67a828d58a0a76 100644 (file)
@@ -933,7 +933,7 @@ static noinline int cow_file_range(struct inode *inode,
        struct extent_map *em;
        int ret = 0;
 
-       if (btrfs_is_free_space_inode(inode)) {
+       if (btrfs_is_free_space_inode(BTRFS_I(inode))) {
                WARN_ON_ONCE(1);
                ret = -EINVAL;
                goto out_unlock;
@@ -1231,7 +1231,7 @@ static noinline int run_delalloc_nocow(struct inode *inode,
                return -ENOMEM;
        }
 
-       nolock = btrfs_is_free_space_inode(inode);
+       nolock = btrfs_is_free_space_inode(BTRFS_I(inode));
 
        cow_start = (u64)-1;
        cur_offset = start;
@@ -1670,7 +1670,7 @@ static void btrfs_set_bit_hook(struct inode *inode,
        if (!(state->state & EXTENT_DELALLOC) && (*bits & EXTENT_DELALLOC)) {
                struct btrfs_root *root = BTRFS_I(inode)->root;
                u64 len = state->end + 1 - state->start;
-               bool do_list = !btrfs_is_free_space_inode(inode);
+               bool do_list = !btrfs_is_free_space_inode(BTRFS_I(inode));
 
                if (*bits & EXTENT_FIRST_DELALLOC) {
                        *bits &= ~EXTENT_FIRST_DELALLOC;
@@ -1720,7 +1720,7 @@ static void btrfs_clear_bit_hook(struct inode *inode,
         */
        if ((state->state & EXTENT_DELALLOC) && (*bits & EXTENT_DELALLOC)) {
                struct btrfs_root *root = BTRFS_I(inode)->root;
-               bool do_list = !btrfs_is_free_space_inode(inode);
+               bool do_list = !btrfs_is_free_space_inode(BTRFS_I(inode));
 
                if (*bits & EXTENT_FIRST_DELALLOC) {
                        *bits &= ~EXTENT_FIRST_DELALLOC;
@@ -1854,7 +1854,7 @@ static int btrfs_submit_bio_hook(struct inode *inode, struct bio *bio,
 
        skip_sum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM;
 
-       if (btrfs_is_free_space_inode(inode))
+       if (btrfs_is_free_space_inode(BTRFS_I(inode)))
                metadata = BTRFS_WQ_ENDIO_FREE_SPACE;
 
        if (bio_op(bio) != REQ_OP_WRITE) {
@@ -2793,7 +2793,7 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
        bool nolock;
        bool truncated = false;
 
-       nolock = btrfs_is_free_space_inode(inode);
+       nolock = btrfs_is_free_space_inode(BTRFS_I(inode));
 
        if (test_bit(BTRFS_ORDERED_IOERR, &ordered_extent->flags)) {
                ret = -EIO;
@@ -2993,7 +2993,7 @@ static int btrfs_writepage_end_io_hook(struct page *page, u64 start, u64 end,
                                            end - start + 1, uptodate))
                return 0;
 
-       if (btrfs_is_free_space_inode(inode)) {
+       if (btrfs_is_free_space_inode(BTRFS_I(inode))) {
                wq = fs_info->endio_freespace_worker;
                func = btrfs_freespace_write_helper;
        } else {
@@ -3865,7 +3865,7 @@ noinline int btrfs_update_inode(struct btrfs_trans_handle *trans,
         * The data relocation inode should also be directly updated
         * without delay
         */
-       if (!btrfs_is_free_space_inode(inode)
+       if (!btrfs_is_free_space_inode(BTRFS_I(inode))
            && root->root_key.objectid != BTRFS_DATA_RELOC_TREE_OBJECTID
            && !test_bit(BTRFS_FS_LOG_RECOVERING, &fs_info->flags)) {
                btrfs_update_root_times(trans, root);
@@ -4319,7 +4319,7 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
         * for non-free space inodes and ref cows, we want to back off from
         * time to time
         */
-       if (!btrfs_is_free_space_inode(inode) &&
+       if (!btrfs_is_free_space_inode(BTRFS_I(inode)) &&
            test_bit(BTRFS_ROOT_REF_COWS, &root->state))
                be_nice = 1;
 
@@ -5180,7 +5180,7 @@ void btrfs_evict_inode(struct inode *inode)
        if (inode->i_nlink &&
            ((btrfs_root_refs(&root->root_item) != 0 &&
              root->root_key.objectid != BTRFS_ROOT_TREE_OBJECTID) ||
-            btrfs_is_free_space_inode(inode)))
+            btrfs_is_free_space_inode(BTRFS_I(inode))))
                goto no_delete;
 
        if (is_bad_inode(inode)) {
@@ -5897,7 +5897,8 @@ int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc)
        if (test_bit(BTRFS_INODE_DUMMY, &BTRFS_I(inode)->runtime_flags))
                return 0;
 
-       if (btrfs_fs_closing(root->fs_info) && btrfs_is_free_space_inode(inode))
+       if (btrfs_fs_closing(root->fs_info) &&
+                       btrfs_is_free_space_inode(BTRFS_I(inode)))
                nolock = true;
 
        if (wbc->sync_mode == WB_SYNC_ALL) {