From patchwork Thu May 9 20:47:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 2545701 Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by patchwork1.kernel.org (Postfix) with ESMTP id 472873FC5A for ; Thu, 9 May 2013 20:51:08 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r49KlweN027977; Thu, 9 May 2013 16:47:58 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r49Klu4p026069 for ; Thu, 9 May 2013 16:47:56 -0400 Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.20]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r49Klu3m008672; Thu, 9 May 2013 16:47:56 -0400 Received: from aserp1040.oracle.com (aserp1040.oracle.com [141.146.126.69]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r49Kltqx012248; Thu, 9 May 2013 16:47:55 -0400 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r49KlsMR011571 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 9 May 2013 20:47:55 GMT Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r49KlrIT010693 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Thu, 9 May 2013 20:47:54 GMT Received: from abhmt105.oracle.com (abhmt105.oracle.com [141.146.116.57]) by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r49Klq5B005143; Thu, 9 May 2013 20:47:53 GMT Received: from localhost (/10.145.179.107) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 09 May 2013 13:47:52 -0700 Date: Thu, 9 May 2013 13:47:51 -0700 From: "Darrick J. Wong" To: Mike Snitzer Message-ID: <20130509204751.GB5712@blackbox.djwong.org> References: <20130508214845.GA7729@blackbox.djwong.org> <20130508220526.GA24132@redhat.com> <20130509203616.GA5713@blackbox.djwong.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20130509203616.GA5713@blackbox.djwong.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-RedHat-Spam-Score: -105.458 (BAYES_00, DCC_REPUT_13_19, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, SPF_PASS, UNPARSEABLE_RELAY, URIBL_BLOCKED, USER_IN_WHITELIST) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.20 X-loop: dm-devel@redhat.com Cc: device-mapper development , Joe Thornber , linux-kernel@vger.kernel.org Subject: [dm-devel] [PATCH 2/2] dmcache: Implement a flush message X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com 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 --- drivers/md/dm-cache-target.c | 4 ++++ 1 file changed, 4 insertions(+) -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel 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;