From: Jesper Juhl Date: Tue, 10 Jan 2006 04:54:44 +0000 (-0800) Subject: [PATCH] Decrease number of pointer derefs in multipath.c X-Git-Tag: v2.6.16-rc1~483 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=352d768b19408d3c019a3fa09fd5bfed99a55bc6;p=linux-2.6 [PATCH] Decrease number of pointer derefs in multipath.c Decrease the number of pointer derefs in drivers/md/multipath.c Benefits of the patch: - Fewer pointer dereferences should make the code slightly faster. - Size of generated code is smaller - improved readability Signed-off-by: Jesper Juhl Acked-by: Ingo Molnar Cc: Alasdair G Kergon Acked-by: NeilBrown Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c index e6aa309a66..96f7af4ae4 100644 --- a/drivers/md/multipath.c +++ b/drivers/md/multipath.c @@ -303,6 +303,7 @@ static void print_multipath_conf (multipath_conf_t *conf) static int multipath_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) { multipath_conf_t *conf = mddev->private; + struct request_queue *q; int found = 0; int path; struct multipath_info *p; @@ -311,8 +312,8 @@ static int multipath_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) for (path=0; pathraid_disks; path++) if ((p=conf->multipaths+path)->rdev == NULL) { - blk_queue_stack_limits(mddev->queue, - rdev->bdev->bd_disk->queue); + q = rdev->bdev->bd_disk->queue; + blk_queue_stack_limits(mddev->queue, q); /* as we don't honour merge_bvec_fn, we must never risk * violating it, so limit ->max_sector to one PAGE, as @@ -320,7 +321,7 @@ static int multipath_add_disk(mddev_t *mddev, mdk_rdev_t *rdev) * (Note: it is very unlikely that a device with * merge_bvec_fn will be involved in multipath.) */ - if (rdev->bdev->bd_disk->queue->merge_bvec_fn && + if (q->merge_bvec_fn && mddev->queue->max_sectors > (PAGE_SIZE>>9)) blk_queue_max_sectors(mddev->queue, PAGE_SIZE>>9);