btrfs-progs: add new dev replace result

A new dev replace result was introduced by kernel commit

Btrfs: return failure if btrfs_dev_replace_finishing() failed

Make the userspace know about the new result too.

Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Btrfs-progs: fix a bug of converting sparse ext2/3/4

When converting a sparse ext* filesystem, btrfs-convert adds checksum extents
for empty extents, whose disk_bytenr = 0, and this can end up with some weird
problems, one of them is the failure of reading free space cache inode on
mounting converted btrfs.

The fix is simple, just to skip making checksum on empty extents.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
btrfs-progs: fix spacing in error messages

Signed-off-by: David Sterba <dsterba@suse.cz>
btrfs-progs: fix return value problem for btrfs sub show

If you exec:
	# btrfs sub show <dir>	<== non-subvolume dir
The cmd print error messages as expected, but returns 0.
By convetion, it should return non-zero and we should explicitly
set it before it goto out.

With other pieces adopted:
1) removed a unnecessary return value set -EINVAL
2) fixed another code branch which may return 0 upon error.
3) with 2) applied, the ret = 0 follows can be removed

Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
btrfs-progs: apply realpath for btrfs fi show when mount point is given

For now,
	# btrfs fi show /mnt/btrfs
gives info correctly, while
	# btrfs fi show /mnt/btrfs/
gives nothing.

This implies that the @realpath() function should be applied to
unify the behavior.

Made a more clear comment right above the call as well.

Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Btrfs-progs: add_refs_for_implied: Use root_id instead of root_bytenr.

resolve_one_root() returns the objectid of a tree rather than the logical
address of the root node. Hence using root_bytenr is misleading. Fix this.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
btrfs-progs: print root dir verbose error in fsck

Before this patch, when btrfsck found an error in root dir, it will only
output the following message "root %llu root dir %llu error" without any
detailed error.

Just add print_inode_error() to print out the whole error.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Btrfs progs 3.17.3

Signed-off-by: David Sterba <dsterba@suse.cz>