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@xxxxxxx> Looks good, Reviewed-by: Christoph Hellwig <hch@xxxxxx> > > /* 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. -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html