btrfs-progs: only report internal dev replace result if there's a result
authorEryu Guan <guaneryu@gmail.com>
Fri, 10 Oct 2014 13:16:16 +0000 (21:16 +0800)
committerDavid Sterba <dsterba@suse.cz>
Mon, 3 Nov 2014 17:35:30 +0000 (18:35 +0100)
commit39893bb15ef39ee2ed254d931faf9c67d6c47e37
tree981b505484cefc9e5fb16fe4d6f9384799bc22e8
parent44cdb62d3478c834f41c87ea79d261b9c8982dce
btrfs-progs: only report internal dev replace result if there's a result

If BTRFS_IOC_DEV_REPLACE ioctl failed, args.result usually won't be
updated by the ioctl.

And the arg has been initialized with 0, the result is always 0, which
is BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR, and the resulting error
message looks confusing:

ERROR: ioctl(DEV_REPLACE_START) failed on "/mnt/btrfs": No such file or directory, no error

But in case there's an internal result returned in future, don't drop
the result completely, instead print dev replace result message only
if the result is updated by a failed ioctl call.

Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
cmds-replace.c
ioctl.h