Re: [PATCH 1/3] new_inode_autonum: add per-sb lastino counter and add new_inode_autonum function that guarantees i_ino uniqueness

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 09, 2006 at 10:24:39AM -0500, Jeff Layton wrote:
> +/**
> + *	new_inode_autonum 	- obtain an inode with a unique i_ino value
> + *	@sb: superblock
> + *
> + *	Allocates a new inode for given superblock. Ensures that i_ino is
> + *	unique on the filesystem.
> + */
> +struct inode *new_inode_autonum(struct super_block *sb)
> +{
> +	struct inode *inode;
> +
> +	inode = __new_inode(sb);
> +	inode->i_ino = iunique(sb, 0);
> +	return inode;

Why do we need this wrapper?  The callers could aswell just do the
iunique call themselves.  It's already exported aswell.

> +/**
> + *	new_inode 	- obtain an inode -- i_ino not guaranteed unique
> + *	@sb: superblock
> + *
> + *	Allocates a new inode for given superblock. i_ino is not guaranteed to
> + *	be unique. Should only be used when i_ino is going to be clobbered.
> + */
> +struct inode *new_inode(struct super_block *sb)
> +{
> +	struct inode *inode;
> +
> +	inode = __new_inode(sb);
> +	inode->i_ino = 0; /* 0 to try to catch callers that don't reset it */
> +	return inode;

And this wrapper is rather pointless as inode_init_once already zeroes the
whole inode.  Just keep the name new_inode for the basic don't assigned
inode number thing.

> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -961,6 +961,14 @@ #endif
>  	/* Granularity of c/m/atime in ns.
>  	   Cannot be worse than a second */
>  	u32		   s_time_gran;
> +
> +	/* per-sb inode counter for new_inode. Make it a 32-bit counter when
> +	   we have the possibility of dealing with 32-bit apps */
> +#ifdef CONFIG_COMPAT
> +	unsigned int		s_nextino;
> +#else
> +	unsigned long		s_nextino;
> +#endif

This is more thanb ugly.  CONFIG_COMPAT should not modify core kernel
behaviour.  It's also short sightened as we once again plan to support
64bit inode numbers on 32bit hosts.

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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux