lkml.org 
[lkml]   [2010]   [Dec]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] cramfs: generate unique inode number for better inode cache usage
On Tue, Dec 14, 2010 at 3:32 PM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
> Why do you repeat that
>
>    inode = iget_locked(sb, cramino(cramfs_inode, offset));
>    if (inode && (inode->i_state & I_NEW)) {
>
> so many times?
>
> Wouldn't it be nicer to just do it once at the top?

Oh, and I think it's probably nicer to then do the if-statements as a

switch (cram_inode->mode & S_IFMT) {
case S_IFREG:
..

but what I objected to in the previous patch was doing it multiple
times, and moving the nice separate helper function into the caller.

So I _think_ you should be able to just do something like this:

ino = cramino(cramfs_inode, offset);
switch (cram_inode->mode & S_IFMT) {
case S_IFREG:
fops = generic_ro_fops;
aops = &cramfs_aops;
break;
case S_IFDIR:
...
default:
ino = CRAMINO_UNIQ(offset);
}
inode = iget_locked(sb, ino);
if (inode && (inode->i_state & I_NEW)) {
inode->i_ops = iops;
inode->i_fops = fops;
inode->i_data.a_ops = aops;
setup_inode(inode, cramfs_inode, cramfs_inode->size);
}

or whatever?

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2010-12-15 00:47    [W:0.167 / U:0.516 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site