Skip to content

Commit

Permalink
[PATCH] Decrease number of pointer derefs in multipath.c
Browse files Browse the repository at this point in the history
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 <jesper.juhl@gmail.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Cc: Alasdair G Kergon <agk@redhat.com>
Acked-by: NeilBrown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Jesper Juhl authored and Linus Torvalds committed Jan 10, 2006
1 parent 3795e16 commit 352d768
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/md/multipath.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -311,16 +312,16 @@ static int multipath_add_disk(mddev_t *mddev, mdk_rdev_t *rdev)

for (path=0; path<mddev->raid_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
* a one page request is never in violation.
* (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);

Expand Down

0 comments on commit 352d768

Please sign in to comment.