aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/dir-item.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-04-04 21:22:22 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-04-04 21:22:22 -0400
commitbae45de03c4d54a9893dedf8a015beb2608b896a (patch)
tree14e8a63492b1ff09fa1851bb3964638331303b99 /fs/btrfs/dir-item.c
parentb1a4d96509a78ad234d94e0b914b289c60d2969d (diff)
Btrfs: add dir inode index
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/dir-item.c')
-rw-r--r--fs/btrfs/dir-item.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/fs/btrfs/dir-item.c b/fs/btrfs/dir-item.c
index baceb1da609f..2a87e23ac9c9 100644
--- a/fs/btrfs/dir-item.c
+++ b/fs/btrfs/dir-item.c
@@ -37,6 +37,25 @@ int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root
37 name_ptr = (char *)(dir_item + 1); 37 name_ptr = (char *)(dir_item + 1);
38 btrfs_memcpy(root, path->nodes[0]->b_data, name_ptr, name, name_len); 38 btrfs_memcpy(root, path->nodes[0]->b_data, name_ptr, name, name_len);
39 btrfs_mark_buffer_dirty(path->nodes[0]); 39 btrfs_mark_buffer_dirty(path->nodes[0]);
40 btrfs_release_path(root, path);
41
42 btrfs_set_key_type(&key, BTRFS_DIR_INDEX_KEY);
43 key.offset = objectid;
44 ret = btrfs_insert_empty_item(trans, root, path, &key, data_size);
45 // FIXME clear the dirindex bit
46 if (ret)
47 goto out;
48
49 dir_item = btrfs_item_ptr(btrfs_buffer_leaf(path->nodes[0]),
50 path->slots[0],
51 struct btrfs_dir_item);
52 btrfs_set_dir_objectid(dir_item, objectid);
53 btrfs_set_dir_type(dir_item, type);
54 btrfs_set_dir_flags(dir_item, 0);
55 btrfs_set_dir_name_len(dir_item, name_len);
56 name_ptr = (char *)(dir_item + 1);
57 btrfs_memcpy(root, path->nodes[0]->b_data, name_ptr, name, name_len);
58 btrfs_mark_buffer_dirty(path->nodes[0]);
40out: 59out:
41 btrfs_release_path(root, path); 60 btrfs_release_path(root, path);
42 btrfs_free_path(path); 61 btrfs_free_path(path);