15 #define FSCACHE_DEBUG_LEVEL COOKIE
16 #include <linux/module.h>
17 #include <linux/slab.h>
37 memset(cookie, 0,
sizeof(*cookie));
68 parent ? (
char *) parent->
def->name :
"<no-parent>",
69 def->
name, netfs_data);
110 switch (cookie->
def->type) {
126 if (fscache_acquire_non_index_cookie(cookie) < 0) {
161 if (list_empty(&fscache_cache_list)) {
162 up_read(&fscache_addremove_sem);
163 _leave(
" = 0 [no caches]");
170 up_read(&fscache_addremove_sem);
172 _leave(
" = -ENOMEDIUM [no cache]");
185 ret = fscache_alloc_object(cache, cookie);
187 up_read(&fscache_addremove_sem);
195 spin_lock(&cookie->
lock);
197 spin_unlock(&cookie->
lock);
204 fscache_set_store_limit(
object, i_size);
210 spin_unlock(&cookie->
lock);
222 up_read(&fscache_addremove_sem);
223 _leave(
" = 0 [deferred]");
227 up_read(&fscache_addremove_sem);
243 _enter(
"%p,%p{%s}", cache, cookie, cookie->
def->name);
245 spin_lock(&cookie->
lock);
248 if (object->
cache == cache)
249 goto object_already_extant;
251 spin_unlock(&cookie->
lock);
256 object = cache->
ops->alloc_object(cache, cookie);
258 if (IS_ERR(
object)) {
260 ret = PTR_ERR(
object);
268 _debug(
"ALLOC OBJ%x: %s {%lx}",
271 ret = fscache_alloc_object(cache, cookie->
parent);
278 if (fscache_attach_object(cookie,
object) < 0) {
280 cache->
ops->put_object(
object);
287 object_already_extant:
289 if (object->
state >= FSCACHE_OBJECT_DYING) {
290 spin_unlock(&cookie->
lock);
293 spin_unlock(&cookie->
lock);
299 cache->
ops->put_object(
object);
319 spin_lock(&cookie->
lock);
326 if (p->
state >= FSCACHE_OBJECT_DYING)
328 goto cant_attach_object;
337 if (p->
state >= FSCACHE_OBJECT_DYING) {
339 spin_unlock(&cookie->
parent->lock);
340 goto cant_attach_object;
345 spin_unlock(&p->
lock);
349 spin_unlock(&cookie->
parent->lock);
367 spin_unlock(&cookie->
lock);
392 spin_lock(&cookie->
lock);
400 spin_unlock(&cookie->
lock);
445 spin_lock(&cookie->
lock);
456 spin_lock(&object->
lock);
459 cache =
object->cache;
460 object->cookie =
NULL;
461 fscache_raise_event(
object, event);
462 spin_unlock(&object->
lock);
473 spin_unlock(&cookie->
lock);
483 fscache_cookie_put(cookie);
499 _debug(
"FREE COOKIE %p", cookie);