History

mm/hugetlb: fix build failure with HUGETLB_PAGE but not HUGEBTLBFS

When CONFIG_HUGETLB_PAGE is set but not CONFIG_HUGETLBFS, the following build failure is encoutered: In file included from arch/powerpc/mm/fault.c:33:0: include/linux/hugetlb.h: In function 'hstate_inode': include/linux/hugetlb.h:477:9: error: implicit declaration of function 'HUGETLBFS_SB' [-Werror=implicit-function-declaration] return HUGETLBFS_SB(i->i_sb)->hstate; ^ include/linux/hugetlb.h:477:30: error: invalid type argument of '->' (have 'int') return HUGETLBFS_SB(i->i_sb)->hstate; ^ Gate hstate_inode() with CONFIG_HUGETLBFS instead of CONFIG_HUGETLB_PAGE.

Christophe Leroy committed 6 years ago

Commit bb297bb1 parent cabc30d1 file · +8 −11Browse files

Showing the changes to include/linux (1 of 1 file). Show all

Unified · Split

include/linux/hugetlb.h+8−11
@@ -443,7 +443,10 @@ static inline bool is_file_hugepages(struct file *file) · 442 unmodified lines
443443 return is_file_shm_hugepages(file);
444444 }
445445
446−
446+static inline struct hstate *hstate_inode(struct inode *i)
447+{
448+ return HUGETLBFS_SB(i->i_sb)->hstate;
449+}
447450 #else /* !CONFIG_HUGETLBFS */
448451
449452 #define is_file_hugepages(file) false
@@ -455,6 +458,10 @@ hugetlb_file_setup(const char *name, size_t size, vm_flags_t acctflag, · 5 unmodified lines
455458 return ERR_PTR(-ENOSYS);
456459 }
457460
461+static inline struct hstate *hstate_inode(struct inode *i)
462+{
463+ return NULL;
464+}
458465 #endif /* !CONFIG_HUGETLBFS */
459466
460467 #ifdef HAVE_ARCH_HUGETLB_UNMAPPED_AREA
@@ -525,11 +532,6 @@ extern unsigned int default_hstate_idx; · 64 unmodified lines
525532
526533 #define default_hstate (hstates[default_hstate_idx])
527534
528−static inline struct hstate *hstate_inode(struct inode *i)
529−{
530− return HUGETLBFS_SB(i->i_sb)->hstate;
531−}
532−
533535 static inline struct hstate *hstate_file(struct file *f)
534536 {
535537 return hstate_inode(file_inode(f));
@@ -782,11 +784,6 @@ static inline struct hstate *hstate_vma(struct vm_area_struct *vma) · 246 unmodified lines
782784 return NULL;
783785 }
784786
785−static inline struct hstate *hstate_inode(struct inode *i)
786−{
787− return NULL;
788−}
789−
790787 static inline struct hstate *page_hstate(struct page *page)
791788 {
792789 return NULL;