Skip to contentSkip to conversation

Cleanup elevator_ops->trim function

PATCH In review Pavel Emelyanov 2 participants 2 messages Jul 19, 2007 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Cleanup elevator_ops->trim function

The elevator_ops's member "trim" is declared and called not like all the other ones. Was this deliberate?

---

block/as-iosched.c       |    2 +-
block/cfq-iosched.c      |    2 +-
block/elevator.c         |    4 ++--
include/linux/elevator.h |    3 ++-
4 files changed, 6 insertions(+), 5 deletions(-)
block/as-iosched.c +0 -0
index 3e316dd..add524c 100644
@@ -1451,7 +1451,7 @@ static struct elevator_type iosched_as =
		.elevator_may_queue_fn =	as_may_queue,
		.elevator_init_fn =		as_init_queue,
		.elevator_exit_fn =		as_exit_queue,
-		.trim =				as_trim,
+		.elevator_trim_fn =		as_trim,
	},

	.elevator_attrs = as_attrs,
block/cfq-iosched.c +0 -0
index 9755a3c..5ee8c39 100644
@@ -2237,7 +2237,7 @@ static struct elevator_type iosched_cfq 

.elevator_may_queue_fn = cfq_may_queue,
.elevator_init_fn = cfq_init_queue,
.elevator_exit_fn = cfq_exit_queue,
- .trim = cfq_free_io_context,
+ .elevator_trim_fn = cfq_free_io_context,

	},
	.elevator_attrs =	cfq_attrs,
	.elevator_name =	"cfq",
block/elevator.c +0 -0
index d265963..ae7601f 100644
@@ -983,12 +983,12 @@ void elv_unregister(struct elevator_type
	/*
	 * Iterate every thread in the process to remove the io contexts.
	 */
-	if (e->ops.trim) {
+	if (e->ops.elevator_trim_fn) {
		read_lock(&tasklist_lock);
		do_each_thread(g, p) {
			task_lock(p);
			if (p->io_context)
-				e->ops.trim(p->io_context);
+				e->ops.elevator_trim_fn(p->io_context);
			task_unlock(p);
		} while_each_thread(g, p);
		read_unlock(&tasklist_lock);
include/linux/elevator.h +0 -0
index e88fcbc..896831a 100644
@@ -29,6 +29,7 @@ typedef void (elevator_deactivate_req_fn
 

typedef void *(elevator_init_fn) (request_queue_t *); typedef void (elevator_exit_fn) (elevator_t *); +typedef void (elevator_trim_fn) (struct io_context *);

struct elevator_ops
{
@@ -55,7 +56,7 @@ struct elevator_ops

	elevator_init_fn *elevator_init_fn;
	elevator_exit_fn *elevator_exit_fn;

- void (*trim)(struct io_context *);
+ elevator_trim_fn *elevator_trim_fn;
};

#define ELV_NAME_MAX (16)

#1 lore raw
Quoted 2 lines · Pavel Emelyanov

The elevator_ops's member "trim" is declared and called not like all the other ones. Was this deliberate?

It's not a elevator action like the others, it's not called during request handling, only for shutdown. So the different naming is actually ok, it shows it's a different type of operation.

Signature · 1 line
Jens Axboe