forked from luck/tmp_suning_uos_patched
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>
This commit is contained in:
parent
4884b8e8eb
commit
907877664e
|
@ -10640,7 +10640,7 @@ int btrfs_make_block_group(struct btrfs_trans_handle *trans, u64 bytes_used,
|
|||
struct btrfs_block_group_cache *cache;
|
||||
int ret;
|
||||
|
||||
btrfs_set_log_full_commit(fs_info, trans);
|
||||
btrfs_set_log_full_commit(trans);
|
||||
|
||||
cache = btrfs_create_block_group_cache(fs_info, chunk_offset, size);
|
||||
if (!cache)
|
||||
|
|
|
@ -9454,7 +9454,7 @@ static int btrfs_rename_exchange(struct inode *old_dir,
|
|||
/* Reference for the source. */
|
||||
if (old_ino == BTRFS_FIRST_FREE_OBJECTID) {
|
||||
/* force full log commit if subvolume involved. */
|
||||
btrfs_set_log_full_commit(fs_info, trans);
|
||||
btrfs_set_log_full_commit(trans);
|
||||
} else {
|
||||
btrfs_pin_log_trans(root);
|
||||
root_log_pinned = true;
|
||||
|
@ -9471,7 +9471,7 @@ static int btrfs_rename_exchange(struct inode *old_dir,
|
|||
/* And now for the dest. */
|
||||
if (new_ino == BTRFS_FIRST_FREE_OBJECTID) {
|
||||
/* force full log commit if subvolume involved. */
|
||||
btrfs_set_log_full_commit(fs_info, trans);
|
||||
btrfs_set_log_full_commit(trans);
|
||||
} else {
|
||||
btrfs_pin_log_trans(dest);
|
||||
dest_log_pinned = true;
|
||||
|
@ -9607,7 +9607,7 @@ static int btrfs_rename_exchange(struct inode *old_dir,
|
|||
btrfs_inode_in_log(BTRFS_I(old_inode), fs_info->generation) ||
|
||||
(new_inode &&
|
||||
btrfs_inode_in_log(BTRFS_I(new_inode), fs_info->generation)))
|
||||
btrfs_set_log_full_commit(fs_info, trans);
|
||||
btrfs_set_log_full_commit(trans);
|
||||
|
||||
if (root_log_pinned) {
|
||||
btrfs_end_log_trans(root);
|
||||
|
@ -9793,7 +9793,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
|||
BTRFS_I(old_inode)->dir_index = 0ULL;
|
||||
if (unlikely(old_ino == BTRFS_FIRST_FREE_OBJECTID)) {
|
||||
/* force full log commit if subvolume involved. */
|
||||
btrfs_set_log_full_commit(fs_info, trans);
|
||||
btrfs_set_log_full_commit(trans);
|
||||
} else {
|
||||
btrfs_pin_log_trans(root);
|
||||
log_pinned = true;
|
||||
|
@ -9914,7 +9914,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
|||
btrfs_inode_in_log(BTRFS_I(old_inode), fs_info->generation) ||
|
||||
(new_inode &&
|
||||
btrfs_inode_in_log(BTRFS_I(new_inode), fs_info->generation)))
|
||||
btrfs_set_log_full_commit(fs_info, trans);
|
||||
btrfs_set_log_full_commit(trans);
|
||||
|
||||
btrfs_end_log_trans(root);
|
||||
log_pinned = false;
|
||||
|
|
|
@ -3096,7 +3096,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
|
|||
if (ret) {
|
||||
blk_finish_plug(&plug);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
btrfs_set_log_full_commit(fs_info, trans);
|
||||
btrfs_set_log_full_commit(trans);
|
||||
mutex_unlock(&root->log_mutex);
|
||||
goto out;
|
||||
}
|
||||
|
@ -3138,7 +3138,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
|
|||
list_del_init(&root_log_ctx.list);
|
||||
|
||||
blk_finish_plug(&plug);
|
||||
btrfs_set_log_full_commit(fs_info, trans);
|
||||
btrfs_set_log_full_commit(trans);
|
||||
|
||||
if (ret != -ENOSPC) {
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
|
@ -3197,7 +3197,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
|
|||
EXTENT_DIRTY | EXTENT_NEW);
|
||||
blk_finish_plug(&plug);
|
||||
if (ret) {
|
||||
btrfs_set_log_full_commit(fs_info, trans);
|
||||
btrfs_set_log_full_commit(trans);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
mutex_unlock(&log_root_tree->log_mutex);
|
||||
goto out_wake_log_root;
|
||||
|
@ -3207,7 +3207,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
|
|||
ret = btrfs_wait_tree_log_extents(log_root_tree,
|
||||
EXTENT_NEW | EXTENT_DIRTY);
|
||||
if (ret) {
|
||||
btrfs_set_log_full_commit(fs_info, trans);
|
||||
btrfs_set_log_full_commit(trans);
|
||||
mutex_unlock(&log_root_tree->log_mutex);
|
||||
goto out_wake_log_root;
|
||||
}
|
||||
|
@ -3229,7 +3229,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
|
|||
*/
|
||||
ret = write_all_supers(fs_info, 1);
|
||||
if (ret) {
|
||||
btrfs_set_log_full_commit(fs_info, trans);
|
||||
btrfs_set_log_full_commit(trans);
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
goto out_wake_log_root;
|
||||
}
|
||||
|
@ -3433,7 +3433,7 @@ int btrfs_del_dir_entries_in_log(struct btrfs_trans_handle *trans,
|
|||
out_unlock:
|
||||
mutex_unlock(&dir->log_mutex);
|
||||
if (ret == -ENOSPC) {
|
||||
btrfs_set_log_full_commit(root->fs_info, trans);
|
||||
btrfs_set_log_full_commit(trans);
|
||||
ret = 0;
|
||||
} else if (ret < 0)
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
|
@ -3449,7 +3449,6 @@ int btrfs_del_inode_ref_in_log(struct btrfs_trans_handle *trans,
|
|||
const char *name, int name_len,
|
||||
struct btrfs_inode *inode, u64 dirid)
|
||||
{
|
||||
struct btrfs_fs_info *fs_info = root->fs_info;
|
||||
struct btrfs_root *log;
|
||||
u64 index;
|
||||
int ret;
|
||||
|
@ -3467,7 +3466,7 @@ int btrfs_del_inode_ref_in_log(struct btrfs_trans_handle *trans,
|
|||
dirid, &index);
|
||||
mutex_unlock(&inode->log_mutex);
|
||||
if (ret == -ENOSPC) {
|
||||
btrfs_set_log_full_commit(fs_info, trans);
|
||||
btrfs_set_log_full_commit(trans);
|
||||
ret = 0;
|
||||
} else if (ret < 0 && ret != -ENOENT)
|
||||
btrfs_abort_transaction(trans, ret);
|
||||
|
@ -5453,7 +5452,7 @@ static bool btrfs_must_commit_transaction(struct btrfs_trans_handle *trans,
|
|||
* Make sure any commits to the log are forced to be full
|
||||
* commits.
|
||||
*/
|
||||
btrfs_set_log_full_commit(fs_info, trans);
|
||||
btrfs_set_log_full_commit(trans);
|
||||
ret = true;
|
||||
}
|
||||
mutex_unlock(&inode->log_mutex);
|
||||
|
@ -6006,7 +6005,7 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans,
|
|||
end_trans:
|
||||
dput(old_parent);
|
||||
if (ret < 0) {
|
||||
btrfs_set_log_full_commit(fs_info, trans);
|
||||
btrfs_set_log_full_commit(trans);
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,10 +30,9 @@ static inline void btrfs_init_log_ctx(struct btrfs_log_ctx *ctx,
|
|||
INIT_LIST_HEAD(&ctx->list);
|
||||
}
|
||||
|
||||
static inline void btrfs_set_log_full_commit(struct btrfs_fs_info *fs_info,
|
||||
struct btrfs_trans_handle *trans)
|
||||
static inline void btrfs_set_log_full_commit(struct btrfs_trans_handle *trans)
|
||||
{
|
||||
WRITE_ONCE(fs_info->last_trans_log_full_commit, trans->transid);
|
||||
WRITE_ONCE(trans->fs_info->last_trans_log_full_commit, trans->transid);
|
||||
}
|
||||
|
||||
static inline int btrfs_need_log_full_commit(struct btrfs_trans_handle *trans)
|
||||
|
|
Loading…
Reference in New Issue
Block a user