• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/fs/squashfs/

Lines Matching defs:entry

68 	struct squashfs_cache_entry *entry;
74 if (cache->entry[i].block == block)
92 * At least one unused cache entry. A simple
93 * round-robin strategy is used to choose the entry to
98 if (cache->entry[i].refcount == 0)
104 entry = &cache->entry[i];
107 * Initialise chosen cache entry, and fill it in from
111 entry->block = block;
112 entry->refcount = 1;
113 entry->pending = 1;
114 entry->num_waiters = 0;
115 entry->error = 0;
118 entry->length = squashfs_read_data(sb, entry->data,
119 block, length, &entry->next_index,
124 if (entry->length < 0)
125 entry->error = entry->length;
127 entry->pending = 0;
130 * While filling this entry one or more other processes
134 if (entry->num_waiters) {
136 wake_up_all(&entry->wait_queue);
146 * previously unused there's one less cache entry available
149 entry = &cache->entry[i];
150 if (entry->refcount == 0)
152 entry->refcount++;
155 * If the entry is currently being filled in by another process
158 if (entry->pending) {
159 entry->num_waiters++;
161 wait_event(entry->wait_queue, !entry->pending);
170 cache->name, i, entry->block, entry->refcount, entry->error);
172 if (entry->error)
173 ERROR("Unable to read %s cache entry [%llx]\n", cache->name,
175 return entry;
180 * Release cache entry, once usage count is zero it can be reused.
182 void squashfs_cache_put(struct squashfs_cache_entry *entry)
184 struct squashfs_cache *cache = entry->cache;
187 entry->refcount--;
188 if (entry->refcount == 0) {
214 if (cache->entry[i].data) {
216 kfree(cache->entry[i].data[j]);
217 kfree(cache->entry[i].data);
221 kfree(cache->entry);
228 * size block_size. To avoid vmalloc fragmentation issues each entry
242 cache->entry = kcalloc(entries, sizeof(*(cache->entry)), GFP_KERNEL);
243 if (cache->entry == NULL) {
260 struct squashfs_cache_entry *entry = &cache->entry[i];
262 init_waitqueue_head(&cache->entry[i].wait_queue);
263 entry->cache = cache;
264 entry->block = SQUASHFS_INVALID_BLK;
265 entry->data = kcalloc(cache->pages, sizeof(void *), GFP_KERNEL);
266 if (entry->data == NULL) {
267 ERROR("Failed to allocate %s cache entry\n", name);
272 entry->data[j] = kmalloc(PAGE_CACHE_SIZE, GFP_KERNEL);
273 if (entry->data[j] == NULL) {
289 * Copy up to length bytes from cache entry to buffer starting at offset bytes
290 * into the cache entry. If there's not length bytes then copy the number of
293 int squashfs_copy_data(void *buffer, struct squashfs_cache_entry *entry,
301 return min(length, entry->length - offset);
303 while (offset < entry->length) {
304 void *buff = entry->data[offset / PAGE_CACHE_SIZE]
306 int bytes = min_t(int, entry->length - offset,
336 struct squashfs_cache_entry *entry;
341 entry = squashfs_cache_get(sb, msblk->block_cache, *block, 0);
342 if (entry->error)
343 return entry->error;
344 else if (*offset >= entry->length)
347 bytes = squashfs_copy_data(buffer, entry, *offset, length);
353 if (*offset == entry->length) {
354 *block = entry->next_index;
358 squashfs_cache_put(entry);