diff options
author | Matthew Wilcox (Oracle) <willy@infradead.org> | 2022-05-18 05:43:35 +0200 |
---|---|---|
committer | Matthew Wilcox (Oracle) <willy@infradead.org> | 2022-08-02 18:34:03 +0200 |
commit | 4fdc08d418f5ca68da64bbfefc03511b8c3dceea (patch) | |
tree | f0976bed5e98094f7f8f75de8ddc4191b181373b /block/partitions | |
parent | block: Use PAGE_SECTORS_SHIFT (diff) | |
download | linux-4fdc08d418f5ca68da64bbfefc03511b8c3dceea.tar.xz linux-4fdc08d418f5ca68da64bbfefc03511b8c3dceea.zip |
block: Convert read_part_sector() to use a folio
This relatively straightforward converion saves a call to compound_head()
hidden inside put_page().
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Diffstat (limited to 'block/partitions')
-rw-r--r-- | block/partitions/check.h | 4 | ||||
-rw-r--r-- | block/partitions/core.c | 10 |
2 files changed, 7 insertions, 7 deletions
diff --git a/block/partitions/check.h b/block/partitions/check.h index 4ffa2359b1a3..8d70a880c372 100644 --- a/block/partitions/check.h +++ b/block/partitions/check.h @@ -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 diff --git a/block/partitions/core.c b/block/partitions/core.c index 269c86523e67..e103ad08a948 100644 --- a/block/partitions/core.c +++ b/block/partitions/core.c @@ -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; |