From patchwork Wed Oct 24 10:54:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shenghui Wang X-Patchwork-Id: 10655583 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 42EA213A4 for ; Thu, 25 Oct 2018 08:10:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 330972B0AF for ; Thu, 25 Oct 2018 08:10:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 268B22B0BE; Thu, 25 Oct 2018 08:10:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CADFA2B0AF for ; Thu, 25 Oct 2018 08:09:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id ACEDA308421A; Thu, 25 Oct 2018 08:09:58 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6463DBA60; Thu, 25 Oct 2018 08:09:58 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2BE0A180B5B7; Thu, 25 Oct 2018 08:09:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w9OAtdsC025412 for ; Wed, 24 Oct 2018 06:55:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 92E9217B61; Wed, 24 Oct 2018 10:55:39 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx18.extmail.prod.ext.phx2.redhat.com [10.5.110.47]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8D1145DA67 for ; Wed, 24 Oct 2018 10:55:37 +0000 (UTC) Received: from smtpbgsg2.qq.com (smtpbgsg2.qq.com [54.254.200.128]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 03137307B97B for ; Wed, 24 Oct 2018 10:55:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1540378506; bh=BQGYtWWwVY94Px5d3lvocBEkH6rNDX7Cfjc5rfspxBc=; h=From:To:Subject:Date:Message-Id; b=SL5FLog59FPKwawqwxupq47UIagKfEXLBv7uXbIjgBSDR4Zm9voxcF3In58dIBuog OkhDZYOco98X2MT3MeP6QqY0NK0Xt0uz/aKx8t+tlLd15yx+fn8vhmJQXVWzJS0hVR jEJ9GY2O5+wOu0ddGps4MPLqGn1k07sTnCzxsT0U= X-QQ-mid: esmtp3t1540378505trb17q9je Received: from localhost.localdomain (unknown [221.221.254.161]) by esmtp4.qq.com (ESMTP) with id ; Wed, 24 Oct 2018 18:54:56 +0800 (CST) X-QQ-SSF: 01000000000000F0FH4000000000000 X-QQ-FEAT: vusB/7NFgTudE2ZG0F6jxR/yUlnDjLbhv2WYynor5TMNN4QzbEufVWrwy7pFx T9T+xRJbqQ8+Tadn3YgqVjbuyxFEK5B4zi1W9TjvePwY3xYpco+kxCy8NUgZkTqK8JwpC2F fJt3UXPv8sP+aJfliuCGaN7SlpYzwy0BB15ywyt9os2dUYYtpWNSJCKqyxjexBZfzns2Ju0 NuJlr20IrWoBD/lynyBjnLbPuRKSR32S1XKSPKJsZ3a+Q0zm96UliahvZKfzCnksGd58arE sQPII+kJBoC2KSQPtNqQ2r3B129oVRlljjEw== X-QQ-GoodBg: 0 From: Shenghui Wang To: mpatocka@redhat.com, agk@redhat.com, snitzer@redhat.com, dm-devel@redhat.com Date: Wed, 24 Oct 2018 18:54:56 +0800 Message-Id: <20181024105456.3204-1-shhuiw@foxmail.com> X-QQ-SENDSIZE: 520 Feedback-ID: esmtp:foxmail.com:bgforeign:bgforeign4 X-QQ-Bgrelay: 1 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Wed, 24 Oct 2018 10:55:33 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Wed, 24 Oct 2018 10:55:33 +0000 (UTC) for IP:'54.254.200.128' DOMAIN:'smtpbgsg2.qq.com' HELO:'smtpbgsg2.qq.com' FROM:'shhuiw@foxmail.com' RCPT:'' X-RedHat-Spam-Score: -0.111 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS) 54.254.200.128 smtpbgsg2.qq.com 54.254.200.128 smtpbgsg2.qq.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.47 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Thu, 25 Oct 2018 04:02:53 -0400 Subject: [dm-devel] [PATCH] dm writecache: flush metadata in single commit in init_memory X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Thu, 25 Oct 2018 08:09:59 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP Do not flush sb ->magic in second commit. Signed-off-by: Shenghui Wang --- drivers/md/dm-writecache.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c index d656bd1799ae..8e9e96a22f68 100644 --- a/drivers/md/dm-writecache.c +++ b/drivers/md/dm-writecache.c @@ -1749,6 +1749,8 @@ static int init_memory(struct dm_writecache *wc) for (b = 0; b < ARRAY_SIZE(sb(wc)->padding); b++) pmem_assign(sb(wc)->padding[b], cpu_to_le64(0)); + + pmem_assign(sb(wc)->magic, cpu_to_le32(MEMORY_SUPERBLOCK_MAGIC)); pmem_assign(sb(wc)->version, cpu_to_le32(MEMORY_SUPERBLOCK_VERSION)); pmem_assign(sb(wc)->block_size, cpu_to_le32(wc->block_size)); pmem_assign(sb(wc)->n_blocks, cpu_to_le64(wc->n_blocks)); @@ -1759,9 +1761,6 @@ static int init_memory(struct dm_writecache *wc) writecache_flush_all_metadata(wc); writecache_commit_flushed(wc); - pmem_assign(sb(wc)->magic, cpu_to_le32(MEMORY_SUPERBLOCK_MAGIC)); - writecache_flush_region(wc, &sb(wc)->magic, sizeof sb(wc)->magic); - writecache_commit_flushed(wc); return 0; }