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.
Showing the changes to include/linux (1 of 1 file). Show all
Unified · Split
| @@ -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 | 446 | static 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) false | 452 | #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 | ||
| 461 | static 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_AREA | 467 | #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 | ||
| 528 | static inline struct hstate *hstate_inode(struct inode *i) | ||
| 529 | { | ||
| 530 | return HUGETLBFS_SB(i->i_sb)->hstate; | ||
| 531 | } | ||
| 532 | |||
| 533 | static inline struct hstate *hstate_file(struct file *f) | 535 | static 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 | ||
| 785 | static inline struct hstate *hstate_inode(struct inode *i) | ||
| 786 | { | ||
| 787 | return NULL; | ||
| 788 | } | ||
| 789 | |||
| 790 | static inline struct hstate *page_hstate(struct page *page) | 787 | static inline struct hstate *page_hstate(struct page *page) |
| 791 | { | 788 | { |
| 792 | return NULL; | 789 | return NULL; |