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 Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BE98DC021AA for ; Fri, 21 Feb 2025 04:55:38 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1tlL4b-0004sn-Ad; Fri, 21 Feb 2025 04:55:36 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tlL4U-0004sc-MV for linux-f2fs-devel@lists.sourceforge.net; Fri, 21 Feb 2025 04:55:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=In-Reply-To:Content-Type:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=pDzCMNB4JM4Tu+Cwz6uhVkh3rFLcrdRL8yhtjBgWd4s=; b=gEDoY9pL8ZHf8LA7W3gRAuN2vZ 9gizus1T1+pH3/vaUpWKhLGor5lj8MoRWEdKIIkC1MaecGWYpx/ES0OdtsCgdFsfnnlM06QQZcKqq qHX/TqkgIFHHLrZXYBuASBnjEFYp4P80H5pVQwLiQsptCk+kxXxQdqyrJvjCjn+89n7o=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To :From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=pDzCMNB4JM4Tu+Cwz6uhVkh3rFLcrdRL8yhtjBgWd4s=; b=K1NKHW1Ktd1UveA9BE2RHWIZod qD+XxYVhbzBFk89Fjdehla8kQYkFxMLJGpOcjOrFvrBoZId6hK/l+idc7QpnZla1SzshyFLo4hb9c rtz8TFAkvF4z7UOIq9yeO8q2cpdOQ5sRu5H9xsY0xiM2G/SpaA093dn9Y52rRFCZgj00=; Received: from tor.source.kernel.org ([172.105.4.254]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1tlL4T-00044U-EU for linux-f2fs-devel@lists.sourceforge.net; Fri, 21 Feb 2025 04:55:30 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id DDA1F6111F; Fri, 21 Feb 2025 04:55:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E556C4CEE2; Fri, 21 Feb 2025 04:55:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740113718; bh=TRrzP0CzcVFMmpJmC4JuqExk9+bEFTrmjzrUl7P32zs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pREs7JkFO7CYYWH8ZpiN7cqx7xyHHCRaPb2iyeGo0yAlDCJtRaFsU4akHKcaEwXlG QHOqiH75KyJoSXzpBxSukeffFi/B3HcJEjLMArOOBCqtFf+i7gzHQI7Pd4Dj7sDE/n dbYDxP9h7sAWRC2hofXAIfLVb8t42TulN+taDuxEqU0K4IZVGVPp7c+xmRmtZ+ewSO yWH7vwPrXx6kF0CXRN1PNIKeo7K3ZDX1xtISS4YmYmxvo67ZnNdpu8dW3Huap10RZj ++yaDHIvpCLoVA/5LlxIvAkaR5p01adyV65/egDNhzeTc/90SJurTcb16i61yDAA6h zbwi7l/PDCOVA== Date: Fri, 21 Feb 2025 04:55:16 +0000 To: "Matthew Wilcox (Oracle)" Message-ID: References: <20250218055203.591403-1-willy@infradead.org> <20250218055203.591403-4-willy@infradead.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20250218055203.591403-4-willy@infradead.org> X-Headers-End: 1tlL4T-00044U-EU Subject: Re: [f2fs-dev] [PATCH 03/27] f2fs: Add f2fs_folio_put() X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Jaegeuk Kim via Linux-f2fs-devel Reply-To: Jaegeuk Kim Cc: linux-fsdevel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net On 02/18, Matthew Wilcox (Oracle) wrote: > Convert f2fs_put_page() to f2fs_folio_put() and add a wrapper. > Replaces three calls to compound_head() with one. > > Signed-off-by: Matthew Wilcox (Oracle) > --- > fs/f2fs/f2fs.h | 15 ++++++++++----- > 1 file changed, 10 insertions(+), 5 deletions(-) > > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h > index b05653f196dd..5e01a08afbd7 100644 > --- a/fs/f2fs/f2fs.h > +++ b/fs/f2fs/f2fs.h > @@ -2806,16 +2806,21 @@ static inline struct page *f2fs_pagecache_get_page( > return pagecache_get_page(mapping, index, fgp_flags, gfp_mask); > } > > -static inline void f2fs_put_page(struct page *page, int unlock) > +static inline void f2fs_folio_put(struct folio *folio, bool unlock) > { > - if (!page) > + if (!folio) > return; > > if (unlock) { > - f2fs_bug_on(F2FS_P_SB(page), !PageLocked(page)); > - unlock_page(page); > + f2fs_bug_on(F2FS_F_SB(folio), !folio_test_locked(folio)); > + folio_unlock(folio); > } > - put_page(page); > + folio_put(folio); > +} > + > +static inline void f2fs_put_page(struct page *page, int unlock) > +{ I got a kernel panic, since there are still several places to pass a null page pointer, which feeds to page_folio() which doesn't expect the null. Applying this can avoid the panic. if (!page) return; > + f2fs_folio_put(page_folio(page), unlock); > } > > static inline void f2fs_put_dnode(struct dnode_of_data *dn) > -- > 2.47.2 > _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DDC26F9D9 for ; Fri, 21 Feb 2025 04:55:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740113719; cv=none; b=Sk5KQSW40whFkGRPj6NtGTsupeTvci492wT28xiCp/wt1rA8sVWD+jJe4m9bu2eNCc2m+1TgtwukohS9s8fcLjEbKeroxR7QtP0BUQUkUUWnBaMHDsl3/jkng0ohgxA2ZV9vuKKQVeBPA9GVGyabRv51YPySSK3FmbfcCw48MN8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740113719; c=relaxed/simple; bh=TRrzP0CzcVFMmpJmC4JuqExk9+bEFTrmjzrUl7P32zs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=p38ZUnuB8SfOlsLcxs6LA2z4T+WcyDaKRtgVPIF/RZLeOpIJZB0lPN/5NlcHPuXe+7IpQcTEAJ22/zdkqD2LGCyq7XXTPxGkEPhpiKanOaQyGnI3ztYzb9edfNPsAVIrOeLqDwzNNGGkhb95IgMu2ktt6eiRWKeUcGp9nWd3WWk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pREs7JkF; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pREs7JkF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E556C4CEE2; Fri, 21 Feb 2025 04:55:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1740113718; bh=TRrzP0CzcVFMmpJmC4JuqExk9+bEFTrmjzrUl7P32zs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pREs7JkFO7CYYWH8ZpiN7cqx7xyHHCRaPb2iyeGo0yAlDCJtRaFsU4akHKcaEwXlG QHOqiH75KyJoSXzpBxSukeffFi/B3HcJEjLMArOOBCqtFf+i7gzHQI7Pd4Dj7sDE/n dbYDxP9h7sAWRC2hofXAIfLVb8t42TulN+taDuxEqU0K4IZVGVPp7c+xmRmtZ+ewSO yWH7vwPrXx6kF0CXRN1PNIKeo7K3ZDX1xtISS4YmYmxvo67ZnNdpu8dW3Huap10RZj ++yaDHIvpCLoVA/5LlxIvAkaR5p01adyV65/egDNhzeTc/90SJurTcb16i61yDAA6h zbwi7l/PDCOVA== Date: Fri, 21 Feb 2025 04:55:16 +0000 From: Jaegeuk Kim To: "Matthew Wilcox (Oracle)" Cc: Chao Yu , linux-f2fs-devel@lists.sourceforge.net, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH 03/27] f2fs: Add f2fs_folio_put() Message-ID: References: <20250218055203.591403-1-willy@infradead.org> <20250218055203.591403-4-willy@infradead.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250218055203.591403-4-willy@infradead.org> On 02/18, Matthew Wilcox (Oracle) wrote: > Convert f2fs_put_page() to f2fs_folio_put() and add a wrapper. > Replaces three calls to compound_head() with one. > > Signed-off-by: Matthew Wilcox (Oracle) > --- > fs/f2fs/f2fs.h | 15 ++++++++++----- > 1 file changed, 10 insertions(+), 5 deletions(-) > > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h > index b05653f196dd..5e01a08afbd7 100644 > --- a/fs/f2fs/f2fs.h > +++ b/fs/f2fs/f2fs.h > @@ -2806,16 +2806,21 @@ static inline struct page *f2fs_pagecache_get_page( > return pagecache_get_page(mapping, index, fgp_flags, gfp_mask); > } > > -static inline void f2fs_put_page(struct page *page, int unlock) > +static inline void f2fs_folio_put(struct folio *folio, bool unlock) > { > - if (!page) > + if (!folio) > return; > > if (unlock) { > - f2fs_bug_on(F2FS_P_SB(page), !PageLocked(page)); > - unlock_page(page); > + f2fs_bug_on(F2FS_F_SB(folio), !folio_test_locked(folio)); > + folio_unlock(folio); > } > - put_page(page); > + folio_put(folio); > +} > + > +static inline void f2fs_put_page(struct page *page, int unlock) > +{ I got a kernel panic, since there are still several places to pass a null page pointer, which feeds to page_folio() which doesn't expect the null. Applying this can avoid the panic. if (!page) return; > + f2fs_folio_put(page_folio(page), unlock); > } > > static inline void f2fs_put_dnode(struct dnode_of_data *dn) > -- > 2.47.2 >