From: Alex Chiang <achiang@hp.com>
To: David Miller <davem@davemloft.net>,
chris.mason@oracle.com, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org, btrfs-devel@oss.oracle.com
Subject: Re: [ANNOUNCE] Btrfs v0.13
Date: Mon, 31 Mar 2008 17:25:19 -0600 [thread overview]
Message-ID: <20080331232519.GD2362@ldl.fc.hp.com> (raw)
In-Reply-To: <20080331224344.GB2362@ldl.fc.hp.com>
* Alex Chiang <achiang@hp.com>:
> * David Miller <davem@davemloft.net>:
> > From: Alex Chiang <achiang@hp.com>
> > Date: Mon, 31 Mar 2008 14:26:33 -0600
> >
> > > I've gotten as far as successfully creating a btrfs filesystem
> > > (at least that's what btrfsck tells me), but haven't been able to
> > > mount it yet, probably because of the sector size issue.
> >
> > You should be able to make a filesystem with a sector
> > size >= PAGE_SIZE and it should work just fine. Please
> > give it a try.
>
> Hrm, I'm having issues still. First, here's a patch for
> mkfs.btrfs to allow the user to pass in a different sector size.
Whoops, whitespace was screwed up on that patch. Here's try #2.
/ac
From: Alex Chiang <achiang@hp.com>
Subject: [PATCH] Teach mkfs.btrfs about configurable sectorsizes
Currently, btrfs assumes PAGE_SIZE <= sectorsize, and sectorsize
is hardcoded to 4K in mkfs.btrfs.
Give mkfs.btrfs a new command line option to specify a different
sector size. The syntax follows mke2fs's -E extended-options syntax,
and the code is taken from mke2fs.
---
mkfs.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 74 insertions(+), 2 deletions(-)
diff --git a/mkfs.c b/mkfs.c
index 49f7308..874a41e 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -137,15 +137,76 @@ err:
return ret;
}
+struct btrfs_params {
+ u32 sectorsize;
+};
+
+/*
+ * Shameless ripped from mke2fs
+ */
+static void parse_extended_opts(struct btrfs_params *param, const char *opts)
+{
+ char *buf, *token, *next, *p, *arg;
+ int len;
+ int r_usage = 0;
+
+ len = strlen(opts);
+ buf = malloc(len+1);
+ if (!buf) {
+ fprintf(stderr, "Couldn't allocate memory to parse options!\n");
+ exit(1);
+ }
+ strcpy(buf, opts);
+ for (token = buf; token && *token; token = next) {
+ p = strchr(token, ',');
+ next = 0;
+ if (p) {
+ *p = 0;
+ next = p+1;
+ }
+ arg = strchr(token, '=');
+ if (arg) {
+ *arg = 0;
+ arg++;
+ }
+ if (strcmp(token, "sectorsize") == 0) {
+ if (!arg) {
+ r_usage++;
+ continue;
+ }
+ param->sectorsize = strtoul(arg, &p, 0);
+ if (*p || (param->sectorsize == 0)) {
+ fprintf(stderr,
+ "Invalid sectorsize parameter: %s\n",
+ arg);
+ r_usage++;
+ continue;
+ }
+ } else {
+ r_usage++;
+ }
+ }
+ if (r_usage) {
+ fprintf(stderr, "\nBad options specified.\n\n"
+ "Extended options are separated by commas, "
+ "and may take an argument which\n"
+ "\tis set off by an equals ('=') sign.\n\n"
+ "Valid extended options are:\n"
+ "\tsectorsize=<sector size in bytes>\n\n");
+ exit(1);
+ }
+}
+
static void print_usage(void)
{
- fprintf(stderr, "usage: mkfs.btrfs [ -l leafsize ] [ -n nodesize] dev [ blocks ]\n");
+ fprintf(stderr, "usage: mkfs.btrfs [ -l leafsize ] [ -n nodesize] [ -E sectorsize=<sectorsize> ] dev [ blocks ]\n");
exit(1);
}
int main(int ac, char **av)
{
char *file;
+ char *extended_opts = 0;
u64 block_count = 0;
u64 dev_block_count = 0;
int fd;
@@ -160,10 +221,11 @@ int main(int ac, char **av)
int zero_end = 1;
struct btrfs_root *root;
struct btrfs_trans_handle *trans;
+ struct btrfs_params fs_params;
while(1) {
int c;
- c = getopt(ac, av, "b:l:n:s:");
+ c = getopt(ac, av, "b:l:n:s:E:");
if (c < 0)
break;
switch(c) {
@@ -180,10 +242,19 @@ int main(int ac, char **av)
block_count = parse_size(optarg);
zero_end = 0;
break;
+ case 'E':
+ memset(&fs_params, 0,
+ sizeof(struct btrfs_params));
+ extended_opts = optarg;
+ break;
default:
print_usage();
}
}
+ if (extended_opts) {
+ parse_extended_opts(&fs_params, extended_opts);
+ sectorsize = fs_params.sectorsize;
+ }
if (leafsize < sectorsize || (leafsize & (sectorsize - 1))) {
fprintf(stderr, "Illegal leafsize %u\n", leafsize);
exit(1);
@@ -192,6 +263,7 @@ int main(int ac, char **av)
fprintf(stderr, "Illegal nodesize %u\n", nodesize);
exit(1);
}
+
ac = ac - optind;
if (ac == 0)
print_usage();
--
1.5.3.1.g1e61
next prev parent reply other threads:[~2008-03-31 23:25 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-21 21:09 [ANNOUNCE] Btrfs v0.13 Chris Mason
2008-02-21 21:12 ` Chris Mason
2008-03-31 20:26 ` Alex Chiang
2008-03-31 20:35 ` Alex Chiang
2008-03-31 20:45 ` David Miller
2008-03-31 22:43 ` Alex Chiang
2008-03-31 23:25 ` Alex Chiang [this message]
2008-04-01 15:58 ` Chris Mason
2008-03-31 22:47 ` Alex Chiang
2008-04-01 0:40 ` Alex Chiang
2008-04-01 13:38 ` Chris Mason
2008-03-31 20:52 ` Chris Mason
2008-03-31 21:02 ` Alex Chiang
2008-03-31 20:28 ` [PATCH 1/2] btrfs-progs: Fix printf format casting errors Alex Chiang
2008-03-31 20:29 ` [PATCH 2/2] btrfs-progs: Stop stomping on 'name' input parameter Alex Chiang
2008-04-01 23:28 ` [ANNOUNCE] Btrfs v0.13 Badari Pulavarty
2008-04-01 23:33 ` Badari Pulavarty
2008-04-03 16:51 ` [PATCH] btrfs - replace div_long_long_rem() Badari Pulavarty
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=20080331232519.GD2362@ldl.fc.hp.com \
--to=achiang@hp.com \
--cc=btrfs-devel@oss.oracle.com \
--cc=chris.mason@oracle.com \
--cc=davem@davemloft.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@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;
as well as URLs for NNTP newsgroup(s).