summaryrefslogtreecommitdiff
path: root/dir-item.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-04-06 15:39:12 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-04-06 15:39:12 -0400
commit8accdae27a678a47f021128121f2975e6fc25201 (patch)
tree6e803324d51f9f7f38c1f449f787d0888dc82d44 /dir-item.c
parentd785b7d058b78176083a0f314da1bc114ad2fa9b (diff)
start of support for subvolumes
Diffstat (limited to 'dir-item.c')
-rw-r--r--dir-item.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/dir-item.c b/dir-item.c
index fff16348..7058b89f 100644
--- a/dir-item.c
+++ b/dir-item.c
@@ -28,8 +28,8 @@ int insert_with_overflow(struct btrfs_trans_handle *trans, struct btrfs_root
}
int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root
- *root, char *name, int name_len, u64 dir, u64
- objectid, u8 type)
+ *root, char *name, int name_len, u64 dir,
+ struct btrfs_key *location, u8 type)
{
int ret = 0;
struct btrfs_path path;
@@ -56,23 +56,27 @@ int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root
dir_item = btrfs_item_ptr(&path.nodes[0]->leaf, path.slots[0],
struct btrfs_dir_item);
- btrfs_set_dir_objectid(dir_item, objectid);
+ btrfs_cpu_key_to_disk(&dir_item->location, location);
btrfs_set_dir_type(dir_item, type);
btrfs_set_dir_flags(dir_item, 0);
btrfs_set_dir_name_len(dir_item, name_len);
name_ptr = (char *)(dir_item + 1);
memcpy(name_ptr, name, name_len);
+ /* FIXME, use some real flag for selecting the extra index */
+ if (root == root->fs_info->tree_root)
+ goto out;
+
btrfs_release_path(root, &path);
btrfs_set_key_type(&key, BTRFS_DIR_INDEX_KEY);
- key.offset = objectid;
+ key.offset = location->objectid;
ret = insert_with_overflow(trans, root, &path, &key, data_size);
if (ret)
goto out;
dir_item = btrfs_item_ptr(&path.nodes[0]->leaf, path.slots[0],
struct btrfs_dir_item);
- btrfs_set_dir_objectid(dir_item, objectid);
+ btrfs_cpu_key_to_disk(&dir_item->location, location);
btrfs_set_dir_type(dir_item, type);
btrfs_set_dir_flags(dir_item, 0);
btrfs_set_dir_name_len(dir_item, name_len);