@@ -149,6 +149,7 @@ struct dm_writecache {
bool pmem_mode:1;
bool writeback_fua:1;
+ bool pmem_reinit:1;
bool overwrote_committed:1;
bool memory_vmapped:1;
@@ -2026,6 +2027,10 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv)
wc->writeback_fua = false;
wc->writeback_fua_set = true;
} else goto invalid_optional;
+ } else if (!strcasecmp(string, "reinit")) {
+ if (WC_MODE_PMEM(wc))
+ wc->pmem_reinit = true;
+ else goto invalid_optional;
} else {
invalid_optional:
r = -EINVAL;
@@ -2127,7 +2132,7 @@ static int writecache_ctr(struct dm_target *ti, unsigned argc, char **argv)
ti->error = "Hardware memory error when reading superblock";
goto bad;
}
- if (!le32_to_cpu(s.magic) && !le32_to_cpu(s.version)) {
+ if (wc->pmem_reinit || (!le32_to_cpu(s.magic) && !le32_to_cpu(s.version))) {
r = init_memory(wc);
if (r) {
ti->error = "Unable to initialize device";