2008-02-21 21:11:47

by Chris Mason

[permalink] [raw]
Subject: [ANNOUNCE] Btrfs v0.13

Hello everyone,

Btrfs v0.13 is now available for download from:

http://oss.oracle.com/projects/btrfs/

We took another short break from the multi-device code to make the minor mods
required to compile on 2.6.25, fix some problematic bugs and do more tuning.

The most important fix is for file data checksumming errors. These might show
up on .o files from compiles or other files where seeky writes were done
internally to fill it up. The end result was a bunch of zeros in the file
where people expected their data to be. Thanks to Yan Zheng for tracking it
down.

GregKH provided most of the 2.6.25 port with some sysfs updates. Since the
sysfs files are not used much and Greg has offered additional cleanups, I've
disabled the btrfs sysfs interface on kernels older than 2.6.25. This way he
won't have to back port any of his changes.

Optimizations and other fixes:

* File data checksumming done in larger chunks, resulting in fewer btree
searches and fewer kmap calls.

* CPU Optimizations for back reference removal

* CPU Optimizations for block allocation, and much more efficient searching
through the free space cache.

* Allocation optimizations, the free space clustering code was not properly
allocating from a cluster once it found it. For normal mounts the fix
improves metadata writeback, for mount -o ssd it improves everything.

* Unaligned access fixes from Dave Miller

* Btree reads are done in larger bios when possible

* i_block accounting is fixed

-chris


2008-02-21 21:13:53

by Chris Mason

[permalink] [raw]
Subject: Re: [ANNOUNCE] Btrfs v0.13

On Thursday 21 February 2008, Chris Mason wrote:
> Hello everyone,
>
> Btrfs v0.13 is now available for download from:
>
> http://oss.oracle.com/projects/btrfs/
>
> We took another short break from the multi-device code to make the minor
> mods required to compile on 2.6.25, fix some problematic bugs and do more
> tuning.

Sorry, I should have added:

v0.13 has no disk format changes since v0.12.

-chris

2008-03-31 20:26:46

by Alex Chiang

[permalink] [raw]
Subject: Re: [ANNOUNCE] Btrfs v0.13

* Chris Mason <[email protected]>:
> Hello everyone,
>
> Btrfs v0.13 is now available for download from:

Hi Chris,

Following are two patches that allow btrfs-progs to build on
ia64, and prevent a SEGV when trying to do a mkfs.btrfs.

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.

/ac

2008-03-31 20:28:59

by Alex Chiang

[permalink] [raw]
Subject: [PATCH 1/2] btrfs-progs: Fix printf format casting errors

From: Alex Chiang <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

We get lots of warnings of the flavor:

utils.c:441: warning: format '%Lu' expects type 'long long unsigned int' but argument 2 has type 'u64'

And thanks to -Werror, the build fails. Clean up these printfs
by properly casting the arg to the format specified.

Signed-off-by: Alex Chiang <[email protected]>
---
ctree.c | 5 +++--
disk-io.c | 7 ++++---
extent-tree.c | 24 +++++++++++++++---------
extent_io.c | 3 ++-
file-item.c | 8 +++++---
inode-map.c | 3 ++-
root-tree.c | 5 ++++-
utils.c | 2 +-
volumes.c | 14 +++++++++-----
9 files changed, 45 insertions(+), 26 deletions(-)

diff --git a/ctree.c b/ctree.c
index 88ebd9e..5311306 100644
--- a/ctree.c
+++ b/ctree.c
@@ -237,8 +237,9 @@ int btrfs_cow_block(struct btrfs_trans_handle *trans,
}
*/
if (trans->transid != root->fs_info->generation) {
- printk(KERN_CRIT "trans %Lu running %Lu\n", trans->transid,
- root->fs_info->generation);
+ printk(KERN_CRIT "trans %llu running %llu\n",
+ (unsigned long long)trans->transid,
+ (unsigned long long)root->fs_info->generation);
WARN_ON(1);
}
if (btrfs_header_generation(buf) == trans->transid) {
diff --git a/disk-io.c b/disk-io.c
index 1afe5a6..8ee7716 100644
--- a/disk-io.c
+++ b/disk-io.c
@@ -84,7 +84,8 @@ static int csum_tree_block(struct btrfs_root *root, struct extent_buffer *buf,

if (verify) {
if (memcmp_extent_buffer(buf, result, 0, BTRFS_CRC32_SIZE)) {
- printk("checksum verify failed on %llu\n", buf->start);
+ printk("checksum verify failed on %llu\n",
+ (unsigned long long)buf->start);
return 1;
}
} else {
@@ -429,8 +430,8 @@ struct btrfs_root *open_ctree_fd(int fp, const char *path, u64 sb_bytenr)
fprintf(stderr, "No valid Btrfs found on %s\n", path);
return NULL;
}
- fprintf(stderr, "found Btrfs on %s with %Lu devices\n", path,
- total_devs);
+ fprintf(stderr, "found Btrfs on %s with %lu devices\n", path,
+ (unsigned long)total_devs);

if (total_devs != 1) {
ret = btrfs_scan_for_fsid(fs_devices, total_devs, 1);
diff --git a/extent-tree.c b/extent-tree.c
index 9696aab..b9cf92f 100644
--- a/extent-tree.c
+++ b/extent-tree.c
@@ -225,7 +225,8 @@ again:
out:
cache = btrfs_lookup_block_group(root->fs_info, search_start);
if (!cache) {
- printk("Unable to find block group for %Lu\n", search_start);
+ printk("Unable to find block group for %llu\n",
+ (unsigned long long)search_start);
WARN_ON(1);
}
return -ENOSPC;
@@ -680,7 +681,8 @@ static int lookup_extent_ref(struct btrfs_trans_handle *trans,
goto out;
if (ret != 0) {
btrfs_print_leaf(root, path->nodes[0]);
- printk("failed to find block number %Lu\n", bytenr);
+ printk("failed to find block number %llu\n",
+ (unsigned long long)bytenr);
BUG();
}
l = path->nodes[0];
@@ -1046,7 +1048,7 @@ static int do_chunk_alloc(struct btrfs_trans_handle *trans,

ret = btrfs_alloc_chunk(trans, extent_root, &start, &num_bytes, flags);
if (ret == -ENOSPC) {
-printk("space info full %Lu\n", flags);
+printk("space info full %llu\n", (unsigned long long)flags);
space_info->full = 1;
return 0;
}
@@ -1315,10 +1317,13 @@ static int __free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
} else {
btrfs_print_leaf(extent_root, path->nodes[0]);
WARN_ON(1);
- printk("Unable to find ref byte nr %Lu root %Lu "
- " gen %Lu owner %Lu offset %Lu\n", bytenr,
- root_objectid, ref_generation, owner_objectid,
- owner_offset);
+ printk("Unable to find ref byte nr %llu root %llu "
+ " gen %llu owner %llu offset %llu\n",
+ (unsigned long long)bytenr,
+ (unsigned long long)root_objectid,
+ (unsigned long long)ref_generation,
+ (unsigned long long)owner_objectid,
+ (unsigned long long)owner_offset);
}
if (!found_extent) {
btrfs_release_path(extent_root, path);
@@ -1720,8 +1725,9 @@ int btrfs_alloc_extent(struct btrfs_trans_handle *trans,
update_block:
ret = update_block_group(trans, root, ins->objectid, ins->offset, 1, 0);
if (ret) {
- printk("update block group failed for %Lu %Lu\n",
- ins->objectid, ins->offset);
+ printk("update block group failed for %llu %llu\n",
+ (unsigned long long)ins->objectid,
+ (unsigned long long)ins->offset);
BUG();
}
return 0;
diff --git a/extent_io.c b/extent_io.c
index b663275..9071644 100644
--- a/extent_io.c
+++ b/extent_io.c
@@ -68,7 +68,8 @@ void extent_io_tree_cleanup(struct extent_io_tree *tree)
eb = list_entry(tree->lru.next, struct extent_buffer, lru);
if (eb->refs != 1) {
fprintf(stderr, "extent buffer leak: "
- "start %Lu len %u\n", eb->start, eb->len);
+ "start %llu len %u\n",
+ (unsigned long long)eb->start, eb->len);
eb->refs = 1;
}
free_extent_buffer(eb);
diff --git a/file-item.c b/file-item.c
index 8b85f7a..4cbc2a5 100644
--- a/file-item.c
+++ b/file-item.c
@@ -136,7 +136,8 @@ int btrfs_insert_inline_extent(struct btrfs_trans_handle *trans,
err = ret;
btrfs_print_leaf(root, leaf);
printk("found wasn't inline offset %llu inode %llu\n",
- offset, objectid);
+ (unsigned long long)offset,
+ (unsigned long long)objectid);
goto fail;
}
found_size = btrfs_file_extent_inline_len(leaf,
@@ -386,8 +387,9 @@ found:
csum_result = btrfs_csum_data(root, data, csum_result, len);
btrfs_csum_final(csum_result, (char *)&csum_result);
if (csum_result == 0) {
- printk("csum result is 0 for inode %Lu offset %Lu\n",
- objectid, offset);
+ printk("csum result is 0 for inode %llu offset %llu\n",
+ (unsigned long long)objectid,
+ (unsigned long long)offset);
}

write_extent_buffer(leaf, &csum_result, (unsigned long)item,
diff --git a/inode-map.c b/inode-map.c
index a0925ea..d2970d4 100644
--- a/inode-map.c
+++ b/inode-map.c
@@ -72,7 +72,8 @@ int btrfs_find_free_objectid(struct btrfs_trans_handle *trans,
path = btrfs_alloc_path();
BUG_ON(!path);
search_start = root->last_inode_alloc;
- search_start = max(search_start, BTRFS_FIRST_FREE_OBJECTID);
+ search_start = max((unsigned long long)search_start,
+ BTRFS_FIRST_FREE_OBJECTID);
search_key.objectid = search_start;
search_key.offset = 0;

diff --git a/root-tree.c b/root-tree.c
index b639214..96c05cb 100644
--- a/root-tree.c
+++ b/root-tree.c
@@ -183,7 +183,10 @@ int btrfs_del_root(struct btrfs_trans_handle *trans, struct btrfs_root *root,
goto out;
if (ret) {
btrfs_print_leaf(root, path->nodes[0]);
-printk("failed to del %Lu %u %Lu\n", key->objectid, key->type, key->offset);
+printk("failed to del %llu %u %llu\n",
+ (unsigned long long)key->objectid,
+ key->type,
+ (unsigned long long)key->offset);

}
BUG_ON(ret != 0);
diff --git a/utils.c b/utils.c
index 0a067e6..7d5a5d6 100644
--- a/utils.c
+++ b/utils.c
@@ -438,7 +438,7 @@ int btrfs_add_to_fsid(struct btrfs_trans_handle *trans,

memcpy(disk_super, super, sizeof(*disk_super));

- printf("adding device id %Lu\n", device.devid);
+ printf("adding device id %llu\n", (unsigned long long)device.devid);
btrfs_set_stack_device_id(dev_item, device.devid);
btrfs_set_stack_device_type(dev_item, device.type);
btrfs_set_stack_device_io_align(dev_item, device.io_align);
diff --git a/volumes.c b/volumes.c
index 7ab48b1..7127677 100644
--- a/volumes.c
+++ b/volumes.c
@@ -121,7 +121,7 @@ static int device_list_add(const char *path,
}
if (fs_devices->lowest_devid > devid) {
fs_devices->lowest_devid = devid;
- printk("lowest devid now %Lu\n", devid);
+ printk("lowest devid now %llu\n", (unsigned long long)devid);
}
*fs_devices_ret = fs_devices;
return 0;
@@ -151,7 +151,8 @@ int btrfs_open_devices(struct btrfs_fs_devices *fs_devices, int flags)
list_for_each(cur, head) {
device = list_entry(cur, struct btrfs_device, dev_list);
fd = open(device->name, flags);
-printk("opening %s devid %Lu fd %d\n", device->name, device->devid, fd);
+printk("opening %s devid %llu fd %d\n", device->name,
+ (unsigned long long)device->devid, fd);
if (fd < 0) {
ret = -errno;
goto fail;
@@ -195,7 +196,7 @@ int btrfs_scan_one_device(int fd, const char *path,
}
devid = le64_to_cpu(disk_super->dev_item.devid);
*total_devs = btrfs_super_num_devices(disk_super);
- printk("found device %Lu on %s\n", devid, path);
+ printk("found device %llu on %s\n", (unsigned long long)devid, path);
ret = device_list_add(path, disk_super, devid, fs_devices_ret);

error_brelse:
@@ -639,7 +640,9 @@ again:
key.objectid,
calc_size, &dev_offset);
BUG_ON(ret);
-printk("alloc chunk size %Lu from dev %Lu\n", calc_size, device->devid);
+printk("alloc chunk size %llu from dev %llu\n",
+ (unsigned long long)calc_size,
+ (unsigned long long)device->devid);
device->bytes_used += calc_size;
ret = btrfs_update_device(trans, device);
BUG_ON(ret);
@@ -838,7 +841,8 @@ static int read_one_dev(struct btrfs_root *root,
devid = btrfs_device_id(leaf, dev_item);
device = btrfs_find_device(root, devid);
if (!device) {
- printk("warning devid %Lu not found already\n", devid);
+ printk("warning devid %llu not found already\n",
+ (unsigned long long)devid);
device = kmalloc(sizeof(*device), GFP_NOFS);
if (!device)
return -ENOMEM;
--
1.5.3.1.g1e61

2008-03-31 20:29:23

by Alex Chiang

[permalink] [raw]
Subject: [PATCH 2/2] btrfs-progs: Stop stomping on 'name' input parameter

In btrfs_name_hash, Local variable 'buf' is declared as

__u32 buf[2];

but we then try to do this:

buf[0] = 0x67452301;
buf[1] = 0xefcdab89;
buf[2] = 0x98badcfe;
buf[3] = 0x10325476;

Oops. Fix buf to be the proper size.

Signed-off-by: Alex Chiang <[email protected]>
---
hash.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hash.c b/hash.c
index 58f0be6..6a0795d 100644
--- a/hash.c
+++ b/hash.c
@@ -80,7 +80,7 @@ u64 btrfs_name_hash(const char *name, int len)
__u32 hash;
__u32 minor_hash = 0;
const char *p;
- __u32 in[8], buf[2];
+ __u32 in[8], buf[4];
u64 hash_result;

/* Initialize the default seed for the hash checksum functions */
--
1.5.3.1.g1e61

2008-03-31 20:35:29

by Alex Chiang

[permalink] [raw]
Subject: Re: [ANNOUNCE] Btrfs v0.13

* Alex Chiang <[email protected]>:
>
> 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.

Oh, and for those curious, here's the output of btrfsck:

[root@canola btrfs-progs-unstable]# btrfsck /dev/cciss/c2d1
found device 1 on /dev/cciss/c2d1
lowest devid now 1
found Btrfs on /dev/cciss/c2d1 with 1 devices
opening /dev/cciss/c2d1 devid 1 fd 4
found 102400 bytes used err is 0
total csum bytes: 0
total tree bytes: 81920
btree space waste bytes: 79462
file data blocks allocated: 0
referenced 0


[yes, that's working over the cciss block device ;)]

/ac

2008-03-31 20:45:25

by David Miller

[permalink] [raw]
Subject: Re: [ANNOUNCE] Btrfs v0.13

From: Alex Chiang <[email protected]>
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.

2008-03-31 20:53:48

by Chris Mason

[permalink] [raw]
Subject: Re: [ANNOUNCE] Btrfs v0.13

On Monday 31 March 2008, Alex Chiang wrote:
> * Chris Mason <[email protected]>:
> > Hello everyone,
> >
> > Btrfs v0.13 is now available for download from:
>
> Hi Chris,
>
> Following are two patches that allow btrfs-progs to build on
> ia64, and prevent a SEGV when trying to do a mkfs.btrfs.
>
> 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.
>

Great, thanks I'll take these two. The kernel side needs the same hash.c fix,
but I've already got that change made locally.

-chris

2008-03-31 21:03:12

by Alex Chiang

[permalink] [raw]
Subject: Re: [ANNOUNCE] Btrfs v0.13

* Chris Mason <[email protected]>:
>
> Great, thanks I'll take these two. The kernel side needs the
> same hash.c fix, but I've already got that change made locally.

Here's a patch for the kernel side.

/ac

Subject: [PATCH] btrfs: Stop trashing 'name' arg of btrfs_name_hash
From: Alex Chiang <[email protected]>

In btrfs_name_hash, Local variable 'buf' is declared as

__u32 buf[2];

but we then try to do this:

buf[0] = 0x67452301;
buf[1] = 0xefcdab89;
buf[2] = 0x98badcfe;
buf[3] = 0x10325476;

Oops. Fix buf to be the proper size.

Signed-off-by: Alex Chiang <[email protected]>

diff -r e4cd88595ed7 -r 03942eecb56d hash.c
--- a/hash.c Thu Feb 21 14:54:12 2008 -0500
+++ b/hash.c Mon Mar 31 14:58:00 2008 -0600
@@ -81,7 +81,7 @@ u64 btrfs_name_hash(const char *name, in
__u32 hash;
__u32 minor_hash = 0;
const char *p;
- __u32 in[8], buf[2];
+ __u32 in[8], buf[4];
u64 hash_result;

if (len == 1 && *name == '.') {

2008-03-31 22:43:58

by Alex Chiang

[permalink] [raw]
Subject: Re: [ANNOUNCE] Btrfs v0.13

* David Miller <[email protected]>:
> From: Alex Chiang <[email protected]>
> 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.
Bug report follows...

/ac

>From f955af8deb68a00d92326a283491ea088f996a53 Mon Sep 17 00:00:00 2001
From: Alex Chiang <[email protected]>
Date: Mon, 31 Mar 2008 16:41:21 -0600
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..9073209 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

2008-03-31 22:47:22

by Alex Chiang

[permalink] [raw]
Subject: Re: [ANNOUNCE] Btrfs v0.13

* David Miller <[email protected]>:
> From: Alex Chiang <[email protected]>
> 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.

So, using the patch from my last mail, I created a btrfs, but was
unable to mount it...

[root@canola btrfs]# getconf PAGESIZE
16384

[root@canola btrfs]# mkfs.btrfs -E sectorsize=16384 /dev/cciss/c2d1
found device 1 on /dev/cciss/c2d1
lowest devid now 1
found Btrfs on /dev/cciss/c2d1 with 1 devices
opening /dev/cciss/c2d1 devid 1 fd 5
alloc chunk size 8388608 from dev 1
alloc chunk size 8388608 from dev 1
fs created on /dev/cciss/c2d1 nodesize 16384 leafsize 16384
sectorsize 16384 bytes 73372631040

[root@canola btrfs]# mount -t btrfs /dev/cciss/c2d1 /mnt/btrfs
mount: /dev/cciss/c2d1: can't read superblock

And from /var/log/messages:

Mar 31 16:50:23 canola kernel: btrfs: cciss/c2d1 checksum verify
failed on 16384 wanted A76CDD59 found 4A0E371 from_this_trans 0
Mar 31 16:50:23 canola kernel: btrfs: valid FS not found on cciss/c2d1
Mar 31 16:50:23 canola kernel: btrfs: open_ctree failed

Any hints?

/ac

2008-03-31 23:25:33

by Alex Chiang

[permalink] [raw]
Subject: Re: [ANNOUNCE] Btrfs v0.13

* Alex Chiang <[email protected]>:
> * David Miller <[email protected]>:
> > From: Alex Chiang <[email protected]>
> > 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 <[email protected]>
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

2008-04-01 00:41:20

by Alex Chiang

[permalink] [raw]
Subject: Re: [ANNOUNCE] Btrfs v0.13

* Alex Chiang <[email protected]>:
> * David Miller <[email protected]>:
> > From: Alex Chiang <[email protected]>
> > 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.
>
> So, using the patch from my last mail, I created a btrfs, but was
> unable to mount it...

It turns out I am an idiot.

At some point, I got confused which btrfs trees I was working in,
and gotten switched up to where I had insmod'ed btrfs v0.13, but
was trying to mount a filesystem created with
btrfs-progs-unstable. Of course, I got a version mismatch when it
went to check for BTRFS_MAGIC and mount failed.

Moving to btrfs-unstable allowed me to mount the filesystem.

[root@canola btrfs-unstable]# mount -t btrfs /dev/cciss/c2d1
/mnt/btrfs
scan one opens /dev/cciss/c2d1
found device 1 on /dev/cciss/c2d1
lowest devid now 1
scan one closes bdev /dev/cciss/c2d1
opening /dev/cciss/c2d1 devid 1
lowest bdev /dev/cciss/c2d1

Sorry for the noise.

/ac