Lines Matching full:object
20 * allocate an object record for a cookie lookup and prepare the lookup data
27 struct cachefiles_object *object; in cachefiles_alloc_object() local
42 /* create a new object record and a temporary leaf image */ in cachefiles_alloc_object()
43 object = kmem_cache_alloc(cachefiles_object_jar, cachefiles_gfp); in cachefiles_alloc_object()
44 if (!object) in cachefiles_alloc_object()
47 ASSERTCMP(object->backer, ==, NULL); in cachefiles_alloc_object()
49 BUG_ON(test_bit(CACHEFILES_OBJECT_ACTIVE, &object->flags)); in cachefiles_alloc_object()
50 atomic_set(&object->usage, 1); in cachefiles_alloc_object()
52 fscache_object_init(&object->fscache, cookie, &cache->cache); in cachefiles_alloc_object()
54 object->type = cookie->def->type; in cachefiles_alloc_object()
77 key = cachefiles_cook_key(buffer, keylen + 2, object->type); in cachefiles_alloc_object()
81 /* get hold of the auxiliary data and prepend the object type */ in cachefiles_alloc_object()
97 object->lookup_data = lookup_data; in cachefiles_alloc_object()
99 _leave(" = %p [%p]", &object->fscache, lookup_data); in cachefiles_alloc_object()
100 return &object->fscache; in cachefiles_alloc_object()
105 BUG_ON(test_bit(CACHEFILES_OBJECT_ACTIVE, &object->flags)); in cachefiles_alloc_object()
106 kmem_cache_free(cachefiles_object_jar, object); in cachefiles_alloc_object()
122 struct cachefiles_object *parent, *object; in cachefiles_lookup_object() local
132 object = container_of(_object, struct cachefiles_object, fscache); in cachefiles_lookup_object()
133 lookup_data = object->lookup_data; in cachefiles_lookup_object()
139 ret = cachefiles_walk_to_object(parent, object, in cachefiles_lookup_object()
146 object->fscache.cookie->def->type != FSCACHE_COOKIE_TYPE_INDEX) in cachefiles_lookup_object()
147 cachefiles_attr_changed(&object->fscache); in cachefiles_lookup_object()
152 fscache_object_lookup_error(&object->fscache); in cachefiles_lookup_object()
164 struct cachefiles_object *object; in cachefiles_lookup_complete() local
166 object = container_of(_object, struct cachefiles_object, fscache); in cachefiles_lookup_complete()
168 _enter("{OBJ%x,%p}", object->fscache.debug_id, object->lookup_data); in cachefiles_lookup_complete()
170 if (object->lookup_data) { in cachefiles_lookup_complete()
171 kfree(object->lookup_data->key); in cachefiles_lookup_complete()
172 kfree(object->lookup_data->auxdata); in cachefiles_lookup_complete()
173 kfree(object->lookup_data); in cachefiles_lookup_complete()
174 object->lookup_data = NULL; in cachefiles_lookup_complete()
179 * increment the usage count on an inode object (may fail if unmounting)
185 struct cachefiles_object *object = in cachefiles_grab_object() local
189 _enter("{OBJ%x,%d}", _object->debug_id, atomic_read(&object->usage)); in cachefiles_grab_object()
192 ASSERT((atomic_read(&object->usage) & 0xffff0000) != 0x6b6b0000); in cachefiles_grab_object()
195 u = atomic_inc_return(&object->usage); in cachefiles_grab_object()
196 trace_cachefiles_ref(object, _object->cookie, in cachefiles_grab_object()
198 return &object->fscache; in cachefiles_grab_object()
202 * update the auxiliary data for an object object on disk
206 struct cachefiles_object *object; in cachefiles_update_object() local
216 object = container_of(_object, struct cachefiles_object, fscache); in cachefiles_update_object()
217 cache = container_of(object->fscache.cache, struct cachefiles_cache, in cachefiles_update_object()
225 cookie = object->fscache.cookie; in cachefiles_update_object()
251 cachefiles_update_object_xattr(object, auxdata); in cachefiles_update_object()
258 * discard the resources pinned by an object and effect retirement if
263 struct cachefiles_object *object; in cachefiles_drop_object() local
271 object = container_of(_object, struct cachefiles_object, fscache); in cachefiles_drop_object()
274 object->fscache.debug_id, atomic_read(&object->usage)); in cachefiles_drop_object()
276 cache = container_of(object->fscache.cache, in cachefiles_drop_object()
280 ASSERT((atomic_read(&object->usage) & 0xffff0000) != 0x6b6b0000); in cachefiles_drop_object()
283 /* We need to tidy the object up if we did in fact manage to open it. in cachefiles_drop_object()
284 * It's possible for us to get here before the object is fully in cachefiles_drop_object()
285 * initialised if the parent goes away or the object gets retired in cachefiles_drop_object()
288 if (object->dentry) { in cachefiles_drop_object()
290 if (test_bit(FSCACHE_OBJECT_RETIRED, &object->fscache.flags) && in cachefiles_drop_object()
293 _debug("- retire object OBJ%x", object->fscache.debug_id); in cachefiles_drop_object()
294 inode = d_backing_inode(object->dentry); in cachefiles_drop_object()
299 cachefiles_delete_object(cache, object); in cachefiles_drop_object()
303 /* close the filesystem stuff attached to the object */ in cachefiles_drop_object()
304 if (object->backer != object->dentry) in cachefiles_drop_object()
305 dput(object->backer); in cachefiles_drop_object()
306 object->backer = NULL; in cachefiles_drop_object()
309 /* note that the object is now inactive */ in cachefiles_drop_object()
310 if (test_bit(CACHEFILES_OBJECT_ACTIVE, &object->flags)) in cachefiles_drop_object()
311 cachefiles_mark_object_inactive(cache, object, i_blocks); in cachefiles_drop_object()
313 dput(object->dentry); in cachefiles_drop_object()
314 object->dentry = NULL; in cachefiles_drop_object()
320 * dispose of a reference to an object
325 struct cachefiles_object *object; in cachefiles_put_object() local
331 object = container_of(_object, struct cachefiles_object, fscache); in cachefiles_put_object()
334 object->fscache.debug_id, atomic_read(&object->usage)); in cachefiles_put_object()
337 ASSERT((atomic_read(&object->usage) & 0xffff0000) != 0x6b6b0000); in cachefiles_put_object()
340 ASSERTIFCMP(object->fscache.parent, in cachefiles_put_object()
341 object->fscache.parent->n_children, >, 0); in cachefiles_put_object()
343 u = atomic_dec_return(&object->usage); in cachefiles_put_object()
344 trace_cachefiles_ref(object, _object->cookie, in cachefiles_put_object()
348 _debug("- kill object OBJ%x", object->fscache.debug_id); in cachefiles_put_object()
350 ASSERT(!test_bit(CACHEFILES_OBJECT_ACTIVE, &object->flags)); in cachefiles_put_object()
351 ASSERTCMP(object->fscache.parent, ==, NULL); in cachefiles_put_object()
352 ASSERTCMP(object->backer, ==, NULL); in cachefiles_put_object()
353 ASSERTCMP(object->dentry, ==, NULL); in cachefiles_put_object()
354 ASSERTCMP(object->fscache.n_ops, ==, 0); in cachefiles_put_object()
355 ASSERTCMP(object->fscache.n_children, ==, 0); in cachefiles_put_object()
357 if (object->lookup_data) { in cachefiles_put_object()
358 kfree(object->lookup_data->key); in cachefiles_put_object()
359 kfree(object->lookup_data->auxdata); in cachefiles_put_object()
360 kfree(object->lookup_data); in cachefiles_put_object()
361 object->lookup_data = NULL; in cachefiles_put_object()
364 cache = object->fscache.cache; in cachefiles_put_object()
365 fscache_object_destroy(&object->fscache); in cachefiles_put_object()
366 kmem_cache_free(cachefiles_object_jar, object); in cachefiles_put_object()
407 struct cachefiles_object *object; in cachefiles_check_consistency() local
412 _enter("{OBJ%x}", op->object->debug_id); in cachefiles_check_consistency()
414 object = container_of(op->object, struct cachefiles_object, fscache); in cachefiles_check_consistency()
415 cache = container_of(object->fscache.cache, in cachefiles_check_consistency()
419 ret = cachefiles_check_auxdata(object); in cachefiles_check_consistency()
427 * notification the attributes on an object have changed
432 struct cachefiles_object *object; in cachefiles_attr_changed() local
445 object = container_of(_object, struct cachefiles_object, fscache); in cachefiles_attr_changed()
446 cache = container_of(object->fscache.cache, in cachefiles_attr_changed()
449 if (ni_size == object->i_size) in cachefiles_attr_changed()
452 if (!object->backer) in cachefiles_attr_changed()
455 ASSERT(d_is_reg(object->backer)); in cachefiles_attr_changed()
457 fscache_set_store_limit(&object->fscache, ni_size); in cachefiles_attr_changed()
459 oi_size = i_size_read(d_backing_inode(object->backer)); in cachefiles_attr_changed()
464 inode_lock(d_inode(object->backer)); in cachefiles_attr_changed()
473 ret = notify_change(object->backer, &newattrs, NULL); in cachefiles_attr_changed()
480 ret = notify_change(object->backer, &newattrs, NULL); in cachefiles_attr_changed()
483 inode_unlock(d_inode(object->backer)); in cachefiles_attr_changed()
487 fscache_set_store_limit(&object->fscache, 0); in cachefiles_attr_changed()
488 cachefiles_io_error_obj(object, "Size set failed"); in cachefiles_attr_changed()
497 * Invalidate an object
501 struct cachefiles_object *object; in cachefiles_invalidate_object() local
508 object = container_of(op->object, struct cachefiles_object, fscache); in cachefiles_invalidate_object()
509 cache = container_of(object->fscache.cache, in cachefiles_invalidate_object()
512 ni_size = op->object->store_limit_l; in cachefiles_invalidate_object()
515 op->object->debug_id, (unsigned long long)ni_size); in cachefiles_invalidate_object()
517 if (object->backer) { in cachefiles_invalidate_object()
518 ASSERT(d_is_reg(object->backer)); in cachefiles_invalidate_object()
520 fscache_set_store_limit(&object->fscache, ni_size); in cachefiles_invalidate_object()
522 path.dentry = object->backer; in cachefiles_invalidate_object()
532 fscache_set_store_limit(&object->fscache, 0); in cachefiles_invalidate_object()
534 cachefiles_io_error_obj(object, in cachefiles_invalidate_object()