Re: [PATCH] jffs2: safely remove obsolete dirent from the f->dents list
From: David Woodhouse
Date: Fri May 04 2018 - 04:18:34 EST
On Fri, 2018-05-04 at 16:06 +0800, yuyufen wrote:
>
> > You've made JFFS2_INVALID_LIMIT 64, which is reasonable enough
> > (although it's a bit of a weird name and possibly wants to be more
> > specific â invalid *what*?).
>
> Thansk a lot for your suggestions.
>
> Yes, it is really a bad name. How about JFFS2_OBS_DIRENT_LIMIT? I amÂ
> not sure.
That'll do; at least it's a hint in the right direction :)
> >
> > So the maximum interesting value of ->obsolete_count is 64. Which means
> > it might as well be a uint8_t and sit in the padding after the
> > 'usercompr' field.
> >
> > It might be useful to look at putting the mutually exclusive fields in
> > struct jffs2_inode_info into a union, and then we don't need the
> > additional space of the atomic_t either; we'll never need that *and*
> > the fragtree at the same time... will we?
>
> You are right, thanks. But, obsolete_count may be large. So, I apply toÂ
> use uint16_t and it also sits in the padding after the 'usercompr'Â
> field.
You can always just cap it. Once it reaches 64 it never changes again,
until you actually harvest them. Without that, a uint16_t could
overflow too.
Attachment:
smime.p7s
Description: S/MIME cryptographic signature