summaryrefslogtreecommitdiffstats
path: root/fs/fscache
diff options
context:
space:
mode:
Diffstat (limited to 'fs/fscache')
-rw-r--r--fs/fscache/cache.c2
-rw-r--r--fs/fscache/cookie.c7
-rw-r--r--fs/fscache/object.c1
3 files changed, 6 insertions, 4 deletions
diff --git a/fs/fscache/cache.c b/fs/fscache/cache.c
index c184c5a356ff..cdcb376ef8df 100644
--- a/fs/fscache/cache.c
+++ b/fs/fscache/cache.c
@@ -220,6 +220,7 @@ int fscache_add_cache(struct fscache_cache *cache,
220{ 220{
221 struct fscache_cache_tag *tag; 221 struct fscache_cache_tag *tag;
222 222
223 ASSERTCMP(ifsdef->cookie, ==, &fscache_fsdef_index);
223 BUG_ON(!cache->ops); 224 BUG_ON(!cache->ops);
224 BUG_ON(!ifsdef); 225 BUG_ON(!ifsdef);
225 226
@@ -248,7 +249,6 @@ int fscache_add_cache(struct fscache_cache *cache,
248 if (!cache->kobj) 249 if (!cache->kobj)
249 goto error; 250 goto error;
250 251
251 ifsdef->cookie = &fscache_fsdef_index;
252 ifsdef->cache = cache; 252 ifsdef->cache = cache;
253 cache->fsdef = ifsdef; 253 cache->fsdef = ifsdef;
254 254
diff --git a/fs/fscache/cookie.c b/fs/fscache/cookie.c
index 97137d7ec5ee..83bfe04456b6 100644
--- a/fs/fscache/cookie.c
+++ b/fs/fscache/cookie.c
@@ -516,6 +516,7 @@ static int fscache_alloc_object(struct fscache_cache *cache,
516 goto error; 516 goto error;
517 } 517 }
518 518
519 ASSERTCMP(object->cookie, ==, cookie);
519 fscache_stat(&fscache_n_object_alloc); 520 fscache_stat(&fscache_n_object_alloc);
520 521
521 object->debug_id = atomic_inc_return(&fscache_object_debug_id); 522 object->debug_id = atomic_inc_return(&fscache_object_debug_id);
@@ -571,6 +572,8 @@ static int fscache_attach_object(struct fscache_cookie *cookie,
571 572
572 _enter("{%s},{OBJ%x}", cookie->def->name, object->debug_id); 573 _enter("{%s},{OBJ%x}", cookie->def->name, object->debug_id);
573 574
575 ASSERTCMP(object->cookie, ==, cookie);
576
574 spin_lock(&cookie->lock); 577 spin_lock(&cookie->lock);
575 578
576 /* there may be multiple initial creations of this object, but we only 579 /* there may be multiple initial creations of this object, but we only
@@ -610,9 +613,7 @@ static int fscache_attach_object(struct fscache_cookie *cookie,
610 spin_unlock(&cache->object_list_lock); 613 spin_unlock(&cache->object_list_lock);
611 } 614 }
612 615
613 /* attach to the cookie */ 616 /* Attach to the cookie. The object already has a ref on it. */
614 object->cookie = cookie;
615 fscache_cookie_get(cookie, fscache_cookie_get_attach_object);
616 hlist_add_head(&object->cookie_link, &cookie->backing_objects); 617 hlist_add_head(&object->cookie_link, &cookie->backing_objects);
617 618
618 fscache_objlist_add(object); 619 fscache_objlist_add(object);
diff --git a/fs/fscache/object.c b/fs/fscache/object.c
index 20e0d0a4dc8c..9edc920f651f 100644
--- a/fs/fscache/object.c
+++ b/fs/fscache/object.c
@@ -327,6 +327,7 @@ void fscache_object_init(struct fscache_object *object,
327 object->store_limit_l = 0; 327 object->store_limit_l = 0;
328 object->cache = cache; 328 object->cache = cache;
329 object->cookie = cookie; 329 object->cookie = cookie;
330 fscache_cookie_get(cookie, fscache_cookie_get_attach_object);
330 object->parent = NULL; 331 object->parent = NULL;
331#ifdef CONFIG_FSCACHE_OBJECT_LIST 332#ifdef CONFIG_FSCACHE_OBJECT_LIST
332 RB_CLEAR_NODE(&object->objlist_link); 333 RB_CLEAR_NODE(&object->objlist_link);