linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Goldwyn Rodrigues <rgoldwyn@suse.de>
Cc: linux-fsdevel@vger.kernel.org, jack@suse.cz,
	Goldwyn Rodrigues <rgoldwyn@suse.com>
Subject: Re: [PATCH 2/7] noblocking aio: Return if cannot get hold of i_rwsem
Date: Mon, 20 Feb 2017 01:24:39 -0800	[thread overview]
Message-ID: <20170220092439.GE5664@infradead.org> (raw)
In-Reply-To: <20170214024603.9563-3-rgoldwyn@suse.de>

> +	/* Don't sleep on inode rwsem */
> +	if (iocb->ki_flags & IOCB_NONBLOCKING) {
> +		if (!inode_trylock(inode))
> +			return -EAGAIN;
> +	} else
> +		inode_lock(inode);

A way to avoid the additional branch in the fast path would be:

	if (!inode_trylock(inode)) {
		if (iocb->ki_flags & IOCB_NONBLOCKING)
			return -EAGAIN;
		inode_lock(inode);
	}

but otherwise this looks fine:

Reviewed-by: Christoph Hellwig <hch@lst.de>

  reply	other threads:[~2017-02-20  9:24 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-14  2:45 [PATCH 0/7] Non-blocking AIO Goldwyn Rodrigues
2017-02-14  2:45 ` [PATCH 1/7] nonblocking aio: Introduce IOCB_FLAG_NONBLOCKING Goldwyn Rodrigues
2017-02-14 18:51   ` Jeff Moyer
2017-02-15 14:51     ` Goldwyn Rodrigues
2017-02-20  9:23   ` Christoph Hellwig
2017-02-14  2:45 ` [PATCH 2/7] noblocking aio: Return if cannot get hold of i_rwsem Goldwyn Rodrigues
2017-02-20  9:24   ` Christoph Hellwig [this message]
2017-02-14  2:45 ` [PATCH 3/7] nonblocking aio: return if direct write will trigger writeback Goldwyn Rodrigues
2017-02-20  9:25   ` Christoph Hellwig
2017-02-14  2:46 ` [PATCH 4/7] nonblocking aio: return on congested block device Goldwyn Rodrigues
2017-02-14  3:55   ` Ming Lei
2017-02-15 11:13     ` Goldwyn Rodrigues
2017-02-14  2:46 ` [PATCH 5/7] nonblocking aio: ext4 Goldwyn Rodrigues
2017-02-14 19:52   ` Andreas Dilger
2017-02-15 11:20     ` Goldwyn Rodrigues
2017-02-14  2:46 ` [PATCH 6/7] nonblocking aio: xfs Goldwyn Rodrigues
2017-02-14  6:44   ` Darrick J. Wong
2017-02-14  7:43   ` Christoph Hellwig
2017-02-15 15:30     ` Goldwyn Rodrigues
2017-02-15 16:11       ` Goldwyn Rodrigues
2017-02-16 20:21         ` Christoph Hellwig
2017-02-16 20:44           ` Goldwyn Rodrigues
2017-02-14  2:46 ` [PATCH 7/7] nonblocking aio: btrfs Goldwyn Rodrigues
2017-02-14  9:24   ` Nikolay Borisov
2017-02-20  9:21 ` [PATCH 0/7] Non-blocking AIO Christoph Hellwig
2017-03-03 10:50 ` Michael Kerrisk

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=20170220092439.GE5664@infradead.org \
    --to=hch@infradead.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=rgoldwyn@suse.com \
    --cc=rgoldwyn@suse.de \
    /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;
as well as URLs for NNTP newsgroup(s).