[U-Boot] [PATCH 1/7] JFFS2: Bug fix for summary support

Detlev Zundel dzu at denx.de
Fri Apr 29 14:57:41 CEST 2011


Hi,

>  1/ Get the latest DIRENT
>  For example, if you create a file in linux jffs2 which config summary
>  support, then you delete the file , you will not see the file  in
>  linux jffs2. But you can also see this file in uboot after you reset
>  the system. That is because all the nodes in jffs2 which config summary
>  will not be marked as obsolete. The deleted file's DIRENT node will be
>  seen in uboot. So what we need to do is to get the latest DIRENT whose
>  ino in DIRENT is 0.

Sorry, but I do not understand that last sentence.  Can you clarify this
please?

>  Than we will not see this file in uboot which is
>  what we want.
>
>  2/ Add CONFIG_SYS_JFFS2_SORT_FRAGMENTS definition,if we config jffs2
>  summary in uboot.
>  All the inodes of a file will not marked as obsolete, if they do not
>  sort in the list struct b_node *, the latest data in inode may be
>  overwritten by the older one.

Also I have trouble making sense of this text.

>
> Signed-off-by: Baidu Liu <liucai.lfn at gmail.com>
> ---
>  fs/jffs2/jffs2_1pass.c      |   17 ++++++++++++-----
>  fs/jffs2/jffs2_nand_1pass.c |   17 +++++++++++++----
>  include/jffs2/jffs2.h       |   10 ++++++++++
>  3 files changed, 35 insertions(+), 9 deletions(-)

[...]

> diff --git a/include/jffs2/jffs2.h b/include/jffs2/jffs2.h
> index 651f94c..5b006c0 100644
> --- a/include/jffs2/jffs2.h
> +++ b/include/jffs2/jffs2.h
> @@ -41,6 +41,16 @@
>  #include <asm/types.h>
>  #include <jffs2/load_kernel.h>
>  
> +#ifdef CONFIG_JFFS2_SUMMARY
> +#ifndef CONFIG_SYS_JFFS2_SORT_FRAGMENTS
> +/*
> +we should define CONFIG_SYS_JFFS2_SORT_FRAGMENTS,if
> +CONFIG_JFFS2_SUMMARY is enabled.
> +*/
> +#define CONFIG_SYS_JFFS2_SORT_FRAGMENTS
> +#endif
> +#endif
> +
>  #define JFFS2_SUPER_MAGIC 0x72b6
>  
>  /* Values we may expect to find in the 'magic' field */

If JFFS2_SUMMARY _needs_ SORT_FRAGMENTS, then we should say so, i.e.

/*
CONFIG_JFFS2_SUMMARY will not work correctly without
CONFIG_SYS_JFFS2_SORT_FRAGMENTS
*/

Alas, technically I do not understand why that is the case.  So I invite
people more knowledgeable with JFFS2 to comment on this bit.

[time passes]

Wait a minute - I tried to understand the code here - is it possible
that SORT_FRAGMENTS really is needed _whenever_ we have a read-write
JFFS2 filesystem?  I.e. even without summary support we will have
problems without SORT_FRAGMENTS?

Wow, if this is true, then the option is certainly named completely
misleading and most boards using JFFS2 actually use incorrect code....

We should define this option by default and only let people undefine it
if they know exactly what they do.

Cheers
  Detlev

-- 
An elephant is a mouse with an operating system.
                                        -- Donald Knuth
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de


More information about the U-Boot mailing list