• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.5.8/xnu-1228.15.4/bsd/hfs/

Lines Matching refs:cache

91 SYSCTL_INT (_kern, OID_AUTO, flush_cache_on_write, CTLFLAG_RW, &flush_cache_on_write, 0, "always flush the drive cache on writes to uncached files");
699 lookup_bucket(struct access_cache *cache, int *indexp, cnid_t parent_id)
705 if (cache->numcached == 0) {
710 if (cache->numcached > NUM_CACHE_ENTRIES) {
712 cache->numcached, NUM_CACHE_ENTRIES);*/
713 cache->numcached = NUM_CACHE_ENTRIES;
716 hi = cache->numcached - 1;
718 index = cache_binSearch(cache->acache, hi, parent_id, &no_match_index);
735 * than an insert if the cache is full.
738 add_node(struct access_cache *cache, int index, cnid_t nodeID, int access)
744 if (lookup_bucket(cache, &lookup_index, nodeID)) {
745 if (cache->haveaccess[lookup_index] != access && cache->haveaccess[lookup_index] == ESRCH) {
747 cache->haveaccess[lookup_index] = access;
758 /* if the cache is full, do a replace rather than an insert */
759 if (cache->numcached >= NUM_CACHE_ENTRIES) {
760 //printf("cache is full (%d). replace at index %d\n", cache->numcached, index);
761 cache->numcached = NUM_CACHE_ENTRIES-1;
763 if (index > cache->numcached) {
764 // printf("index %d pinned to %d\n", index, cache->numcached);
765 index = cache->numcached;
769 if (index < cache->numcached && index < NUM_CACHE_ENTRIES && nodeID > cache->acache[index]) {
773 if (index >= 0 && index < cache->numcached) {
775 bcopy( cache->acache+index, cache->acache+(index+1), (cache->numcached - index)*sizeof(int) );
776 bcopy( cache->haveaccess+index, cache->haveaccess+(index+1), (cache->numcached - index)*sizeof(unsigned char) );
779 cache->acache[index] = nodeID;
780 cache->haveaccess[index] = access;
781 cache->numcached++;
812 do_attr_lookup(struct hfsmount *hfsmp, struct access_cache *cache, dev_t dev, cnid_t cnid,
843 cache->lookups++;
856 do_access_check(struct hfsmount *hfsmp, int *err, struct access_cache *cache, HFSCatalogNodeID nodeID,
879 /* check the cache before resorting to hitting the catalog */
884 if (lookup_bucket(cache, &cache_index, thisNodeID)) {
885 cache->cachehits++;
886 myErr = cache->haveaccess[cache_index];
892 scope_index = 0; // so we'll just use the cache result
910 /* remember which parents we want to cache */
922 myErr = do_attr_lookup(hfsmp, cache, dev, thisNodeID, skip_cp, &catkey, &cnattr);
996 /* cache the parent directory(ies) */
999 add_node(cache, -1, parent_ids[i], ESRCH);
1001 add_node(cache, -1, parent_ids[i], myErr);
1024 struct access_cache cache;
1053 /* initialize the local cache and buffers */
1054 cache.numcached = 0;
1055 cache.cachehits = 0;
1056 cache.lookups = 0;
1057 cache.acache = NULL;
1058 cache.haveaccess = NULL;
1136 cache.acache = (unsigned int *) kalloc(sizeof(int) * NUM_CACHE_ENTRIES);
1137 cache.haveaccess = (unsigned char *) kalloc(sizeof(unsigned char) * NUM_CACHE_ENTRIES);
1139 if (file_ids == NULL || access == NULL || (map_size != 0 && bitmap == NULL) || cache.acache == NULL || cache.haveaccess == NULL) {
1149 if (cache.acache) {
1150 kfree(cache.acache, sizeof(int) * NUM_CACHE_ENTRIES);
1152 if (cache.haveaccess) {
1153 kfree(cache.haveaccess, sizeof(unsigned char) * NUM_CACHE_ENTRIES);
1201 error = do_attr_lookup(hfsmp, &cache, dev, cnid, skip_cp, &catkey, &cnattr);
1254 cache.cachehits++;
1259 myaccess = do_access_check(hfsmp, &error, &cache, catkey.hfsPlus.parentID,
1286 //printf("on exit (err %d), numfiles/numcached/cachehits/lookups is %d/%d/%d/%d\n", error, num_files, cache.numcached, cache.cachehits, cache.lookups);
1296 if (cache.acache)
1297 kfree(cache.acache, sizeof(int) * NUM_CACHE_ENTRIES);
1298 if (cache.haveaccess)
1299 kfree(cache.haveaccess, sizeof(unsigned char) * NUM_CACHE_ENTRIES);
2859 * invalidated (to maintain buffer cache consistency).
3079 /* not found in cache ==> came from disk */