btrfs: Make btrfs_log_new_name take btrfs_inode
Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
0f8939b8ac
commit
9ca5fbfbb9
|
@ -6597,7 +6597,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
d_instantiate(dentry, inode);
|
d_instantiate(dentry, inode);
|
||||||
btrfs_log_new_name(trans, inode, NULL, parent);
|
btrfs_log_new_name(trans, BTRFS_I(inode), NULL, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
btrfs_balance_delayed_items(fs_info);
|
btrfs_balance_delayed_items(fs_info);
|
||||||
|
@ -9654,13 +9654,13 @@ static int btrfs_rename_exchange(struct inode *old_dir,
|
||||||
|
|
||||||
if (root_log_pinned) {
|
if (root_log_pinned) {
|
||||||
parent = new_dentry->d_parent;
|
parent = new_dentry->d_parent;
|
||||||
btrfs_log_new_name(trans, old_inode, old_dir, parent);
|
btrfs_log_new_name(trans, BTRFS_I(old_inode), BTRFS_I(old_dir), parent);
|
||||||
btrfs_end_log_trans(root);
|
btrfs_end_log_trans(root);
|
||||||
root_log_pinned = false;
|
root_log_pinned = false;
|
||||||
}
|
}
|
||||||
if (dest_log_pinned) {
|
if (dest_log_pinned) {
|
||||||
parent = old_dentry->d_parent;
|
parent = old_dentry->d_parent;
|
||||||
btrfs_log_new_name(trans, new_inode, new_dir, parent);
|
btrfs_log_new_name(trans, BTRFS_I(new_inode), BTRFS_I(new_dir), parent);
|
||||||
btrfs_end_log_trans(dest);
|
btrfs_end_log_trans(dest);
|
||||||
dest_log_pinned = false;
|
dest_log_pinned = false;
|
||||||
}
|
}
|
||||||
|
@ -9926,7 +9926,7 @@ static int btrfs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||||
if (log_pinned) {
|
if (log_pinned) {
|
||||||
struct dentry *parent = new_dentry->d_parent;
|
struct dentry *parent = new_dentry->d_parent;
|
||||||
|
|
||||||
btrfs_log_new_name(trans, old_inode, old_dir, parent);
|
btrfs_log_new_name(trans, BTRFS_I(old_inode), BTRFS_I(old_dir), parent);
|
||||||
btrfs_end_log_trans(root);
|
btrfs_end_log_trans(root);
|
||||||
log_pinned = false;
|
log_pinned = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5809,30 +5809,28 @@ void btrfs_record_snapshot_destroy(struct btrfs_trans_handle *trans,
|
||||||
* full transaction commit is required.
|
* full transaction commit is required.
|
||||||
*/
|
*/
|
||||||
int btrfs_log_new_name(struct btrfs_trans_handle *trans,
|
int btrfs_log_new_name(struct btrfs_trans_handle *trans,
|
||||||
struct inode *inode, struct inode *old_dir,
|
struct btrfs_inode *inode, struct btrfs_inode *old_dir,
|
||||||
struct dentry *parent)
|
struct dentry *parent)
|
||||||
{
|
{
|
||||||
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
|
struct btrfs_fs_info *fs_info = btrfs_sb(inode->vfs_inode.i_sb);
|
||||||
struct btrfs_root * root = BTRFS_I(inode)->root;
|
struct btrfs_root * root = inode->root;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* this will force the logging code to walk the dentry chain
|
* this will force the logging code to walk the dentry chain
|
||||||
* up for the file
|
* up for the file
|
||||||
*/
|
*/
|
||||||
if (S_ISREG(inode->i_mode))
|
if (S_ISREG(inode->vfs_inode.i_mode))
|
||||||
BTRFS_I(inode)->last_unlink_trans = trans->transid;
|
inode->last_unlink_trans = trans->transid;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if this inode hasn't been logged and directory we're renaming it
|
* if this inode hasn't been logged and directory we're renaming it
|
||||||
* from hasn't been logged, we don't need to log it
|
* from hasn't been logged, we don't need to log it
|
||||||
*/
|
*/
|
||||||
if (BTRFS_I(inode)->logged_trans <=
|
if (inode->logged_trans <= fs_info->last_trans_committed &&
|
||||||
fs_info->last_trans_committed &&
|
(!old_dir || old_dir->logged_trans <= fs_info->last_trans_committed))
|
||||||
(!old_dir || BTRFS_I(old_dir)->logged_trans <=
|
|
||||||
fs_info->last_trans_committed))
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return btrfs_log_inode_parent(trans, root, inode, parent, 0,
|
return btrfs_log_inode_parent(trans, root, &inode->vfs_inode, parent, 0,
|
||||||
LLONG_MAX, 1, NULL);
|
LLONG_MAX, 1, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,6 @@ void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans,
|
||||||
void btrfs_record_snapshot_destroy(struct btrfs_trans_handle *trans,
|
void btrfs_record_snapshot_destroy(struct btrfs_trans_handle *trans,
|
||||||
struct btrfs_inode *dir);
|
struct btrfs_inode *dir);
|
||||||
int btrfs_log_new_name(struct btrfs_trans_handle *trans,
|
int btrfs_log_new_name(struct btrfs_trans_handle *trans,
|
||||||
struct inode *inode, struct inode *old_dir,
|
struct btrfs_inode *inode, struct btrfs_inode *old_dir,
|
||||||
struct dentry *parent);
|
struct dentry *parent);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue