From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C24D2C433ED for ; Mon, 12 Apr 2021 01:54:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8C64761027 for ; Mon, 12 Apr 2021 01:54:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236245AbhDLByu (ORCPT ); Sun, 11 Apr 2021 21:54:50 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:16437 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235543AbhDLByq (ORCPT ); Sun, 11 Apr 2021 21:54:46 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4FJWvJ5xxlzwRFQ; Mon, 12 Apr 2021 09:52:12 +0800 (CST) Received: from [10.67.77.175] (10.67.77.175) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.498.0; Mon, 12 Apr 2021 09:54:20 +0800 Subject: Re: [PATCH] fs/buffer.c: Delete redundant uptodate check for buffer To: , CC: Yang Guo , Alexander Viro , Andrew Morton References: <1617260222-13797-1-git-send-email-zhangshaokun@hisilicon.com> From: Shaokun Zhang Message-ID: Date: Mon, 12 Apr 2021 09:54:20 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <1617260222-13797-1-git-send-email-zhangshaokun@hisilicon.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.77.175] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org +Cc: Andrew Morton On 2021/4/1 14:57, Shaokun Zhang wrote: > From: Yang Guo > > The buffer uptodate state has been checked in function set_buffer_uptodate, > there is no need use buffer_uptodate before calling set_buffer_uptodate and > delete it. > > Cc: Alexander Viro > Signed-off-by: Yang Guo > Signed-off-by: Shaokun Zhang > --- > fs/buffer.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/fs/buffer.c b/fs/buffer.c > index 673cfbef9eec..2c0d0b3f3203 100644 > --- a/fs/buffer.c > +++ b/fs/buffer.c > @@ -2055,8 +2055,7 @@ int __block_write_begin_int(struct page *page, loff_t pos, unsigned len, > block_end = block_start + blocksize; > if (block_end <= from || block_start >= to) { > if (PageUptodate(page)) { > - if (!buffer_uptodate(bh)) > - set_buffer_uptodate(bh); > + set_buffer_uptodate(bh); > } > continue; > } > @@ -2088,8 +2087,7 @@ int __block_write_begin_int(struct page *page, loff_t pos, unsigned len, > } > } > if (PageUptodate(page)) { > - if (!buffer_uptodate(bh)) > - set_buffer_uptodate(bh); > + set_buffer_uptodate(bh); > continue; > } > if (!buffer_uptodate(bh) && !buffer_delay(bh) && >