Page 2 of 2
Re: unacceptably slow filesystem access - possible causes?
Posted: Fri Feb 19, 2016 4:38 am
by onlyonemac
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).
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).
Re: unacceptably slow filesystem access - possible causes?
Posted: Fri Feb 19, 2016 7:11 am
by mariuszp
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?
Re: unacceptably slow filesystem access - possible causes?
Posted: Fri Feb 19, 2016 7:59 am
by Combuster
You can, at least for testing, enforce a sync() to complete whenever a file gets close()'d.
Re: unacceptably slow filesystem access - possible causes?
Posted: Fri Feb 19, 2016 9:43 am
by mariuszp
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.
Re: unacceptably slow filesystem access - possible causes?
Posted: Fri Feb 19, 2016 10:13 am
by onlyonemac
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.
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).