Re: [PATCH 1/5] kernfs: implement i_generation

From: Tejun Heo
Date: Tue May 23 2017 - 15:20:08 EST


Hello,

On Tue, May 23, 2017 at 08:09:48AM -0700, Shaohua Li wrote:
> > i_generation is only supposed to be valid on a per-inode basis, so this
> > global counter seems really odd.
>
> What's the difference between per-inode or per-super? The i_generation doesn't
> need to be consecutive for an inode. I checked other fs, a lot of filesystems
> implement i_generation in this way, for example, f2fs, ext4.

One worry is that it is reasonably possible to wrap on the generation
number. Some setups go through cgroups really fast and wrapping 2^32
on the number of files ever created isn't that difficult over time.
This actually showing up as a malfunction would be very low probabilty
but is still nasty.

It'd be nice to give out unique 64bit id for each kn but then we can't
use idr. rbtree or extensible hash should work, right?

Thanks.

--
tejun