aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/btrfs/btrfs_inode.h5
-rw-r--r--fs/btrfs/extent-tree.c2
-rw-r--r--fs/btrfs/file-item.c2
-rw-r--r--fs/btrfs/inode.c22
4 files changed, 16 insertions, 15 deletions
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
index b168238bcb13..21b8cfe08e95 100644
--- a/fs/btrfs/btrfs_inode.h
+++ b/fs/btrfs/btrfs_inode.h
@@ -191,9 +191,10 @@ static inline void btrfs_i_size_write(struct inode *inode, u64 size)
191 BTRFS_I(inode)->disk_i_size = size; 191 BTRFS_I(inode)->disk_i_size = size;
192} 192}
193 193
194static inline bool btrfs_is_free_space_inode(struct btrfs_root *root, 194static inline bool btrfs_is_free_space_inode(struct inode *inode)
195 struct inode *inode)
196{ 195{
196 struct btrfs_root *root = BTRFS_I(inode)->root;
197
197 if (root == root->fs_info->tree_root && 198 if (root == root->fs_info->tree_root &&
198 btrfs_ino(inode) != BTRFS_BTREE_INODE_OBJECTID) 199 btrfs_ino(inode) != BTRFS_BTREE_INODE_OBJECTID)
199 return true; 200 return true;
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 5e552f9cc5be..d1ebd2a06116 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -4444,7 +4444,7 @@ int btrfs_delalloc_reserve_metadata(struct inode *inode, u64 num_bytes)
4444 int ret; 4444 int ret;
4445 4445
4446 /* Need to be holding the i_mutex here if we aren't free space cache */ 4446 /* Need to be holding the i_mutex here if we aren't free space cache */
4447 if (btrfs_is_free_space_inode(root, inode)) 4447 if (btrfs_is_free_space_inode(inode))
4448 flush = 0; 4448 flush = 0;
4449 4449
4450 if (flush && btrfs_transaction_in_commit(root->fs_info)) 4450 if (flush && btrfs_transaction_in_commit(root->fs_info))
diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c
index 863c34d111b5..b45b9de0c21d 100644
--- a/fs/btrfs/file-item.c
+++ b/fs/btrfs/file-item.c
@@ -183,7 +183,7 @@ static int __btrfs_lookup_bio_sums(struct btrfs_root *root,
183 * read from the commit root and sidestep a nasty deadlock 183 * read from the commit root and sidestep a nasty deadlock
184 * between reading the free space cache and updating the csum tree. 184 * between reading the free space cache and updating the csum tree.
185 */ 185 */
186 if (btrfs_is_free_space_inode(root, inode)) { 186 if (btrfs_is_free_space_inode(inode)) {
187 path->search_commit_root = 1; 187 path->search_commit_root = 1;
188 path->skip_locking = 1; 188 path->skip_locking = 1;
189 } 189 }
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 18f1b44d1610..321c415dea7f 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -825,7 +825,7 @@ static noinline int cow_file_range(struct inode *inode,
825 struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree; 825 struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree;
826 int ret = 0; 826 int ret = 0;
827 827
828 BUG_ON(btrfs_is_free_space_inode(root, inode)); 828 BUG_ON(btrfs_is_free_space_inode(inode));
829 trans = btrfs_join_transaction(root); 829 trans = btrfs_join_transaction(root);
830 if (IS_ERR(trans)) { 830 if (IS_ERR(trans)) {
831 extent_clear_unlock_delalloc(inode, 831 extent_clear_unlock_delalloc(inode,
@@ -1153,7 +1153,7 @@ static noinline int run_delalloc_nocow(struct inode *inode,
1153 return -ENOMEM; 1153 return -ENOMEM;
1154 } 1154 }
1155 1155
1156 nolock = btrfs_is_free_space_inode(root, inode); 1156 nolock = btrfs_is_free_space_inode(inode);
1157 1157
1158 if (nolock) 1158 if (nolock)
1159 trans = btrfs_join_transaction_nolock(root); 1159 trans = btrfs_join_transaction_nolock(root);
@@ -1466,7 +1466,7 @@ static void btrfs_set_bit_hook(struct inode *inode,
1466 if (!(state->state & EXTENT_DELALLOC) && (*bits & EXTENT_DELALLOC)) { 1466 if (!(state->state & EXTENT_DELALLOC) && (*bits & EXTENT_DELALLOC)) {
1467 struct btrfs_root *root = BTRFS_I(inode)->root; 1467 struct btrfs_root *root = BTRFS_I(inode)->root;
1468 u64 len = state->end + 1 - state->start; 1468 u64 len = state->end + 1 - state->start;
1469 bool do_list = !btrfs_is_free_space_inode(root, inode); 1469 bool do_list = !btrfs_is_free_space_inode(inode);
1470 1470
1471 if (*bits & EXTENT_FIRST_DELALLOC) { 1471 if (*bits & EXTENT_FIRST_DELALLOC) {
1472 *bits &= ~EXTENT_FIRST_DELALLOC; 1472 *bits &= ~EXTENT_FIRST_DELALLOC;
@@ -1501,7 +1501,7 @@ static void btrfs_clear_bit_hook(struct inode *inode,
1501 if ((state->state & EXTENT_DELALLOC) && (*bits & EXTENT_DELALLOC)) { 1501 if ((state->state & EXTENT_DELALLOC) && (*bits & EXTENT_DELALLOC)) {
1502 struct btrfs_root *root = BTRFS_I(inode)->root; 1502 struct btrfs_root *root = BTRFS_I(inode)->root;
1503 u64 len = state->end + 1 - state->start; 1503 u64 len = state->end + 1 - state->start;
1504 bool do_list = !btrfs_is_free_space_inode(root, inode); 1504 bool do_list = !btrfs_is_free_space_inode(inode);
1505 1505
1506 if (*bits & EXTENT_FIRST_DELALLOC) { 1506 if (*bits & EXTENT_FIRST_DELALLOC) {
1507 *bits &= ~EXTENT_FIRST_DELALLOC; 1507 *bits &= ~EXTENT_FIRST_DELALLOC;
@@ -1612,7 +1612,7 @@ static int btrfs_submit_bio_hook(struct inode *inode, int rw, struct bio *bio,
1612 1612
1613 skip_sum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM; 1613 skip_sum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM;
1614 1614
1615 if (btrfs_is_free_space_inode(root, inode)) 1615 if (btrfs_is_free_space_inode(inode))
1616 metadata = 2; 1616 metadata = 2;
1617 1617
1618 if (!(rw & REQ_WRITE)) { 1618 if (!(rw & REQ_WRITE)) {
@@ -1869,7 +1869,7 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
1869 int ret; 1869 int ret;
1870 bool nolock; 1870 bool nolock;
1871 1871
1872 nolock = btrfs_is_free_space_inode(root, inode); 1872 nolock = btrfs_is_free_space_inode(inode);
1873 1873
1874 if (test_bit(BTRFS_ORDERED_IOERR, &ordered_extent->flags)) { 1874 if (test_bit(BTRFS_ORDERED_IOERR, &ordered_extent->flags)) {
1875 ret = -EIO; 1875 ret = -EIO;
@@ -2007,7 +2007,7 @@ static int btrfs_writepage_end_io_hook(struct page *page, u64 start, u64 end,
2007 ordered_extent->work.func = finish_ordered_fn; 2007 ordered_extent->work.func = finish_ordered_fn;
2008 ordered_extent->work.flags = 0; 2008 ordered_extent->work.flags = 0;
2009 2009
2010 if (btrfs_is_free_space_inode(root, inode)) 2010 if (btrfs_is_free_space_inode(inode))
2011 workers = &root->fs_info->endio_freespace_worker; 2011 workers = &root->fs_info->endio_freespace_worker;
2012 else 2012 else
2013 workers = &root->fs_info->endio_write_workers; 2013 workers = &root->fs_info->endio_write_workers;
@@ -2732,7 +2732,7 @@ noinline int btrfs_update_inode(struct btrfs_trans_handle *trans,
2732 * The data relocation inode should also be directly updated 2732 * The data relocation inode should also be directly updated
2733 * without delay 2733 * without delay
2734 */ 2734 */
2735 if (!btrfs_is_free_space_inode(root, inode) 2735 if (!btrfs_is_free_space_inode(inode)
2736 && root->root_key.objectid != BTRFS_DATA_RELOC_TREE_OBJECTID) { 2736 && root->root_key.objectid != BTRFS_DATA_RELOC_TREE_OBJECTID) {
2737 ret = btrfs_delayed_update_inode(trans, root, inode); 2737 ret = btrfs_delayed_update_inode(trans, root, inode);
2738 if (!ret) 2738 if (!ret)
@@ -3743,7 +3743,7 @@ void btrfs_evict_inode(struct inode *inode)
3743 3743
3744 truncate_inode_pages(&inode->i_data, 0); 3744 truncate_inode_pages(&inode->i_data, 0);
3745 if (inode->i_nlink && (btrfs_root_refs(&root->root_item) != 0 || 3745 if (inode->i_nlink && (btrfs_root_refs(&root->root_item) != 0 ||
3746 btrfs_is_free_space_inode(root, inode))) 3746 btrfs_is_free_space_inode(inode)))
3747 goto no_delete; 3747 goto no_delete;
3748 3748
3749 if (is_bad_inode(inode)) { 3749 if (is_bad_inode(inode)) {
@@ -4457,7 +4457,7 @@ int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc)
4457 if (test_bit(BTRFS_INODE_DUMMY, &BTRFS_I(inode)->runtime_flags)) 4457 if (test_bit(BTRFS_INODE_DUMMY, &BTRFS_I(inode)->runtime_flags))
4458 return 0; 4458 return 0;
4459 4459
4460 if (btrfs_fs_closing(root->fs_info) && btrfs_is_free_space_inode(root, inode)) 4460 if (btrfs_fs_closing(root->fs_info) && btrfs_is_free_space_inode(inode))
4461 nolock = true; 4461 nolock = true;
4462 4462
4463 if (wbc->sync_mode == WB_SYNC_ALL) { 4463 if (wbc->sync_mode == WB_SYNC_ALL) {
@@ -7051,7 +7051,7 @@ int btrfs_drop_inode(struct inode *inode)
7051 struct btrfs_root *root = BTRFS_I(inode)->root; 7051 struct btrfs_root *root = BTRFS_I(inode)->root;
7052 7052
7053 if (btrfs_root_refs(&root->root_item) == 0 && 7053 if (btrfs_root_refs(&root->root_item) == 0 &&
7054 !btrfs_is_free_space_inode(root, inode)) 7054 !btrfs_is_free_space_inode(inode))
7055 return 1; 7055 return 1;
7056 else 7056 else
7057 return generic_drop_inode(inode); 7057 return generic_drop_inode(inode);