summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* btrfs-progs: Convert man page for btrfs-quota.Qu Wenruo2014-04-22
| | | | | | | Convert man page for btrfs-quota. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Convert man page for btrfs-receive.Qu Wenruo2014-04-22
| | | | | | | Convert man page for btrfs-receive. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Convert man page for btrfs-send.Qu Wenruo2014-04-22
| | | | | | | Convert man page for btrfs-send. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Convert man page for btrfs-inspect-internalQu Wenruo2014-04-22
| | | | | | | Convert man page for btrfs-inspect-internal. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Convert man page for btrfs-rescueQu Wenruo2014-04-22
| | | | | | | Convert man page for btrfs-rescue. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Convert man page for btrfs-check.Qu Wenruo2014-04-22
| | | | | | | Convert man page for btrfs-check. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Convert man page for btrfs-scrubQu Wenruo2014-04-22
| | | | | | | Convert man page for btrfs-scrub. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Convert man page for btrfs-device subcommand.Qu Wenruo2014-04-22
| | | | | | | Convert man page for btrfs-device subcommand. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Convert man page for btrfs-balance.Qu Wenruo2014-04-22
| | | | | | | Convert man page for btrfs-balance. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Convert man page for filesystem subcommand.Qu Wenruo2014-04-22
| | | | | | | Convert man page for filesystem subcommand. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Convert man page for btrfs-subvolumeQu Wenruo2014-04-22
| | | | | | | Convert man page for btrfs-subvolume. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Introduce asciidoc based man page and btrfs man page.Qu Wenruo2014-04-22
| | | | | | | | | | | | | | | The old man page of btrfs will grow larger with new functions adding to btrfs-progs and harder to maintain because the reader-unfriendly roff grammar and one LARGE btrfs.in. This patch will introduce the simplified Documentation directory mainly 'stolen' from git and include the first man page for 'btrfs(8)'. This time, man page will be written in human-friendly asciidoc grammar and each commands of btrfs will have a separate man page, which I hope can reduce the effort to maintain the man page. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* v3.14.1Chris Mason2014-04-18
| | | | Signed-off-by: Chris Mason <clm@fb.com>
* btrfs-progs: correct prompt of minimal num of devs for raid56Gui Hecheng2014-04-11
| | | | | | | | | For btrfs, Raid5 can't go below 2 devs, not 3; Raid6 can't go below 3 devs, not 4. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: update btrfs_file_extent_inline_len to match kernel versionFilipe David Borba Manana2014-04-11
| | | | | | | | | | | | | | | | | | | | | | | The following kernel commit changed the definition of the inline function btrfs_file_extent_inline_len(): commit 514ac8ad8793a097c0c9d89202c642479d6dfa34 Author: Chris Mason <clm@fb.com> Date: Fri Jan 3 21:07:00 2014 -0800 Btrfs: don't use ram_bytes for uncompressed inline items If we truncate an uncompressed inline item, ram_bytes isn't updated to reflect the new size. The fixe uses the size directly from the item header when reading uncompressed inlines, and also fixes truncate to update the size as it goes. Not having this new definition implies that the restore tool might misbehave when restoring files with an inline extent that got truncated on a kernel older than release 3.14. Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: restore, for compressed extents don't read more bytes than neededFilipe David Borba Manana2014-04-11
| | | | | | | | | | | | | | | | | | | | | | | We need to read a number of bytes corresponding to the disk size of the file extent item, and not to the number of bytes in the num_bytes field. Normally disk_size is smaller than num_bytes (when using compression), except for files created with lzo compression in a kernel older then the one which introduced the following change: commit 59516f6017c589e7316418fda6128ba8f829a77f Author: Stefan Agner <stefan@agner.ch> Date: Mon Jul 1 20:33:39 2013 +0200 Btrfs: return -1 when lzo compression makes data bigger With this fix the lzo code behaves like the zlib code by returning an error code when compression does not help reduce the size of the file. This is currently not a bug since the compressed size is checked again in the calling method compress_file_range. Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Make property work with -t optionKusanagi Kouichi2014-04-11
| | | | | | | | | | | | | | | # btrfs prop list -t f . btrfs property list: too many arguments ... # btrfs prop get -t f . label btrfs property get: too many arguments ... # btrfs prop set -t f . label abc btrfs property set: too many arguments ... Signed-off-by: Kusanagi Kouichi <slash@ac.auone-net.jp> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Constify gettersKusanagi Kouichi2014-04-11
| | | | | Signed-off-by: Kusanagi Kouichi <slash@ac.auone-net.jp> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: btrfs: remove dead code in handle_optionsRakesh Pandit2014-04-11
| | | | | | | Just cleanup: remove useless return type, while loop and dead code. Signed-off-by: Rakesh Pandit <rakesh@tuxera.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Modify the help string to keep consistent with man page.Qu Wenruo2014-04-11
| | | | | | | | | Help string of "btrfs dev scan" is inconsistent with man page, which lacks the fact that -d|--all-device is conflict with <device>. This patch fixes the description Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: fsck: fix wrong index in pick_next_pending()Wang Shilong2014-04-11
| | | | | | | | Though all tree blocks have same size, we'd better use right index here. Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: fsck: reduce memory usage of extent record structWang Shilong2014-04-11
| | | | | | | | | Two changes: 1.use bit filed for @found_rec 2.u32 is enough to calculate duplicate extent number. Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: fsck: fix possible memory leaks in run_next_block()Wang Shilong2014-04-11
| | | | | | | We still need free allocated cache memory in case error happens. Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: fsck: don't free @seen cache until we finish searchingWang Shilong2014-04-11
| | | | | | | | @seen cache is used to avoid iterating same block more than once, and we can not free them until we have finished searching. Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs v3.14Chris Mason2014-04-06
| | | | Signed-off-by: Chris Mason <clm@fb.com>
* btrfs-progs: fix listing deleted subvolumesDavid Sterba2014-04-04
| | | | | | | | | | | | | The real check whether to show deleted or live subvolumes was skipped if just '-d' was specified without other filters. The 'deleted' filter was not accounted. It is now handled as a normal filter, that additionally sets the only_delete global status in order to be processed before any other filters in filter_root(). Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* btrfs-progs: make device discard process interruptibleDavid Sterba2014-04-04
| | | | | | | | | The ioctl for the whole range is not interruptible, which can be annoying when the discard is not wanted but user forgets to use the -K option. Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* btrfs-progs: avoid implicit scan for backup SBAnand Jain2014-04-04
| | | | | | | | | | | | | | | | | | | | | | | | When a disk containing btrfs is overwritten with other FS, ext4 for example it doesn't overwrite 2nd and 3rd copy of the btrfs SB. And btrfs_read_dev_super() would look for backup SB when primary SB isn't found. This causes the problem as in the reproducer below. In kernel we avoid this by _not_ reading backup SB implicitly, this patch would port the same to btrfs-progs. reproducer: mkfs.btrfs /dev/sde mkfs.ext4 /dev/sde mount /dev/sde /ext4 btrfs-convert /dev/sde (is successful (bug)) with this patch :: btrfs-convert /dev/sde /dev/sde is mounted Signed-off-by: Anand Jain <Anand.Jain@oracle.com> Signed-off-by: Chris Mason <clm@fb.com>
* Btrfs-progs: fsck: fix memory leak and unnecessary call to freeRakesh Pandit2014-03-21
| | | | | | | | | Free already allocated memory to item1_data if malloc fails for item2_data in swap_values. Seems to be a typo from commit 70749a77. Signed-off-by: Rakesh Pandit <rakesh@tuxera.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* Btrfs-progs: return with -ENOMEM if malloc failsRakesh Pandit2014-03-21
| | | | | | | | | Prevent segfault if memory allocation fails for sargs in get_df (cmds-filesystem.c). Signed-off-by: Rakesh Pandit <rakesh@tuxera.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* Btrfs-progs: scrub: don't call unlock if pthread_mutex_lock failsRakesh Pandit2014-03-21
| | | | | | | | | | | | If pthread_mutex_lock fails (rare but fix it anyway), don't call pthread_mutex_unlock on mutex. Rationale being that if pthread_mutex_lock fails pthread_mutex_unlock will always fail and overwrite actual error value in err. Signed-off-by: Rakesh Pandit <rakesh@tuxera.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* btrfs-progs: Fix a memleak in btrfs_scan_lblkid().Qu Wenruo2014-03-21
| | | | | | | | | In btrfs_scan_lblkid(), blkid_get_cache() is called but cache not freed. This patch adds blkid_put_cache() to free it. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* btrfs-progs: Fix a memleak in btrfs_scan_one_device.Qu Wenruo2014-03-21
| | | | | | | | | | | | Valgrind reports memleak in btrfs_scan_one_device() about allocating btrfs_device but on btrfs_close_devices() they are not reclaimed. Although not a bug since after btrfs_close_devices() btrfs will exit so memory will be reclaimed by system anyway, it's better to fix it anyway. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* btrfs-progs: skip erroneous free before initializationGui Hecheng2014-03-21
| | | | | | | | | If the list is not initialized, don't try to free it. Otherwise it will cause segmentfault. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* btrfs-progs: fix bug on mkfs with relative path specifiedGui Hecheng2014-03-21
| | | | | | | | | | | | | | | | The bug accurs when exec: # mkfs.btrfs -r <a relative path> <device> (note: the path should be 'valid' correspond to your `pwd`) error msg: $ scandir for <a relative path> failed: No such file... o Replace strdup() with realpath() to get the correct scan path. o fix memory leaks and adopt the "single return + goto out" pattern Reported-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* Btrfs-progs: mkfs: make sure we can deal with hard links with -r optionWang Shilong2014-03-21
| | | | | | | | | | | | | | | | Steps to reproduce: # mkdir -p /tmp/test # touch /tmp/test/file # ln /tmp/test/file /tmp/test/hardlinks # mkfs.btrfs -f /dev/sda13 -r /tmp/test # btrfs check /dev/sda13 To deal with hard link, we must deal with inode with same inode id rather than increase inode id by ourselves. Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* Btrfs-progs: mkfs: don't create extent for an empty fileWang Shilong2014-03-21
| | | | | | | | | | | | | | Steps to reproduce: # mkdir -p /tmp/test # touch /tmp/test/file # mkfs.btrfs -f /dev/sda13 -r /tmp/test # btrfs check /dev/sda13 For an empty file, don't create extent data for it. Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* btrfs-progs: fix uninit variable in btrfs_scan_kernelChris Mason2014-03-21
| | | | Signed-off-by: Chris Mason <clm@fb.com>
* Btrfs-progs: fsck: handle case that we can not lookup extent infoWang Shilong2014-03-21
| | | | | | | | | | | | | | | | | Previously, --init-extent-tree works just because btrfs_lookup_extent_info() blindly return 0, and this make it work if there are not any *FULL BACKREF* mode in broken filesystem. It is just a coincidence that --init-extent-tree option works, let's do it in the right way firstly. For now, we have not supported to rebuild extent tree if there are any *FULL BACKREF* mode which means if there are snapshots with broken filesystem, avoid using --init-extent-tree option now. Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* Btrfs-progs: fsck: force to udate tree root for some casesWang Shilong2014-03-21
| | | | | | | | | | | | | | | | | | | commit roots won't update root item in tree root if it finds updated root's bytenr is same as before. However, this is not right for fsck, we need update tree root in the following case: 1.overwrite previous root node. 2.reinit reloc data tree, this is because we skip pin relo data tree before which means we can allocate same block as before. Fix this by updating tree root ourselves for the above cases. Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* Btrfs-progs: fsck: insert root dir into reloc data tree when reiniting itWang Shilong2014-03-21
| | | | | | | | | | | | | | | | There are two bugs when resetting balance: 1.we will skip reinitting reloc data tree if no reloc root found, however this is not right because we don't pin reloc data tree before. 2.we should insert root dir into reloc data tree,otherwise we will fail to fsck. Fix problems by forcely reiniting reloc data root and inserting root dir. Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* Btrfs-progs: fsck: reset balance after reiniting extent rootWang Shilong2014-03-21
| | | | | | | | | | reset balance need cow block which will insert extent item into extent tree. If we do this before reinitting extent root, we may encounter EEIXST. Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* Btrfs-progs: fsck: deal with really corrupted extent treeWang Shilong2014-03-21
| | | | | | | | | | | | | | To reinit extent root, we need find a free extent, however, we may have a really corrupted extent tree, so we can't rely on existed extent tree to cache block group any more. During test, we fail to reinit extent tree which is because we can not find a free extent so let's make block group cache ourselves firstly. Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* Btrfs-progs: remove unused variable and update btrfs-image man pageRakesh Pandit2014-03-21
| | | | | | | | | | | | | | | | | | | | | | | | Remove unused variable in btrfs-image.c (update_super) and update man page documentation about -r option. Running btrfsck on a restored image produces missing chunk information. This is because by default, btrfs-image fixes up chunk tree to use 1 stripe pointing to the primary device. This in turns results in btrfsck making some noise. $ ./mkfs.btrfs /dev/sdb2 -f $ ./btrfs-image /dev/sdb2 btrfs_image_output $ ./btrfs-image -r btrfs_image_output disk-image $ ./btrfsck disk-image Device extent[1, 29360128, 8388608] didn't find the relative chunk. Device extent[1, 1111490560, 1073741824] didn't find the relative chunk. Ideally btfsck should be updated to reflect this default behavior and not through these messages, but it isn't harmful and can be done later. Signed-off-by: Rakesh Pandit <rakesh@tuxera.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* Btrfs-progs: use the correct integer type for ioctlArvin Schnell2014-03-21
| | | | | | Signed-off-by: Arvin Schnell <aschnell@suse.de> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* btrfs-progs: make the device scan logic more clearGui Hecheng2014-03-21
| | | | | | | | | | | | | | 1. Use long option to replace the original strcmp() to parse the "--all-devices". 2. the "int ret" is defined in 2 places, just define it once and make the return pattern into "goto + single return". This does not change the actual scan procedure and return values. Just make it clear, the original seems a little confusing. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* btrfs-progs: cleanup device stat usage promptGui Hecheng2014-03-21
| | | | | | | | | 1. use usage() to replace the fprintf() 2. use check_argc_exact() to replace "argc != ..." Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* Btrfs-progs: free path if we don't find root itemRakesh Pandit2014-03-21
| | | | | | | | | | In btrfs_find_last_root before returning with -ENOENT (if root item is not found) free path and also remove btrfs_release_path before btrfs_free_path because btrfs_free_path anyway calls it. Signed-off-by: Rakesh Pandit <rakesh@tuxera.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* btrfs-progs: include <sys/xattr.h> instead of <attr/xattr.h>Christophe Vu-Brugier2014-03-21
| | | | | | | | | | | The `btrfs` and `mkfs.btrfs` binaries are not linked against libattr so the correct header to include is <sys/xattr.h>. This fixes the build when attr header files are not installed. Signed-off-by: Christophe Vu-Brugier <cvubrugier@yahoo.fr> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* Btrfs-progs: make sure to save mirror_num only if it is setJosef Bacik2014-03-21
| | | | | | | | | | | If we are cycling through all of the mirrors trying to find the best one we need to make sure we set best_mirror to an actual mirror number and not 0. Otherwise we could end up reading a mirror that wasn't the best and make everybody sad. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>