All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Christoph Hellwig <hch@lst.de>
Cc: viro@zeniv.linux.org.uk, axboe@kernel.dk,
	Milosz Tanski <milosz@adfin.com>,
	Goldwyn Rodrigues <rgoldwyn@suse.com>,
	mgorman@suse.de, Volker.Lendecke@sernet.de,
	linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org
Subject: Re: [PATCH 2/4] fs: support IOCB_NOWAIT in generic_file_buffered_read
Date: Thu, 24 Aug 2017 16:31:41 +0200	[thread overview]
Message-ID: <20170824143141.GB8969@quack2.suse.cz> (raw)
In-Reply-To: <20170822161712.11716-3-hch@lst.de>

On Tue 22-08-17 18:17:10, Christoph Hellwig wrote:
> From: Milosz Tanski <milosz@adfin.com>
> 
> Allow generic_file_buffered_read to bail out early instead of waiting for
> the page lock or reading a page if IOCB_NOWAIT is specified.
> 
> Signed-off-by: Milosz Tanski <milosz@adfin.com>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Jeff Moyer <jmoyer@redhat.com>
> Acked-by: Sage Weil <sage@redhat.com>
> ---
>  mm/filemap.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/mm/filemap.c b/mm/filemap.c
> index 4bcfa74ad802..9f60255fb7bb 100644
> --- a/mm/filemap.c
> +++ b/mm/filemap.c
> @@ -1937,6 +1937,8 @@ static ssize_t generic_file_buffered_read(struct kiocb *iocb,
>  
>  		page = find_get_page(mapping, index);
>  		if (!page) {
> +			if (iocb->ki_flags & IOCB_NOWAIT)
> +				goto would_block;
>  			page_cache_sync_readahead(mapping,
>  					ra, filp,
>  					index, last_index - index);

Hum, we have:

                if (!PageUptodate(page)) {
                        /*
                         * See comment in do_read_cache_page on why
                         * wait_on_page_locked is used to avoid
                         * unnecessarily
                         * serialisations and why it's safe.
                         */
                        error = wait_on_page_locked_killable(page);
                        if (unlikely(error))
                                goto readpage_error;
                        if (PageUptodate(page))
                                goto page_ok;

And wait_on_page_locked_killable() above does not seem to be handled in
your patch. I would just check IOCB_NOWAIT in !PageUptodate(page) branch
above and bail - which also removes the need for the two checks below...

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

  reply	other threads:[~2017-08-24 14:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-22 16:17 non-blocking buffered reads V4 Christoph Hellwig
2017-08-22 16:17 ` [PATCH 1/4] fs: pass iocb to do_generic_file_read Christoph Hellwig
2017-08-24 14:23   ` Jan Kara
2017-08-22 16:17 ` [PATCH 2/4] fs: support IOCB_NOWAIT in generic_file_buffered_read Christoph Hellwig
2017-08-24 14:31   ` Jan Kara [this message]
2017-08-25  7:36     ` Christoph Hellwig
2017-08-22 16:17 ` [PATCH 3/4] fs: support RWF_NOWAIT for buffered reads Christoph Hellwig
2017-08-24 14:38   ` Jan Kara
2017-08-22 16:17 ` [PATCH 4/4] block_dev: support RFW_NOWAIT on block device nodes Christoph Hellwig
2017-08-24 14:39   ` Jan Kara
  -- strict thread matches above, loose matches on Subject: below --
2017-08-29 14:13 non-blocking buffered reads V5 Christoph Hellwig
2017-08-29 14:13 ` [PATCH 2/4] fs: support IOCB_NOWAIT in generic_file_buffered_read Christoph Hellwig
2017-09-04 12:47   ` Jan Kara
2017-07-06 15:30 non-blockling buffered reads V3 Christoph Hellwig
2017-07-06 15:30 ` [PATCH 2/4] fs: support IOCB_NOWAIT in generic_file_buffered_read Christoph Hellwig
2017-07-07 10:23   ` Mel Gorman

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=20170824143141.GB8969@quack2.suse.cz \
    --to=jack@suse.cz \
    --cc=Volker.Lendecke@sernet.de \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=milosz@adfin.com \
    --cc=rgoldwyn@suse.com \
    --cc=viro@zeniv.linux.org.uk \
    /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.