Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 21120
b: refs/heads/master
c: e17a948
h: refs/heads/master
v: v3
  • Loading branch information
Al Viro committed Mar 18, 2006
1 parent f58ddc3 commit 8102cfe
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 25975f863b0fd42c58109e253e7a4c65d9fdaf48
refs/heads/master: e17a9489b4a686bb5e9615e1d375c67619cb99c5
7 changes: 7 additions & 0 deletions trunk/block/as-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@ static void free_as_io_context(struct as_io_context *aic)
kfree(aic);
}

static void as_trim(struct io_context *ioc)
{
kfree(ioc->aic);
ioc->aic = NULL;
}

/* Called when the task exits */
static void exit_as_io_context(struct as_io_context *aic)
{
Expand Down Expand Up @@ -1860,6 +1866,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_ktype = &as_ktype,
Expand Down
8 changes: 8 additions & 0 deletions trunk/block/cfq-iosched.c
Original file line number Diff line number Diff line change
Expand Up @@ -1211,6 +1211,13 @@ static void cfq_free_io_context(struct cfq_io_context *cic)
kmem_cache_free(cfq_ioc_pool, cic);
}

static void cfq_trim(struct io_context *ioc)
{
ioc->set_ioprio = NULL;
if (ioc->cic)
cfq_free_io_context(ioc->cic);
}

/*
* Called with interrupts disabled
*/
Expand Down Expand Up @@ -2472,6 +2479,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_trim,
},
.elevator_ktype = &cfq_ktype,
.elevator_name = "cfq",
Expand Down
24 changes: 9 additions & 15 deletions trunk/block/elevator.c
Original file line number Diff line number Diff line change
Expand Up @@ -675,21 +675,15 @@ void elv_unregister(struct elevator_type *e)
/*
* Iterate every thread in the process to remove the io contexts.
*/
read_lock(&tasklist_lock);
do_each_thread(g, p) {
struct io_context *ioc = p->io_context;
if (ioc && ioc->cic) {
ioc->cic->exit(ioc->cic);
ioc->cic->dtor(ioc->cic);
ioc->cic = NULL;
}
if (ioc && ioc->aic) {
ioc->aic->exit(ioc->aic);
ioc->aic->dtor(ioc->aic);
ioc->aic = NULL;
}
} while_each_thread(g, p);
read_unlock(&tasklist_lock);
if (e->ops.trim) {
read_lock(&tasklist_lock);
do_each_thread(g, p) {
task_lock(p);
e->ops.trim(p->io_context);
task_unlock(p);
} while_each_thread(g, p);
read_unlock(&tasklist_lock);
}

spin_lock_irq(&elv_list_lock);
list_del_init(&e->list);
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/elevator.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ struct elevator_ops

elevator_init_fn *elevator_init_fn;
elevator_exit_fn *elevator_exit_fn;
void (*trim)(struct io_context *);
};

#define ELV_NAME_MAX (16)
Expand Down

0 comments on commit 8102cfe

Please sign in to comment.