Re: [PATCH] make last_inode counter in new_inode 32-bit on kernels that offer x86 compatability

From: Matthew Wilcox
Date: Tue Nov 07 2006 - 11:10:37 EST


On Tue, Nov 07, 2006 at 10:56:06AM -0500, Jeff Layton wrote:
> retry:
> - if (counter > max_reserved) {
> - head = inode_hashtable + hash(sb,counter);
> - res = counter++;
> + if (sb->s_lastino >= max_reserved) {
> + head = inode_hashtable + hash(sb,++sb->s_lastino);
> + res = sb->s_lastino;

I think it'd be clearer to write this as:

res = ++sb->s_lastino;
head = inode_hashtable + hash(sb, res);

My eye skipped over the preincrement entirely the way it's currently
written.

> inode = find_inode_fast(sb, head, res);
> if (!inode) {
> spin_unlock(&inode_lock);
> return res;
> }
> } else {
> - counter = max_reserved + 1;
> + sb->s_lastino = max_reserved;
> }
> goto retry;
>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/