diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-10-15 16:14:19 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:03:56 -0400 |
commit | 5f39d397dfbe140a14edecd4e73c34ce23c4f9ee (patch) | |
tree | 280561e4b68d573590557dd27df656869eed8023 /fs/btrfs/inode-item.c | |
parent | 50b78c24d594e6985f36a9a8d8e2fb74e1664e90 (diff) |
Btrfs: Create extent_buffer interface for large blocksizes
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 | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/fs/btrfs/inode-item.c b/fs/btrfs/inode-item.c index b78346177539..35d2608f8918 100644 --- a/fs/btrfs/inode-item.c +++ b/fs/btrfs/inode-item.c | |||
@@ -20,24 +20,18 @@ | |||
20 | #include "disk-io.h" | 20 | #include "disk-io.h" |
21 | #include "transaction.h" | 21 | #include "transaction.h" |
22 | 22 | ||
23 | int btrfs_insert_inode(struct btrfs_trans_handle *trans, struct btrfs_root | 23 | int btrfs_insert_empty_inode(struct btrfs_trans_handle *trans, |
24 | *root, u64 objectid, struct btrfs_inode_item | 24 | struct btrfs_root *root, |
25 | *inode_item) | 25 | struct btrfs_path *path, u64 objectid) |
26 | { | 26 | { |
27 | struct btrfs_path *path; | ||
28 | struct btrfs_key key; | 27 | struct btrfs_key key; |
29 | int ret; | 28 | int ret; |
30 | key.objectid = objectid; | 29 | key.objectid = objectid; |
31 | key.flags = 0; | ||
32 | btrfs_set_key_type(&key, BTRFS_INODE_ITEM_KEY); | 30 | btrfs_set_key_type(&key, BTRFS_INODE_ITEM_KEY); |
33 | key.offset = 0; | 31 | key.offset = 0; |
34 | 32 | ||
35 | path = btrfs_alloc_path(); | 33 | ret = btrfs_insert_empty_item(trans, root, path, &key, |
36 | BUG_ON(!path); | 34 | sizeof(struct btrfs_inode_item)); |
37 | ret = btrfs_insert_item(trans, root, &key, inode_item, | ||
38 | sizeof(*inode_item)); | ||
39 | btrfs_release_path(root, path); | ||
40 | btrfs_free_path(path); | ||
41 | if (ret == 0 && objectid > root->highest_inode) | 35 | if (ret == 0 && objectid > root->highest_inode) |
42 | root->highest_inode = objectid; | 36 | root->highest_inode = objectid; |
43 | return ret; | 37 | return ret; |
@@ -51,15 +45,15 @@ int btrfs_lookup_inode(struct btrfs_trans_handle *trans, struct btrfs_root | |||
51 | int cow = mod != 0; | 45 | int cow = mod != 0; |
52 | int ret; | 46 | int ret; |
53 | int slot; | 47 | int slot; |
54 | struct btrfs_leaf *leaf; | 48 | struct extent_buffer *leaf; |
55 | struct btrfs_key found_key; | 49 | struct btrfs_key found_key; |
56 | 50 | ||
57 | ret = btrfs_search_slot(trans, root, location, path, ins_len, cow); | 51 | ret = btrfs_search_slot(trans, root, location, path, ins_len, cow); |
58 | if (ret > 0 && btrfs_key_type(location) == BTRFS_ROOT_ITEM_KEY && | 52 | if (ret > 0 && btrfs_key_type(location) == BTRFS_ROOT_ITEM_KEY && |
59 | location->offset == (u64)-1 && path->slots[0] != 0) { | 53 | location->offset == (u64)-1 && path->slots[0] != 0) { |
60 | slot = path->slots[0] - 1; | 54 | slot = path->slots[0] - 1; |
61 | leaf = btrfs_buffer_leaf(path->nodes[0]); | 55 | leaf = path->nodes[0]; |
62 | btrfs_disk_key_to_cpu(&found_key, &leaf->items[slot].key); | 56 | btrfs_item_key_to_cpu(leaf, &found_key, slot); |
63 | if (found_key.objectid == location->objectid && | 57 | if (found_key.objectid == location->objectid && |
64 | btrfs_key_type(&found_key) == btrfs_key_type(location)) { | 58 | btrfs_key_type(&found_key) == btrfs_key_type(location)) { |
65 | path->slots[0]--; | 59 | path->slots[0]--; |