dir-item.c (c5739bba5260a59cebd20a51a55080592c8d3b07) dir-item.c (70b2befd0c8a4064715d8b340270650cc9d15af8)
1#include <linux/module.h>
2#include "ctree.h"
3#include "disk-io.h"
4#include "hash.h"
5#include "transaction.h"
6
7int insert_with_overflow(struct btrfs_trans_handle *trans, struct btrfs_root
8 *root, struct btrfs_path *path, struct btrfs_key

--- 89 unchanged lines hidden (view full) ---

98 int cow = mod != 0;
99 struct btrfs_disk_key *found_key;
100 struct btrfs_leaf *leaf;
101 u32 overflow;
102
103 key.objectid = dir;
104 key.flags = 0;
105 btrfs_set_key_type(&key, BTRFS_DIR_ITEM_KEY);
1#include <linux/module.h>
2#include "ctree.h"
3#include "disk-io.h"
4#include "hash.h"
5#include "transaction.h"
6
7int insert_with_overflow(struct btrfs_trans_handle *trans, struct btrfs_root
8 *root, struct btrfs_path *path, struct btrfs_key

--- 89 unchanged lines hidden (view full) ---

98 int cow = mod != 0;
99 struct btrfs_disk_key *found_key;
100 struct btrfs_leaf *leaf;
101 u32 overflow;
102
103 key.objectid = dir;
104 key.flags = 0;
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);
108 BUG_ON(ret);
109 while(1) {
110 ret = btrfs_search_slot(trans, root, &key, path, ins_len, cow);
111 if (ret < 0)
112 return ret;
113 if (ret > 0) {
114 if (path->slots[0] == 0)

--- 26 unchanged lines hidden (view full) ---

141 u64 objectid, int mod)
142{
143 int ret;
144 struct btrfs_key key;
145 int ins_len = mod < 0 ? -1 : 0;
146 int cow = mod != 0;
147 struct btrfs_disk_key *found_key;
148 struct btrfs_leaf *leaf;
107 ret = btrfs_name_hash(name, name_len, &key.offset);
108 BUG_ON(ret);
109 while(1) {
110 ret = btrfs_search_slot(trans, root, &key, path, ins_len, cow);
111 if (ret < 0)
112 return ret;
113 if (ret > 0) {
114 if (path->slots[0] == 0)

--- 26 unchanged lines hidden (view full) ---

141 u64 objectid, int mod)
142{
143 int ret;
144 struct btrfs_key key;
145 int ins_len = mod < 0 ? -1 : 0;
146 int cow = mod != 0;
147 struct btrfs_disk_key *found_key;
148 struct btrfs_leaf *leaf;
149 int overflow = 0;
149
150 key.objectid = dir;
151 key.flags = 0;
152 btrfs_set_key_type(&key, BTRFS_DIR_INDEX_KEY);
150
151 key.objectid = dir;
152 key.flags = 0;
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);
156 if (ret < 0)
157 return ret;
158 if (ret > 0) {
159 if (path->slots[0] == 0)
160 return 1;
161 path->slots[0]--;
155
156 while(1) {
157 btrfs_set_key_overflow(&key, overflow);
158 ret = btrfs_search_slot(trans, root, &key, path, ins_len, cow);
159 if (ret < 0)
160 return ret;
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 }
163 leaf = btrfs_buffer_leaf(path->nodes[0]);
164 found_key = &leaf->items[path->slots[0]].key;
165
166 if (btrfs_disk_key_objectid(found_key) != dir ||
167 btrfs_disk_key_type(found_key) != BTRFS_DIR_INDEX_KEY)
168 return 1;
169 if (btrfs_disk_key_offset(found_key) == objectid)

--- 21 unchanged lines hidden ---
172 }
173 leaf = btrfs_buffer_leaf(path->nodes[0]);
174 found_key = &leaf->items[path->slots[0]].key;
175
176 if (btrfs_disk_key_objectid(found_key) != dir ||
177 btrfs_disk_key_type(found_key) != BTRFS_DIR_INDEX_KEY)
178 return 1;
179 if (btrfs_disk_key_offset(found_key) == objectid)

--- 21 unchanged lines hidden ---