diff options
-rw-r--r-- | block/ll_rw_blk.c | 56 | ||||
-rw-r--r-- | drivers/block/ps3disk.c | 21 | ||||
-rw-r--r-- | drivers/ide/ide-disk.c | 29 | ||||
-rw-r--r-- | drivers/md/dm-table.c | 28 | ||||
-rw-r--r-- | drivers/md/dm.c | 16 | ||||
-rw-r--r-- | drivers/md/dm.h | 1 | ||||
-rw-r--r-- | drivers/md/linear.c | 20 | ||||
-rw-r--r-- | drivers/md/md.c | 1 | ||||
-rw-r--r-- | drivers/md/multipath.c | 30 | ||||
-rw-r--r-- | drivers/md/raid0.c | 21 | ||||
-rw-r--r-- | drivers/md/raid1.c | 31 | ||||
-rw-r--r-- | drivers/md/raid10.c | 31 | ||||
-rw-r--r-- | drivers/md/raid5.c | 31 | ||||
-rw-r--r-- | drivers/message/i2o/i2o_block.c | 24 | ||||
-rw-r--r-- | drivers/scsi/sd.c | 22 | ||||
-rw-r--r-- | include/linux/blkdev.h | 3 |
16 files changed, 36 insertions, 329 deletions
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c index 4fde3a3c92d3..4df7d027eb06 100644 --- a/block/ll_rw_blk.c +++ b/block/ll_rw_blk.c | |||
@@ -304,23 +304,6 @@ int blk_queue_ordered(struct request_queue *q, unsigned ordered, | |||
304 | 304 | ||
305 | EXPORT_SYMBOL(blk_queue_ordered); | 305 | EXPORT_SYMBOL(blk_queue_ordered); |
306 | 306 | ||
307 | /** | ||
308 | * blk_queue_issue_flush_fn - set function for issuing a flush | ||
309 | * @q: the request queue | ||
310 | * @iff: the function to be called issuing the flush | ||
311 | * | ||
312 | * Description: | ||
313 | * If a driver supports issuing a flush command, the support is notified | ||
314 | * to the block layer by defining it through this call. | ||
315 | * | ||
316 | **/ | ||
317 | void blk_queue_issue_flush_fn(struct request_queue *q, issue_flush_fn *iff) | ||
318 | { | ||
319 | q->issue_flush_fn = iff; | ||
320 | } | ||
321 | |||
322 | EXPORT_SYMBOL(blk_queue_issue_flush_fn); | ||
323 | |||
324 | /* | 307 | /* |
325 | * Cache flushing for ordered writes handling | 308 | * Cache flushing for ordered writes handling |
326 | */ | 309 | */ |
@@ -2666,6 +2649,14 @@ int blk_execute_rq(struct request_queue *q, struct gendisk *bd_disk, | |||
2666 | 2649 | ||
2667 | EXPORT_SYMBOL(blk_execute_rq); | 2650 | EXPORT_SYMBOL(blk_execute_rq); |
2668 | 2651 | ||
2652 | static void bio_end_empty_barrier(struct bio *bio, int err) | ||
2653 | { | ||
2654 | if (err) | ||
2655 | clear_bit(BIO_UPTODATE, &bio->bi_flags); | ||
2656 | |||
2657 | complete(bio->bi_private); | ||
2658 | } | ||
2659 | |||
2669 | /** | 2660 | /** |
2670 | * blkdev_issue_flush - queue a flush | 2661 | * blkdev_issue_flush - queue a flush |
2671 | * @bdev: blockdev to issue flush for | 2662 | * @bdev: blockdev to issue flush for |
@@ -2678,7 +2669,10 @@ EXPORT_SYMBOL(blk_execute_rq); | |||
2678 | */ | 2669 | */ |
2679 | int blkdev_issue_flush(struct block_device *bdev, sector_t *error_sector) | 2670 | int blkdev_issue_flush(struct block_device *bdev, sector_t *error_sector) |
2680 | { | 2671 | { |
2672 | DECLARE_COMPLETION_ONSTACK(wait); | ||
2681 | struct request_queue *q; | 2673 | struct request_queue *q; |
2674 | struct bio *bio; | ||
2675 | int ret; | ||
2682 | 2676 | ||
2683 | if (bdev->bd_disk == NULL) | 2677 | if (bdev->bd_disk == NULL) |
2684 | return -ENXIO; | 2678 | return -ENXIO; |
@@ -2686,10 +2680,32 @@ int blkdev_issue_flush(struct block_device *bdev, sector_t *error_sector) | |||
2686 | q = bdev_get_queue(bdev); | 2680 | q = bdev_get_queue(bdev); |
2687 | if (!q) | 2681 | if (!q) |
2688 | return -ENXIO; | 2682 | return -ENXIO; |
2689 | if (!q->issue_flush_fn) | ||
2690 | return -EOPNOTSUPP; | ||
2691 | 2683 | ||
2692 | return q->issue_flush_fn(q, bdev->bd_disk, error_sector); | 2684 | bio = bio_alloc(GFP_KERNEL, 0); |
2685 | if (!bio) | ||
2686 | return -ENOMEM; | ||
2687 | |||
2688 | bio->bi_end_io = bio_end_empty_barrier; | ||
2689 | bio->bi_private = &wait; | ||
2690 | bio->bi_bdev = bdev; | ||
2691 | submit_bio(1 << BIO_RW_BARRIER, bio); | ||
2692 | |||
2693 | wait_for_completion(&wait); | ||
2694 | |||
2695 | /* | ||
2696 | * The driver must store the error location in ->bi_sector, if | ||
2697 | * it supports it. For non-stacked drivers, this should be copied | ||
2698 | * from rq->sector. | ||
2699 | */ | ||
2700 | if (error_sector) | ||
2701 | *error_sector = bio->bi_sector; | ||
2702 | |||
2703 | ret = 0; | ||
2704 | if (!bio_flagged(bio, BIO_UPTODATE)) | ||
2705 | ret = -EIO; | ||
2706 | |||
2707 | bio_put(bio); | ||
2708 | return ret; | ||
2693 | } | 2709 | } |
2694 | 2710 | ||
2695 | EXPORT_SYMBOL(blkdev_issue_flush); | 2711 | EXPORT_SYMBOL(blkdev_issue_flush); |
diff --git a/drivers/block/ps3disk.c b/drivers/block/ps3disk.c index 06d0552cf49c..e354bfc070e1 100644 --- a/drivers/block/ps3disk.c +++ b/drivers/block/ps3disk.c | |||
@@ -414,26 +414,6 @@ static void ps3disk_prepare_flush(struct request_queue *q, struct request *req) | |||
414 | req->cmd_type = REQ_TYPE_FLUSH; | 414 | req->cmd_type = REQ_TYPE_FLUSH; |
415 | } | 415 | } |
416 | 416 | ||
417 | static int ps3disk_issue_flush(struct request_queue *q, struct gendisk *gendisk, | ||
418 | sector_t *sector) | ||
419 | { | ||
420 | struct ps3_storage_device *dev = q->queuedata; | ||
421 | struct request *req; | ||
422 | int res; | ||
423 | |||
424 | dev_dbg(&dev->sbd.core, "%s:%u\n", __func__, __LINE__); | ||
425 | |||
426 | req = blk_get_request(q, WRITE, __GFP_WAIT); | ||
427 | ps3disk_prepare_flush(q, req); | ||
428 | res = blk_execute_rq(q, gendisk, req, 0); | ||
429 | if (res) | ||
430 | dev_err(&dev->sbd.core, "%s:%u: flush request failed %d\n", | ||
431 | __func__, __LINE__, res); | ||
432 | blk_put_request(req); | ||
433 | return res; | ||
434 | } | ||
435 | |||
436 | |||
437 | static unsigned long ps3disk_mask; | 417 | static unsigned long ps3disk_mask; |
438 | 418 | ||
439 | static DEFINE_MUTEX(ps3disk_mask_mutex); | 419 | static DEFINE_MUTEX(ps3disk_mask_mutex); |
@@ -506,7 +486,6 @@ static int __devinit ps3disk_probe(struct ps3_system_bus_device *_dev) | |||
506 | blk_queue_dma_alignment(queue, dev->blk_size-1); | 486 | blk_queue_dma_alignment(queue, dev->blk_size-1); |
507 | blk_queue_hardsect_size(queue, dev->blk_size); | 487 | blk_queue_hardsect_size(queue, dev->blk_size); |
508 | 488 | ||
509 | blk_queue_issue_flush_fn(queue, ps3disk_issue_flush); | ||
510 | blk_queue_ordered(queue, QUEUE_ORDERED_DRAIN_FLUSH, | 489 | blk_queue_ordered(queue, QUEUE_ORDERED_DRAIN_FLUSH, |
511 | ps3disk_prepare_flush); | 490 | ps3disk_prepare_flush); |
512 | 491 | ||
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 4754769eda97..92177ca48b4d 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c | |||
@@ -716,32 +716,6 @@ static void idedisk_prepare_flush(struct request_queue *q, struct request *rq) | |||
716 | rq->buffer = rq->cmd; | 716 | rq->buffer = rq->cmd; |
717 | } | 717 | } |
718 | 718 | ||
719 | static int idedisk_issue_flush(struct request_queue *q, struct gendisk *disk, | ||
720 | sector_t *error_sector) | ||
721 | { | ||
722 | ide_drive_t *drive = q->queuedata; | ||
723 | struct request *rq; | ||
724 | int ret; | ||
725 | |||
726 | if (!drive->wcache) | ||
727 | return 0; | ||
728 | |||
729 | rq = blk_get_request(q, WRITE, __GFP_WAIT); | ||
730 | |||
731 | idedisk_prepare_flush(q, rq); | ||
732 | |||
733 | ret = blk_execute_rq(q, disk, rq, 0); | ||
734 | |||
735 | /* | ||
736 | * if we failed and caller wants error offset, get it | ||
737 | */ | ||
738 | if (ret && error_sector) | ||
739 | *error_sector = ide_get_error_location(drive, rq->cmd); | ||
740 | |||
741 | blk_put_request(rq); | ||
742 | return ret; | ||
743 | } | ||
744 | |||
745 | /* | 719 | /* |
746 | * This is tightly woven into the driver->do_special can not touch. | 720 | * This is tightly woven into the driver->do_special can not touch. |
747 | * DON'T do it again until a total personality rewrite is committed. | 721 | * DON'T do it again until a total personality rewrite is committed. |
@@ -781,7 +755,6 @@ static void update_ordered(ide_drive_t *drive) | |||
781 | struct hd_driveid *id = drive->id; | 755 | struct hd_driveid *id = drive->id; |
782 | unsigned ordered = QUEUE_ORDERED_NONE; | 756 | unsigned ordered = QUEUE_ORDERED_NONE; |
783 | prepare_flush_fn *prep_fn = NULL; | 757 | prepare_flush_fn *prep_fn = NULL; |
784 | issue_flush_fn *issue_fn = NULL; | ||
785 | 758 | ||
786 | if (drive->wcache) { | 759 | if (drive->wcache) { |
787 | unsigned long long capacity; | 760 | unsigned long long capacity; |
@@ -805,13 +778,11 @@ static void update_ordered(ide_drive_t *drive) | |||
805 | if (barrier) { | 778 | if (barrier) { |
806 | ordered = QUEUE_ORDERED_DRAIN_FLUSH; | 779 | ordered = QUEUE_ORDERED_DRAIN_FLUSH; |
807 | prep_fn = idedisk_prepare_flush; | 780 | prep_fn = idedisk_prepare_flush; |
808 | issue_fn = idedisk_issue_flush; | ||
809 | } | 781 | } |
810 | } else | 782 | } else |
811 | ordered = QUEUE_ORDERED_DRAIN; | 783 | ordered = QUEUE_ORDERED_DRAIN; |
812 | 784 | ||
813 | blk_queue_ordered(drive->queue, ordered, prep_fn); | 785 | blk_queue_ordered(drive->queue, ordered, prep_fn); |
814 | blk_queue_issue_flush_fn(drive->queue, issue_fn); | ||
815 | } | 786 | } |
816 | 787 | ||
817 | static int write_cache(ide_drive_t *drive, int arg) | 788 | static int write_cache(ide_drive_t *drive, int arg) |
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 2bcde5798b5a..fbe477bb2c68 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c | |||
@@ -999,33 +999,6 @@ void dm_table_unplug_all(struct dm_table *t) | |||
999 | } | 999 | } |
1000 | } | 1000 | } |
1001 | 1001 | ||
1002 | int dm_table_flush_all(struct dm_table *t) | ||
1003 | { | ||
1004 | struct list_head *d, *devices = dm_table_get_devices(t); | ||
1005 | int ret = 0; | ||
1006 | unsigned i; | ||
1007 | |||
1008 | for (i = 0; i < t->num_targets; i++) | ||
1009 | if (t->targets[i].type->flush) | ||
1010 | t->targets[i].type->flush(&t->targets[i]); | ||
1011 | |||
1012 | for (d = devices->next; d != devices; d = d->next) { | ||
1013 | struct dm_dev *dd = list_entry(d, struct dm_dev, list); | ||
1014 | struct request_queue *q = bdev_get_queue(dd->bdev); | ||
1015 | int err; | ||
1016 | |||
1017 | if (!q->issue_flush_fn) | ||
1018 | err = -EOPNOTSUPP; | ||
1019 | else | ||
1020 | err = q->issue_flush_fn(q, dd->bdev->bd_disk, NULL); | ||
1021 | |||
1022 | if (!ret) | ||
1023 | ret = err; | ||
1024 | } | ||
1025 | |||
1026 | return ret; | ||
1027 | } | ||
1028 | |||
1029 | struct mapped_device *dm_table_get_md(struct dm_table *t) | 1002 | struct mapped_device *dm_table_get_md(struct dm_table *t) |
1030 | { | 1003 | { |
1031 | dm_get(t->md); | 1004 | dm_get(t->md); |
@@ -1043,4 +1016,3 @@ EXPORT_SYMBOL(dm_table_get_md); | |||
1043 | EXPORT_SYMBOL(dm_table_put); | 1016 | EXPORT_SYMBOL(dm_table_put); |
1044 | EXPORT_SYMBOL(dm_table_get); | 1017 | EXPORT_SYMBOL(dm_table_get); |
1045 | EXPORT_SYMBOL(dm_table_unplug_all); | 1018 | EXPORT_SYMBOL(dm_table_unplug_all); |
1046 | EXPORT_SYMBOL(dm_table_flush_all); | ||
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 167765c47747..d837d37f6209 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -840,21 +840,6 @@ static int dm_request(struct request_queue *q, struct bio *bio) | |||
840 | return 0; | 840 | return 0; |
841 | } | 841 | } |
842 | 842 | ||
843 | static int dm_flush_all(struct request_queue *q, struct gendisk *disk, | ||
844 | sector_t *error_sector) | ||
845 | { | ||
846 | struct mapped_device *md = q->queuedata; | ||
847 | struct dm_table *map = dm_get_table(md); | ||
848 | int ret = -ENXIO; | ||
849 | |||
850 | if (map) { | ||
851 | ret = dm_table_flush_all(map); | ||
852 | dm_table_put(map); | ||
853 | } | ||
854 | |||
855 | return ret; | ||
856 | } | ||
857 | |||
858 | static void dm_unplug_all(struct request_queue *q) | 843 | static void dm_unplug_all(struct request_queue *q) |
859 | { | 844 | { |
860 | struct mapped_device *md = q->queuedata; | 845 | struct mapped_device *md = q->queuedata; |
@@ -1003,7 +988,6 @@ static struct mapped_device *alloc_dev(int minor) | |||
1003 | blk_queue_make_request(md->queue, dm_request); | 988 | blk_queue_make_request(md->queue, dm_request); |
1004 | blk_queue_bounce_limit(md->queue, BLK_BOUNCE_ANY); | 989 | blk_queue_bounce_limit(md->queue, BLK_BOUNCE_ANY); |
1005 | md->queue->unplug_fn = dm_unplug_all; | 990 | md->queue->unplug_fn = dm_unplug_all; |
1006 | md->queue->issue_flush_fn = dm_flush_all; | ||
1007 | 991 | ||
1008 | md->io_pool = mempool_create_slab_pool(MIN_IOS, _io_cache); | 992 | md->io_pool = mempool_create_slab_pool(MIN_IOS, _io_cache); |
1009 | if (!md->io_pool) | 993 | if (!md->io_pool) |
diff --git a/drivers/md/dm.h b/drivers/md/dm.h index 462ee652a890..4b3faa45277e 100644 --- a/drivers/md/dm.h +++ b/drivers/md/dm.h | |||
@@ -111,7 +111,6 @@ void dm_table_postsuspend_targets(struct dm_table *t); | |||
111 | int dm_table_resume_targets(struct dm_table *t); | 111 | int dm_table_resume_targets(struct dm_table *t); |
112 | int dm_table_any_congested(struct dm_table *t, int bdi_bits); | 112 | int dm_table_any_congested(struct dm_table *t, int bdi_bits); |
113 | void dm_table_unplug_all(struct dm_table *t); | 113 | void dm_table_unplug_all(struct dm_table *t); |
114 | int dm_table_flush_all(struct dm_table *t); | ||
115 | 114 | ||
116 | /*----------------------------------------------------------------- | 115 | /*----------------------------------------------------------------- |
117 | * A registry of target types. | 116 | * A registry of target types. |
diff --git a/drivers/md/linear.c b/drivers/md/linear.c index 550148770bb2..56a11f6c127b 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c | |||
@@ -92,25 +92,6 @@ static void linear_unplug(struct request_queue *q) | |||
92 | } | 92 | } |
93 | } | 93 | } |
94 | 94 | ||
95 | static int linear_issue_flush(struct request_queue *q, struct gendisk *disk, | ||
96 | sector_t *error_sector) | ||
97 | { | ||
98 | mddev_t *mddev = q->queuedata; | ||
99 | linear_conf_t *conf = mddev_to_conf(mddev); | ||
100 | int i, ret = 0; | ||
101 | |||
102 | for (i=0; i < mddev->raid_disks && ret == 0; i++) { | ||
103 | struct block_device *bdev = conf->disks[i].rdev->bdev; | ||
104 | struct request_queue *r_queue = bdev_get_queue(bdev); | ||
105 | |||
106 | if (!r_queue->issue_flush_fn) | ||
107 | ret = -EOPNOTSUPP; | ||
108 | else | ||
109 | ret = r_queue->issue_flush_fn(r_queue, bdev->bd_disk, error_sector); | ||
110 | } | ||
111 | return ret; | ||
112 | } | ||
113 | |||
114 | static int linear_congested(void *data, int bits) | 95 | static int linear_congested(void *data, int bits) |
115 | { | 96 | { |
116 | mddev_t *mddev = data; | 97 | mddev_t *mddev = data; |
@@ -279,7 +260,6 @@ static int linear_run (mddev_t *mddev) | |||
279 | 260 | ||
280 | blk_queue_merge_bvec(mddev->queue, linear_mergeable_bvec); | 261 | blk_queue_merge_bvec(mddev->queue, linear_mergeable_bvec); |
281 | mddev->queue->unplug_fn = linear_unplug; | 262 | mddev->queue->unplug_fn = linear_unplug; |
282 | mddev->queue->issue_flush_fn = linear_issue_flush; | ||
283 | mddev->queue->backing_dev_info.congested_fn = linear_congested; | 263 | mddev->queue->backing_dev_info.congested_fn = linear_congested; |
284 | mddev->queue->backing_dev_info.congested_data = mddev; | 264 | mddev->queue->backing_dev_info.congested_data = mddev; |
285 | return 0; | 265 | return 0; |
diff --git a/drivers/md/md.c b/drivers/md/md.c index acf1b81b47cb..0dc563d76b39 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -3463,7 +3463,6 @@ static int do_md_stop(mddev_t * mddev, int mode) | |||
3463 | mddev->pers->stop(mddev); | 3463 | mddev->pers->stop(mddev); |
3464 | mddev->queue->merge_bvec_fn = NULL; | 3464 | mddev->queue->merge_bvec_fn = NULL; |
3465 | mddev->queue->unplug_fn = NULL; | 3465 | mddev->queue->unplug_fn = NULL; |
3466 | mddev->queue->issue_flush_fn = NULL; | ||
3467 | mddev->queue->backing_dev_info.congested_fn = NULL; | 3466 | mddev->queue->backing_dev_info.congested_fn = NULL; |
3468 | if (mddev->pers->sync_request) | 3467 | if (mddev->pers->sync_request) |
3469 | sysfs_remove_group(&mddev->kobj, &md_redundancy_group); | 3468 | sysfs_remove_group(&mddev->kobj, &md_redundancy_group); |
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c index f2a63f394ad9..b35731cceac6 100644 --- a/drivers/md/multipath.c +++ b/drivers/md/multipath.c | |||
@@ -194,35 +194,6 @@ static void multipath_status (struct seq_file *seq, mddev_t *mddev) | |||
194 | seq_printf (seq, "]"); | 194 | seq_printf (seq, "]"); |
195 | } | 195 | } |
196 | 196 | ||
197 | static int multipath_issue_flush(struct request_queue *q, struct gendisk *disk, | ||
198 | sector_t *error_sector) | ||
199 | { | ||
200 | mddev_t *mddev = q->queuedata; | ||
201 | multipath_conf_t *conf = mddev_to_conf(mddev); | ||
202 | int i, ret = 0; | ||
203 | |||
204 | rcu_read_lock(); | ||
205 | for (i=0; i<mddev->raid_disks && ret == 0; i++) { | ||
206 | mdk_rdev_t *rdev = rcu_dereference(conf->multipaths[i].rdev); | ||
207 | if (rdev && !test_bit(Faulty, &rdev->flags)) { | ||
208 | struct block_device *bdev = rdev->bdev; | ||
209 | struct request_queue *r_queue = bdev_get_queue(bdev); | ||
210 | |||
211 | if (!r_queue->issue_flush_fn) | ||
212 | ret = -EOPNOTSUPP; | ||
213 | else { | ||
214 | atomic_inc(&rdev->nr_pending); | ||
215 | rcu_read_unlock(); | ||
216 | ret = r_queue->issue_flush_fn(r_queue, bdev->bd_disk, | ||
217 | error_sector); | ||
218 | rdev_dec_pending(rdev, mddev); | ||
219 | rcu_read_lock(); | ||
220 | } | ||
221 | } | ||
222 | } | ||
223 | rcu_read_unlock(); | ||
224 | return ret; | ||
225 | } | ||
226 | static int multipath_congested(void *data, int bits) | 197 | static int multipath_congested(void *data, int bits) |
227 | { | 198 | { |
228 | mddev_t *mddev = data; | 199 | mddev_t *mddev = data; |
@@ -527,7 +498,6 @@ static int multipath_run (mddev_t *mddev) | |||
527 | mddev->array_size = mddev->size; | 498 | mddev->array_size = mddev->size; |
528 | 499 | ||
529 | mddev->queue->unplug_fn = multipath_unplug; | 500 | mddev->queue->unplug_fn = multipath_unplug; |
530 | mddev->queue->issue_flush_fn = multipath_issue_flush; | ||
531 | mddev->queue->backing_dev_info.congested_fn = multipath_congested; | 501 | mddev->queue->backing_dev_info.congested_fn = multipath_congested; |
532 | mddev->queue->backing_dev_info.congested_data = mddev; | 502 | mddev->queue->backing_dev_info.congested_data = mddev; |
533 | 503 | ||
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index ef0da2d84959..e79e1a538d44 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c | |||
@@ -40,26 +40,6 @@ static void raid0_unplug(struct request_queue *q) | |||
40 | } | 40 | } |
41 | } | 41 | } |
42 | 42 | ||
43 | static int raid0_issue_flush(struct request_queue *q, struct gendisk *disk, | ||
44 | sector_t *error_sector) | ||
45 | { | ||
46 | mddev_t *mddev = q->queuedata; | ||
47 | raid0_conf_t *conf = mddev_to_conf(mddev); | ||
48 | mdk_rdev_t **devlist = conf->strip_zone[0].dev; | ||
49 | int i, ret = 0; | ||
50 | |||
51 | for (i=0; i<mddev->raid_disks && ret == 0; i++) { | ||
52 | struct block_device *bdev = devlist[i]->bdev; | ||
53 | struct request_queue *r_queue = bdev_get_queue(bdev); | ||
54 | |||
55 | if (!r_queue->issue_flush_fn) | ||
56 | ret = -EOPNOTSUPP; | ||
57 | else | ||
58 | ret = r_queue->issue_flush_fn(r_queue, bdev->bd_disk, error_sector); | ||
59 | } | ||
60 | return ret; | ||
61 | } | ||
62 | |||
63 | static int raid0_congested(void *data, int bits) | 43 | static int raid0_congested(void *data, int bits) |
64 | { | 44 | { |
65 | mddev_t *mddev = data; | 45 | mddev_t *mddev = data; |
@@ -250,7 +230,6 @@ static int create_strip_zones (mddev_t *mddev) | |||
250 | 230 | ||
251 | mddev->queue->unplug_fn = raid0_unplug; | 231 | mddev->queue->unplug_fn = raid0_unplug; |
252 | 232 | ||
253 | mddev->queue->issue_flush_fn = raid0_issue_flush; | ||
254 | mddev->queue->backing_dev_info.congested_fn = raid0_congested; | 233 | mddev->queue->backing_dev_info.congested_fn = raid0_congested; |
255 | mddev->queue->backing_dev_info.congested_data = mddev; | 234 | mddev->queue->backing_dev_info.congested_data = mddev; |
256 | 235 | ||
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 6d03bea6fa58..0bcefad82413 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -567,36 +567,6 @@ static void raid1_unplug(struct request_queue *q) | |||
567 | md_wakeup_thread(mddev->thread); | 567 | md_wakeup_thread(mddev->thread); |
568 | } | 568 | } |
569 | 569 | ||
570 | static int raid1_issue_flush(struct request_queue *q, struct gendisk *disk, | ||
571 | sector_t *error_sector) | ||
572 | { | ||
573 | mddev_t *mddev = q->queuedata; | ||
574 | conf_t *conf = mddev_to_conf(mddev); | ||
575 | int i, ret = 0; | ||
576 | |||
577 | rcu_read_lock(); | ||
578 | for (i=0; i<mddev->raid_disks && ret == 0; i++) { | ||
579 | mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[i].rdev); | ||
580 | if (rdev && !test_bit(Faulty, &rdev->flags)) { | ||
581 | struct block_device *bdev = rdev->bdev; | ||
582 | struct request_queue *r_queue = bdev_get_queue(bdev); | ||
583 | |||
584 | if (!r_queue->issue_flush_fn) | ||
585 | ret = -EOPNOTSUPP; | ||
586 | else { | ||
587 | atomic_inc(&rdev->nr_pending); | ||
588 | rcu_read_unlock(); | ||
589 | ret = r_queue->issue_flush_fn(r_queue, bdev->bd_disk, | ||
590 | error_sector); | ||
591 | rdev_dec_pending(rdev, mddev); | ||
592 | rcu_read_lock(); | ||
593 | } | ||
594 | } | ||
595 | } | ||
596 | rcu_read_unlock(); | ||
597 | return ret; | ||
598 | } | ||
599 | |||
600 | static int raid1_congested(void *data, int bits) | 570 | static int raid1_congested(void *data, int bits) |
601 | { | 571 | { |
602 | mddev_t *mddev = data; | 572 | mddev_t *mddev = data; |
@@ -1997,7 +1967,6 @@ static int run(mddev_t *mddev) | |||
1997 | mddev->array_size = mddev->size; | 1967 | mddev->array_size = mddev->size; |
1998 | 1968 | ||
1999 | mddev->queue->unplug_fn = raid1_unplug; | 1969 | mddev->queue->unplug_fn = raid1_unplug; |
2000 | mddev->queue->issue_flush_fn = raid1_issue_flush; | ||
2001 | mddev->queue->backing_dev_info.congested_fn = raid1_congested; | 1970 | mddev->queue->backing_dev_info.congested_fn = raid1_congested; |
2002 | mddev->queue->backing_dev_info.congested_data = mddev; | 1971 | mddev->queue->backing_dev_info.congested_data = mddev; |
2003 | 1972 | ||
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 25a96c42bdb0..fc6607acb6e4 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -611,36 +611,6 @@ static void raid10_unplug(struct request_queue *q) | |||
611 | md_wakeup_thread(mddev->thread); | 611 | md_wakeup_thread(mddev->thread); |
612 | } | 612 | } |
613 | 613 | ||
614 | static int raid10_issue_flush(struct request_queue *q, struct gendisk *disk, | ||
615 | sector_t *error_sector) | ||
616 | { | ||
617 | mddev_t *mddev = q->queuedata; | ||
618 | conf_t *conf = mddev_to_conf(mddev); | ||
619 | int i, ret = 0; | ||
620 | |||
621 | rcu_read_lock(); | ||
622 | for (i=0; i<mddev->raid_disks && ret == 0; i++) { | ||
623 | mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[i].rdev); | ||
624 | if (rdev && !test_bit(Faulty, &rdev->flags)) { | ||
625 | struct block_device *bdev = rdev->bdev; | ||
626 | struct request_queue *r_queue = bdev_get_queue(bdev); | ||
627 | |||
628 | if (!r_queue->issue_flush_fn) | ||
629 | ret = -EOPNOTSUPP; | ||
630 | else { | ||
631 | atomic_inc(&rdev->nr_pending); | ||
632 | rcu_read_unlock(); | ||
633 | ret = r_queue->issue_flush_fn(r_queue, bdev->bd_disk, | ||
634 | error_sector); | ||
635 | rdev_dec_pending(rdev, mddev); | ||
636 | rcu_read_lock(); | ||
637 | } | ||
638 | } | ||
639 | } | ||
640 | rcu_read_unlock(); | ||
641 | return ret; | ||
642 | } | ||
643 | |||
644 | static int raid10_congested(void *data, int bits) | 614 | static int raid10_congested(void *data, int bits) |
645 | { | 615 | { |
646 | mddev_t *mddev = data; | 616 | mddev_t *mddev = data; |
@@ -2118,7 +2088,6 @@ static int run(mddev_t *mddev) | |||
2118 | mddev->resync_max_sectors = size << conf->chunk_shift; | 2088 | mddev->resync_max_sectors = size << conf->chunk_shift; |
2119 | 2089 | ||
2120 | mddev->queue->unplug_fn = raid10_unplug; | 2090 | mddev->queue->unplug_fn = raid10_unplug; |
2121 | mddev->queue->issue_flush_fn = raid10_issue_flush; | ||
2122 | mddev->queue->backing_dev_info.congested_fn = raid10_congested; | 2091 | mddev->queue->backing_dev_info.congested_fn = raid10_congested; |
2123 | mddev->queue->backing_dev_info.congested_data = mddev; | 2092 | mddev->queue->backing_dev_info.congested_data = mddev; |
2124 | 2093 | ||
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index caaca9e178bc..8ee181a01f52 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -3204,36 +3204,6 @@ static void raid5_unplug_device(struct request_queue *q) | |||
3204 | unplug_slaves(mddev); | 3204 | unplug_slaves(mddev); |
3205 | } | 3205 | } |
3206 | 3206 | ||
3207 | static int raid5_issue_flush(struct request_queue *q, struct gendisk *disk, | ||
3208 | sector_t *error_sector) | ||
3209 | { | ||
3210 | mddev_t *mddev = q->queuedata; | ||
3211 | raid5_conf_t *conf = mddev_to_conf(mddev); | ||
3212 | int i, ret = 0; | ||
3213 | |||
3214 | rcu_read_lock(); | ||
3215 | for (i=0; i<mddev->raid_disks && ret == 0; i++) { | ||
3216 | mdk_rdev_t *rdev = rcu_dereference(conf->disks[i].rdev); | ||
3217 | if (rdev && !test_bit(Faulty, &rdev->flags)) { | ||
3218 | struct block_device *bdev = rdev->bdev; | ||
3219 | struct request_queue *r_queue = bdev_get_queue(bdev); | ||
3220 | |||
3221 | if (!r_queue->issue_flush_fn) | ||
3222 | ret = -EOPNOTSUPP; | ||
3223 | else { | ||
3224 | atomic_inc(&rdev->nr_pending); | ||
3225 | rcu_read_unlock(); | ||
3226 | ret = r_queue->issue_flush_fn(r_queue, bdev->bd_disk, | ||
3227 | error_sector); | ||
3228 | rdev_dec_pending(rdev, mddev); | ||
3229 | rcu_read_lock(); | ||
3230 | } | ||
3231 | } | ||
3232 | } | ||
3233 | rcu_read_unlock(); | ||
3234 | return ret; | ||
3235 | } | ||
3236 | |||
3237 | static int raid5_congested(void *data, int bits) | 3207 | static int raid5_congested(void *data, int bits) |
3238 | { | 3208 | { |
3239 | mddev_t *mddev = data; | 3209 | mddev_t *mddev = data; |
@@ -4263,7 +4233,6 @@ static int run(mddev_t *mddev) | |||
4263 | mdname(mddev)); | 4233 | mdname(mddev)); |
4264 | 4234 | ||
4265 | mddev->queue->unplug_fn = raid5_unplug_device; | 4235 | mddev->queue->unplug_fn = raid5_unplug_device; |
4266 | mddev->queue->issue_flush_fn = raid5_issue_flush; | ||
4267 | mddev->queue->backing_dev_info.congested_data = mddev; | 4236 | mddev->queue->backing_dev_info.congested_data = mddev; |
4268 | mddev->queue->backing_dev_info.congested_fn = raid5_congested; | 4237 | mddev->queue->backing_dev_info.congested_fn = raid5_congested; |
4269 | 4238 | ||
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c index 50b2c7334410..d602ba6d5417 100644 --- a/drivers/message/i2o/i2o_block.c +++ b/drivers/message/i2o/i2o_block.c | |||
@@ -149,29 +149,6 @@ static int i2o_block_device_flush(struct i2o_device *dev) | |||
149 | }; | 149 | }; |
150 | 150 | ||
151 | /** | 151 | /** |
152 | * i2o_block_issue_flush - device-flush interface for block-layer | ||
153 | * @queue: the request queue of the device which should be flushed | ||
154 | * @disk: gendisk | ||
155 | * @error_sector: error offset | ||
156 | * | ||
157 | * Helper function to provide flush functionality to block-layer. | ||
158 | * | ||
159 | * Returns 0 on success or negative error code on failure. | ||
160 | */ | ||
161 | |||
162 | static int i2o_block_issue_flush(struct request_queue * queue, struct gendisk *disk, | ||
163 | sector_t * error_sector) | ||
164 | { | ||
165 | struct i2o_block_device *i2o_blk_dev = queue->queuedata; | ||
166 | int rc = -ENODEV; | ||
167 | |||
168 | if (likely(i2o_blk_dev)) | ||
169 | rc = i2o_block_device_flush(i2o_blk_dev->i2o_dev); | ||
170 | |||
171 | return rc; | ||
172 | } | ||
173 | |||
174 | /** | ||
175 | * i2o_block_device_mount - Mount (load) the media of device dev | 152 | * i2o_block_device_mount - Mount (load) the media of device dev |
176 | * @dev: I2O device which should receive the mount request | 153 | * @dev: I2O device which should receive the mount request |
177 | * @media_id: Media Identifier | 154 | * @media_id: Media Identifier |
@@ -1009,7 +986,6 @@ static struct i2o_block_device *i2o_block_device_alloc(void) | |||
1009 | } | 986 | } |
1010 | 987 | ||
1011 | blk_queue_prep_rq(queue, i2o_block_prep_req_fn); | 988 | blk_queue_prep_rq(queue, i2o_block_prep_req_fn); |
1012 | blk_queue_issue_flush_fn(queue, i2o_block_issue_flush); | ||
1013 | 989 | ||
1014 | gd->major = I2O_MAJOR; | 990 | gd->major = I2O_MAJOR; |
1015 | gd->queue = queue; | 991 | gd->queue = queue; |
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 0a3a528212c2..69f542c4923c 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -826,27 +826,6 @@ static int sd_sync_cache(struct scsi_disk *sdkp) | |||
826 | return 0; | 826 | return 0; |
827 | } | 827 | } |
828 | 828 | ||
829 | static int sd_issue_flush(struct request_queue *q, struct gendisk *disk, | ||
830 | sector_t *error_sector) | ||
831 | { | ||
832 | int ret = 0; | ||
833 | struct scsi_device *sdp = q->queuedata; | ||
834 | struct scsi_disk *sdkp; | ||
835 | |||
836 | if (sdp->sdev_state != SDEV_RUNNING) | ||
837 | return -ENXIO; | ||
838 | |||
839 | sdkp = scsi_disk_get_from_dev(&sdp->sdev_gendev); | ||
840 | |||
841 | if (!sdkp) | ||
842 | return -ENODEV; | ||
843 | |||
844 | if (sdkp->WCE) | ||
845 | ret = sd_sync_cache(sdkp); | ||
846 | scsi_disk_put(sdkp); | ||
847 | return ret; | ||
848 | } | ||
849 | |||
850 | static void sd_prepare_flush(struct request_queue *q, struct request *rq) | 829 | static void sd_prepare_flush(struct request_queue *q, struct request *rq) |
851 | { | 830 | { |
852 | memset(rq->cmd, 0, sizeof(rq->cmd)); | 831 | memset(rq->cmd, 0, sizeof(rq->cmd)); |
@@ -1697,7 +1676,6 @@ static int sd_probe(struct device *dev) | |||
1697 | sd_revalidate_disk(gd); | 1676 | sd_revalidate_disk(gd); |
1698 | 1677 | ||
1699 | blk_queue_prep_rq(sdp->request_queue, sd_prep_fn); | 1678 | blk_queue_prep_rq(sdp->request_queue, sd_prep_fn); |
1700 | blk_queue_issue_flush_fn(sdp->request_queue, sd_issue_flush); | ||
1701 | 1679 | ||
1702 | gd->driverfs_dev = &sdp->sdev_gendev; | 1680 | gd->driverfs_dev = &sdp->sdev_gendev; |
1703 | gd->flags = GENHD_FL_DRIVERFS; | 1681 | gd->flags = GENHD_FL_DRIVERFS; |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index fb2ff749dc1f..bbf906a0b419 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -330,7 +330,6 @@ typedef void (unplug_fn) (struct request_queue *); | |||
330 | 330 | ||
331 | struct bio_vec; | 331 | struct bio_vec; |
332 | typedef int (merge_bvec_fn) (struct request_queue *, struct bio *, struct bio_vec *); | 332 | typedef int (merge_bvec_fn) (struct request_queue *, struct bio *, struct bio_vec *); |
333 | typedef int (issue_flush_fn) (struct request_queue *, struct gendisk *, sector_t *); | ||
334 | typedef void (prepare_flush_fn) (struct request_queue *, struct request *); | 333 | typedef void (prepare_flush_fn) (struct request_queue *, struct request *); |
335 | typedef void (softirq_done_fn)(struct request *); | 334 | typedef void (softirq_done_fn)(struct request *); |
336 | 335 | ||
@@ -368,7 +367,6 @@ struct request_queue | |||
368 | prep_rq_fn *prep_rq_fn; | 367 | prep_rq_fn *prep_rq_fn; |
369 | unplug_fn *unplug_fn; | 368 | unplug_fn *unplug_fn; |
370 | merge_bvec_fn *merge_bvec_fn; | 369 | merge_bvec_fn *merge_bvec_fn; |
371 | issue_flush_fn *issue_flush_fn; | ||
372 | prepare_flush_fn *prepare_flush_fn; | 370 | prepare_flush_fn *prepare_flush_fn; |
373 | softirq_done_fn *softirq_done_fn; | 371 | softirq_done_fn *softirq_done_fn; |
374 | 372 | ||
@@ -770,7 +768,6 @@ extern void blk_queue_dma_alignment(struct request_queue *, int); | |||
770 | extern void blk_queue_softirq_done(struct request_queue *, softirq_done_fn *); | 768 | extern void blk_queue_softirq_done(struct request_queue *, softirq_done_fn *); |
771 | extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); | 769 | extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); |
772 | extern int blk_queue_ordered(struct request_queue *, unsigned, prepare_flush_fn *); | 770 | extern int blk_queue_ordered(struct request_queue *, unsigned, prepare_flush_fn *); |
773 | extern void blk_queue_issue_flush_fn(struct request_queue *, issue_flush_fn *); | ||
774 | extern int blk_do_ordered(struct request_queue *, struct request **); | 771 | extern int blk_do_ordered(struct request_queue *, struct request **); |
775 | extern unsigned blk_ordered_cur_seq(struct request_queue *); | 772 | extern unsigned blk_ordered_cur_seq(struct request_queue *); |
776 | extern unsigned blk_ordered_req_seq(struct request *); | 773 | extern unsigned blk_ordered_req_seq(struct request *); |