summaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@kernel.org>2023-06-16 23:21:24 +0200
committerMike Snitzer <snitzer@kernel.org>2023-06-17 00:24:14 +0200
commitfa375646241b5350f7326fd4d686891b95d9fbe5 (patch)
tree520b8269e6163dec3c2ea47b6ada6a4393d4d738 /drivers/md
parentdm: remove stale/redundant dm_internal_{suspend,resume} prototypes in dm.h (diff)
downloadlinux-fa375646241b5350f7326fd4d686891b95d9fbe5.tar.xz
linux-fa375646241b5350f7326fd4d686891b95d9fbe5.zip
dm thin: disable discards for thin-pool if no_discard_passdown
Also rename disable_passdown_if_not_supported to disable_discard_passdown_if_not_supported. And fold passdown_enabled() into only caller. Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-thin.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index ebcfd84e8b7f..5b0c2f004dbb 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -2528,16 +2528,11 @@ static void noflush_work(struct thin_c *tc, void (*fn)(struct work_struct *))
/*----------------------------------------------------------------*/
-static bool passdown_enabled(struct pool_c *pt)
-{
- return pt->adjusted_pf.discard_passdown;
-}
-
static void set_discard_callbacks(struct pool *pool)
{
struct pool_c *pt = pool->ti->private;
- if (passdown_enabled(pt)) {
+ if (pt->adjusted_pf.discard_passdown) {
pool->process_discard_cell = process_discard_cell_passdown;
pool->process_prepared_discard = process_prepared_discard_passdown_pt1;
pool->process_prepared_discard_pt2 = process_prepared_discard_passdown_pt2;
@@ -2846,7 +2841,7 @@ static bool is_factor(sector_t block_size, uint32_t n)
* If discard_passdown was enabled verify that the data device
* supports discards. Disable discard_passdown if not.
*/
-static void disable_passdown_if_not_supported(struct pool_c *pt)
+static void disable_discard_passdown_if_not_supported(struct pool_c *pt)
{
struct pool *pool = pt->pool;
struct block_device *data_bdev = pt->data_dev->bdev;
@@ -4100,7 +4095,9 @@ static void pool_io_hints(struct dm_target *ti, struct queue_limits *limits)
*/
if (pt->adjusted_pf.discard_enabled) {
- disable_passdown_if_not_supported(pt);
+ disable_discard_passdown_if_not_supported(pt);
+ if (!pt->adjusted_pf.discard_passdown)
+ limits->max_discard_sectors = 0;
/*
* The pool uses the same discard limits as the underlying data
* device. DM core has already set this up.