summaryrefslogtreecommitdiff
path: root/dir-item.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-03-21 11:13:29 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-03-21 11:13:29 -0400
commit8a2c8123c5ee5b09f3b8265e5e6db2e687d29e99 (patch)
tree4e608f93d52d4df45d20e3482ac8acaf02244118 /dir-item.c
parentb55672a2a1694d27b73f8233efcc1d986bfc797a (diff)
downloadbtrfs-progs-8a2c8123c5ee5b09f3b8265e5e6db2e687d29e99.tar.gz
create a root dir in mkfs
Diffstat (limited to 'dir-item.c')
-rw-r--r--dir-item.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/dir-item.c b/dir-item.c
index 949c4e5..ec3e488 100644
--- a/dir-item.c
+++ b/dir-item.c
@@ -21,7 +21,12 @@ int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root
key.objectid = dir;
key.flags = 0;
btrfs_set_key_type(&key, BTRFS_DIR_ITEM_KEY);
- ret = btrfs_name_hash(name, name_len, &key.offset);
+ if (name_len == 1 && *name == '.')
+ key.offset = 1;
+ else if (name_len == 2 && name[0] == '.' && name[1] == '.')
+ key.offset = 2;
+ else
+ ret = btrfs_name_hash(name, name_len, &key.offset);
BUG_ON(ret);
btrfs_init_path(&path);
data_size = sizeof(*dir_item) + name_len;