platform/upstream/btrfs-progs.git
8 years agobtrfs-progs: Restrict e2fsprogs version for convert
Qu Wenruo [Thu, 14 Apr 2016 06:24:34 +0000 (14:24 +0800)]
btrfs-progs: Restrict e2fsprogs version for convert

We want to support version 1.41 due to longterm and enterprise distros,
make the check explicit.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: add safety delay before starting full balance
David Sterba [Mon, 2 May 2016 08:26:29 +0000 (10:26 +0200)]
btrfs-progs: add safety delay before starting full balance

A short delay with a warning before starting a full balance should
improve usability. We have been getting reports from people who run full
balance after following some random advice and then get surprised by the
performance impact.

The countdown is done even when run from scripts, but as the whole
balance takes significanly more time, this shouldn't be an issue.

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: add CHANGES 3.12 - 4.5.1
David Sterba [Mon, 25 Apr 2016 13:10:57 +0000 (15:10 +0200)]
btrfs-progs: add CHANGES 3.12 - 4.5.1

The changes are posted to the mailinglist and to the wiki, but for
packaging reasons it's good to have them locally in the git as well.

The initial conversion from wiki was done by Nick, then adjusted by me.

Reported-by: Nicholas D Steeves <nsteeves@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: Read qgroup status for qgroup verify
Qu Wenruo [Mon, 18 Apr 2016 02:27:09 +0000 (10:27 +0800)]
btrfs-progs: Read qgroup status for qgroup verify

Read qgroup status for its flags like QGROUP_STATUS_FLAG_RESCAN and
QGROUP_STATUS_FLAG_INCONSISTENT.

This will help to avoid false alert for case like qgroup rescan is still
running when un-mounted.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: Fix an extent buffer leak in qgroups check
Qu Wenruo [Mon, 18 Apr 2016 02:27:08 +0000 (10:27 +0800)]
btrfs-progs: Fix an extent buffer leak in qgroups check

Qgroup verify codes will read fs root to check if the subvolume exists.
But it forgot to free the extent buffer read out, only freeing the
memory.

Fix it by also freeing the extent buffers.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: Fix return value bug of qgroups check
Qu Wenruo [Mon, 18 Apr 2016 02:27:07 +0000 (10:27 +0800)]
btrfs-progs: Fix return value bug of qgroups check

Before this patch, although btrfsck will check qgroups if quota is
enabled, it always return 0 even qgroup numbers are corrupted.

Fix it by allowing return value from report_qgroups function (formally
defined as print_qgroup_difference).

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: prop: remove an unnecessary condition on parse_args
Satoru Takeuchi [Wed, 20 Apr 2016 06:32:48 +0000 (15:32 +0900)]
btrfs-progs: prop: remove an unnecessary condition on parse_args

>From commit c742debab11f ('btrfs-progs: fix a regression that
"property" with -t option doesn't work'), the number of arguments
is checked strictly. So the following condition never be
satisfied.

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: "device ready" accepts just one device
Satoru Takeuchi [Mon, 14 Mar 2016 00:27:22 +0000 (09:27 +0900)]
btrfs-progs: "device ready" accepts just one device

* actual result

  =======================================
  # ./btrfs device ready /dev/sdb foo
  #
  =======================================

* expecting result

  =======================================
  # ./btrfs device ready /dev/sdb foo
  btrfs device ready: too many arguments
  usage: btrfs device ready <device>

      Check device to see if it has all of its devices in cache for mounting

  #
  =======================================

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: Check if the FSID was seen by comparing full UUID
Yauhen Kharuzhy [Thu, 14 Apr 2016 22:21:11 +0000 (15:21 -0700)]
btrfs-progs: Check if the FSID was seen by comparing full UUID

is_seen_fsid() uses simple hash to check if FS was seen before at
walking on FS list in 'filesystem show' command: hash key is first byte
of the UUID. This function doesn't check full UUID then, so, if there
are two FS with same first byte in UUIDs exist, only one will be shown:

root@test:~# btrfs fi show
Label: 'System'  uuid: 688cb918-7bac-4c8e-9b11-8d047eb14cf4
        Total devices 2 FS bytes used 1.76GiB
        devid    1 size 3.46TiB used 4.01GiB path /dev/sda2
        devid    2 size 6.91TiB used 4.01GiB path /dev/sdb2

Global spare

root@test:~# grep btrfs /proc/mounts
/dev/sda2 / btrfs rw,relatime,space_cache,subvolid=256,subvol=/root 0 0
/dev/sdc /media/688cb918-7bac-4c8e-9b11-8d047eb14cf4 btrfs rw,relatime,space_cache,subvolid=5,subvol=/ 0 0

root@test:~# btrfs fi show --all-devices
Label: 'System'  uuid: 688cb918-7bac-4c8e-9b11-8d047eb14cf4
        Total devices 2 FS bytes used 1.76GiB
        devid    1 size 3.46TiB used 4.03GiB path /dev/sda2
        devid    2 size 6.91TiB used 4.01GiB path /dev/sdb2

Label: 'test'  uuid: 683b1a80-ca7f-4c4d-b87b-7155401a4d18
        Total devices 7 FS bytes used 2.06MiB
        devid    1 size 7.28TiB used 1.57GiB path /dev/sdc
        devid    2 size 7.28TiB used 1.57GiB path /dev/sdd
        devid    3 size 7.28TiB used 1.57GiB path /dev/sde
        devid    4 size 7.28TiB used 1.57GiB path /dev/sdf
        devid    5 size 7.28TiB used 1.57GiB path /dev/sdg
        devid    6 size 7.28TiB used 1.57GiB path /dev/sdh
        devid    7 size 7.28TiB used 1.57GiB path /dev/sdi

To resolve this collision, search for full FSID in the list of seen
filesystems.

Signed-off-by: Yauhen Kharuzhy <yauhen.kharuzhy@zavadatar.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: convert: fix typo in original image subvolume name
David Sterba [Mon, 11 Apr 2016 15:41:01 +0000 (17:41 +0200)]
btrfs-progs: convert: fix typo in original image subvolume name

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: device stats: Print devid instead of null
Patrik Lundquist [Tue, 5 Apr 2016 15:27:43 +0000 (17:27 +0200)]
btrfs-progs: device stats: Print devid instead of null

Print e.g. "[devid:4].write_io_errs   6" instead of
"[(null)].write_io_errs   6" when device is missing.

Signed-off-by: Patrik Lundquist <patrik.lundquist@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: fix re-declared get_device_info()
Anand Jain [Tue, 5 Apr 2016 07:36:01 +0000 (15:36 +0800)]
btrfs-progs: fix re-declared get_device_info()

The other get_device_info() is in the same file, 4 lines above.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: check: use add_extent_rec_nolookup after lookups
David Sterba [Fri, 1 Apr 2016 12:45:33 +0000 (14:45 +0200)]
btrfs-progs: check: use add_extent_rec_nolookup after lookups

The lookup was duplicated, use the helper that does not do it.

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: check: refactor add_extent_rec, separate lookup
David Sterba [Fri, 1 Apr 2016 12:42:42 +0000 (14:42 +0200)]
btrfs-progs: check: refactor add_extent_rec, separate lookup

Separate the part of add_extent_rec that comes after the lookup does not
succeed, there are callers interested in just this.

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: check: cleanup, move structure definitions to the beginning
David Sterba [Fri, 1 Apr 2016 12:19:09 +0000 (14:19 +0200)]
btrfs-progs: check: cleanup, move structure definitions to the beginning

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: deprecate and stop using btrfs_level_size
David Sterba [Fri, 1 Apr 2016 11:17:44 +0000 (13:17 +0200)]
btrfs-progs: deprecate and stop using btrfs_level_size

Size of a b-tree node is always nodesize, regardless of the level.

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: replace leafsize with nodesize
David Sterba [Fri, 1 Apr 2016 10:57:11 +0000 (12:57 +0200)]
btrfs-progs: replace leafsize with nodesize

Nodesize is used in kernel, the values are always equal. We have to keep
leafsize in headers, similarly the tree setting functions still take and
set leafsize, but it's effectively a no-op.

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: fi sync: make it silent by default
David Sterba [Thu, 31 Mar 2016 16:58:39 +0000 (18:58 +0200)]
btrfs-progs: fi sync: make it silent by default

Report only errors returned by the ioctl.

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: fsck: Fix a false metadata extent warning
Qu Wenruo [Thu, 31 Mar 2016 02:19:34 +0000 (10:19 +0800)]
btrfs-progs: fsck: Fix a false metadata extent warning

At least 2 user from mail list reported btrfsck reported false alert of
"bad metadata [XXXX,YYYY) crossing stripe boundary".

While the reported number are all inside the same 64K boundary.
After some check, all the false alert have the same bytenr feature,
which can be divided by stripe size (64K).

The result seems to be initial 'max_size' can be 0, causing 'start' +
'max_size' - 1, to cross the stripe boundary.

Fix it by always update extent_record->cross_stripe when the
extent_record is updated, to avoid temporary false alert to be reported.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: update docs and completion for tree-stats
Alexander Fougner [Fri, 11 Mar 2016 11:49:46 +0000 (12:49 +0100)]
btrfs-progs: update docs and completion for tree-stats

Signed-off-by: Alexander Fougner <fougner89@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: copy btrfs-calc-size to inspect-internal tree-stats
Alexander Fougner [Fri, 11 Mar 2016 11:49:45 +0000 (12:49 +0100)]
btrfs-progs: copy btrfs-calc-size to inspect-internal tree-stats

Signed-off-by: Alexander Fougner <fougner89@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: tests: add support for command line coverage tests
David Sterba [Sun, 20 Mar 2016 14:34:10 +0000 (15:34 +0100)]
btrfs-progs: tests: add support for command line coverage tests

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agoBtrfs progs v4.5.1
David Sterba [Thu, 31 Mar 2016 15:10:28 +0000 (17:10 +0200)]
Btrfs progs v4.5.1

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: fix unknown type name 'u64' in gccgo
Julio Montes [Tue, 29 Mar 2016 21:34:48 +0000 (15:34 -0600)]
btrfs-progs: fix unknown type name 'u64' in gccgo

Signed-off-by: Julio Montes <imc.coder@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: docs: update mkfs page for dup on multidev fs
David Sterba [Wed, 30 Mar 2016 14:56:32 +0000 (16:56 +0200)]
btrfs-progs: docs: update mkfs page for dup on multidev fs

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: tests: update 001-basic-profiles, dup on multidev fs
David Sterba [Wed, 30 Mar 2016 14:18:49 +0000 (16:18 +0200)]
btrfs-progs: tests: update 001-basic-profiles, dup on multidev fs

Testcase for "btrfs-progs: mkfs: fix an error when using DUP on multidev
fs"

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: mkfs: fix an error when using DUP on multidev fs
Satoru Takeuchi [Fri, 25 Mar 2016 01:55:34 +0000 (10:55 +0900)]
btrfs-progs: mkfs: fix an error when using DUP on multidev fs

To accept DUP on multidev fs, in addition to the following
commit, we need to mark DUP as an allowed data/metadata
profile.

commit 42f1279bf8e9 ("btrfs-progs: mkfs: allow DUP on multidev fs, only warn")

* actual result

  =============================================
  # ./mkfs.btrfs -f -m DUP -d DUP /dev/sdb1 /dev/sdb2
  btrfs-progs v4.5-24-ga35b7e6
  See http://btrfs.wiki.kernel.org for more information.

  WARNING: DUP is not recommended on filesystem with multiple devices
  ERROR: unable to create FS with metadata profile DUP (have 2 devices but 1 devices are required)
  =============================================

* expected result

  =============================================
  # ./mkfs.btrfs -f -m dup -d dup /dev/sdb1 /dev/sdb2
  WARNING: DUP is not recommended on filesystem with multiple devices
  btrfs-progs v4.5-25-g1a10a3c
  See http://btrfs.wiki.kernel.org for more information.

  Label:              (null)
  UUID:               010d72ff-c87c-4516-8916-5e635719d110
  Node size:          16384
  Sector size:        4096
  Filesystem size:    28.87GiB
  Block group profiles:
    Data:             DUP               1.01GiB
    Metadata:         DUP               1.01GiB
    System:           DUP              12.00MiB
  SSD detected:       no
  Incompat features:  extref, skinny-metadata
  Number of devices:  2
  Devices:
     ID        SIZE  PATH
      1   953.00MiB  /dev/sdb1
      2    27.94GiB  /dev/sdb2

  ==================================================

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: fix fd leak in get_subvol_info
David Sterba [Thu, 24 Mar 2016 18:31:33 +0000 (19:31 +0100)]
btrfs-progs: fix fd leak in get_subvol_info

A typo, introduced in "btrfs-progs: create get_subvol_info()".

Resolves-coverity-id: 1357106
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: use safe copy for label buffer everywhere
David Sterba [Thu, 24 Mar 2016 18:19:31 +0000 (19:19 +0100)]
btrfs-progs: use safe copy for label buffer everywhere

There's a mix of opencoded strncpy + null termination, strncpy, memcppy
without termination etc. Unify them and use the helper.

Resolves-coverity-id: 1357105
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: rename __strncpy__null to __strncpy_null
David Sterba [Thu, 24 Mar 2016 18:17:53 +0000 (19:17 +0100)]
btrfs-progs: rename __strncpy__null  to __strncpy_null

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: mkfs: allow DUP on multidev fs, only warn
David Sterba [Wed, 16 Mar 2016 17:08:33 +0000 (18:08 +0100)]
btrfs-progs: mkfs: allow DUP on multidev fs, only warn

The DUP profile can work on multiple filesystems, the limitation is
rather artificial. Let the user make the decision and print a warning.

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: make error message from add_clone_source more generic
David Sterba [Thu, 24 Mar 2016 14:26:05 +0000 (15:26 +0100)]
btrfs-progs: make error message from add_clone_source more generic

Do not hardcode the error message.

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: send: fix handling of multiple snapshots
Tsutomu Itoh [Thu, 24 Mar 2016 07:47:28 +0000 (16:47 +0900)]
btrfs-progs: send: fix handling of multiple snapshots

We cannot send multiple snapshots at once.

[before fix]
# btrfs send ./snap[12] > snap12.data
At subvol ./snap1
At subvol ./snap2
ERROR: parent determination failed for 0
#

[after fix]
# btrfs send ./snap[12] > snap12.data
At subvol ./snap1
At subvol ./snap2
#

Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: tests: add misc 014-filesystem-label
David Sterba [Tue, 22 Mar 2016 18:01:39 +0000 (19:01 +0100)]
btrfs-progs: tests: add misc 014-filesystem-label

Test various label lengths on a mounted filesystem.

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: tests: introduce mustfail helper
David Sterba [Tue, 22 Mar 2016 17:47:18 +0000 (18:47 +0100)]
btrfs-progs: tests: introduce mustfail helper

Invalid syntax, expected failure on corrupted data etc. Failure is
success.

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: fix build of standalone utilities after clean
David Sterba [Tue, 22 Mar 2016 17:29:24 +0000 (18:29 +0100)]
btrfs-progs: fix build of standalone utilities after clean

$ make clean
$ make btrfs-debug-tree

will fail because the dependency from $(btrfs_debug_tree_objects) is
missing. The variable standalone_deps magically collects all the deps
and will build them in advance. The simple fix to use the existing
substitution based on $@ does not work for pattern rules, as Noah found
out.

Reported-by: Noah Massey <noah.massey@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: cleanup block group helpers types
David Sterba [Tue, 22 Mar 2016 16:01:20 +0000 (17:01 +0100)]
btrfs-progs: cleanup block group helpers types

Use const char and remove stray prototypes.

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: utils: make more arguments const
David Sterba [Tue, 22 Mar 2016 15:56:33 +0000 (16:56 +0100)]
btrfs-progs: utils: make more arguments const

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: rename get_subvol_name() to subvol_strip_mountpoint()
Anand Jain [Mon, 21 Mar 2016 07:21:05 +0000 (15:21 +0800)]
btrfs-progs: rename get_subvol_name() to subvol_strip_mountpoint()

Signed-off-by: Anand Jain <anand.jain@oracle.com>
[ renamed from subvol_minus_mnt to subvol_strip_mountpoint ]
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: create get_subvol_info()
Anand Jain [Mon, 21 Mar 2016 07:21:04 +0000 (15:21 +0800)]
btrfs-progs: create get_subvol_info()

get_subvol_info() is useful as we are adding more features around
subvolume. This function was inline with the function
cmd_subvol_show().

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: move get_subvol_name() to utils.c
Anand Jain [Mon, 21 Mar 2016 07:21:03 +0000 (15:21 +0800)]
btrfs-progs: move get_subvol_name() to utils.c

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: remove duplicate function __is_subvol()
Anand Jain [Mon, 21 Mar 2016 07:21:02 +0000 (15:21 +0800)]
btrfs-progs: remove duplicate function __is_subvol()

The function test_issubvolume() provides the same check, and
has better logic.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: move test_issubvolume() to utils.c
Anand Jain [Mon, 21 Mar 2016 07:21:01 +0000 (15:21 +0800)]
btrfs-progs: move test_issubvolume() to utils.c

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: rearrange subvolume functions together
Anand Jain [Mon, 21 Mar 2016 07:21:00 +0000 (15:21 +0800)]
btrfs-progs: rearrange subvolume functions together

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: utils: make sure set_label_mounted uses correct length buffers
Petros Angelatos [Tue, 22 Mar 2016 10:40:29 +0000 (03:40 -0700)]
btrfs-progs: utils: make sure set_label_mounted uses correct length buffers

When `btrfs filesystem label /foo bar` command is invoked, it will pass
the buffer allocated in the argv array directly to set_label_mounted()
and then to the BTRFS_IOC_SET_FSLABEL ioctl.

However, the kernel code handling the ioctl will always try to copy
BTRFS_LABEL_SIZE bytes[1] from the userland pointer. Under certain
conditions and when the label is small enough, the command will fail
with:

    [root@localhost /]# btrfs filesystem label /mnt f
    ERROR: unable to set label Bad address

Fix this by making sure we pass a BTRFS_LABEL_SIZE sized buffer to the
ioctl containing the desired label.

[1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/fs/btrfs/ioctl.c?id=refs/tags/v4.5#n5231

Signed-off-by: Petros Angelatos <petrosagg@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: fragments: fix build
David Sterba [Tue, 22 Mar 2016 15:06:31 +0000 (16:06 +0100)]
btrfs-progs: fragments: fix build

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: fix fi du so it works in more cases
Austin S. Hemmelgarn [Mon, 21 Mar 2016 12:23:11 +0000 (08:23 -0400)]
btrfs-progs: fix fi du so it works in more cases

Currently, btrfs fi du uses open_file_or_dir(), which tries to open
it's argument with O_RDWR.  Because of POSIX semantics, this fails for
non-root users when the file is read-only or is an executable that
is being run currently, or for all users (including root) when the
filesystem is read-only.  This results in a somewhat confusing 'Unknown
error -1' message when trying to check such files.  Switch to using
open_file_or_dir3() with O_RDONLY passed in the flags, as this avoids
the limitations listed above, and we have no need to write to the files
anyway (and thus shouldn't be opening them writable).

Signed-off-by: Austin S. Hemmelgarn <ahferroin7@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: build: fix static standalone utilities
Noah Massey [Mon, 21 Mar 2016 14:16:07 +0000 (10:16 -0400)]
btrfs-progs: build: fix static standalone utilities

commit b5e7979 "btrfs-progs: build: extend per-binary objects" allows
the standalone utilities to link against object files shared with the
main binary. However, the btrfs-*.static targets need to be adjusted
to build against the static versions of the common files.

Signed-off-by: Noah Massey <noah.massey@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agoBtrfs progs v4.5
David Sterba [Sun, 20 Mar 2016 22:59:05 +0000 (23:59 +0100)]
Btrfs progs v4.5

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: tests: enumerate RWX in convert tests
David Sterba [Fri, 18 Mar 2016 16:11:25 +0000 (17:11 +0100)]
btrfs-progs: tests: enumerate RWX in convert tests

Generating all valid combinations takes too much time.

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: tests: populate fs with small dataset for convert tests
Lakshmipathi.G [Tue, 8 Mar 2016 15:00:06 +0000 (20:30 +0530)]
btrfs-progs: tests: populate fs with small dataset for convert tests

Signed-off-by: Lakshmipathi.G <Lakshmipathi.G@giis.co.in>
[ minor tweaks ]
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: switch to common message helpers in open_ctree_fs_info
David Sterba [Fri, 18 Mar 2016 15:34:33 +0000 (16:34 +0100)]
btrfs-progs: switch to common message helpers in open_ctree_fs_info

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: handle stat errors in open_ctree_fs_info
David Sterba [Fri, 18 Mar 2016 15:07:09 +0000 (16:07 +0100)]
btrfs-progs: handle stat errors in open_ctree_fs_info

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: add stat check in open_ctree_fs_info
Austin S. Hemmelgarn [Fri, 18 Mar 2016 14:03:42 +0000 (10:03 -0400)]
btrfs-progs: add stat check in open_ctree_fs_info

Currently, open_ctree_fs_info will open whatever path you pass it and try
to interpret it as a BTRFS filesystem.  While this is not nessecarily
dangerous (except possibly if done on a character device), it does
result in some rather cryptic and non-sensical error messages when
trying to run certain commands in ways they weren't intended to be run.
Add a check using stat(2) to verify that the path we've been passed is
in fact a regular file or a block device, or a symlink pointing to a
regular file or block device.

This causes the following commands to provide a helpful error message
when run on a FIFO, directory, character device, or socket:
    * btrfs check
    * btrfs restore
    * btrfs-image
    * btrfs-find-root
    * btrfs inspect-internal dump-tree

stat(2) is used instead of lstat(2), as stat(2) follows symlinks just
like open(2) does, which means we check the same inode that open(2)
opens, and thus don't need special handling for symlinks.

Signed-off-by: Austin S. Hemmelgarn <ahferroin7@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: fi du: fix incorrect column order
Alexander Fougner [Fri, 18 Mar 2016 11:08:24 +0000 (12:08 +0100)]
btrfs-progs: fi du: fix incorrect column order

Signed-off-by: Alexander Fougner <fougner89@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: qgroup assign: handle --no-rescan option
Satoru Takeuchi [Fri, 18 Mar 2016 01:36:29 +0000 (10:36 +0900)]
btrfs-progs: qgroup assign: handle --no-rescan option

* actual result

   ==================================================
   # btrfs qgroup assign --no-rescan 0/260 1/261 /btrfs
   btrfs qgroup assign: unrecognized option '--no-rescan'
   usage: btrfs qgroup assign [options] <src> <dst> <path>

       Assign SRC as the child qgroup of DST

       --rescan       schedule qutoa rescan if needed
       --no-rescan

   ==================================================

* expected result

   ==================================================
   # ./btrfs qgroup assign --no-rescan 0/260 1/261 /btrfs
   #
   ==================================================

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: qgroup assign: can't handle options
Satoru Takeuchi [Fri, 18 Mar 2016 01:35:15 +0000 (10:35 +0900)]
btrfs-progs: qgroup assign: can't handle options

"qgroup assign" is considered as working without any options
from the following commit.

commit 176aeca9a148 ("btrfs-progs: add getopt stubs where needed")

However, we can pass options to this command.

* actual result

   ==================================================
   # ./btrfs qgroup assign --rescan 0/260 1/261 /btrfs
   btrfs qgroup assign: unrecognized option '--rescan'
   usage: btrfs qgroup assign [options] <src> <dst> <path>

       Assign SRC as the child qgroup of DST

       --rescan       schedule qutoa rescan if needed
       --no-rescan

   ==================================================

* expected result

   ==================================================
   # ./btrfs qgroup assign --rescan 0/260 1/261 /btrfs
   #
   ==================================================

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: inspect subvolid-resolve: fix argument parsing
Satoru Takeuchi [Fri, 18 Mar 2016 01:31:32 +0000 (10:31 +0900)]
btrfs-progs: inspect subvolid-resolve: fix argument parsing

"inspect-internal subvolid-resolve" doesn't work from the following commit.

commit 176aeca9a148 ("btrfs-progs: add getopt stubs where needed")

It's because 1st argument, subvolid, is also used for the pathname of
filesystem. 2nd argument should be used for this purpose instead.

* actual result

   ==================================================
   # ./btrfs inspect-internal subvolid-resolve 260 /btrfs
   ERROR: cannot access '260': No such file or directory
   ==================================================

* expected result

   ==================================================
   # btrfs inspect-internal subvolid-resolve 260 /btrfs
   snap
   ==================================================

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: qgroup create/destroy: fix argument parsing
Satoru Takeuchi [Fri, 18 Mar 2016 01:29:50 +0000 (10:29 +0900)]
btrfs-progs: qgroup create/destroy: fix argument parsing

"qgroup create/destroy" don't work from the following commit.

commit 176aeca9a148 ("btrfs-progs: add getopt stubs where needed")

* actual result

   ==================================================
   # ./btrfs qgroup create 1 /btrfs/sub
   btrfs qgroup create: too few arguments
   usage: btrfs qgroup create <qgroupid> <path>

       Create a subvolume quota group.
   ==================================================
   # btrfs qgroup create 1 /btrfs/sub
   # ./btrfs qgroup destroy 1 /btrfs/sub
   btrfs qgroup destroy: too few arguments
   usage: btrfs qgroup destroy <qgroupid> <path>

       Destroy a quota group.

   ==================================================

* expected result

   ==================================================
   # btrfs qgroup create 1 /btrfs/sub
   # btrfs qgroup destroy 1 /btrfs/sub/
   ==================================================

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: subvol get-default: fix argument parsing
Satoru Takeuchi [Fri, 18 Mar 2016 01:26:15 +0000 (10:26 +0900)]
btrfs-progs: subvol get-default: fix argument parsing

"sub get-default" does't work since the following commit.

commit 176aeca9a148 ("btrfs-progs: add getopt stubs where needed")

* actual result

   ==================================================
   # ./btrfs sub get-default /btrfs
   btrfs subvolume get-default: too few arguments
   usage: btrfs subvolume get-default <path>

       Get the default subvolume of a filesystem
   ==================================================

* expected result

   ==================================================
   # btrfs sub get-default /btrfs
   ID 5 (FS_TREE)
   ==================================================

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: docs: man5, add space_cache=v2
David Sterba [Thu, 17 Mar 2016 13:49:32 +0000 (14:49 +0100)]
btrfs-progs: docs: man5, add space_cache=v2

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: tests: add 013-subvolume-sync-crash
David Sterba [Thu, 17 Mar 2016 13:22:24 +0000 (14:22 +0100)]
btrfs-progs: tests: add 013-subvolume-sync-crash

Test for "btrfs-progs: subvol sync: fix memory corruption, undersized
array", a lot of deleted subvolumes in the 'subvol sync' will not fit
into the array, should result in a glibc report.

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: subvol sync: fix memory corruption, undersized array
David Sterba [Thu, 17 Mar 2016 10:41:18 +0000 (11:41 +0100)]
btrfs-progs: subvol sync: fix memory corruption, undersized array

The subvol sync command crashed randomly at the end with

*** glibc detected *** btrfs: double free or corruption (out): 0x00000000006ab040 ***

This is caused by running out of the ids array in case there are more
than 128 subvolumes. The array is increased in steps but does not
account the size of the item, so there was room for 1024 / 8 = 128
subvolume ids.

Fixes: c9f885ec8963 ("btrfs-progs: subvol: let sync check only current deletions")
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agoBtrfs progs v4.5-rc1
David Sterba [Wed, 16 Mar 2016 18:07:12 +0000 (19:07 +0100)]
Btrfs progs v4.5-rc1

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: docs: fi defrag, make some paragraphs more visible
David Sterba [Wed, 16 Mar 2016 18:03:05 +0000 (19:03 +0100)]
btrfs-progs: docs: fi defrag, make some paragraphs more visible

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: mkfs: also parse raid0 profile case-insensitive
David Sterba [Wed, 16 Mar 2016 16:41:16 +0000 (17:41 +0100)]
btrfs-progs: mkfs: also parse raid0 profile case-insensitive

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: btrfs-debugfs: fetch block group information
Liu Bo [Mon, 11 Jan 2016 20:10:22 +0000 (12:10 -0800)]
btrfs-progs: btrfs-debugfs: fetch block group information

This aims to decide whether a balance can reduce the number of
data block groups and if it is, this shows the '-dvrange' block
group's objectid.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: fix a regression that "property" with -t option doesn't work
Satoru Takeuchi [Wed, 16 Mar 2016 02:11:07 +0000 (11:11 +0900)]
btrfs-progs: fix a regression that "property" with -t option doesn't work

"property" is considered as working without any options
from the following commit.

commit 176aeca9a148 ("btrfs-progs: add getopt stubs where needed")

However, we can pass -t option to this command.

* actual result

  ==================================================
  $ ./btrfs prop list -t f /btrfs
  btrfs property list: invalid option -- 't'
  usage: btrfs property list [-t <type>] <object>

      Lists available properties with their descriptions for the given object.

      Please see the help of 'btrfs property get' for a description of
      objects and object types.

  ==================================================

* expected result

  ==================================================
  $ ./btrfs prop list -t f /btrfs
  label               Set/get label of device.
  ==================================================

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: Describe optarg of -m option in the manpage of receive
Satoru Takeuchi [Wed, 16 Mar 2016 02:01:11 +0000 (11:01 +0900)]
btrfs-progs: Describe optarg of -m option in the manpage of receive

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: fi du: make the output more aligned
David Sterba [Tue, 15 Mar 2016 18:00:57 +0000 (19:00 +0100)]
btrfs-progs: fi du: make the output more aligned

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: fi du: update help text
David Sterba [Tue, 15 Mar 2016 16:58:23 +0000 (17:58 +0100)]
btrfs-progs: fi du: update help text

Move the command-specific options to the beginning, add missing long
option.

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: docs: add filesystem du
David Sterba [Tue, 15 Mar 2016 16:56:36 +0000 (17:56 +0100)]
btrfs-progs: docs: add filesystem du

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: remove btrfs-show-super manual page and point to inspect-internal
David Sterba [Thu, 10 Mar 2016 15:51:53 +0000 (16:51 +0100)]
btrfs-progs: remove btrfs-show-super manual page and point to inspect-internal

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: docs: update dump-super
David Sterba [Tue, 15 Mar 2016 16:16:00 +0000 (17:16 +0100)]
btrfs-progs: docs: update dump-super

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: docs: rename and move dump-super
David Sterba [Tue, 15 Mar 2016 15:44:55 +0000 (16:44 +0100)]
btrfs-progs: docs: rename and move dump-super

The command name is 'dump-super', move the section to it's alphabetical
order.

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: dump-super: add more long options
David Sterba [Tue, 15 Mar 2016 15:32:26 +0000 (16:32 +0100)]
btrfs-progs: dump-super: add more long options

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: dump-super: switch to getopt_long
David Sterba [Tue, 15 Mar 2016 15:31:58 +0000 (16:31 +0100)]
btrfs-progs: dump-super: switch to getopt_long

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: fix resource leak during device scanning
David Sterba [Tue, 15 Mar 2016 09:25:00 +0000 (10:25 +0100)]
btrfs-progs: fix resource leak during device scanning

The dev info is leaked each time we find a known filesystem.

Resolves-coverity-id: 1127098
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: utils: switch more error messages to common helpers
David Sterba [Mon, 14 Mar 2016 13:36:30 +0000 (14:36 +0100)]
btrfs-progs: utils: switch more error messages to common helpers

Functions relatd to device changes/status/open, mount checks.

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: improve error messages after failed wiping
David Sterba [Mon, 14 Mar 2016 13:18:32 +0000 (14:18 +0100)]
btrfs-progs: improve error messages after failed wiping

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: Introduce device delete by devid
Anand Jain [Mon, 14 Mar 2016 08:31:49 +0000 (16:31 +0800)]
btrfs-progs: Introduce device delete by devid

This patch introduces new option <devid> for the command

  btrfs device delete <device_path|devid>[..]  <mnt>

In a user reported issue on a 3-disk-RAID1, one disk failed with its
SB unreadable. Now with this patch user will have a choice to delete
the device using devid.

The other method we could do, is to match the input device_path
to the available device_paths with in the kernel. But that won't
work in all the cases, like what if user provided mapper path
when the path within the kernel is a non-mapper path.

This patch depends on the below kernel patch for the new feature to work,
however it will fail-back to the old interface for the kernel without the
patch

  Btrfs: Introduce device delete by devid

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: docs: fix more typos and spelling errors
David Sterba [Mon, 14 Mar 2016 13:10:16 +0000 (14:10 +0100)]
btrfs-progs: docs: fix more typos and spelling errors

With help of ispell.

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: docs: fix spelling errors
Alexander Fougner [Sun, 13 Mar 2016 13:24:08 +0000 (14:24 +0100)]
btrfs-progs: docs: fix spelling errors

Signed-off-by: Alexander Fougner <fougner89@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: Avoid interpreting options after "--" when getting unit mode
Satoru Takeuchi [Mon, 14 Mar 2016 00:02:34 +0000 (09:02 +0900)]
btrfs-progs: Avoid interpreting options after "--" when getting unit mode

* actual result

  ======================================
  # ./btrfs device usage -- -m /btrfs

  /dev/sdf1, ID: 1
     Device size:          95367.41MiB
     Data,single:          2056.00MiB
     Metadata,DUP:         2048.00MiB
     System,DUP:             16.00MiB
     Unallocated:          91247.41MiB
  ======================================

* expected result

  ======================================
  # ./btrfs device usage -- -m /btrfs

  ERROR: can't access '-m': No such file or directory
  ======================================

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: Fix a regression that btrfs filesystem label doesn't work
Satoru Takeuchi [Mon, 14 Mar 2016 00:15:42 +0000 (09:15 +0900)]
btrfs-progs: Fix a regression that btrfs filesystem label doesn't work

The number of arguments which is allowed to pass became wrong
from the following commit.

commit 176aeca9a148c5e29de0 ("btrfs-progs: add getopt stubs where needed")

* actual result

  ===========================================================
  # ./btrfs prop get /btrfs label
  label=foo
  # ./btrfs fi label /btrfs
  btrfs filesystem label: too few arguments
  usage: btrfs filesystem label [<device>|<mount_point>] [<newlabel>]

      Get or change the label of a filesystem

      With one argument, get the label of filesystem on <device>.
      If <newlabel> is passed, set the filesystem label to <newlabel>.

  # ./btrfs fi label /btrfs bar
  foo
  # ./btrfs prop get /btrfs label
  label=foo
  ===========================================================

* expected result

  ===========================================================
  # ./btrfs prop get /btrfs label
  label=foo
  # ./btrfs fi label /btrfs
  foo
  # ./btrfs fi label /btrfs bar
  # ./btrfs prop get /btrfs label
  label=bar
  ===========================================================

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: print-tree: show the compression method string
Wang Xiaoguang [Fri, 11 Mar 2016 05:09:02 +0000 (13:09 +0800)]
btrfs-progs: print-tree: show the compression method string

Signed-off-by: Wang Xiaoguang <wangxg.fnst@cn.fujitsu.com>
[ changed the format of unknown value ]
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: Fix device scan to interpret its argument properly
Satoru Takeuchi [Fri, 11 Mar 2016 00:26:13 +0000 (09:26 +0900)]
btrfs-progs: Fix device scan to interpret its argument properly

Fix the following bug.

  ================================
  # btrfs device scan -- /dev/sdb
  ERROR: not a block device: --
  ================================

It should work as follow.

  ================================
  # ./btrfs device scan -- /dev/sdb
  Scanning for Btrfs filesystems in '/dev/sdb'
  ================================

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: Dont' stop scanning of devices at first failed device
Yauhen Kharuzhy [Fri, 11 Mar 2016 00:04:35 +0000 (16:04 -0800)]
btrfs-progs: Dont' stop scanning of devices at first failed device

When 'btrfs device scan' command is invoked, it scans all devices,
check them for btrfs superblock and add devices with btrfs to a list.

Next, each device from the list is passed to kernel where it is handled
in the btrfs_scan_one_device() function. This function can, for example,
return -EBUSY when device contains superblock matched to existing and
mounted filesystem (if this device was pulled out from RAID and
connected again after some time).

btrfs tool stops device scan if any device has been failed to add, so
other existing devices with (possibly) valid FS will never be reached.

Fix this by remove stopping at any failure in the btrfs_register_all_devices(),
just return error count. btrfs_scan_one_device() reports any kind of
error already.

Signed-off-by: Yauhen Kharuzhy <yauhen.kharuzhy@zavadatar.com>
[ initialize err to 0 ]
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: remove btrfs-debug-tree manual page and point to inspect-internal
David Sterba [Thu, 10 Mar 2016 15:51:53 +0000 (16:51 +0100)]
btrfs-progs: remove btrfs-debug-tree manual page and point to inspect-internal

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: dump-tree: let --tree understand name of the tree
David Sterba [Thu, 10 Mar 2016 14:57:46 +0000 (15:57 +0100)]
btrfs-progs: dump-tree: let --tree understand name of the tree

For practical purposes teach -t about the human readable names of the
trees in addition to the numerical id. The name syntax is flexible.

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: docs: update dump-tree
David Sterba [Thu, 10 Mar 2016 14:18:01 +0000 (15:18 +0100)]
btrfs-progs: docs: update dump-tree

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: dump-tree: print version information earlier
David Sterba [Thu, 10 Mar 2016 14:02:18 +0000 (15:02 +0100)]
btrfs-progs: dump-tree: print version information earlier

The version information could be useful addition to the dump, print it
before we attempt to open the filesystem.

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: dump-tree: print tree keys with -e
David Sterba [Thu, 10 Mar 2016 13:57:07 +0000 (14:57 +0100)]
btrfs-progs: dump-tree: print tree keys with -e

The incomplete tree description is printed with -e, glued to the leaf
information.

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: Describe device scan -d is a deprecated option in manpage
Satoru Takeuchi [Wed, 9 Mar 2016 23:08:31 +0000 (08:08 +0900)]
btrfs-progs: Describe device scan -d is a deprecated option in manpage

It's already marked as deprecated in cmd_device_scan_usage().

commit 5444864e5605 ("btrfs-progs: remove BTRFS_SCAN_PROC scan method")

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: Replace hardcoded PAGE_CACHE_SIZE with sectorsize.
Feifei Xu [Thu, 10 Mar 2016 08:43:20 +0000 (16:43 +0800)]
btrfs-progs: Replace hardcoded PAGE_CACHE_SIZE with sectorsize.

PAGE_CACHE_SIZE is hardcoded to 4K in cmds-restore.c. Correct
value should be sector size. Fix this through replacing
hardcoded 4K to sectorsize.

Signed-off-by: Feifei Xu <xufeifei@linux.vnet.ibm.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: check: unify naming of long option values
David Sterba [Wed, 9 Mar 2016 13:57:27 +0000 (14:57 +0100)]
btrfs-progs: check: unify naming of long option values

We use GETOP_VAL_ .

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: docs: update check options
David Sterba [Wed, 9 Mar 2016 13:55:11 +0000 (14:55 +0100)]
btrfs-progs: docs: update check options

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: check: drop short option for --chunk-tree
David Sterba [Wed, 9 Mar 2016 13:48:44 +0000 (14:48 +0100)]
btrfs-progs: check: drop short option for --chunk-tree

The need to specify the chunk root is not that common, we will reserve
the short option -c for later use.

Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: Add new option for specify chunk root bytenr
Lu Fengqi [Mon, 7 Mar 2016 04:57:41 +0000 (12:57 +0800)]
btrfs-progs: Add new option for specify chunk root bytenr

Add new btrfsck option, '--chunk-root', to specify chunk root bytenr.
And allow open_ctree_fs_info() function accept chunk_root_bytenr to
override the bytenr in superblock. This will be mainly used when chunk
tree corruption.

Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
8 years agobtrfs-progs: fix broken 'device scan' arguments parsing
Yauhen Kharuzhy [Wed, 9 Mar 2016 01:19:40 +0000 (17:19 -0800)]
btrfs-progs: fix broken 'device scan' arguments parsing

Commit 52179e4fea41e55f31c92cd033a0b53a5107b4f4 'btrfs-progs: unify argc
min/max checking' breaks 'btrfs device scan' command when no argument
was given. Fix this.

Signed-off-by: Yauhen Kharuzhy <yauhen.kharuzhy@zavadatar.com>
Signed-off-by: David Sterba <dsterba@suse.com>