From: Zheng Yan <zheng.yan@oracle.com>
To: linux-btrfs@vger.kernel.org, Chris Mason <chris.mason@oracle.com>
Subject: [PATCH] update mkfs for the new space balancing code
Date: Fri, 26 Sep 2008 00:58:21 +0800 [thread overview]
Message-ID: <48DBC32D.1010603@oracle.com> (raw)
Hello,
The new space balancing code needs a subvol to store the
temporary inode for data extent relocation.
Regards
Yan Zheng
---
diff -r 35eb00b579c4 mkfs.c
--- a/mkfs.c Tue Sep 23 12:29:10 2008 -0400
+++ b/mkfs.c Thu Sep 25 21:50:51 2008 +0800
@@ -229,6 +229,32 @@
(allowed & data_profile));
BUG_ON(ret);
}
+ return 0;
+}
+
+static int create_data_reloc_tree(struct btrfs_trans_handle *trans,
+ struct btrfs_root *root)
+{
+ struct btrfs_key location;
+ struct btrfs_root_item root_item;
+ struct extent_buffer *tmp;
+ u64 objectid = BTRFS_DATA_RELOC_TREE_OBJECTID;
+ int ret;
+
+ ret = btrfs_copy_root(trans, root, root->node, &tmp, objectid);
+ BUG_ON(ret);
+
+ memcpy(&root_item, &root->root_item, sizeof(root_item));
+ btrfs_set_root_bytenr(&root_item, tmp->start);
+ btrfs_set_root_level(&root_item, btrfs_header_level(tmp));
+ free_extent_buffer(tmp);
+
+ location.objectid = objectid;
+ location.type = BTRFS_ROOT_ITEM_KEY;
+ location.offset = trans->transid;
+ ret = btrfs_insert_root(trans, root->fs_info->tree_root,
+ &location, &root_item);
+ BUG_ON(ret);
return 0;
}
@@ -459,6 +485,9 @@
metadata_profile);
BUG_ON(ret);
+ ret = create_data_reloc_tree(trans, root);
+ BUG_ON(ret);
+
printf("fs created label %s on %s\n\tnodesize %u leafsize %u "
"sectorsize %u size %s\n",
label, first_file, nodesize, leafsize, sectorsize,
reply other threads:[~2008-09-25 16:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48DBC32D.1010603@oracle.com \
--to=zheng.yan@oracle.com \
--cc=chris.mason@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox