scsicam: Fix use of page cache
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Wed, 9 Feb 2022 17:58:22 +0000 (12:58 -0500)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Sun, 8 May 2022 18:28:18 +0000 (14:28 -0400)
Convert scsicam to use a folio instead of a page.  There is no need to
check the error flag here; read_cache_folio() will return -EIO if the
folio cannot be read correctly.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
drivers/scsi/scsicam.c

index acdc0ac..e2c7d8e 100644 (file)
@@ -34,15 +34,14 @@ unsigned char *scsi_bios_ptable(struct block_device *dev)
 {
        struct address_space *mapping = bdev_whole(dev)->bd_inode->i_mapping;
        unsigned char *res = NULL;
-       struct page *page;
+       struct folio *folio;
 
-       page = read_mapping_page(mapping, 0, NULL);
-       if (IS_ERR(page))
+       folio = read_mapping_folio(mapping, 0, NULL);
+       if (IS_ERR(folio))
                return NULL;
 
-       if (!PageError(page))
-               res = kmemdup(page_address(page) + 0x1be, 66, GFP_KERNEL);
-       put_page(page);
+       res = kmemdup(folio_address(folio) + 0x1be, 66, GFP_KERNEL);
+       folio_put(folio);
        return res;
 }
 EXPORT_SYMBOL(scsi_bios_ptable);