public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Trond Myklebust <trondmy@kernel.org>
To: Dave Wysochanski <dwysocha@redhat.com>,
	Anna Schumaker <anna.schumaker@netapp.com>,
	Trond Myklebust <trond.myklebust@hammerspace.com>,
	David Howells <dhowells@redhat.com>
Cc: linux-nfs@vger.kernel.org, linux-cachefs@redhat.com,
	Benjamin Maynard <benmaynard@google.com>,
	Daire Byrne <daire.byrne@gmail.com>
Subject: Re: [PATCH v9 1/5] NFS: Rename readpage_async_filler to nfs_pageio_add_page
Date: Thu, 27 Oct 2022 14:07:28 -0400	[thread overview]
Message-ID: <010f7996fde7dc4aa7a21e4b2b835d5ae7084771.camel@kernel.org> (raw)
In-Reply-To: <20221017105212.77588-2-dwysocha@redhat.com>

On Mon, 2022-10-17 at 06:52 -0400, Dave Wysochanski wrote:
> Rename readpage_async_filler to nfs_pageio_add_page to
> better reflect what this function does (add a page to
> the nfs_pageio_descriptor), and simplify arguments to
> this function by removing struct nfs_readdesc.
> 
> Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
> Reviewed-by: Jeff Layton <jlayton@kernel.org>
> ---
>  fs/nfs/read.c | 60 +++++++++++++++++++++++++------------------------
> --
>  1 file changed, 30 insertions(+), 30 deletions(-)
> 
> diff --git a/fs/nfs/read.c b/fs/nfs/read.c
> index 8ae2c8d1219d..525e82ea9a9e 100644
> --- a/fs/nfs/read.c
> +++ b/fs/nfs/read.c
> @@ -127,11 +127,6 @@ static void nfs_readpage_release(struct nfs_page
> *req, int error)
>         nfs_release_request(req);
>  }
>  
> -struct nfs_readdesc {
> -       struct nfs_pageio_descriptor pgio;
> -       struct nfs_open_context *ctx;
> -};
> -
>  static void nfs_page_group_set_uptodate(struct nfs_page *req)
>  {
>         if (nfs_page_group_sync_on_bit(req, PG_UPTODATE))
> @@ -153,7 +148,8 @@ static void nfs_read_completion(struct
> nfs_pgio_header *hdr)
>  
>                 if (test_bit(NFS_IOHDR_EOF, &hdr->flags)) {
>                         /* note: regions of the page not covered by a
> -                        * request are zeroed in
> readpage_async_filler */
> +                        * request are zeroed in nfs_pageio_add_page
> +                        */
>                         if (bytes > hdr->good_bytes) {
>                                 /* nothing in this request was good,
> so zero
>                                  * the full extent of the request */
> @@ -281,8 +277,10 @@ static void nfs_readpage_result(struct rpc_task
> *task,
>                 nfs_readpage_retry(task, hdr);
>  }
>  
> -static int
> -readpage_async_filler(struct nfs_readdesc *desc, struct page *page)
> +int
> +nfs_pageio_add_page(struct nfs_pageio_descriptor *pgio,
> +                   struct nfs_open_context *ctx,
> +                   struct page *page)

If we're going to rename this function, then let's not give it a name
that suggests it belongs in pagelist.c. It's not a generic helper
function, but is still very much specific to the pagecache read
functionality.

>  {
>         struct inode *inode = page_file_mapping(page)->host;
>         unsigned int rsize = NFS_SERVER(inode)->rsize;
> @@ -302,15 +300,15 @@ readpage_async_filler(struct nfs_readdesc
> *desc, struct page *page)
>                         goto out_unlock;
>         }
>  
> -       new = nfs_create_request(desc->ctx, page, 0, aligned_len);
> +       new = nfs_create_request(ctx, page, 0, aligned_len);
>         if (IS_ERR(new))
>                 goto out_error;
>  
>         if (len < PAGE_SIZE)
>                 zero_user_segment(page, len, PAGE_SIZE);
> -       if (!nfs_pageio_add_request(&desc->pgio, new)) {
> +       if (!nfs_pageio_add_request(pgio, new)) {
>                 nfs_list_remove_request(new);
> -               error = desc->pgio.pg_error;
> +               error = pgio->pg_error;
>                 nfs_readpage_release(new, error);
>                 goto out;
>         }
> @@ -332,7 +330,8 @@ readpage_async_filler(struct nfs_readdesc *desc,
> struct page *page)
>  int nfs_read_folio(struct file *file, struct folio *folio)
>  {
>         struct page *page = &folio->page;
> -       struct nfs_readdesc desc;
> +       struct nfs_pageio_descriptor pgio;
> +       struct nfs_open_context *ctx;
>         struct inode *inode = page_file_mapping(page)->host;
>         int ret;
>  
> @@ -358,29 +357,29 @@ int nfs_read_folio(struct file *file, struct
> folio *folio)
>  
>         if (file == NULL) {
>                 ret = -EBADF;
> -               desc.ctx = nfs_find_open_context(inode, NULL,
> FMODE_READ);
> -               if (desc.ctx == NULL)
> +               ctx = nfs_find_open_context(inode, NULL, FMODE_READ);
> +               if (ctx == NULL)
>                         goto out_unlock;
>         } else
> -               desc.ctx =
> get_nfs_open_context(nfs_file_open_context(file));
> +               ctx =
> get_nfs_open_context(nfs_file_open_context(file));
>  
> -       xchg(&desc.ctx->error, 0);
> -       nfs_pageio_init_read(&desc.pgio, inode, false,
> +       xchg(&ctx->error, 0);
> +       nfs_pageio_init_read(&pgio, inode, false,
>                              &nfs_async_read_completion_ops);
>  
> -       ret = readpage_async_filler(&desc, page);
> +       ret = nfs_pageio_add_page(&pgio, ctx, page);
>         if (ret)
>                 goto out;
>  
> -       nfs_pageio_complete_read(&desc.pgio);
> -       ret = desc.pgio.pg_error < 0 ? desc.pgio.pg_error : 0;
> +       nfs_pageio_complete_read(&pgio);
> +       ret = pgio.pg_error < 0 ? pgio.pg_error : 0;
>         if (!ret) {
>                 ret = wait_on_page_locked_killable(page);
>                 if (!PageUptodate(page) && !ret)
> -                       ret = xchg(&desc.ctx->error, 0);
> +                       ret = xchg(&ctx->error, 0);
>         }
>  out:
> -       put_nfs_open_context(desc.ctx);
> +       put_nfs_open_context(ctx);
>         trace_nfs_aop_readpage_done(inode, page, ret);
>         return ret;
>  out_unlock:
> @@ -391,9 +390,10 @@ int nfs_read_folio(struct file *file, struct
> folio *folio)
>  
>  void nfs_readahead(struct readahead_control *ractl)
>  {
> +       struct nfs_pageio_descriptor pgio;
> +       struct nfs_open_context *ctx;
>         unsigned int nr_pages = readahead_count(ractl);
>         struct file *file = ractl->file;
> -       struct nfs_readdesc desc;
>         struct inode *inode = ractl->mapping->host;
>         struct page *page;
>         int ret;
> @@ -407,25 +407,25 @@ void nfs_readahead(struct readahead_control
> *ractl)
>  
>         if (file == NULL) {
>                 ret = -EBADF;
> -               desc.ctx = nfs_find_open_context(inode, NULL,
> FMODE_READ);
> -               if (desc.ctx == NULL)
> +               ctx = nfs_find_open_context(inode, NULL, FMODE_READ);
> +               if (ctx == NULL)
>                         goto out;
>         } else
> -               desc.ctx =
> get_nfs_open_context(nfs_file_open_context(file));
> +               ctx =
> get_nfs_open_context(nfs_file_open_context(file));
>  
> -       nfs_pageio_init_read(&desc.pgio, inode, false,
> +       nfs_pageio_init_read(&pgio, inode, false,
>                              &nfs_async_read_completion_ops);
>  
>         while ((page = readahead_page(ractl)) != NULL) {
> -               ret = readpage_async_filler(&desc, page);
> +               ret = nfs_pageio_add_page(&pgio, ctx, page);
>                 put_page(page);
>                 if (ret)
>                         break;
>         }
>  
> -       nfs_pageio_complete_read(&desc.pgio);
> +       nfs_pageio_complete_read(&pgio);
>  
> -       put_nfs_open_context(desc.ctx);
> +       put_nfs_open_context(ctx);
>  out:
>         trace_nfs_aop_readahead_done(inode, nr_pages, ret);
>  }

-- 
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@hammerspace.com



  reply	other threads:[~2022-10-27 18:07 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-17 10:52 [PATCH v9 0/5] Convert NFS with fscache to the netfs API Dave Wysochanski
2022-10-17 10:52 ` [PATCH v9 1/5] NFS: Rename readpage_async_filler to nfs_pageio_add_page Dave Wysochanski
2022-10-27 18:07   ` Trond Myklebust [this message]
2022-10-28 10:32     ` David Wysochanski
2022-10-28 17:14       ` Trond Myklebust
2022-10-17 10:52 ` [PATCH v9 2/5] NFS: Configure support for netfs when NFS fscache is configured Dave Wysochanski
2022-10-17 10:52 ` [PATCH v9 3/5] NFS: Convert buffered read paths to use netfs when fscache is enabled Dave Wysochanski
2022-10-27 19:16   ` Trond Myklebust
2022-10-28 11:50     ` David Wysochanski
2022-10-28 16:59       ` Trond Myklebust
2022-10-29 16:46         ` David Wysochanski
2022-10-30 23:25           ` David Wysochanski
2022-10-31 17:42             ` Benjamin Maynard
     [not found]             ` <1B2E1442-EB0A-43E3-96BB-15C717E966E5@hammerspace.com>
2022-11-12 12:46               ` Benjamin Maynard
2022-11-14 10:41                 ` David Wysochanski
2022-11-14 12:42                   ` Benjamin Maynard
2022-11-14 13:07                     ` Jeff Layton
2022-11-14 13:14                       ` Benjamin Maynard
2022-11-14 13:53                         ` Jeff Layton
2022-11-14 13:33                     ` Daire Byrne
2022-11-14 13:46                 ` David Wysochanski
2022-11-14 16:03                   ` Benjamin Maynard
2022-11-14 17:11                     ` Jeff Layton
2022-11-14 17:34                     ` David Wysochanski
2022-11-14 21:25                       ` Benjamin Maynard
2022-11-17 11:03                         ` Daire Byrne
2023-01-03 20:33                           ` Benjamin Maynard
2023-02-06 17:32                             ` Benjamin Maynard
2023-02-09 15:09                               ` David Wysochanski
2022-10-17 10:52 ` [PATCH v9 4/5] NFS: Remove all NFSIOS_FSCACHE counters due to conversion to netfs API Dave Wysochanski
2022-10-17 10:52 ` [PATCH v9 5/5] NFS: Remove fscache specific trace points and NFS_INO_FSCACHE bit Dave Wysochanski

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=010f7996fde7dc4aa7a21e4b2b835d5ae7084771.camel@kernel.org \
    --to=trondmy@kernel.org \
    --cc=anna.schumaker@netapp.com \
    --cc=benmaynard@google.com \
    --cc=daire.byrne@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=dwysocha@redhat.com \
    --cc=linux-cachefs@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@hammerspace.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox