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()
341 trace_cachefiles_vfs_error(object, d_inode(cache->graveyard), in cachefiles_bury_object()
394 trace_cachefiles_rename(object, d_inode(rep)->i_ino, why); in cachefiles_bury_object()
399 trace_cachefiles_vfs_error(object, d_inode(dir), ret, in cachefiles_bury_object()
406 __cachefiles_unmark_inode_in_use(object, d_inode(rep)); in cachefiles_bury_object()
416 int cachefiles_delete_object(struct cachefiles_object *object, in cachefiles_delete_object() argument
419 struct cachefiles_volume *volume = object->volume; in cachefiles_delete_object()
420 struct dentry *dentry = object->file->f_path.dentry; in cachefiles_delete_object()
421 struct dentry *fan = volume->fanout[(u8)object->cookie->key_hash]; in cachefiles_delete_object()
424 _enter(",OBJ%x{%pD}", object->debug_id, object->file); in cachefiles_delete_object()
430 ret = cachefiles_unlink(volume->cache, object, fan, dentry, why); in cachefiles_delete_object()
438 * time comes to discard the object from memory.
440 struct file *cachefiles_create_tmpfile(struct cachefiles_object *object) in cachefiles_create_tmpfile() argument
442 struct cachefiles_volume *volume = object->volume; in cachefiles_create_tmpfile()
445 struct dentry *fan = volume->fanout[(u8)object->cookie->key_hash]; in cachefiles_create_tmpfile()
463 trace_cachefiles_vfs_error(object, d_inode(fan), ret, in cachefiles_create_tmpfile()
466 cachefiles_io_error_obj(object, "Failed to create tmpfile"); in cachefiles_create_tmpfile()
470 trace_cachefiles_tmpfile(object, file_inode(file)); in cachefiles_create_tmpfile()
473 if (!cachefiles_mark_inode_in_use(object, file_inode(file))) in cachefiles_create_tmpfile()
476 ret = cachefiles_ondemand_init_object(object); in cachefiles_create_tmpfile()
480 ni_size = object->cookie->object_size; in cachefiles_create_tmpfile()
484 trace_cachefiles_trunc(object, file_inode(file), 0, ni_size, in cachefiles_create_tmpfile()
491 object, file_inode(file), ret, in cachefiles_create_tmpfile()
509 cachefiles_do_unmark_inode_in_use(object, file_inode(file)); in cachefiles_create_tmpfile()
519 static bool cachefiles_create_file(struct cachefiles_object *object) in cachefiles_create_file() argument
524 ret = cachefiles_has_space(object->volume->cache, 1, 0, in cachefiles_create_file()
529 file = cachefiles_create_tmpfile(object); in cachefiles_create_file()
533 set_bit(FSCACHE_COOKIE_NEEDS_UPDATE, &object->cookie->flags); in cachefiles_create_file()
534 set_bit(CACHEFILES_OBJECT_USING_TMPFILE, &object->flags); in cachefiles_create_file()
536 object->file = file; in cachefiles_create_file()
544 static bool cachefiles_open_file(struct cachefiles_object *object, in cachefiles_open_file() argument
547 struct cachefiles_cache *cache = object->volume->cache; in cachefiles_open_file()
554 if (!cachefiles_mark_inode_in_use(object, d_inode(dentry))) { in cachefiles_open_file()
568 trace_cachefiles_vfs_error(object, d_backing_inode(dentry), in cachefiles_open_file()
581 ret = cachefiles_ondemand_init_object(object); in cachefiles_open_file()
585 ret = cachefiles_check_auxdata(object, file); in cachefiles_open_file()
589 clear_bit(FSCACHE_COOKIE_NO_DATA_TO_READ, &object->cookie->flags); in cachefiles_open_file()
591 object->file = file; in cachefiles_open_file()
593 /* Always update the atime on an object we've just looked up (this is in cachefiles_open_file()
601 fscache_cookie_lookup_negative(object->cookie); in cachefiles_open_file()
602 cachefiles_unmark_inode_in_use(object, file); in cachefiles_open_file()
605 return cachefiles_create_file(object); in cachefiles_open_file()
611 cachefiles_do_unmark_inode_in_use(object, d_inode(dentry)); in cachefiles_open_file()
616 * walk from the parent object to the child object through the backing
619 bool cachefiles_look_up_object(struct cachefiles_object *object) in cachefiles_look_up_object() argument
621 struct cachefiles_volume *volume = object->volume; in cachefiles_look_up_object()
622 struct dentry *dentry, *fan = volume->fanout[(u8)object->cookie->key_hash]; in cachefiles_look_up_object()
625 _enter("OBJ%x,%s,", object->debug_id, object->d_name); in cachefiles_look_up_object()
630 dentry = lookup_positive_unlocked(object->d_name, fan, in cachefiles_look_up_object()
631 object->d_name_len); in cachefiles_look_up_object()
634 trace_cachefiles_lookup(object, fan, dentry); in cachefiles_look_up_object()
639 cachefiles_io_error_obj(object, "Lookup failed"); in cachefiles_look_up_object()
646 ret = cachefiles_bury_object(volume->cache, object, fan, dentry, in cachefiles_look_up_object()
654 ret = cachefiles_open_file(object, dentry); in cachefiles_look_up_object()
659 _leave(" = t [%lu]", file_inode(object->file)->i_ino); in cachefiles_look_up_object()
663 fscache_cookie_lookup_negative(object->cookie); in cachefiles_look_up_object()
664 return cachefiles_create_file(object); in cachefiles_look_up_object()
671 struct cachefiles_object *object) in cachefiles_commit_tmpfile() argument
673 struct cachefiles_volume *volume = object->volume; in cachefiles_commit_tmpfile()
674 struct dentry *dentry, *fan = volume->fanout[(u8)object->cookie->key_hash]; in cachefiles_commit_tmpfile()
678 _enter(",%pD", object->file); in cachefiles_commit_tmpfile()
683 dentry = lookup_one_len(object->d_name, fan, object->d_name_len); in cachefiles_commit_tmpfile()
687 trace_cachefiles_vfs_error(object, d_inode(fan), PTR_ERR(dentry), in cachefiles_commit_tmpfile()
694 if (d_backing_inode(dentry) == file_inode(object->file)) { in cachefiles_commit_tmpfile()
699 ret = cachefiles_unlink(volume->cache, object, fan, dentry, in cachefiles_commit_tmpfile()
707 dentry = lookup_one_len(object->d_name, fan, object->d_name_len); in cachefiles_commit_tmpfile()
711 trace_cachefiles_vfs_error(object, d_inode(fan), PTR_ERR(dentry), in cachefiles_commit_tmpfile()
720 ret = vfs_link(object->file->f_path.dentry, &nop_mnt_idmap, in cachefiles_commit_tmpfile()
723 trace_cachefiles_vfs_error(object, d_inode(fan), ret, in cachefiles_commit_tmpfile()
727 trace_cachefiles_link(object, file_inode(object->file)); in cachefiles_commit_tmpfile()
728 spin_lock(&object->lock); in cachefiles_commit_tmpfile()
730 clear_bit(CACHEFILES_OBJECT_USING_TMPFILE, &object->flags); in cachefiles_commit_tmpfile()
731 spin_unlock(&object->lock); in cachefiles_commit_tmpfile()
789 * Cull an object if it's not in use
805 /* check to see if someone is using this object */ in cachefiles_cull()
846 * Find out if an object is in use or not
848 * - returns -EBUSY or 0 to indicate whether an object is in use or not