btrfs: Make btrfs_insert_dir_item take btrfs_inode
Signed-off-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
committed by
David Sterba
parent
d0a0b78de4
commit
8e7611cf38
+1
-1
@@ -2982,7 +2982,7 @@ int btrfs_check_dir_item_collision(struct btrfs_root *root, u64 dir,
|
|||||||
const char *name, int name_len);
|
const char *name, int name_len);
|
||||||
int btrfs_insert_dir_item(struct btrfs_trans_handle *trans,
|
int btrfs_insert_dir_item(struct btrfs_trans_handle *trans,
|
||||||
struct btrfs_root *root, const char *name,
|
struct btrfs_root *root, const char *name,
|
||||||
int name_len, struct inode *dir,
|
int name_len, struct btrfs_inode *dir,
|
||||||
struct btrfs_key *location, u8 type, u64 index);
|
struct btrfs_key *location, u8 type, u64 index);
|
||||||
struct btrfs_dir_item *btrfs_lookup_dir_item(struct btrfs_trans_handle *trans,
|
struct btrfs_dir_item *btrfs_lookup_dir_item(struct btrfs_trans_handle *trans,
|
||||||
struct btrfs_root *root,
|
struct btrfs_root *root,
|
||||||
|
|||||||
+3
-3
@@ -120,7 +120,7 @@ int btrfs_insert_xattr_item(struct btrfs_trans_handle *trans,
|
|||||||
*/
|
*/
|
||||||
int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root
|
int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root
|
||||||
*root, const char *name, int name_len,
|
*root, const char *name, int name_len,
|
||||||
struct inode *dir, struct btrfs_key *location,
|
struct btrfs_inode *dir, struct btrfs_key *location,
|
||||||
u8 type, u64 index)
|
u8 type, u64 index)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@@ -133,7 +133,7 @@ int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root
|
|||||||
struct btrfs_disk_key disk_key;
|
struct btrfs_disk_key disk_key;
|
||||||
u32 data_size;
|
u32 data_size;
|
||||||
|
|
||||||
key.objectid = btrfs_ino(BTRFS_I(dir));
|
key.objectid = btrfs_ino(dir);
|
||||||
key.type = BTRFS_DIR_ITEM_KEY;
|
key.type = BTRFS_DIR_ITEM_KEY;
|
||||||
key.offset = btrfs_name_hash(name, name_len);
|
key.offset = btrfs_name_hash(name, name_len);
|
||||||
|
|
||||||
@@ -174,7 +174,7 @@ second_insert:
|
|||||||
btrfs_release_path(path);
|
btrfs_release_path(path);
|
||||||
|
|
||||||
ret2 = btrfs_insert_delayed_dir_index(trans, root->fs_info, name,
|
ret2 = btrfs_insert_delayed_dir_index(trans, root->fs_info, name,
|
||||||
name_len, BTRFS_I(dir), &disk_key, type, index);
|
name_len, dir, &disk_key, type, index);
|
||||||
out_free:
|
out_free:
|
||||||
btrfs_free_path(path);
|
btrfs_free_path(path);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
|||||||
+1
-1
@@ -6276,7 +6276,7 @@ int btrfs_add_link(struct btrfs_trans_handle *trans,
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ret = btrfs_insert_dir_item(trans, root, name, name_len,
|
ret = btrfs_insert_dir_item(trans, root, name, name_len,
|
||||||
parent_inode, &key,
|
BTRFS_I(parent_inode), &key,
|
||||||
btrfs_inode_type(inode), index);
|
btrfs_inode_type(inode), index);
|
||||||
if (ret == -EEXIST || ret == -EOVERFLOW)
|
if (ret == -EEXIST || ret == -EOVERFLOW)
|
||||||
goto fail_dir_item;
|
goto fail_dir_item;
|
||||||
|
|||||||
+1
-1
@@ -587,7 +587,7 @@ static noinline int create_subvol(struct inode *dir,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = btrfs_insert_dir_item(trans, root,
|
ret = btrfs_insert_dir_item(trans, root,
|
||||||
name, namelen, dir, &key,
|
name, namelen, BTRFS_I(dir), &key,
|
||||||
BTRFS_FT_DIR, index);
|
BTRFS_FT_DIR, index);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
btrfs_abort_transaction(trans, ret);
|
btrfs_abort_transaction(trans, ret);
|
||||||
|
|||||||
@@ -1644,7 +1644,7 @@ static noinline int create_pending_snapshot(struct btrfs_trans_handle *trans,
|
|||||||
|
|
||||||
ret = btrfs_insert_dir_item(trans, parent_root,
|
ret = btrfs_insert_dir_item(trans, parent_root,
|
||||||
dentry->d_name.name, dentry->d_name.len,
|
dentry->d_name.name, dentry->d_name.len,
|
||||||
parent_inode, &key,
|
BTRFS_I(parent_inode), &key,
|
||||||
BTRFS_FT_DIR, index);
|
BTRFS_FT_DIR, index);
|
||||||
/* We have check then name at the beginning, so it is impossible. */
|
/* We have check then name at the beginning, so it is impossible. */
|
||||||
BUG_ON(ret == -EEXIST || ret == -EOVERFLOW);
|
BUG_ON(ret == -EEXIST || ret == -EOVERFLOW);
|
||||||
|
|||||||
Reference in New Issue
Block a user