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

btrfs: Make check_parent_dirs_for_sync take btrfs_inode

Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 73f2e545
...@@ -5045,14 +5045,14 @@ static bool btrfs_must_commit_transaction(struct btrfs_trans_handle *trans, ...@@ -5045,14 +5045,14 @@ static bool btrfs_must_commit_transaction(struct btrfs_trans_handle *trans,
* a full commit is required. * a full commit is required.
*/ */
static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans, static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans,
struct inode *inode, struct btrfs_inode *inode,
struct dentry *parent, struct dentry *parent,
struct super_block *sb, struct super_block *sb,
u64 last_committed) u64 last_committed)
{ {
int ret = 0; int ret = 0;
struct dentry *old_parent = NULL; struct dentry *old_parent = NULL;
struct inode *orig_inode = inode; struct btrfs_inode *orig_inode = inode;
/* /*
* for regular files, if its inode is already on disk, we don't * for regular files, if its inode is already on disk, we don't
...@@ -5060,15 +5060,15 @@ static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans, ...@@ -5060,15 +5060,15 @@ static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans,
* we can use the last_unlink_trans field to record renames * we can use the last_unlink_trans field to record renames
* and other fun in this file. * and other fun in this file.
*/ */
if (S_ISREG(inode->i_mode) && if (S_ISREG(inode->vfs_inode.i_mode) &&
BTRFS_I(inode)->generation <= last_committed && inode->generation <= last_committed &&
BTRFS_I(inode)->last_unlink_trans <= last_committed) inode->last_unlink_trans <= last_committed)
goto out; goto out;
if (!S_ISDIR(inode->i_mode)) { if (!S_ISDIR(inode->vfs_inode.i_mode)) {
if (!parent || d_really_is_negative(parent) || sb != parent->d_sb) if (!parent || d_really_is_negative(parent) || sb != parent->d_sb)
goto out; goto out;
inode = d_inode(parent); inode = BTRFS_I(d_inode(parent));
} }
while (1) { while (1) {
...@@ -5079,10 +5079,10 @@ static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans, ...@@ -5079,10 +5079,10 @@ static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans,
* think this inode has already been logged. * think this inode has already been logged.
*/ */
if (inode != orig_inode) if (inode != orig_inode)
BTRFS_I(inode)->logged_trans = trans->transid; inode->logged_trans = trans->transid;
smp_mb(); smp_mb();
if (btrfs_must_commit_transaction(trans, BTRFS_I(inode))) { if (btrfs_must_commit_transaction(trans, inode)) {
ret = 1; ret = 1;
break; break;
} }
...@@ -5091,8 +5091,8 @@ static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans, ...@@ -5091,8 +5091,8 @@ static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans,
break; break;
if (IS_ROOT(parent)) { if (IS_ROOT(parent)) {
inode = d_inode(parent); inode = BTRFS_I(d_inode(parent));
if (btrfs_must_commit_transaction(trans, BTRFS_I(inode))) if (btrfs_must_commit_transaction(trans, inode))
ret = 1; ret = 1;
break; break;
} }
...@@ -5100,7 +5100,7 @@ static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans, ...@@ -5100,7 +5100,7 @@ static noinline int check_parent_dirs_for_sync(struct btrfs_trans_handle *trans,
parent = dget_parent(parent); parent = dget_parent(parent);
dput(old_parent); dput(old_parent);
old_parent = parent; old_parent = parent;
inode = d_inode(parent); inode = BTRFS_I(d_inode(parent));
} }
dput(old_parent); dput(old_parent);
...@@ -5429,7 +5429,7 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans, ...@@ -5429,7 +5429,7 @@ static int btrfs_log_inode_parent(struct btrfs_trans_handle *trans,
goto end_no_trans; goto end_no_trans;
} }
ret = check_parent_dirs_for_sync(trans, inode, parent, ret = check_parent_dirs_for_sync(trans, BTRFS_I(inode), parent,
sb, last_committed); sb, last_committed);
if (ret) if (ret)
goto end_no_trans; goto end_no_trans;
......
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