Lines Matching defs:cache

95 SYSCTL_INT (_kern, OID_AUTO, flush_cache_on_write, CTLFLAG_RW | CTLFLAG_LOCKED, &flush_cache_on_write, 0, "always flush the drive cache on writes to uncached files");
937 lookup_bucket(struct access_cache *cache, int *indexp, cnid_t parent_id)
943 if (cache->numcached == 0) {
948 if (cache->numcached > NUM_CACHE_ENTRIES) {
950 cache->numcached, NUM_CACHE_ENTRIES);*/
951 cache->numcached = NUM_CACHE_ENTRIES;
954 hi = cache->numcached - 1;
956 index = cache_binSearch(cache->acache, hi, parent_id, &no_match_index);
973 * than an insert if the cache is full.
976 add_node(struct access_cache *cache, int index, cnid_t nodeID, int access)
982 if (lookup_bucket(cache, &lookup_index, nodeID)) {
983 if (cache->haveaccess[lookup_index] != access && cache->haveaccess[lookup_index] == ESRCH) {
985 cache->haveaccess[lookup_index] = access;
996 /* if the cache is full, do a replace rather than an insert */
997 if (cache->numcached >= NUM_CACHE_ENTRIES) {
998 //printf("hfs: cache is full (%d). replace at index %d\n", cache->numcached, index);
999 cache->numcached = NUM_CACHE_ENTRIES-1;
1001 if (index > cache->numcached) {
1002 // printf("hfs: index %d pinned to %d\n", index, cache->numcached);
1003 index = cache->numcached;
1007 if (index < cache->numcached && index < NUM_CACHE_ENTRIES && nodeID > cache->acache[index]) {
1011 if (index >= 0 && index < cache->numcached) {
1013 bcopy( cache->acache+index, cache->acache+(index+1), (cache->numcached - index)*sizeof(int) );
1014 bcopy( cache->haveaccess+index, cache->haveaccess+(index+1), (cache->numcached - index)*sizeof(unsigned char) );
1017 cache->acache[index] = nodeID;
1018 cache->haveaccess[index] = access;
1019 cache->numcached++;
1050 do_attr_lookup(struct hfsmount *hfsmp, struct access_cache *cache, cnid_t cnid,
1085 cache->lookups++;
1098 do_access_check(struct hfsmount *hfsmp, int *err, struct access_cache *cache, HFSCatalogNodeID nodeID,
1121 /* check the cache before resorting to hitting the catalog */
1126 if (lookup_bucket(cache, &cache_index, thisNodeID)) {
1127 cache->cachehits++;
1128 myErr = cache->haveaccess[cache_index];
1134 scope_index = 0; // so we'll just use the cache result
1152 /* remember which parents we want to cache */
1164 myErr = do_attr_lookup(hfsmp, cache, thisNodeID, skip_cp, &catkey, &cnattr);
1236 /* cache the parent directory(ies) */
1239 add_node(cache, -1, parent_ids[i], ESRCH);
1241 add_node(cache, -1, parent_ids[i], myErr);
1264 struct access_cache cache;
1291 /* initialize the local cache and buffers */
1292 cache.numcached = 0;
1293 cache.cachehits = 0;
1294 cache.lookups = 0;
1295 cache.acache = NULL;
1296 cache.haveaccess = NULL;
1374 cache.acache = (unsigned int *) kalloc(sizeof(int) * NUM_CACHE_ENTRIES);
1375 cache.haveaccess = (unsigned char *) kalloc(sizeof(unsigned char) * NUM_CACHE_ENTRIES);
1377 if (file_ids == NULL || access == NULL || (map_size != 0 && bitmap == NULL) || cache.acache == NULL || cache.haveaccess == NULL) {
1387 if (cache.acache) {
1388 kfree(cache.acache, sizeof(int) * NUM_CACHE_ENTRIES);
1390 if (cache.haveaccess) {
1391 kfree(cache.haveaccess, sizeof(unsigned char) * NUM_CACHE_ENTRIES);
1439 error = do_attr_lookup(hfsmp, &cache, cnid, skip_cp, &catkey, &cnattr);
1496 cache.cachehits++;
1501 myaccess = do_access_check(hfsmp, &error, &cache, catkey.hfsPlus.parentID,
1528 //printf("hfs: on exit (err %d), numfiles/numcached/cachehits/lookups is %d/%d/%d/%d\n", error, num_files, cache.numcached, cache.cachehits, cache.lookups);
1538 if (cache.acache)
1539 kfree(cache.acache, sizeof(int) * NUM_CACHE_ENTRIES);
1540 if (cache.haveaccess)
1541 kfree(cache.haveaccess, sizeof(unsigned char) * NUM_CACHE_ENTRIES);
1827 /* The free extent cache is managed differently for sparse devices.
1829 * device is marked as sparse, so the free extent cache for this
1831 * count). Reset the cache so that it will be rebuilt again
1845 * a meaningful result, we cache the number of blocks for later use in
2671 * blocks that are borrowed and in-cache. We have to assume that
2786 * CP cache key from getting tossed prior to our IO finishing here.
2809 * file's cache key for whatever reason (device may be locked). However,
3629 * invalidated (to maintain buffer cache consistency).
3732 * do not currently exist in the cache... in that case
4314 /* not found in cache ==> came from disk */
4749 * may have pages left in the cache since NOCACHE