how linux::ext4's block-level read/write work

148 Views Asked by At

Im creating a new database, which would work directly on the block-device, without a file-system,

But block-level read/write operations, require higher standards, like

  • Aligned-memory,
  • Per-block access instead of per-byte, etc

So I decided to either learn from, or maybe fork, the block-level read/write implementation of ext4, the default fs of linux,

NOTE: I cannot use filesystem, because the db's architecture, requires it, to capture the whole needed space, at the db creation, all the tables, heap, indexes, etc are then managed manually by the db itself.

Currently the db use pread64/pwrite64, for per-byte access,

So I checked the linux's source code, and got to

  • ssize_t ksys_pread64, which calls

  • ssize_t vfs_read, which again calls

  • struct file's f_op's read function,

  • Im not able to find the definition of this function, also confused, that where to proceed from here

Also, should I, or not, use the ext4's implementation, like is there any, more efficient implementation of block-access?, Im really confused,

EDIT: I know that read block, memcpy, write block is not hard, but Im in the search, for reducing the memcpy overhead, hence achieving efficiency, by only memcpying void *unAlignedBytesBefore and void *unAlignedBytesAfter, of the buffer to be written, rest all is written as passed.

thanks

0

There are 0 best solutions below