# Re: \[PATCH 2/5\] Fix hugetlb\_basepage\_index missing prototype warning

- From: Hugh Dickins \<hughd@google.com\>
- Date: 2021-06-15 23:17:15 
- List: linux-mm
- Page: https://ratatoskr.run/linux-mm/2021/06/6508788
- Thread: https://ratatoskr.run/linux-mm/2021/06/6508778/t.md

```text
On Tue, 15 Jun 2021, Matthew Wilcox (Oracle) wrote:

> -Wmissing-prototypes requires that the prototype actually be in scope,
> not just previously seen.  Move it outside page_to_pgoff().
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Thanks Matthew:
Acked-by: Hugh Dickins <hughd@google.com>
but Andrew please just add as a -fix.patch to
mm-futex-fix-shared-futex-pgoff-on-shmem-huge-page.patch
and merge them in due course - thank you.

> ---
>  include/linux/pagemap.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
> index 5f0582de24e7..c4b1514818ff 100644
> --- a/include/linux/pagemap.h
> +++ b/include/linux/pagemap.h
> @@ -585,16 +585,16 @@ static inline pgoff_t page_to_index(struct page *page)
>  	return pgoff;
>  }
>  
> +extern pgoff_t hugetlb_basepage_index(struct page *page);
> +
>  /*
>   * Get the offset in PAGE_SIZE (even for hugetlb pages).
>   * (TODO: hugetlb pages should have ->index in PAGE_SIZE)
>   */
>  static inline pgoff_t page_to_pgoff(struct page *page)
>  {
> -	if (unlikely(PageHuge(page))) {
> -		extern pgoff_t hugetlb_basepage_index(struct page *page);
> +	if (unlikely(PageHuge(page)))
>  		return hugetlb_basepage_index(page);
> -	}
>  	return page_to_index(page);
>  }
>  
> -- 
> 2.30.2

```
