]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/filemap: Add i_blocks_per_folio()
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Wed, 28 Apr 2021 03:11:28 +0000 (23:11 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Sun, 15 Aug 2021 15:36:43 +0000 (11:36 -0400)
Reimplement i_blocks_per_page() as a wrapper around i_blocks_per_folio().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Howells <dhowells@redhat.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
include/linux/pagemap.h

index 006de2d84d06558d5bdd54266da161f248151c66..412db88b8d0c4baae13fd04b2b627fe13589959b 100644 (file)
@@ -1150,19 +1150,25 @@ static inline int page_mkwrite_check_truncate(struct page *page,
 }
 
 /**
- * i_blocks_per_page - How many blocks fit in this page.
+ * i_blocks_per_folio - How many blocks fit in this folio.
  * @inode: The inode which contains the blocks.
- * @page: The page (head page if the page is a THP).
+ * @folio: The folio.
  *
- * If the block size is larger than the size of this page, return zero.
+ * If the block size is larger than the size of this folio, return zero.
  *
- * Context: The caller should hold a refcount on the page to prevent it
+ * Context: The caller should hold a refcount on the folio to prevent it
  * from being split.
- * Return: The number of filesystem blocks covered by this page.
+ * Return: The number of filesystem blocks covered by this folio.
  */
+static inline
+unsigned int i_blocks_per_folio(struct inode *inode, struct folio *folio)
+{
+       return folio_size(folio) >> inode->i_blkbits;
+}
+
 static inline
 unsigned int i_blocks_per_page(struct inode *inode, struct page *page)
 {
-       return thp_size(page) >> inode->i_blkbits;
+       return i_blocks_per_folio(inode, page_folio(page));
 }
 #endif /* _LINUX_PAGEMAP_H */