@@ -92,6 +92,7 @@ extern struct page *shmem_read_mapping_page_gfp(struct address_space *mapping,
extern void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end);
int shmem_unuse(unsigned int type);
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
extern bool shmem_is_huge(struct vm_area_struct *vma, struct inode *inode,
pgoff_t index, bool shmem_huge_force);
static inline bool shmem_huge_enabled(struct vm_area_struct *vma,
@@ -100,6 +101,14 @@ static inline bool shmem_huge_enabled(struct vm_area_struct *vma,
return shmem_is_huge(vma, file_inode(vma->vm_file), vma->vm_pgoff,
shmem_huge_force);
}
+#else /* !CONFIG_TRANSPARENT_HUGEPAGE */
+static inline bool shmem_huge_enabled(struct vm_area_struct *vma,
+ bool shmem_huge_force)
+{
+ return false;
+}
+#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
+
extern unsigned long shmem_swap_usage(struct vm_area_struct *vma);
extern unsigned long shmem_partial_swap_usage(struct address_space *mapping,
pgoff_t start, pgoff_t end);
@@ -678,8 +678,8 @@ static long shmem_unused_huge_count(struct super_block *sb,
#define shmem_huge SHMEM_HUGE_DENY
-bool shmem_is_huge(struct vm_area_struct *vma, struct inode *inode,
- pgoff_t index, bool shmem_huge_force)
+static inline bool shmem_is_huge(struct vm_area_struct *vma, struct inode *inode,
+ pgoff_t index, bool shmem_huge_force)
{
return false;
}
When CONFIG_TRANSPARENT_HUGEPAGE is not set, shmem_is_huge() is not needed outside of shmem.c. Signed-off-by: Yann Droneaud <ydroneaud@opteya.com> --- include/linux/shmem_fs.h | 9 +++++++++ mm/shmem.c | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-)