Commit 3fa841d7 authored by NeilBrown's avatar NeilBrown

md: report device as congested when suspended

This should writeback from coming when the device is temporarily
suspended.
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent 0da3c619
...@@ -108,6 +108,9 @@ static int linear_congested(void *data, int bits) ...@@ -108,6 +108,9 @@ static int linear_congested(void *data, int bits)
linear_conf_t *conf; linear_conf_t *conf;
int i, ret = 0; int i, ret = 0;
if (mddev_congested(mddev, bits))
return 1;
rcu_read_lock(); rcu_read_lock();
conf = rcu_dereference(mddev->private); conf = rcu_dereference(mddev->private);
......
...@@ -262,6 +262,12 @@ static void mddev_resume(mddev_t *mddev) ...@@ -262,6 +262,12 @@ static void mddev_resume(mddev_t *mddev)
mddev->pers->quiesce(mddev, 0); mddev->pers->quiesce(mddev, 0);
} }
int mddev_congested(mddev_t *mddev, int bits)
{
return mddev->suspended;
}
EXPORT_SYMBOL(mddev_congested);
static inline mddev_t *mddev_get(mddev_t *mddev) static inline mddev_t *mddev_get(mddev_t *mddev)
{ {
......
...@@ -430,6 +430,7 @@ extern void md_write_end(mddev_t *mddev); ...@@ -430,6 +430,7 @@ extern void md_write_end(mddev_t *mddev);
extern void md_done_sync(mddev_t *mddev, int blocks, int ok); extern void md_done_sync(mddev_t *mddev, int blocks, int ok);
extern void md_error(mddev_t *mddev, mdk_rdev_t *rdev); extern void md_error(mddev_t *mddev, mdk_rdev_t *rdev);
extern int mddev_congested(mddev_t *mddev, int bits);
extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev, extern void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev,
sector_t sector, int size, struct page *page); sector_t sector, int size, struct page *page);
extern void md_super_wait(mddev_t *mddev); extern void md_super_wait(mddev_t *mddev);
......
...@@ -199,6 +199,9 @@ static int multipath_congested(void *data, int bits) ...@@ -199,6 +199,9 @@ static int multipath_congested(void *data, int bits)
multipath_conf_t *conf = mddev->private; multipath_conf_t *conf = mddev->private;
int i, ret = 0; int i, ret = 0;
if (mddev_congested(mddev, bits))
return 1;
rcu_read_lock(); rcu_read_lock();
for (i = 0; i < mddev->raid_disks ; i++) { for (i = 0; i < mddev->raid_disks ; i++) {
mdk_rdev_t *rdev = rcu_dereference(conf->multipaths[i].rdev); mdk_rdev_t *rdev = rcu_dereference(conf->multipaths[i].rdev);
......
...@@ -44,6 +44,9 @@ static int raid0_congested(void *data, int bits) ...@@ -44,6 +44,9 @@ static int raid0_congested(void *data, int bits)
mdk_rdev_t **devlist = conf->devlist; mdk_rdev_t **devlist = conf->devlist;
int i, ret = 0; int i, ret = 0;
if (mddev_congested(mddev, bits))
return 1;
for (i = 0; i < mddev->raid_disks && !ret ; i++) { for (i = 0; i < mddev->raid_disks && !ret ; i++) {
struct request_queue *q = bdev_get_queue(devlist[i]->bdev); struct request_queue *q = bdev_get_queue(devlist[i]->bdev);
......
...@@ -576,6 +576,9 @@ static int raid1_congested(void *data, int bits) ...@@ -576,6 +576,9 @@ static int raid1_congested(void *data, int bits)
conf_t *conf = mddev->private; conf_t *conf = mddev->private;
int i, ret = 0; int i, ret = 0;
if (mddev_congested(mddev, bits))
return 1;
rcu_read_lock(); rcu_read_lock();
for (i = 0; i < mddev->raid_disks; i++) { for (i = 0; i < mddev->raid_disks; i++) {
mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[i].rdev); mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[i].rdev);
......
...@@ -631,6 +631,8 @@ static int raid10_congested(void *data, int bits) ...@@ -631,6 +631,8 @@ static int raid10_congested(void *data, int bits)
conf_t *conf = mddev->private; conf_t *conf = mddev->private;
int i, ret = 0; int i, ret = 0;
if (mddev_congested(mddev, bits))
return 1;
rcu_read_lock(); rcu_read_lock();
for (i = 0; i < mddev->raid_disks && ret == 0; i++) { for (i = 0; i < mddev->raid_disks && ret == 0; i++) {
mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[i].rdev); mdk_rdev_t *rdev = rcu_dereference(conf->mirrors[i].rdev);
......
...@@ -3332,6 +3332,9 @@ static int raid5_congested(void *data, int bits) ...@@ -3332,6 +3332,9 @@ static int raid5_congested(void *data, int bits)
/* No difference between reads and writes. Just check /* No difference between reads and writes. Just check
* how busy the stripe_cache is * how busy the stripe_cache is
*/ */
if (mddev_congested(mddev, bits))
return 1;
if (conf->inactive_blocked) if (conf->inactive_blocked)
return 1; return 1;
if (conf->quiesce) if (conf->quiesce)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment