aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Btrfs progs v4.7HEADv4.7masterDavid Sterba2016-07-291-1/+1
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: update CHANGES for 4.7David Sterba2016-07-291-1/+17
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fix memory leak with missing deviceJustin Maggard2016-07-291-0/+2
| | | | | | | | | In read_one_chunk(), we may add an empty entry for a missing device. However, this entry wasn't being added to the dev_list, and so it never got freed. Signed-off-by: Justin Maggard <jmaggard@netgear.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fix unaligned access in raid6 calculationsDavid Sterba2016-07-291-4/+12
| | | | | | | | | | The raid6 code matches kernel implementation that also does the unaligned access. So to keep the code close, add helpers for unaligned native access and use them. The helpers are local as we don't plan to use them elsewhere. Reported-by: Anatoly Pugachev <matorola@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: use proper unaligned helper in btrfs_csum_finalDavid Sterba2016-07-291-1/+1
| | | | | | | | This will not cause unaligned access as the checksum is at the beginning of btrfs_header and thus aligned to a page, but for clarity use the helper. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fi defrag: change default extent target size to 32 MiBDavid Sterba2016-07-282-6/+21
| | | | | | | The kernel default is too low, 32 MiB is recommended and should give better results. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: Doc: Fix format error in btrfs-sendQu Wenruo2016-07-281-0/+1
| | | | | Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: handler memory allocation error in write_data_to_diskDavid Sterba2016-07-281-1/+9
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: handle memory allocation error in __alloc_extent_bufferDavid Sterba2016-07-281-4/+2
| | | | | | Drop the BUG() as all callers handle errors. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: update values of EXTENT_* bitsDavid Sterba2016-07-281-12/+12
| | | | | | Make the values unsigned as we do various bit operations. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: refactor and extend btrfs_prepare_device argumentsDavid Sterba2016-07-285-16/+28
| | | | | | | | The message about discard is printed unconditionally and does not conform to the --quite option eg. in mkfs. Consolidate the operation flags into one argument and add support for verbosity. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: use values directly for BLOCK_GROUP_ macrosDavid Sterba2016-07-281-4/+4
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: use unsigned type for extent_buffer flagsDavid Sterba2016-07-281-1/+1
| | | | | | We're doing bit operations. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fix unaligned access calculating raid56 dataDavid Sterba2016-07-281-3/+8
| | | | | | | | | The extent_buffer::data might be unaligned wrt unsigned long, depends on acutal layout of the structure and width of the int types. Use explicit unaligned access helpers. Reported-by: Anatoly Pugachev <matorola@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: kerncompat: introduce put_unaligned_x helpersDavid Sterba2016-07-281-0/+4
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: docs: update btrfs-balance manual pageDavid Sterba2016-07-281-2/+3
| | | | | | Update the new options. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: balance: add another (shorter) option for backgroundDavid Sterba2016-07-261-1/+3
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: balance: silence compiler warningDavid Sterba2016-07-261-1/+6
| | | | | | | | | | cmds-balance.c: In function 'cmd_balance_start': cmds-balance.c:654:6: warning: ignoring return value of 'chdir', declared with attribute warn_unused_result [-Wunused-result] chdir("/"); Reported-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: add option to run balance as daemonAustin S. Hemmelgarn2016-07-262-1/+43
| | | | | | | | | | | | | | | | | | | | Currently, balance operations are run synchronously in the foreground. This is nice for interactive management, but is kind of crappy when you start looking at automation and similar things. This patch adds an option to `btrfs balance start` to tell it to daemonize prior to running the balance operation, thus allowing us to preform balances asynchronously. The two biggest use cases I have for this are starting a balance on a remote server without establishing a full shell session, and being able to background the balance in a recovery shell (which usually has no job control) so I can still get progress information. Because it simply daemonizes prior to calling the balance ioctl, this doesn't actually need any kernel support. Signed-off-by: Austin S. Hemmelgarn <ahferroin7@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fix btrfsck of space_cache=v2 bitmaps on big-endianOmar Sandoval2016-07-263-2/+22
| | | | | | | | Copy le_test_bit() from the kernel and use that for the free space tree bitmaps. Signed-off-by: Omar Sandoval <osandov@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: corrupt block: handle eb read and write errorsDavid Sterba2016-07-151-1/+13
| | | | | Resolves-coverity-id: 1261558 Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: corrupt block: handle block mapping errors in debug_corrupt_blockDavid Sterba2016-07-151-2/+10
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: corrupt block: pass eb as argument to debug_corrupt_blockDavid Sterba2016-07-151-11/+16
| | | | | | Allocate the eb externally so we can handle the easy errors in advance. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: image: fix minor resource leakDavid Sterba2016-07-151-0/+1
| | | | | | | It's on error exit path. Resolves-coverity-id: 1354246 Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: handle ulist_add errors in qgroup-verifyDavid Sterba2016-07-151-5/+18
| | | | | Resolves-coverity-id: 1364084 Signed-off-by: David Sterba <dsterba@suse.com>
* Btrfs-progs: fix btrfs-map-logical to only print extent mapping infoLiu Bo2016-07-151-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I have a valid btrfs image which contains, ... item 10 key (1103101952 BLOCK_GROUP_ITEM 1288372224) itemoff 15947 itemsize 24 block group used 655360 chunk_objectid 256 flags DATA|RAID5 item 11 key (1103364096 EXTENT_ITEM 131072) itemoff 15894 itemsize 53 extent refs 1 gen 11 flags DATA extent data backref root 5 objectid 258 offset 0 count 1 item 12 key (1103888384 EXTENT_ITEM 262144) itemoff 15841 itemsize 53 extent refs 1 gen 15 flags DATA extent data backref root 1 objectid 256 offset 0 count 1 item 13 key (1104281600 EXTENT_ITEM 262144) itemoff 15788 itemsize 53 extent refs 1 gen 15 flags DATA extent data backref root 1 objectid 257 offset 0 count 1 ... The extent [1103364096, 131072) has length 131072, but if we run "btrfs-map-logical -l 1103364096 -b $((65536 * 3)) /dev/sda" it will return mapping info 's of non-existing extents. It's because it assumes that extents's are contiguous on logical address, when it's not true, after one loop (cur_logical += cur_len) and mapping the next extent, we can get an extent that is out of our search range and we end up with a negative @real_len and printing all mapping infos till the disk end. Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Reviewed-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add 007-unsupported-block-sizesDavid Sterba2016-07-151-0/+21
| | | | | | Check if block sizes smaller than 4k expectedly fail to convert. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: docs: update btrfs manual pageDavid Sterba2016-07-151-2/+29
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: docs: update btrfs-convert manual pageDavid Sterba2016-07-151-12/+21
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: docs: update btrfs-filesystem manual pageDavid Sterba2016-07-141-3/+4
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: docs: update btrfs-scrub manual pageDavid Sterba2016-07-141-10/+22
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: do not set optind if not necessaryDavid Sterba2016-07-1311-20/+0
| | | | | | | In the subcommand callbacks that are called just once, we don't need to explicitly reset optind. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: balance: use errno directlyDavid Sterba2016-07-131-31/+16
| | | | | | No need to store the errno in a local variable. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: balance: cleanup, switch to common exit blockDavid Sterba2016-07-131-17/+21
| | | | | | | Call close_file_or_dir at the end of the function and replace returns by gotos to the exit block. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: docs: update btrfs-subvolume manual pageDavid Sterba2016-07-131-21/+26
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: docs: update btrfs-balance manual pageDavid Sterba2016-07-131-3/+147
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: du: fix to skip not btrfs dir/fileWang Shilong2016-07-133-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'btrfs file du' is a very useful tool to watch my system file usage information with snapshot aware. when trying to run following commands: [root@localhost btrfs-progs]# btrfs file du / Total Exclusive Set shared Filename ERROR: Failed to lookup root id - Inappropriate ioctl for device ERROR: cannot check space of '/': Unknown error -1 and My Filesystem looks like this: [root@localhost btrfs-progs]# df -Th Filesystem Type Size Used Avail Use% Mounted on devtmpfs devtmpfs 16G 0 16G 0% /dev tmpfs tmpfs 16G 368K 16G 1% /dev/shm tmpfs tmpfs 16G 1.4M 16G 1% /run tmpfs tmpfs 16G 0 16G 0% /sys/fs/cgroup /dev/sda3 btrfs 60G 19G 40G 33% / tmpfs tmpfs 16G 332K 16G 1% /tmp /dev/sdc btrfs 2.8T 166G 1.7T 9% /data /dev/sda2 xfs 2.0G 452M 1.6G 23% /boot /dev/sda1 vfat 1.9G 11M 1.9G 1% /boot/efi tmpfs tmpfs 3.2G 24K 3.2G 1% /run/user/1000 So I installed Btrfs as my root partition, but boot partition can be other fs. We can Let btrfs tool aware of this is not a btrfs file or directory and skip those files, so that someone like me could just run 'btrfs file du /' to scan all btrfs filesystems. After patch, it will look like: Total Exclusive Set shared Filename 0.00B 0.00B - //root/.bash_logout 0.00B 0.00B - //root/.bash_profile 0.00B 0.00B - //root/.bashrc 0.00B 0.00B - //root/.cshrc 0.00B 0.00B - //root/.tcshrc This works for me to analysis system usage and analysis performaces. Signed-off-by: Wang Shilong <wangshilong1991@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: add the error message when open failsTsutomu Itoh2016-07-131-0/+2
| | | | | | | | | | | | | | When open in btrfs_open_devices failed, only the following message is displayed. Therefore the user doesn't understand the reason why open failed. # btrfs check /dev/sdb8 Couldn't open file system This patch adds the error message when open fails. Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: docs: man5, document control deviceDavid Sterba2016-07-131-0/+34
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: 006-image-on-missing-device: fix btrfs tool pathLuis Henriques2016-07-131-2/+2
| | | | | | | | | | | | | | | | If btrfs isn't in the path, this test will fail with: [TEST/misc] 006-image-on-missing-device failed: btrfs fi show /dev/loop0 test failed for case 006-image-on-missing-device Makefile:226: recipe for target 'test-misc' failed make: *** [test-misc] Error 1 Fix the test script by adding $TOP to the path. Signed-off-by: Luis Henriques <henrix@camandro.org> [ updated to full command names ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: check: write corrected qgroup info to diskMark Fasheh2016-07-135-22/+185
| | | | | | | | | | | | | | | | Now that we can verify all qgroups, we can write the corrected qgroups out to disk when '--repair' is specified. The qgroup status item is also updated to clear any out-of-date state. The repair_ functions were modeled after the inode repair code in cmds-check.c. I also renamed the 'scan' member of qgroup_status_item to 'rescan' in order to keep consistency with the kernel. Testing this was easy, I just reproduced qgroup inconsistencies via the usual routes and had btrfsck fix them. Signed-off-by: Mark Fasheh <mfasheh@suse.de> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: check: verify qgroups above level 0Mark Fasheh2016-07-131-57/+254
| | | | | | | | | | | | At the moment we only check subvolume quota groups (level 0). With this patch we can check groups above 0, thus verifying the entire qgroup hierarchy on a file system. The accounting portion of this patch is modeled after the kernel - we are essentially reimplementing the 'quota rescan' case here. Most other sections of this code went unchanged, in particular the root counting works independently of the accounting. Signed-off-by: Mark Fasheh <mfasheh@suse.de> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: factor out repair modeDavid Sterba2016-07-043-1/+4
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: check: switch to iterating over the backref_treeJeff Mahoney2016-07-041-49/+39
| | | | | | | | | | We now have two data structures that can be used to iterate the same data set, and there may be quite a few of them in memory. Eliminating the list_head member will reduce memory consumption while iterating over the extent backrefs. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: check: supplement extent backref list with rbtreeJeff Mahoney2016-07-041-48/+145
| | | | | | | | | | | | | | For the pathlogical case, like xfstests generic/297 that creates a large file consisting of one, repeating reflinked extent, fsck can take hours. The root cause is that calling find_data_backref while iterating the extent records is an O(n^2) algorithm. For my example test run, n was 2*2^20 and fsck was at 8 hours and counting. This patch supplements the list with an rbtree and drops the runtime of that testcase to about 20 seconds. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: check: add helpers for converting between structuresJeff Mahoney2016-07-041-34/+60
| | | | | | | | | We either open code list_entry calls or outright cast between types. The compiler will do the right thing if we use static inlines to do typesafe conversions. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: use the correct struct for BTRFS_IOC_LOGICAL_INOHans van Kranenburg2016-07-041-1/+1
| | | | | | | | | | | | | | BTRFS_IOC_LOGICAL_INO takes a btrfs_ioctl_logical_ino_args as argument, not a btrfs_ioctl_ino_path_args. The lines were probably copy/pasted when the code was written. Since btrfs_ioctl_logical_ino_args and btrfs_ioctl_ino_path_args have the same size, the actual IOCTL definition here does not change. But, it makes the code less confusing for the reader. Signed-off-by: Hans van Kranenburg <hans.van.kranenburg@mendix.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: mkfs: fix allocation information output of block group typesWang Xiaoguang2016-07-041-0/+17
| | | | | | | | | When cleanup_temp_chunks() removes block groups, it forgot to update mkfs_allocation accordingly, fix this. Signed-off-by: Wang Xiaoguang <wangxg.fnst@cn.fujitsu.com> [ minor adjustments ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: use /bin/bash for scriptsDavid Sterba2016-07-042-2/+2
| | | | | | Since we use 'source' in scripts, let's use bash everywhere. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: convert-test: Add test case for discontinuous hole extentQu Wenruo2016-07-041-0/+23
| | | | | | | | | | | | | For ext* fs containing a large hole(larger than 128M), btrfs-convert will only insert one 128M hole extent and skip the remaining. This leads to discontinuous file extents. Add test case for it, and since it's a pinpoint regression test case, no combination of convert options nor checksum verification. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>