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(via8dd2cb7e88
"block: discard granularity might not be power of 2" and59771079c1
"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>
This commit is contained in:
parent
fd7c092e71
commit
f13945d757
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue