diff mbox series

[4/5] zfs: Fix return value of fs_devread()

Message ID 20240407014743.13872-5-mwleeds@mailtundra.com
State Accepted
Delegated to: Tom Rini
Headers show
Series zfs: Fix zfs support on aarch64 | expand

Commit Message

mwleeds@mailtundra.com April 7, 2024, 1:47 a.m. UTC
As evidenced by how other filesystems handle it, a return value of 0
from fs_devread() means failure; nonzero means success. The opposite
assumption was being made in zfs.c for the use of zfs_devread() so fix
the confusion by making zfs_devread() return 0 on success.

It probably doesn't make sense to change the handling of zfs_devread()
in zfs.c instead, because as it is it matches the semantics of the other
functions there.

Signed-off-by: Phaedrus Leeds <mwleeds@mailtundra.com>
Tested-by: Phaedrus Leeds <mwleeds@mailtundra.com>
---
 fs/zfs/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/fs/zfs/dev.c b/fs/zfs/dev.c
index 251e7d1f74..fcd9893b3a 100644
--- a/fs/zfs/dev.c
+++ b/fs/zfs/dev.c
@@ -19,12 +19,12 @@  static struct disk_partition *part_info;
 void zfs_set_blk_dev(struct blk_desc *rbdd, struct disk_partition *info)
 {
 	zfs_blk_desc = rbdd;
 	part_info = info;
 }
 
 /* err */
 int zfs_devread(int sector, int byte_offset, int byte_len, char *buf)
 {
 	return fs_devread(zfs_blk_desc, part_info, sector, byte_offset,
-			  byte_len, buf);
+			  byte_len, buf) ? 0 : 1;
 }