]> git.baikalelectronics.ru Git - kernel.git/commit
dm thin: support discard with non power of two block size
authorMike Snitzer <snitzer@redhat.com>
Fri, 12 Oct 2012 20:02:07 +0000 (21:02 +0100)
committerAlasdair G Kergon <agk@redhat.com>
Fri, 12 Oct 2012 20:02:07 +0000 (21:02 +0100)
commit3e40393bd3f4bd4f7c91a1a40f0b4eb987c317bf
tree0aeeda160b7cccfb77be58d47084a8e606905bf7
parentcee62dc5c71478c3a8ca5ee864c8daca17287c51
dm thin: support discard with non power of two block size

Support discards when the pool's block size is not a power of 2.
The block layer assumes discard_granularity is a power of 2 (in
blkdev_issue_discard), so we set this to the largest power of 2 that is
a divides into the number of sectors in each block, but never less than
DATA_DEV_BLOCK_SIZE_MIN_SECTORS.

This patch eliminates the "Discard support must be disabled when the
block size is not a power of 2" constraint that was imposed in commit
9c8dd9b ("dm thin: support for non power of 2 pool blocksize").  That
commit was incomplete: using a block size that is not a power of 2
shouldn't mean disabling discard support on the device completely.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
drivers/md/dm-thin.c