aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/Kconfig.iosched28
-rw-r--r--drivers/block/as-iosched.c2
-rw-r--r--drivers/block/cciss_scsi.c10
-rw-r--r--drivers/block/cfq-iosched.c22
-rw-r--r--drivers/block/elevator.c50
-rw-r--r--drivers/block/paride/paride.c1
-rw-r--r--drivers/block/paride/pf.c4
-rw-r--r--drivers/block/paride/pg.c2
-rw-r--r--drivers/block/paride/pt.c1
-rw-r--r--drivers/block/viodasd.c9
10 files changed, 80 insertions, 49 deletions
diff --git a/drivers/block/Kconfig.iosched b/drivers/block/Kconfig.iosched
index 6070a480600b..5b90d2fa63b8 100644
--- a/drivers/block/Kconfig.iosched
+++ b/drivers/block/Kconfig.iosched
@@ -38,4 +38,32 @@ config IOSCHED_CFQ
38 among all processes in the system. It should provide a fair 38 among all processes in the system. It should provide a fair
39 working environment, suitable for desktop systems. 39 working environment, suitable for desktop systems.
40 40
41choice
42 prompt "Default I/O scheduler"
43 default DEFAULT_AS
44 help
45 Select the I/O scheduler which will be used by default for all
46 block devices.
47
48 config DEFAULT_AS
49 bool "Anticipatory" if IOSCHED_AS
50
51 config DEFAULT_DEADLINE
52 bool "Deadline" if IOSCHED_DEADLINE
53
54 config DEFAULT_CFQ
55 bool "CFQ" if IOSCHED_CFQ
56
57 config DEFAULT_NOOP
58 bool "No-op"
59
60endchoice
61
62config DEFAULT_IOSCHED
63 string
64 default "anticipatory" if DEFAULT_AS
65 default "deadline" if DEFAULT_DEADLINE
66 default "cfq" if DEFAULT_CFQ
67 default "noop" if DEFAULT_NOOP
68
41endmenu 69endmenu
diff --git a/drivers/block/as-iosched.c b/drivers/block/as-iosched.c
index 564172234819..c6744ff38294 100644
--- a/drivers/block/as-iosched.c
+++ b/drivers/block/as-iosched.c
@@ -1973,8 +1973,8 @@ static int __init as_init(void)
1973 1973
1974static void __exit as_exit(void) 1974static void __exit as_exit(void)
1975{ 1975{
1976 kmem_cache_destroy(arq_pool);
1977 elv_unregister(&iosched_as); 1976 elv_unregister(&iosched_as);
1977 kmem_cache_destroy(arq_pool);
1978} 1978}
1979 1979
1980module_init(as_init); 1980module_init(as_init);
diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c
index e183a3ef7839..ec27976a57da 100644
--- a/drivers/block/cciss_scsi.c
+++ b/drivers/block/cciss_scsi.c
@@ -28,13 +28,17 @@
28 through the array controller. Note in particular, neither 28 through the array controller. Note in particular, neither
29 physical nor logical disks are presented through the scsi layer. */ 29 physical nor logical disks are presented through the scsi layer. */
30 30
31#include <linux/timer.h>
32#include <linux/completion.h>
33#include <linux/slab.h>
34#include <linux/string.h>
35
36#include <asm/atomic.h>
37
31#include <scsi/scsi.h> 38#include <scsi/scsi.h>
32#include <scsi/scsi_cmnd.h> 39#include <scsi/scsi_cmnd.h>
33#include <scsi/scsi_device.h> 40#include <scsi/scsi_device.h>
34#include <scsi/scsi_host.h> 41#include <scsi/scsi_host.h>
35#include <asm/atomic.h>
36#include <linux/timer.h>
37#include <linux/completion.h>
38 42
39#include "cciss_scsi.h" 43#include "cciss_scsi.h"
40 44
diff --git a/drivers/block/cfq-iosched.c b/drivers/block/cfq-iosched.c
index 94690e4d41e0..5281f8e70510 100644
--- a/drivers/block/cfq-iosched.c
+++ b/drivers/block/cfq-iosched.c
@@ -2418,28 +2418,8 @@ static int __init cfq_init(void)
2418 2418
2419static void __exit cfq_exit(void) 2419static void __exit cfq_exit(void)
2420{ 2420{
2421 struct task_struct *g, *p;
2422 unsigned long flags;
2423
2424 read_lock_irqsave(&tasklist_lock, flags);
2425
2426 /*
2427 * iterate each process in the system, removing our io_context
2428 */
2429 do_each_thread(g, p) {
2430 struct io_context *ioc = p->io_context;
2431
2432 if (ioc && ioc->cic) {
2433 ioc->cic->exit(ioc->cic);
2434 cfq_free_io_context(ioc->cic);
2435 ioc->cic = NULL;
2436 }
2437 } while_each_thread(g, p);
2438
2439 read_unlock_irqrestore(&tasklist_lock, flags);
2440
2441 cfq_slab_kill();
2442 elv_unregister(&iosched_cfq); 2421 elv_unregister(&iosched_cfq);
2422 cfq_slab_kill();
2443} 2423}
2444 2424
2445module_init(cfq_init); 2425module_init(cfq_init);
diff --git a/drivers/block/elevator.c b/drivers/block/elevator.c
index 55621d5c5774..36f1057084b0 100644
--- a/drivers/block/elevator.c
+++ b/drivers/block/elevator.c
@@ -147,24 +147,17 @@ static void elevator_setup_default(void)
147 struct elevator_type *e; 147 struct elevator_type *e;
148 148
149 /* 149 /*
150 * check if default is set and exists 150 * If default has not been set, use the compiled-in selection.
151 */ 151 */
152 if (chosen_elevator[0] && (e = elevator_get(chosen_elevator))) { 152 if (!chosen_elevator[0])
153 elevator_put(e); 153 strcpy(chosen_elevator, CONFIG_DEFAULT_IOSCHED);
154 return;
155 }
156 154
157#if defined(CONFIG_IOSCHED_AS) 155 /*
158 strcpy(chosen_elevator, "anticipatory"); 156 * If the given scheduler is not available, fall back to no-op.
159#elif defined(CONFIG_IOSCHED_DEADLINE) 157 */
160 strcpy(chosen_elevator, "deadline"); 158 if (!(e = elevator_find(chosen_elevator)))
161#elif defined(CONFIG_IOSCHED_CFQ) 159 strcpy(chosen_elevator, "noop");
162 strcpy(chosen_elevator, "cfq"); 160 elevator_put(e);
163#elif defined(CONFIG_IOSCHED_NOOP)
164 strcpy(chosen_elevator, "noop");
165#else
166#error "You must build at least 1 IO scheduler into the kernel"
167#endif
168} 161}
169 162
170static int __init elevator_setup(char *str) 163static int __init elevator_setup(char *str)
@@ -642,6 +635,27 @@ EXPORT_SYMBOL_GPL(elv_register);
642 635
643void elv_unregister(struct elevator_type *e) 636void elv_unregister(struct elevator_type *e)
644{ 637{
638 struct task_struct *g, *p;
639
640 /*
641 * Iterate every thread in the process to remove the io contexts.
642 */
643 read_lock(&tasklist_lock);
644 do_each_thread(g, p) {
645 struct io_context *ioc = p->io_context;
646 if (ioc && ioc->cic) {
647 ioc->cic->exit(ioc->cic);
648 ioc->cic->dtor(ioc->cic);
649 ioc->cic = NULL;
650 }
651 if (ioc && ioc->aic) {
652 ioc->aic->exit(ioc->aic);
653 ioc->aic->dtor(ioc->aic);
654 ioc->aic = NULL;
655 }
656 } while_each_thread(g, p);
657 read_unlock(&tasklist_lock);
658
645 spin_lock_irq(&elv_list_lock); 659 spin_lock_irq(&elv_list_lock);
646 list_del_init(&e->list); 660 list_del_init(&e->list);
647 spin_unlock_irq(&elv_list_lock); 661 spin_unlock_irq(&elv_list_lock);
@@ -739,8 +753,10 @@ ssize_t elv_iosched_store(request_queue_t *q, const char *name, size_t count)
739 return -EINVAL; 753 return -EINVAL;
740 } 754 }
741 755
742 if (!strcmp(elevator_name, q->elevator->elevator_type->elevator_name)) 756 if (!strcmp(elevator_name, q->elevator->elevator_type->elevator_name)) {
757 elevator_put(e);
743 return count; 758 return count;
759 }
744 760
745 elevator_switch(q, e); 761 elevator_switch(q, e);
746 return count; 762 return count;
diff --git a/drivers/block/paride/paride.c b/drivers/block/paride/paride.c
index 1fef136c0e41..ce94aa11f6a7 100644
--- a/drivers/block/paride/paride.c
+++ b/drivers/block/paride/paride.c
@@ -29,6 +29,7 @@
29#include <linux/string.h> 29#include <linux/string.h>
30#include <linux/spinlock.h> 30#include <linux/spinlock.h>
31#include <linux/wait.h> 31#include <linux/wait.h>
32#include <linux/sched.h> /* TASK_* */
32 33
33#ifdef CONFIG_PARPORT_MODULE 34#ifdef CONFIG_PARPORT_MODULE
34#define CONFIG_PARPORT 35#define CONFIG_PARPORT
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c
index 94af920465b5..e9746af29b9f 100644
--- a/drivers/block/paride/pf.c
+++ b/drivers/block/paride/pf.c
@@ -807,10 +807,6 @@ static int pf_next_buf(void)
807 return 1; 807 return 1;
808 spin_lock_irqsave(&pf_spin_lock, saved_flags); 808 spin_lock_irqsave(&pf_spin_lock, saved_flags);
809 pf_end_request(1); 809 pf_end_request(1);
810 if (pf_req) {
811 pf_count = pf_req->current_nr_sectors;
812 pf_buf = pf_req->buffer;
813 }
814 spin_unlock_irqrestore(&pf_spin_lock, saved_flags); 810 spin_unlock_irqrestore(&pf_spin_lock, saved_flags);
815 return 1; 811 return 1;
816} 812}
diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c
index 82f2d6d2eeef..6f5df0fad703 100644
--- a/drivers/block/paride/pg.c
+++ b/drivers/block/paride/pg.c
@@ -162,6 +162,8 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_SLV, D_DLY};
162#include <linux/mtio.h> 162#include <linux/mtio.h>
163#include <linux/pg.h> 163#include <linux/pg.h>
164#include <linux/device.h> 164#include <linux/device.h>
165#include <linux/sched.h> /* current, TASK_* */
166#include <linux/jiffies.h>
165 167
166#include <asm/uaccess.h> 168#include <asm/uaccess.h>
167 169
diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c
index 686c95573452..715ae5dc88fb 100644
--- a/drivers/block/paride/pt.c
+++ b/drivers/block/paride/pt.c
@@ -146,6 +146,7 @@ static int (*drives[4])[6] = {&drive0, &drive1, &drive2, &drive3};
146#include <linux/slab.h> 146#include <linux/slab.h>
147#include <linux/mtio.h> 147#include <linux/mtio.h>
148#include <linux/device.h> 148#include <linux/device.h>
149#include <linux/sched.h> /* current, TASK_*, schedule_timeout() */
149 150
150#include <asm/uaccess.h> 151#include <asm/uaccess.h>
151 152
diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c
index e46ecd23b3ac..709f809f79f1 100644
--- a/drivers/block/viodasd.c
+++ b/drivers/block/viodasd.c
@@ -778,13 +778,16 @@ static struct vio_device_id viodasd_device_table[] __devinitdata = {
778 { "viodasd", "" }, 778 { "viodasd", "" },
779 { "", "" } 779 { "", "" }
780}; 780};
781
782MODULE_DEVICE_TABLE(vio, viodasd_device_table); 781MODULE_DEVICE_TABLE(vio, viodasd_device_table);
782
783static struct vio_driver viodasd_driver = { 783static struct vio_driver viodasd_driver = {
784 .name = "viodasd",
785 .id_table = viodasd_device_table, 784 .id_table = viodasd_device_table,
786 .probe = viodasd_probe, 785 .probe = viodasd_probe,
787 .remove = viodasd_remove 786 .remove = viodasd_remove,
787 .driver = {
788 .name = "viodasd",
789 .owner = THIS_MODULE,
790 }
788}; 791};
789 792
790/* 793/*