]> git.baikalelectronics.ru Git - kernel.git/commitdiff
block: Convert read_part_sector() to use a folio
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Wed, 18 May 2022 03:43:35 +0000 (23:43 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Tue, 2 Aug 2022 16:34:03 +0000 (12:34 -0400)
This relatively straightforward converion saves a call to compound_head()
hidden inside put_page().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
block/partitions/check.h
block/partitions/core.c

index 4ffa2359b1a37e0d5343ac2e559f6490a45a5a8c..8d70a880c3720a6e9a7b6f5a553cb7b59db2628f 100644 (file)
@@ -24,13 +24,13 @@ struct parsed_partitions {
 };
 
 typedef struct {
-       struct page *v;
+       struct folio *v;
 } Sector;
 
 void *read_part_sector(struct parsed_partitions *state, sector_t n, Sector *p);
 static inline void put_dev_sector(Sector p)
 {
-       put_page(p.v);
+       folio_put(p.v);
 }
 
 static inline void
index 269c86523e67de961282cebdf1493f194c40187a..e103ad08a948d6cfa60f2faa4ab9c46283a4dd6f 100644 (file)
@@ -705,19 +705,19 @@ EXPORT_SYMBOL_GPL(bdev_disk_changed);
 void *read_part_sector(struct parsed_partitions *state, sector_t n, Sector *p)
 {
        struct address_space *mapping = state->disk->part0->bd_inode->i_mapping;
-       struct page *page;
+       struct folio *folio;
 
        if (n >= get_capacity(state->disk)) {
                state->access_beyond_eod = true;
                goto out;
        }
 
-       page = read_mapping_page(mapping, n >> PAGE_SECTORS_SHIFT, NULL);
-       if (IS_ERR(page))
+       folio = read_mapping_folio(mapping, n >> PAGE_SECTORS_SHIFT, NULL);
+       if (IS_ERR(folio))
                goto out;
 
-       p->v = page;
-       return page_address(page) + offset_in_page(n * SECTOR_SIZE);
+       p->v = folio;
+       return folio_address(folio) + offset_in_folio(folio, n * SECTOR_SIZE);
 out:
        p->v = NULL;
        return NULL;