2008-06-05 15:17:21 EXT3 Error Writing Large Files to CompactFlash
David Kasper (UNITED STATES)
Message: 56758
I have integrated the CompactFlash daughter card with the BF537-STAMP and am using EXT3 for the CompactFlash filesystem. My application writes test data to the drive (10 Megabyte file via 5Kbyte blocks) and I have implemented usleep(1) between every block written. I get the following error:
attempt to access beyond end of device
hda1: rw=1, want=8390664, limit=8027649
Buffer I/O error on device hda1, logical block 1048832
lost page write due to I/O error on hda1
journal_bmap: journal block not found at offset 16 on hda1
Aborting journal on device hda1.
ext3_abort called.
EXT3-fs error (device hda1): ext3_journal_start_sb: Detected aborted journal
Remounting filesystem read-only
attempt to access beyond end of device
hda1: rw=1, want=16781320, limit=8027649
attempt to access beyond end of device
hda1: rw=1, want=87067112, limit=8027649
__journal_remove_journal_head: freeing b_frozen_data
At this point I have to run fsck to fix errors on the drive. Does anybody have any suggestions to avoid this problem? I was thinking of increasing the sleep time between each block written. However, I still wouldn't know the root cause.
Thanks,
David Kasper
QuoteReplyEditDelete
2008-06-05 17:53:25 Re: EXT3 Error Writing Large Files to CompactFlash
Mike Frysinger (UNITED STATES)
Message: 56767
what do you mean by "integrated" ? did you buy one of the addon cards and just setup your software for it ?
you should be able to send a data stream to the card at fast as possible and not see errors. if you're getting errors, then either the hardware is unstable or the driver is ... userspace should not attempt to workaround either of those problems in any way.
QuoteReplyEditDelete
2008-06-05 17:57:48 Re: EXT3 Error Writing Large Files to CompactFlash
David Kasper (UNITED STATES)
Message: 56768
Mike,
I am using the CF/IDE-ATA/NAND BF537 STAMP Extender (PN ADDS-BF537CF-STEXT) and the ADDS-BF537-STAMP V2.1.
Dave
QuoteReplyEditDelete
2008-06-05 18:07:30 Re: EXT3 Error Writing Large Files to CompactFlash
Mike Frysinger (UNITED STATES)
Message: 56769
what kernel/toolchain versions are you using ? did you modify your flash bank timings like the documentation indicates ?
QuoteReplyEditDelete
2008-06-05 18:18:23 Re: EXT3 Error Writing Large Files to CompactFlash
David Kasper (UNITED STATES)
Message: 56770
Mike,
I am using Blackfin-toolchain-07r1.1-3.i386.rpm and uClinux-dist-2007r1.1-rc3. Also, I have the correct bank settings. Do you think I should try reducing the SCLK from 62 MHz?
Thanks,
Dave
QuoteReplyEditDelete
2008-06-05 18:29:44 Re: EXT3 Error Writing Large Files to CompactFlash
Mike Frysinger (UNITED STATES)
Message: 56771
is there a reason you're using 2007R1.1 and not 2008R1 ?
QuoteReplyEditDelete
2008-06-05 18:41:32 Re: EXT3 Error Writing Large Files to CompactFlash
David Kasper (UNITED STATES)
Message: 56772
Mike,
I started the project last year and never upgraded the kernel. Do you think I may have better luck with latest releases?
Dave
QuoteReplyEditDelete
2008-06-05 22:46:28 Re: EXT3 Error Writing Large Files to CompactFlash
Mike Frysinger (UNITED STATES)
Message: 56780
i can validate things on 2008R1 ... i just wanted to make sure you didnt just grab an old release
please post your kernel config file as an attachment
QuoteReplyEditDelete
2008-06-06 12:18:34 Re: EXT3 Error Writing Large Files to CompactFlash
David Kasper (UNITED STATES)
Message: 56823
Mike,
Attached is uClinux-dist/linux-2.6.x/.config. Let me know if I didn't attach the correct file. FYI, I plan on repeating the test with an EXT2 filesystem.
Dave
config
QuoteReplyEditDelete
2008-06-23 00:01:29 Re: EXT3 Error Writing Large Files to CompactFlash
David Kasper (UNITED STATES)
Message: 57698
Mike,
FYI, recall I am experiencing corrupt files or EXT2 filesystem errors with the '07 kernel using a test app writing to CompactFlash (100 files of 5Mbytes each). I have verified that the root cause isn't hardware by creating a SIMPLE driver that performs a media test of the device (ramp and another pattern). I have successfully written and read 14 Gbytes without a single error. So the error exists either in the '07 kernel or bundled IDE driver. Hopefully you will be able to perform the test on your end. Let me know if you need any test code or support. Or if you can build '08 for me I can test it in parallel. I am not familiar with a lot of details of the kernel design so let me know if my thinking doesn't make much sense. Since the problem exists in the release I was thinking of disabling the data cache or changing block sizes. But I am not sure if I should go higher or lower on the sizes. I wonder if I am running into a memory fragmentation issue... Also, I was going to search for any delays in the driver and maybe try doubling them to see if the problem goes-away.
David Kasper
QuoteReplyEditDelete
2008-06-27 13:19:05 Re: EXT3 Error Writing Large Files to CompactFlash
Mike Frysinger (UNITED STATES)
Message: 57968
i'm using a stamp in the default settings:
Clock: VCO: 500 MHz, Core: 500 MHz, System: 100 MHz
root:/mnt> hdparm -i /dev/hda
/dev/hda:
Model=SanDisk SDCFH2-002G, FwRev=HDX 4.32, SerialNo=003419E0197L1545
Config={ HardSect NotMFM Removeable DTR>10Mbs nonMagnetic }
RawCHS=3970/16/63, TrkSize=0, SectSize=576, ECCbytes=4
BuffType=(2) DualPort, BuffSize=1kB, MaxMultSect=4, MultSect=off
CurCHS=3970/16/63, CurSects=4001760, LBA=yes, LBAsects=4001760
IORDY=no, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
PIO modes: pio0 pio1 pio2 pio3 pio4
DMA modes: mdma0 mdma1 mdma2
AdvancedPM=no WriteCache=disabled
Drive conforms to: Unspecified: ATA/ATAPI-4
* current active mode
i dont know what your test code is doing, but i can create ~150meg files just fine, and then copy them around
double check your EBIU settings according to the documentation
QuoteReplyEditDelete
2008-06-28 15:06:04 Re: EXT3 Error Writing Large Files to CompactFlash
David Kasper (UNITED STATES)
Message: 58030
Mike,
Thanks for taking time to test CF. Lately I have made great progress. Note my settings are 62MHz SCLK with max wait states for bank3 (I think FFC3). However, I got it working by making the following changes:
1. Removed all instanes of "echo 3 > /proc/sys/vm/drop_caches"
2. Added "sync" after every file close (desirable to ensure mission critical data is on media). However, after about 10 file saves I encountered memory allocation core dumps. Via top I noticed the page cache level was 30M when this was occurring.
3. Rebuilding the kernel with settings for "small systems" I limited the size of the cache to 10M. This fixed the memory allocation error issue.
>>> Does anybody have any comments or know why? I just hacked this but don't understand the root cause. Thanks.
4. Since my test files have a pseudo-random patter I rebooted and ran a checker program that opens them up, reads contents and displays status if they are correct. After the first 4 files (5MB) the checker app would start reporting mismatches. So I inserted the CompactFlash into my PC and checked them manually but found the files were correct.
5. Rebuilding the kernel with Blackfin DCACHE disabled fixed the verify issue. I have tested 1500 files (5MB each) and haven't experienced a single error.
>>> To me this implies a driver error with regard to invalidating or flushing the BF data cache. Note the cache was previously configured to write through policy. If anyone has any understanding then comments are welcome.
6. Now all thats left is a unmount issue that I will post in a seperate thread.
Thanks to everybody for all the help along the way,
David Kasper
QuoteReplyEditDelete
2008-06-29 10:29:32 Re: EXT3 Error Writing Large Files to CompactFlash
Mike Frysinger (UNITED STATES)
Message: 58048
i seem to recall there being some low level IO bugs in the original 2007R1 release that were fixed in the 2007R1 branch (and thus is part of 2008R1)