Lines Matching full:object

20 	struct cachefiles_object *object = file->private_data;  in cachefiles_ondemand_fd_release()  local
27 if (!object) in cachefiles_ondemand_fd_release()
30 info = object->ondemand; in cachefiles_ondemand_fd_release()
31 cache = object->volume->cache; in cachefiles_ondemand_fd_release()
38 cachefiles_ondemand_set_object_close(object); in cachefiles_ondemand_fd_release()
52 trace_cachefiles_ondemand_fd_release(object, object_id); in cachefiles_ondemand_fd_release()
53 cachefiles_put_object(object, cachefiles_obj_put_ondemand_fd); in cachefiles_ondemand_fd_release()
61 struct cachefiles_object *object = kiocb->ki_filp->private_data; in cachefiles_ondemand_fd_write_iter() local
62 struct cachefiles_cache *cache = object->volume->cache; in cachefiles_ondemand_fd_write_iter()
63 struct file *file = object->file; in cachefiles_ondemand_fd_write_iter()
73 ret = __cachefiles_prepare_write(object, file, &pos, &len, len, true); in cachefiles_ondemand_fd_write_iter()
78 trace_cachefiles_ondemand_fd_write(object, file_inode(file), pos, len); in cachefiles_ondemand_fd_write_iter()
79 ret = __cachefiles_write(object, file, pos, iter, NULL, NULL); in cachefiles_ondemand_fd_write_iter()
89 struct cachefiles_object *object = filp->private_data; in cachefiles_ondemand_fd_llseek() local
90 struct file *file = object->file; in cachefiles_ondemand_fd_llseek()
101 struct cachefiles_object *object = filp->private_data; in cachefiles_ondemand_fd_ioctl() local
102 struct cachefiles_cache *cache = object->volume->cache; in cachefiles_ondemand_fd_ioctl()
115 req->object != object) { in cachefiles_ondemand_fd_ioctl()
122 trace_cachefiles_ondemand_cread(object, id); in cachefiles_ondemand_fd_ioctl()
138 * <cache_size> indicates the object size if >=0, error code if negative
177 !req->object->ondemand->ondemand_id) { in cachefiles_ondemand_copen()
184 info = req->object->ondemand; in cachefiles_ondemand_copen()
215 * cachefiles_ondemand_set_object_close(object) in cachefiles_ondemand_copen()
230 cookie = req->object->cookie; in cachefiles_ondemand_copen()
236 trace_cachefiles_ondemand_copen(req->object, id, size); in cachefiles_ondemand_copen()
238 cachefiles_ondemand_set_object_open(req->object); in cachefiles_ondemand_copen()
244 /* Need to set object close to avoid reopen status continuing */ in cachefiles_ondemand_copen()
246 cachefiles_ondemand_set_object_close(req->object); in cachefiles_ondemand_copen()
278 struct cachefiles_object *object; in cachefiles_ondemand_get_fd() local
284 object = cachefiles_grab_object(req->object, in cachefiles_ondemand_get_fd()
286 cache = object->volume->cache; in cachefiles_ondemand_get_fd()
301 &cachefiles_ondemand_fd_fops, object, O_WRONLY); in cachefiles_ondemand_get_fd()
307 spin_lock(&object->ondemand->lock); in cachefiles_ondemand_get_fd()
308 if (object->ondemand->ondemand_id > 0) { in cachefiles_ondemand_get_fd()
309 spin_unlock(&object->ondemand->lock); in cachefiles_ondemand_get_fd()
320 object->ondemand->ondemand_id = object_id; in cachefiles_ondemand_get_fd()
321 spin_unlock(&object->ondemand->lock); in cachefiles_ondemand_get_fd()
324 trace_cachefiles_ondemand_open(object, &req->msg, load); in cachefiles_ondemand_get_fd()
336 spin_lock(&object->ondemand->lock); in cachefiles_ondemand_get_fd()
337 /* Avoid marking an opened object as closed. */ in cachefiles_ondemand_get_fd()
338 if (object->ondemand->ondemand_id <= 0) in cachefiles_ondemand_get_fd()
339 cachefiles_ondemand_set_object_close(object); in cachefiles_ondemand_get_fd()
340 spin_unlock(&object->ondemand->lock); in cachefiles_ondemand_get_fd()
341 cachefiles_put_object(object, cachefiles_obj_put_ondemand_fd); in cachefiles_ondemand_get_fd()
350 cachefiles_ondemand_init_object(info->object); in ondemand_object_worker()
355 * closed object, reopen it.
356 * Skip read requests whose related object is reopening.
362 struct cachefiles_object *object; in cachefiles_ondemand_select_req() local
368 object = req->object; in cachefiles_ondemand_select_req()
369 info = object->ondemand; in cachefiles_ondemand_select_req()
370 if (cachefiles_ondemand_object_is_close(object)) { in cachefiles_ondemand_select_req()
371 cachefiles_ondemand_set_object_reopening(object); in cachefiles_ondemand_select_req()
375 if (cachefiles_ondemand_object_is_reopening(object)) in cachefiles_ondemand_select_req()
433 cachefiles_grab_object(req->object, cachefiles_obj_get_read_req); in cachefiles_ondemand_daemon_read()
443 msg->object_id = req->object->ondemand->ondemand_id; in cachefiles_ondemand_daemon_read()
457 cachefiles_put_object(req->object, cachefiles_obj_put_read_req); in cachefiles_ondemand_daemon_read()
467 static int cachefiles_ondemand_send_req(struct cachefiles_object *object, in cachefiles_ondemand_send_req() argument
473 struct cachefiles_cache *cache = object->volume->cache; in cachefiles_ondemand_send_req()
493 req->object = object; in cachefiles_ondemand_send_req()
521 cachefiles_ondemand_object_is_dropping(object)) { in cachefiles_ondemand_send_req()
531 !cachefiles_ondemand_object_is_open(object)) { in cachefiles_ondemand_send_req()
532 WARN_ON_ONCE(object->ondemand->ondemand_id == 0); in cachefiles_ondemand_send_req()
580 /* Reset the object to close state in error handling path. in cachefiles_ondemand_send_req()
582 * cachefiles_ondemand_fd_release() will set object to close. in cachefiles_ondemand_send_req()
585 !cachefiles_ondemand_object_is_dropping(object)) in cachefiles_ondemand_send_req()
586 cachefiles_ondemand_set_object_close(object); in cachefiles_ondemand_send_req()
594 struct cachefiles_object *object = req->object; in cachefiles_ondemand_init_open_req() local
595 struct fscache_cookie *cookie = object->cookie; in cachefiles_ondemand_init_open_req()
596 struct fscache_volume *volume = object->volume->vcookie; in cachefiles_ondemand_init_open_req()
612 if (!(object->cookie->advice & FSCACHE_ADV_WANT_CACHE_SIZE)) { in cachefiles_ondemand_init_open_req()
628 struct cachefiles_object *object = req->object; in cachefiles_ondemand_init_close_req() local
630 if (!cachefiles_ondemand_object_is_open(object)) in cachefiles_ondemand_init_close_req()
633 trace_cachefiles_ondemand_close(object, &req->msg); in cachefiles_ondemand_init_close_req()
645 struct cachefiles_object *object = req->object; in cachefiles_ondemand_init_read_req() local
651 trace_cachefiles_ondemand_read(object, &req->msg, load); in cachefiles_ondemand_init_read_req()
655 int cachefiles_ondemand_init_object(struct cachefiles_object *object) in cachefiles_ondemand_init_object() argument
657 struct fscache_cookie *cookie = object->cookie; in cachefiles_ondemand_init_object()
658 struct fscache_volume *volume = object->volume->vcookie; in cachefiles_ondemand_init_object()
661 if (!object->ondemand) in cachefiles_ondemand_init_object()
668 * allocated object ID if any. in cachefiles_ondemand_init_object()
670 if (cachefiles_ondemand_object_is_open(object)) in cachefiles_ondemand_init_object()
678 return cachefiles_ondemand_send_req(object, CACHEFILES_OP_OPEN, in cachefiles_ondemand_init_object()
682 void cachefiles_ondemand_clean_object(struct cachefiles_object *object) in cachefiles_ondemand_clean_object() argument
688 if (!object->ondemand) in cachefiles_ondemand_clean_object()
691 cachefiles_ondemand_send_req(object, CACHEFILES_OP_CLOSE, 0, in cachefiles_ondemand_clean_object()
694 if (!object->ondemand->ondemand_id) in cachefiles_ondemand_clean_object()
697 /* Cancel all requests for the object that is being dropped. */ in cachefiles_ondemand_clean_object()
698 cache = object->volume->cache; in cachefiles_ondemand_clean_object()
700 cachefiles_ondemand_set_object_dropping(object); in cachefiles_ondemand_clean_object()
702 if (req->object == object) { in cachefiles_ondemand_clean_object()
711 cancel_work_sync(&object->ondemand->ondemand_work); in cachefiles_ondemand_clean_object()
714 int cachefiles_ondemand_init_obj_info(struct cachefiles_object *object, in cachefiles_ondemand_init_obj_info() argument
720 object->ondemand = kzalloc(sizeof(struct cachefiles_ondemand_info), in cachefiles_ondemand_init_obj_info()
722 if (!object->ondemand) in cachefiles_ondemand_init_obj_info()
725 object->ondemand->object = object; in cachefiles_ondemand_init_obj_info()
726 spin_lock_init(&object->ondemand->lock); in cachefiles_ondemand_init_obj_info()
727 INIT_WORK(&object->ondemand->ondemand_work, ondemand_object_worker); in cachefiles_ondemand_init_obj_info()
731 void cachefiles_ondemand_deinit_obj_info(struct cachefiles_object *object) in cachefiles_ondemand_deinit_obj_info() argument
733 kfree(object->ondemand); in cachefiles_ondemand_deinit_obj_info()
734 object->ondemand = NULL; in cachefiles_ondemand_deinit_obj_info()
737 int cachefiles_ondemand_read(struct cachefiles_object *object, in cachefiles_ondemand_read() argument
742 return cachefiles_ondemand_send_req(object, CACHEFILES_OP_READ, in cachefiles_ondemand_read()