Message ID | 20230626022212.30297-1-luhongfei@vivo.com (mailing list archive) |
---|---|
State | Deferred, archived |
Headers | show |
Series | fs: iomap: replace the ternary conditional operator with max_t() | expand |
On Mon, Jun 26, 2023 at 10:22:12AM +0800, Lu Hongfei wrote: > It would be better to replace the traditional ternary conditional > operator with max_t() in iomap_iter No it wouldn't. There are two possible meanings for iter->processed. Either we processed a positive number of bytes, or it's an errno. max_t() doesn't express that. Your patch adds confusion, not reduces it.
diff --git a/fs/iomap/iter.c b/fs/iomap/iter.c index 79a0614eaab7..528fd196c50b 100644 --- a/fs/iomap/iter.c +++ b/fs/iomap/iter.c @@ -77,7 +77,7 @@ int iomap_iter(struct iomap_iter *iter, const struct iomap_ops *ops) if (iter->iomap.length && ops->iomap_end) { ret = ops->iomap_end(iter->inode, iter->pos, iomap_length(iter), - iter->processed > 0 ? iter->processed : 0, + max_t(s64, iter->processed, 0), iter->flags, &iter->iomap); if (ret < 0 && !iter->processed) return ret;
It would be better to replace the traditional ternary conditional operator with max_t() in iomap_iter Signed-off-by: Lu Hongfei <luhongfei@vivo.com> --- fs/iomap/iter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)