Btrfs v0.10 (online growing/shrinking, ext3 conversion, and more)
Hello everyone,
Btrfs v0.10 is now available for download from:
http://oss.oracle.com/projects/btrfs/
Btrfs is still in an early alpha state, and the disk format is not finalized. v0.10 introduces a new disk format, and is not compatible with v0.9.
The core of this release is explicit back references for all metadata blocks, data extents, and directory items. These are a crucial building block for future features such as online fsck and migration between devices. The back references are verified during deletes, and the extent back references are checked by the existing offline fsck tool.
For all of the details of how the back references are maintained, please see the design document:
http://oss.oracle.com/projects/btrfs/dist/documentation/btrfs-design.html
Other new features (described in detail below):
* Online resizing (including shrinking)
* In place conversion from Ext3 to Btrfs
* data=ordered support
* Mount options to disable data COW and checksumming
* Barrier support for sata and IDE drives
[ Resizing ]
In order to demonstrate and test the back references, I've added an online resizer, which can both grow and shrink the filesystem:
mount -t btrfs /dev/xxx /mnt
# add 2GB to the FS btrfsctl -r +2g /mnt
# shrink the FS by 4GB btrfsctl -r -4g /mnt
# Explicitly set the FS size
btrfsctl -r 20g /mnt
# Use 'max' to grow the FS to the limit of the device btrfsctl -r max /mnt
[ Conversion from Ext3 ]
This is an offline, in place, conversion program written by Yan Zheng. It has been through basic testing, but should not be trusted with critical data.
To build the conversion program, run 'make convert' in the btrfs-progs tree. It depends on libe2fs and acl development libraries.
The conversion program uses the copy on write nature of Btrfs to preserve the original Ext3 FS, sharing the data blocks between Btrfs and Ext3 metadata. Btrfs metadata is created inside the free space of the Ext3 filesystem, and it is possible to either make the conversion permanent (reclaiming the space used by Ext3) or roll back the conversion to the original Ext3 filesystem.
More details and example usage of the conversion program can be found here:
http://oss.oracle.com/projects/btrfs/dist/documentation/btrfs-converter.html
Thanks to Yan Zheng for all of his work on the converter.
[ New mount options ]
mount -o nodatacsum disables checksumming on data extents
mount -o nodatacow disables copy on write of data extents, unless a given extent is referenced by more than one snapshot. This is targeted at database workloads, where copy on write is not optimal for performance.
The explicit back references allow the nodatacow code to make sure copy on write is done when multiple snapshots reference the same file, maintaining snapshot consistency.
mount -o alloc_start=num forces allocation hints to start at least num bytes into the disk. This was introduced to test the resizer. Example usage:
mount -o alloc_start=16g /dev/xxxx /mnt
(do something to the FS)
btrfsctl -r 12g /mnt
The btrfsctl command will resize the FS down to 12GB in size. Because the FS was mounted with -o alloc_start=16g, any allocations done after mounting will need to be relocated by the resizer.
It is safe to specify a number past the end of the FS, if the alloc_start is too large, it is ignored.
mount -o nobarrier disables cache flushes during commit.
-chris
Quoted 5 lines · Chris Mason
http://oss.oracle.com/projects/btrfs/
Btrfs is still in an early alpha state, and the disk format is not finalized. v0.10 introduces a new disk format, and is not compatible with v0.9.
Looks like fun. btrfsck fails to check if it actually received a dev argument though, so if you don't pass a device, we get a nice segfault.
---
btrfsck.c +8 -0
@@ -709,6 +709,11 @@return err; } +void print_usage (void ) { +fprintf (stderr,"usage: btrfsck dev\n" ); +exit (1 ); +} +int main (int ac,char **av) {struct btrfs_root *root;struct cache_tree extent_cache;
@@ -727,6 +732,9 @@int slot;struct btrfs_root_item ri; +if (ac <2 ) +print_usage (); +radix_tree_init ();cache_tree_init (&extent_cache);cache_tree_init (&seen);
Quoted 3 lines · Chris Mason
Hello everyone,
Btrfs v0.10 is now available for download from:
It does not even compile for me, tested with 2.6.24-rc{7,8}. I will look at that later.
fs/built-in.o: In function `btrfs_xattr_set_acl':
acl.c:(.text+0x68f33): undefined reference to posix_acl_from_xattr' acl.c:(.text+0x68f47): undefined reference to posix_acl_valid'
make: *** [.tmp_vmlinux1] Error 1
Is this release supposed to fix the suspend problem?
Signature · 2 lines
Regards, Chris
ons, 16 01 2008 kl. 11:02 +0100, skrev Christian Hesse:
Quoted 5 lines · Chris Mason
Quoted 3 lines
Hello everyone,
Btrfs v0.10 is now available for download from:
Quoted 8 lines
It does not even compile for me, tested with 2.6.24-rc{7,8}. I will look at that later.
fs/built-in.o: In function `btrfs_xattr_set_acl':
acl.c:(.text+0x68f33): undefined reference toposix_acl_from_xattr' acl.c:(.text+0x68f47): undefined reference toposix_acl_valid'
make: *** [.tmp_vmlinux1] Error 1
See this build fix for kernels without acl by Yan Zheng on the btrfs-devel list
http://oss.oracle.com/pipermail/btrfs-devel/2008-January/000386.html
Simon Holm Thøgersen
Quoted 5 lines · Chris Mason
Hello everyone,
Btrfs v0.10 is now available for download from:
Well, it turns out this release had a few small problems:
* data=ordered deadlock on older kernels (including 2.6.23)
* Compile problems when ACLs were not enabled in the kernel
So, I've put v0.11 out there. It fixes those two problems and will also compile on older (2.6.18) enterprise kernels.
v0.11 does not have any disk format changes.
-chris
Quoted 4 lines · Chris mason
So, I've put v0.11 out there. It fixes those two problems and will also compile on older (2.6.18) enterprise kernels.
v0.11 does not have any disk format changes.
Hi Chris,
First, massive congratulations for bringing this to fruition in such a short time.
Now back to the regular carping: why even support older kernels?
Regards,
Daniel
Quoted 4 lines · Daniel Phillips
Quoted 3 lines · Chris mason
So, I've put v0.11 out there. It fixes those two problems and will also compile on older (2.6.18) enterprise kernels.
Quoted 8 lines
Quoted 1 line
v0.11 does not have any disk format changes.
Hi Chris,
First, massive congratulations for bringing this to fruition in such a short time.
Now back to the regular carping: why even support older kernels?
The general answer is the backports are small and easy. I don't test them heavily, and I don't go out of my way to make things work.
But, they do make it easier for people to try out, and to figure how to use all these new features to solve problems. Small changes that enable more testers are always welcome.
In general, the core parts of the kernel that btrfs uses haven't had many interface changes since 2.6.18, so this isn't a huge deal.
-chris
Quoted 1 line · Chris mason
So, I've put v0.11 out there.
Ok, back to the suspend problem I mentioned:
Jan 18 00:04:40 revo WARNING: at fs/btrfs/tree-defrag.c:74 defrag_walk_down() Jan 18 00:04:40 revo Pid: 258, comm: btrfs/0 Not tainted 2.6.24-rc8 #1 Jan 18 00:04:40 revo [<b01ddef3>] btrfs_defrag_leaves+0x273/0x8c0 Jan 18 00:04:40 revo [<b01d5b57>] btrfs_defrag_root+0x67/0xe0 Jan 18 00:04:40 revo [<b01d5c43>] btrfs_defrag_dirty_roots+0x73/0x80 Jan 18 00:04:40 revo [<b01d5c50>] btrfs_transaction_cleaner+0x0/0xd0 Jan 18 00:04:40 revo [<b01d5cf2>] btrfs_transaction_cleaner+0xa2/0xd0 Jan 18 00:04:40 revo [<b013911d>] run_workqueue+0xad/0x130 Jan 18 00:04:40 revo [<b0139b80>] worker_thread+0x0/0xf0 Jan 18 00:04:40 revo [<b0139c0c>] worker_thread+0x8c/0xf0 Jan 18 00:04:40 revo [<b013d100>] autoremove_wake_function+0x0/0x40 Jan 18 00:04:40 revo [<b0139b80>] worker_thread+0x0/0xf0 Jan 18 00:04:40 revo [<b013ce42>] kthread+0x42/0x70 Jan 18 00:04:40 revo [<b013ce00>] kthread+0x0/0x70 Jan 18 00:04:40 revo [<b0104ea7>] kernel_thread_helper+0x7/0x10 Jan 18 00:04:40 revo ======================= Jan 18 00:04:40 revo BUG: unable to handle kernel NULL pointer dereference at virtual address 0000001c Jan 18 00:04:40 revo printing eip: b01d3c58 *pde = 00000000 Jan 18 00:04:40 revo Oops: 0000 [#1] SMP Jan 18 00:04:40 revo Modules linked in: iwl3945 Jan 18 00:04:40 revo Jan 18 00:04:40 revo Pid: 258, comm: btrfs/0 Not tainted (2.6.24-rc8 #1) Jan 18 00:04:40 revo EIP: 0060:[<b01d3c58>] EFLAGS: 00010292 CPU: 0 Jan 18 00:04:40 revo EIP is at btrfs_clear_buffer_defrag+0x18/0x80 Jan 18 00:04:40 revo EAX: 00000000 EBX: 00000000 ECX: eec6d528 EDX: eec6d528 Jan 18 00:04:40 revo ESI: ee544200 EDI: ee40c000 EBP: 00000040 ESP: ee40de8c Jan 18 00:04:40 revo DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068 Jan 18 00:04:40 revo Process btrfs/0 (pid: 258, ti=ee40c000 task=ef0ab570 task.ti=ee40c000) Jan 18 00:04:40 revo Stack: 00100fff 00000000 00000040 00000000 d343bdbc eec37634 ee544200 00000000 Jan 18 00:04:40 revo ee544200 ee40c000 00000000 b01de0b5 eec37e14 00000000 ee40df14 b04b6a09 Jan 18 00:04:40 revo 00000001 eedf23e4 eec6d528 00000000 02ba5cc0 eec37e14 01000000 00000010 Jan 18 00:04:40 revo Call Trace: Jan 18 00:04:40 revo [<b01de0b5>] btrfs_defrag_leaves+0x435/0x8c0 Jan 18 00:04:40 revo [<b01d5b57>] btrfs_defrag_root+0x67/0xe0 Jan 18 00:04:40 revo [<b01d5c43>] btrfs_defrag_dirty_roots+0x73/0x80 Jan 18 00:04:40 revo [<b01d5c50>] btrfs_transaction_cleaner+0x0/0xd0 Jan 18 00:04:40 revo [<b01d5cf2>] btrfs_transaction_cleaner+0xa2/0xd0 Jan 18 00:04:40 revo [<b013911d>] run_workqueue+0xad/0x130 Jan 18 00:04:40 revo [<b0139b80>] worker_thread+0x0/0xf0 Jan 18 00:04:40 revo [<b0139c0c>] worker_thread+0x8c/0xf0 Jan 18 00:04:40 revo [<b013d100>] autoremove_wake_function+0x0/0x40 Jan 18 00:04:40 revo [<b0139b80>] worker_thread+0x0/0xf0 Jan 18 00:04:40 revo [<b013ce42>] kthread+0x42/0x70 Jan 18 00:04:40 revo [<b013ce00>] kthread+0x0/0x70 Jan 18 00:04:40 revo [<b0104ea7>] kernel_thread_helper+0x7/0x10 Jan 18 00:04:40 revo ======================= Jan 18 00:04:40 revo Code: 24 1c 8b 74 24 20 8b 7c 24 24 8b 6c 24 28 83 c4 2c c3 90 83 ec 2c 89 74 24 20 89 6c 24 28 bd 40 00 00 00 89 5c 24 1c 89 7c 24 24 <8b> 58 1c 8b 10 8b 48 04 8b 5b 10 89 ce 8b 1b 8b 5b b8 8b 9b bc Jan 18 00:04:40 revo EIP: [<b01d3c58>] btrfs_clear_buffer_defrag+0x18/0x80 SS:ESP 0068:ee40de8c Jan 18 00:04:40 revo ---[ end trace f7750d79e5545648 ]---
I get this after a suspend/resume cycle with mounted btrfs.
Signature · 2 lines
Regards, Chris
Quoted 5 lines · Christian Hesse
Quoted 1 line · Chris mason
So, I've put v0.11 out there.
Ok, back to the suspend problem I mentioned:
[ oopsen ]
Quoted 1 line
I get this after a suspend/resume cycle with mounted btrfs.
Looks like metadata corruption. How are you suspending?
-chris
Quoted 11 lines · Chris mason
Quoted 4 lines · Christian Hesse
Quoted 1 line · Chris mason
So, I've put v0.11 out there.
Ok, back to the suspend problem I mentioned:
[ oopsen ]
Quoted 1 line
I get this after a suspend/resume cycle with mounted btrfs.
Looks like metadata corruption. How are you suspending?
No, that's not metadata corruption. After reset I can use the image without problems. After resume the first access to the fs oopses.
I use kernel 2.6.24-rc8 with tuxonice 3.0-rc3 and btrfs 0.11.
Back in early december I reported the problem for btrfs 0.9. Seems like the lockfs call still is not implemented. Any hints what I need when I try to code it myself?
Signature · 2 lines
Regards, Chris
2008/1/21, Christian Hesse <[email protected]>:
Quoted 3 lines
Back in early december I reported the problem for btrfs 0.9. Seems like the lockfs call still is not implemented. Any hints what I need when I try to code it myself?
Please try this dirty patch. I think it can solve your problem.
Regards
YZ
---
super.c +14 -0
@@ -423,6 +423,18 @@ static struct file_system_type btrfs_fs_ .fs_flags = FS_REQUIRES_DEV, }; +static void btrfs_write_super_lockfs (struct super_block *sb) +{ +struct btrfs_root *root =btrfs_sb (sb); +btrfs_transaction_flush_work (root); +} + +static void btrfs_unlockfs (struct super_block *sb) +{ +struct btrfs_root *root =btrfs_sb (sb); +btrfs_transaction_queue_work (root,HZ *30 ); +} +static struct super_operations btrfs_super_ops = { .delete_inode = btrfs_delete_inode, .put_inode = btrfs_put_inode,
@@ -435,6 +447,8 @@ static struct super_operations btrfs_sup .alloc_inode = btrfs_alloc_inode, .destroy_inode = btrfs_destroy_inode, .statfs = btrfs_statfs, + .write_super_lockfs = btrfs_write_super_lockfs, + .unlockfs = btrfs_unlockfs, };static int __init init_btrfs_fs (void )
Quoted 6 lines · Yan Zheng
2008/1/21, Christian Hesse <[email protected]>:
Quoted 3 lines
Back in early december I reported the problem for btrfs 0.9. Seems like the lockfs call still is not implemented. Any hints what I need when I try to code it myself?
Please try this dirty patch. I think it can solve your problem.
Looks good... No oops so far. ;) Thanks a lot!
Signature · 2 lines
Regards, Chris