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
443 return is_file_shm_hugepages(file);443 return is_file_shm_hugepages(file);
444}444}
445 445
446 446static inline struct hstate *hstate_inode(struct inode *i)
447{
448 return HUGETLBFS_SB(i->i_sb)->hstate;
449}
447#else /* !CONFIG_HUGETLBFS */450#else /* !CONFIG_HUGETLBFS */
448 451
449#define is_file_hugepages(file) false452#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
455 return ERR_PTR(-ENOSYS);458 return ERR_PTR(-ENOSYS);
456}459}
457 460
461static inline struct hstate *hstate_inode(struct inode *i)
462{
463 return NULL;
464}
458#endif /* !CONFIG_HUGETLBFS */465#endif /* !CONFIG_HUGETLBFS */
459 466
460#ifdef HAVE_ARCH_HUGETLB_UNMAPPED_AREA467#ifdef HAVE_ARCH_HUGETLB_UNMAPPED_AREA
@@ -525,11 +532,6 @@ extern unsigned int default_hstate_idx; · 64 unmodified lines
525 532
526#define default_hstate (hstates[default_hstate_idx])533#define default_hstate (hstates[default_hstate_idx])
527 534
528static inline struct hstate *hstate_inode(struct inode *i)
529{
530 return HUGETLBFS_SB(i->i_sb)->hstate;
531}
532
533static inline struct hstate *hstate_file(struct file *f)535static inline struct hstate *hstate_file(struct file *f)
534{536{
535 return hstate_inode(file_inode(f));537 return hstate_inode(file_inode(f));
@@ -782,11 +784,6 @@ static inline struct hstate *hstate_vma(struct vm_area_struct *vma) · 246 unmodified lines
782 return NULL;784 return NULL;
783}785}
784 786
785static inline struct hstate *hstate_inode(struct inode *i)
786{
787 return NULL;
788}
789
790static inline struct hstate *page_hstate(struct page *page)787static inline struct hstate *page_hstate(struct page *page)
791{788{
792 return NULL;789 return NULL;