From patchwork Wed Jul 23 07:43:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ma, Jianpeng" X-Patchwork-Id: 4609181 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 048FF9F37C for ; Wed, 23 Jul 2014 07:44:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 17A4A20107 for ; Wed, 23 Jul 2014 07:44:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EBC3D201C8 for ; Wed, 23 Jul 2014 07:44:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756914AbaGWHoO (ORCPT ); Wed, 23 Jul 2014 03:44:14 -0400 Received: from mga11.intel.com ([192.55.52.93]:62684 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932428AbaGWHnP convert rfc822-to-8bit (ORCPT ); Wed, 23 Jul 2014 03:43:15 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 23 Jul 2014 00:43:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,715,1400050800"; d="scan'208";a="565912750" Received: from fmsmsx108.amr.corp.intel.com ([10.19.9.228]) by fmsmga001.fm.intel.com with ESMTP; 23 Jul 2014 00:43:13 -0700 Received: from fmsmsx113.amr.corp.intel.com (10.18.116.7) by FMSMSX108.amr.corp.intel.com (10.19.9.228) with Microsoft SMTP Server (TLS) id 14.3.123.3; Wed, 23 Jul 2014 00:43:12 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX113.amr.corp.intel.com (10.18.116.7) with Microsoft SMTP Server (TLS) id 14.3.123.3; Wed, 23 Jul 2014 00:43:12 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.52]) by shsmsx102.ccr.corp.intel.com ([169.254.2.120]) with mapi id 14.03.0123.003; Wed, 23 Jul 2014 15:43:11 +0800 From: "Ma, Jianpeng" To: "sage@redhat.com" CC: "ceph-devel@vger.kernel.org" Subject: [PATCH] os/FileJournal: Update the journal header when closing journal Thread-Topic: [PATCH] os/FileJournal: Update the journal header when closing journal Thread-Index: Ac+mSWaEZoQnzF2ySheQ030SRCrpVA== Date: Wed, 23 Jul 2014 07:43:09 +0000 Message-ID: <6AA21C22F0A5DA478922644AD2EC308C895E17@SHSMSX101.ccr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When closing journal, it should check must_write_header and update journal header if must_write_header alreay set. It can reduce the nosense journal-replay after restarting osd. Signed-off-by: Ma Jianpeng --- src/os/FileJournal.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/src/os/FileJournal.cc b/src/os/FileJournal.cc index 7eb7927..5649e6d 100644 --- a/src/os/FileJournal.cc +++ b/src/os/FileJournal.cc @@ -544,6 +544,7 @@ void FileJournal::close() // close assert(writeq_empty()); + assert(!must_write_header); assert(fd >= 0); VOID_TEMP_FAILURE_RETRY(::close(fd)); fd = -1; @@ -1102,7 +1103,7 @@ void FileJournal::write_thread_entry() while (1) { { Mutex::Locker locker(writeq_lock); - if (writeq.empty()) { + if (writeq.empty() && !must_write_header) { if (write_stop) break; dout(20) << "write_thread_entry going to sleep" << dendl;