Lines Matching full:object

17 static bool __cachefiles_mark_inode_in_use(struct cachefiles_object *object,  in __cachefiles_mark_inode_in_use()  argument
24 trace_cachefiles_mark_active(object, inode); in __cachefiles_mark_inode_in_use()
27 trace_cachefiles_mark_failed(object, inode); in __cachefiles_mark_inode_in_use()
33 static bool cachefiles_mark_inode_in_use(struct cachefiles_object *object, in cachefiles_mark_inode_in_use() argument
39 can_use = __cachefiles_mark_inode_in_use(object, inode); in cachefiles_mark_inode_in_use()
47 static void __cachefiles_unmark_inode_in_use(struct cachefiles_object *object, in __cachefiles_unmark_inode_in_use() argument
51 trace_cachefiles_mark_inactive(object, inode); in __cachefiles_unmark_inode_in_use()
54 static void cachefiles_do_unmark_inode_in_use(struct cachefiles_object *object, in cachefiles_do_unmark_inode_in_use() argument
58 __cachefiles_unmark_inode_in_use(object, inode); in cachefiles_do_unmark_inode_in_use()
66 void cachefiles_unmark_inode_in_use(struct cachefiles_object *object, in cachefiles_unmark_inode_in_use() argument
69 struct cachefiles_cache *cache = object->volume->cache; in cachefiles_unmark_inode_in_use()
72 cachefiles_do_unmark_inode_in_use(object, inode); in cachefiles_unmark_inode_in_use()
74 if (!test_bit(CACHEFILES_OBJECT_USING_TMPFILE, &object->flags)) { in cachefiles_unmark_inode_in_use()
229 struct cachefiles_object *object, in cachefiles_unlink() argument
239 trace_cachefiles_unlink(object, d_inode(dentry)->i_ino, why); in cachefiles_unlink()
253 trace_cachefiles_vfs_error(object, d_backing_inode(dir), ret, in cachefiles_unlink()
259 * Delete an object representation from the cache
265 struct cachefiles_object *object, in cachefiles_bury_object() argument
288 ret = cachefiles_unlink(cache, object, dir, rep, why); in cachefiles_bury_object()
297 _debug("move stale object to graveyard"); in cachefiles_bury_object()
339 trace_cachefiles_vfs_error(object, d_inode(cache->graveyard), in cachefiles_bury_object()
392 trace_cachefiles_rename(object, d_inode(rep)->i_ino, why); in cachefiles_bury_object()
397 trace_cachefiles_vfs_error(object, d_inode(dir), ret, in cachefiles_bury_object()
404 __cachefiles_unmark_inode_in_use(object, d_inode(rep)); in cachefiles_bury_object()
414 int cachefiles_delete_object(struct cachefiles_object *object, in cachefiles_delete_object() argument
417 struct cachefiles_volume *volume = object->volume; in cachefiles_delete_object()
418 struct dentry *dentry = object->file->f_path.dentry; in cachefiles_delete_object()
419 struct dentry *fan = volume->fanout[(u8)object->cookie->key_hash]; in cachefiles_delete_object()
422 _enter(",OBJ%x{%pD}", object->debug_id, object->file); in cachefiles_delete_object()
428 ret = cachefiles_unlink(volume->cache, object, fan, dentry, why); in cachefiles_delete_object()
436 * time comes to discard the object from memory.
438 struct file *cachefiles_create_tmpfile(struct cachefiles_object *object) in cachefiles_create_tmpfile() argument
440 struct cachefiles_volume *volume = object->volume; in cachefiles_create_tmpfile()
443 struct dentry *fan = volume->fanout[(u8)object->cookie->key_hash]; in cachefiles_create_tmpfile()
460 trace_cachefiles_vfs_error(object, d_inode(fan), ret, in cachefiles_create_tmpfile()
463 cachefiles_io_error_obj(object, "Failed to create tmpfile"); in cachefiles_create_tmpfile()
467 trace_cachefiles_tmpfile(object, file_inode(file)); in cachefiles_create_tmpfile()
470 if (!cachefiles_mark_inode_in_use(object, file_inode(file))) in cachefiles_create_tmpfile()
473 ret = cachefiles_ondemand_init_object(object); in cachefiles_create_tmpfile()
477 ni_size = object->cookie->object_size; in cachefiles_create_tmpfile()
481 trace_cachefiles_trunc(object, file_inode(file), 0, ni_size, in cachefiles_create_tmpfile()
488 object, file_inode(file), ret, in cachefiles_create_tmpfile()
506 cachefiles_do_unmark_inode_in_use(object, file_inode(file)); in cachefiles_create_tmpfile()
516 static bool cachefiles_create_file(struct cachefiles_object *object) in cachefiles_create_file() argument
521 ret = cachefiles_has_space(object->volume->cache, 1, 0, in cachefiles_create_file()
526 file = cachefiles_create_tmpfile(object); in cachefiles_create_file()
530 set_bit(FSCACHE_COOKIE_NEEDS_UPDATE, &object->cookie->flags); in cachefiles_create_file()
531 set_bit(CACHEFILES_OBJECT_USING_TMPFILE, &object->flags); in cachefiles_create_file()
533 object->file = file; in cachefiles_create_file()
541 static bool cachefiles_open_file(struct cachefiles_object *object, in cachefiles_open_file() argument
544 struct cachefiles_cache *cache = object->volume->cache; in cachefiles_open_file()
551 if (!cachefiles_mark_inode_in_use(object, d_inode(dentry))) { in cachefiles_open_file()
566 trace_cachefiles_vfs_error(object, d_backing_inode(dentry), in cachefiles_open_file()
579 ret = cachefiles_ondemand_init_object(object); in cachefiles_open_file()
583 ret = cachefiles_check_auxdata(object, file); in cachefiles_open_file()
587 object->file = file; in cachefiles_open_file()
589 /* Always update the atime on an object we've just looked up (this is in cachefiles_open_file()
598 fscache_cookie_lookup_negative(object->cookie); in cachefiles_open_file()
599 cachefiles_unmark_inode_in_use(object, file); in cachefiles_open_file()
603 return cachefiles_create_file(object); in cachefiles_open_file()
609 cachefiles_do_unmark_inode_in_use(object, d_inode(dentry)); in cachefiles_open_file()
615 * walk from the parent object to the child object through the backing
618 bool cachefiles_look_up_object(struct cachefiles_object *object) in cachefiles_look_up_object() argument
620 struct cachefiles_volume *volume = object->volume; in cachefiles_look_up_object()
621 struct dentry *dentry, *fan = volume->fanout[(u8)object->cookie->key_hash]; in cachefiles_look_up_object()
624 _enter("OBJ%x,%s,", object->debug_id, object->d_name); in cachefiles_look_up_object()
629 dentry = lookup_positive_unlocked(object->d_name, fan, in cachefiles_look_up_object()
630 object->d_name_len); in cachefiles_look_up_object()
633 trace_cachefiles_lookup(object, fan, dentry); in cachefiles_look_up_object()
638 cachefiles_io_error_obj(object, "Lookup failed"); in cachefiles_look_up_object()
645 ret = cachefiles_bury_object(volume->cache, object, fan, dentry, in cachefiles_look_up_object()
653 if (!cachefiles_open_file(object, dentry)) in cachefiles_look_up_object()
656 _leave(" = t [%lu]", file_inode(object->file)->i_ino); in cachefiles_look_up_object()
660 fscache_cookie_lookup_negative(object->cookie); in cachefiles_look_up_object()
661 return cachefiles_create_file(object); in cachefiles_look_up_object()
668 struct cachefiles_object *object) in cachefiles_commit_tmpfile() argument
670 struct cachefiles_volume *volume = object->volume; in cachefiles_commit_tmpfile()
671 struct dentry *dentry, *fan = volume->fanout[(u8)object->cookie->key_hash]; in cachefiles_commit_tmpfile()
675 _enter(",%pD", object->file); in cachefiles_commit_tmpfile()
680 dentry = lookup_one_len(object->d_name, fan, object->d_name_len); in cachefiles_commit_tmpfile()
684 trace_cachefiles_vfs_error(object, d_inode(fan), PTR_ERR(dentry), in cachefiles_commit_tmpfile()
691 if (d_backing_inode(dentry) == file_inode(object->file)) { in cachefiles_commit_tmpfile()
696 ret = cachefiles_unlink(volume->cache, object, fan, dentry, in cachefiles_commit_tmpfile()
704 dentry = lookup_one_len(object->d_name, fan, object->d_name_len); in cachefiles_commit_tmpfile()
708 trace_cachefiles_vfs_error(object, d_inode(fan), PTR_ERR(dentry), in cachefiles_commit_tmpfile()
717 ret = vfs_link(object->file->f_path.dentry, &init_user_ns, in cachefiles_commit_tmpfile()
720 trace_cachefiles_vfs_error(object, d_inode(fan), ret, in cachefiles_commit_tmpfile()
724 trace_cachefiles_link(object, file_inode(object->file)); in cachefiles_commit_tmpfile()
725 spin_lock(&object->lock); in cachefiles_commit_tmpfile()
727 clear_bit(CACHEFILES_OBJECT_USING_TMPFILE, &object->flags); in cachefiles_commit_tmpfile()
728 spin_unlock(&object->lock); in cachefiles_commit_tmpfile()
786 * Cull an object if it's not in use
802 /* check to see if someone is using this object */ in cachefiles_cull()
843 * Find out if an object is in use or not
845 * - returns -EBUSY or 0 to indicate whether an object is in use or not