schfs: do not read a block off the disk just to overwrite it
kd_write() went through bread(), so every block a write allocated was read from the disk first and then replaced whole. That was a quarter of the disk operations of a SchFS write. bgetblk() is bread() without the read, as Linux's getblk() is. 1 MB on AHCI under QEMU: 2.0 -> 2.8 MB/s in 4 KB writes, 4.5 -> 5.6 MB/s in 64 KB ones. 3 MB of random data written and copied through the cache's evictions reads back with the same md5. The 63 KB/s seen earlier is the legacy IDE driver on QEMU's default machine, at about 10 ms per emulated PIO write; the same disk on AHCI (q35) is 40 times faster. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S1giNvrHTrPMPw7V6x1kQ4
This commit is contained in:
parent
7a1e63a553
commit
b213ab5778
3 changed files with 20 additions and 4 deletions
|
|
@ -42,6 +42,7 @@ int blkdev_register(const char *name, const struct blkdev_ops *ops,
|
|||
// blocks. A filesystem still mounted from it fails on its next access.
|
||||
void blkdev_unregister(int dev);
|
||||
void binval(uint dev); // kernel/dev/bio.c
|
||||
struct buf *bgetblk(uint dev, uint64 blockno); // bread() without the read
|
||||
|
||||
int blkdev_present(uint dev);
|
||||
void blkdev_rw(struct buf *b);
|
||||
|
|
|
|||
Loading…
Reference in a new issue