[PATCH] btrfs-progs: add '-b' option to filesystem df and show
Add '-b' and '--bytes' options to btrfs filesystem df and show, for easier integration with scripts. This causes all sizes to be displayed in decimal bytes instead of pretty-printed with human-readable suffices KB, MB, etc. Signed-off-by: Audrius Butkevicius audrius.butkevic...@elastichosts.com --- cmds-filesystem.c | 93 +++-- 1 file changed, 68 insertions(+), 25 deletions(-) diff --git a/cmds-filesystem.c b/cmds-filesystem.c index 507239a..9392209 100644 --- a/cmds-filesystem.c +++ b/cmds-filesystem.c @@ -40,7 +40,7 @@ static const char * const filesystem_cmd_group_usage[] = { }; static const char * const cmd_df_usage[] = { - btrfs filesystem df path, + btrfs filesystem df [-b|--bytes] path, Show space usage information for a mount point, NULL }; @@ -53,11 +53,23 @@ static int cmd_df(int argc, char **argv) int fd; int e; char *path; + int start = 1; + int rawbytes = 0; + + while (argc start) { + if (!strcmp(argv[start], --bytes) || + !strcmp(argv[start], -b)) { + rawbytes = 1; + start += 1; + } else { + break; + } + } - if (check_argc_exact(argc, 2)) + if (check_argc_exact(argc, start + 1)) usage(cmd_df_usage); - path = argv[1]; + path = argv[start]; fd = open_file_or_dir(path); if (fd 0) { @@ -150,10 +162,18 @@ static int cmd_df(int argc, char **argv) written += 8; } - total_bytes = pretty_sizes(sargs-spaces[i].total_bytes); - used_bytes = pretty_sizes(sargs-spaces[i].used_bytes); - printf(%s: total=%s, used=%s\n, description, total_bytes, - used_bytes); + if (rawbytes) { + printf(%s: total=%llu, used=%llu\n, description, + (unsigned long long)sargs-spaces[i].total_bytes, + (unsigned long long)sargs-spaces[i].used_bytes); + } else { + total_bytes = pretty_sizes(sargs-spaces[i].total_bytes); + used_bytes = pretty_sizes(sargs-spaces[i].used_bytes); + printf(%s: total=%s, used=%s\n, description, total_bytes, + used_bytes); + free(total_bytes); + free(bytes_used); + } } close(fd); free(sargs); @@ -182,7 +202,7 @@ static int uuid_search(struct btrfs_fs_devices *fs_devices, char *search) return 0; } -static void print_one_uuid(struct btrfs_fs_devices *fs_devices) +static void print_one_uuid(struct btrfs_fs_devices *fs_devices, int rawbytes) { char uuidbuf[37]; struct list_head *cur; @@ -199,25 +219,39 @@ static void print_one_uuid(struct btrfs_fs_devices *fs_devices) else printf(Label: none ); - super_bytes_used = pretty_sizes(device-super_bytes_used); - total = device-total_devs; - printf( uuid: %s\n\tTotal devices %llu FS bytes used %s\n, uuidbuf, - (unsigned long long)total, super_bytes_used); - free(super_bytes_used); + if (rawbytes) { + printf( uuid: %s\n\tTotal devices %llu FS bytes used %llu\n, + uuidbuf, (unsigned long long)total, + (unsigned long long)device-super_bytes_used); + } else { + super_bytes_used = pretty_sizes(device-super_bytes_used); + printf( uuid: %s\n\tTotal devices %llu FS bytes used %s\n, + uuidbuf, (unsigned long long)total, super_bytes_used); + free(super_bytes_used); + } list_for_each(cur, fs_devices-devices) { char *total_bytes; char *bytes_used; device = list_entry(cur, struct btrfs_device, dev_list); - total_bytes = pretty_sizes(device-total_bytes); - bytes_used = pretty_sizes(device-bytes_used); - printf(\tdevid %4llu size %s used %s path %s\n, - (unsigned long long)device-devid, - total_bytes, bytes_used, device-name); - free(total_bytes); - free(bytes_used); + if (rawbytes) { + printf(\tdevid %4llu size %llu used %llu path %s\n, + (unsigned long long)device-devid, + (unsigned long long)device-total_bytes, + (unsigned long long)device-bytes_used, + device-name); + } + else { + total_bytes = pretty_sizes(device-total_bytes); + bytes_used =
Re: [PATCH] btrfs-progs: add '-b' option to filesystem df and show
On Fri, Feb 01, 2013 at 09:59:49AM +, Audrius Butkevicius wrote: Add '-b' and '--bytes' options to btrfs filesystem df and show, for easier integration with scripts. This causes all sizes to be displayed in decimal bytes instead of pretty-printed with human-readable suffices KB, MB, etc. Please, not this way. The right way to do this would be to modify the pretty-print function so that it can output bytes or SI suffixes (kB, MB) or binary suffixes (KiB, MiB). I'm fairly sure I posted a patch for this a couple of years ago. There was some discussion then about the appropriate command-line options to use. The options should also be applicable to fi show, and to anything else which outputs byte counts. Note also that this may well clash with Goffredo's new free-space display (which hasn't yet made it to David's integration tree, but shouldn't be far away). Hugo. Signed-off-by: Audrius Butkevicius audrius.butkevic...@elastichosts.com --- cmds-filesystem.c | 93 +++-- 1 file changed, 68 insertions(+), 25 deletions(-) diff --git a/cmds-filesystem.c b/cmds-filesystem.c index 507239a..9392209 100644 --- a/cmds-filesystem.c +++ b/cmds-filesystem.c @@ -40,7 +40,7 @@ static const char * const filesystem_cmd_group_usage[] = { }; static const char * const cmd_df_usage[] = { - btrfs filesystem df path, + btrfs filesystem df [-b|--bytes] path, Show space usage information for a mount point, NULL }; @@ -53,11 +53,23 @@ static int cmd_df(int argc, char **argv) int fd; int e; char *path; + int start = 1; + int rawbytes = 0; + + while (argc start) { + if (!strcmp(argv[start], --bytes) || + !strcmp(argv[start], -b)) { + rawbytes = 1; + start += 1; + } else { + break; + } + } - if (check_argc_exact(argc, 2)) + if (check_argc_exact(argc, start + 1)) usage(cmd_df_usage); - path = argv[1]; + path = argv[start]; fd = open_file_or_dir(path); if (fd 0) { @@ -150,10 +162,18 @@ static int cmd_df(int argc, char **argv) written += 8; } - total_bytes = pretty_sizes(sargs-spaces[i].total_bytes); - used_bytes = pretty_sizes(sargs-spaces[i].used_bytes); - printf(%s: total=%s, used=%s\n, description, total_bytes, -used_bytes); + if (rawbytes) { + printf(%s: total=%llu, used=%llu\n, description, +(unsigned long long)sargs-spaces[i].total_bytes, +(unsigned long long)sargs-spaces[i].used_bytes); + } else { + total_bytes = pretty_sizes(sargs-spaces[i].total_bytes); + used_bytes = pretty_sizes(sargs-spaces[i].used_bytes); + printf(%s: total=%s, used=%s\n, description, total_bytes, +used_bytes); + free(total_bytes); + free(bytes_used); + } } close(fd); free(sargs); @@ -182,7 +202,7 @@ static int uuid_search(struct btrfs_fs_devices *fs_devices, char *search) return 0; } -static void print_one_uuid(struct btrfs_fs_devices *fs_devices) +static void print_one_uuid(struct btrfs_fs_devices *fs_devices, int rawbytes) { char uuidbuf[37]; struct list_head *cur; @@ -199,25 +219,39 @@ static void print_one_uuid(struct btrfs_fs_devices *fs_devices) else printf(Label: none ); - super_bytes_used = pretty_sizes(device-super_bytes_used); - total = device-total_devs; - printf( uuid: %s\n\tTotal devices %llu FS bytes used %s\n, uuidbuf, -(unsigned long long)total, super_bytes_used); - free(super_bytes_used); + if (rawbytes) { + printf( uuid: %s\n\tTotal devices %llu FS bytes used %llu\n, +uuidbuf, (unsigned long long)total, +(unsigned long long)device-super_bytes_used); + } else { + super_bytes_used = pretty_sizes(device-super_bytes_used); + printf( uuid: %s\n\tTotal devices %llu FS bytes used %s\n, +uuidbuf, (unsigned long long)total, super_bytes_used); + free(super_bytes_used); + } list_for_each(cur, fs_devices-devices) { char *total_bytes; char *bytes_used; device = list_entry(cur, struct btrfs_device, dev_list); - total_bytes = pretty_sizes(device-total_bytes); - bytes_used = pretty_sizes(device-bytes_used); - printf(\tdevid %4llu size %s used %s path %s\n, -(unsigned long long)device-devid, -
Re: [PATCH] Btrfs-prog/send: fix wrong dump_fd check in cmd_send_start()
On Fri, Feb 01, 2013 at 10:58:33AM +0800, Chen Yang wrote: Good catch, thanks. I see that there's no special handling of the '-' filename that usually means stdout. We may want to add this as a common command line usage pattern. We can touch a file name -, so I think special handling of the '-' is unnecessary. I want to avoid creating a file named '-'. It would work the same way as 'cat -' etc. david -- 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
Re: btrfs: extended inode refs
On Thu, Jan 31, 2013 at 01:25:26PM -0500, Norbert Veber wrote: On Thu, Jan 31, 2013 at 06:34:04PM +0100, David Sterba wrote: Otherwise, Mark's patches add the incompat bit unconditionally, we need a way how to make it tunable in the same way as other mkfs do. I'd say to take them as-is now and extend mkfs later. Well I guess its more of a job for btrfstune. Same way as tune2fs can enable all of their features. Right. Having to reformat seems uncecessary. Right. david -- 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
[no subject]
subscribe -- 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
Re: [PATCH 1/2] Btrfs: serialize unlocked dio reads with truncate
On Thu, Jan 31, 2013 at 10:56:34PM -0700, Miao Xie wrote: On Thu, 31 Jan 2013 11:40:41 -0500, Josef Bacik wrote: On Thu, Jan 31, 2013 at 02:23:19AM -0700, Miao Xie wrote: Currently, we can do unlocked dio reads, but the following race is possible: dio_read_task truncate_task -btrfs_setattr() -btrfs_direct_IO -__blockdev_direct_IO -btrfs_get_block -btrfs_truncate() #alloc truncated blocks #to other inode -submit_io() #INFORMATION LEAK In order to avoid this problem, we must serialize unlocked dio reads with truncate by inode_dio_wait(). So I had thinking about this, are we sure we don't want to just lock the extent range when we truncate? I'm good with this, but it seems like we might as well and be consistent and use the extent locks. What do you think? Thanks, But comparing with the current approach, the extent lock has the following problem: Dio_Read_Task Truncate_task truncate file set isize to 4096 drop pages lock extent[4096, 8191] read extent[4096, 8191] unlock extent[4096, 8191] lock extent[4096, -1ULL] truncate item unlock extent[4096, -1ULL] lock extent[8192, ...] read extent[8192, ...] no extent item zero the buffer unlock extent[8192, ...] we get the data that is mixed with new data.(Punch hole also has this problem, we need fix) So this case is fine, since we'll still get valid data, the extents would still be there. If you are mixing dio reads with simultaneous truncate/hole punching you deserve to get your ass bitten :). The other option would be to lock before we set the isize, or check the isize in get_extents. Thanks, Josef -- 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
IO failure when trying to convert degraded raid1 to single
Hello, Trying to convert degraded raid1 to single... # mount btrfs0.img /mnt/test -oloop,degraded # btrfs filesystem balance start -mconvert=single -dconvert=single -f /mnt/test ...ends up with: Btrfs v0.20-rc1-56-g6cd836d device fsid 88c73405-12f4-4dc8-90f2-71925867d0c5 devid 1 transid 4 /dev/loop0 btrfs: allowing degraded mounts btrfs: disk space caching is enabled btrfs: force reducing metadata integrity BTRFS error (device loop0) in write_all_supers:3070: IO failure (errors while submitting device barriers.) btrfs is forced readonly BTRFS warning (device loop0): Skipping commit of aborted transaction. [ cut here ] WARNING: at fs/btrfs/super.c:246 __btrfs_abort_transaction+0xb7/0xd0() Hardware name: Bochs Pid: 334, comm: btrfs Not tainted 3.6.0+ #1 Call Trace: [c101f4b8] warn_slowpath_common+0x68/0xa0 [c110a0b7] ? __btrfs_abort_transaction+0xb7/0xd0 [c110a0b7] ? __btrfs_abort_transaction+0xb7/0xd0 [c101f54e] warn_slowpath_fmt+0x2e/0x30 [c110a0b7] __btrfs_abort_transaction+0xb7/0xd0 [c11305de] btrfs_commit_transaction+0xde/0x940 [c619] ? btrfs_search_slot+0x3a9/0x7f0 [c11508fe] ? map_private_extent_buffer+0x5e/0xe0 [c1129050] ? btree_set_page_dirty+0x30/0x40 [c10630b7] ? set_page_dirty+0x47/0x50 [c114fa4f] ? set_extent_buffer_dirty+0x6f/0xa0 [c1036b50] ? abort_exclusive_wait+0x60/0x60 [c110cc0b] ? btrfs_free_path+0x1b/0x20 [c11524a4] insert_balance_item+0x494/0x4c0 [c1003833] ? do_IRQ+0x43/0xa0 [c1156d16] btrfs_balance+0x396/0x1030 [c101cf0e] ? kmap_atomic+0xe/0x10 [c1060a6c] ? get_page_from_freelist+0x22c/0x500 [c101ce7e] ? kmap_atomic_prot+0x3e/0xc0 [c107d66a] ? kmem_cache_alloc+0x5a/0xf0 [c115d88d] ? btrfs_ioctl_balance+0x13d/0x430 [c115d816] btrfs_ioctl_balance+0xc6/0x430 [c1160940] ? update_ioctl_balance_args+0x420/0x420 [c116128f] btrfs_ioctl+0x94f/0x1830 [c1076736] ? anon_vma_prepare+0xb6/0x110 [c1064c8d] ? lru_cache_add_lru+0x1d/0x40 [c1075fdc] ? page_add_new_anon_rmap+0x6c/0x80 [c101c05e] ? pte_alloc_one+0x1e/0x40 [c1160940] ? update_ioctl_balance_args+0x420/0x420 [c108f456] do_vfs_ioctl+0x76/0x570 [c10192b3] ? do_page_fault+0x173/0x410 [c1073969] ? do_brk+0x1a9/0x2d0 [c108f97d] sys_ioctl+0x2d/0x60 [c1221a45] syscall_call+0x7/0xb ---[ end trace b997a9531fdaebad ]--- BTRFS error (device loop0) in cleanup_transaction:1378: IO failure delayed_refs has NO entry Kernel and tools compiled from git. I also uploaded my minimal qemu setup, which I use to experiment with btrfs: http://pp.siedziba.pl/tmp/linux-btrfs-qemu.tar.xz (execute start.sh to run qemu, then test.sh script to trigger the error) Regards -- 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
[PATCH] Btrfs-progs: use btrfs_lookup_first_block_group when fixing accounting
This was a bug from long time ago that never actually got fixed. We start with bytenr 0 when looping through all of the block groups, but btrfs_lookup_block_group will bail out since it couldn't find a block group with 0 as the bytenr. Btrfs_lookup_first_block_group will be nice and adjust the start up to the right value, so this way we reset all the block groups properly and not screw up the users block group accounting. Thanks, Signed-off-by: Josef Bacik jba...@fusionio.com --- extent-tree.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/extent-tree.c b/extent-tree.c index 20cdffa..10cc995 100644 --- a/extent-tree.c +++ b/extent-tree.c @@ -3406,7 +3406,7 @@ int btrfs_fix_block_accounting(struct btrfs_trans_handle *trans, } while(1) { - cache = btrfs_lookup_block_group(fs_info, start); + cache = btrfs_lookup_first_block_group(fs_info, start); if (!cache) break; start = cache-key.objectid + cache-key.offset; -- 1.7.7.6 -- 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
Integration branch of btrfs-progs 2013-02-01
Hi, documentation updates, mkfs support of extended refs (aka more hardlinks possible), new command 'subvolume show' and extensions/updates to the 'subvolume list' command and fsck fixes. Please consider this more like a preview, there were some merge conflicts and I may have missed some combination of subvol list options that do not do what they're expected to do. I'm going to do some more testing of the previous integration branch and send a pull request as of 20130126. david repo url: git://repo.or.cz/btrfs-progs-unstable/devel.git --- Anand Jain (14): Btrfs-progs: man btrfs: subcommands must be grouped together Btrfs-progs: move printing subvol list outside of btrfs_list_subvols Btrfs-progs: add parent uuid for snapshots Btrfs-progs: move struct root_info to btrfs-list.h Btrfs-progs: add function btrfs_get_subvol to get root_info of a subvol Btrfs-progs: add method to filter snapshots by parent uuid Btrfs-progs: put find_mount_root() in commands.h Btrfs-progs: make printing subvol extensible to newer layouts Btrfs-progs: make get_subvol_name non cmds-send specific Btrfs-progs: add show subcommand to subvol cli Btrfs-progs: update btrfs_get_subvol to be inline with resolve_root ret changes Btrfs-progs: Fix a small memory leak in managing the btrfs list filter Btrfs-progs: add subvol flags to print Btrfs-progs: dont print uuid unless -u option is given Chen Yang (2): Btrfs-prog/send: fix wrong dump_fd check in cmd_send_start() Btrfs-progs: Complete the help information of btrfs send/receive David Sterba (5): btrfs-progs: fix parallel build btrfs-progs: upcase filter options btrfs-progs: add option g to show generation btrfs-progs: add option c to show ogeneration btrfs-progs: update man pages of subvol list Dieter Ries (1): btrfs-progs: btrfsck: Print which filesystem to be checked to stdout Eric Sandeen (1): btrfs-progs: fix mkfs.btrfs -r option Goffredo Baroncelli (1): Update the man page with the new prefixes. Josef Bacik (1): Btrfs-progs: use btrfs_lookup_first_block_group when fixing accounting Lukas Czerner (3): Btrfs-progs: move path modification to filters Btrfs-progs: add '-o' option into subvolume list command Btrfs-progs: List all subvolumes by default Mark Fasheh (3): btrfs-progs: Basic support for extended inode refs btrfs-progs: add extended inode ref support to btrfsck btrfs-progs: mkfs support for extended inode refs Wang Shilong (1): Btrfs-progs: filter the deleted subvolumes when listing snapshots -- 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
Re: Integration branch of btrfs-progs 2013-01-30
On Thu, Jan 31, 2013 at 08:17:13PM +0100, Martin Steigerwald wrote: Hope the extended free space information stuff by Goffredo comes next :) The code needs some work, and I'm not sure where the dicusssions about the visual appearance of the output ended. I don't remember whether we had a generally accepted version. I've pulled and rebased the patches from Goffredo's repo, based on some recent snapshot of integration branch, see foreign/fi-df-merge2 . david -- 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
[PATCH] Btrfs-progs: handle errors reading fs roots
A user had a problem where btrfsck would bail out because it was finding extents for a snapshot that had been deleted but not entirely cleaned up. We can handle this case fine, we just need to report an error properly. This patch allowed btrfsck to continue and eventually fix his file system. Thanks, Signed-off-by: Josef Bacik jba...@fusionio.com --- btrfsck.c |8 +++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/btrfsck.c b/btrfsck.c index a851008..ff2d7b5 100644 --- a/btrfsck.c +++ b/btrfsck.c @@ -1772,6 +1772,10 @@ static int check_fs_roots(struct btrfs_root *root, fs_root_objectid(key.objectid)) { tmp_root = btrfs_read_fs_root_no_cache(root-fs_info, key); + if (IS_ERR(tmp_root)) { + err = 1; + goto next; + } ret = check_fs_root(tmp_root, root_cache, wc); if (ret) err = 1; @@ -1781,6 +1785,7 @@ static int check_fs_roots(struct btrfs_root *root, process_root_ref(leaf, path.slots[0], key, root_cache); } +next: path.slots[0]++; } btrfs_release_path(tree_root, path); @@ -1940,7 +1945,8 @@ static int check_owner_ref(struct btrfs_root *root, key.offset = (u64)-1; ref_root = btrfs_read_fs_root(root-fs_info, key); - BUG_ON(IS_ERR(ref_root)); + if (IS_ERR(ref_root)) + return 1; level = btrfs_header_level(buf); if (level == 0) -- 1.7.7.6 -- 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
[PATCH] Btrfs-progs: fix double free of extent buffer
Noticed this while looking for an segfault related to our eb cache in btrfsck. We free the eb in out: so we don't need this extra free. Thanks, Signed-off-by: Josef Bacik jba...@fusionio.com --- btrfsck.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/btrfsck.c b/btrfsck.c index ff2d7b5..b9dc0bd 100644 --- a/btrfsck.c +++ b/btrfsck.c @@ -2594,7 +2594,6 @@ static int run_next_block(struct btrfs_root *root, if (!extent_buffer_uptodate(buf)) { record_bad_block_io(root-fs_info, extent_cache, bytenr, size); - free_extent_buffer(buf); goto out; } -- 1.7.7.6 -- 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
[PATCH] Btrfs-progs: return an error if we can't find an fs root
Instead of doing a BUG_ON() if we fail to find the last fs root just return an error so the callers can deal with it how they like. Also we need to actually return an error if we can't find the latest root so that the error handling works. With this btrfsck was able to deal with a file system that was missing a root item but still had extents that referred back to the root. Thanks, Signed-off-by: Josef Bacik jba...@fusionio.com --- disk-io.c |3 ++- root-tree.c |2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/disk-io.c b/disk-io.c index c4d4631..f6391ed 100644 --- a/disk-io.c +++ b/disk-io.c @@ -438,7 +438,8 @@ static int find_and_setup_root(struct btrfs_root *tree_root, root, fs_info, objectid); ret = btrfs_find_last_root(tree_root, objectid, root-root_item, root-root_key); - BUG_ON(ret); + if (ret) + return ret; blocksize = btrfs_level_size(root, btrfs_root_level(root-root_item)); generation = btrfs_root_generation(root-root_item); diff --git a/root-tree.c b/root-tree.c index 782472c..ecb7599 100644 --- a/root-tree.c +++ b/root-tree.c @@ -47,7 +47,7 @@ int btrfs_find_last_root(struct btrfs_root *root, u64 objectid, slot = path-slots[0] - 1; btrfs_item_key_to_cpu(l, found_key, slot); if (found_key.objectid != objectid) { - ret = 1; + ret = -ENOENT; goto out; } read_extent_buffer(l, item, btrfs_item_ptr_offset(l, slot), -- 1.7.7.6 -- 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
Re: /home on BTRFS on SSD, now highly fragmenting virtuoso database - use autodefrag?
Am Donnerstag, 31. Januar 2013 schrieb Hugo Mills: On Thu, Jan 31, 2013 at 02:44:12PM +0100, Martin Steigerwald wrote: Hi! Today I converted my /home from Ext4 to BTRFS by reformatting and copying all over again. I created the filesystem with -l 16384 -n 16384 -d single -m single on an logical volume Intel SSD 320 and mount with compress=lzo,spacecache. Current state: The way that compression is implemented in btrfs, compressed files always look fragmented, even if they're not. Basically, each compression block shows up as a single fragment. If the blocks are next to each other, the file's not actually fragmented, but still looks like it to fiemap. Ah, thanks. Thats interesting to know. [snip] Except for a highly fragmenting file: martin@merkaba:~/.kde/share/apps/nepomuk/repository/main/data/virtuosobackend ls -lh insgesamt 1,2G -rw--- 1 martin martin 1,3G Jan 31 14:07 soprano-virtuoso.db -rw-r--r-- 1 martin martin 14 Jan 31 14:06 soprano-virtuoso.lck -rw--- 1 martin martin0 Jan 27 17:52 soprano-virtuoso.lock -rw-r--r-- 1 martin martin 13K Jan 31 10:22 soprano-virtuoso.log -rw-r--r-- 1 martin martin0 Jan 27 17:52 soprano-virtuoso.pxa -rw-r--r-- 1 martin martin 8,0M Jan 31 14:07 soprano-virtuoso-temp.db -rw-r--r-- 1 martin martin 14K Jan 31 14:07 soprano-virtuoso.trx martin@merkaba:~/.kde/share/apps/nepomuk/repository/main/data/virtuosobackend sudo filefrag soprano-virtuoso.db [sudo] password for martin: soprano-virtuoso.db: 481 extents found […] Now I do not perceive any bottle neck so far and this is an SSD. What would be your recommendation: Add autodefrag to mount options or not? For an SSD, probably not worth it. Thanks. I then will use what I advice attendees to my Linux Performance Analysis Performance trainings and what XFS guys are also advicing: Use the defaults (unless you know otherwise). Especially since I think the Intel SSD 320 is one of the better ones and desktop search is really snappy up to know. Thanks, -- Martin 'Helios' Steigerwald - http://www.Lichtvoll.de GPG: 03B0 0D6C 0040 0710 4AFA B82F 991B EAAC A599 84C7 -- 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
[PATCH] Btrfs: account for orphan inodes properly during cleanup
Dave sent me a panic where we were doing the orphan cleanup and panic'ed trying to release our reservation from the orphan block rsv. The reason for this is because our orphan block rsv had been free'd out from underneath us because the transaction commit found that there were no orphan inodes according to its count and decided to free it. This is incorrect so make sure we inc the orphan inodes count so the accounting is all done properly. This would also cause the warning in the orphan commit code normally if you had any orphans to cleanup as they would only decrement the orphan count so you'd get a negative orphan count which could cause problems during runtime. Thanks, Signed-off-by: Josef Bacik jba...@fusionio.com --- fs/btrfs/inode.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 804a34b..5398883 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -2502,6 +2502,7 @@ int btrfs_orphan_cleanup(struct btrfs_root *root) */ set_bit(BTRFS_INODE_HAS_ORPHAN_ITEM, BTRFS_I(inode)-runtime_flags); + atomic_inc(root-orphan_inodes); /* if we have links, this was a truncate, lets do that */ if (inode-i_nlink) { -- 1.7.7.6 -- 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
System unmountable RW
Hi, I have a btrfs volume that I can't mount RW (but I can mount and use it RO). So, at boot time, the partition is mounted RO (defaults,noatime,compress-force=zlib,nossd,ro) : Feb 1 22:30:12 frozen kernel: [8.646350] Btrfs loaded Feb 1 22:30:12 frozen kernel: [8.650878] device fsid cf2c98bd-147b-400e-bca5-79765650b1a7 devid 1 transid 376249 /dev/mapper/vg--frozen-backup Feb 1 22:30:12 frozen kernel: [8.652740] btrfs: force zlib compression Feb 1 22:30:12 frozen kernel: [8.652750] btrfs: not using ssd allocation scheme Feb 1 22:30:12 frozen kernel: [8.652756] btrfs: disk space caching is enabled then I do : mount -o rw,remount /backup/ Feb 1 22:32:38 frozen kernel: [ 65.780686] btrfs: force zlib compression Feb 1 22:32:38 frozen kernel: [ 65.780700] btrfs: not using ssd allocation scheme Feb 1 22:32:38 frozen kernel: [ 65.780706] btrfs: disk space caching is enabled I let that mount run days, without any success. It stay running, and I can't interrupt it (CTRL+C or kill). There is nothing about btrfs in kern.log, and when I run btrfsck it throw OOM because it use the 10GB of RAM of the system. It's a 2TB volume, running a 3.7.1 kernel : # btrfs fi df /backup/ Data: total=1.72TB, used=1.65TB System, DUP: total=64.00MB, used=208.00KB System: total=4.00MB, used=0.00 Metadata, DUP: total=39.20GB, used=35.38GB If it's a btrfs bug, can I give you any information to help fix that ? Thanks, Olivier -- 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
Re: System unmountable RW
then I do : mount -o rw,remount /backup/ Feb 1 22:32:38 frozen kernel: [ 65.780686] btrfs: force zlib compression Feb 1 22:32:38 frozen kernel: [ 65.780700] btrfs: not using ssd allocation scheme Feb 1 22:32:38 frozen kernel: [ 65.780706] btrfs: disk space caching is enabled I let that mount run days, without any success. It stay running, and I can't interrupt it (CTRL+C or kill). Hit alt-sysrq-w at that point, and then post your dmesg; there should be at least one stacktrace in there (possibly many), which should give a good idea where it's hanging up. -- 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