Skip to contentSkip to conversation

fuse: use min() macro

PATCH In review Shen Lichuan 2 participants 2 messages Aug 27, 2024 – Aug 30, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fuse: use min() macro

Use the min() macro to simplify the function and improve its readability.

---
 fs/fuse/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/fuse/file.c +1 -1
index 8ead93e775f4..aedeaa6014a6 100644
@@ -977,7 +977,7 @@ static void fuse_send_readpages(struct fuse_io_args *ia, struct file *file)
 			return;
 	} else {
 		res = fuse_simple_request(fm, &ap->args);
-		err = res < 0 ? res : 0;
+		err = min(res, 0);
 	}
 	fuse_readpages_end(fm, &ap->args, err);
 }
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 14 lines · Shen Lichuan

Use the min() macro to simplify the function and improve its readability.

---
 fs/fuse/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/fuse/file.c +0 -0
index 8ead93e775f4..aedeaa6014a6 100644

fs/fuse/file.c static void fuse_send_readpages(struct fuse_io_args *ia, struct file *file) · line 980

Quoted 5 lines
fs/fuse/file.c +1 -1
@@ -977,7 +977,7 @@ static void fuse_send_readpages(struct fuse_io_args *ia, struct file *file)
                        return;
        } else {
                res = fuse_simple_request(fm, &ap->args);
-               err = res < 0 ? res : 0;
+               err = min(res, 0);

I find it more readable the way it is, because it's not a mathematical minimum, rather a "if error, return error, otherwise return zero".

Thanks,
Miklos