summaryrefslogtreecommitdiff
path: root/include/linux/highmem-internal.h
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2020-12-30 18:21:39 +0300
committerMatthew Wilcox (Oracle) <willy@infradead.org>2021-10-18 14:49:38 +0300
commit53c36de0701f2fdda6b1d209dc89e2bad4a9c7b8 (patch)
treebb2ad9e09ae5c30285e16ea6914fd30b52464c25 /include/linux/highmem-internal.h
parent08b0b0059bf1c2e8637f724cc7cc4d29b1e808de (diff)
downloadlinux-53c36de0701f2fdda6b1d209dc89e2bad4a9c7b8.tar.xz
mm: Add kmap_local_folio()
This allows us to map a portion of a folio. Callers can only expect to access up to the next page boundary. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Acked-by: Vlastimil Babka <vbabka@suse.cz>
Diffstat (limited to 'include/linux/highmem-internal.h')
-rw-r--r--include/linux/highmem-internal.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/highmem-internal.h b/include/linux/highmem-internal.h
index 4aa1031d3e4c..0a0b2b09b1b8 100644
--- a/include/linux/highmem-internal.h
+++ b/include/linux/highmem-internal.h
@@ -73,6 +73,12 @@ static inline void *kmap_local_page(struct page *page)
return __kmap_local_page_prot(page, kmap_prot);
}
+static inline void *kmap_local_folio(struct folio *folio, size_t offset)
+{
+ struct page *page = folio_page(folio, offset / PAGE_SIZE);
+ return __kmap_local_page_prot(page, kmap_prot) + offset % PAGE_SIZE;
+}
+
static inline void *kmap_local_page_prot(struct page *page, pgprot_t prot)
{
return __kmap_local_page_prot(page, prot);
@@ -171,6 +177,11 @@ static inline void *kmap_local_page(struct page *page)
return page_address(page);
}
+static inline void *kmap_local_folio(struct folio *folio, size_t offset)
+{
+ return page_address(&folio->page) + offset;
+}
+
static inline void *kmap_local_page_prot(struct page *page, pgprot_t prot)
{
return kmap_local_page(page);