summaryrefslogtreecommitdiff
path: root/fs/btrfs/inode-item.c
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@redhat.com>2008-07-24 12:12:38 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:05 -0400
commitaec7477b3b0e8ec93f6d274f25ba40b0665134d4 (patch)
tree2f689681e2f1b48d1c42b2242e21cbf456ec4c55 /fs/btrfs/inode-item.c
parent3eaa2885276fd6dac7b076a793932428b7168e74 (diff)
downloadlinux-3.10-aec7477b3b0e8ec93f6d274f25ba40b0665134d4.tar.gz
linux-3.10-aec7477b3b0e8ec93f6d274f25ba40b0665134d4.tar.bz2
linux-3.10-aec7477b3b0e8ec93f6d274f25ba40b0665134d4.zip
Btrfs: Implement new dir index format
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode-item.c')
-rw-r--r--fs/btrfs/inode-item.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/btrfs/inode-item.c b/fs/btrfs/inode-item.c
index cba30b6cc6f..d93451c66ba 100644
--- a/fs/btrfs/inode-item.c
+++ b/fs/btrfs/inode-item.c
@@ -52,7 +52,7 @@ int find_name_in_backref(struct btrfs_path *path, const char * name,
int btrfs_del_inode_ref(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
const char *name, int name_len,
- u64 inode_objectid, u64 ref_objectid)
+ u64 inode_objectid, u64 ref_objectid, u64 *index)
{
struct btrfs_path *path;
struct btrfs_key key;
@@ -86,6 +86,10 @@ int btrfs_del_inode_ref(struct btrfs_trans_handle *trans,
}
leaf = path->nodes[0];
item_size = btrfs_item_size_nr(leaf, path->slots[0]);
+
+ if (index)
+ *index = btrfs_inode_ref_index(leaf, ref);
+
if (del_len == item_size) {
ret = btrfs_del_item(trans, root, path);
goto out;
@@ -106,7 +110,7 @@ out:
int btrfs_insert_inode_ref(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
const char *name, int name_len,
- u64 inode_objectid, u64 ref_objectid)
+ u64 inode_objectid, u64 ref_objectid, u64 index)
{
struct btrfs_path *path;
struct btrfs_key key;
@@ -138,6 +142,7 @@ int btrfs_insert_inode_ref(struct btrfs_trans_handle *trans,
struct btrfs_inode_ref);
ref = (struct btrfs_inode_ref *)((unsigned long)ref + old_size);
btrfs_set_inode_ref_name_len(path->nodes[0], ref, name_len);
+ btrfs_set_inode_ref_index(path->nodes[0], ref, index);
ptr = (unsigned long)(ref + 1);
ret = 0;
} else if (ret < 0) {
@@ -146,6 +151,7 @@ int btrfs_insert_inode_ref(struct btrfs_trans_handle *trans,
ref = btrfs_item_ptr(path->nodes[0], path->slots[0],
struct btrfs_inode_ref);
btrfs_set_inode_ref_name_len(path->nodes[0], ref, name_len);
+ btrfs_set_inode_ref_index(path->nodes[0], ref, index);
ptr = (unsigned long)(ref + 1);
}
write_extent_buffer(path->nodes[0], name, ptr, name_len);