diff options
author | Chris Mason | 2007-04-05 03:22:22 +0200 |
---|---|---|
committer | David Woodhouse | 2007-04-05 03:22:22 +0200 |
commit | bae45de03c4d54a9893dedf8a015beb2608b896a (patch) | |
tree | 14e8a63492b1ff09fa1851bb3964638331303b99 /fs/btrfs/dir-item.c | |
parent | Btrfs: tweak the inode-map and free extent search starts on cold mount (diff) | |
download | kernel-qcow2-linux-bae45de03c4d54a9893dedf8a015beb2608b896a.tar.gz kernel-qcow2-linux-bae45de03c4d54a9893dedf8a015beb2608b896a.tar.xz kernel-qcow2-linux-bae45de03c4d54a9893dedf8a015beb2608b896a.zip |
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.c | 19 |
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 name_ptr = (char *)(dir_item + 1); btrfs_memcpy(root, path->nodes[0]->b_data, name_ptr, name, name_len); btrfs_mark_buffer_dirty(path->nodes[0]); + btrfs_release_path(root, path); + + btrfs_set_key_type(&key, BTRFS_DIR_INDEX_KEY); + key.offset = objectid; + ret = btrfs_insert_empty_item(trans, root, path, &key, data_size); + // FIXME clear the dirindex bit + if (ret) + goto out; + + dir_item = btrfs_item_ptr(btrfs_buffer_leaf(path->nodes[0]), + path->slots[0], + struct btrfs_dir_item); + btrfs_set_dir_objectid(dir_item, objectid); + 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); + btrfs_memcpy(root, path->nodes[0]->b_data, name_ptr, name, name_len); + btrfs_mark_buffer_dirty(path->nodes[0]); out: btrfs_release_path(root, path); btrfs_free_path(path); |