Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4717130ybv; Mon, 17 Feb 2020 04:36:45 -0800 (PST) X-Google-Smtp-Source: APXvYqxFsGAe99jcW9232WooNb3Qkk6ekJBdBdkubR7tfRzyf2Zt8jPYTmEioJa6ZnVHUva/PGBF X-Received: by 2002:a9d:3f5:: with SMTP id f108mr12313955otf.103.1581943005614; Mon, 17 Feb 2020 04:36:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581943005; cv=none; d=google.com; s=arc-20160816; b=x0LToks1UIoIUXkZiJ8qvr4J0iXKAPWtqCx1Xy5zrFbwEBKvKqD1ZrmwtLJA+Pq6TI LC1Eo7LiCtSEQIzhYaBjQrpMYLuc+B8TBEWc5h9fphKWXPXePoArjko4hPUHjC1+EZsx JDfy0yEhuCcl85x/y/ofTaUCyB+8LCGtkIxXZWhZiOLG0p0bmQykriLLo35PeF+TFRBE MnR5/aUOhc70en56XrLEmTshlHuKh1KuaU7G+UaQnzk6qy0u5RlY2XcHV/oPxvJTPwsH zfAVnNy0cTd1Cl+Hnle2D8OUuKHZHP4h0sxn/OIB88S4HB2WwG9bUAHs3uAS0y1aZZ5h Kuxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=eHA9W2jbZ0ByqfElq+5j0mbYOuaET1FnDZtkej1UHRM=; b=ZMs4JkhFz6kWXnWuhES+QXnDKCm/+JRIX58MuIQSMpxVUBzJTRbe5vIv5gkEJ9ajx4 PxLcU+a/VYT1lDz0JgQ0sKBhv7DanihtwE884+Fjel+8+akzixwzvYN/sQSIqBYKiEDR fAyd6TRzrWCK5bLOKSEZN/PKdRhFAmZHfqhs5rHpsYgzUdF7ElvP+7Cx9RCRInxAUtrg iHf0R+yHCeQH5ye7nTNJe7Cxa+zzuA4A2ZYKkUy0sDloYfpWmeofS3bHj1AE3HzPUBMb nrKL/DBrFTnzFOCeFsK/2SGpcvcrzPNADJPllC6fuvdZVqjYBGK1ab6ndgU+PRCEdRDD g59A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r6si142410otp.220.2020.02.17.04.36.24; Mon, 17 Feb 2020 04:36:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728076AbgBQL2X (ORCPT + 99 others); Mon, 17 Feb 2020 06:28:23 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:52642 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726558AbgBQL2X (ORCPT ); Mon, 17 Feb 2020 06:28:23 -0500 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 50FA7E43C055C908BD9B; Mon, 17 Feb 2020 19:28:20 +0800 (CST) Received: from huawei.com (10.175.124.28) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.439.0; Mon, 17 Feb 2020 19:28:13 +0800 From: "zhangyi (F)" To: CC: , , Subject: [PATCH] jbd2: improve comments about freeing data buffers whose page mapping is NULL Date: Mon, 17 Feb 2020 19:27:06 +0800 Message-ID: <20200217112706.20085-1-yi.zhang@huawei.com> X-Mailer: git-send-email 2.17.2 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.124.28] X-CFilter-Loop: Reflected Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Improve comments in jbd2_journal_commit_transaction() to describe why we don't need to clear the buffer_mapped bit for freeing file mapping buffers whose page mapping is NULL. Fixes: c96dceeabf76 ("jbd2: do not clear the BH_Mapped flag when forgetting a metadata buffer") Signed-off-by: zhangyi (F) Suggested-by: Jan Kara --- fs/jbd2/commit.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index 27373f5792a4..e855d8260433 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c @@ -997,9 +997,10 @@ void jbd2_journal_commit_transaction(journal_t *journal) * journalled data) we need to unmap buffer and clear * more bits. We also need to be careful about the check * because the data page mapping can get cleared under - * out hands, which alse need not to clear more bits - * because the page and buffers will be freed and can - * never be reused once we are done with them. + * our hands. Note that if mapping == NULL, we don't + * need to make buffer unmapped because the page is + * already detached from the mapping and buffers cannot + * get reused. */ mapping = READ_ONCE(bh->b_page->mapping); if (mapping && !sb_is_blkdev_sb(mapping->host->i_sb)) { -- 2.17.2