Skip to contentSkip to conversation

Frequent Writes to NAND flash with UBIFS in sychronous mode

DISCUSSION Joe 3 participants 5 messages Nov 8, 2012 – Nov 16, 2012 2 messages not in the archive Memory technology devices (MTD)

lore
Share & tools
lore

Joe

author
#0 lore raw

Hi,
I have the following observation when UBIFS is mounted as synchronous fs. (-o
sync option from bootargs).

1. For every file read, there are writes to nand flash.
2. For the execution of every command, there are writes to nand flash. For ex. On execution of any command, say 'cd' or 'ls' i observe quiet a few
writes happening to NAND flash.

What could be the reason for this behaviour? Any other option to bring down the amount of writes but by retaining the synchronous behaviour?

With sync option enabled, we expect Flash writes to happen more frequently , how-ever we do not want writes to happen with the execution of every command.

This observation holds true for linux 2.6.28, 2.6.35 & 3.4.10 linux kernel versions.

Since, there is a limit on number of writes per block of nand flash, we are concerned if the above behaviour will trigger a faster nand corruption on the long run.

Regards,
Joe.

#1 lore raw
Quoted 8 lines · Joe

Hi,
I have the following observation when UBIFS is mounted as synchronous fs. (-o sync option from bootargs).

1. For every file read, there are writes to nand flash.
2. For the execution of every command, there are writes to nand flash. For ex. On execution of any command, say 'cd' or 'ls' i observe quiet a few writes happening to NAND flash.

I'm no expert but I could imagine two reasons, one, that there are cached writes which are being performed shortly after your read operations.

Two, it could be that the UBI scrub functionality is (erroneously) detecting that the data needs to be rewritten and consequently does a rewrite whenever something is read.

Does this only happen in synchronous mode?

In general reading should not cause anything to be written. In fact, you can mount a static UBI volume as a file system (which cannot be rewritten on a block basis, only on a volume basis) which wouldn't be possible if there were writes being performed. (In all honesty, I haven't tried using -o sync when doing this though).

/Ricard

Signature · 3 lines
Ricard Wolf Wanderlöf                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30

A message that is not in the archive (sent off-list or not yet received): CAHT8gTMcFtwJ2qkW0rhzWVKeS0R3AjLVp27H4WhVVcbJf1ZBTQ@mail.gmail.com

#3 lore raw
Quoted 4 lines · Tech tech

Hi Ricard,
 Thanks for the reply. Yes. This observation is only with synchronous mode. Without '-sync' option, writes doesn't happen with reads.
Can you explain a little more on the "cached writes" that you mentioned?

Sorry, thinking about it, that would be valid for the case without '-o sync' where write operations do not happen right away but are buffered. But in the synchronous case writes should be performed more or less immediately.

Quoted 1 line

I will try to check the UBI scrub part & will update.

I was thinking along the lines of misconfigured hardware or software believing that there were bit flips in the data and it needed to be rewritten for that reason.

/Ricard

Signature · 3 lines
Ricard Wolf Wanderlöf                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30

A message that is not in the archive (sent off-list or not yet received): CAHT8gTMP3NdsxSSe4OXHEU0FZcR9tMj3OG31w0TUMeRY4vZqEQ@mail.gmail.com

#5 lore raw
Quoted 1 line · Tech tech

Ok. Got it. W.r.t erroneous identification of bit flips within hardware/software, we verified that the ECC algorithm doesn't report bit flips before writes. Though there were a few ECC errors reported by hardware, that could be corrected the the ECC correction algorithm. Is this what you meant?   -Joe

What I meant was that UBI upon detecting that ECC corrections have been applied will schedule the relevant blocks for rewrite, to avoid further bit flips causing the data to become unreadable. Such detection is performed when reading, hence reading data where bit flips have been detected (even if they have been corrected by the ECC algorithm) can result in writes, even if they don't necessarily occur immediately after the read which scheduled them.

How many are 'a few ECC errors', and over how long a time from where the detected?

/Ricard

Quoted 35 lines

On Fri, Nov 9, 2012 at 4:12 PM, Ricard Wanderlof <[email protected]> wrote:

On Fri, 9 Nov 2012, Tech tech wrote:

Hi Ricard,
 Thanks for the reply. Yes. This observation is only with synchronous mode.
Without '-sync' option, writes doesn't happen with reads.
Can you explain a little more on the "cached writes" that you mentioned?

Sorry, thinking about it, that would be valid for the case without '-o sync' where write operations do not happen right away but are buffered. But in the synchronous case writes should be performed more or less immediately.

I will try to check the UBI scrub part & will update.

I was thinking along the lines of misconfigured hardware or software believing that there were bit flips in the data and it needed to be rewritten for that reason.

/Ricard
--
Ricard Wolf Wanderlöf                           ricardw(at)axis.com Axis Communications AB, Lund, Sweden            www.axis.com Phone +46 46 272 2016                           Fax +46 46 13 61 30

Signature · 3 lines
Ricard Wolf Wanderlöf                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30
#6 lore raw
In reply to Joe
Quoted 5 lines · Joe

Hi,
I have the following observation when UBIFS is mounted as synchronous fs. (-o
sync option from bootargs).

1. For every file read, there are writes to nand flash.

I do not believe it is UBIFS's fault. May be shell history?

Quoted 3 lines

2. For the execution of every command, there are writes to nand flash. For ex. On execution of any command, say 'cd' or 'ls' i observe quiet a few
writes happening to NAND flash.

Also I do not believe it is UBIFS's fault.

Quoted 3 lines

What could be the reason for this behaviour? Any other option to bring down the amount of writes but by retaining the synchronous behaviour?

This is your environment most probably.

Quoted 2 lines

With sync option enabled, we expect Flash writes to happen more frequently , how-ever we do not want writes to happen with the execution of every command.

Sure, explore who does the writes and why. E.g., enabe the "general" extra messages - this should print PIDs and file-names for all I/O. See

http://www.linux-mtd.infradead.org/faq/ubifs.html#L_how_debug

Quoted 2 lines

This observation holds true for linux 2.6.28, 2.6.35 & 3.4.10 linux kernel versions.

Signature · 2 lines
Best Regards,
Artem Bityutskiy