summaryrefslogtreecommitdiff
path: root/sys/src/9/port/cache.c
AgeCommit message (Collapse)Author
2017-01-12kernel: make the mntcache robust against fileserver like fossil that do not ↵cinap_lenrek
change the qid.vers on wstat introducing new ctrunc() function that invalidates any caches for the passed in chan, invoked when handling wstat with a specified file length or on file creation/truncation. test program to reproduce the problem: #include <u.h> #include <libc.h> #include <libsec.h> void main(int argc, char *argv[]) { int fd; Dir *d, nd; fd = create("xxx", ORDWR, 0666); write(fd, "1234", 4); d = dirstat("xxx"); assert(d->length == 4); nulldir(&nd); nd.length = 0; dirwstat("xxx", &nd); d = dirstat("xxx"); assert(d->length == 0); fd = open("xxx", OREAD); assert(read(fd, (void*)&d, 4) == 0); }
2015-07-26kernel: pipelined read ahead for the mount cachecinap_lenrek
this changes devmnt adding mntrahread() function and some helpers for it to do pipelined sequential read ahead for the mount cache. basically, cread() calls mntrahread() with Mntrah structure and it figures out if we where reading sequentially and if thats the case issues reads of c->iounit size in advance. the read ahead state (Mntrah) is kept in the mount cache so we can handle (read ahead) cache invalidation in the presence of writes.
2015-06-16kernel: remove waserror() arround newpage() in mntcachecinap_lenrek
newpage() does not raise error().
2015-03-16kernel: get rid of auxpage() and preserve cache index bits in Page.va in ↵cinap_lenrek
mount cache the mount cache uses Page.va to store cached range offset and limit, but mips kernel uses cache index bits from Page.va to maintain page coloring. Page.va was not initialized by auxpage(). this change removes auxpage() which was primarily used only by the mount cache and use newpage() with cache file offset page as va so we will get a page of the right color. mount cache keeps the index bits intact by only using the top and buttom PGSHIFT bits of Page.va for the range offset/limit.
2014-12-16kernel: remove obsolete comment regarding Mntcache size in */main.ccinap_lenrek
2014-12-16kernel: new mount cachecinap_lenrek
this is a new more simple version of the mount cache that does not require dynamic allocations for extends. the Mntcache structure now contains a page bitmap that is used for quick page invalidation. the size of the bitmap is proportional to MAXCACHE. instead of keeping track of cached range in the Extend data structure, we keep all the information in the Page itself. the offset from the page where the cache range starts is in the low PGSHIT bits and the end in the top bits of Page.va. we choose Page.daddr to map 1:1 the Mountcache number and page number (pn) in the Mountcache. to find a page, we first check the bitmap if the page is there and then do a pagelookup() with the daddr key.
2014-12-15kernel: minor changes to mount cachecinap_lenrek
change page cache ids (bid) to uintptr so we use the full address space of Page.daddr. make maxcache offset check consistent in cread(). use consistent types in cupdate() and simplify with goto. make internal functions static. use nil instead of 0 for pointers.
2014-06-22kernel: new pagecache, remove Lock from page, use cmpswap for Ref instead of ↵cinap_lenrek
Lock make the Page stucture less than half its original size by getting rid of the Lock and the lru. The Lock was required to coordinate the unchaining of pages that where both cached and on the lru freelist. now pages have a single next pointer that is used for palloc.head freelist xor for page cache hash chains in Image.pghash[]. cached pages are not on the freelist anymore, but will be reclaimed from images by the pager when the freelist runs out of pages. each Image has its own 512 hash chains for cached page lookup. That is 2MB worth of pages and there should be no collisions for most text images. page reclaiming can be done without holding palloc.lock as the Image is the owner of the page hash chains protected by the Image's lock. reclaiming Image structures can be done quickly by only reclaiming pages from inactive images, that is images which are not currently in use by segments. the Ref structure has no Lock anymore. Only a single long that is atomically incremented or decremnted using cmpswap(). there are various other changes as a consequence code. and lots of pikeshedding, sorry.
2013-12-29kernel: remove unused debug cprint() function from port/cache.ccinap_lenrek
the cache can be inspected more easily with acid kernel library.
2012-10-17kernel: mnt cache reworkcinap_lenrek
avoid double entries in the cache for copen() and properly handle locking so we wont just give up if we cant lock the Mntcache entry, but drop the cache lock, qlock the Mntcache entry, and then recheck the cache. general cleanup (cdev -> ccache, use eqchantdqid())
2011-12-22kernel: make mntcache effective, be carefullcinap_lenrek
2011-03-30Import sources from 2011-03-30 iso image - libTaru Karttunen
2011-03-30Import sources from 2011-03-30 iso imageTaru Karttunen