diff options
author | Josef Bacik <jbacik@redhat.com> | 2008-07-24 12:12:38 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:04:05 -0400 |
commit | aec7477b3b0e8ec93f6d274f25ba40b0665134d4 (patch) | |
tree | 2f689681e2f1b48d1c42b2242e21cbf456ec4c55 /fs/btrfs/inode-item.c | |
parent | 3eaa2885276fd6dac7b076a793932428b7168e74 (diff) |
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.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/btrfs/inode-item.c b/fs/btrfs/inode-item.c index cba30b6cc6fe..d93451c66ba1 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, | |||
52 | int btrfs_del_inode_ref(struct btrfs_trans_handle *trans, | 52 | int btrfs_del_inode_ref(struct btrfs_trans_handle *trans, |
53 | struct btrfs_root *root, | 53 | struct btrfs_root *root, |
54 | const char *name, int name_len, | 54 | const char *name, int name_len, |
55 | u64 inode_objectid, u64 ref_objectid) | 55 | u64 inode_objectid, u64 ref_objectid, u64 *index) |
56 | { | 56 | { |
57 | struct btrfs_path *path; | 57 | struct btrfs_path *path; |
58 | struct btrfs_key key; | 58 | struct btrfs_key key; |
@@ -86,6 +86,10 @@ int btrfs_del_inode_ref(struct btrfs_trans_handle *trans, | |||
86 | } | 86 | } |
87 | leaf = path->nodes[0]; | 87 | leaf = path->nodes[0]; |
88 | item_size = btrfs_item_size_nr(leaf, path->slots[0]); | 88 | item_size = btrfs_item_size_nr(leaf, path->slots[0]); |
89 | |||
90 | if (index) | ||
91 | *index = btrfs_inode_ref_index(leaf, ref); | ||
92 | |||
89 | if (del_len == item_size) { | 93 | if (del_len == item_size) { |
90 | ret = btrfs_del_item(trans, root, path); | 94 | ret = btrfs_del_item(trans, root, path); |
91 | goto out; | 95 | goto out; |
@@ -106,7 +110,7 @@ out: | |||
106 | int btrfs_insert_inode_ref(struct btrfs_trans_handle *trans, | 110 | int btrfs_insert_inode_ref(struct btrfs_trans_handle *trans, |
107 | struct btrfs_root *root, | 111 | struct btrfs_root *root, |
108 | const char *name, int name_len, | 112 | const char *name, int name_len, |
109 | u64 inode_objectid, u64 ref_objectid) | 113 | u64 inode_objectid, u64 ref_objectid, u64 index) |
110 | { | 114 | { |
111 | struct btrfs_path *path; | 115 | struct btrfs_path *path; |
112 | struct btrfs_key key; | 116 | struct btrfs_key key; |
@@ -138,6 +142,7 @@ int btrfs_insert_inode_ref(struct btrfs_trans_handle *trans, | |||
138 | struct btrfs_inode_ref); | 142 | struct btrfs_inode_ref); |
139 | ref = (struct btrfs_inode_ref *)((unsigned long)ref + old_size); | 143 | ref = (struct btrfs_inode_ref *)((unsigned long)ref + old_size); |
140 | btrfs_set_inode_ref_name_len(path->nodes[0], ref, name_len); | 144 | btrfs_set_inode_ref_name_len(path->nodes[0], ref, name_len); |
145 | btrfs_set_inode_ref_index(path->nodes[0], ref, index); | ||
141 | ptr = (unsigned long)(ref + 1); | 146 | ptr = (unsigned long)(ref + 1); |
142 | ret = 0; | 147 | ret = 0; |
143 | } else if (ret < 0) { | 148 | } else if (ret < 0) { |
@@ -146,6 +151,7 @@ int btrfs_insert_inode_ref(struct btrfs_trans_handle *trans, | |||
146 | ref = btrfs_item_ptr(path->nodes[0], path->slots[0], | 151 | ref = btrfs_item_ptr(path->nodes[0], path->slots[0], |
147 | struct btrfs_inode_ref); | 152 | struct btrfs_inode_ref); |
148 | btrfs_set_inode_ref_name_len(path->nodes[0], ref, name_len); | 153 | btrfs_set_inode_ref_name_len(path->nodes[0], ref, name_len); |
154 | btrfs_set_inode_ref_index(path->nodes[0], ref, index); | ||
149 | ptr = (unsigned long)(ref + 1); | 155 | ptr = (unsigned long)(ref + 1); |
150 | } | 156 | } |
151 | write_extent_buffer(path->nodes[0], name, ptr, name_len); | 157 | write_extent_buffer(path->nodes[0], name, ptr, name_len); |