The series slightly improves the readability of elevator.c.
Jinlong Chen (4):
elevator: print none at first in elv_iosched_show even if the queue
has a scheduler
elevator: replace continue with else-if in elv_iosched_show
elevator: repalce "len+name" with "name+len" in elv_iosched_show
elevator: use bool instead of int as the return type of
elv_iosched_allow_bio_merge
block/elevator.c | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
--
2.34.1
We have bool type now, update the old signature.
Signed-off-by: Jinlong Chen <[email protected]>
---
block/elevator.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/block/elevator.c b/block/elevator.c
index 93dbaa560b67..cb1c9a69026c 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -57,7 +57,7 @@ static LIST_HEAD(elv_list);
* Query io scheduler to see if the current process issuing bio may be
* merged with rq.
*/
-static int elv_iosched_allow_bio_merge(struct request *rq, struct bio *bio)
+static bool elv_iosched_allow_bio_merge(struct request *rq, struct bio *bio)
{
struct request_queue *q = rq->q;
struct elevator_queue *e = q->elevator;
@@ -65,7 +65,7 @@ static int elv_iosched_allow_bio_merge(struct request *rq, struct bio *bio)
if (e->type->ops.allow_merge)
return e->type->ops.allow_merge(q, rq, bio);
- return 1;
+ return true;
}
/*
--
2.34.1
The "pointer + offset" pattern is more resonable.
Signed-off-by: Jinlong Chen <[email protected]>
---
block/elevator.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/elevator.c b/block/elevator.c
index ffa750976d25..93dbaa560b67 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -783,7 +783,7 @@ ssize_t elv_iosched_show(struct request_queue *q, char *name)
}
spin_unlock(&elv_list_lock);
- len += sprintf(len+name, "\n");
+ len += sprintf(name+len, "\n");
return len;
}
--
2.34.1
On Fri, Nov 25, 2022 at 11:53:14PM +0800, Jinlong Chen wrote:
> We have bool type now, update the old signature.
Looks good, especially as the allow_merge method already returns a bool:
Reviewed-by: Christoph Hellwig <[email protected]>
On Fri, Nov 25, 2022 at 11:53:13PM +0800, Jinlong Chen wrote:
> The "pointer + offset" pattern is more resonable.
Looks good:
Reviewed-by: Christoph Hellwig <[email protected]>