diff mbox series

[01/10] ufs: Convert ufs_get_page() to use a folio

Message ID 20240709033029.1769992-2-willy@infradead.org (mailing list archive)
State New
Headers show
Series Convert UFS directory handling to folios | expand

Commit Message

Matthew Wilcox July 9, 2024, 3:30 a.m. UTC
Remove a call to read_mapping_page().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 fs/ufs/dir.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

Comments

Al Viro July 16, 2024, 10:31 p.m. UTC | #1
On Tue, Jul 09, 2024 at 04:30:18AM +0100, Matthew Wilcox (Oracle) wrote:

> +	struct folio *folio = read_mapping_folio(mapping, n, NULL);
> +
> +	if (IS_ERR(folio))
> +		return &folio->page;

		return ERR_CAST(folio);
would be better here; yes, I realize it's going away in the next commit,
but it's easier to follow that way (and actually makes the next commit
easier to follow as well).
diff mbox series

Patch

diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c
index 61f25d3cf3f7..0705848899c1 100644
--- a/fs/ufs/dir.c
+++ b/fs/ufs/dir.c
@@ -194,18 +194,19 @@  static bool ufs_check_page(struct page *page)
 static struct page *ufs_get_page(struct inode *dir, unsigned long n)
 {
 	struct address_space *mapping = dir->i_mapping;
-	struct page *page = read_mapping_page(mapping, n, NULL);
-	if (!IS_ERR(page)) {
-		kmap(page);
-		if (unlikely(!PageChecked(page))) {
-			if (!ufs_check_page(page))
-				goto fail;
-		}
+	struct folio *folio = read_mapping_folio(mapping, n, NULL);
+
+	if (IS_ERR(folio))
+		return &folio->page;
+	kmap(&folio->page);
+	if (unlikely(!folio_test_checked(folio))) {
+		if (!ufs_check_page(&folio->page))
+			goto fail;
 	}
-	return page;
+	return &folio->page;
 
 fail:
-	ufs_put_page(page);
+	ufs_put_page(&folio->page);
 	return ERR_PTR(-EIO);
 }