aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@redhat.com>2013-08-20 15:02:41 -0400
committerMike Snitzer <snitzer@redhat.com>2013-08-23 09:02:14 -0400
commitf610937214e2ac8c4225df9a124ea0de1f030626 (patch)
tree879998ed1f96546a6dd555debcd74ad09b88be29 /drivers/md
parent0cc67cd9c55c4b1f076abca06c922751088e6d86 (diff)
dm cache: fix stacking of geometry limits
Do not blindly override the queue limits (specifically io_min and io_opt). Allow traditional stacking of these limits if io_opt is a factor of the cache's data block size. Without this patch mkfs.xfs does not recognize the cache device's provided limits as a useful geometry (e.g. raid) so these hints are ignored. This was due to setting io_min to a useless value. Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com> Acked-by: Joe Thornber <ejt@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-cache-target.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c
index 31985ea81408..22ff650ac24e 100644
--- a/drivers/md/dm-cache-target.c
+++ b/drivers/md/dm-cache-target.c
@@ -2612,9 +2612,17 @@ static void set_discard_limits(struct cache *cache, struct queue_limits *limits)
2612static void cache_io_hints(struct dm_target *ti, struct queue_limits *limits) 2612static void cache_io_hints(struct dm_target *ti, struct queue_limits *limits)
2613{ 2613{
2614 struct cache *cache = ti->private; 2614 struct cache *cache = ti->private;
2615 uint64_t io_opt_sectors = limits->io_opt >> SECTOR_SHIFT;
2615 2616
2616 blk_limits_io_min(limits, 0); 2617 /*
2617 blk_limits_io_opt(limits, cache->sectors_per_block << SECTOR_SHIFT); 2618 * If the system-determined stacked limits are compatible with the
2619 * cache's blocksize (io_opt is a factor) do not override them.
2620 */
2621 if (io_opt_sectors < cache->sectors_per_block ||
2622 do_div(io_opt_sectors, cache->sectors_per_block)) {
2623 blk_limits_io_min(limits, 0);
2624 blk_limits_io_opt(limits, cache->sectors_per_block << SECTOR_SHIFT);
2625 }
2618 set_discard_limits(cache, limits); 2626 set_discard_limits(cache, limits);
2619} 2627}
2620 2628