lkml.org 
[lkml]   [2018]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] jffs2: safely remove obsolete dirent from the f->dents list
From
Date


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]
\
 
 \ /
  Last update: 2018-05-04 10:19    [W:0.055 / U:0.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site