Skip to content

filesystem: block device api is too specific #4023

@YarivCol

Description

@YarivCol

Description

  • Type: Enhancement

Enhancement

The api of block device have program and erase function instead of simply write function:
virtual int program(const void *buffer, bd_addr_t addr, bd_size_t size) = 0;
virtual int erase(bd_addr_t addr, bd_size_t size) = 0;

instead of:
virtual int write(const void *buffer, bd_addr_t addr, bd_size_t size) = 0;

also i think only two size function will be sufficient:

virtual bd_size_t size() const = 0;
virtual bd_size_t get_block_size() const = 0;

the main motivation of this enhancement is to change the api to look more like proven block device api like the linux kernel one.
Also for encapsulate reasons: files system needs only to write to device without knowing how the device itself works (erase, program), even more in current fat wrapper in each write erase is called causing fast wear in flash block devices (fat file system is not journaling file system so it will try to write to same blocks causing them to wear) and slow write in nor flash devices( erase in nor flash takes time).
if block device will have only write , flash block device can implement FTL layer and prevent fast wearing of device.

also i am in favor of creating of FTL block device and flash device(with the same api as current block device api), the FTL block device will use flash device.

*i am working on this patch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions