Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5191048rwl; Tue, 11 Apr 2023 01:34:45 -0700 (PDT) X-Google-Smtp-Source: AKy350awAipxFIx4GtOMgKhW1MRHmD6OPoElrxOleU7qLtCaow/k9EecVK1vGWS4JXO55HO/8Nze X-Received: by 2002:a17:90b:1c8f:b0:246:b450:cafe with SMTP id oo15-20020a17090b1c8f00b00246b450cafemr3306612pjb.30.1681202085333; Tue, 11 Apr 2023 01:34:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681202085; cv=none; d=google.com; s=arc-20160816; b=Bf+d0GZLoQtfQR3De1AMFOU09pbRfnGiPSUins/Wv5DXP/cxgGDKq71HkqcEnYCKr+ S+LySuUCKnITYAQWXGKnf4v5YnEGI/mbm3J70F2JSco6T5L3u6xtz8KQDHe7Qep7Wpi/ W+bzKQiqhrZ9GJl5+AsB+1el44gZkKuI6GX4ulHbj5mjOgeRiKHtVWpySdZZgUwVB0eY 1z+dzLKC5hx8IqKGpEPu9KoHo3b/9+ZMgOn68mtG1q7kUxGWJgoi2bcscDXyBSaKztK6 mmObvHQJqhTAbAlHpLiuTFH2IPsQ3svd953gKpZSmq53sqOE4nyQzALaeUUkqBj+UQvE x8+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=IHn9Eh6lalkW9vp9xVUsOmwR2nhtJNphD3AaGBeffUI=; b=drRUXAYKGsM9oHngl0bFGP6xE6jQoFTipuoRafixikcjt45xEgxYpfq7Kk4nmB4c9G 5Xoe7TJiXafOtA2ES6pgtVD4Be4YLg7iWX6oSmupChXQWavmBr6G0mHEKspjublE1FnS T5BDrBnr8k+KT27Gnqoua8KCL516d/uJl41SYi/CQEKsvhUWdnSMnhrR84lS4kaq9pwq 2SA+xz4oODGYArEziz9LpnlHDHZHO1lDDwZXbPSAYvL9sd1jGrO5O8xgcGUIj8Xfu7p1 YpyZ+4ejKz5b3HThjUSrUmWrtmHSmcbfGXa3s5DC7A1AH+pT5BP2/agc9CH579oO3aah KCIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=igmrbDkV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gt17-20020a17090af2d100b0024693539558si6157489pjb.83.2023.04.11.01.34.32; Tue, 11 Apr 2023 01:34:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=igmrbDkV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230245AbjDKIeZ (ORCPT + 99 others); Tue, 11 Apr 2023 04:34:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230471AbjDKIeX (ORCPT ); Tue, 11 Apr 2023 04:34:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B976D40DD for ; Tue, 11 Apr 2023 01:34:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5754C61E67 for ; Tue, 11 Apr 2023 08:34:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E86D2C433EF; Tue, 11 Apr 2023 08:34:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681202048; bh=vWRd0M+XDT89DUaEUaER2lgBgrSKrR9GWjWJ1XatS1w=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=igmrbDkV7dy8imzW3rW9lvMJZtVqvlk/y2DUky4jxHWm1mbDe+Ddt/1OnbHeFEmbQ Eu1t4Do/9FznM383edvHbCxoRfcha8jKCVJitNm2ohnWBfwid0v2KbBDQwb7UQ2kJb x2PH9F8hSurDKwSdVvEBRc6fNJIshKUz+4MahxCZf6KqAL3uoyivcW306YXuw79V5K qu3KfhgqjldXU4+PvMxa5/i3sdM+kWUzoTnXYmsJA3l62zxN/va34plc9VImY+fCAM cz0csbXi0FXsra5Ku3vvmHRFY64L8lHYZ8vYieRWwIKmGh8t9J8O+MBNam81o9i4VX VoDZW0AlMC1fw== Message-ID: Date: Tue, 11 Apr 2023 16:34:05 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [PATCH 1/2] f2fs: remove folio_detach_private() in .invalidate_folio and .release_folio Content-Language: en-US To: Jaegeuk Kim Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org References: <20230410022418.1843178-1-chao@kernel.org> From: Chao Yu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023/4/11 2:33, Jaegeuk Kim wrote: > On 04/10, Chao Yu wrote: >> We have maintain PagePrivate and page_private and page reference >> w/ {set,clear}_page_private_*, it doesn't need to call >> folio_detach_private() in the end of .invalidate_folio and >> .release_folio, remove it and use f2fs_bug_on instead. >> >> Signed-off-by: Chao Yu >> --- >> fs/f2fs/data.c | 7 +++++-- >> 1 file changed, 5 insertions(+), 2 deletions(-) >> >> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c >> index 4946df6dd253..8b179b4bdc03 100644 >> --- a/fs/f2fs/data.c >> +++ b/fs/f2fs/data.c >> @@ -3737,7 +3737,8 @@ void f2fs_invalidate_folio(struct folio *folio, size_t offset, size_t length) >> inode->i_ino == F2FS_COMPRESS_INO(sbi)) >> clear_page_private_data(&folio->page); >> >> - folio_detach_private(folio); >> + f2fs_bug_on(sbi, PagePrivate(&folio->page)); >> + f2fs_bug_on(sbi, page_private(&folio->page)); > > I think we can just check page_private() only. Why? how about the case PagePrivate was set, but page_private was't? It must be a bug as well? Thanks, > >> } >> >> bool f2fs_release_folio(struct folio *folio, gfp_t wait) >> @@ -3759,7 +3760,9 @@ bool f2fs_release_folio(struct folio *folio, gfp_t wait) >> clear_page_private_reference(&folio->page); >> clear_page_private_gcing(&folio->page); >> >> - folio_detach_private(folio); >> + f2fs_bug_on(sbi, PagePrivate(&folio->page)); >> + f2fs_bug_on(sbi, page_private(&folio->page)); >> + >> return true; >> } >> >> -- >> 2.25.1