aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/dir-item.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-04-17 15:39:32 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-04-17 15:39:32 -0400
commit70b2befd0c8a4064715d8b340270650cc9d15af8 (patch)
tree81171607c9ddf501e5c0233dc24d20d1a5b19858 /fs/btrfs/dir-item.c
parentb18c6685810af8e6763760711aece31ccc7a8ea8 (diff)
Btrfs: rework csums and extent item ordering
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/dir-item.c')
-rw-r--r--fs/btrfs/dir-item.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/fs/btrfs/dir-item.c b/fs/btrfs/dir-item.c
index 0ba46bc0da9a..cd4137a8b87e 100644
--- a/fs/btrfs/dir-item.c
+++ b/fs/btrfs/dir-item.c
@@ -103,7 +103,7 @@ int btrfs_lookup_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root
103 key.objectid = dir; 103 key.objectid = dir;
104 key.flags = 0; 104 key.flags = 0;
105 btrfs_set_key_type(&key, BTRFS_DIR_ITEM_KEY); 105 btrfs_set_key_type(&key, BTRFS_DIR_ITEM_KEY);
106 btrfs_set_key_overflow(&key, BTRFS_KEY_OVERFLOW_MAX - 1); 106 // btrfs_set_key_overflow(&key, BTRFS_KEY_OVERFLOW_MAX - 1);
107 ret = btrfs_name_hash(name, name_len, &key.offset); 107 ret = btrfs_name_hash(name, name_len, &key.offset);
108 BUG_ON(ret); 108 BUG_ON(ret);
109 while(1) { 109 while(1) {
@@ -146,19 +146,29 @@ int btrfs_lookup_dir_index_item(struct btrfs_trans_handle *trans,
146 int cow = mod != 0; 146 int cow = mod != 0;
147 struct btrfs_disk_key *found_key; 147 struct btrfs_disk_key *found_key;
148 struct btrfs_leaf *leaf; 148 struct btrfs_leaf *leaf;
149 int overflow = 0;
149 150
150 key.objectid = dir; 151 key.objectid = dir;
151 key.flags = 0; 152 key.flags = 0;
152 btrfs_set_key_type(&key, BTRFS_DIR_INDEX_KEY); 153 btrfs_set_key_type(&key, BTRFS_DIR_INDEX_KEY);
153 btrfs_set_key_overflow(&key, BTRFS_KEY_OVERFLOW_MAX - 1);
154 key.offset = objectid; 154 key.offset = objectid;
155 ret = btrfs_search_slot(trans, root, &key, path, ins_len, cow); 155
156 if (ret < 0) 156 while(1) {
157 return ret; 157 btrfs_set_key_overflow(&key, overflow);
158 if (ret > 0) { 158 ret = btrfs_search_slot(trans, root, &key, path, ins_len, cow);
159 if (path->slots[0] == 0) 159 if (ret < 0)
160 return 1; 160 return ret;
161 path->slots[0]--; 161 if (ret > 0) {
162 if (overflow >= BTRFS_KEY_OVERFLOW_MAX)
163 return 1;
164 overflow++;
165 btrfs_set_key_overflow(&key, overflow);
166 btrfs_release_path(root, path);
167 continue;
168 } else {
169 /* found */
170 break;
171 }
162 } 172 }
163 leaf = btrfs_buffer_leaf(path->nodes[0]); 173 leaf = btrfs_buffer_leaf(path->nodes[0]);
164 found_key = &leaf->items[path->slots[0]].key; 174 found_key = &leaf->items[path->slots[0]].key;