summaryrefslogtreecommitdiff
path: root/fs/xfs/kmem.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2019-06-28 19:27:19 -0700
committerDarrick J. Wong <darrick.wong@oracle.com>2019-06-28 19:27:19 -0700
commit72945d86ddec143ee5064f36eae4b48b03ea1a3f (patch)
tree971c0ac3ccbecfec6aac4086a9f45848f680d6fd /fs/xfs/kmem.h
parentce89755cdfeaa0073341f8b5d07caff4fa9fc316 (diff)
xfs: make mem_to_page available outside of xfs_buf.c
Rename the function to kmem_to_page and move it to kmem.h together with our kmem_large allocator that may either return kmalloced or vmalloc pages. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/kmem.h')
-rw-r--r--fs/xfs/kmem.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/xfs/kmem.h b/fs/xfs/kmem.h
index 8e6b3ba81c03..267655acd426 100644
--- a/fs/xfs/kmem.h
+++ b/fs/xfs/kmem.h
@@ -124,4 +124,12 @@ kmem_zone_zalloc(kmem_zone_t *zone, xfs_km_flags_t flags)
return kmem_zone_alloc(zone, flags | KM_ZERO);
}
+static inline struct page *
+kmem_to_page(void *addr)
+{
+ if (is_vmalloc_addr(addr))
+ return vmalloc_to_page(addr);
+ return virt_to_page(addr);
+}
+
#endif /* __XFS_SUPPORT_KMEM_H__ */