[PATCH 08/11, RESEND] btrfs-progs: btrfs-select-super output is confusing when it fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Trivial patch:
./btrfs-progs/btrfs-select-super -s 0 /dev/sdc
using SB copy 0, bytenr 65536
No valid Btrfs found on /dev/sdc
Open ctree failed

The line 'using..' is confusing which gives an
indication that command is successful

This patch will avoid that when command fails

Signed-off-by: Anand Jain <anand.jain@xxxxxxxxxx>
---
 btrfs-select-super.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/btrfs-select-super.c b/btrfs-select-super.c
index 0c4f5c0..6a458b8 100644
--- a/btrfs-select-super.c
+++ b/btrfs-select-super.c
@@ -43,7 +43,7 @@ int main(int ac, char **av)
 {
 	struct btrfs_root *root;
 	int ret;
-	int num;
+	int num = 0;
 	u64 bytenr = 0;
 
 	while(1) {
@@ -55,8 +55,6 @@ int main(int ac, char **av)
 			case 's':
 				num = atol(optarg);
 				bytenr = btrfs_sb_offset(num);
-				printf("using SB copy %d, bytenr %llu\n", num,
-				       (unsigned long long)bytenr);
 				break;
 			default:
 				print_usage();
@@ -97,5 +95,7 @@ int main(int ac, char **av)
 	 * transaction commit.  We just want the super copy we pulled off the
 	 * disk to overwrite all the other copies
 	 */ 
+	printf("using SB copy %d, bytenr %llu\n", num,
+	       (unsigned long long)bytenr);
 	return ret;
 }
-- 
1.8.1.227.g44fe835

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux