Re: Direct flash access from filesystem


Carles Cufi
 

Hi,

-----Original Message-----
From: zephyr-devel-bounces@... [mailto:zephyr-devel-
bounces@...] On Behalf Of Paul Sokolovsky
Sent: 21 August 2017 11:01
To: Andrzej Kaczmarek <andrzej.kaczmarek@...>
Cc: zephyr-devel@...
Subject: Re: [Zephyr-devel] Direct flash access from filesystem

Hello Andrzej,

On Mon, 21 Aug 2017 10:31:26 +0200
Andrzej Kaczmarek <andrzej.kaczmarek@...> wrote:

Hi all,

I'm porting NFFS (Newtron Flash File System) from Mynewt to Zephyr.
The original fs implementation has direct access to flash, i.e. it
will read, write and erase data to/from flash directly using flash
HAL. But existing fs implementation in Zephyr (FAT12) is using disk
subsystem to access flash so I wanted to do the same in NFFS, however
it does not seem to be useful here because:
- NFFS needs byte-level access to flash - disk subsystem allows
sector-level access only
- NFFS takes case of erasing sectors itself, when required - disk
subsystem does this during writes

​So does it make sense to try to adjust NFFS and/or disk subsystem to
work together? ​Or it's actually better to let NFFS access flash
directly, just as it does in Mynewt?
Well, NFFS is a *flash* filesystem, it's expected that it would require
more specific underlying device type than a generic FS like FAT which
can work on any block device. The situation is similar to Linux, where
JFFS2, etc. require not just a block device, but /dev/mtd (memory
technology device).

So, I wouldn't be surprised that such a requirement arises, but how to
deal with it - extend existing block device interface in Zephyr,
introduce a separate MTD interface, or just work on top of existing
flash drivers, if they are generic enough - that's what more
experienced folks may suggest, I hope.
I think that working directly on top of (standard) flash drivers for a flash filesystem is quite reasonable, since there is no reason to have an additional layer in this particular case. Whether that might have consequences in the future if multiple filesystems are mounted I do not know.

Regards,

Carles

Join {devel@lists.zephyrproject.org to automatically receive all group messages.