FAILED: patch "[PATCH] dm writecache: return the exact table values that were set" failed to apply to 4.19-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 054bee16163df023e2589db09fd27d81f7ad9e72 Mon Sep 17 00:00:00 2001
From: Mikulas Patocka <[email protected]>
Date: Thu, 4 Feb 2021 05:20:52 -0500
Subject: [PATCH] dm writecache: return the exact table values that were set
LVM doesn't like it when the target returns different values from what was set in the constructor. Fix dm-writecache so that the returned table values are exactly the same as requested values.
drivers/md/dm-writecache.c +30 -24
@@ -159,14 +159,22 @@ struct dm_writecache { bool overwrote_committed:1; bool memory_vmapped:1; + bool start_sector_set:1; bool high_wm_percent_set:1; bool low_wm_percent_set:1; bool max_writeback_jobs_set:1; bool autocommit_blocks_set:1; bool autocommit_time_set:1; + bool max_age_set:1; bool writeback_fua_set:1; bool flush_on_suspend:1; bool cleaner:1; + bool cleaner_set:1; + +unsigned high_wm_percent_value; +unsigned low_wm_percent_value; +unsigned autocommit_time_value; +unsigned max_age_value;unsigned writeback_all;struct workqueue_struct *writeback_wq;
@@ -2203,6 +2211,7 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv)if (sscanf (string,"%llu%c" , &start_sector, &dummy) !=1 ) goto invalid_optional; wc->start_sector = start_sector; + wc->start_sector_set = true;if (wc->start_sector != start_sector || wc->start_sector >= wc->memory_map_size >>SECTOR_SHIFT ) goto invalid_optional;
@@ -2212,6 +2221,7 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv) goto invalid_optional;if (high_wm_percent <0 || high_wm_percent >100 ) goto invalid_optional; + wc->high_wm_percent_value = high_wm_percent; wc->high_wm_percent_set = true; }else if (!strcasecmp (string,"low_watermark" ) && opt_params >=1 ) { string =dm_shift_arg (&as), opt_params--;
@@ -2219,6 +2229,7 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv) goto invalid_optional;if (low_wm_percent <0 || low_wm_percent >100 ) goto invalid_optional; + wc->low_wm_percent_value = low_wm_percent; wc->low_wm_percent_set = true; }else if (!strcasecmp (string,"writeback_jobs" ) && opt_params >=1 ) { string =dm_shift_arg (&as), opt_params--;
@@ -2238,6 +2249,7 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv)if (autocommit_msecs >3600000 ) goto invalid_optional; wc->autocommit_jiffies =msecs_to_jiffies (autocommit_msecs); + wc->autocommit_time_value = autocommit_msecs; wc->autocommit_time_set = true; }else if (!strcasecmp (string,"max_age" ) && opt_params >=1 ) {unsigned max_age_msecs;
@@ -2247,7 +2259,10 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv)if (max_age_msecs >86400000 ) goto invalid_optional; wc->max_age =msecs_to_jiffies (max_age_msecs); + wc->max_age_set = true; + wc->max_age_value = max_age_msecs; }else if (!strcasecmp (string,"cleaner" )) { + wc->cleaner_set = true; wc->cleaner = true; }else if (!strcasecmp (string,"fua" )) {if (WC_MODE_PMEM (wc)) {
@@ -2453,7 +2468,6 @@ static void writecache_status(struct dm_target *ti, status_type_t type,struct dm_writecache *wc = ti->private;unsigned extra_args;unsigned sz =0 ; -uint64_t x;switch (type) {case STATUSTYPE_INFO :
@@ -2465,11 +2479,11 @@ static void writecache_status(struct dm_target *ti, status_type_t type,DMEMIT ("%c %s %s %u " ,WC_MODE_PMEM (wc) ?'p' :'s' , wc->dev->name, wc->ssd_dev->name, wc->block_size); extra_args =0 ; -if (wc->start_sector) +if (wc->start_sector_set) extra_args +=2 ; -if (wc->high_wm_percent_set && !wc->cleaner) +if (wc->high_wm_percent_set) extra_args +=2 ; -if (wc->low_wm_percent_set && !wc->cleaner) +if (wc->low_wm_percent_set) extra_args +=2 ;if (wc->max_writeback_jobs_set) extra_args +=2 ;
@@ -2477,37 +2491,29 @@ static void writecache_status(struct dm_target *ti, status_type_t type, extra_args +=2 ;if (wc->autocommit_time_set) extra_args +=2 ; -if (wc->max_age !=MAX_AGE_UNSPECIFIED ) +if (wc->max_age_set) extra_args +=2 ; -if (wc->cleaner) +if (wc->cleaner_set) extra_args++;if (wc->writeback_fua_set) extra_args++;DMEMIT ("%u" , extra_args); -if (wc->start_sector) +if (wc->start_sector_set)DMEMIT (" start_sector %llu" , (unsigned long long )wc->start_sector); -if (wc->high_wm_percent_set && !wc->cleaner) { - x = (uint64_t )wc->freelist_high_watermark *100 ; - x += wc->n_blocks /2 ; -do_div (x, (size_t )wc->n_blocks); -DMEMIT (" high_watermark %u" ,100 - (unsigned )x); - } -if (wc->low_wm_percent_set && !wc->cleaner) { - x = (uint64_t )wc->freelist_low_watermark *100 ; - x += wc->n_blocks /2 ; -do_div (x, (size_t )wc->n_blocks); -DMEMIT (" low_watermark %u" ,100 - (unsigned )x); - } +if (wc->high_wm_percent_set) +DMEMIT (" high_watermark %u" , wc->high_wm_percent_value); +if (wc->low_wm_percent_set) +DMEMIT (" low_watermark %u" , wc->low_wm_percent_value);if (wc->max_writeback_jobs_set)DMEMIT (" writeback_jobs %u" , wc->max_writeback_jobs);if (wc->autocommit_blocks_set)DMEMIT (" autocommit_blocks %u" , wc->autocommit_blocks);if (wc->autocommit_time_set) -DMEMIT (" autocommit_time %u" ,jiffies_to_msecs (wc->autocommit_jiffies)); -if (wc->max_age !=MAX_AGE_UNSPECIFIED ) -DMEMIT (" max_age %u" ,jiffies_to_msecs (wc->max_age)); -if (wc->cleaner) +DMEMIT (" autocommit_time %u" , wc->autocommit_time_value); +if (wc->max_age_set) +DMEMIT (" max_age %u" , wc->max_age_value); +if (wc->cleaner_set)DMEMIT (" cleaner" );if (wc->writeback_fua_set)DMEMIT (" %sfua" , wc->writeback_fua ?"" :"no" );
@@ -2517,7 +2523,7 @@ static void writecache_status(struct dm_target *ti, status_type_t type,static struct target_type writecache_target = { .name ="writecache" , - .version = {1 ,3 ,0 }, + .version = {1 ,4 ,0 }, .module =THIS_MODULE , .ctr = writecache_ctr, .dtr = writecache_dtr,
Mikulas Patocka
maintainerQuoted 9 lines · On Mon, 1 Mar 2021, [email protected] wrote:
The patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.thanks,
greg k-h
Hi
This is backport of the patch 054bee16163df023e2589db09fd27d81f7ad9e72 for the stable branches 4.19 and 5.4.
Mikulas
commit 054bee16163df023e2589db09fd27d81f7ad9e72
Author: Mikulas Patocka <[email protected]> Date: Thu Feb 4 05:20:52 2021 -0500
dm writecache: return the exact table values that were set
LVM doesn't like it when the target returns different values from what was set in the constructor. Fix dm-writecache so that the returned table values are exactly the same as requested values.
--- drivers/md/dm-writecache.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/md/dm-writecache.c +16 -16
@@ -154,6 +154,7 @@ struct dm_writecache { bool overwrote_committed:1; bool memory_vmapped:1; + bool start_sector_set:1; bool high_wm_percent_set:1; bool low_wm_percent_set:1; bool max_writeback_jobs_set:1;
@@ -162,6 +163,10 @@ struct dm_writecache { bool writeback_fua_set:1; bool flush_on_suspend:1; +unsigned high_wm_percent_value; +unsigned low_wm_percent_value; +unsigned autocommit_time_value; +unsigned writeback_all;struct workqueue_struct *writeback_wq;struct work_struct writeback_work;
@@ -2069,6 +2074,7 @@ static int writecache_ctr(struct dm_targif (sscanf (string,"%llu%c" , &start_sector, &dummy) !=1 ) goto invalid_optional; wc->start_sector = start_sector; + wc->start_sector_set = true;if (wc->start_sector != start_sector || wc->start_sector >= wc->memory_map_size >>SECTOR_SHIFT ) goto invalid_optional;
@@ -2078,6 +2084,7 @@ static int writecache_ctr(struct dm_targ goto invalid_optional;if (high_wm_percent <0 || high_wm_percent >100 ) goto invalid_optional; + wc->high_wm_percent_value = high_wm_percent; wc->high_wm_percent_set = true; }else if (!strcasecmp (string,"low_watermark" ) && opt_params >=1 ) { string =dm_shift_arg (&as), opt_params--;
@@ -2085,6 +2092,7 @@ static int writecache_ctr(struct dm_targ goto invalid_optional;if (low_wm_percent <0 || low_wm_percent >100 ) goto invalid_optional; + wc->low_wm_percent_value = low_wm_percent; wc->low_wm_percent_set = true; }else if (!strcasecmp (string,"writeback_jobs" ) && opt_params >=1 ) { string =dm_shift_arg (&as), opt_params--;
@@ -2104,6 +2112,7 @@ static int writecache_ctr(struct dm_targif (autocommit_msecs >3600000 ) goto invalid_optional; wc->autocommit_jiffies =msecs_to_jiffies (autocommit_msecs); + wc->autocommit_time_value = autocommit_msecs; wc->autocommit_time_set = true; }else if (!strcasecmp (string,"fua" )) {if (WC_MODE_PMEM (wc)) {
@@ -2305,7 +2314,6 @@ static void writecache_status(struct dm_struct dm_writecache *wc = ti->private;unsigned extra_args;unsigned sz =0 ; -uint64_t x;switch (type) {case STATUSTYPE_INFO :
@@ -2317,7 +2325,7 @@ static void writecache_status(struct dm_DMEMIT ("%c %s %s %u " ,WC_MODE_PMEM (wc) ?'p' :'s' , wc->dev->name, wc->ssd_dev->name, wc->block_size); extra_args =0 ; -if (wc->start_sector) +if (wc->start_sector_set) extra_args +=2 ;if (wc->high_wm_percent_set) extra_args +=2 ;
@@ -2333,26 +2341,18 @@ static void writecache_status(struct dm_ extra_args++;DMEMIT ("%u" , extra_args); -if (wc->start_sector) +if (wc->start_sector_set)DMEMIT (" start_sector %llu" , (unsigned long long )wc->start_sector); -if (wc->high_wm_percent_set) { - x = (uint64_t )wc->freelist_high_watermark *100 ; - x += wc->n_blocks /2 ; -do_div (x, (size_t )wc->n_blocks); -DMEMIT (" high_watermark %u" ,100 - (unsigned )x); - } -if (wc->low_wm_percent_set) { - x = (uint64_t )wc->freelist_low_watermark *100 ; - x += wc->n_blocks /2 ; -do_div (x, (size_t )wc->n_blocks); -DMEMIT (" low_watermark %u" ,100 - (unsigned )x); - } +if (wc->high_wm_percent_set) +DMEMIT (" high_watermark %u" , wc->high_wm_percent_value); +if (wc->low_wm_percent_set) +DMEMIT (" low_watermark %u" , wc->low_wm_percent_value);if (wc->max_writeback_jobs_set)DMEMIT (" writeback_jobs %u" , wc->max_writeback_jobs);if (wc->autocommit_blocks_set)DMEMIT (" autocommit_blocks %u" , wc->autocommit_blocks);if (wc->autocommit_time_set) -DMEMIT (" autocommit_time %u" ,jiffies_to_msecs (wc->autocommit_jiffies)); +DMEMIT (" autocommit_time %u" , wc->autocommit_time_value);if (wc->writeback_fua_set)DMEMIT (" %sfua" , wc->writeback_fua ?"" :"no" );break ;
Greg KH
maintainerQuoted 10 lines · Mikulas Patocka
Quoted 6 lines · On Mon, 1 Mar 2021, [email protected] wrote:
The patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
Quoted 8 lines
Quoted 3 lines
thanks,
greg k-h
Hi
This is backport of the patch
054bee16163df023e2589db09fd27d81f7ad9e72for the stable branches 4.19 and 5.4.
Now queued up, thanks.
greg k-h