[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200426214925.10970-7-guoqing.jiang@cloud.ionos.com>
Date: Sun, 26 Apr 2020 23:49:22 +0200
From: Guoqing Jiang <guoqing.jiang@...ud.ionos.com>
To: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: hch@...radead.org, david@...morbit.com, willy@...radead.org,
Guoqing Jiang <guoqing.jiang@...ud.ionos.com>,
"Darrick J. Wong" <darrick.wong@...cle.com>,
linux-xfs@...r.kernel.org
Subject: [RFC PATCH 6/9] iomap: use set/clear_fs_page_private
Since the new pair function is introduced, we can call them to clean the
code in iomap.
Cc: Christoph Hellwig <hch@...radead.org>
Cc: "Darrick J. Wong" <darrick.wong@...cle.com>
Cc: linux-xfs@...r.kernel.org
Signed-off-by: Guoqing Jiang <guoqing.jiang@...ud.ionos.com>
---
fs/iomap/buffered-io.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
index 89e21961d1ad..cc48bf4f1193 100644
--- a/fs/iomap/buffered-io.c
+++ b/fs/iomap/buffered-io.c
@@ -59,24 +59,18 @@ iomap_page_create(struct inode *inode, struct page *page)
* migrate_page_move_mapping() assumes that pages with private data have
* their count elevated by 1.
*/
- get_page(page);
- set_page_private(page, (unsigned long)iop);
- SetPagePrivate(page);
- return iop;
+ return (struct iomap_page *)set_fs_page_private(page, iop);
}
static void
iomap_page_release(struct page *page)
{
- struct iomap_page *iop = to_iomap_page(page);
+ struct iomap_page *iop = clear_fs_page_private(page);
if (!iop)
return;
WARN_ON_ONCE(atomic_read(&iop->read_count));
WARN_ON_ONCE(atomic_read(&iop->write_count));
- ClearPagePrivate(page);
- set_page_private(page, 0);
- put_page(page);
kfree(iop);
}
@@ -556,11 +550,9 @@ iomap_migrate_page(struct address_space *mapping, struct page *newpage,
if (page_has_private(page)) {
ClearPagePrivate(page);
- get_page(newpage);
- set_page_private(newpage, page_private(page));
+ set_fs_page_private(newpage, (void *)page_private(page));
set_page_private(page, 0);
put_page(page);
- SetPagePrivate(newpage);
}
if (mode != MIGRATE_SYNC_NO_COPY)
--
2.17.1
Powered by blists - more mailing lists