diff options
author | Christoph Hellwig <hch@lst.de> | 2019-06-28 22:27:19 -0400 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2019-06-28 22:27:19 -0400 |
commit | 72945d86ddec143ee5064f36eae4b48b03ea1a3f (patch) | |
tree | 971c0ac3ccbecfec6aac4086a9f45848f680d6fd /fs/xfs | |
parent | ce89755cdfeaa0073341f8b5d07caff4fa9fc316 (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')
-rw-r--r-- | fs/xfs/kmem.h | 8 | ||||
-rw-r--r-- | fs/xfs/xfs_buf.c | 13 |
2 files changed, 9 insertions, 12 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) | |||
124 | return kmem_zone_alloc(zone, flags | KM_ZERO); | 124 | return kmem_zone_alloc(zone, flags | KM_ZERO); |
125 | } | 125 | } |
126 | 126 | ||
127 | static inline struct page * | ||
128 | kmem_to_page(void *addr) | ||
129 | { | ||
130 | if (is_vmalloc_addr(addr)) | ||
131 | return vmalloc_to_page(addr); | ||
132 | return virt_to_page(addr); | ||
133 | } | ||
134 | |||
127 | #endif /* __XFS_SUPPORT_KMEM_H__ */ | 135 | #endif /* __XFS_SUPPORT_KMEM_H__ */ |
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index e860114e8c9b..f455995f9278 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c | |||
@@ -934,17 +934,6 @@ xfs_buf_set_empty( | |||
934 | bp->b_maps[0].bm_len = bp->b_length; | 934 | bp->b_maps[0].bm_len = bp->b_length; |
935 | } | 935 | } |
936 | 936 | ||
937 | static inline struct page * | ||
938 | mem_to_page( | ||
939 | void *addr) | ||
940 | { | ||
941 | if ((!is_vmalloc_addr(addr))) { | ||
942 | return virt_to_page(addr); | ||
943 | } else { | ||
944 | return vmalloc_to_page(addr); | ||
945 | } | ||
946 | } | ||
947 | |||
948 | int | 937 | int |
949 | xfs_buf_associate_memory( | 938 | xfs_buf_associate_memory( |
950 | xfs_buf_t *bp, | 939 | xfs_buf_t *bp, |
@@ -977,7 +966,7 @@ xfs_buf_associate_memory( | |||
977 | bp->b_offset = offset; | 966 | bp->b_offset = offset; |
978 | 967 | ||
979 | for (i = 0; i < bp->b_page_count; i++) { | 968 | for (i = 0; i < bp->b_page_count; i++) { |
980 | bp->b_pages[i] = mem_to_page((void *)pageaddr); | 969 | bp->b_pages[i] = kmem_to_page((void *)pageaddr); |
981 | pageaddr += PAGE_SIZE; | 970 | pageaddr += PAGE_SIZE; |
982 | } | 971 | } |
983 | 972 | ||