From: NeilBrown Following are 7 patches for md They all grew out of a desire to redo the locking in unplug_slave. Getting and dropping a spinlock so often for very little gain (it would be nearly impossible to lose the relevant race) really bothered me. I finally figured that I could reply it with rcu locking which is very light wait, and quite up to the task. One the way I found an number of inconsistencies that needed cleaning up and even a few bugs to fix. The first 6 patches deal with these inconsistencies and bugs. The last redoes the locking for adding/removing/accessing devices within md personalities. This patch: md_flush_all() isn't needed as each personality defines its own issue_flush_fn. Signed-off-by: Neil Brown Signed-off-by: Andrew Morton --- 25-akpm/drivers/md/md.c | 33 --------------------------------- 1 files changed, 33 deletions(-) diff -puN drivers/md/md.c~md-remove-md_flush_all drivers/md/md.c --- 25/drivers/md/md.c~md-remove-md_flush_all Thu Oct 21 15:06:59 2004 +++ 25-akpm/drivers/md/md.c Thu Oct 21 15:06:59 2004 @@ -154,38 +154,6 @@ static spinlock_t all_mddevs_lock = SPIN tmp = tmp->next;}) \ ) -int md_flush_mddev(mddev_t *mddev, sector_t *error_sector) -{ - struct list_head *tmp; - mdk_rdev_t *rdev; - int ret = 0; - - /* - * this list iteration is done without any locking in md?! - */ - ITERATE_RDEV(mddev, rdev, tmp) { - request_queue_t *r_queue = bdev_get_queue(rdev->bdev); - int err; - - if (!r_queue->issue_flush_fn) - err = -EOPNOTSUPP; - else - err = r_queue->issue_flush_fn(r_queue, rdev->bdev->bd_disk, error_sector); - - if (!ret) - ret = err; - } - - return ret; -} - -static int md_flush_all(request_queue_t *q, struct gendisk *disk, - sector_t *error_sector) -{ - mddev_t *mddev = q->queuedata; - - return md_flush_mddev(mddev, error_sector); -} static int md_fail_request (request_queue_t *q, struct bio *bio) { @@ -1714,7 +1682,6 @@ static int do_md_run(mddev_t * mddev) */ mddev->queue->queuedata = mddev; mddev->queue->make_request_fn = mddev->pers->make_request; - mddev->queue->issue_flush_fn = md_flush_all; mddev->changed = 1; return 0; _