Blame SOURCES/device-mapper-persistent-data-cache_restore-fix-metadata-version-and-clean-shutdown.patch

25ad42
 caching/cache_restore.cc   | 5 +++--
25ad42
 caching/restore_emitter.cc | 4 ++--
25ad42
 caching/restore_emitter.h  | 8 +++++++-
25ad42
 3 files changed, 12 insertions(+), 5 deletions(-)
25ad42
25ad42
diff --git a/caching/cache_restore.cc b/caching/cache_restore.cc
25ad42
index f62306d..e430c11 100644
25ad42
--- a/caching/cache_restore.cc
25ad42
+++ b/caching/cache_restore.cc
25ad42
@@ -69,8 +69,9 @@ namespace {
25ad42
 		try {
25ad42
 			block_manager<>::ptr bm = open_bm(*fs.output, block_manager<>::READ_WRITE);
25ad42
 			metadata::ptr md(new metadata(bm, metadata::CREATE));
25ad42
-			emitter::ptr restorer = create_restore_emitter(md, fs.clean_shutdown,
25ad42
-								       fs.metadata_version);
25ad42
+			emitter::ptr restorer = create_restore_emitter(md,
25ad42
+								       fs.metadata_version,
25ad42
+								       fs.clean_shutdown ? CLEAN_SHUTDOWN : NO_CLEAN_SHUTDOWN);
25ad42
 
25ad42
 			check_file_exists(*fs.input);
25ad42
 			ifstream in(fs.input->c_str(), ifstream::in);
25ad42
diff --git a/caching/restore_emitter.cc b/caching/restore_emitter.cc
25ad42
index 34c5020..b7a573f 100644
25ad42
--- a/caching/restore_emitter.cc
25ad42
+++ b/caching/restore_emitter.cc
25ad42
@@ -115,9 +115,9 @@ namespace {
25ad42
 
25ad42
 emitter::ptr
25ad42
 caching::create_restore_emitter(metadata::ptr md, unsigned metadata_version,
25ad42
-				bool clean_shutdown)
25ad42
+				shutdown_type st)
25ad42
 {
25ad42
-	return emitter::ptr(new restorer(md, clean_shutdown, metadata_version));
25ad42
+	return emitter::ptr(new restorer(md, st == CLEAN_SHUTDOWN, metadata_version));
25ad42
 }
25ad42
 
25ad42
 //----------------------------------------------------------------
25ad42
diff --git a/caching/restore_emitter.h b/caching/restore_emitter.h
25ad42
index 5c077af..a1d45d6 100644
25ad42
--- a/caching/restore_emitter.h
25ad42
+++ b/caching/restore_emitter.h
25ad42
@@ -7,9 +7,15 @@
25ad42
 //----------------------------------------------------------------
25ad42
 
25ad42
 namespace caching {
25ad42
+
25ad42
+	enum shutdown_type {
25ad42
+		CLEAN_SHUTDOWN,
25ad42
+		NO_CLEAN_SHUTDOWN
25ad42
+	};
25ad42
+
25ad42
 	emitter::ptr create_restore_emitter(metadata::ptr md,
25ad42
 					    unsigned metadata_version,
25ad42
-					    bool clean_shutdown = true);
25ad42
+					    shutdown_type st = CLEAN_SHUTDOWN);
25ad42
 }
25ad42
 
25ad42
 //----------------------------------------------------------------