All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Souptick Joarder <jrdr.linux@gmail.com>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org,
	Alex Shi <alex.shi@linux.alibaba.com>
Subject: Re: [PATCH] mm: add prototype for __add_to_page_cache_locked()
Date: Tue, 22 Dec 2020 20:40:00 +0000	[thread overview]
Message-ID: <20201222204000.GN874@casper.infradead.org> (raw)
In-Reply-To: <1608646792-29073-1-git-send-email-jrdr.linux@gmail.com>

On Tue, Dec 22, 2020 at 07:49:52PM +0530, Souptick Joarder wrote:
> Otherwise it cause gcc warning:
>           ^~~~~~~~~~~~~~~

That line is just confusing.

> ../mm/filemap.c:830:14: warning: no previous prototype for
> ‘__add_to_page_cache_locked’ [-Wmissing-prototypes]
>  noinline int __add_to_page_cache_locked(struct page *page,
>               ^~~~~~~~~~~~~~~~~~~~~~~~~~

And I don't think those two lines add much value, do you?

> A previous attempt to make this function static leads to
> compile error for few architectures.

It might be better to say why it has to be non-static here (because it's
an error injection point).  And it's not architecture dependent (afaik),
it's whether error injection is enabled in the config.

> Adding a prototype will silence the warning.
> 
> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
> Cc: Alex Shi <alex.shi@linux.alibaba.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> ---
>  include/linux/mm.h | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 5299b90a..ac07f65 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -216,6 +216,12 @@ int overcommit_kbytes_handler(struct ctl_table *, int, void *, size_t *,
>  		loff_t *);
>  int overcommit_policy_handler(struct ctl_table *, int, void *, size_t *,
>  		loff_t *);
> +/*
> + * Any attempt to mark this function as static leads to build failure
> + * for few architectures. Adding a prototype to silence gcc warning.
> + */

We don't need a comment here for this.  The commit log is enough.

> +int __add_to_page_cache_locked(struct page *page, struct address_space *mapping,
> +		pgoff_t offset, gfp_t gfp, void **shadowp);

Please name that 'index', not 'offset'.


  reply	other threads:[~2020-12-22 20:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-22 14:19 [PATCH] mm: add prototype for __add_to_page_cache_locked() Souptick Joarder
2020-12-22 20:40 ` Matthew Wilcox [this message]
2020-12-22 23:53   ` Andrew Morton
2020-12-23  1:19     ` Matthew Wilcox
2020-12-23  8:31     ` Christoph Hellwig
2020-12-23 12:11       ` Matthew Wilcox
2020-12-23 15:52         ` Christoph Hellwig
2020-12-28  0:59           ` Alexei Starovoitov
2020-12-28  0:59             ` Alexei Starovoitov
2020-12-23  3:16 Souptick Joarder
2020-12-23  3:18 ` Souptick Joarder
2020-12-23  3:18   ` Souptick Joarder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201222204000.GN874@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=alex.shi@linux.alibaba.com \
    --cc=jrdr.linux@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.