From: Christoph Hellwig <hch@infradead.org>
To: NeilBrown <neilb@suse.de>
Cc: Trond Myklebust <trond.myklebust@primarydata.com>,
linux-nfs@vger.kernel.org
Subject: Re: [PATCH 1/7] NFS: nfs4_lookup_revalidate: only evaluate parent if it will be used.
Date: Tue, 15 Jul 2014 09:56:37 -0700 [thread overview]
Message-ID: <20140715165637.GA22566@infradead.org> (raw)
In-Reply-To: <20140714012820.12562.14018.stgit@notabene.brown>
On Mon, Jul 14, 2014 at 11:28:20AM +1000, NeilBrown wrote:
> nfs4_lookup_revalidate only uses 'parent' to get 'dir', and only
> uses 'dir' if 'inode == NULL'.
>
> So we don't need to find out what 'parent' or 'dir' is until we
> know that 'inode' is NULL.
>
> By moving 'dget_parent' inside the 'if', we can reduce the number of
> call sites for 'dput(parent)'.
>
> Signed-off-by: NeilBrown <neilb@suse.de>
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
>
> /* We can't create new files in nfs_open_revalidate(), so we
> * optimize away revalidation of negative dentries.
> */
> if (inode == NULL) {
> + struct dentry *parent;
> + struct inode *dir;
> +
> + parent = dget_parent(dentry);
> + dir = parent->d_inode;
> if (!nfs_neg_need_reval(dir, dentry, flags))
> ret = 1;
> + dput(parent);
> goto out;
Seems like this could be further condensed to:
struct dentry *parent = dget_parent(dentry);
if (!nfs_neg_need_reval(parent->d_inode, dentry, flags))
ret = 1;
dput(parent);
goto out;
or maybe even kill the goto out now that it's just a simple return
without additional work.
next prev parent reply other threads:[~2014-07-15 16:56 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-14 1:28 [PATCH 0/7] Add RCU-walk support to NFS NeilBrown
2014-07-14 1:28 ` [PATCH 5/7] NFS: teach nfs_neg_need_reval to understand LOOKUP_RCU NeilBrown
2014-07-14 1:28 ` [PATCH 3/7] sunrpc/auth: allow lockless (rcu) lookup of credential cache NeilBrown
2014-07-14 1:28 ` [PATCH 6/7] NFS: teach nfs_lookup_verify_inode to handle LOOKUP_RCU NeilBrown
2014-07-14 1:28 ` [PATCH 4/7] NFS: support RCU_WALK in nfs_permission() NeilBrown
2014-07-14 1:28 ` [PATCH 2/7] NFS: prepare for RCU-walk support but pushing tests later in code NeilBrown
2014-07-14 1:28 ` [PATCH 7/7] NFS: allow lockless access to access_cache NeilBrown
2014-07-14 1:28 ` [PATCH 1/7] NFS: nfs4_lookup_revalidate: only evaluate parent if it will be used NeilBrown
2014-07-15 16:56 ` Christoph Hellwig [this message]
2014-07-14 2:00 ` [PATCH 0/7] Add RCU-walk support to NFS Trond Myklebust
2014-07-14 2:25 ` NeilBrown
2014-07-14 2:39 ` Trond Myklebust
2014-07-23 7:14 ` NeilBrown
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=20140715165637.GA22566@infradead.org \
--to=hch@infradead.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--cc=trond.myklebust@primarydata.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 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.