Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5193967rwl; Tue, 11 Apr 2023 01:37:59 -0700 (PDT) X-Google-Smtp-Source: AKy350YYloz4+425ilxm0PICjIzupx5UubTC0B+fv2tSkn/wGYlTTAtwNmKY3zoTa93rNQcgwlrl X-Received: by 2002:a17:903:28cb:b0:1a5:2585:d09f with SMTP id kv11-20020a17090328cb00b001a52585d09fmr11681664plb.12.1681202279201; Tue, 11 Apr 2023 01:37:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681202279; cv=none; d=google.com; s=arc-20160816; b=Xai61EPpF1Zeg0iecdSa4PUP3nbSwOZ3UtlNyLVZEj8eNn1Lxx9iWcQP/OWOGDA+aG bP3A52ObMBgYbUwSrPyX0rY/rkLcVcWFXtwFsXhaKXdLeJy09cJzKndBlV7zM+PbdZVi 7iOofNCSkrcqALEBeULwQqsQRK1B2P5AJXs/lKMT+VTlzclHFGgpFQKNoFsvKfJrng7X pDim6UWb56EbDjKnYPyIlEwpZ5ZiiojJRX4X2IRYFiWnNOtKr4KzKEK87tNmXs7zmIiW nqTvKxXdC73h+ZIyBRBBmloMJdKfuZ6tZ56pE74evi/HCN2fPSqxjeCWLMSpfiQVawW7 cWpA== 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=55GHC0W6WwYl1hL4fXaluEU5ovMdkhFgXOcwCrD1FTg=; b=MDHfFh4tCB3g8Sy289Xzqcgwyz0M5eA2/Olyu+nQH/Spw7uEHZeUWrEcubZwN6DewY 0IFv37X1fcs1qyKM1HXddeJJ5O8PhtZp10joAgdYCvb6vpqSVVZQ31hgkuHHp8d85Vfm VMNcNmBLg2ZgATvnX9dpqxGvajE8hATTzGDRa0tEnMquzoCE0MnOlLP3tTUbn3Guihb+ Do2pKH+v7CyPJqMxdwjPooBoxQPRq1FSR3SLI6RKAU/l1lTAEQQOf8J220yRg0yrxTPb UJa3AwnfDnaf+BNDHeiWQyEJzlxXNJ0fBl0lYS5KfYlkR4twep2C2aq5jegZArMJN1b8 ncxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BC5Z3xpJ; 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 q22-20020a170902bd9600b001a04202f77bsi12913727pls.431.2023.04.11.01.37.47; Tue, 11 Apr 2023 01:37:59 -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=BC5Z3xpJ; 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 S230316AbjDKIhS (ORCPT + 99 others); Tue, 11 Apr 2023 04:37:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230355AbjDKIhP (ORCPT ); Tue, 11 Apr 2023 04:37:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CC3F30FA for ; Tue, 11 Apr 2023 01:37:10 -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 E1281622D7 for ; Tue, 11 Apr 2023 08:37:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8896DC433EF; Tue, 11 Apr 2023 08:37:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681202229; bh=wOKAV9W48PUCbJhAWm/aGptDEIS+77Kp1nJ77iUN0h8=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=BC5Z3xpJs3+8JSw+1JjCMvvigAq7cu/9pYu38TRi5o5+4I8Wv75Rt8GnQc/cA5bRh jTQWRE+iVhf9cG2mE6EnTkUD9iYw4TfeP0g/dl5jixsMs5uLC3/g0Lo0UAxdF4dYed S2gzhN23qrT2DTSR5dozsFzOsfFuGPFatR8H/WTydSHS9LE+sM32+v39r9STL8u09u CzkcqKQuUuuZU43kARD4mkEwzao1hiq8IeowyjxLmAAeoOOZqPp0BUIg2y/3U47UIG 4rBOaNEbdI0lHcD28RBj173hNI/KEz0/YlJKON4FvR+XND7FAacLWvSotdx0ARXuA6 yfiVIusZbOyng== Message-ID: <05690b56-e7e2-14d5-7a56-00bcddc61c78@kernel.org> Date: Tue, 11 Apr 2023 16:37:06 +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 2/2] f2fs: clean up with {attach,detach}_page_private() 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> <20230410022418.1843178-2-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=-7.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, 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:47, Jaegeuk Kim wrote: > On 04/10, Chao Yu wrote: >> No logic changes. >> >> Signed-off-by: Chao Yu >> --- >> fs/f2fs/f2fs.h | 32 ++++++++------------------------ >> 1 file changed, 8 insertions(+), 24 deletions(-) >> >> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h >> index ec8387da7f74..c378aedcadea 100644 >> --- a/fs/f2fs/f2fs.h >> +++ b/fs/f2fs/f2fs.h >> @@ -1416,11 +1416,8 @@ static inline bool page_private_##name(struct page *page) \ >> #define PAGE_PRIVATE_SET_FUNC(name, flagname) \ >> static inline void set_page_private_##name(struct page *page) \ >> { \ >> - if (!PagePrivate(page)) { \ >> - get_page(page); \ >> - SetPagePrivate(page); \ >> - set_page_private(page, 0); \ >> - } \ >> + if (!PagePrivate(page)) \ >> + attach_page_private(page, (void *)page->private); \ > > attach_page_private(page, (void *)0); Correct, thanks for fixing this. Thanks, > >> set_bit(PAGE_PRIVATE_NOT_POINTER, &page_private(page)); \ >> set_bit(PAGE_PRIVATE_##flagname, &page_private(page)); \ >> } >> @@ -1429,13 +1426,8 @@ static inline void set_page_private_##name(struct page *page) \ >> static inline void clear_page_private_##name(struct page *page) \ >> { \ >> clear_bit(PAGE_PRIVATE_##flagname, &page_private(page)); \ >> - if (page_private(page) == BIT(PAGE_PRIVATE_NOT_POINTER)) { \ >> - set_page_private(page, 0); \ >> - if (PagePrivate(page)) { \ >> - ClearPagePrivate(page); \ >> - put_page(page); \ >> - }\ >> - } \ >> + if (page_private(page) == BIT(PAGE_PRIVATE_NOT_POINTER)) \ >> + detach_page_private(page); \ >> } >> >> PAGE_PRIVATE_GET_FUNC(nonpointer, NOT_POINTER); >> @@ -1464,11 +1456,8 @@ static inline unsigned long get_page_private_data(struct page *page) >> >> static inline void set_page_private_data(struct page *page, unsigned long data) >> { >> - if (!PagePrivate(page)) { >> - get_page(page); >> - SetPagePrivate(page); >> - set_page_private(page, 0); >> - } >> + if (!PagePrivate(page)) >> + attach_page_private(page, 0); >> set_bit(PAGE_PRIVATE_NOT_POINTER, &page_private(page)); >> page_private(page) |= data << PAGE_PRIVATE_MAX; >> } >> @@ -1476,13 +1465,8 @@ static inline void set_page_private_data(struct page *page, unsigned long data) >> static inline void clear_page_private_data(struct page *page) >> { >> page_private(page) &= GENMASK(PAGE_PRIVATE_MAX - 1, 0); >> - if (page_private(page) == BIT(PAGE_PRIVATE_NOT_POINTER)) { >> - set_page_private(page, 0); >> - if (PagePrivate(page)) { >> - ClearPagePrivate(page); >> - put_page(page); >> - } >> - } >> + if (page_private(page) == BIT(PAGE_PRIVATE_NOT_POINTER)) >> + detach_page_private(page); >> } >> >> /* For compression */ >> -- >> 2.25.1