Skip to content

Commit

Permalink
dm thin: disable discard support for thin devices if pool's is disabled
Browse files Browse the repository at this point in the history
If the pool is configured with 'ignore_discard' its discard support is
disabled.  The pool's thin devices should also have queue_limits that
reflect discards are disabled.

Fixes: 34fbcf6 ("dm thin: range discard support")
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Cc: stable@vger.kernel.org # 4.1+
  • Loading branch information
Mike Snitzer committed Sep 14, 2015
1 parent 6ff33f3 commit 2160767
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/md/dm-thin.c
Original file line number Diff line number Diff line change
Expand Up @@ -4249,6 +4249,10 @@ static void thin_io_hints(struct dm_target *ti, struct queue_limits *limits)
{
struct thin_c *tc = ti->private;
struct pool *pool = tc->pool;
struct queue_limits *pool_limits = dm_get_queue_limits(pool->pool_md);

if (!pool_limits->discard_granularity)
return; /* pool's discard support is disabled */

limits->discard_granularity = pool->sectors_per_block << SECTOR_SHIFT;
limits->max_discard_sectors = 2048 * 1024 * 16; /* 16G */
Expand Down

0 comments on commit 2160767

Please sign in to comment.