From: Christoph Hellwig <hch@lst.de>
To: David Howells <dhowells@redhat.com>
Cc: willy@infradead.org, trond.myklebust@primarydata.com,
darrick.wong@oracle.com, hch@lst.de, viro@zeniv.linux.org.uk,
jlayton@kernel.org, sfrench@samba.org,
torvalds@linux-foundation.org, linux-nfs@vger.kernel.org,
linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH v2 3/5] mm: Make swap_readpage() for SWP_FS_OPS use ->direct_IO() not ->readpage()
Date: Fri, 13 Aug 2021 09:12:45 +0200 [thread overview]
Message-ID: <20210813071245.GC26339@lst.de> (raw)
In-Reply-To: <162879974434.3306668.4798886633463058599.stgit@warthog.procyon.org.uk>
> +/*
> + * Keep track of the kiocb we're using to do async DIO. We have to
> + * refcount it until various things stop looking at the kiocb *after*
> + * calling ->ki_complete().
> + */
> +struct swapfile_kiocb {
> + struct kiocb iocb;
> + refcount_t ki_refcnt;
> +};
The ki_ prefix is a little strange here.
> +
> +static void swapfile_put_kiocb(struct swapfile_kiocb *ki)
> +{
> + if (refcount_dec_and_test(&ki->ki_refcnt)) {
> + fput(ki->iocb.ki_filp);
What do we need the file reference for here? The swap code has to have
higher level prevention for closing the file vs active I/O, at least the
block path seems to rely on that.
> +static void swapfile_read_complete(struct kiocb *iocb, long ret, long ret2)
> +{
> + struct swapfile_kiocb *ki = container_of(iocb, struct swapfile_kiocb, iocb);
Overly long line.
> + /* Should set IOCB_HIPRI too, but the box becomes unresponsive whilst
> + * putting out occasional messages about the NFS sunrpc scheduling
> + * tasks being hung.
> + */
IOCB_HIPRI has a very specific meaning, so I'm not sure we should
use it never mind leave such a comment here. Also this is not the
proper standard kernel comment style.
> +
> + iov_iter_bvec(&to, READ, &bv, 1, thp_size(page));
> + ret = swap_file->f_mapping->a_ops->direct_IO(&kiocb, &to);
> +
> + __swapfile_read_complete(&kiocb, ret, 0);
> + return (ret > 0) ? 0 : ret;
No need for the braces.
> + return (ret > 0) ? 0 : ret;
Same here.
next prev parent reply other threads:[~2021-08-13 7:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-12 20:21 [RFC PATCH v2 0/5] mm: Fix NFS swapfiles and use DIO for swapfiles David Howells
2021-08-12 20:22 ` [RFC PATCH v2 1/5] nfs: Fix write to swapfile failure due to generic_write_checks() David Howells
2021-08-13 3:09 ` Matthew Wilcox
2021-08-13 7:02 ` Christoph Hellwig
2021-08-19 22:38 ` NeilBrown
2021-08-12 20:22 ` [RFC PATCH v2 2/5] mm: Remove the callback func argument from __swap_writepage() David Howells
2021-08-13 7:03 ` Christoph Hellwig
2021-08-12 20:22 ` [RFC PATCH v2 3/5] mm: Make swap_readpage() for SWP_FS_OPS use ->direct_IO() not ->readpage() David Howells
2021-08-12 21:23 ` Matthew Wilcox
2021-08-13 7:12 ` Christoph Hellwig [this message]
2021-08-12 20:22 ` [RFC PATCH v2 4/5] mm: Make __swap_writepage() do async DIO if asked for it David Howells
2021-08-12 20:22 ` [RFC PATCH v2 5/5] mm: Remove swap BIO paths and only use DIO paths [BROKEN] David Howells
2021-08-13 7:14 ` Christoph Hellwig
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=20210813071245.GC26339@lst.de \
--to=hch@lst.de \
--cc=darrick.wong@oracle.com \
--cc=dhowells@redhat.com \
--cc=jlayton@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-nfs@vger.kernel.org \
--cc=sfrench@samba.org \
--cc=torvalds@linux-foundation.org \
--cc=trond.myklebust@primarydata.com \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.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.