[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130509204751.GB5712@blackbox.djwong.org>
Date: Thu, 9 May 2013 13:47:51 -0700
From: "Darrick J. Wong" <darrick.wong@...cle.com>
To: Mike Snitzer <snitzer@...hat.com>
Cc: device-mapper development <dm-devel@...hat.com>,
Joe Thornber <thornber@...hat.com>,
linux-kernel@...r.kernel.org
Subject: [PATCH 2/2] dmcache: Implement a flush message
Create a new 'flush' message that causes the dmcache to write all of its
metadata out to disk. This enables us to ensure that the disk reflects
whatever's in memory without having to tear down the cache device. This helps
me in the case where I have a cached ro fs that I can't umount and therefore
can't tear down the cache device, but want to save the cache metadata anyway.
The command syntax is as follows:
# dmsetup message mycache 0 flush now
Signed-off-by: Darrick J. Wong <darrick.wong@...cle.com>
---
drivers/md/dm-cache-target.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c
index 4fb7b4c..e26e5d2 100644
--- a/drivers/md/dm-cache-target.c
+++ b/drivers/md/dm-cache-target.c
@@ -2522,6 +2522,7 @@ err:
static int process_config_option(struct cache *cache, char **argv)
{
+ bool res;
unsigned long tmp;
if (!strcasecmp(argv[0], "migration_threshold")) {
@@ -2530,6 +2531,9 @@ static int process_config_option(struct cache *cache, char **argv)
cache->migration_threshold = tmp;
return 0;
+ } else if (!strcasecmp(argv[0], "flush")) {
+ res = sync_metadata(cache);
+ return res ? 0 : -EIO;
}
return NOT_CORE_OPTION;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists