udf: Convert udf_symlink_filler() to use a folio
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Wed, 17 Apr 2024 15:04:07 +0000 (16:04 +0100)
committerJan Kara <jack@suse.cz>
Tue, 23 Apr 2024 13:36:02 +0000 (15:36 +0200)
Remove the conversion to struct page and use folio APIs throughout.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Message-Id: <20240417150416.752929-2-willy@infradead.org>

fs/udf/symlink.c

index f7eaf7b145940ba7bc73abcfa0dd6a9efb1855f5..0105e7e2ba3d949df940707af9cea423c2517977 100644 (file)
@@ -99,18 +99,17 @@ static int udf_pc_to_char(struct super_block *sb, unsigned char *from,
 
 static int udf_symlink_filler(struct file *file, struct folio *folio)
 {
-       struct page *page = &folio->page;
-       struct inode *inode = page->mapping->host;
+       struct inode *inode = folio->mapping->host;
        struct buffer_head *bh = NULL;
        unsigned char *symlink;
        int err = 0;
-       unsigned char *p = page_address(page);
+       unsigned char *p = folio_address(folio);
        struct udf_inode_info *iinfo = UDF_I(inode);
 
        /* We don't support symlinks longer than one block */
        if (inode->i_size > inode->i_sb->s_blocksize) {
                err = -ENAMETOOLONG;
-               goto out_unlock;
+               goto out;
        }
 
        if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) {
@@ -120,24 +119,15 @@ static int udf_symlink_filler(struct file *file, struct folio *folio)
                if (!bh) {
                        if (!err)
                                err = -EFSCORRUPTED;
-                       goto out_err;
+                       goto out;
                }
                symlink = bh->b_data;
        }
 
        err = udf_pc_to_char(inode->i_sb, symlink, inode->i_size, p, PAGE_SIZE);
        brelse(bh);
-       if (err)
-               goto out_err;
-
-       SetPageUptodate(page);
-       unlock_page(page);
-       return 0;
-
-out_err:
-       SetPageError(page);
-out_unlock:
-       unlock_page(page);
+out:
+       folio_end_read(folio, err == 0);
        return err;
 }