lkml.org 
[lkml]   [2013]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
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@oracle.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;

\
 
 \ /
  Last update: 2013-05-09 23:01    [W:0.072 / U:1.816 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site