diff options
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/Kconfig.iosched | 28 | ||||
-rw-r--r-- | drivers/block/aoe/aoecmd.c | 13 | ||||
-rw-r--r-- | drivers/block/as-iosched.c | 2 | ||||
-rw-r--r-- | drivers/block/cciss_scsi.c | 10 | ||||
-rw-r--r-- | drivers/block/cfq-iosched.c | 26 | ||||
-rw-r--r-- | drivers/block/elevator.c | 57 | ||||
-rw-r--r-- | drivers/block/floppy.c | 2 | ||||
-rw-r--r-- | drivers/block/genhd.c | 29 | ||||
-rw-r--r-- | drivers/block/ll_rw_blk.c | 47 | ||||
-rw-r--r-- | drivers/block/noop-iosched.c | 1 | ||||
-rw-r--r-- | drivers/block/paride/paride.c | 1 | ||||
-rw-r--r-- | drivers/block/paride/pf.c | 4 | ||||
-rw-r--r-- | drivers/block/paride/pg.c | 2 | ||||
-rw-r--r-- | drivers/block/paride/pt.c | 1 | ||||
-rw-r--r-- | drivers/block/viodasd.c | 17 |
15 files changed, 128 insertions, 112 deletions
diff --git a/drivers/block/Kconfig.iosched b/drivers/block/Kconfig.iosched index 6070a480600..5b90d2fa63b 100644 --- a/drivers/block/Kconfig.iosched +++ b/drivers/block/Kconfig.iosched @@ -38,4 +38,32 @@ config IOSCHED_CFQ among all processes in the system. It should provide a fair working environment, suitable for desktop systems. +choice + prompt "Default I/O scheduler" + default DEFAULT_AS + help + Select the I/O scheduler which will be used by default for all + block devices. + + config DEFAULT_AS + bool "Anticipatory" if IOSCHED_AS + + config DEFAULT_DEADLINE + bool "Deadline" if IOSCHED_DEADLINE + + config DEFAULT_CFQ + bool "CFQ" if IOSCHED_CFQ + + config DEFAULT_NOOP + bool "No-op" + +endchoice + +config DEFAULT_IOSCHED + string + default "anticipatory" if DEFAULT_AS + default "deadline" if DEFAULT_DEADLINE + default "cfq" if DEFAULT_CFQ + default "noop" if DEFAULT_NOOP + endmenu diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c index 5c9c7c1a3d4..326ca3876b6 100644 --- a/drivers/block/aoe/aoecmd.c +++ b/drivers/block/aoe/aoecmd.c @@ -468,16 +468,11 @@ aoecmd_ata_rsp(struct sk_buff *skb) unsigned long duration = jiffies - buf->start_time; unsigned long n_sect = buf->bio->bi_size >> 9; struct gendisk *disk = d->gd; + const int rw = bio_data_dir(buf->bio); - if (bio_data_dir(buf->bio) == WRITE) { - disk_stat_inc(disk, writes); - disk_stat_add(disk, write_ticks, duration); - disk_stat_add(disk, write_sectors, n_sect); - } else { - disk_stat_inc(disk, reads); - disk_stat_add(disk, read_ticks, duration); - disk_stat_add(disk, read_sectors, n_sect); - } + disk_stat_inc(disk, ios[rw]); + disk_stat_add(disk, ticks[rw], duration); + disk_stat_add(disk, sectors[rw], n_sect); disk_stat_add(disk, io_ticks, duration); n = (buf->flags & BUFFL_FAIL) ? -EIO : 0; bio_endio(buf->bio, buf->bio->bi_size, n); diff --git a/drivers/block/as-iosched.c b/drivers/block/as-iosched.c index 56417223481..c6744ff3829 100644 --- a/drivers/block/as-iosched.c +++ b/drivers/block/as-iosched.c @@ -1973,8 +1973,8 @@ static int __init as_init(void) static void __exit as_exit(void) { - kmem_cache_destroy(arq_pool); elv_unregister(&iosched_as); + kmem_cache_destroy(arq_pool); } module_init(as_init); diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c index e183a3ef783..ec27976a57d 100644 --- a/drivers/block/cciss_scsi.c +++ b/drivers/block/cciss_scsi.c @@ -28,13 +28,17 @@ through the array controller. Note in particular, neither physical nor logical disks are presented through the scsi layer. */ +#include <linux/timer.h> +#include <linux/completion.h> +#include <linux/slab.h> +#include <linux/string.h> + +#include <asm/atomic.h> + #include <scsi/scsi.h> #include <scsi/scsi_cmnd.h> #include <scsi/scsi_device.h> #include <scsi/scsi_host.h> -#include <asm/atomic.h> -#include <linux/timer.h> -#include <linux/completion.h> #include "cciss_scsi.h" diff --git a/drivers/block/cfq-iosched.c b/drivers/block/cfq-iosched.c index 94690e4d41e..ecacca9c877 100644 --- a/drivers/block/cfq-iosched.c +++ b/drivers/block/cfq-iosched.c @@ -2059,10 +2059,8 @@ static void cfq_put_cfqd(struct cfq_data *cfqd) if (!atomic_dec_and_test(&cfqd->ref)) return; - blk_put_queue(q); - cfq_shutdown_timer_wq(cfqd); - q->elevator->elevator_data = NULL; + blk_put_queue(q); mempool_destroy(cfqd->crq_pool); kfree(cfqd->crq_hash); @@ -2418,28 +2416,8 @@ static int __init cfq_init(void) static void __exit cfq_exit(void) { - struct task_struct *g, *p; - unsigned long flags; - - read_lock_irqsave(&tasklist_lock, flags); - - /* - * iterate each process in the system, removing our io_context - */ - do_each_thread(g, p) { - struct io_context *ioc = p->io_context; - - if (ioc && ioc->cic) { - ioc->cic->exit(ioc->cic); - cfq_free_io_context(ioc->cic); - ioc->cic = NULL; - } - } while_each_thread(g, p); - - read_unlock_irqrestore(&tasklist_lock, flags); - - cfq_slab_kill(); elv_unregister(&iosched_cfq); + cfq_slab_kill(); } module_init(cfq_init); diff --git a/drivers/block/elevator.c b/drivers/block/elevator.c index 55621d5c577..d4a49a3df82 100644 --- a/drivers/block/elevator.c +++ b/drivers/block/elevator.c @@ -147,24 +147,17 @@ static void elevator_setup_default(void) struct elevator_type *e; /* - * check if default is set and exists + * If default has not been set, use the compiled-in selection. */ - if (chosen_elevator[0] && (e = elevator_get(chosen_elevator))) { - elevator_put(e); - return; - } + if (!chosen_elevator[0]) + strcpy(chosen_elevator, CONFIG_DEFAULT_IOSCHED); -#if defined(CONFIG_IOSCHED_AS) - strcpy(chosen_elevator, "anticipatory"); -#elif defined(CONFIG_IOSCHED_DEADLINE) - strcpy(chosen_elevator, "deadline"); -#elif defined(CONFIG_IOSCHED_CFQ) - strcpy(chosen_elevator, "cfq"); -#elif defined(CONFIG_IOSCHED_NOOP) - strcpy(chosen_elevator, "noop"); -#else -#error "You must build at least 1 IO scheduler into the kernel" -#endif + /* + * If the given scheduler is not available, fall back to no-op. + */ + if (!(e = elevator_find(chosen_elevator))) + strcpy(chosen_elevator, "noop"); + elevator_put(e); } static int __init elevator_setup(char *str) @@ -376,9 +369,14 @@ void __elv_add_request(request_queue_t *q, struct request *rq, int where, case ELEVATOR_INSERT_SORT: BUG_ON(!blk_fs_request(rq)); rq->flags |= REQ_SORTED; - q->elevator->ops->elevator_add_req_fn(q, rq); if (q->last_merge == NULL && rq_mergeable(rq)) q->last_merge = rq; + /* + * Some ioscheds (cfq) run q->request_fn directly, so + * rq cannot be accessed after calling + * elevator_add_req_fn. + */ + q->elevator->ops->elevator_add_req_fn(q, rq); break; default: @@ -642,6 +640,27 @@ EXPORT_SYMBOL_GPL(elv_register); void elv_unregister(struct elevator_type *e) { + struct task_struct *g, *p; + + /* + * 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); + spin_lock_irq(&elv_list_lock); list_del_init(&e->list); spin_unlock_irq(&elv_list_lock); @@ -739,8 +758,10 @@ ssize_t elv_iosched_store(request_queue_t *q, const char *name, size_t count) return -EINVAL; } - if (!strcmp(elevator_name, q->elevator->elevator_type->elevator_name)) + if (!strcmp(elevator_name, q->elevator->elevator_type->elevator_name)) { + elevator_put(e); return count; + } elevator_switch(q, e); return count; diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 00895477155..5eadbb9d4d7 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -177,7 +177,7 @@ static int print_unex = 1; #include <linux/interrupt.h> #include <linux/init.h> #include <linux/devfs_fs_kernel.h> -#include <linux/device.h> +#include <linux/platform_device.h> #include <linux/buffer_head.h> /* for invalidate_buffers() */ /* diff --git a/drivers/block/genhd.c b/drivers/block/genhd.c index 486ce1fdeb8..54aec4a1ae1 100644 --- a/drivers/block/genhd.c +++ b/drivers/block/genhd.c @@ -391,13 +391,12 @@ static ssize_t disk_stats_read(struct gendisk * disk, char *page) "%8u %8u %8llu %8u " "%8u %8u %8u" "\n", - disk_stat_read(disk, reads), disk_stat_read(disk, read_merges), - (unsigned long long)disk_stat_read(disk, read_sectors), - jiffies_to_msecs(disk_stat_read(disk, read_ticks)), - disk_stat_read(disk, writes), - disk_stat_read(disk, write_merges), - (unsigned long long)disk_stat_read(disk, write_sectors), - jiffies_to_msecs(disk_stat_read(disk, write_ticks)), + disk_stat_read(disk, ios[0]), disk_stat_read(disk, merges[0]), + (unsigned long long)disk_stat_read(disk, sectors[0]), + jiffies_to_msecs(disk_stat_read(disk, ticks[0])), + disk_stat_read(disk, ios[1]), disk_stat_read(disk, merges[1]), + (unsigned long long)disk_stat_read(disk, sectors[1]), + jiffies_to_msecs(disk_stat_read(disk, ticks[1])), disk->in_flight, jiffies_to_msecs(disk_stat_read(disk, io_ticks)), jiffies_to_msecs(disk_stat_read(disk, time_in_queue))); @@ -583,12 +582,12 @@ static int diskstats_show(struct seq_file *s, void *v) preempt_enable(); seq_printf(s, "%4d %4d %s %u %u %llu %u %u %u %llu %u %u %u %u\n", gp->major, n + gp->first_minor, disk_name(gp, n, buf), - disk_stat_read(gp, reads), disk_stat_read(gp, read_merges), - (unsigned long long)disk_stat_read(gp, read_sectors), - jiffies_to_msecs(disk_stat_read(gp, read_ticks)), - disk_stat_read(gp, writes), disk_stat_read(gp, write_merges), - (unsigned long long)disk_stat_read(gp, write_sectors), - jiffies_to_msecs(disk_stat_read(gp, write_ticks)), + disk_stat_read(gp, ios[0]), disk_stat_read(gp, merges[0]), + (unsigned long long)disk_stat_read(gp, sectors[0]), + jiffies_to_msecs(disk_stat_read(gp, ticks[0])), + disk_stat_read(gp, ios[1]), disk_stat_read(gp, merges[1]), + (unsigned long long)disk_stat_read(gp, sectors[1]), + jiffies_to_msecs(disk_stat_read(gp, ticks[1])), gp->in_flight, jiffies_to_msecs(disk_stat_read(gp, io_ticks)), jiffies_to_msecs(disk_stat_read(gp, time_in_queue))); @@ -601,8 +600,8 @@ static int diskstats_show(struct seq_file *s, void *v) seq_printf(s, "%4d %4d %s %u %u %u %u\n", gp->major, n + gp->first_minor + 1, disk_name(gp, n + 1, buf), - hd->reads, hd->read_sectors, - hd->writes, hd->write_sectors); + hd->ios[0], hd->sectors[0], + hd->ios[1], hd->sectors[1]); } return 0; diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c index 0af73512b9a..2747741677f 100644 --- a/drivers/block/ll_rw_blk.c +++ b/drivers/block/ll_rw_blk.c @@ -2387,16 +2387,9 @@ static void drive_stat_acct(struct request *rq, int nr_sectors, int new_io) if (!blk_fs_request(rq) || !rq->rq_disk) return; - if (rw == READ) { - __disk_stat_add(rq->rq_disk, read_sectors, nr_sectors); - if (!new_io) - __disk_stat_inc(rq->rq_disk, read_merges); - } else if (rw == WRITE) { - __disk_stat_add(rq->rq_disk, write_sectors, nr_sectors); - if (!new_io) - __disk_stat_inc(rq->rq_disk, write_merges); - } - if (new_io) { + if (!new_io) { + __disk_stat_inc(rq->rq_disk, merges[rw]); + } else { disk_round_stats(rq->rq_disk); rq->rq_disk->in_flight++; } @@ -2791,17 +2784,11 @@ static inline void blk_partition_remap(struct bio *bio) if (bdev != bdev->bd_contains) { struct hd_struct *p = bdev->bd_part; + const int rw = bio_data_dir(bio); + + p->sectors[rw] += bio_sectors(bio); + p->ios[rw]++; - switch (bio_data_dir(bio)) { - case READ: - p->read_sectors += bio_sectors(bio); - p->reads++; - break; - case WRITE: - p->write_sectors += bio_sectors(bio); - p->writes++; - break; - } bio->bi_sector += p->start_sect; bio->bi_bdev = bdev->bd_contains; } @@ -3048,6 +3035,12 @@ static int __end_that_request_first(struct request *req, int uptodate, (unsigned long long)req->sector); } + if (blk_fs_request(req) && req->rq_disk) { + const int rw = rq_data_dir(req); + + __disk_stat_add(req->rq_disk, sectors[rw], nr_bytes >> 9); + } + total_bytes = bio_nbytes = 0; while ((bio = req->bio) != NULL) { int nbytes; @@ -3176,16 +3169,10 @@ void end_that_request_last(struct request *req) if (disk && blk_fs_request(req)) { unsigned long duration = jiffies - req->start_time; - switch (rq_data_dir(req)) { - case WRITE: - __disk_stat_inc(disk, writes); - __disk_stat_add(disk, write_ticks, duration); - break; - case READ: - __disk_stat_inc(disk, reads); - __disk_stat_add(disk, read_ticks, duration); - break; - } + const int rw = rq_data_dir(req); + + __disk_stat_inc(disk, ios[rw]); + __disk_stat_add(disk, ticks[rw], duration); disk_round_stats(disk); disk->in_flight--; } diff --git a/drivers/block/noop-iosched.c b/drivers/block/noop-iosched.c index f56b8edb06e..e54f006e7e6 100644 --- a/drivers/block/noop-iosched.c +++ b/drivers/block/noop-iosched.c @@ -9,6 +9,7 @@ static void elevator_noop_add_request(request_queue_t *q, struct request *rq) { + rq->flags |= REQ_NOMERGE; elv_dispatch_add_tail(q, rq); } diff --git a/drivers/block/paride/paride.c b/drivers/block/paride/paride.c index 1fef136c0e4..ce94aa11f6a 100644 --- a/drivers/block/paride/paride.c +++ b/drivers/block/paride/paride.c @@ -29,6 +29,7 @@ #include <linux/string.h> #include <linux/spinlock.h> #include <linux/wait.h> +#include <linux/sched.h> /* TASK_* */ #ifdef CONFIG_PARPORT_MODULE #define CONFIG_PARPORT diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c index 94af920465b..e9746af29b9 100644 --- a/drivers/block/paride/pf.c +++ b/drivers/block/paride/pf.c @@ -807,10 +807,6 @@ static int pf_next_buf(void) return 1; spin_lock_irqsave(&pf_spin_lock, saved_flags); pf_end_request(1); - if (pf_req) { - pf_count = pf_req->current_nr_sectors; - pf_buf = pf_req->buffer; - } spin_unlock_irqrestore(&pf_spin_lock, saved_flags); return 1; } diff --git a/drivers/block/paride/pg.c b/drivers/block/paride/pg.c index 82f2d6d2eee..6f5df0fad70 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}; #include <linux/mtio.h> #include <linux/pg.h> #include <linux/device.h> +#include <linux/sched.h> /* current, TASK_* */ +#include <linux/jiffies.h> #include <asm/uaccess.h> diff --git a/drivers/block/paride/pt.c b/drivers/block/paride/pt.c index 686c9557345..715ae5dc88f 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}; #include <linux/slab.h> #include <linux/mtio.h> #include <linux/device.h> +#include <linux/sched.h> /* current, TASK_*, schedule_timeout() */ #include <asm/uaccess.h> diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c index e46ecd23b3a..2d518aa2720 100644 --- a/drivers/block/viodasd.c +++ b/drivers/block/viodasd.c @@ -45,10 +45,10 @@ #include <asm/uaccess.h> #include <asm/vio.h> -#include <asm/iSeries/HvTypes.h> -#include <asm/iSeries/HvLpEvent.h> -#include <asm/iSeries/HvLpConfig.h> -#include <asm/iSeries/vio.h> +#include <asm/iseries/hv_types.h> +#include <asm/iseries/hv_lp_event.h> +#include <asm/iseries/hv_lp_config.h> +#include <asm/iseries/vio.h> MODULE_DESCRIPTION("iSeries Virtual DASD"); MODULE_AUTHOR("Dave Boutcher"); @@ -778,13 +778,16 @@ static struct vio_device_id viodasd_device_table[] __devinitdata = { { "viodasd", "" }, { "", "" } }; - MODULE_DEVICE_TABLE(vio, viodasd_device_table); + static struct vio_driver viodasd_driver = { - .name = "viodasd", .id_table = viodasd_device_table, .probe = viodasd_probe, - .remove = viodasd_remove + .remove = viodasd_remove, + .driver = { + .name = "viodasd", + .owner = THIS_MODULE, + } }; /* |