You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nuttx.apache.org by Federico Braghiroli <fe...@gmail.com> on 2021/07/27 11:09:27 UTC
Force sector flush in bch driver
Hello,
I'm using an i2c eeprom with sector (page) size of 16 bytes and through
the bch driver I perform some read/write sequences from user space.
However, when writing block of data with a size not multiple of the
sector size I got a partial eeprom write; in this situation, the bch
driver flags the partial sector (remaining bytes) as "dirty".
In order to write these remaining bytes to the eeprom, I need to flush
the buffer.
In commit 9fc55224385d4abe2dc7a3336f6d9d3f147a0f2d this flush operation
has been removed to reduce multiple writes but nothing has been
introduced to manually write "dirty" sector from userspace.
Currently, the only option is to call a close() followed by a open() to
trigger the bchlib_flushsector().
A possible solution consists in implementing an ioctl in bch driver
(like the existing BIOC_FLUSH) to trigger bchlib_flushsector().
Attached to this mail a possible patch.
Let me know if I miss something.
Thanks
Regards,
Federico Braghiroli