From patchwork Wed Apr 12 16:08:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaegeuk Kim X-Patchwork-Id: 13209316 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 759EDC77B6E for ; Wed, 12 Apr 2023 16:08:32 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1pmd1L-0003VA-I5; Wed, 12 Apr 2023 16:08:30 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pmd1K-0003V4-GN for linux-f2fs-devel@lists.sourceforge.net; Wed, 12 Apr 2023 16:08:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=bL7JW7lTDok36JATXOIdhDtgRJiR9tQwFaIM0C0N7Tw=; b=NUQ3VYnAsvwtSPret28cM251G9 54eHZ/LcsVsPVSsDZ1KpjGPQ0vWVj/k+KgH+YdTjBugqi6J738e/RskBlZSbfc9fUh3r6Mr4IcM7T kLluPZDc8HEUNiHkQP5nOHV7+/etSilZEt5r9ALVmkWFTh37wapePqn2iwoDrHiiNvbE=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From :Sender:Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=bL7JW7lTDok36JATXOIdhDtgRJiR9tQwFaIM0C0N7Tw=; b=W /V96qHoHGNLpwW3MbcypmqoQYqFpn2pNWQCiJis0azL2PnwnPd2w2fjSD1qbHFpT6fg0N+6yG8P5n sUW7ZRwzcYLYwA/V87QvSghq5fwQ9/uypmQcEugIHF3AQmFbu2gJLybi9T8xeijg32SVv3MkCIaOf z/0rS9kuNWCsQN+M=; Received: from dfw.source.kernel.org ([139.178.84.217]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1pmd1I-005RHm-Ec for linux-f2fs-devel@lists.sourceforge.net; Wed, 12 Apr 2023 16:08:29 +0000 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 32753636BC for ; Wed, 12 Apr 2023 16:08:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DED6C433EF; Wed, 12 Apr 2023 16:08:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681315701; bh=8XI4VwX95L0aDd5aZfR4XLw/V4QhNPw/aWXcf8kuWVA=; h=From:To:Cc:Subject:Date:From; b=nvruxvKHd7lTHzaainaw/rcOvL1cB+msXQGIwwJMdiXF6DS+qiScPwmjLT7AeN6e3 YKiBXJxocqpa8nLtvoJOesaGOdULmPEIagNRsx1b8kOZ9ayF8UvFyL98l+r4aGIy72 h8HC6Ls3rzvHcoQeWcEkiXmk3s0zX+UgoyRelhUg+GpJgSN46cEd0gAGFfeNFVRt5J oTeyk+CRAXS2IcexL1AoJKOZKPgL0MGHuu7z0nYbXruqZKi+J/R461jFek4SMxaZ6G ckvmuIN95v8e+b/YmOiovuWlS4UxKMAlSoG+0F5fnHy9QCLXRUEgOcQqtOWGl7A2Rg QhBsQ2PrW59yQ== From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Date: Wed, 12 Apr 2023 09:08:09 -0700 Message-Id: <20230412160810.1534632-1-jaegeuk@kernel.org> X-Mailer: git-send-email 2.40.0.577.gac1e443424-goog MIME-Version: 1.0 X-Headers-End: 1pmd1I-005RHm-Ec Subject: [f2fs-dev] [PATCH 1/2] f2fs: remove set|get_private_inline to clean up 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: , Cc: Jaegeuk Kim Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net 2049d4fcb057 ("f2fs: avoid multiple node page writes due to inline_data") introduced flushing inline_data when flushing node pages. b763f3bedc2d ("f2fs: restructure f2fs page.private layout") Replace PageChecked with PagePrivate But, it turned out the bit was not cleared in corner case. Let's revert the original hack and rely on the generic write path to flush inline_data. Fixes: 2049d4fcb057 ("f2fs: avoid multiple node page writes due to inline_data") Fixes: b763f3bedc2d ("f2fs: restructure f2fs page.private layout") Signed-off-by: Jaegeuk Kim Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim --- fs/f2fs/data.c | 2 -- fs/f2fs/f2fs.h | 9 ++------- fs/f2fs/inline.c | 2 -- fs/f2fs/inode.c | 4 ---- fs/f2fs/node.c | 52 ------------------------------------------------ 5 files changed, 2 insertions(+), 67 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 5a3636b70f48..14cd647d727d 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -3389,8 +3389,6 @@ static int prepare_write_begin(struct f2fs_sb_info *sbi, if (pos + len <= MAX_INLINE_DATA(inode)) { f2fs_do_read_inline_data(page, ipage); set_inode_flag(inode, FI_DATA_EXIST); - if (inode->i_nlink) - set_page_private_inline(ipage); goto out; } err = f2fs_convert_inline_page(&dn, page); diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index ede38bcef80e..200fb2243e8a 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -1382,9 +1382,8 @@ static inline void f2fs_clear_bit(unsigned int nr, char *addr); * bit 0 PAGE_PRIVATE_NOT_POINTER * bit 1 PAGE_PRIVATE_DUMMY_WRITE * bit 2 PAGE_PRIVATE_ONGOING_MIGRATION - * bit 3 PAGE_PRIVATE_INLINE_INODE - * bit 4 PAGE_PRIVATE_REF_RESOURCE - * bit 5- f2fs private data + * bit 3 PAGE_PRIVATE_REF_RESOURCE + * bit 4- f2fs private data * * Layout B: lowest bit should be 0 * page.private is a wrapped pointer. @@ -1393,7 +1392,6 @@ enum { PAGE_PRIVATE_NOT_POINTER, /* private contains non-pointer data */ PAGE_PRIVATE_DUMMY_WRITE, /* data page for padding aligned IO */ PAGE_PRIVATE_ONGOING_MIGRATION, /* data page which is on-going migrating */ - PAGE_PRIVATE_INLINE_INODE, /* inode page contains inline data */ PAGE_PRIVATE_REF_RESOURCE, /* dirty page has referenced resources */ PAGE_PRIVATE_MAX }; @@ -1432,17 +1430,14 @@ static inline void clear_page_private_##name(struct page *page) \ } PAGE_PRIVATE_GET_FUNC(nonpointer, NOT_POINTER); -PAGE_PRIVATE_GET_FUNC(inline, INLINE_INODE); PAGE_PRIVATE_GET_FUNC(gcing, ONGOING_MIGRATION); PAGE_PRIVATE_GET_FUNC(dummy, DUMMY_WRITE); PAGE_PRIVATE_SET_FUNC(reference, REF_RESOURCE); -PAGE_PRIVATE_SET_FUNC(inline, INLINE_INODE); PAGE_PRIVATE_SET_FUNC(gcing, ONGOING_MIGRATION); PAGE_PRIVATE_SET_FUNC(dummy, DUMMY_WRITE); PAGE_PRIVATE_CLEAR_FUNC(reference, REF_RESOURCE); -PAGE_PRIVATE_CLEAR_FUNC(inline, INLINE_INODE); PAGE_PRIVATE_CLEAR_FUNC(gcing, ONGOING_MIGRATION); PAGE_PRIVATE_CLEAR_FUNC(dummy, DUMMY_WRITE); diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c index 4638fee16a91..c9ede493f8cc 100644 --- a/fs/f2fs/inline.c +++ b/fs/f2fs/inline.c @@ -188,7 +188,6 @@ int f2fs_convert_inline_page(struct dnode_of_data *dn, struct page *page) /* clear inline data and flag after data writeback */ f2fs_truncate_inline_inode(dn->inode, dn->inode_page, 0); - clear_page_private_inline(dn->inode_page); clear_out: stat_dec_inline_inode(dn->inode); clear_inode_flag(dn->inode, FI_INLINE_DATA); @@ -267,7 +266,6 @@ int f2fs_write_inline_data(struct inode *inode, struct page *page) set_inode_flag(inode, FI_APPEND_WRITE); set_inode_flag(inode, FI_DATA_EXIST); - clear_page_private_inline(dn.inode_page); f2fs_put_dnode(&dn); return 0; } diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c index cf4327ad106c..336f92afb7e7 100644 --- a/fs/f2fs/inode.c +++ b/fs/f2fs/inode.c @@ -699,10 +699,6 @@ void f2fs_update_inode(struct inode *inode, struct page *node_page) __set_inode_rdev(inode, ri); - /* deleted inode */ - if (inode->i_nlink == 0) - clear_page_private_inline(node_page); - init_idisk_time(inode); #ifdef CONFIG_F2FS_CHECK_FS f2fs_inode_chksum_set(F2FS_I_SB(inode), node_page); diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index bd1dad523796..8bdcf80ca07a 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1479,42 +1479,6 @@ struct page *f2fs_get_node_page_ra(struct page *parent, int start) return __get_node_page(sbi, nid, parent, start); } -static void flush_inline_data(struct f2fs_sb_info *sbi, nid_t ino) -{ - struct inode *inode; - struct page *page; - int ret; - - /* should flush inline_data before evict_inode */ - inode = ilookup(sbi->sb, ino); - if (!inode) - return; - - page = f2fs_pagecache_get_page(inode->i_mapping, 0, - FGP_LOCK|FGP_NOWAIT, 0); - if (!page) - goto iput_out; - - if (!PageUptodate(page)) - goto page_out; - - if (!PageDirty(page)) - goto page_out; - - if (!clear_page_dirty_for_io(page)) - goto page_out; - - ret = f2fs_write_inline_data(inode, page); - inode_dec_dirty_pages(inode); - f2fs_remove_dirty_inode(inode); - if (ret) - set_page_dirty(page); -page_out: - f2fs_put_page(page, 1); -iput_out: - iput(inode); -} - static struct page *last_fsync_dnode(struct f2fs_sb_info *sbi, nid_t ino) { pgoff_t index; @@ -1918,14 +1882,6 @@ void f2fs_flush_inline_data(struct f2fs_sb_info *sbi) /* someone wrote it for us */ goto continue_unlock; } - - /* flush inline_data, if it's async context. */ - if (page_private_inline(page)) { - clear_page_private_inline(page); - unlock_page(page); - flush_inline_data(sbi, ino_of_node(page)); - continue; - } unlock_page(page); } folio_batch_release(&fbatch); @@ -2000,14 +1956,6 @@ int f2fs_sync_node_pages(struct f2fs_sb_info *sbi, if (!do_balance) goto write_node; - /* flush inline_data */ - if (page_private_inline(page)) { - clear_page_private_inline(page); - unlock_page(page); - flush_inline_data(sbi, ino_of_node(page)); - goto lock_node; - } - /* flush dirty inode */ if (IS_INODE(page) && flush_dirty_inode(page)) goto lock_node; From patchwork Wed Apr 12 16:08:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaegeuk Kim X-Patchwork-Id: 13209317 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 45EC2C77B6E for ; Wed, 12 Apr 2023 16:08:35 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1pmd1N-00019X-Tn; Wed, 12 Apr 2023 16:08:34 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pmd1L-00019R-GD for linux-f2fs-devel@lists.sourceforge.net; Wed, 12 Apr 2023 16:08:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: 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=6tHcvpNWiPht801PO9Zrv9yhnQM7CzF7GEisM5jFpsg=; b=O+OXjY1hV0Fxy8TW5h4dyXKV0k g6n6fEGmTjyQXgZC//F0Eq9lYf7sKcRxraSDx9YFerHrvMsV9A5Ql8o9a8py256+cuSKjVgEbI1lz 3rMT767HDlmVJFPJ1rSXpuiu2WsN6CqcAKCaOmdPXG33XsdRhUAAo8TlMg6ubW1/iXME=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: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=6tHcvpNWiPht801PO9Zrv9yhnQM7CzF7GEisM5jFpsg=; b=Gx+2+LTuve1mS4S3t+3R8GEFFO +bF1jDSQGX7WMVtBi6iBsV+09C+uQab+sp8VaJ/e6P7zibpU57ACDhJHUkGbPgRQt05vajKRsVsfK DE3MXbBVOFvMYoL6ymEI/ZcpGWUlvlvmojLCP87ddck+USnR9qtzHPoW5M4HL9PJ67RM=; Received: from dfw.source.kernel.org ([139.178.84.217]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1pmd1L-00005E-I8 for linux-f2fs-devel@lists.sourceforge.net; Wed, 12 Apr 2023 16:08:32 +0000 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 E343B636C5 for ; Wed, 12 Apr 2023 16:08:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 476C9C4339B; Wed, 12 Apr 2023 16:08:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681315702; bh=ErdIVpMC3VDYiThvtybryY3eGzznLtXvGbiDRfOIaas=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BTJQXgFhL2eaZ4SKpHjGxCwSPn0yTAk4ZK7EMWcE7zMzFlGbA90+FDDf+t7vijQj0 o2dGPaDEr0c+iEwgZofIu1EkKZtyRO1nqT5WKMNfCyubomd2SOm9+lXh4gyVcYNDBC 48Qxbt6waTRzbBV67xtSZ2YGq6A3de7QL4T1E8nAg6FKPmHWPrUTe6Ye5rlf1e/3l1 rVRbuKgt4sOKunV3NJui7CdWH/ggJ4wjb/tCOfA2WknXupSytJJQAP3iPpU2mpIZF2 DReKRlsCuhtSKLjclcXBCSvWlDOY9sE5PwJ5dEiO/9pH7faL2bT6+D1Gz+LyfphcNo 8j1sLLKapRn3w== From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Date: Wed, 12 Apr 2023 09:08:10 -0700 Message-Id: <20230412160810.1534632-2-jaegeuk@kernel.org> X-Mailer: git-send-email 2.40.0.577.gac1e443424-goog In-Reply-To: <20230412160810.1534632-1-jaegeuk@kernel.org> References: <20230412160810.1534632-1-jaegeuk@kernel.org> MIME-Version: 1.0 X-Headers-End: 1pmd1L-00005E-I8 Subject: [f2fs-dev] [PATCH 2/2] f2fs: remove folio_detach_private() in .invalidate_folio and .release_folio 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: , Cc: Jaegeuk Kim Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net From: Chao Yu 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. This patch should be applied along with ("f2fs: remove set|get_private_inline to clean up"). Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim --- fs/f2fs/data.c | 4 ++-- fs/f2fs/dir.c | 5 ++--- fs/f2fs/f2fs.h | 32 ++++++++------------------------ 3 files changed, 12 insertions(+), 29 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 14cd647d727d..037e70e85f63 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -3732,7 +3732,7 @@ 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, page_private(&folio->page)); } bool f2fs_release_folio(struct folio *folio, gfp_t wait) @@ -3754,7 +3754,7 @@ 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, page_private(&folio->page)); return true; } diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c index d6dd8327e82d..cea179dec3b6 100644 --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c @@ -906,13 +906,12 @@ void f2fs_delete_entry(struct f2fs_dir_entry *dentry, struct page *page, clear_page_dirty_for_io(page); ClearPageUptodate(page); + clear_page_private_reference(page); clear_page_private_gcing(page); + f2fs_bug_on(F2FS_I_SB(dir), page_private(page)); inode_dec_dirty_pages(dir); f2fs_remove_dirty_inode(dir); - - detach_page_private(page); - set_page_private(page, 0); } f2fs_put_page(page, 1); diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 200fb2243e8a..48fbd8b54e69 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -1407,11 +1407,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 *)0); \ set_bit(PAGE_PRIVATE_NOT_POINTER, &page_private(page)); \ set_bit(PAGE_PRIVATE_##flagname, &page_private(page)); \ } @@ -1420,13 +1417,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); @@ -1452,11 +1444,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, (void *)0); set_bit(PAGE_PRIVATE_NOT_POINTER, &page_private(page)); page_private(page) |= data << PAGE_PRIVATE_MAX; } @@ -1464,13 +1453,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 */