diff options
author | Mike Snitzer <snitzer@redhat.com> | 2013-03-02 02:45:44 +0400 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2013-03-02 02:45:44 +0400 |
commit | f13945d75730081830b6f3360266950e2b7c9067 (patch) | |
tree | d911f24cd7d09a92c992e58495c7704621ccde38 | |
parent | fd7c092e711ebab55b2688d3859d95dfd0301f73 (diff) | |
download | linux-f13945d75730081830b6f3360266950e2b7c9067.tar.xz |
dm thin: support a non power of 2 discard_granularity
Support a non-power-of-2 discard granularity in dm-thin, now that the block
layer supports this(via 8dd2cb7e880d2f77fba53b523c99133ad5054cfd "block:
discard granularity might not be power of 2" and
59771079c18c44e39106f0f30054025acafadb41 "blk: avoid divide-by-zero with zero
discard granularity").
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
-rw-r--r-- | drivers/md/dm-thin.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index 7a66d73148e6..75159cd4c7af 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c @@ -2443,15 +2443,8 @@ static void set_discard_limits(struct pool_c *pt, struct queue_limits *limits) if (pt->adjusted_pf.discard_passdown) { data_limits = &bdev_get_queue(pt->data_dev->bdev)->limits; limits->discard_granularity = data_limits->discard_granularity; - } else if (block_size_is_power_of_two(pool)) + } else limits->discard_granularity = pool->sectors_per_block << SECTOR_SHIFT; - else - /* - * Use largest power of 2 that is a factor of sectors_per_block - * but at least DATA_DEV_BLOCK_SIZE_MIN_SECTORS. - */ - limits->discard_granularity = max(1 << (ffs(pool->sectors_per_block) - 1), - DATA_DEV_BLOCK_SIZE_MIN_SECTORS) << SECTOR_SHIFT; } static void pool_io_hints(struct dm_target *ti, struct queue_limits *limits) |