aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2009-09-23 04:10:29 -0400
committerNeilBrown <neilb@suse.de>2009-09-23 04:10:29 -0400
commit3fa841d7e7266f6fcc1b3885b905f5153ba897d8 (patch)
tree7afa971a10eddcf52787340ea43fa1e910b5805b /drivers
parent0da3c6194ec2f32617b272df4505a1cf022faea5 (diff)
md: report device as congested when suspended
This should writeback from coming when the device is temporarily suspended. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/md/linear.c3
-rw-r--r--drivers/md/md.c6
-rw-r--r--drivers/md/md.h1
-rw-r--r--drivers/md/multipath.c3
-rw-r--r--drivers/md/raid0.c3
-rw-r--r--drivers/md/raid1.c3
-rw-r--r--drivers/md/raid10.c2
-rw-r--r--drivers/md/raid5.c3
8 files changed, 24 insertions, 0 deletions
diff --git a/drivers/md/linear.c b/drivers/md/linear.c
index ea4842905444..1ceceb334d5e 100644
--- a/drivers/md/linear.c
+++ b/drivers/md/linear.c
@@ -108,6 +108,9 @@ static int linear_congested(void *data, int bits)
108 linear_conf_t *conf; 108 linear_conf_t *conf;
109 int i, ret = 0; 109 int i, ret = 0;
110 110
111 if (mddev_congested(mddev, bits))
112 return 1;
113
111 rcu_read_lock(); 114 rcu_read_lock();
112 conf = rcu_dereference(mddev->private); 115 conf = rcu_dereference(mddev->private);
113 116
diff --git a/drivers/md/md.c b/drivers/md/md.c
index a3dd3c8ea681..26ba42a79129 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -262,6 +262,12 @@ static void mddev_resume(mddev_t *mddev)
262 mddev->pers->quiesce(mddev, 0); 262 mddev->pers->quiesce(mddev, 0);
263} 263}
264 264
265int mddev_congested(mddev_t *mddev, int bits)
266{
267 return mddev->suspended;
268}
269EXPORT_SYMBOL(mddev_congested);
270
265 271
266static inline mddev_t *mddev_get(mddev_t *mddev) 272static inline mddev_t *mddev_get(mddev_t *mddev)
267{ 273{
diff --git a/drivers/md/md.h b/drivers/md/md.h
index f55d2ff95133..f184b69ef337 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -430,6 +430,7 @@ extern void md_write_end(mddev_t *mddev);
430extern void md_done_sync(mddev_t *mddev, int blocks, int ok); 430extern void md_done_sync(mddev_t *mddev, int blocks, int ok);
431extern void md_error(mddev_t *mddev, mdk_rdev_t *rdev); 431extern void md_error(mddev_t *mddev, mdk_rdev_t *rdev);
432 432
433extern int mddev_congested(mddev_t *mddev, int bits);
433extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev, 434extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev,
434 sector_t sector, int size, struct page *page); 435 sector_t sector, int size, struct page *page);
435extern void md_super_wait(mddev_t *mddev); 436extern void md_super_wait(mddev_t *mddev);
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c
index 94c21c11b9bc..dcbf9d35928b 100644
--- a/drivers/md/multipath.c
+++ b/drivers/md/multipath.c
@@ -199,6 +199,9 @@ static int multipath_congested(void *data, int bits)
199 multipath_conf_t *conf = mddev->private; 199 multipath_conf_t *conf = mddev->private;
200 int i, ret = 0; 200 int i, ret = 0;
201 201
202 if (mddev_congested(mddev, bits))
203 return 1;
204
202 rcu_read_lock(); 205 rcu_read_lock();
203 for (i = 0; i < mddev->raid_disks ; i++) { 206 for (i = 0; i < mddev->raid_disks ; i++) {
204 mdk_rdev_t *rdev = rcu_dereference(conf->multipaths[i].rdev); 207 mdk_rdev_t *rdev = rcu_dereference(conf->multipaths[i].rdev);
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index 68a4d129206e..d3a4ce06015a 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -44,6 +44,9 @@ static int raid0_congested(void *data, int bits)
44 mdk_rdev_t **devlist = conf->devlist; 44 mdk_rdev_t **devlist = conf->devlist;
45 int i, ret = 0; 45 int i, ret = 0;
46 46
47 if (mddev_congested(mddev, bits))
48 return 1;
49
47 for (i = 0; i < mddev->raid_disks && !ret ; i++) { 50 for (i = 0; i < mddev->raid_disks && !ret ; i++) {
48 struct request_queue *q = bdev_get_queue(devlist[i]->bdev); 51 struct request_queue *q = bdev_get_queue(devlist[i]->bdev);
49 52
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 7efdeb44097f..a1eb4e13a112 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -576,6 +576,9 @@ static int raid1_congested(void *data, int bits)
576 conf_t *conf = mddev->private; 576 conf_t *conf = mddev->private;
577 int i, ret = 0; 577 int i, ret = 0;
578 578
579 if (mddev_congested(mddev, bits))
580 return 1;
581
579 rcu_read_lock(); 582 rcu_read_lock();
580 for (i = 0; i < mddev->raid_disks; i++) { 583 for (i = 0; i < mddev->raid_disks; i++) {
581 mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[i].rdev); 584 mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[i].rdev);
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 7872968fdfcc..191f42efecc2 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -631,6 +631,8 @@ static int raid10_congested(void *data, int bits)
631 conf_t *conf = mddev->private; 631 conf_t *conf = mddev->private;
632 int i, ret = 0; 632 int i, ret = 0;
633 633
634 if (mddev_congested(mddev, bits))
635 return 1;
634 rcu_read_lock(); 636 rcu_read_lock();
635 for (i = 0; i < mddev->raid_disks && ret == 0; i++) { 637 for (i = 0; i < mddev->raid_disks && ret == 0; i++) {
636 mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[i].rdev); 638 mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[i].rdev);
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index bee3573ed1bd..9db84c98a41d 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -3332,6 +3332,9 @@ static int raid5_congested(void *data, int bits)
3332 /* No difference between reads and writes. Just check 3332 /* No difference between reads and writes. Just check
3333 * how busy the stripe_cache is 3333 * how busy the stripe_cache is
3334 */ 3334 */
3335
3336 if (mddev_congested(mddev, bits))
3337 return 1;
3335 if (conf->inactive_blocked) 3338 if (conf->inactive_blocked)
3336 return 1; 3339 return 1;
3337 if (conf->quiesce) 3340 if (conf->quiesce)