]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
xfs: make mem_to_page available outside of xfs_buf.c
authorChristoph Hellwig <hch@lst.de>
Sat, 29 Jun 2019 02:27:19 +0000 (19:27 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Sat, 29 Jun 2019 02:27:19 +0000 (19:27 -0700)
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>
fs/xfs/kmem.h
fs/xfs/xfs_buf.c

index 8e6b3ba81c03e398d2b91c76c456760c2a97ae82..267655acd42681e0cec5253e94d05681bb9f2c13 100644 (file)
@@ -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__ */
index e860114e8c9b64d6649fb038e92d25d4f1350008..f455995f927844583b45847299bc7db316323d27 100644 (file)
@@ -934,17 +934,6 @@ xfs_buf_set_empty(
        bp->b_maps[0].bm_len = bp->b_length;
 }
 
-static inline struct page *
-mem_to_page(
-       void                    *addr)
-{
-       if ((!is_vmalloc_addr(addr))) {
-               return virt_to_page(addr);
-       } else {
-               return vmalloc_to_page(addr);
-       }
-}
-
 int
 xfs_buf_associate_memory(
        xfs_buf_t               *bp,
@@ -977,7 +966,7 @@ xfs_buf_associate_memory(
        bp->b_offset = offset;
 
        for (i = 0; i < bp->b_page_count; i++) {
-               bp->b_pages[i] = mem_to_page((void *)pageaddr);
+               bp->b_pages[i] = kmem_to_page((void *)pageaddr);
                pageaddr += PAGE_SIZE;
        }