Copy the restrictions from the request queue into a temporary local variable and use combine_restrictions_low() instead of duplicating the code. [Christoph Saout] --- diff/drivers/md/dm-table.c 2004-01-02 11:23:40.000000000 +0000 +++ source/drivers/md/dm-table.c 2004-01-23 13:01:54.000000000 +0000 @@ -482,17 +482,19 @@ start, len, mode, result); if (!r) { request_queue_t *q = bdev_get_queue((*result)->bdev); - struct io_restrictions *rs = &ti->limits; - + struct io_restrictions *lrs = &ti->limits; /* - * Combine the device limits low. - * - * FIXME: if we move an io_restriction struct - * into q this would just be a call to - * combine_restrictions_low() + * FIXME: If we move an io_restriction struct into q we wouldn't + * need to copy the restrictions to a temporary variable. */ - rs->max_sectors = - min_not_zero(rs->max_sectors, q->max_sectors); + struct io_restrictions hrs = { + .max_sectors = q->max_sectors, + .max_phys_segments = q->max_phys_segments, + .max_hw_segments = q->max_hw_segments, + .hardsect_size = q->hardsect_size, + .max_segment_size = q->max_segment_size, + .seg_boundary_mask = q->seg_boundary_mask + }; /* FIXME: Device-Mapper on top of RAID-0 breaks because DM * currently doesn't honor MD's merge_bvec_fn routine. @@ -502,25 +504,14 @@ * least operate correctly. */ if (q->merge_bvec_fn) - rs->max_sectors = - min_not_zero(rs->max_sectors, + hrs.max_sectors = + min_not_zero(hrs.max_sectors, (unsigned short)(PAGE_SIZE >> 9)); - rs->max_phys_segments = - min_not_zero(rs->max_phys_segments, - q->max_phys_segments); - - rs->max_hw_segments = - min_not_zero(rs->max_hw_segments, q->max_hw_segments); - - rs->hardsect_size = max(rs->hardsect_size, q->hardsect_size); - - rs->max_segment_size = - min_not_zero(rs->max_segment_size, q->max_segment_size); - - rs->seg_boundary_mask = - min_not_zero(rs->seg_boundary_mask, - q->seg_boundary_mask); + /* + * Combine the device limits low. + */ + combine_restrictions_low(lrs, &hrs); } return r;