[<prev] [next>] [day] [month] [year] [list]
Message-ID: <4FABC7A1.9010003@jpberlin.de>
Date: Thu, 10 May 2012 15:50:25 +0200
From: Thomas Bechtold <thomasbechtold@...erlin.de>
To: linux-kernel@...r.kernel.org, linux-mmc@...r.kernel.org,
cjb@...top.org
Subject: reliable write to micro sd-card with O_SYNC and O_DIRECT not possible
Hi,
i tried to write some pages (each 512 byte) to a industrial micro
sd-card (from delkin devices, 2 GB) with O_SYNC and O_DIRECT but the
write process is not reliable when i remove the card.
i do the following:
1) open the device (with O_DIRECT and O_SYNC)
2) write the page to the card
3) close the device
4) open the device
5) read the page
6) compare the read page with the written page
7) if both pages are equal, the page-write was successful. otherwise, an
error code is returned.
The strange thing is, that my write-process returns successfully
(written and read page are equal)but when i later read the card, some
pages are empty.
I can reproduce this behavior with the attached testprogram when i do
the following:
1) start the program with ./mmc-test write //and fix the device path
MEMORY_DEVICE_PATH before you start the program
2) remove and attach the memory card 10x
3) start the program with ./mmc-test read
now there are some pages which should be successfully written, but in
fact are unavailable.
i tested this with a usb-mmc-card adapter on i386 (debian 3.2 backports
kernel)and with the atmel-mci driver on arm at91 platform (3.2.16
upstream kernel).
TIA,
Tom
View attachment "mmc-write.c" of type "text/x-csrc" (5342 bytes)
Powered by blists - more mailing lists