Commit ab1717b2 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: Make btrfs_must_commit_transaction take btrfs_inode

Signed-off-by: default avatarNikolay Borisov <n.borisov.lkml@gmail.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent f5cc7b80
...@@ -5021,13 +5021,13 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans, ...@@ -5021,13 +5021,13 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
* we logged the inode or it might have also done the unlink). * we logged the inode or it might have also done the unlink).
*/ */
static bool btrfs_must_commit_transaction(struct btrfs_trans_handle *trans, static bool btrfs_must_commit_transaction(struct btrfs_trans_handle *trans,
struct inode *inode) struct btrfs_inode *inode)
{ {
struct btrfs_fs_info *fs_info = BTRFS_I(inode)->root->fs_info; struct btrfs_fs_info *fs_info = inode->root->fs_info;
bool ret = false; bool ret = false;
mutex_lock(&BTRFS_I(inode)->log_mutex); mutex_lock(&inode->log_mutex);
if (BTRFS_I(inode)->last_unlink_trans > fs_info->last_trans_committed) { if (inode->last_unlink_trans > fs_info->last_trans_committed) {
/* /*
* Make sure any commits to the log are forced to be full * Make sure any commits to the log are forced to be full
* commits. * commits.
...@@ -5035,7 +5035,7 @@ static bool btrfs_must_commit_transaction(struct btrfs_trans_handle *trans, ...@@ -5035,7 +5035,7 @@ static bool btrfs_must_commit_transaction(struct btrfs_trans_handle *trans,
btrfs_set_log_full_commit(fs_info, trans); btrfs_set_log_full_commit(fs_info, trans);
ret = true; ret = true;
} }
mutex_unlock(&BTRFS_I(inode)->log_mutex); mutex_unlock(&inode->log_mutex);
return ret; return ret;
} }
...@@ -5084,7 +5084,7 @@ static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans, ...@@ -5084,7 +5084,7 @@ static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans,
BTRFS_I(inode)->logged_trans = trans->transid; BTRFS_I(inode)->logged_trans = trans->transid;
smp_mb(); smp_mb();
if (btrfs_must_commit_transaction(trans, inode)) { if (btrfs_must_commit_transaction(trans, BTRFS_I(inode))) {
ret = 1; ret = 1;
break; break;
} }
...@@ -5094,7 +5094,7 @@ static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans, ...@@ -5094,7 +5094,7 @@ static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans,
if (IS_ROOT(parent)) { if (IS_ROOT(parent)) {
inode = d_inode(parent); inode = d_inode(parent);
if (btrfs_must_commit_transaction(trans, inode)) if (btrfs_must_commit_transaction(trans, BTRFS_I(inode)))
ret = 1; ret = 1;
break; break;
} }
...@@ -5248,7 +5248,7 @@ static int log_new_dir_dentries(struct btrfs_trans_handle *trans, ...@@ -5248,7 +5248,7 @@ static int log_new_dir_dentries(struct btrfs_trans_handle *trans,
ret = btrfs_log_inode(trans, root, di_inode, ret = btrfs_log_inode(trans, root, di_inode,
log_mode, 0, LLONG_MAX, ctx); log_mode, 0, LLONG_MAX, ctx);
if (!ret && if (!ret &&
btrfs_must_commit_transaction(trans, di_inode)) btrfs_must_commit_transaction(trans, BTRFS_I(di_inode)))
ret = 1; ret = 1;
iput(di_inode); iput(di_inode);
if (ret) if (ret)
...@@ -5368,7 +5368,7 @@ static int btrfs_log_all_parents(struct btrfs_trans_handle *trans, ...@@ -5368,7 +5368,7 @@ static int btrfs_log_all_parents(struct btrfs_trans_handle *trans,
ret = btrfs_log_inode(trans, root, dir_inode, ret = btrfs_log_inode(trans, root, dir_inode,
LOG_INODE_ALL, 0, LLONG_MAX, ctx); LOG_INODE_ALL, 0, LLONG_MAX, ctx);
if (!ret && if (!ret &&
btrfs_must_commit_transaction(trans, dir_inode)) btrfs_must_commit_transaction(trans, BTRFS_I(dir_inode)))
ret = 1; ret = 1;
if (!ret && ctx && ctx->log_new_dentries) if (!ret && ctx && ctx->log_new_dentries)
ret = log_new_dir_dentries(trans, root, ret = log_new_dir_dentries(trans, root,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment