That is a bad idea. If there are going to be multiple writes to the same "page", you want to buffer those. Standard procedure is to buffer the writes (i.e. to write them to the cached "page" only) and then flush the buffer to disk (write the invalidated "pages" to disk) when the buffer needs to be cleared or (in the interest of maintaining data integrity) at fixed intervals (say, every 10 seconds).mariuszp wrote:I still need to do some optimisations for the writes (currently I just invalidate the cached pages that contain the sector being written; I am planning to make it so that it updates the cache after while writing to disk in parallel).
unacceptably slow filesystem access - possible causes?
-
- Member
- Posts: 1146
- Joined: Sat Mar 01, 2014 2:59 pm
Re: unacceptably slow filesystem access - possible causes?
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.
Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
Re: unacceptably slow filesystem access - possible causes?
I should probably implement write caching as @onlyonemac suggests, but currently during the development stage i'm worried i'll forget to "poweroff" or "sync" and instead terminate the VM immediately and break the filesystem. Would it really be a significant problem if I'm writing to disk in parallel using DMA?
Does the disk controller take (almost) the same amount of time to read a cylinder compared to reading 8 consecutive sectors?
Does the disk controller take (almost) the same amount of time to read a cylinder compared to reading 8 consecutive sectors?
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: unacceptably slow filesystem access - possible causes?
You can, at least for testing, enforce a sync() to complete whenever a file gets close()'d.
Re: unacceptably slow filesystem access - possible causes?
Well, that is done and the speed has greatly improved. I still need to implement prefetching because the GUI takes a few seconds to load the wallpaper.
-
- Member
- Posts: 1146
- Joined: Sat Mar 01, 2014 2:59 pm
Re: unacceptably slow filesystem access - possible causes?
If you flush the disk buffer every e.g. 10 seconds as I suggested, then as long as your VM (or computer) is idle for at least that period of time then you won't corrupt anything by terminating it (which is exactly why we flush the disk buffer every few seconds).mariuszp wrote:I should probably implement write caching as @onlyonemac suggests, but currently during the development stage i'm worried i'll forget to "poweroff" or "sync" and instead terminate the VM immediately and break the filesystem.
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.
Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing