Skip to contentSkip to conversation

shared/032: add options for jffs2

PATCH Superseded Su Yue 1 participant 1 message Dec 19, 2020 Memory technology devices (MTD)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Su Yue

author
#0 lore raw

PATCH 1/1 shared/032: add options for jffs2

Recently I found that my disk space was eaten by results/shared/032.full after one round of xfstests running. The file was filled with binary bytes by the command:
mkfs -t jffs2 /dev/mapper/test-2 >> results/shared/032.full 2>&1

Manual of mkfs.jffs2:
========================================================================
The program mkfs.jffs2 creates a JFFS2 (Second Journalling Flash File System) file system image and writes the resulting image to the file specified by the -o option or by default to the standard output, unless the standard output is a terminal device in which case mkfs.jffs2 will abort. The file system image is created using the files and directories contained in the directory specified by the option -r or the present directory, if the -r option is not specified.
========================================================================

So the command equals to

`mkfs -t jffs2 -r xfstests-dev /dev/mapper/test-2 \
    -o results/shared/032.full >> results/shared/032.full 2>&1`

The output image 032.full is under the directory xfstests-dev. mkfs.jffs2 keeps reading from 032.full in page size and append bytes to 032.full until the disk where xfstests-devel located is full.

Fix it by setting @preargs to '-r /proc/fs -o' for jffs2, now the output is $SCRATCH_DEV. Since mkfs.jffs2 doesn't check overwrite case, just skip overwrite attempt.

---
 tests/shared/032 | 5 +++++
 1 file changed, 5 insertions(+)
tests/shared/032 +5 -0
index 00ae6860d9d5..5da606177440 100755
@@ -55,6 +55,8 @@ do
 	[ $fs = ext3 ] && preargs="-F"
 	[ $fs = ext4 ] && preargs="-F"
 	[ $fs = ext4dev ] && preargs="-F"
+	# jffs2 mkfs requires '-r $directory' and '-o $image'
+	[ $fs = jffs2 ] && preargs="-r /proc/fs -o"
 
 	# overwite the first few Kb - should blow away superblocks
 	$here/src/devzero -n 20 $SCRATCH_DEV >/dev/null
@@ -66,6 +68,9 @@ do
 
 	if [ $? -eq 0 ] ; then
 		# next, ensure we don't overwrite it
+		# jffs mkfs don't check overwrite case
+		[ $fs = jffs2 ] && continue
+
 		echo "=== Attempting $FSTYP overwrite of $fs..." >>$seqres.full
 		${MKFS_PROG} -t $FSTYP $SCRATCH_DEV >>$seqres.full 2>&1
 
Signature · 6 lines
2.29.2


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/