aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode-map.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-10-15 16:14:19 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:03:56 -0400
commit5f39d397dfbe140a14edecd4e73c34ce23c4f9ee (patch)
tree280561e4b68d573590557dd27df656869eed8023 /fs/btrfs/inode-map.c
parent50b78c24d594e6985f36a9a8d8e2fb74e1664e90 (diff)
Btrfs: Create extent_buffer interface for large blocksizes
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode-map.c')
-rw-r--r--fs/btrfs/inode-map.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/fs/btrfs/inode-map.c b/fs/btrfs/inode-map.c
index 405470866254..ab74977adf5c 100644
--- a/fs/btrfs/inode-map.c
+++ b/fs/btrfs/inode-map.c
@@ -24,8 +24,9 @@ int btrfs_find_highest_inode(struct btrfs_root *root, u64 *objectid)
24{ 24{
25 struct btrfs_path *path; 25 struct btrfs_path *path;
26 int ret; 26 int ret;
27 struct btrfs_leaf *l; 27 struct extent_buffer *l;
28 struct btrfs_key search_key; 28 struct btrfs_key search_key;
29 struct btrfs_key found_key;
29 int slot; 30 int slot;
30 31
31 path = btrfs_alloc_path(); 32 path = btrfs_alloc_path();
@@ -39,8 +40,9 @@ int btrfs_find_highest_inode(struct btrfs_root *root, u64 *objectid)
39 BUG_ON(ret == 0); 40 BUG_ON(ret == 0);
40 if (path->slots[0] > 0) { 41 if (path->slots[0] > 0) {
41 slot = path->slots[0] - 1; 42 slot = path->slots[0] - 1;
42 l = btrfs_buffer_leaf(path->nodes[0]); 43 l = path->nodes[0];
43 *objectid = btrfs_disk_key_objectid(&l->items[slot].key); 44 btrfs_item_key_to_cpu(l, &found_key, slot);
45 *objectid = found_key.objectid;
44 } else { 46 } else {
45 *objectid = BTRFS_FIRST_FREE_OBJECTID; 47 *objectid = BTRFS_FIRST_FREE_OBJECTID;
46 } 48 }
@@ -64,13 +66,12 @@ int btrfs_find_free_objectid(struct btrfs_trans_handle *trans,
64 int slot = 0; 66 int slot = 0;
65 u64 last_ino = 0; 67 u64 last_ino = 0;
66 int start_found; 68 int start_found;
67 struct btrfs_leaf *l; 69 struct extent_buffer *l;
68 struct btrfs_key search_key; 70 struct btrfs_key search_key;
69 u64 search_start = dirid; 71 u64 search_start = dirid;
70 72
71 path = btrfs_alloc_path(); 73 path = btrfs_alloc_path();
72 BUG_ON(!path); 74 BUG_ON(!path);
73 search_key.flags = 0;
74 search_start = root->last_inode_alloc; 75 search_start = root->last_inode_alloc;
75 search_start = max(search_start, BTRFS_FIRST_FREE_OBJECTID); 76 search_start = max(search_start, BTRFS_FIRST_FREE_OBJECTID);
76 search_key.objectid = search_start; 77 search_key.objectid = search_start;
@@ -86,9 +87,9 @@ int btrfs_find_free_objectid(struct btrfs_trans_handle *trans,
86 path->slots[0]--; 87 path->slots[0]--;
87 88
88 while (1) { 89 while (1) {
89 l = btrfs_buffer_leaf(path->nodes[0]); 90 l = path->nodes[0];
90 slot = path->slots[0]; 91 slot = path->slots[0];
91 if (slot >= btrfs_header_nritems(&l->header)) { 92 if (slot >= btrfs_header_nritems(l)) {
92 ret = btrfs_next_leaf(root, path); 93 ret = btrfs_next_leaf(root, path);
93 if (ret == 0) 94 if (ret == 0)
94 continue; 95 continue;
@@ -103,7 +104,7 @@ int btrfs_find_free_objectid(struct btrfs_trans_handle *trans,
103 last_ino : search_start; 104 last_ino : search_start;
104 goto found; 105 goto found;
105 } 106 }
106 btrfs_disk_key_to_cpu(&key, &l->items[slot].key); 107 btrfs_item_key_to_cpu(l, &key, slot);
107 if (key.objectid >= search_start) { 108 if (key.objectid >= search_start) {
108 if (start_found) { 109 if (start_found) {
109 if (last_ino < search_start) 110 if (last_ino < search_start)