linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs-progs: reserve < 0 return value for errnos
@ 2017-10-27  7:31 Anand Jain
  2017-10-27  7:54 ` Nikolay Borisov
  2017-10-27 14:41 ` [PATCH v2] " Anand Jain
  0 siblings, 2 replies; 5+ messages in thread
From: Anand Jain @ 2017-10-27  7:31 UTC (permalink / raw)
  To: linux-btrfs

btrfs_read_dev_super() returns -1 upon not finding a suitable SB,
change that to return 1 instead, so that it can reserve the < 0
values for the errno communications.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
An independent patch, not related to any recent patch sent to ML.

 disk-io.c | 2 +-
 utils.c   | 2 +-
 volumes.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/disk-io.c b/disk-io.c
index f5edc4796619..ba87bb4ce6da 100644
--- a/disk-io.c
+++ b/disk-io.c
@@ -1491,7 +1491,7 @@ int btrfs_read_dev_super(int fd, struct btrfs_super_block *sb, u64 sb_bytenr,
 		}
 	}
 
-	return transid > 0 ? 0 : -1;
+	return transid > 0 ? 0 : 1;
 }
 
 static int write_dev_supers(struct btrfs_fs_info *fs_info,
diff --git a/utils.c b/utils.c
index 524f463d3140..7574cda8151c 100644
--- a/utils.c
+++ b/utils.c
@@ -1678,7 +1678,7 @@ int get_fs_info(const char *path, struct btrfs_ioctl_fs_info_args *fi_args,
 		disk_super = (struct btrfs_super_block *)buf;
 		ret = btrfs_read_dev_super(fd, disk_super,
 					   BTRFS_SUPER_INFO_OFFSET, 0);
-		if (ret < 0) {
+		if (ret) {
 			ret = -EIO;
 			goto out;
 		}
diff --git a/volumes.c b/volumes.c
index 2209e5a9100b..87008bfdd586 100644
--- a/volumes.c
+++ b/volumes.c
@@ -268,7 +268,7 @@ int btrfs_scan_one_device(int fd, const char *path,
 
 	disk_super = (struct btrfs_super_block *)buf;
 	ret = btrfs_read_dev_super(fd, disk_super, super_offset, sbflags);
-	if (ret < 0)
+	if (ret)
 		return -EIO;
 	devid = btrfs_stack_device_id(&disk_super->dev_item);
 	if (btrfs_super_flags(disk_super) & BTRFS_SUPER_FLAG_METADUMP)
-- 
2.13.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-10-27 14:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-27  7:31 [PATCH] btrfs-progs: reserve < 0 return value for errnos Anand Jain
2017-10-27  7:54 ` Nikolay Borisov
2017-10-27  8:04   ` Qu Wenruo
2017-10-27 14:41     ` Anand Jain
2017-10-27 14:41 ` [PATCH v2] " Anand Jain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).