Linux Kernels

dm thin: disable discard support for thin devices if pool's is disabled

This change “dm thin: disable discard support for thin devices if pool's is disabled” (commit 2160767) in Linux kernel is authored by Mike Snitzer <snitzer [at] redhat.com> on Tue Sep 8 08:56:13 2015 -0400.

Description of "dm thin: disable discard support for thin devices if pool's is disabled"

The change “dm thin: disable discard support for thin devices if pool's is disabled” introduces changes as follows.

dm thin: disable discard support for thin devices if pool's is disabled

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: 34fbcf62 ("dm thin: range discard support")
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Cc: stable@vger.kernel.org # 4.1+

Linux kernel releases containing commit 2160767

The Linux kernel releases containing this commit are as follows.

Linux kernel code changes from "dm thin: disable discard support for thin devices if pool's is disabled"

There are 4 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/md/dm-thin.c | 4 ++++
 1 file changed, 4 insertions(+)
 
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index 6578b7bc1fbb..6fcbfb063366 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -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 */

The commit for this change in Linux stable tree is 2160767 (patch).

Last modified: 2020/01/11 09:36