diff options
author | David Sterba <dsterba@suse.com> | 2019-03-20 08:28:05 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2019-04-29 13:02:41 -0400 |
commit | 907877664e2d858b9344e3a46ceeb2e74425e81f (patch) | |
tree | c033c8c77e332592f0fe59f22f1ab40a3ddda838 | |
parent | 4884b8e8ebf54e1654bddd9721b9b00e69d6a148 (diff) |
btrfs: get fs_info from trans in btrfs_set_log_full_commit
We can read fs_info from the transaction and can drop it from the
parameters.
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r-- | fs/btrfs/extent-tree.c | 2 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 10 | ||||
-rw-r--r-- | fs/btrfs/tree-log.c | 19 | ||||
-rw-r--r-- | fs/btrfs/tree-log.h | 5 |
4 files changed, 17 insertions, 19 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 3dcb53c32226..174f4f0311da 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -10640,7 +10640,7 @@ int btrfs_make_block_group(struct btrfs_trans_handle *trans, u64 bytes_used, | |||
10640 | struct btrfs_block_group_cache *cache; | 10640 | struct btrfs_block_group_cache *cache; |
10641 | int ret; | 10641 | int ret; |
10642 | 10642 | ||
10643 | btrfs_set_log_full_commit(fs_info, trans); | 10643 | btrfs_set_log_full_commit(trans); |
10644 | 10644 | ||
10645 | cache = btrfs_create_block_group_cache(fs_info, chunk_offset, size); | 10645 | cache = btrfs_create_block_group_cache(fs_info, chunk_offset, size); |
10646 | if (!cache) | 10646 | if (!cache) |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index baa80d808806..b998e288366a 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -9454,7 +9454,7 @@ static int btrfs_rename_exchange(struct inode *old_dir, | |||
9454 | /* Reference for the source. */ | 9454 | /* Reference for the source. */ |
9455 | if (old_ino == BTRFS_FIRST_FREE_OBJECTID) { | 9455 | if (old_ino == BTRFS_FIRST_FREE_OBJECTID) { |
9456 | /* force full log commit if subvolume involved. */ | 9456 | /* force full log commit if subvolume involved. */ |
9457 | btrfs_set_log_full_commit(fs_info, trans); | 9457 | btrfs_set_log_full_commit(trans); |
9458 | } else { | 9458 | } else { |
9459 | btrfs_pin_log_trans(root); | 9459 | btrfs_pin_log_trans(root); |
9460 | root_log_pinned = true; | 9460 | root_log_pinned = true; |
@@ -9471,7 +9471,7 @@ static int btrfs_rename_exchange(struct inode *old_dir, | |||
9471 | /* And now for the dest. */ | 9471 | /* And now for the dest. */ |
9472 | if (new_ino == BTRFS_FIRST_FREE_OBJECTID) { | 9472 | if (new_ino == BTRFS_FIRST_FREE_OBJECTID) { |
9473 | /* force full log commit if subvolume involved. */ | 9473 | /* force full log commit if subvolume involved. */ |
9474 | btrfs_set_log_full_commit(fs_info, trans); | 9474 | btrfs_set_log_full_commit(trans); |
9475 | } else { | 9475 | } else { |
9476 | btrfs_pin_log_trans(dest); | 9476 | btrfs_pin_log_trans(dest); |
9477 | dest_log_pinned = true; | 9477 | dest_log_pinned = true; |
@@ -9607,7 +9607,7 @@ out_fail: | |||
9607 | btrfs_inode_in_log(BTRFS_I(old_inode), fs_info->generation) || | 9607 | btrfs_inode_in_log(BTRFS_I(old_inode), fs_info->generation) || |
9608 | (new_inode && | 9608 | (new_inode && |
9609 | btrfs_inode_in_log(BTRFS_I(new_inode), fs_info->generation))) | 9609 | btrfs_inode_in_log(BTRFS_I(new_inode), fs_info->generation))) |
9610 | btrfs_set_log_full_commit(fs_info, trans); | 9610 | btrfs_set_log_full_commit(trans); |
9611 | 9611 | ||
9612 | if (root_log_pinned) { | 9612 | if (root_log_pinned) { |
9613 | btrfs_end_log_trans(root); | 9613 | btrfs_end_log_trans(root); |
@@ -9793,7 +9793,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
9793 | BTRFS_I(old_inode)->dir_index = 0ULL; | 9793 | BTRFS_I(old_inode)->dir_index = 0ULL; |
9794 | if (unlikely(old_ino == BTRFS_FIRST_FREE_OBJECTID)) { | 9794 | if (unlikely(old_ino == BTRFS_FIRST_FREE_OBJECTID)) { |
9795 | /* force full log commit if subvolume involved. */ | 9795 | /* force full log commit if subvolume involved. */ |
9796 | btrfs_set_log_full_commit(fs_info, trans); | 9796 | btrfs_set_log_full_commit(trans); |
9797 | } else { | 9797 | } else { |
9798 | btrfs_pin_log_trans(root); | 9798 | btrfs_pin_log_trans(root); |
9799 | log_pinned = true; | 9799 | log_pinned = true; |
@@ -9914,7 +9914,7 @@ out_fail: | |||
9914 | btrfs_inode_in_log(BTRFS_I(old_inode), fs_info->generation) || | 9914 | btrfs_inode_in_log(BTRFS_I(old_inode), fs_info->generation) || |
9915 | (new_inode && | 9915 | (new_inode && |
9916 | btrfs_inode_in_log(BTRFS_I(new_inode), fs_info->generation))) | 9916 | btrfs_inode_in_log(BTRFS_I(new_inode), fs_info->generation))) |
9917 | btrfs_set_log_full_commit(fs_info, trans); | 9917 | btrfs_set_log_full_commit(trans); |
9918 | 9918 | ||
9919 | btrfs_end_log_trans(root); | 9919 | btrfs_end_log_trans(root); |
9920 | log_pinned = false; | 9920 | log_pinned = false; |
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index dc030f620be1..75a8e3c78fdb 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
@@ -3096,7 +3096,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, | |||
3096 | if (ret) { | 3096 | if (ret) { |
3097 | blk_finish_plug(&plug); | 3097 | blk_finish_plug(&plug); |
3098 | btrfs_abort_transaction(trans, ret); | 3098 | btrfs_abort_transaction(trans, ret); |
3099 | btrfs_set_log_full_commit(fs_info, trans); | 3099 | btrfs_set_log_full_commit(trans); |
3100 | mutex_unlock(&root->log_mutex); | 3100 | mutex_unlock(&root->log_mutex); |
3101 | goto out; | 3101 | goto out; |
3102 | } | 3102 | } |
@@ -3138,7 +3138,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, | |||
3138 | list_del_init(&root_log_ctx.list); | 3138 | list_del_init(&root_log_ctx.list); |
3139 | 3139 | ||
3140 | blk_finish_plug(&plug); | 3140 | blk_finish_plug(&plug); |
3141 | btrfs_set_log_full_commit(fs_info, trans); | 3141 | btrfs_set_log_full_commit(trans); |
3142 | 3142 | ||
3143 | if (ret != -ENOSPC) { | 3143 | if (ret != -ENOSPC) { |
3144 | btrfs_abort_transaction(trans, ret); | 3144 | btrfs_abort_transaction(trans, ret); |
@@ -3197,7 +3197,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, | |||
3197 | EXTENT_DIRTY | EXTENT_NEW); | 3197 | EXTENT_DIRTY | EXTENT_NEW); |
3198 | blk_finish_plug(&plug); | 3198 | blk_finish_plug(&plug); |
3199 | if (ret) { | 3199 | if (ret) { |
3200 | btrfs_set_log_full_commit(fs_info, trans); | 3200 | btrfs_set_log_full_commit(trans); |
3201 | btrfs_abort_transaction(trans, ret); | 3201 | btrfs_abort_transaction(trans, ret); |
3202 | mutex_unlock(&log_root_tree->log_mutex); | 3202 | mutex_unlock(&log_root_tree->log_mutex); |
3203 | goto out_wake_log_root; | 3203 | goto out_wake_log_root; |
@@ -3207,7 +3207,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, | |||
3207 | ret = btrfs_wait_tree_log_extents(log_root_tree, | 3207 | ret = btrfs_wait_tree_log_extents(log_root_tree, |
3208 | EXTENT_NEW | EXTENT_DIRTY); | 3208 | EXTENT_NEW | EXTENT_DIRTY); |
3209 | if (ret) { | 3209 | if (ret) { |
3210 | btrfs_set_log_full_commit(fs_info, trans); | 3210 | btrfs_set_log_full_commit(trans); |
3211 | mutex_unlock(&log_root_tree->log_mutex); | 3211 | mutex_unlock(&log_root_tree->log_mutex); |
3212 | goto out_wake_log_root; | 3212 | goto out_wake_log_root; |
3213 | } | 3213 | } |
@@ -3229,7 +3229,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, | |||
3229 | */ | 3229 | */ |
3230 | ret = write_all_supers(fs_info, 1); | 3230 | ret = write_all_supers(fs_info, 1); |
3231 | if (ret) { | 3231 | if (ret) { |
3232 | btrfs_set_log_full_commit(fs_info, trans); | 3232 | btrfs_set_log_full_commit(trans); |
3233 | btrfs_abort_transaction(trans, ret); | 3233 | btrfs_abort_transaction(trans, ret); |
3234 | goto out_wake_log_root; | 3234 | goto out_wake_log_root; |
3235 | } | 3235 | } |
@@ -3433,7 +3433,7 @@ fail: | |||
3433 | out_unlock: | 3433 | out_unlock: |
3434 | mutex_unlock(&dir->log_mutex); | 3434 | mutex_unlock(&dir->log_mutex); |
3435 | if (ret == -ENOSPC) { | 3435 | if (ret == -ENOSPC) { |
3436 | btrfs_set_log_full_commit(root->fs_info, trans); | 3436 | btrfs_set_log_full_commit(trans); |
3437 | ret = 0; | 3437 | ret = 0; |
3438 | } else if (ret < 0) | 3438 | } else if (ret < 0) |
3439 | btrfs_abort_transaction(trans, ret); | 3439 | btrfs_abort_transaction(trans, ret); |
@@ -3449,7 +3449,6 @@ int btrfs_del_inode_ref_in_log(struct btrfs_trans_handle *trans, | |||
3449 | const char *name, int name_len, | 3449 | const char *name, int name_len, |
3450 | struct btrfs_inode *inode, u64 dirid) | 3450 | struct btrfs_inode *inode, u64 dirid) |
3451 | { | 3451 | { |
3452 | struct btrfs_fs_info *fs_info = root->fs_info; | ||
3453 | struct btrfs_root *log; | 3452 | struct btrfs_root *log; |
3454 | u64 index; | 3453 | u64 index; |
3455 | int ret; | 3454 | int ret; |
@@ -3467,7 +3466,7 @@ int btrfs_del_inode_ref_in_log(struct btrfs_trans_handle *trans, | |||
3467 | dirid, &index); | 3466 | dirid, &index); |
3468 | mutex_unlock(&inode->log_mutex); | 3467 | mutex_unlock(&inode->log_mutex); |
3469 | if (ret == -ENOSPC) { | 3468 | if (ret == -ENOSPC) { |
3470 | btrfs_set_log_full_commit(fs_info, trans); | 3469 | btrfs_set_log_full_commit(trans); |
3471 | ret = 0; | 3470 | ret = 0; |
3472 | } else if (ret < 0 && ret != -ENOENT) | 3471 | } else if (ret < 0 && ret != -ENOENT) |
3473 | btrfs_abort_transaction(trans, ret); | 3472 | btrfs_abort_transaction(trans, ret); |
@@ -5453,7 +5452,7 @@ static bool btrfs_must_commit_transaction(struct btrfs_trans_handle *trans, | |||
5453 | * Make sure any commits to the log are forced to be full | 5452 | * Make sure any commits to the log are forced to be full |
5454 | * commits. | 5453 | * commits. |
5455 | */ | 5454 | */ |
5456 | btrfs_set_log_full_commit(fs_info, trans); | 5455 | btrfs_set_log_full_commit(trans); |
5457 | ret = true; | 5456 | ret = true; |
5458 | } | 5457 | } |
5459 | mutex_unlock(&inode->log_mutex); | 5458 | mutex_unlock(&inode->log_mutex); |
@@ -6006,7 +6005,7 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans, | |||
6006 | end_trans: | 6005 | end_trans: |
6007 | dput(old_parent); | 6006 | dput(old_parent); |
6008 | if (ret < 0) { | 6007 | if (ret < 0) { |
6009 | btrfs_set_log_full_commit(fs_info, trans); | 6008 | btrfs_set_log_full_commit(trans); |
6010 | ret = 1; | 6009 | ret = 1; |
6011 | } | 6010 | } |
6012 | 6011 | ||
diff --git a/fs/btrfs/tree-log.h b/fs/btrfs/tree-log.h index bdf63d0c4128..132e43d29034 100644 --- a/fs/btrfs/tree-log.h +++ b/fs/btrfs/tree-log.h | |||
@@ -30,10 +30,9 @@ static inline void btrfs_init_log_ctx(struct btrfs_log_ctx *ctx, | |||
30 | INIT_LIST_HEAD(&ctx->list); | 30 | INIT_LIST_HEAD(&ctx->list); |
31 | } | 31 | } |
32 | 32 | ||
33 | static inline void btrfs_set_log_full_commit(struct btrfs_fs_info *fs_info, | 33 | static inline void btrfs_set_log_full_commit(struct btrfs_trans_handle *trans) |
34 | struct btrfs_trans_handle *trans) | ||
35 | { | 34 | { |
36 | WRITE_ONCE(fs_info->last_trans_log_full_commit, trans->transid); | 35 | WRITE_ONCE(trans->fs_info->last_trans_log_full_commit, trans->transid); |
37 | } | 36 | } |
38 | 37 | ||
39 | static inline int btrfs_need_log_full_commit(struct btrfs_trans_handle *trans) | 38 | static inline int btrfs_need_log_full_commit(struct btrfs_trans_handle *trans) |