Skip to contentSkip to conversation

elevator: remove second argument in elevator_init()

PATCH Superseded Alexey Klimov 3 participants 5 messages Jan 15, 2016 – Sep 27, 2016 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 elevator: remove second argument in elevator_init()

Last user of elevator_init() with non-NULL name as second argument that supposed to be s390 dasd driver has gone few releases ago. Drivers rely on elevator_change(), elevator_switch() and friends for example. Right now elevator_init() is always called as elevator_init(q, NULL).

Patch removes passing of second name argument and its usage.

While we're at it fix following if-check after removed lines. We know that elevator_type e is initialized by NULL and need to check only chosen_elevator.

---
 block/blk-core.c         |  2 +-
 block/elevator.c         | 10 ++--------
 include/linux/elevator.h |  2 +-
 3 files changed, 4 insertions(+), 10 deletions(-)
block/blk-core.c +1 -1
index 33e2f62..f742ef4 100644
@@ -861,7 +861,7 @@ blk_init_allocated_queue(struct request_queue *q, request_fn_proc *rfn,
 	mutex_lock(&q->sysfs_lock);
 
 	/* init elevator */
-	if (elevator_init(q, NULL)) {
+	if (elevator_init(q)) {
 		mutex_unlock(&q->sysfs_lock);
 		goto fail;
 	}
block/elevator.c +2 -8
index c3555c9..ff5c830 100644
@@ -177,7 +177,7 @@ static void elevator_release(struct kobject *kobj)
 	kfree(e);
 }
 
-int elevator_init(struct request_queue *q, char *name)
+int elevator_init(struct request_queue *q)
 {
 	struct elevator_type *e = NULL;
 	int err;
@@ -196,18 +196,12 @@ int elevator_init(struct request_queue *q, char *name)
 	q->end_sector = 0;
 	q->boundary_rq = NULL;
 
-	if (name) {
-		e = elevator_get(name, true);
-		if (!e)
-			return -EINVAL;
-	}
-
 	/*
 	 * Use the default elevator specified by config boot param or
 	 * config option.  Don't try to load modules as we could be running
 	 * off async and request_module() isn't allowed from async.
 	 */
-	if (!e && *chosen_elevator) {
+	if (*chosen_elevator) {
 		e = elevator_get(chosen_elevator, false);
 		if (!e)
 			printk(KERN_ERR "I/O scheduler %s not found\n",
include/linux/elevator.h +1 -1
index 638b324..0ae0efd 100644
@@ -154,7 +154,7 @@ extern void elv_unregister(struct elevator_type *);
 extern ssize_t elv_iosched_show(struct request_queue *, char *);
 extern ssize_t elv_iosched_store(struct request_queue *, const char *, size_t);
 
-extern int elevator_init(struct request_queue *, char *);
+extern int elevator_init(struct request_queue *);
 extern void elevator_exit(struct elevator_queue *);
 extern int elevator_change(struct request_queue *, const char *);
 extern bool elv_rq_merge_ok(struct request *, struct bio *);
Signature · 1 line
2.5.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Alexey Klimov

Last user of elevator_init() with non-NULL name as second argument that supposed to be s390 dasd driver has gone few releases ago. Drivers rely on elevator_change(), elevator_switch() and friends for example. Right now elevator_init() is always called as elevator_init(q, NULL).

Quoted 7 lines

Patch removes passing of second name argument and its usage.

While we're at it fix following if-check after removed lines. We know that elevator_type e is initialized by NULL and need to check only chosen_elevator.

Quoted 65 lines
---
 block/blk-core.c         |  2 +-
 block/elevator.c         | 10 ++--------
 include/linux/elevator.h |  2 +-
 3 files changed, 4 insertions(+), 10 deletions(-)
block/blk-core.c +1 -1
index 33e2f62..f742ef4 100644
@@ -861,7 +861,7 @@ blk_init_allocated_queue(struct request_queue *q, request_fn_proc *rfn,
 	mutex_lock(&q->sysfs_lock);
 
 	/* init elevator */
-	if (elevator_init(q, NULL)) {
+	if (elevator_init(q)) {
 		mutex_unlock(&q->sysfs_lock);
 		goto fail;
 	}
block/elevator.c +2 -8
index c3555c9..ff5c830 100644
@@ -177,7 +177,7 @@ static void elevator_release(struct kobject *kobj)
 	kfree(e);
 }
 
-int elevator_init(struct request_queue *q, char *name)
+int elevator_init(struct request_queue *q)
 {
 	struct elevator_type *e = NULL;
 	int err;
@@ -196,18 +196,12 @@ int elevator_init(struct request_queue *q, char *name)
 	q->end_sector = 0;
 	q->boundary_rq = NULL;
 
-	if (name) {
-		e = elevator_get(name, true);
-		if (!e)
-			return -EINVAL;
-	}
-
 	/*
 	 * Use the default elevator specified by config boot param or
 	 * config option.  Don't try to load modules as we could be running
 	 * off async and request_module() isn't allowed from async.
 	 */
-	if (!e && *chosen_elevator) {
+	if (*chosen_elevator) {
 		e = elevator_get(chosen_elevator, false);
 		if (!e)
 			printk(KERN_ERR "I/O scheduler %s not found\n",
include/linux/elevator.h +1 -1
index 638b324..0ae0efd 100644
@@ -154,7 +154,7 @@ extern void elv_unregister(struct elevator_type *);
 extern ssize_t elv_iosched_show(struct request_queue *, char *);
 extern ssize_t elv_iosched_store(struct request_queue *, const char *, size_t);
 
-extern int elevator_init(struct request_queue *, char *);
+extern int elevator_init(struct request_queue *);
 extern void elevator_exit(struct elevator_queue *);
 extern int elevator_change(struct request_queue *, const char *);
 extern bool elv_rq_merge_ok(struct request *, struct bio *);
#2 lore raw

Hi all,

Quoted 10 lines · Jeff Moyer
Quoted 8 lines · Alexey Klimov

Last user of elevator_init() with non-NULL name as second argument that supposed to be s390 dasd driver has gone few releases ago. Drivers rely on elevator_change(), elevator_switch() and friends for example. Right now elevator_init() is always called as elevator_init(q, NULL).

Patch removes passing of second name argument and its usage.

Quoted 7 lines
Quoted 5 lines

While we're at it fix following if-check after removed lines. We know that elevator_type e is initialized by NULL and need to check only chosen_elevator.

what is the status of this patch? Is it that wrong and are there some concerns or do I need to resend it?

Best regards,
Alexey

Quoted 65 lines
Quoted 65 lines
---
 block/blk-core.c         |  2 +-
 block/elevator.c         | 10 ++--------
 include/linux/elevator.h |  2 +-
 3 files changed, 4 insertions(+), 10 deletions(-)
block/blk-core.c +1 -1
index 33e2f62..f742ef4 100644
@@ -861,7 +861,7 @@ blk_init_allocated_queue(struct request_queue *q, request_fn_proc *rfn,
      mutex_lock(&q->sysfs_lock);
 
      /* init elevator */
-     if (elevator_init(q, NULL)) {
+     if (elevator_init(q)) {
              mutex_unlock(&q->sysfs_lock);
              goto fail;
      }
block/elevator.c +2 -8
index c3555c9..ff5c830 100644
@@ -177,7 +177,7 @@ static void elevator_release(struct kobject *kobj)
      kfree(e);
 }
 
-int elevator_init(struct request_queue *q, char *name)
+int elevator_init(struct request_queue *q)
 {
      struct elevator_type *e = NULL;
      int err;
@@ -196,18 +196,12 @@ int elevator_init(struct request_queue *q, char *name)
      q->end_sector = 0;
      q->boundary_rq = NULL;
 
-     if (name) {
-             e = elevator_get(name, true);
-             if (!e)
-                     return -EINVAL;
-     }
-
      /*
       * Use the default elevator specified by config boot param or
       * config option.  Don't try to load modules as we could be running
       * off async and request_module() isn't allowed from async.
       */
-     if (!e && *chosen_elevator) {
+     if (*chosen_elevator) {
              e = elevator_get(chosen_elevator, false);
              if (!e)
                      printk(KERN_ERR "I/O scheduler %s not found\n",
include/linux/elevator.h +1 -1
index 638b324..0ae0efd 100644
@@ -154,7 +154,7 @@ extern void elv_unregister(struct elevator_type *);
 extern ssize_t elv_iosched_show(struct request_queue *, char *);
 extern ssize_t elv_iosched_store(struct request_queue *, const char *, size_t);
 
-extern int elevator_init(struct request_queue *, char *);
+extern int elevator_init(struct request_queue *);
 extern void elevator_exit(struct elevator_queue *);
 extern int elevator_change(struct request_queue *, const char *);
 extern bool elv_rq_merge_ok(struct request *, struct bio *);
maintainer
#3 lore raw
Quoted 17 lines · Alexey Klimov

Hi all,

Quoted 14 lines · Jeff Moyer
Quoted 12 lines · Alexey Klimov

Last user of elevator_init() with non-NULL name as second argument that supposed to be s390 dasd driver has gone few releases ago. Drivers rely on elevator_change(), elevator_switch() and friends for example. Right now elevator_init() is always called as elevator_init(q, NULL).

Patch removes passing of second name argument and its usage.

While we're at it fix following if-check after removed lines. We know that elevator_type e is initialized by NULL and need to check only chosen_elevator.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

what is the status of this patch? Is it that wrong and are there some concerns or do I need to resend it?

It looks fine, I'll pick it up for 4.7.

Signature · 1 line
Jens Axboe
#4 lore raw
Quoted 27 lines · Jens Axboe
Quoted 26 lines · Alexey Klimov

Hi all,

Quoted 19 lines · Jeff Moyer
Quoted 6 lines · Alexey Klimov

Last user of elevator_init() with non-NULL name as second argument that supposed to be s390 dasd driver has gone few releases ago. Drivers rely on elevator_change(), elevator_switch() and friends for example. Right now elevator_init() is always called as elevator_init(q, NULL).

Quoted 7 lines

Patch removes passing of second name argument and its usage.

While we're at it fix following if-check after removed lines. We know that elevator_type e is initialized by NULL and need to check only chosen_elevator.

Quoted 8 lines
Quoted 2 lines

what is the status of this patch? Is it that wrong and are there some concerns or do I need to resend it?

It looks fine, I'll pick it up for 4.7.

--
Jens Axboe

So, I guess this one was lost: I can't find it in the tree. Looks like the easiest way will be to rebase (and check that it's still fine) and resend. Right?

Best regards,
Alexey.