Lines Matching full:object

21 	struct cachefiles_object *object = file->private_data;  in cachefiles_ondemand_fd_release()  local
28 if (!object) in cachefiles_ondemand_fd_release()
31 info = object->ondemand; in cachefiles_ondemand_fd_release()
32 cache = object->volume->cache; in cachefiles_ondemand_fd_release()
39 cachefiles_ondemand_set_object_close(object); in cachefiles_ondemand_fd_release()
53 trace_cachefiles_ondemand_fd_release(object, object_id); in cachefiles_ondemand_fd_release()
54 cachefiles_put_object(object, cachefiles_obj_put_ondemand_fd); in cachefiles_ondemand_fd_release()
62 struct cachefiles_object *object = kiocb->ki_filp->private_data; in cachefiles_ondemand_fd_write_iter() local
63 struct cachefiles_cache *cache = object->volume->cache; in cachefiles_ondemand_fd_write_iter()
64 struct file *file = object->file; in cachefiles_ondemand_fd_write_iter()
74 ret = __cachefiles_prepare_write(object, file, &pos, &len, true); in cachefiles_ondemand_fd_write_iter()
79 trace_cachefiles_ondemand_fd_write(object, file_inode(file), pos, len); in cachefiles_ondemand_fd_write_iter()
80 ret = __cachefiles_write(object, file, pos, iter, NULL, NULL); in cachefiles_ondemand_fd_write_iter()
92 struct cachefiles_object *object = filp->private_data; in cachefiles_ondemand_fd_llseek() local
93 struct file *file = object->file; in cachefiles_ondemand_fd_llseek()
104 struct cachefiles_object *object = filp->private_data; in cachefiles_ondemand_fd_ioctl() local
105 struct cachefiles_cache *cache = object->volume->cache; in cachefiles_ondemand_fd_ioctl()
118 req->object != object) { in cachefiles_ondemand_fd_ioctl()
125 trace_cachefiles_ondemand_cread(object, id); in cachefiles_ondemand_fd_ioctl()
141 * <cache_size> indicates the object size if >=0, error code if negative
180 !req->object->ondemand->ondemand_id) { in cachefiles_ondemand_copen()
187 info = req->object->ondemand; in cachefiles_ondemand_copen()
218 * cachefiles_ondemand_set_object_close(object) in cachefiles_ondemand_copen()
233 cookie = req->object->cookie; in cachefiles_ondemand_copen()
239 trace_cachefiles_ondemand_copen(req->object, id, size); in cachefiles_ondemand_copen()
241 cachefiles_ondemand_set_object_open(req->object); in cachefiles_ondemand_copen()
247 /* Need to set object close to avoid reopen status continuing */ in cachefiles_ondemand_copen()
249 cachefiles_ondemand_set_object_close(req->object); in cachefiles_ondemand_copen()
281 struct cachefiles_object *object; in cachefiles_ondemand_get_fd() local
287 object = cachefiles_grab_object(req->object, in cachefiles_ondemand_get_fd()
289 cache = object->volume->cache; in cachefiles_ondemand_get_fd()
304 &cachefiles_ondemand_fd_fops, object, O_WRONLY); in cachefiles_ondemand_get_fd()
310 spin_lock(&object->ondemand->lock); in cachefiles_ondemand_get_fd()
311 if (object->ondemand->ondemand_id > 0) { in cachefiles_ondemand_get_fd()
312 spin_unlock(&object->ondemand->lock); in cachefiles_ondemand_get_fd()
323 object->ondemand->ondemand_id = object_id; in cachefiles_ondemand_get_fd()
324 spin_unlock(&object->ondemand->lock); in cachefiles_ondemand_get_fd()
327 trace_cachefiles_ondemand_open(object, &req->msg, load); in cachefiles_ondemand_get_fd()
339 spin_lock(&object->ondemand->lock); in cachefiles_ondemand_get_fd()
340 /* Avoid marking an opened object as closed. */ in cachefiles_ondemand_get_fd()
341 if (object->ondemand->ondemand_id <= 0) in cachefiles_ondemand_get_fd()
342 cachefiles_ondemand_set_object_close(object); in cachefiles_ondemand_get_fd()
343 spin_unlock(&object->ondemand->lock); in cachefiles_ondemand_get_fd()
344 cachefiles_put_object(object, cachefiles_obj_put_ondemand_fd); in cachefiles_ondemand_get_fd()
353 cachefiles_ondemand_init_object(info->object); in ondemand_object_worker()
358 * closed object, reopen it.
359 * Skip read requests whose related object is reopening.
365 struct cachefiles_object *object; in cachefiles_ondemand_select_req() local
371 object = req->object; in cachefiles_ondemand_select_req()
372 info = object->ondemand; in cachefiles_ondemand_select_req()
373 if (cachefiles_ondemand_object_is_close(object)) { in cachefiles_ondemand_select_req()
374 cachefiles_ondemand_set_object_reopening(object); in cachefiles_ondemand_select_req()
378 if (cachefiles_ondemand_object_is_reopening(object)) in cachefiles_ondemand_select_req()
436 cachefiles_grab_object(req->object, cachefiles_obj_get_read_req); in cachefiles_ondemand_daemon_read()
446 msg->object_id = req->object->ondemand->ondemand_id; in cachefiles_ondemand_daemon_read()
460 cachefiles_put_object(req->object, cachefiles_obj_put_read_req); in cachefiles_ondemand_daemon_read()
470 static int cachefiles_ondemand_send_req(struct cachefiles_object *object, in cachefiles_ondemand_send_req() argument
476 struct cachefiles_cache *cache = object->volume->cache; in cachefiles_ondemand_send_req()
496 req->object = object; in cachefiles_ondemand_send_req()
524 cachefiles_ondemand_object_is_dropping(object)) { in cachefiles_ondemand_send_req()
534 !cachefiles_ondemand_object_is_open(object)) { in cachefiles_ondemand_send_req()
535 WARN_ON_ONCE(object->ondemand->ondemand_id == 0); in cachefiles_ondemand_send_req()
583 /* Reset the object to close state in error handling path. in cachefiles_ondemand_send_req()
585 * cachefiles_ondemand_fd_release() will set object to close. in cachefiles_ondemand_send_req()
588 !cachefiles_ondemand_object_is_dropping(object)) in cachefiles_ondemand_send_req()
589 cachefiles_ondemand_set_object_close(object); in cachefiles_ondemand_send_req()
597 struct cachefiles_object *object = req->object; in cachefiles_ondemand_init_open_req() local
598 struct fscache_cookie *cookie = object->cookie; in cachefiles_ondemand_init_open_req()
599 struct fscache_volume *volume = object->volume->vcookie; in cachefiles_ondemand_init_open_req()
615 if (!(object->cookie->advice & FSCACHE_ADV_WANT_CACHE_SIZE)) { in cachefiles_ondemand_init_open_req()
631 struct cachefiles_object *object = req->object; in cachefiles_ondemand_init_close_req() local
633 if (!cachefiles_ondemand_object_is_open(object)) in cachefiles_ondemand_init_close_req()
636 trace_cachefiles_ondemand_close(object, &req->msg); in cachefiles_ondemand_init_close_req()
648 struct cachefiles_object *object = req->object; in cachefiles_ondemand_init_read_req() local
654 trace_cachefiles_ondemand_read(object, &req->msg, load); in cachefiles_ondemand_init_read_req()
658 int cachefiles_ondemand_init_object(struct cachefiles_object *object) in cachefiles_ondemand_init_object() argument
660 struct fscache_cookie *cookie = object->cookie; in cachefiles_ondemand_init_object()
661 struct fscache_volume *volume = object->volume->vcookie; in cachefiles_ondemand_init_object()
664 if (!object->ondemand) in cachefiles_ondemand_init_object()
671 * allocated object ID if any. in cachefiles_ondemand_init_object()
673 if (cachefiles_ondemand_object_is_open(object)) in cachefiles_ondemand_init_object()
681 return cachefiles_ondemand_send_req(object, CACHEFILES_OP_OPEN, in cachefiles_ondemand_init_object()
685 void cachefiles_ondemand_clean_object(struct cachefiles_object *object) in cachefiles_ondemand_clean_object() argument
691 if (!object->ondemand) in cachefiles_ondemand_clean_object()
694 cachefiles_ondemand_send_req(object, CACHEFILES_OP_CLOSE, 0, in cachefiles_ondemand_clean_object()
697 if (!object->ondemand->ondemand_id) in cachefiles_ondemand_clean_object()
700 /* Cancel all requests for the object that is being dropped. */ in cachefiles_ondemand_clean_object()
701 cache = object->volume->cache; in cachefiles_ondemand_clean_object()
703 cachefiles_ondemand_set_object_dropping(object); in cachefiles_ondemand_clean_object()
705 if (req->object == object) { in cachefiles_ondemand_clean_object()
714 cancel_work_sync(&object->ondemand->ondemand_work); in cachefiles_ondemand_clean_object()
717 int cachefiles_ondemand_init_obj_info(struct cachefiles_object *object, in cachefiles_ondemand_init_obj_info() argument
723 object->ondemand = kzalloc(sizeof(struct cachefiles_ondemand_info), in cachefiles_ondemand_init_obj_info()
725 if (!object->ondemand) in cachefiles_ondemand_init_obj_info()
728 object->ondemand->object = object; in cachefiles_ondemand_init_obj_info()
729 spin_lock_init(&object->ondemand->lock); in cachefiles_ondemand_init_obj_info()
730 INIT_WORK(&object->ondemand->ondemand_work, ondemand_object_worker); in cachefiles_ondemand_init_obj_info()
734 void cachefiles_ondemand_deinit_obj_info(struct cachefiles_object *object) in cachefiles_ondemand_deinit_obj_info() argument
736 kfree(object->ondemand); in cachefiles_ondemand_deinit_obj_info()
737 object->ondemand = NULL; in cachefiles_ondemand_deinit_obj_info()
740 int cachefiles_ondemand_read(struct cachefiles_object *object, in cachefiles_ondemand_read() argument
745 return cachefiles_ondemand_send_req(object, CACHEFILES_OP_READ, in cachefiles_ondemand_read()