[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1332758696.6913.3.camel@tucsk.pomaz.szeredi.hu>
Date: Mon, 26 Mar 2012 12:44:56 +0200
From: Miklos Szeredi <mszeredi@...e.cz>
To: Christoph Hellwig <hch@...radead.org>
Cc: Miklos Szeredi <miklos@...redi.hu>, viro@...IV.linux.org.uk,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 8/9] vfs: split __lookup_hash
On Tue, 2012-03-20 at 12:39 -0400, Christoph Hellwig wrote:
> On Tue, Mar 06, 2012 at 01:56:40PM +0100, Miklos Szeredi wrote:
> > From: Miklos Szeredi <mszeredi@...e.cz>
> >
> > Split __lookup_hash into two component functions:
> >
> > lookup_dcache - tries cached lookup, returns whether real lookup is needed
> > lookup_real - calls i_op->lookup
> >
> > This eliminates code duplication between d_alloc_and_lookup() and
> > d_inode_lookup().
>
> The return value from lookup_dcache is a bit confusing. What about
> returning the need_lookup flag, and passing the dentry as a parameter,
> that way the callers would do the more obvious:
>
> if (lookup_dcache(name, base, nd, &dentry))
> return dentry;
>
> instead of having to check two conditions.
>
The reason I dislike your version is that returning an error value in an
argument would be strange.
And this works too:
dentry = lookup_dcache(name, base, nd, &need_lookup);
if (!need_lookup)
return dentry;
Thanks,
Miklos
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists