lkml.org 
[lkml]   [2018]   [Apr]   [27]   [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
This looks a lot better than the first iteration; thank you for getting
it to this point. One last thing, I hope...
On Thu, 2018-03-29 at 20:00 +0800, Yufen Yu wrote:
>
> --- a/fs/jffs2/jffs2_fs_i.h
> +++ b/fs/jffs2/jffs2_fs_i.h
> @@ -42,6 +42,12 @@ struct jffs2_inode_info {
>         /* Directory entries */
>         struct jffs2_full_dirent *dents;
>  
> +       /* Directory open refcount */
> +       atomic_t nr_dir_opening;
> +
> +       /* obsolete dirent count in the list of 'dents' */
> +       unsigned int obsolete_count;
> +
>         /* The target path if this is the inode of a symlink */
>         unsigned char *target;
>  

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*?).

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?[unhandled content-type:application/x-pkcs7-signature]
\
 
 \ /
  Last update: 2018-04-28 00:23    [W:0.570 / U:0.652 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site