[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250620034206.3804-1-wangyufei@vivo.com>
Date: Fri, 20 Jun 2025 11:42:04 +0800
From: wangyufei <wangyufei@...o.com>
To: Justin Sanders <justin@...aid.com>,
Jens Axboe <axboe@...nel.dk>,
linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: opensource.kernel@...o.com,
wangyufei <wangyufei@...o.com>
Subject: [PATCH] aoe: Use min() to simplify code in probe()
Use min() to simplify probe() and improve its readability.
Signed-off-by: wangyufei <wangyufei@...o.com>
---
drivers/block/aoe/aoecmd.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
index 6298f8e27..d6fd83245 100644
--- a/drivers/block/aoe/aoecmd.c
+++ b/drivers/block/aoe/aoecmd.c
@@ -16,6 +16,7 @@
#include <net/net_namespace.h>
#include <linux/unaligned.h>
#include <linux/uio.h>
+#include <linux/minmax.h>
#include "aoe.h"
#define MAXIOC (8192) /* default meant to avoid most soft lockups */
@@ -607,10 +608,7 @@ probe(struct aoetgt *t)
ata_rw_frameinit(f);
skb = f->skb;
for (frag = 0, n = f->iter.bi_size; n > 0; ++frag, n -= m) {
- if (n < PAGE_SIZE)
- m = n;
- else
- m = PAGE_SIZE;
+ m = min(n, PAGE_SIZE);
skb_fill_page_desc(skb, frag, empty_page, 0, m);
}
skb->len += f->iter.bi_size;
--
2.39.0
Powered by blists - more mailing lists