Lines Matching refs:node
53 struct block_cache_node *node; in cache_find() local
55 list_for_each_entry(node, &block_cache, lh) in cache_find()
56 if ((node->iftype == iftype) && in cache_find()
57 (node->devnum == devnum) && in cache_find()
58 (node->blksz == blksz) && in cache_find()
59 (node->start <= start) && in cache_find()
60 (node->start + node->blkcnt >= start + blkcnt)) { in cache_find()
61 if (block_cache.next != &node->lh) { in cache_find()
63 list_del(&node->lh); in cache_find()
64 list_add(&node->lh, &block_cache); in cache_find()
66 return node; in cache_find()
75 struct block_cache_node *node = cache_find(iftype, devnum, start, in blkcache_read() local
77 if (node) { in blkcache_read()
78 const char *src = node->cache + (start - node->start) * blksz; in blkcache_read()
97 struct block_cache_node *node; in blkcache_fill() local
109 node = (struct block_cache_node *)block_cache.prev; in blkcache_fill()
110 list_del(&node->lh); in blkcache_fill()
113 node->start, node->blkcnt); in blkcache_fill()
114 if (node->blkcnt * node->blksz < bytes) { in blkcache_fill()
115 free(node->cache); in blkcache_fill()
116 node->cache = 0; in blkcache_fill()
119 node = malloc(sizeof(*node)); in blkcache_fill()
120 if (!node) in blkcache_fill()
122 node->cache = 0; in blkcache_fill()
125 if (!node->cache) { in blkcache_fill()
126 node->cache = malloc(bytes); in blkcache_fill()
127 if (!node->cache) { in blkcache_fill()
128 free(node); in blkcache_fill()
136 node->iftype = iftype; in blkcache_fill()
137 node->devnum = devnum; in blkcache_fill()
138 node->start = start; in blkcache_fill()
139 node->blkcnt = blkcnt; in blkcache_fill()
140 node->blksz = blksz; in blkcache_fill()
141 memcpy(node->cache, buffer, bytes); in blkcache_fill()
142 list_add(&node->lh, &block_cache); in blkcache_fill()
149 struct block_cache_node *node; in blkcache_invalidate() local
152 node = (struct block_cache_node *)entry; in blkcache_invalidate()
154 (node->iftype == iftype && node->devnum == devnum)) { in blkcache_invalidate()
156 free(node->cache); in blkcache_invalidate()
157 free(node); in blkcache_invalidate()