diff options
author | Dave Chinner <dchinner@redhat.com> | 2024-01-16 09:59:41 +1100 |
---|---|---|
committer | Chandan Babu R <chandanbabu@kernel.org> | 2024-02-13 18:07:34 +0530 |
commit | afdc115559c57a48ad697219cec1d16962ad9e30 (patch) | |
tree | 900c14c9067038d5fd5d3304dc75619ab4500077 /fs/xfs/xfs_linux.h | |
parent | f078d4ea827607867d42fb3b2ef907caf86ce49d (diff) |
xfs: move kmem_to_page()
Move it to the general xfs linux wrapper header file so we can
prepare to remove kmem.h
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
Diffstat (limited to 'fs/xfs/xfs_linux.h')
-rw-r--r-- | fs/xfs/xfs_linux.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h index d7873e0360f0..666618b463c9 100644 --- a/fs/xfs/xfs_linux.h +++ b/fs/xfs/xfs_linux.h @@ -269,4 +269,15 @@ int xfs_rw_bdev(struct block_device *bdev, sector_t sector, unsigned int count, # define PTR_FMT "%p" #endif +/* + * Helper for IO routines to grab backing pages from allocated kernel memory. + */ +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_LINUX__ */ |