Commit 9c973f26 authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] md: rationalise issue_flush function in md personalities

The functions are all subtly different.  This patch makes them all much the
same.  In particular, EOPNOTSUPP gets returned by all is appropriate.
Signed-off-by: default avatarNeil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 6e010a71
......@@ -99,17 +99,14 @@ static int linear_issue_flush(request_queue_t *q, struct gendisk *disk,
linear_conf_t *conf = mddev_to_conf(mddev);
int i, ret = 0;
for (i=0; i < mddev->raid_disks; i++) {
for (i=0; i < mddev->raid_disks && ret == 0; i++) {
struct block_device *bdev = conf->disks[i].rdev->bdev;
request_queue_t *r_queue = bdev_get_queue(bdev);
if (!r_queue->issue_flush_fn) {
if (!r_queue->issue_flush_fn)
ret = -EOPNOTSUPP;
break;
}
ret = r_queue->issue_flush_fn(r_queue, bdev->bd_disk, error_sector);
if (ret)
break;
else
ret = r_queue->issue_flush_fn(r_queue, bdev->bd_disk, error_sector);
}
return ret;
}
......
......@@ -219,20 +219,17 @@ static int multipath_issue_flush(request_queue_t *q, struct gendisk *disk,
multipath_conf_t *conf = mddev_to_conf(mddev);
int i, ret = 0;
for (i=0; i<mddev->raid_disks; i++) {
for (i=0; i<mddev->raid_disks && ret == 0; i++) {
mdk_rdev_t *rdev = conf->multipaths[i].rdev;
if (rdev && !rdev->faulty) {
struct block_device *bdev = rdev->bdev;
request_queue_t *r_queue = bdev_get_queue(bdev);
if (!r_queue->issue_flush_fn) {
if (!r_queue->issue_flush_fn)
ret = -EOPNOTSUPP;
break;
}
ret = r_queue->issue_flush_fn(r_queue, bdev->bd_disk, error_sector);
if (ret)
break;
else
ret = r_queue->issue_flush_fn(r_queue, bdev->bd_disk,
error_sector);
}
}
return ret;
......
......@@ -48,18 +48,14 @@ static int raid0_issue_flush(request_queue_t *q, struct gendisk *disk,
mdk_rdev_t **devlist = conf->strip_zone[0].dev;
int i, ret = 0;
for (i=0; i<mddev->raid_disks; i++) {
for (i=0; i<mddev->raid_disks && ret == 0; i++) {
struct block_device *bdev = devlist[i]->bdev;
request_queue_t *r_queue = bdev_get_queue(bdev);
if (!r_queue->issue_flush_fn) {
if (!r_queue->issue_flush_fn)
ret = -EOPNOTSUPP;
break;
}
ret =r_queue->issue_flush_fn(r_queue, bdev->bd_disk, error_sector);
if (ret)
break;
else
ret = r_queue->issue_flush_fn(r_queue, bdev->bd_disk, error_sector);
}
return ret;
}
......
......@@ -459,17 +459,17 @@ static int raid1_issue_flush(request_queue_t *q, struct gendisk *disk,
int i, ret = 0;
spin_lock_irqsave(&conf->device_lock, flags);
for (i=0; i<mddev->raid_disks; i++) {
for (i=0; i<mddev->raid_disks && ret == 0; i++) {
mdk_rdev_t *rdev = conf->mirrors[i].rdev;
if (rdev && !rdev->faulty) {
struct block_device *bdev = rdev->bdev;
request_queue_t *r_queue = bdev_get_queue(bdev);
if (r_queue->issue_flush_fn) {
ret = r_queue->issue_flush_fn(r_queue, bdev->bd_disk, error_sector);
if (ret)
break;
}
if (!r_queue->issue_flush_fn)
ret = -EOPNOTSUPP;
else
ret = r_queue->issue_flush_fn(r_queue, bdev->bd_disk,
error_sector);
}
}
spin_unlock_irqrestore(&conf->device_lock, flags);
......
......@@ -613,17 +613,17 @@ static int raid10_issue_flush(request_queue_t *q, struct gendisk *disk,
int i, ret = 0;
spin_lock_irqsave(&conf->device_lock, flags);
for (i=0; i<mddev->raid_disks; i++) {
for (i=0; i<mddev->raid_disks && ret == 0; i++) {
mdk_rdev_t *rdev = conf->mirrors[i].rdev;
if (rdev && !rdev->faulty) {
struct block_device *bdev = rdev->bdev;
request_queue_t *r_queue = bdev_get_queue(bdev);
if (r_queue->issue_flush_fn) {
ret = r_queue->issue_flush_fn(r_queue, bdev->bd_disk, error_sector);
if (ret)
break;
}
if (!r_queue->issue_flush_fn)
ret = -EOPNOTSUPP;
else
ret = r_queue->issue_flush_fn(r_queue, bdev->bd_disk,
error_sector);
}
}
spin_unlock_irqrestore(&conf->device_lock, flags);
......
......@@ -1347,27 +1347,17 @@ static int raid5_issue_flush(request_queue_t *q, struct gendisk *disk,
raid5_conf_t *conf = mddev_to_conf(mddev);
int i, ret = 0;
for (i=0; i<mddev->raid_disks; i++) {
for (i=0; i<mddev->raid_disks && ret == 0; i++) {
mdk_rdev_t *rdev = conf->disks[i].rdev;
if (rdev && !rdev->faulty) {
struct block_device *bdev = rdev->bdev;
request_queue_t *r_queue;
if (!bdev)
continue;
r_queue = bdev_get_queue(bdev);
if (!r_queue)
continue;
request_queue_t *r_queue = bdev_get_queue(bdev);
if (!r_queue->issue_flush_fn) {
if (!r_queue->issue_flush_fn)
ret = -EOPNOTSUPP;
break;
}
ret = r_queue->issue_flush_fn(r_queue, bdev->bd_disk, error_sector);
if (ret)
break;
else
ret = r_queue->issue_flush_fn(r_queue, bdev->bd_disk,
error_sector);
}
}
return ret;
......
......@@ -1509,27 +1509,17 @@ static int raid6_issue_flush(request_queue_t *q, struct gendisk *disk,
raid6_conf_t *conf = mddev_to_conf(mddev);
int i, ret = 0;
for (i=0; i<mddev->raid_disks; i++) {
for (i=0; i<mddev->raid_disks && ret == 0; i++) {
mdk_rdev_t *rdev = conf->disks[i].rdev;
if (rdev && !rdev->faulty) {
struct block_device *bdev = rdev->bdev;
request_queue_t *r_queue;
if (!bdev)
continue;
r_queue = bdev_get_queue(bdev);
if (!r_queue)
continue;
request_queue_t *r_queue = bdev_get_queue(bdev);
if (!r_queue->issue_flush_fn) {
if (!r_queue->issue_flush_fn)
ret = -EOPNOTSUPP;
break;
}
ret = r_queue->issue_flush_fn(r_queue, bdev->bd_disk, error_sector);
if (ret)
break;
else
ret = r_queue->issue_flush_fn(r_queue, bdev->bd_disk,
error_sector);
}
}
return ret;
......
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