Skip to contentSkip to conversation

Interesting MTD (jffs2) problem - magic bitmask not found

DISCUSSION Michael Palme 2 participants 3 messages Oct 1, 2002 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

hello...

i've posted this on linux-arm mailing list, but i think its also interesting for this list...

i run 2.4.18-rmk7 with mtd from cvs (mid september). problem as follows:

# cat /proc/mtd
  dev:    size   erasesize  name
  mtd0: 00040000 00040000 "blob"
  mtd1: 00040000 00040000 "parm"
  mtd2: 00100000 00040000 "krnl"
  mtd3: 00400000 00040000 "rd"
  mtd4: 00100000 00040000 "krnl2"
  mtd5: 00400000 00040000 "rd2"
  mtd6: 01580000 00040000 "jffs2"
# mtd_debug info /dev/mtd6
  mtd.type = MTD_NORFLASH
  mtd.flags = MTD_CAP_NORFLASH
  mtd.size = 22544384 (21M)
  mtd.erasesize = 262144 (256K)
  mtd.oobblock = 0
  mtd.oobsize = 0
  mtd.ecctype = MTD_ECC_NONE
  regions = 0
# cd /root
# ls temp
  temp1  temp2
# mkfs.jffs2 -r temp -e 262144 -o jffs2img
# eraseall /dev/mtd6
  Erasing 256 Kibyte @ ...[snip]...  100% complete.
# cp jffs2img /dev/mtd6
# mount /dev/mtdblock6 -t jffs2 /mnt/jffs2/
# cd /mnt/jffs2
# ls
  temp1  temp2
# rm -r temp*
... [this tooks very long time] ...
# ls
# cd /
# umount /mnt/jffs2/
# mount /dev/mtdblock6 -t jffs2 /mnt/jffs2/
?????????????????????????????????????????????????????????????????????
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040000:
0x2003 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040004:
0x000c instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040008:
0xdc6d instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00080000:
0x2003 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00080004:
0x000c instead
...[snip]...
?????????????????????????????????????????????????????????????????????
# mount
  /dev/ramdisk on / type ext2 (rw)
  none on /proc type proc (rw)
  /dev/mtdblock6 on /mnt/jffs2 type jffs2 (rw)
# cd /mnt/jffs2/
# ls
#
...

best regards... Michael Palme

#1 lore raw

Re: jffs2 problem - magic bitmask not found

hello again :-)

after lots of time playing around that thing put me really into madness...

but could be i am doing something wrong!?
please verify:

i want to use jffs2 on my strongarmboard with 32Mb Intel strata flash. so i think things to do to get a working jffs2 partition are as follows:

* built kernel with mtd and jffs2 support (i have done this ... kernel 2.4.18-rmk7 with patched in mtd-cvs)

* built mtd-utils (successfully done -- crossbuilt for running on arm native)

* create partitions on flash (i have done this via commmand line partition table parsing -- CONFIG_CMDLINE="root=/dev/ram0 mtdparts=sa1100:256k(blob),256k(parm),1M(krnl),4M(rd),1M(krnl2),4M(rd2),-(jffs2)")

* erase the jffs2 partition (done via "eraseall /dev/mtd6" -- also tried to delete it via jtag, so im sure theres no crap in after erasing...)

* verify things ("cat /proc/mtd" and "mtd_debug info /dev/mtd6" -- okay, everything as expected)

* create a jffs2 image (done via "mkfs.jffs2 -r foo -o jffs2.img -p -e 262144" -- image contains only a dummy file and is very small)

* copy the image to the mtd partition ("cp jffs2.img /dev/mtd6")

* mounting the jffs2 partition 1st time (works okay via "mount -t jffs2 /dev/mtdblock6 /mnt/jffs2")

* verify contents (okay "ls /mnt/jffs2" shows the dummy file)

BUT THEN:

* umount jffs2 part ("umount /mnt/jffs2") takes *very* long

* immediately remount of the jffs2 part brings lots of error messages:

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040000:
0x2003 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040004:
0x000c instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040008:
0xdc6d instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00080000:
0x2003 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00080004:
0x000c instead

* but after that, "mount" shows the jffs2 part as mounted and i can see the dummy file again

* now unmounting again -- now very fast!?

i've tried again and again... no success.

please who can help
i need the fs for production use...

thanks in advance ... Michael Palme

#2 lore raw

RE: jffs2 problem - magic bitmask not found

Quoted 32 lines

hello again :-)

after lots of time playing around that thing put me really into madness...

but could be i am doing something wrong!?
please verify:

i want to use jffs2 on my strongarmboard with 32Mb Intel strata flash. so i think things to do to get a working jffs2 partition are as follows:

* built kernel with mtd and jffs2 support (i have done this ... kernel 2.4.18-rmk7 with patched in mtd-cvs)

* built mtd-utils (successfully done -- crossbuilt for running on arm native)

* create partitions on flash (i have done this via commmand line partition table parsing -- CONFIG_CMDLINE="root=/dev/ram0 mtdparts=sa1100:256k(blob),256k(parm),1M(krnl),4M(rd),1M(krnl2),4M(rd2),-(jffs2)")

* erase the jffs2 partition (done via "eraseall /dev/mtd6" -- also tried to delete it via jtag, so im sure theres no crap in after erasing...)

* verify things ("cat /proc/mtd" and "mtd_debug info /dev/mtd6" -- okay, everything as expected)

* create a jffs2 image (done via "mkfs.jffs2 -r foo -o jffs2.img -p -e 262144" -- image contains only a dummy file and is very small)

* copy the image to the mtd partition ("cp jffs2.img /dev/mtd6")

Quoted 8 lines

* mounting the jffs2 partition 1st time (works okay via "mount -t jffs2 /dev/mtdblock6 /mnt/jffs2")

* verify contents (okay "ls /mnt/jffs2" shows the dummy file)

BUT THEN:

* umount jffs2 part ("umount /mnt/jffs2") takes *very* long

JFFS2 is probaly erasing and putting a CLEANMARKER on all unused erase blocks and will block until it's finished. I think this can be fixed.

What happens if you wait 5-10 minutes before you unmount the FS for the time? While waiting, do a couple of 'df' commands and see if the Use field slowly increases to 100% and then drops back your expected usage.

Quoted 13 lines

* immediately remount of the jffs2 part brings lots of error messages:

jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040000:
0x2003 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040004:
0x000c instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040008:
0xdc6d instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00080000:
0x2003 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00080004:
0x000c instead

No idea why this happens.

Quoted 5 lines

* but after that, "mount" shows the jffs2 part as mounted and i can see the dummy file again

* now unmounting again -- now very fast!?

That's because JFFS2 already has marked all unused erase blocks with a CLEANMARKER.

Jocke

Quoted 13 lines

i've tried again and again... no success.

please who can help
i need the fs for production use...

thanks in advance ... Michael Palme

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