[Btrfs-devel] [PATCH 2/2] fix mkfs so it sets the proper permissions on the root inode

Josef Bacik jwhiter at redhat.com
Thu Jun 28 20:42:24 PDT 2007


Hello,

This patch makes mkfs set the root inode's permissions to 755 and doesn't create
the 'default' directory in the root of the filesystem.  Thank you,

Josef

diff -r 85bf73175772 mkfs.c
--- a/mkfs.c	Thu Jun 28 16:20:29 2007 -0400
+++ b/mkfs.c	Thu Jun 28 20:48:25 2007 -0400
@@ -61,7 +61,7 @@ static int __make_root_dir(struct btrfs_
 	btrfs_set_inode_size(&inode_item, 6);
 	btrfs_set_inode_nlink(&inode_item, 1);
 	btrfs_set_inode_nblocks(&inode_item, 1);
-	btrfs_set_inode_mode(&inode_item, S_IFDIR | 0555);
+	btrfs_set_inode_mode(&inode_item, S_IFDIR | 0755);
 
 	if (root->fs_info->tree_root == root)
 		btrfs_set_super_root_dir(root->fs_info->disk_super, objectid);
@@ -146,7 +146,6 @@ static int make_root_dir(int fd) {
 	struct btrfs_super_block super;
 	struct btrfs_trans_handle *trans;
 	int ret;
-	struct btrfs_key location;
 
 	root = open_ctree_fd(fd, &super);
 
@@ -161,14 +160,6 @@ static int make_root_dir(int fd) {
 	if (ret)
 		goto err;
 	ret = __make_root_dir(trans, root, BTRFS_FIRST_FREE_OBJECTID);
-	if (ret)
-		goto err;
-	memcpy(&location, &root->fs_info->fs_root->root_key, sizeof(location));
-	location.offset = (u64)-1;
-	ret = btrfs_insert_dir_item(trans, root->fs_info->tree_root,
-			"default", strlen("default"),
-			btrfs_super_root_dir(root->fs_info->disk_super),
-			&location, BTRFS_FT_DIR);
 	if (ret)
 		goto err;
 	btrfs_commit_transaction(trans, root, root->fs_info->disk_super);



More information about the Btrfs-devel mailing list