Re: Btrfs default subvolume, /home
On Sat, 2011-11-05 at 22:22 -0400, Eric Griffith wrote: Hey guys, I've been trying out BTRFS the last couple days, just to kind of see what to expect and what I can do with it once its finalized and we have a working fsck. I do have a couple question that neither the Arch Wiki, The Fedora WIki, Ubuntu wiki or the kernel.org wiki could answer. So here goes; When I installed fedora (F16 Beta) I made root be an ext4 partition, with /home as BTRFS. Ubuntu wiki states that any BTRFS partition has a default subvolume called default, I cant find it for /home. /etc/fstab: # # /etc/fstab # Created by anaconda on Thu Nov 3 15:24:14 2011 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # UUID=e5021a48-c961-4e73-98a5-beee06355f46 / ext4 defaults 1 1 UUID=97ac420f-2818-4833-b7b6-4ac497716e3b /home btrfs defaults,autodefrag,compress 1 2 UUID=0d275462-1ad3-46af-a1b8-637ca5efeca6 swap swap defaults 0 0 btrfs --help says. btrfs subvolume list path : List the snapshot/subvolume of a filesystem. I'd expect it to spit out default at some point. Couple outputs [eric@eric-laptop ~]$ sudo btrfs subvolume list / ERROR: '/' is not a subvolume [eric@eric-laptop ~]$ sudo btrfs subvolume list /home [eric@eric-laptop ~]$ It doesn't list the root volume (0). I'm not sure if it ever did - it is root volume so it might not subvolume. What i wanted was an easy; reliable way to keep a backup of my home using btrfs instead of just rsync. Unfortunately, in order to use snapshot, it needs to be on, or be a, subvolume. Remember that snapshots are not backups. If anything damages your partition, or even sector your file is in, you have troubles. proof: [eric@eric-laptop ~]$ sudo btrfs subvolume snapshot /home/eric /home/eric/test ERROR: '/home/eric' is not a subvolume [eric@eric-laptop ~]$ Why not (with eric back on /home): btrfs subvolume snapshot /home /home/snapshot-$(date -u +%Y%m%d) Snapshots are not recursive. (It works for me with integration-20111030 but not integration-20111012 on 3.1.0+) So; I rebooted into single user, mv'ed /home/eric to /home/eric-btrfs, made a subvolume in /home/ named 'eric' to take the place of my home, and cp'ed all of my files from eric-btrfs to eric, a quick chown, and chmod to get the file permissions right. Rebooted, tried to login... error messages, lots of error messages. Cant switch out from / /home/eric/.kde/share/config/knotifyrc is not writable despite having read and write permission, and ownership. Can you log in from tty to check whether you can access $HOME? I'm not btrfs developer but I am not sure if you can have subvolume owned by non-root. Can anyone figure out what the heck is going on? I know BTRFS is still experimental, but I thought the layout and implementation was finalized. OR; what do I have to do to make Btrfs work as a /home as it should? (see ZFS / LVM ) Regards signature.asc Description: This is a digitally signed message part
[GIT PULL] Btrfs pull request
Hi everyone, This pull request is pretty beefy, it ended up merging a number of long running projects and cleanup queues. I've got btrfs patches in the new kernel.org btrfs repo. There are two different branches with the same changes. for-linus is against 3.1 and has also been tested against Linus' tree as of yesterday. git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs.git for-linus The next-merged branch is the same btrfs code, but has a merge commit for the current linux-next tree. There was only a single conflict, linux-next has a fix for code that no longer exists, so the merge is just to take my code. I know Linus won't end up using this, it's just to demonstrate the conflict in case he ends up with that patch. git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs.git next-merged The big features in this pull are: Many cleanups and optimizations from Josef. Many of these fixup the enospc throttling in btrfs, where we try to start IO to make sure we can do all the allocations we've promised we'll do. The end result is a dramatic improvement in random write workloads among many others. Arne Jansen and Jan Schmidt have improved the scrubber and provided utilities to walk btrfs' many backrefs. The scrubber is much faster thanks to extensive btree readahead and instead of just telling you a specific block is bad, it tells you which btree or which file was impacted by that bad block. There are also progs updates to give you the same backref walking from the command line. SUSE and Fujitsu have a nice set of error handling fixes, and Li Zefan also closed out some problems in the mount -o autodefrag mode. I kicked in an array of backup tree roots. If a given mount fails to go through because a tree root is bad, you can mount -o recovery and it'll walk through the array and try older versions of the FS. I also spent a lot of time refining Fujitsu's log tree improvements. This code has been around for quite a while, and I really wanted to get it in this time. But yesterday I hit corruptions when I mixed heavy fsyncs with heavy snapshotting, and I wasn't able to fix things in time for this merge window. Josef Bacik (60) commits (+1847/-1238): Btrfs: don't check bytes_pinned to determine if we should commit the transaction (+0/-11) Btrfs: allow callers to specify if flushing can occur for btrfs_block_rsv_check (+10/-10) Btrfs: be smarter about committing the transaction in reserve_metadata_bytes (+67/-19) Btrfs: release metadata from global reserve if we have to fallback for unlink (+4/-1) Btrfs: wait for ordered extents if we're in trouble when shrinking delalloc (+17/-8) Btrfs: add a io_ctl struct and helpers for dealing with the space cache (+375/-318) Btrfs: seperate out btrfs_block_rsv_check out into 2 different functions (+37/-24) Btrfs: check the return value of filemap_write_and_wait in the space cache (+5/-2) Btrfs: don't increase the block_rsv's size when emergency allocating space (+0/-3) Btrfs: use the global reserve when truncating the free space cache inode (+17/-5) Btrfs: make sure to unset trans-block_rsv before running delayed refs (+11/-0) Btrfs: only reserve space in fallocate if we have to do a preallocate (+16/-6) Btrfs: stop passing a trans handle all around the reservation code (+39/-43) Btrfs: skip looking for delalloc if we don't have -fill_delalloc (+5/-1) Btrfs: if we have a lot of pinned space, commit the transaction (+15/-0) Btrfs: release trans metadata bytes before flushing delayed refs (+3/-8) Btrfs: make a delayed_block_rsv for the delayed item insertion (+13/-7) Btrfs: ratelimit the generation printk for the free space cache (+7/-5) Btrfs: use the global reserve as a backup for deleting inodes (+11/-1) Btrfs: allow shrink_delalloc flush the needed reclaimed pages (+3/-2) Btrfs: only inherit btrfs specific flags when creating files (+11/-6) Btrfs: break out of orphan cleanup if we can't make progress (+11/-0) Btrfs: move stuff around in btrfs_inode to get better packing (+3/-3) Btrfs: reserve some space for an orphan item when unlinking (+8/-1) Btrfs: wait for ordered extents if we didn't reclaim enough (+1/-1) Btrfs: check unused against how much space we actually want (+1/-1) Btrfs: put the block group cache after we commit the super (+3/-3) Btrfs: inline checksums into the disk free space cache (+172/-68) Btrfs: use the inode's mapping mask for allocating pages (+18/-6) Btrfs: fix space leak when we fail to make an allocation (+14/-6) Btrfs: don't skip writing out a empty block groups cache (+6/-4) Btrfs: use the transactions block_rsv for the csum root (+10/-6) Btrfs: fix call to btrfs_search_slot in free space cache (+1/-1) Btrfs: use d_obtain_alias when mounting subvol/subvolid (+1/-24) Btrfs: allow us to overcommit our enospc reservations (+88/-18) Btrfs: don't get the
Re: [GIT PULL] Btrfs pull request
2011/11/6 Chris Mason chris.ma...@oracle.com: Hi Chris, and thanks a lot for your work. Arne Jansen and Jan Schmidt have improved the scrubber and provided utilities to walk btrfs' many backrefs. The scrubber is much faster thanks to extensive btree readahead and instead of just telling you a specific block is bad, it tells you which btree or which file was impacted by that bad block. Using your for-linus branch, on latest Linus' git tree, with latest git tools, I've got this: root@Q45:/home/gelma/dev/prg/btrfs# ./btrfs scrub start -Br /dev/md126 ERROR: scrubbing /dev/md126 failed for device id 1 (Cannot allocate memory) scrub canceled for 11827b37-1ba0-4b3e-883d-2746987724ca scrub started at Sun Nov 6 20:23:46 2011 and was aborted after 0 seconds total bytes scrubbed: 0.00 with 0 errors root@Q45:/home/gelma/dev/prg/btrfs# ./btrfs scrub start -Br /home/ ERROR: scrubbing /home/ failed for device id 1 (Cannot allocate memory) scrub canceled for 11827b37-1ba0-4b3e-883d-2746987724ca scrub started at Sun Nov 6 20:25:01 2011 and was aborted after 0 seconds total bytes scrubbed: 0.00 with 0 errors Thanks a lot for your time, Andrea There are also progs updates to give you the same backref walking from the command line. SUSE and Fujitsu have a nice set of error handling fixes, and Li Zefan also closed out some problems in the mount -o autodefrag mode. I kicked in an array of backup tree roots. If a given mount fails to go through because a tree root is bad, you can mount -o recovery and it'll walk through the array and try older versions of the FS. I also spent a lot of time refining Fujitsu's log tree improvements. This code has been around for quite a while, and I really wanted to get it in this time. But yesterday I hit corruptions when I mixed heavy fsyncs with heavy snapshotting, and I wasn't able to fix things in time for this merge window. Josef Bacik (60) commits (+1847/-1238): Btrfs: don't check bytes_pinned to determine if we should commit the transaction (+0/-11) Btrfs: allow callers to specify if flushing can occur for btrfs_block_rsv_check (+10/-10) Btrfs: be smarter about committing the transaction in reserve_metadata_bytes (+67/-19) Btrfs: release metadata from global reserve if we have to fallback for unlink (+4/-1) Btrfs: wait for ordered extents if we're in trouble when shrinking delalloc (+17/-8) Btrfs: add a io_ctl struct and helpers for dealing with the space cache (+375/-318) Btrfs: seperate out btrfs_block_rsv_check out into 2 different functions (+37/-24) Btrfs: check the return value of filemap_write_and_wait in the space cache (+5/-2) Btrfs: don't increase the block_rsv's size when emergency allocating space (+0/-3) Btrfs: use the global reserve when truncating the free space cache inode (+17/-5) Btrfs: make sure to unset trans-block_rsv before running delayed refs (+11/-0) Btrfs: only reserve space in fallocate if we have to do a preallocate (+16/-6) Btrfs: stop passing a trans handle all around the reservation code (+39/-43) Btrfs: skip looking for delalloc if we don't have -fill_delalloc (+5/-1) Btrfs: if we have a lot of pinned space, commit the transaction (+15/-0) Btrfs: release trans metadata bytes before flushing delayed refs (+3/-8) Btrfs: make a delayed_block_rsv for the delayed item insertion (+13/-7) Btrfs: ratelimit the generation printk for the free space cache (+7/-5) Btrfs: use the global reserve as a backup for deleting inodes (+11/-1) Btrfs: allow shrink_delalloc flush the needed reclaimed pages (+3/-2) Btrfs: only inherit btrfs specific flags when creating files (+11/-6) Btrfs: break out of orphan cleanup if we can't make progress (+11/-0) Btrfs: move stuff around in btrfs_inode to get better packing (+3/-3) Btrfs: reserve some space for an orphan item when unlinking (+8/-1) Btrfs: wait for ordered extents if we didn't reclaim enough (+1/-1) Btrfs: check unused against how much space we actually want (+1/-1) Btrfs: put the block group cache after we commit the super (+3/-3) Btrfs: inline checksums into the disk free space cache (+172/-68) Btrfs: use the inode's mapping mask for allocating pages (+18/-6) Btrfs: fix space leak when we fail to make an allocation (+14/-6) Btrfs: don't skip writing out a empty block groups cache (+6/-4) Btrfs: use the transactions block_rsv for the csum root (+10/-6) Btrfs: fix call to btrfs_search_slot in free space cache (+1/-1) Btrfs: use d_obtain_alias when mounting subvol/subvolid (+1/-24) Btrfs: allow us to overcommit our enospc reservations (+88/-18) Btrfs: don't get the block_rsv in btrfs_free_tree_block (+0/-4) Btrfs: handle enospc accounting for free space inodes (+47/-23) Btrfs: reduce the amount of space needed for truncates (+15/-4) Btrfs: kill the orphan space calculation
[PATCH] btrfs: Don't leak mem in scrub_fixup().
It seems to me that we may leak the memory allocated to 'multi' in scrub_fixup() if, for example, 'length' turns out to be less than PAGE_SIZE after we call btrfs_map_block(). This patch should take care of the leak by always kfree'ing 'multi' before we return in that error case. Signed-off-by: Jesper Juhl j...@chaosbits.net --- fs/btrfs/scrub.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) Compile tested only since I don't have any btrfs filesystems to test on. diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index a8d03d5..b53433e 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -271,6 +271,7 @@ static void scrub_fixup(struct scrub_bio *sbio, int ix) ret = btrfs_map_block(map_tree, REQ_WRITE, logical, length, multi, 0); if (ret || !multi || length PAGE_SIZE) { + kfree(multi); printk(KERN_ERR scrub_fixup: btrfs_map_block failed us for %llu\n, (unsigned long long)logical); -- 1.7.7.2 -- Jesper Juhl j...@chaosbits.net http://www.chaosbits.net/ Don't top-post http://www.catb.org/jargon/html/T/top-post.html Plain text mails only, please. -- To unsubscribe from this list: send the line unsubscribe linux-btrfs in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
How to remount btrfs without compression?
Hello, Is there any possibility to remount a compressed btrfs without any compression at all? Syslinux bootloader does not understand any btrfs compression and whenever I edit syslinux.cfg on my compressed / subvolume, the file becomes compressed and thus unreadable by syslinux on the next boot. I tried to remount / without the 'compress' option (and edit syslinux.cfg in uncompressed state) and while the mount command would not show compression any more, I can see in the /proc/mounts that compression is still there and the file still gets compressed after editing. But there seem to be no mount option like compress=none or something. The only workaround I found is to boot from a live CD mount / without any compression and re-save syslinux.cfg. Then it the file gets uncompressed. Are there any other options except for this workaround to temporarily remount btrfs without compression? thanks -- To unsubscribe from this list: send the line unsubscribe linux-btrfs in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: at fs/btrfs/extent-tree.c:124
In for-linus branch, when xfstests was executed, the following warning messages were output. Thanks, Tsutomu === Nov 7 13:51:00 luna kernel: [ 824.063444] device fsid 2f0ad8a9-93d5-4c99-837f-9db99543133b devid 1 transid 1822 /dev/sdd4 Nov 7 13:51:00 luna kernel: [ 824.063946] btrfs: disk space caching is enabled Nov 7 13:51:00 luna kernel: [ 824.097652] block group 1103101952 has an wrong amount of free space Nov 7 13:51:00 luna kernel: [ 824.097873] btrfs: failed to load free space cache for block group 1103101952 Nov 7 13:51:01 luna kernel: [ 824.413821] [ cut here ] Nov 7 13:51:01 luna kernel: [ 824.413855] WARNING: at fs/btrfs/extent-tree.c:124 btrfs_put_block_group+0x4f/0x67 [btrfs]() Nov 7 13:51:01 luna kernel: [ 824.413858] Hardware name: PRIMERGY Nov 7 13:51:01 luna kernel: [ 824.413860] Modules linked in: btrfs zlib_deflate crc32c libcrc32c nfsd lockd nfs_acl auth_rpcgss autofs4 sunrpc 8021q garp stp llc cpufreq_ondemand acpi_cpufreq freq_table mperf cachefiles fscache ipv6 ext3 jbd dm_mirror dm_region_hash dm_log dm_mod kvm uinput ppdev parport_pc parport sg pcspkr i2c_i801 i2c_core iTCO_wdt iTCO_vendor_support tg3 shpchp pci_hotplug i3000_edac edac_core ext4 mbcache jbd2 crc16 sd_mod crc_t10dif megaraid_sas sr_mod cdrom floppy pata_acpi ata_generic ata_piix libata scsi_mod [last unloaded: microcode] Nov 7 13:51:01 luna kernel: [ 824.413915] Pid: 7472, comm: umount Not tainted 3.1.0mod+ #1 Nov 7 13:51:01 luna kernel: [ 824.413917] Call Trace: Nov 7 13:51:01 luna kernel: [ 824.413925] [8104b6fe] warn_slowpath_common+0x85/0x9d Nov 7 13:51:01 luna kernel: [ 824.413929] [8104b730] warn_slowpath_null+0x1a/0x1c Nov 7 13:51:01 luna kernel: [ 824.413943] [a043691c] btrfs_put_block_group+0x4f/0x67 [btrfs] Nov 7 13:51:01 luna kernel: [ 824.413956] [a043710c] btrfs_free_block_groups+0xde/0x258 [btrfs] Nov 7 13:51:01 luna kernel: [ 824.413973] [a0447a59] close_ctree+0x22c/0x325 [btrfs] Nov 7 13:51:01 luna kernel: [ 824.413978] [8112e426] ? dispose_list+0x3e/0x4f Nov 7 13:51:01 luna kernel: [ 824.413989] [a042cb7d] btrfs_put_super+0x1d/0x2c [btrfs] Nov 7 13:51:01 luna kernel: [ 824.413994] [8111bcdc] generic_shutdown_super+0x5b/0xba Nov 7 13:51:01 luna kernel: [ 824.413998] [8111bdba] kill_anon_super+0x16/0x22 Nov 7 13:51:01 luna kernel: [ 824.414002] [8111c5b2] deactivate_locked_super+0x26/0x57 Nov 7 13:51:01 luna kernel: [ 824.414006] [8111cfe5] deactivate_super+0x45/0x4c Nov 7 13:51:01 luna kernel: [ 824.414010] [81132237] mntput_no_expire+0x143/0x14c Nov 7 13:51:01 luna kernel: [ 824.414822] [81132de3] sys_umount+0x2d9/0x304 Nov 7 13:51:01 luna kernel: [ 824.414838] [81122c69] ? path_put+0x22/0x26 Nov 7 13:51:01 luna kernel: [ 824.414846] [813af4c2] system_call_fastpath+0x16/0x1b Nov 7 13:51:01 luna kernel: [ 824.414852] ---[ end trace 1167c1ef9b771b7f ]--- Nov 7 13:51:01 luna kernel: [ 824.418017] [ cut here ] Nov 7 13:51:01 luna kernel: [ 824.418039] WARNING: at fs/btrfs/extent-tree.c:7158 btrfs_free_block_groups+0x220/0x258 [btrfs]() Nov 7 13:51:01 luna kernel: [ 824.418042] Hardware name: PRIMERGY Nov 7 13:51:01 luna kernel: [ 824.418044] Modules linked in: btrfs zlib_deflate crc32c libcrc32c nfsd lockd nfs_acl auth_rpcgss autofs4 sunrpc 8021q garp stp llc cpufreq_ondemand acpi_cpufreq freq_table mperf cachefiles fscache ipv6 ext3 jbd dm_mirror dm_region_hash dm_log dm_mod kvm uinput ppdev parport_pc parport sg pcspkr i2c_i801 i2c_core iTCO_wdt iTCO_vendor_support tg3 shpchp pci_hotplug i3000_edac edac_core ext4 mbcache jbd2 crc16 sd_mod crc_t10dif megaraid_sas sr_mod cdrom floppy pata_acpi ata_generic ata_piix libata scsi_mod [last unloaded: microcode] Nov 7 13:51:01 luna kernel: [ 824.418107] Pid: 7472, comm: umount Tainted: G W 3.1.0mod+ #1 Nov 7 13:51:01 luna kernel: [ 824.418110] Call Trace: Nov 7 13:51:01 luna kernel: [ 824.418117] [8104b6fe] warn_slowpath_common+0x85/0x9d Nov 7 13:51:01 luna kernel: [ 824.418121] [8104b730] warn_slowpath_null+0x1a/0x1c Nov 7 13:51:01 luna kernel: [ 824.418137] [a043724e] btrfs_free_block_groups+0x220/0x258 [btrfs] Nov 7 13:51:01 luna kernel: [ 824.418157] [a0447a59] close_ctree+0x22c/0x325 [btrfs] Nov 7 13:51:01 luna kernel: [ 824.418161] [8112e426] ? dispose_list+0x3e/0x4f Nov 7 13:51:01 luna kernel: [ 824.418175] [a042cb7d] btrfs_put_super+0x1d/0x2c [btrfs] Nov 7 13:51:01 luna kernel: [ 824.418180] [8111bcdc] generic_shutdown_super+0x5b/0xba Nov 7 13:51:01 luna kernel: [ 824.418185] [8111bdba] kill_anon_super+0x16/0x22 Nov 7 13:51:01 luna kernel: [ 824.418190] [8111c5b2]
[btrfs-progs: PATCH] scrub: fix build failure by restoring proper library ordering
From: Sergei Trofimovich sly...@gentoo.org $ LDFLAGS=-static make gcc -lpthread -g -O0 -o btrfs btrfs.o btrfs_cmds.o scrub.o \ ctree.o disk-io.o radix-tree.o extent-tree.o print-tree.o root-tree.o dir-item.o file-item.o inode-item.o inode-map.o crc32c.o rbtree.o extent-cache.o extent_io.o volumes.o utils.o btrfs-list.o btrfslabel.o -static -luuid scrub.o: In function `scrub_write_progress': /home/slyfox/linux-2.6-um-x86_64-fs/btrfs-progs-unstable/scrub.c:752: undefined reference to `pthread_mutex_lock' /home/slyfox/linux-2.6-um-x86_64-fs/btrfs-progs-unstable/scrub.c:758: undefined reference to `pthread_setcancelstate' /home/slyfox/linux-2.6-um-x86_64-fs/btrfs-progs-unstable/scrub.c:783: undefined reference to `pthread_mutex_unlock' /home/slyfox/linux-2.6-um-x86_64-fs/btrfs-progs-unstable/scrub.c:787: undefined reference to `pthread_setcancelstate' Signed-off-by: Sergei Trofimovich sly...@gentoo.org --- Makefile |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index edee1a0..4d498b9 100644 --- a/Makefile +++ b/Makefile @@ -36,8 +36,8 @@ version: bash version.sh btrfs: $(objects) btrfs.o btrfs_cmds.o scrub.o - $(CC) -lpthread $(CFLAGS) -o btrfs btrfs.o btrfs_cmds.o scrub.o \ - $(objects) $(LDFLAGS) $(LIBS) + $(CC) $(CFLAGS) -o btrfs btrfs.o btrfs_cmds.o scrub.o \ + $(objects) $(LDFLAGS) $(LIBS) -lpthread btrfsctl: $(objects) btrfsctl.o $(CC) $(CFLAGS) -o btrfsctl btrfsctl.o $(objects) $(LDFLAGS) $(LIBS) -- 1.7.3.4 -- To unsubscribe from this list: send the line unsubscribe linux-btrfs in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html