Re: Have ext3 on SanDisk CF but can't disable write-back caching as kernel instructs

From: pojen (pojen1_at_hotmail.com)
Date: 07/13/03


Date: Sun, 13 Jul 2003 01:48:40 -0700

I will suggest you to do some research on CF to IDE. If you use 2.4 kernel,
hack ide.c is must. Then, why not to put most of your system to cramfs and
read-only and just keep a small piece of the CF to r/w. Even the power lost,
your system will never lost after boot.
I used to put my /etc, /var and /tmp on ram disk when system-init and s-link
to cramfs system. Here is what I did:
1. keep a /etc somewhere cramfs and copy it to ramdisk at the boot time.
2. cramfs /etc s-link to ramdisk /etc mount point.
3. Then, copy your extra setting from r/w(if exist) to overwrite /etc
setting. If not exist, well, you still have the default one.
JFFS or JFFS2 can be done on CF but you will need mtd-cf module to simulate
MTD device(never try).

pojen

"Dan Harkless" <usenet@harkless.org> wrote in message
news:4189894b.0307101425.23f52806@posting.google.com...
> [Sorry if this post is a duplicate -- the original was refused by the
> moderated linux.kernel group, and I know with real Usenet servers that
> means the post won't make it to the other crossposted groups either --
> not sure whether or not this is the case for Google Groups...]
>
>
> My company is currently developing a Linux-based embedded device for
> installation on airliners. The OS is based on SuSE 8.2 Pro's Minimum
> System install.
>
> Our device may lose power at any time, but it's very important we
> don't corrupt our data or our filesystem metadata, so our filesystems
> (except our initrd-based root filesystem) are ext3, mounted
> 'data=journal'.
>
> At boot time, we get an error from the kernel saying that write-back
> caching needs to be turned off for disks containing journalled
> filesystems:
>
> % dmesg | grep hdc
> ide1: BM-DMA at 0x1408-0x140f, BIOS settings: hdc:pio, hdd:pio
> hdc: SanDisk SDCFB-256, CFA DISK drive
> hdc: attached ide-disk driver.
> hdc: task_no_data_intr: status=0x51 { DriveReady SeekComplete Erro
> r }
> hdc: task_no_data_intr: error=0x04 { DriveStatusError }
> hdc: 501760 sectors (257 MB) w/1KiB Cache, CHS=980/16/32
> hdc: hdc1 hdc2 hdc3
> hdc: hdc1 hdc2 hdc3
> hdc: hdc1 hdc2 hdc3
> hdc: hdc1 hdc2 hdc3
> hdc: hdc1 hdc2 hdc3
> hdc: hdc1 hdc2 hdc3
> hdc: drive_cmd: status=0x51 { DriveReady SeekComplete Error }
> hdc: drive_cmd: error=0x04 { DriveStatusError }
> hdc: cache flushing failed. disable write back cacheing for journa
> lled file systems
> hdc: drive_cmd: status=0x51 { DriveReady SeekComplete Error }
> hdc: drive_cmd: error=0x04 { DriveStatusError }
> hdc: cache flushing failed. disable write back cacheing for journa
> lled file systems
>
> Did some research and found that I need to use 'hdparm -W0' to turn
> off write-back caching (shouldn't that be handled automatically by the
> ext3 drivers?), but it fails to work on the SanDisk drive:
>
> % hdparm -W0 /dev/hdc
>
> /dev/hdc:
> setting drive write-caching to 0 (off)
> HDIO_DRIVE_CMD(setcache) failed: Input/output error
>
> I also found a post suggesting that the "SeekComplete Error" meant I
> should turn off DMA, but that doesn't work either:
>
> % hdparm -d0 /dev/hdc
>
> /dev/hdc:
> setting using_dma to 0 (off)
> HDIO_SET_DMA failed: Operation not permitted
> using_dma = 0 (off)
>
> Both commands work fine on the Seagate hard drive we have in the boxes
> during development (it won't be there in the field):
>
> % hdparm -W0 -d0 /dev/hda
>
> /dev/hda:
> setting using_dma to 0 (off)
> setting drive write-caching to 0 (off)
> using_dma = 0 (off)
>
> Is it to be expected that we can't disable write-back caching on the
> SanDisk drive? Is this the case for all CompactFlash disks, or just
> certain ones?
>
> What will the consequences be of not being able to disable write
> caching? Corruption of data / filesystems? Or just increased chance
> of lost (but not corrupted?) data if we lose power just after data has
> exited the journal?
>
> --
> Dan Harkless
> usenet@harkless.org
> http://harkless.org/dan/



Relevant Pages