diff options
author | NeilBrown <neilb@suse.de> | 2010-04-01 00:02:13 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2010-05-18 01:27:55 -0400 |
commit | 21a52c6d05c15f862797736393915bfa8cd40ee9 (patch) | |
tree | 44ffb633d209457979177a52132761a368fcb976 /drivers/md | |
parent | cca9cf90c504d98644ace52c474770970729f0eb (diff) |
md: pass mddev to make_request functions rather than request_queue
We used to pass the personality make_request function direct
to the block layer so the first argument had to be a queue.
But now we have the intermediary md_make_request so it makes
at lot more sense to pass a struct mddev_s.
It makes it possible to have an mddev without its own queue too.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/faulty.c | 3 | ||||
-rw-r--r-- | drivers/md/linear.c | 7 | ||||
-rw-r--r-- | drivers/md/md.c | 4 | ||||
-rw-r--r-- | drivers/md/md.h | 2 | ||||
-rw-r--r-- | drivers/md/multipath.c | 3 | ||||
-rw-r--r-- | drivers/md/raid0.c | 7 | ||||
-rw-r--r-- | drivers/md/raid1.c | 3 | ||||
-rw-r--r-- | drivers/md/raid10.c | 7 | ||||
-rw-r--r-- | drivers/md/raid5.c | 8 |
9 files changed, 18 insertions, 26 deletions
diff --git a/drivers/md/faulty.c b/drivers/md/faulty.c index 608a8d3736e2..bd4348f6be0b 100644 --- a/drivers/md/faulty.c +++ b/drivers/md/faulty.c | |||
@@ -168,9 +168,8 @@ static void add_sector(conf_t *conf, sector_t start, int mode) | |||
168 | conf->nfaults = n+1; | 168 | conf->nfaults = n+1; |
169 | } | 169 | } |
170 | 170 | ||
171 | static int make_request(struct request_queue *q, struct bio *bio) | 171 | static int make_request(mddev_t *mddev, struct bio *bio) |
172 | { | 172 | { |
173 | mddev_t *mddev = q->queuedata; | ||
174 | conf_t *conf = mddev->private; | 173 | conf_t *conf = mddev->private; |
175 | int failit = 0; | 174 | int failit = 0; |
176 | 175 | ||
diff --git a/drivers/md/linear.c b/drivers/md/linear.c index 3048c1704f40..3204a2263f21 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c | |||
@@ -286,9 +286,8 @@ static int linear_stop (mddev_t *mddev) | |||
286 | return 0; | 286 | return 0; |
287 | } | 287 | } |
288 | 288 | ||
289 | static int linear_make_request (struct request_queue *q, struct bio *bio) | 289 | static int linear_make_request (mddev_t *mddev, struct bio *bio) |
290 | { | 290 | { |
291 | mddev_t *mddev = q->queuedata; | ||
292 | dev_info_t *tmp_dev; | 291 | dev_info_t *tmp_dev; |
293 | sector_t start_sector; | 292 | sector_t start_sector; |
294 | 293 | ||
@@ -328,9 +327,9 @@ static int linear_make_request (struct request_queue *q, struct bio *bio) | |||
328 | 327 | ||
329 | bp = bio_split(bio, end_sector - bio->bi_sector); | 328 | bp = bio_split(bio, end_sector - bio->bi_sector); |
330 | 329 | ||
331 | if (linear_make_request(q, &bp->bio1)) | 330 | if (linear_make_request(mddev, &bp->bio1)) |
332 | generic_make_request(&bp->bio1); | 331 | generic_make_request(&bp->bio1); |
333 | if (linear_make_request(q, &bp->bio2)) | 332 | if (linear_make_request(mddev, &bp->bio2)) |
334 | generic_make_request(&bp->bio2); | 333 | generic_make_request(&bp->bio2); |
335 | bio_pair_release(bp); | 334 | bio_pair_release(bp); |
336 | return 0; | 335 | return 0; |
diff --git a/drivers/md/md.c b/drivers/md/md.c index f48ba419cd7b..2e05b0c2515d 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -240,7 +240,7 @@ static int md_make_request(struct request_queue *q, struct bio *bio) | |||
240 | atomic_inc(&mddev->active_io); | 240 | atomic_inc(&mddev->active_io); |
241 | rcu_read_unlock(); | 241 | rcu_read_unlock(); |
242 | 242 | ||
243 | rv = mddev->pers->make_request(q, bio); | 243 | rv = mddev->pers->make_request(mddev, bio); |
244 | 244 | ||
245 | cpu = part_stat_lock(); | 245 | cpu = part_stat_lock(); |
246 | part_stat_inc(cpu, &mddev->gendisk->part0, ios[rw]); | 246 | part_stat_inc(cpu, &mddev->gendisk->part0, ios[rw]); |
@@ -354,7 +354,7 @@ static void md_submit_barrier(struct work_struct *ws) | |||
354 | bio_endio(bio, 0); | 354 | bio_endio(bio, 0); |
355 | else { | 355 | else { |
356 | bio->bi_rw &= ~(1<<BIO_RW_BARRIER); | 356 | bio->bi_rw &= ~(1<<BIO_RW_BARRIER); |
357 | if (mddev->pers->make_request(mddev->queue, bio)) | 357 | if (mddev->pers->make_request(mddev, bio)) |
358 | generic_make_request(bio); | 358 | generic_make_request(bio); |
359 | mddev->barrier = POST_REQUEST_BARRIER; | 359 | mddev->barrier = POST_REQUEST_BARRIER; |
360 | submit_barriers(mddev); | 360 | submit_barriers(mddev); |
diff --git a/drivers/md/md.h b/drivers/md/md.h index 3225e25f3c2a..a536f5458097 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h | |||
@@ -330,7 +330,7 @@ struct mdk_personality | |||
330 | int level; | 330 | int level; |
331 | struct list_head list; | 331 | struct list_head list; |
332 | struct module *owner; | 332 | struct module *owner; |
333 | int (*make_request)(struct request_queue *q, struct bio *bio); | 333 | int (*make_request)(mddev_t *mddev, struct bio *bio); |
334 | int (*run)(mddev_t *mddev); | 334 | int (*run)(mddev_t *mddev); |
335 | int (*stop)(mddev_t *mddev); | 335 | int (*stop)(mddev_t *mddev); |
336 | void (*status)(struct seq_file *seq, mddev_t *mddev); | 336 | void (*status)(struct seq_file *seq, mddev_t *mddev); |
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c index 5b4e2918663a..50bf8e6f8c7b 100644 --- a/drivers/md/multipath.c +++ b/drivers/md/multipath.c | |||
@@ -135,9 +135,8 @@ static void multipath_unplug(struct request_queue *q) | |||
135 | } | 135 | } |
136 | 136 | ||
137 | 137 | ||
138 | static int multipath_make_request (struct request_queue *q, struct bio * bio) | 138 | static int multipath_make_request(mddev_t *mddev, struct bio * bio) |
139 | { | 139 | { |
140 | mddev_t *mddev = q->queuedata; | ||
141 | multipath_conf_t *conf = mddev->private; | 140 | multipath_conf_t *conf = mddev->private; |
142 | struct multipath_bh * mp_bh; | 141 | struct multipath_bh * mp_bh; |
143 | struct multipath_info *multipath; | 142 | struct multipath_info *multipath; |
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index d535f9be39f4..9f9c6b76ca7c 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c | |||
@@ -465,9 +465,8 @@ static inline int is_io_in_chunk_boundary(mddev_t *mddev, | |||
465 | } | 465 | } |
466 | } | 466 | } |
467 | 467 | ||
468 | static int raid0_make_request(struct request_queue *q, struct bio *bio) | 468 | static int raid0_make_request(mddev_t *mddev, struct bio *bio) |
469 | { | 469 | { |
470 | mddev_t *mddev = q->queuedata; | ||
471 | unsigned int chunk_sects; | 470 | unsigned int chunk_sects; |
472 | sector_t sector_offset; | 471 | sector_t sector_offset; |
473 | struct strip_zone *zone; | 472 | struct strip_zone *zone; |
@@ -495,9 +494,9 @@ static int raid0_make_request(struct request_queue *q, struct bio *bio) | |||
495 | else | 494 | else |
496 | bp = bio_split(bio, chunk_sects - | 495 | bp = bio_split(bio, chunk_sects - |
497 | sector_div(sector, chunk_sects)); | 496 | sector_div(sector, chunk_sects)); |
498 | if (raid0_make_request(q, &bp->bio1)) | 497 | if (raid0_make_request(mddev, &bp->bio1)) |
499 | generic_make_request(&bp->bio1); | 498 | generic_make_request(&bp->bio1); |
500 | if (raid0_make_request(q, &bp->bio2)) | 499 | if (raid0_make_request(mddev, &bp->bio2)) |
501 | generic_make_request(&bp->bio2); | 500 | generic_make_request(&bp->bio2); |
502 | 501 | ||
503 | bio_pair_release(bp); | 502 | bio_pair_release(bp); |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index eebce166dafe..5ff75c4d3af6 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -773,9 +773,8 @@ do_sync_io: | |||
773 | return NULL; | 773 | return NULL; |
774 | } | 774 | } |
775 | 775 | ||
776 | static int make_request(struct request_queue *q, struct bio * bio) | 776 | static int make_request(mddev_t *mddev, struct bio * bio) |
777 | { | 777 | { |
778 | mddev_t *mddev = q->queuedata; | ||
779 | conf_t *conf = mddev->private; | 778 | conf_t *conf = mddev->private; |
780 | mirror_info_t *mirror; | 779 | mirror_info_t *mirror; |
781 | r1bio_t *r1_bio; | 780 | r1bio_t *r1_bio; |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index ca313d646fd1..a1d727610a49 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -788,9 +788,8 @@ static void unfreeze_array(conf_t *conf) | |||
788 | spin_unlock_irq(&conf->resync_lock); | 788 | spin_unlock_irq(&conf->resync_lock); |
789 | } | 789 | } |
790 | 790 | ||
791 | static int make_request(struct request_queue *q, struct bio * bio) | 791 | static int make_request(mddev_t *mddev, struct bio * bio) |
792 | { | 792 | { |
793 | mddev_t *mddev = q->queuedata; | ||
794 | conf_t *conf = mddev->private; | 793 | conf_t *conf = mddev->private; |
795 | mirror_info_t *mirror; | 794 | mirror_info_t *mirror; |
796 | r10bio_t *r10_bio; | 795 | r10bio_t *r10_bio; |
@@ -824,9 +823,9 @@ static int make_request(struct request_queue *q, struct bio * bio) | |||
824 | */ | 823 | */ |
825 | bp = bio_split(bio, | 824 | bp = bio_split(bio, |
826 | chunk_sects - (bio->bi_sector & (chunk_sects - 1)) ); | 825 | chunk_sects - (bio->bi_sector & (chunk_sects - 1)) ); |
827 | if (make_request(q, &bp->bio1)) | 826 | if (make_request(mddev, &bp->bio1)) |
828 | generic_make_request(&bp->bio1); | 827 | generic_make_request(&bp->bio1); |
829 | if (make_request(q, &bp->bio2)) | 828 | if (make_request(mddev, &bp->bio2)) |
830 | generic_make_request(&bp->bio2); | 829 | generic_make_request(&bp->bio2); |
831 | 830 | ||
832 | bio_pair_release(bp); | 831 | bio_pair_release(bp); |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 231afda1697f..2882a26646fd 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -3753,9 +3753,8 @@ static int bio_fits_rdev(struct bio *bi) | |||
3753 | } | 3753 | } |
3754 | 3754 | ||
3755 | 3755 | ||
3756 | static int chunk_aligned_read(struct request_queue *q, struct bio * raid_bio) | 3756 | static int chunk_aligned_read(mddev_t *mddev, struct bio * raid_bio) |
3757 | { | 3757 | { |
3758 | mddev_t *mddev = q->queuedata; | ||
3759 | raid5_conf_t *conf = mddev->private; | 3758 | raid5_conf_t *conf = mddev->private; |
3760 | int dd_idx; | 3759 | int dd_idx; |
3761 | struct bio* align_bi; | 3760 | struct bio* align_bi; |
@@ -3870,9 +3869,8 @@ static struct stripe_head *__get_priority_stripe(raid5_conf_t *conf) | |||
3870 | return sh; | 3869 | return sh; |
3871 | } | 3870 | } |
3872 | 3871 | ||
3873 | static int make_request(struct request_queue *q, struct bio * bi) | 3872 | static int make_request(mddev_t *mddev, struct bio * bi) |
3874 | { | 3873 | { |
3875 | mddev_t *mddev = q->queuedata; | ||
3876 | raid5_conf_t *conf = mddev->private; | 3874 | raid5_conf_t *conf = mddev->private; |
3877 | int dd_idx; | 3875 | int dd_idx; |
3878 | sector_t new_sector; | 3876 | sector_t new_sector; |
@@ -3896,7 +3894,7 @@ static int make_request(struct request_queue *q, struct bio * bi) | |||
3896 | 3894 | ||
3897 | if (rw == READ && | 3895 | if (rw == READ && |
3898 | mddev->reshape_position == MaxSector && | 3896 | mddev->reshape_position == MaxSector && |
3899 | chunk_aligned_read(q,bi)) | 3897 | chunk_aligned_read(mddev,bi)) |
3900 | return 0; | 3898 | return 0; |
3901 | 3899 | ||
3902 | logical_sector = bi->bi_sector & ~((sector_t)STRIPE_SECTORS-1); | 3900 | logical_sector = bi->bi_sector & ~((sector_t)STRIPE_SECTORS-1); |