aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2006-10-03 04:15:53 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-03 11:04:18 -0400
commit26be34dc3a46be983352dd89683db374b0cb73fa (patch)
tree296ed9d019ac56d4a6ea0909f1cf11bdfd08a3e5 /drivers/md
parentc04be0aa82ff535e3676ab3e573957bdeef41879 (diff)
[PATCH] md: define backing_dev_info.congested_fn for raid0 and linear
Each backing_dev needs to be able to report whether it is congested, either by modulating BDI_*_congested in ->state, or by defining a ->congested_fn. md/raid did neither of these. This patch add a congested_fn which simply checks all component devices to see if they are congested. Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/linear.c15
-rw-r--r--drivers/md/raid0.c17
2 files changed, 32 insertions, 0 deletions
diff --git a/drivers/md/linear.c b/drivers/md/linear.c
index b99c19c7eb22..c625ddb8833d 100644
--- a/drivers/md/linear.c
+++ b/drivers/md/linear.c
@@ -111,6 +111,19 @@ static int linear_issue_flush(request_queue_t *q, struct gendisk *disk,
111 return ret; 111 return ret;
112} 112}
113 113
114static int linear_congested(void *data, int bits)
115{
116 mddev_t *mddev = data;
117 linear_conf_t *conf = mddev_to_conf(mddev);
118 int i, ret = 0;
119
120 for (i = 0; i < mddev->raid_disks && !ret ; i++) {
121 request_queue_t *q = bdev_get_queue(conf->disks[i].rdev->bdev);
122 ret |= bdi_congested(&q->backing_dev_info, bits);
123 }
124 return ret;
125}
126
114static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks) 127static linear_conf_t *linear_conf(mddev_t *mddev, int raid_disks)
115{ 128{
116 linear_conf_t *conf; 129 linear_conf_t *conf;
@@ -269,6 +282,8 @@ static int linear_run (mddev_t *mddev)
269 blk_queue_merge_bvec(mddev->queue, linear_mergeable_bvec); 282 blk_queue_merge_bvec(mddev->queue, linear_mergeable_bvec);
270 mddev->queue->unplug_fn = linear_unplug; 283 mddev->queue->unplug_fn = linear_unplug;
271 mddev->queue->issue_flush_fn = linear_issue_flush; 284 mddev->queue->issue_flush_fn = linear_issue_flush;
285 mddev->queue->backing_dev_info.congested_fn = linear_congested;
286 mddev->queue->backing_dev_info.congested_data = mddev;
272 return 0; 287 return 0;
273} 288}
274 289
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index cb8c6317e4e5..dfe32149ad3a 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -60,6 +60,21 @@ static int raid0_issue_flush(request_queue_t *q, struct gendisk *disk,
60 return ret; 60 return ret;
61} 61}
62 62
63static int raid0_congested(void *data, int bits)
64{
65 mddev_t *mddev = data;
66 raid0_conf_t *conf = mddev_to_conf(mddev);
67 mdk_rdev_t **devlist = conf->strip_zone[0].dev;
68 int i, ret = 0;
69
70 for (i = 0; i < mddev->raid_disks && !ret ; i++) {
71 request_queue_t *q = bdev_get_queue(devlist[i]->bdev);
72
73 ret |= bdi_congested(&q->backing_dev_info, bits);
74 }
75 return ret;
76}
77
63 78
64static int create_strip_zones (mddev_t *mddev) 79static int create_strip_zones (mddev_t *mddev)
65{ 80{
@@ -236,6 +251,8 @@ static int create_strip_zones (mddev_t *mddev)
236 mddev->queue->unplug_fn = raid0_unplug; 251 mddev->queue->unplug_fn = raid0_unplug;
237 252
238 mddev->queue->issue_flush_fn = raid0_issue_flush; 253 mddev->queue->issue_flush_fn = raid0_issue_flush;
254 mddev->queue->backing_dev_info.congested_fn = raid0_congested;
255 mddev->queue->backing_dev_info.congested_data = mddev;
239 256
240 printk("raid0: done.\n"); 257 printk("raid0: done.\n");
241 return 0; 258 return 0;