mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-25 05:04:09 +08:00
Btrfs: kill root from btrfs_is_free_space_inode
Since root can be fetched via BTRFS_I macro directly, we can save an args for btrfs_is_free_space_inode(). Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com>
This commit is contained in:
parent
51a8cf9d2d
commit
83eea1f1ba
@ -191,9 +191,10 @@ static inline void btrfs_i_size_write(struct inode *inode, u64 size)
|
|||||||
BTRFS_I(inode)->disk_i_size = size;
|
BTRFS_I(inode)->disk_i_size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool btrfs_is_free_space_inode(struct btrfs_root *root,
|
static inline bool btrfs_is_free_space_inode(struct inode *inode)
|
||||||
struct inode *inode)
|
|
||||||
{
|
{
|
||||||
|
struct btrfs_root *root = BTRFS_I(inode)->root;
|
||||||
|
|
||||||
if (root == root->fs_info->tree_root &&
|
if (root == root->fs_info->tree_root &&
|
||||||
btrfs_ino(inode) != BTRFS_BTREE_INODE_OBJECTID)
|
btrfs_ino(inode) != BTRFS_BTREE_INODE_OBJECTID)
|
||||||
return true;
|
return true;
|
||||||
|
@ -4444,7 +4444,7 @@ int btrfs_delalloc_reserve_metadata(struct inode *inode, u64 num_bytes)
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Need to be holding the i_mutex here if we aren't free space cache */
|
/* Need to be holding the i_mutex here if we aren't free space cache */
|
||||||
if (btrfs_is_free_space_inode(root, inode))
|
if (btrfs_is_free_space_inode(inode))
|
||||||
flush = 0;
|
flush = 0;
|
||||||
|
|
||||||
if (flush && btrfs_transaction_in_commit(root->fs_info))
|
if (flush && btrfs_transaction_in_commit(root->fs_info))
|
||||||
|
@ -183,7 +183,7 @@ static int __btrfs_lookup_bio_sums(struct btrfs_root *root,
|
|||||||
* read from the commit root and sidestep a nasty deadlock
|
* read from the commit root and sidestep a nasty deadlock
|
||||||
* between reading the free space cache and updating the csum tree.
|
* between reading the free space cache and updating the csum tree.
|
||||||
*/
|
*/
|
||||||
if (btrfs_is_free_space_inode(root, inode)) {
|
if (btrfs_is_free_space_inode(inode)) {
|
||||||
path->search_commit_root = 1;
|
path->search_commit_root = 1;
|
||||||
path->skip_locking = 1;
|
path->skip_locking = 1;
|
||||||
}
|
}
|
||||||
|
@ -825,7 +825,7 @@ static noinline int cow_file_range(struct inode *inode,
|
|||||||
struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree;
|
struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
BUG_ON(btrfs_is_free_space_inode(root, inode));
|
BUG_ON(btrfs_is_free_space_inode(inode));
|
||||||
trans = btrfs_join_transaction(root);
|
trans = btrfs_join_transaction(root);
|
||||||
if (IS_ERR(trans)) {
|
if (IS_ERR(trans)) {
|
||||||
extent_clear_unlock_delalloc(inode,
|
extent_clear_unlock_delalloc(inode,
|
||||||
@ -1153,7 +1153,7 @@ static noinline int run_delalloc_nocow(struct inode *inode,
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
nolock = btrfs_is_free_space_inode(root, inode);
|
nolock = btrfs_is_free_space_inode(inode);
|
||||||
|
|
||||||
if (nolock)
|
if (nolock)
|
||||||
trans = btrfs_join_transaction_nolock(root);
|
trans = btrfs_join_transaction_nolock(root);
|
||||||
@ -1466,7 +1466,7 @@ static void btrfs_set_bit_hook(struct inode *inode,
|
|||||||
if (!(state->state & EXTENT_DELALLOC) && (*bits & EXTENT_DELALLOC)) {
|
if (!(state->state & EXTENT_DELALLOC) && (*bits & EXTENT_DELALLOC)) {
|
||||||
struct btrfs_root *root = BTRFS_I(inode)->root;
|
struct btrfs_root *root = BTRFS_I(inode)->root;
|
||||||
u64 len = state->end + 1 - state->start;
|
u64 len = state->end + 1 - state->start;
|
||||||
bool do_list = !btrfs_is_free_space_inode(root, inode);
|
bool do_list = !btrfs_is_free_space_inode(inode);
|
||||||
|
|
||||||
if (*bits & EXTENT_FIRST_DELALLOC) {
|
if (*bits & EXTENT_FIRST_DELALLOC) {
|
||||||
*bits &= ~EXTENT_FIRST_DELALLOC;
|
*bits &= ~EXTENT_FIRST_DELALLOC;
|
||||||
@ -1501,7 +1501,7 @@ static void btrfs_clear_bit_hook(struct inode *inode,
|
|||||||
if ((state->state & EXTENT_DELALLOC) && (*bits & EXTENT_DELALLOC)) {
|
if ((state->state & EXTENT_DELALLOC) && (*bits & EXTENT_DELALLOC)) {
|
||||||
struct btrfs_root *root = BTRFS_I(inode)->root;
|
struct btrfs_root *root = BTRFS_I(inode)->root;
|
||||||
u64 len = state->end + 1 - state->start;
|
u64 len = state->end + 1 - state->start;
|
||||||
bool do_list = !btrfs_is_free_space_inode(root, inode);
|
bool do_list = !btrfs_is_free_space_inode(inode);
|
||||||
|
|
||||||
if (*bits & EXTENT_FIRST_DELALLOC) {
|
if (*bits & EXTENT_FIRST_DELALLOC) {
|
||||||
*bits &= ~EXTENT_FIRST_DELALLOC;
|
*bits &= ~EXTENT_FIRST_DELALLOC;
|
||||||
@ -1612,7 +1612,7 @@ static int btrfs_submit_bio_hook(struct inode *inode, int rw, struct bio *bio,
|
|||||||
|
|
||||||
skip_sum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM;
|
skip_sum = BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM;
|
||||||
|
|
||||||
if (btrfs_is_free_space_inode(root, inode))
|
if (btrfs_is_free_space_inode(inode))
|
||||||
metadata = 2;
|
metadata = 2;
|
||||||
|
|
||||||
if (!(rw & REQ_WRITE)) {
|
if (!(rw & REQ_WRITE)) {
|
||||||
@ -1869,7 +1869,7 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
|
|||||||
int ret;
|
int ret;
|
||||||
bool nolock;
|
bool nolock;
|
||||||
|
|
||||||
nolock = btrfs_is_free_space_inode(root, inode);
|
nolock = btrfs_is_free_space_inode(inode);
|
||||||
|
|
||||||
if (test_bit(BTRFS_ORDERED_IOERR, &ordered_extent->flags)) {
|
if (test_bit(BTRFS_ORDERED_IOERR, &ordered_extent->flags)) {
|
||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
@ -2007,7 +2007,7 @@ static int btrfs_writepage_end_io_hook(struct page *page, u64 start, u64 end,
|
|||||||
ordered_extent->work.func = finish_ordered_fn;
|
ordered_extent->work.func = finish_ordered_fn;
|
||||||
ordered_extent->work.flags = 0;
|
ordered_extent->work.flags = 0;
|
||||||
|
|
||||||
if (btrfs_is_free_space_inode(root, inode))
|
if (btrfs_is_free_space_inode(inode))
|
||||||
workers = &root->fs_info->endio_freespace_worker;
|
workers = &root->fs_info->endio_freespace_worker;
|
||||||
else
|
else
|
||||||
workers = &root->fs_info->endio_write_workers;
|
workers = &root->fs_info->endio_write_workers;
|
||||||
@ -2732,7 +2732,7 @@ noinline int btrfs_update_inode(struct btrfs_trans_handle *trans,
|
|||||||
* The data relocation inode should also be directly updated
|
* The data relocation inode should also be directly updated
|
||||||
* without delay
|
* without delay
|
||||||
*/
|
*/
|
||||||
if (!btrfs_is_free_space_inode(root, inode)
|
if (!btrfs_is_free_space_inode(inode)
|
||||||
&& root->root_key.objectid != BTRFS_DATA_RELOC_TREE_OBJECTID) {
|
&& root->root_key.objectid != BTRFS_DATA_RELOC_TREE_OBJECTID) {
|
||||||
ret = btrfs_delayed_update_inode(trans, root, inode);
|
ret = btrfs_delayed_update_inode(trans, root, inode);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
@ -3743,7 +3743,7 @@ void btrfs_evict_inode(struct inode *inode)
|
|||||||
|
|
||||||
truncate_inode_pages(&inode->i_data, 0);
|
truncate_inode_pages(&inode->i_data, 0);
|
||||||
if (inode->i_nlink && (btrfs_root_refs(&root->root_item) != 0 ||
|
if (inode->i_nlink && (btrfs_root_refs(&root->root_item) != 0 ||
|
||||||
btrfs_is_free_space_inode(root, inode)))
|
btrfs_is_free_space_inode(inode)))
|
||||||
goto no_delete;
|
goto no_delete;
|
||||||
|
|
||||||
if (is_bad_inode(inode)) {
|
if (is_bad_inode(inode)) {
|
||||||
@ -4457,7 +4457,7 @@ int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc)
|
|||||||
if (test_bit(BTRFS_INODE_DUMMY, &BTRFS_I(inode)->runtime_flags))
|
if (test_bit(BTRFS_INODE_DUMMY, &BTRFS_I(inode)->runtime_flags))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (btrfs_fs_closing(root->fs_info) && btrfs_is_free_space_inode(root, inode))
|
if (btrfs_fs_closing(root->fs_info) && btrfs_is_free_space_inode(inode))
|
||||||
nolock = true;
|
nolock = true;
|
||||||
|
|
||||||
if (wbc->sync_mode == WB_SYNC_ALL) {
|
if (wbc->sync_mode == WB_SYNC_ALL) {
|
||||||
@ -7051,7 +7051,7 @@ int btrfs_drop_inode(struct inode *inode)
|
|||||||
struct btrfs_root *root = BTRFS_I(inode)->root;
|
struct btrfs_root *root = BTRFS_I(inode)->root;
|
||||||
|
|
||||||
if (btrfs_root_refs(&root->root_item) == 0 &&
|
if (btrfs_root_refs(&root->root_item) == 0 &&
|
||||||
!btrfs_is_free_space_inode(root, inode))
|
!btrfs_is_free_space_inode(inode))
|
||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
return generic_drop_inode(inode);
|
return generic_drop_inode(inode);
|
||||||
|
Loading…
Reference in New Issue
Block a user