[PATCH 0/2] Fix Jffs2 type flash erase problem

Xiaolei Li xiaolei.li at mediatek.com
Sun Apr 8 20:10:08 PDT 2018


Jffs2 clean marker is not written actually, because OOB write length is
set to 0 when do mtd_write(). So, "-j" option of flash_erase is usless now.

This patch adds support to access OOB available size by
/sys/class/mtd/mtdX/oobavail. Then, user can write clean marker to OOB
free area with the minimum size between OOB available size and 8. This
is the same with Jffs2 itself. Please refer the function
jffs2_write_nand_cleanmarker() in the kernel file fs/jffs2/wbuf.c.

And this patch depends on the reviewing patch "mtd: Add sysfs attribute for
mtd OOB available size"[1].

Changes relative to:
--------------------
tree	: https://github.com/sigma-star/mtd-utils
branch	: master
commit	:
	'commit 80de29a464c7 ("mkfs.ubifs: Allow root entry in device
	 table")'

Tests:
------
* do "flash_erase -j" operation on SLC NAND MT29F16G08ADBCA, which page
  size is 4096, oob size is 224.
* mount jffs2 file system, do "dd" test, and there is no problem.

[1] https://patchwork.kernel.org/patch/10319475/

Xiaolei Li (2):
  libmtd: Add support to access OOB available size
  misc-utils: flash_erase: Fix Jffs2 type flash erase problem

 include/libmtd.h         | 2 ++
 lib/libmtd.c             | 7 +++++++
 lib/libmtd_int.h         | 3 +++
 misc-utils/flash_erase.c | 9 +++++----
 4 files changed, 17 insertions(+), 4 deletions(-)

-- 
1.9.1




More information about the linux-mtd mailing list