Lines Matching full:object
24 * allocate an object record for a cookie lookup and prepare the lookup data
31 struct cachefiles_object *object; in cachefiles_alloc_object() local
46 /* create a new object record and a temporary leaf image */ in cachefiles_alloc_object()
47 object = kmem_cache_alloc(cachefiles_object_jar, cachefiles_gfp); in cachefiles_alloc_object()
48 if (!object) in cachefiles_alloc_object()
51 ASSERTCMP(object->backer, ==, NULL); in cachefiles_alloc_object()
53 BUG_ON(test_bit(CACHEFILES_OBJECT_ACTIVE, &object->flags)); in cachefiles_alloc_object()
54 atomic_set(&object->usage, 1); in cachefiles_alloc_object()
56 fscache_object_init(&object->fscache, cookie, &cache->cache); in cachefiles_alloc_object()
58 object->type = cookie->def->type; in cachefiles_alloc_object()
81 key = cachefiles_cook_key(buffer, keylen + 2, object->type); in cachefiles_alloc_object()
85 /* get hold of the auxiliary data and prepend the object type */ in cachefiles_alloc_object()
101 object->lookup_data = lookup_data; in cachefiles_alloc_object()
103 _leave(" = %p [%p]", &object->fscache, lookup_data); in cachefiles_alloc_object()
104 return &object->fscache; in cachefiles_alloc_object()
109 BUG_ON(test_bit(CACHEFILES_OBJECT_ACTIVE, &object->flags)); in cachefiles_alloc_object()
110 kmem_cache_free(cachefiles_object_jar, object); in cachefiles_alloc_object()
126 struct cachefiles_object *parent, *object; in cachefiles_lookup_object() local
136 object = container_of(_object, struct cachefiles_object, fscache); in cachefiles_lookup_object()
137 lookup_data = object->lookup_data; in cachefiles_lookup_object()
143 ret = cachefiles_walk_to_object(parent, object, in cachefiles_lookup_object()
150 object->fscache.cookie->def->type != FSCACHE_COOKIE_TYPE_INDEX) in cachefiles_lookup_object()
151 cachefiles_attr_changed(&object->fscache); in cachefiles_lookup_object()
156 fscache_object_lookup_error(&object->fscache); in cachefiles_lookup_object()
168 struct cachefiles_object *object; in cachefiles_lookup_complete() local
170 object = container_of(_object, struct cachefiles_object, fscache); in cachefiles_lookup_complete()
172 _enter("{OBJ%x,%p}", object->fscache.debug_id, object->lookup_data); in cachefiles_lookup_complete()
174 if (object->lookup_data) { in cachefiles_lookup_complete()
175 kfree(object->lookup_data->key); in cachefiles_lookup_complete()
176 kfree(object->lookup_data->auxdata); in cachefiles_lookup_complete()
177 kfree(object->lookup_data); in cachefiles_lookup_complete()
178 object->lookup_data = NULL; in cachefiles_lookup_complete()
183 * increment the usage count on an inode object (may fail if unmounting)
189 struct cachefiles_object *object = in cachefiles_grab_object() local
193 _enter("{OBJ%x,%d}", _object->debug_id, atomic_read(&object->usage)); in cachefiles_grab_object()
196 ASSERT((atomic_read(&object->usage) & 0xffff0000) != 0x6b6b0000); in cachefiles_grab_object()
199 u = atomic_inc_return(&object->usage); in cachefiles_grab_object()
200 trace_cachefiles_ref(object, _object->cookie, in cachefiles_grab_object()
202 return &object->fscache; in cachefiles_grab_object()
206 * update the auxiliary data for an object object on disk
210 struct cachefiles_object *object; in cachefiles_update_object() local
220 object = container_of(_object, struct cachefiles_object, fscache); in cachefiles_update_object()
221 cache = container_of(object->fscache.cache, struct cachefiles_cache, in cachefiles_update_object()
229 cookie = object->fscache.cookie; in cachefiles_update_object()
255 cachefiles_update_object_xattr(object, auxdata); in cachefiles_update_object()
262 * discard the resources pinned by an object and effect retirement if
267 struct cachefiles_object *object; in cachefiles_drop_object() local
275 object = container_of(_object, struct cachefiles_object, fscache); in cachefiles_drop_object()
278 object->fscache.debug_id, atomic_read(&object->usage)); in cachefiles_drop_object()
280 cache = container_of(object->fscache.cache, in cachefiles_drop_object()
284 ASSERT((atomic_read(&object->usage) & 0xffff0000) != 0x6b6b0000); in cachefiles_drop_object()
287 /* We need to tidy the object up if we did in fact manage to open it. in cachefiles_drop_object()
288 * It's possible for us to get here before the object is fully in cachefiles_drop_object()
289 * initialised if the parent goes away or the object gets retired in cachefiles_drop_object()
292 if (object->dentry) { in cachefiles_drop_object()
294 if (test_bit(FSCACHE_OBJECT_RETIRED, &object->fscache.flags) && in cachefiles_drop_object()
297 _debug("- retire object OBJ%x", object->fscache.debug_id); in cachefiles_drop_object()
298 inode = d_backing_inode(object->dentry); in cachefiles_drop_object()
303 cachefiles_delete_object(cache, object); in cachefiles_drop_object()
307 /* close the filesystem stuff attached to the object */ in cachefiles_drop_object()
308 if (object->backer != object->dentry) in cachefiles_drop_object()
309 dput(object->backer); in cachefiles_drop_object()
310 object->backer = NULL; in cachefiles_drop_object()
313 /* note that the object is now inactive */ in cachefiles_drop_object()
314 if (test_bit(CACHEFILES_OBJECT_ACTIVE, &object->flags)) in cachefiles_drop_object()
315 cachefiles_mark_object_inactive(cache, object, i_blocks); in cachefiles_drop_object()
317 dput(object->dentry); in cachefiles_drop_object()
318 object->dentry = NULL; in cachefiles_drop_object()
324 * dispose of a reference to an object
329 struct cachefiles_object *object; in cachefiles_put_object() local
335 object = container_of(_object, struct cachefiles_object, fscache); in cachefiles_put_object()
338 object->fscache.debug_id, atomic_read(&object->usage)); in cachefiles_put_object()
341 ASSERT((atomic_read(&object->usage) & 0xffff0000) != 0x6b6b0000); in cachefiles_put_object()
344 ASSERTIFCMP(object->fscache.parent, in cachefiles_put_object()
345 object->fscache.parent->n_children, >, 0); in cachefiles_put_object()
347 u = atomic_dec_return(&object->usage); in cachefiles_put_object()
348 trace_cachefiles_ref(object, _object->cookie, in cachefiles_put_object()
352 _debug("- kill object OBJ%x", object->fscache.debug_id); in cachefiles_put_object()
354 ASSERT(!test_bit(CACHEFILES_OBJECT_ACTIVE, &object->flags)); in cachefiles_put_object()
355 ASSERTCMP(object->fscache.parent, ==, NULL); in cachefiles_put_object()
356 ASSERTCMP(object->backer, ==, NULL); in cachefiles_put_object()
357 ASSERTCMP(object->dentry, ==, NULL); in cachefiles_put_object()
358 ASSERTCMP(object->fscache.n_ops, ==, 0); in cachefiles_put_object()
359 ASSERTCMP(object->fscache.n_children, ==, 0); in cachefiles_put_object()
361 if (object->lookup_data) { in cachefiles_put_object()
362 kfree(object->lookup_data->key); in cachefiles_put_object()
363 kfree(object->lookup_data->auxdata); in cachefiles_put_object()
364 kfree(object->lookup_data); in cachefiles_put_object()
365 object->lookup_data = NULL; in cachefiles_put_object()
368 cache = object->fscache.cache; in cachefiles_put_object()
369 fscache_object_destroy(&object->fscache); in cachefiles_put_object()
370 kmem_cache_free(cachefiles_object_jar, object); in cachefiles_put_object()
411 struct cachefiles_object *object; in cachefiles_check_consistency() local
416 _enter("{OBJ%x}", op->object->debug_id); in cachefiles_check_consistency()
418 object = container_of(op->object, struct cachefiles_object, fscache); in cachefiles_check_consistency()
419 cache = container_of(object->fscache.cache, in cachefiles_check_consistency()
423 ret = cachefiles_check_auxdata(object); in cachefiles_check_consistency()
431 * notification the attributes on an object have changed
436 struct cachefiles_object *object; in cachefiles_attr_changed() local
449 object = container_of(_object, struct cachefiles_object, fscache); in cachefiles_attr_changed()
450 cache = container_of(object->fscache.cache, in cachefiles_attr_changed()
453 if (ni_size == object->i_size) in cachefiles_attr_changed()
456 if (!object->backer) in cachefiles_attr_changed()
459 ASSERT(d_is_reg(object->backer)); in cachefiles_attr_changed()
461 fscache_set_store_limit(&object->fscache, ni_size); in cachefiles_attr_changed()
463 oi_size = i_size_read(d_backing_inode(object->backer)); in cachefiles_attr_changed()
468 inode_lock(d_inode(object->backer)); in cachefiles_attr_changed()
477 ret = notify_change(object->backer, &newattrs, NULL); in cachefiles_attr_changed()
484 ret = notify_change(object->backer, &newattrs, NULL); in cachefiles_attr_changed()
487 inode_unlock(d_inode(object->backer)); in cachefiles_attr_changed()
491 fscache_set_store_limit(&object->fscache, 0); in cachefiles_attr_changed()
492 cachefiles_io_error_obj(object, "Size set failed"); in cachefiles_attr_changed()
501 * Invalidate an object
505 struct cachefiles_object *object; in cachefiles_invalidate_object() local
512 object = container_of(op->object, struct cachefiles_object, fscache); in cachefiles_invalidate_object()
513 cache = container_of(object->fscache.cache, in cachefiles_invalidate_object()
516 ni_size = op->object->store_limit_l; in cachefiles_invalidate_object()
519 op->object->debug_id, (unsigned long long)ni_size); in cachefiles_invalidate_object()
521 if (object->backer) { in cachefiles_invalidate_object()
522 ASSERT(d_is_reg(object->backer)); in cachefiles_invalidate_object()
524 fscache_set_store_limit(&object->fscache, ni_size); in cachefiles_invalidate_object()
526 path.dentry = object->backer; in cachefiles_invalidate_object()
536 fscache_set_store_limit(&object->fscache, 0); in cachefiles_invalidate_object()
538 cachefiles_io_error_obj(object, in cachefiles_invalidate_object()