Messages in this thread | | | Subject | Re: [PATCH] jffs2: safely remove obsolete dirent from the f->dents list | From | David Woodhouse <> | Date | Fri, 04 May 2018 09:18:18 +0100 |
| |
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. [unhandled content-type:application/x-pkcs7-signature]
| |