Commit Graph

1244 Commits (c17d0a73c11d7cdbdf1582408ec6d168876160ea)
 

Author SHA1 Message Date
Josef Bacik 016e698a37 Btrfs-progs: make the repair option a global static var
It's just annoying to have to pass it around everywhere.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:23:11 -04:00
Anand Jain 1fdf85a3a3 btrfs-progs: device add should check existing FS before adding
as of now, when 'btrfs device add' adds a device it doesn't
check if the given device contains an existing FS. This
patch will change that to check the same. which when true
add will fail, and ask user to use -f option to overwrite.

further, since now we have test_dev_for_mkfs() function
to check if a disk can be used, so this patch will also
use this function to test the given device before adding.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:23:11 -04:00
chandan c31c50f330 btrfs-progs: cmd_find_new: Sync fs before searching for modified files.
The sync makes sure that 'very recently' introduced delayed work is
accounted for in the output of 'btrfs subvolume find-new' command.

Signed-off-by: chandan <chandan@linux.vnet.ibm.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:23:11 -04:00
Anand Jain 844034adba btrfs-progs: create helper function to use lblkid to scan for btrfs disks
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:23:11 -04:00
Anand Jain 23c47a132f btrfs-progs: move out print in cmd_df to another function
This is a prepatory work for the btrfs fi show command
fixes. So that we have a function get_df to get the fs sizes

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:23:11 -04:00
Ross Kirk 33ce9a82b8 btrfs-progs: Make btrfs_header_fsid() return unsigned long
Internally, btrfs_header_fsid() calculates an unsigned long, but casts
it to a pointer, while all callers cast it to unsigned long again.

Committed to btrfs as fba6aa75654394fccf2530041e9451414c28084f

Fix line length issues and match changes to kernelspace

Signed-off-by: Ross Kirk <ross.kirk@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:23:11 -04:00
chandan 120e27d76f btrfs-progs: clear_extent_bits: Fix memory leak.
The 'prealloc' extent_state structure is leaked for the case when the 'desired
range' encapsulates/covers the 'extent range'.

Signed-off-by: chandan <chandan@linux.vnet.ibm.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:23:11 -04:00
Josef Bacik 1b10eaa8e1 Btrfs-progs: fix the min ticks check in print_seek_histogram
Before I had been dividing by 5 but that gave me too much output so I changed it
to 20 without changing the min seeks test.  Fix this to avoid a divide by 0
problem.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:23:11 -04:00
David Sterba 25d82d2229 btrfs-progs: check if device supports trim
The message about trim was printed unconditionally, we should check if
trim is supported at all.

Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:23:11 -04:00
Josef Bacik b5efa4c3c9 Btrfs-progs: add a bunch of new statistics to btrfs-calc-size
I've been wanting to get back to the allocator and make some changes to try and
fix our fragmenation woes with lots of metadata.  But in order to make these
changes I need to have something to tell me if my changes are making a real
measurable difference.  So this patch adds a bunch of new statistics to
btrfs-calc-size.  It will tell me how long it took to read in the trees, how
many seeks it had (both forward and backward).  It will tell me how far spread
out the tree is and spit out a nice histogram of the seeks.  Here is some sample
output

Calculating size of extent tree
        Total size: 60.74MB
                Inline data: 0.00
        Total seeks: 5020
                Forward seeks: 3691
                Backward seeks: 1329
                Avg seek len: 929.53MB
        Seek histogram
                      4096 -       4096:       1043 ####
                      8192 -      73728:        760 ###
                     81920 -   52527104:        753 ###
                  53518336 -  168009728:        753 ###
                 168591360 -  696045568:        753 ###
                 696238080 - 7560364032:        753 ###
                7560437760 - 8409739264:        178 |
        Total clusters: 1874
                Avg cluster size: 25.17KB
                Min cluster size: 8.00KB
                Max cluster size: 472.00KB
        Total disk spread: 7.90GB
        Total read time: 0 s 341670 us
        Levels: 4

This way we can have good numbers to back up any changes we make to the
allocator.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:23:11 -04:00
David Sterba 7fbcc39c30 btrfs-progs: look up the containing tree root id
Find the tree id of the containing subvolume for a given file or
directory. For subvolume return it's own id.

$ btrfs inspect-internal rootid <path>

Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:23:11 -04:00
David Sterba 8e937074a4 btrfs-progs: remove leftovers from hg times
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:23:11 -04:00
Ross Kirk db6feaadfe btrfs-progs: remove unused parameter from btrfs_header_fsid
Remove unused parameter, 'eb'. Unused since introduction in
7777e63b42

Signed-off-by: Ross Kirk <ross.kirk@gmail.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:23:10 -04:00
Ross Kirk af86684e9b btrfs-progs: drop unused parameter from btrfs_item_nr
Remove unused eb parameter from btrfs_item_nr, unused since introduced
in 7777e63b42

Signed-off-by: Ross Kirk <ross.kirk@gmail.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:23:10 -04:00
Wang Shilong 7985fe64e0 Btrfs-progs: add super-recover to recover bad supers
Until now if one of device's first superblock is corrupt,btrfs will
fail to mount. Luckily, btrfs have at least two superblocks for
every disk.

In theory, if silent corrupting happens when we are writting superblocks
into disk, we must hold at least one good superblock.

One side effect is that user must gurantee that the disk must be
a btrfs disk. Otherwise, this tool may destroy other fs.(This is also
reason why btrfs only use first superblock in every disk to mount)

This little program will try to correct bad superblocks from
good superblocks with max generation.

There will be five kinds of return values:

0: all supers are valid, no need to recover
1: usage or syntax error
2: recover all bad superblocks successfully
3: fail to recover bad superblocks
4: abort to recover bad superblocks

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:23:08 -04:00
Wang Shilong 39813fb7ac Btrfs-progs: move ask_user() to utils.c
Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:22:26 -04:00
Wang Shilong 77801d34d0 Btrfs-progs: pass flag to control whether run ioctl in btrfs_scan_for_fsid()
If some fatal superblocks are damaged, running ioctl will return failure,
in this case, we should avoid run ioctl.

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:22:26 -04:00
Wang Shilong e353813b7c Btrfs-progs: do not run ioctls in check_mounted_where()
We don't need to run ioctls when checking whether btrfs
has mounted somewhere.

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:22:26 -04:00
David Sterba 4e466c8b44 btrfs-progs: add list_sort and use it to sort devices by id
The devices in 'btrfs filesystem show' are now sorted by the device id,
currently the order was undefined.

Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:22:26 -04:00
David Sterba e9270f6209 btrfs-progs: separate command and implementation of chunk-recover code
The command has been moved and we should rename the files accordingly,
so the entry point is now in cmds-rescue.c and the core functionality
in it's own file.

Return codes of btrfs_recover_chunk_tree have been simplified not to
require a define and another file for defintion.

CC: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:22:23 -04:00
David Sterba 6ed613854d btrfs-progs: move chunk-recover to rescue group
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:21:38 -04:00
David Sterba 133b1b0377 btrfs-progs: introduce rescue command group
Add an empty 1st level command namespace that will collect specialized
recovery tools like chunk-recover, zero-log, select-super and similar.

Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:21:36 -04:00
David Sterba 992fd23180 btrfs-progs: add nodiscard option to device add
Same as for mkfs.

Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:20:43 -04:00
David Sterba 15ac848f8a btrfs-progs: use better name for nodiscard variable and flip the logic
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:20:43 -04:00
Wang Shilong f3ba662634 Btrfs-progs: fix magic return value in cmds-balance.c
If there is no balance in progress, resume/pause/cancel
will return 2. Usage or syntax errors will return 1.
And 0 means operations return successfully.

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:20:43 -04:00
Chris West (Faux) cddbab982d btrfs-progs: fix -Wmissing-noreturn
Signed-off-by: "Chris West (Faux)" <git@goeswhere.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:20:43 -04:00
Chris West (Faux) 8892d54442 btrfs-progs: 'optarg' shadows getopt
Signed-off-by: "Chris West (Faux)" <git@goeswhere.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:20:43 -04:00
Josef Bacik d02aeeaae0 Btrfs-progs: add ability to corrupt file extent disk bytenr
A user had a corrupt fs where one of his file extents pointed to a completely
bogus disk bytenr.  This patch allows us to corrupt a file system in a similar
way in order to test btrfsck.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:20:43 -04:00
Josef Bacik ce5a3ef3c0 Btrfs-progs: make btrfsck fix backrefs that are broken
If you set an file extent item's disk_bytenr to something completely wrong we
won't be able to fix this if it is the only one who has a ref on the original
disk bytenr.  Our extent records know exactly who is supposed to point at them,
so if we have an extent record that has no backrefs we can go and try to lookup
the backrefs ourselves.  If these backrefs do not point to an extent record that
was actually found then we can be pretty sure this extent record is valid and
the backref is bogus.  Then the verify_backref code can do its thing and reset
the backref to point to the right extent record and we can all carry on.  This
fixes a user reported corruption.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:20:43 -04:00
Josef Bacik 9e93f11b2e Btrfs-progs: allow fsck to fix directory isize errors
A user reported a problem where he was unable to rmdir an empty directory.  This
is because his isize was wrong.  This patch will fix this sort of corruption and
allow him to rmdir his directory.  Thanks

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:20:43 -04:00
Josef Bacik eb626f4918 Btrfs-progs: setup framework to corrupt specific fields of an inode
A user reported a problem with his fs where he had a bogus isize on his
directory.  In order to make sure my patch for fsck fixes this properly I needed
to be able to corrupt an inode like this, which is what this patch is for.
Eventually I want to extend this to corrupt everything so we can integrate tests
into btrfs-progs to run btrfsck against to make sure we don't regress on fixing
things with btrfsck.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:20:43 -04:00
David Sterba 114a79f823 btrfs-progs: make btrfs-corrupt-block compile again
Reexport csum_tree_block.

Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:20:43 -04:00
Wang Shilong 1425caef05 Btrfs-progs: fix typo in btrfs_err_str()
Raid5 and raid6 at least need three and foure devices respectively,
fix it.

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:20:42 -04:00
Hidetoshi Seto 03e9539615 btrfs-progs: calculate available blocks on device properly
I found that mkfs.btrfs aborts when assigned multi volumes contain
a small volume:

  # parted /dev/sdf p
  Model: LSI MegaRAID SAS RMB (scsi)
  Disk /dev/sdf: 72.8GB
  Sector size (logical/physical): 512B/512B
  Partition Table: msdos

  Number  Start   End     Size    Type     File system  Flags
   1      32.3kB  72.4GB  72.4GB  primary
   2      72.4GB  72.8GB  461MB   primary

  # ./mkfs.btrfs -f /dev/sdf1 /dev/sdf2
  :
  SMALL VOLUME: forcing mixed metadata/data groups
  adding device /dev/sdf2 id 2
  mkfs.btrfs: volumes.c:852: btrfs_alloc_chunk: Assertion `!(ret)' failed.
  Aborted (core dumped)

This failure of btrfs_alloc_chunk was caused by following steps:
 1) since there is only small space in the small device, mkfs was
    going to allocate a chunk from free space as much as available.
    So mkfs called btrfs_alloc_chunk with
        size = device->total_bytes - device->used_bytes.
 2) (According to the comment in source code, to avoid overwriting
    superblock,) btrfs_alloc_chunk starts taking chunks at an offset
    of 1MB. It means that the layout of a disk will be like:
     [[1MB at beginning for sb][allocated chunks]* ... free space ... ]
    and you can see that the available free space for allocation is:
        avail = device->total_bytes - device->used_bytes - 1MB.
 3) Therefore there is only free space 1MB less than requested. damn.

>From further investigations I also found that this issue is easily
reproduced by using -A, --alloc-start option:

  # truncate --size=1G testfile
  # ./mkfs.btrfs -A900M -f testfile
   :
  mkfs.btrfs: volumes.c:852: btrfs_alloc_chunk: Assertion `!(ret)' failed.
  Aborted (core dumped)

In this case there is only 100MB for allocation but btrfs_alloc_chunk
was going to allocate more than the 100MB.

The root cause of both of above troubles is a same simple bug:
btrfs_chunk_alloc does not calculate available bytes properly even
though it researches how many devices have enough room to have a
chunk to be allocated.

So this patch introduces new function btrfs_device_avail_bytes()
which returns available bytes for allocation in specified device.

Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:20:42 -04:00
Hidetoshi Seto 49fef6fc53 btrfs-progs: error if device have no space to make primary chunks
The previous patch works fine if the size of specified volume to mkfs
is less than 4MB. However usually btrfs requires more than 4MB to work,
and the minimum preferred size is depending on the raid setting etc.

This patch let mkfs print error message if it cannot allocate one of
chunks should be there at first.

 [before]
  # truncate --size=4500K testfile
  # ./mkfs.btrfs -f testfile
   :
  SMALL VOLUME: forcing mixed metadata/data groups
  mkfs.btrfs: mkfs.c:84: make_root_dir: Assertion `!(ret)' failed.
  Aborted (core dumped)

 [After]
  # truncate --size=4500K testfile
  # ./mkfs.btrfs -f testfile
   :
  SMALL VOLUME: forcing mixed metadata/data groups
  no space to alloc data/metadata chunk
  failed to setup the root directory

TBD is calculate minimum size for setting and put it in the error
message to let user know how large amount of volume is required.

Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:20:42 -04:00
Hidetoshi Seto f9d102efdc btrfs-progs: error if device for mkfs is too small
Eric pointed out that mkfs abort if specified volume is too small:

  # truncate --size=2m testfile
  # ./mkfs.btrfs testfile
   :
  SMALL VOLUME: forcing mixed metadata/data groups
  mkfs.btrfs: volumes.c:852: btrfs_alloc_chunk: Assertion `!(ret)' failed.
  Aborted (core dumped)

As the first step to fix problems around there, let mkfs to report
error if the size of target volume is less than the size of the first
system block group, BTRFS_MKFS_SYSTEM_GROUP_SIZE (= 4MB).

Reported-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:20:42 -04:00
chandan 7c9074422a btrfs-progs: btrfs_setup_chunk_tree_and_device_map: Return -EIO on error.
As a result of a successful call to btrfs_read_sys_array(), the 'ret'
variable is already set to 0. Hence the function would return 0 even
if the call to read_tree_block() fails.

Signed-off-by: chandan <chandan@linux.vnet.ibm.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:20:42 -04:00
Gui Hecheng 1c87a95bfc btrfs-progs: free strdup()s that are not freed
The strdup()s not freed are reported as memory leaks by valgrind.

Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:20:42 -04:00
Gui Hecheng aea22fa1b5 btrfs-progs: free the local list pending_list in btrfs_scan_one_dir
Originally the local pending_list is not guaranteed to be freed upon
fails, it should be emptyed and the elements should be freed.

Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:20:42 -04:00
Gui Hecheng 0785476db0 btrfs-progs: missing tree-freeing statements added
The seen cache_tree in run_next_block freed.
Originally, this "missing" causes memory leaks, reported by valgrind.

Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:20:42 -04:00
Gui Hecheng 28abed7b0f btrfs-progs: local variable memory freed
The local probe variable in is_ssd() freed upon unsuccessful return;
The local dir_head list in make_image() freed upon unsuccessful return.

Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:20:42 -04:00
Gui Hecheng 0f2569b126 btrfs-progs: free local variable buf upon unsuccessful returns
The variable "buf" passed into find_collision() as parameter "name"
should be freed on unsuccessful returns.

Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:20:42 -04:00
Wang Shilong 5991043ea4 Btrfs-progs: fix magic return value in cmds-scrub.c
There will be four kinds of return value for command "scrub start":

0: scrub dosen't find errors and return success.
1: usage or syntax errors.
3: scrub finds errors and correct all of them.
4: scrub finds errors and some of them are not correctable.

Three kinds of return values for scrub cancel/resume:

0: cancel successfully.
1: usage or syntax errors.
2: cancel a not started or finished scrub.

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:20:42 -04:00
Wang Shilong 2e8956a55f Btrfs-progs: fix magic return value in cmds-replace.c
There are 3 kinds of return values in replace cancel:

0: cancel successfully.
1: usage or syntal errors
2: cancel a not started or finished replacing operations.

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:20:42 -04:00
Wang Shilong 0497edae9f Btrfs-progs: fix magic return value in random-test.c
Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:20:42 -04:00
Wang Shilong 5f00e770f8 Btrfs-progs: fix magic return value in dir-test.c
Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:20:42 -04:00
Wang Shilong 039a27cea4 Btrfs-progs: fix magic return value in send-test.c
Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:20:42 -04:00
Wang Shilong aaf03176af Btrfs-progs: fix magic return value in btrfs-zero-log.c
Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:20:42 -04:00
Wang Shilong 2ce6b4bf24 Btrfs-progs: fix magic return value in btrfs-imgae.c
Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:20:42 -04:00
Wang Shilong 59fd13f39a Btrfs-progs: fix magic return value in cmds-send.c
If btrfs send return failure, we return 1,otherwise 0 will be returned.

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-10-16 08:20:41 -04:00