Lines Matching refs:ki

35 static inline void cachefiles_put_kiocb(struct cachefiles_kiocb *ki)  in cachefiles_put_kiocb()  argument
37 if (refcount_dec_and_test(&ki->ki_refcnt)) { in cachefiles_put_kiocb()
38 cachefiles_put_object(ki->object, cachefiles_obj_put_ioreq); in cachefiles_put_kiocb()
39 fput(ki->iocb.ki_filp); in cachefiles_put_kiocb()
40 kfree(ki); in cachefiles_put_kiocb()
49 struct cachefiles_kiocb *ki = container_of(iocb, struct cachefiles_kiocb, iocb); in cachefiles_read_complete() local
50 struct inode *inode = file_inode(ki->iocb.ki_filp); in cachefiles_read_complete()
55 trace_cachefiles_io_error(ki->object, inode, ret, in cachefiles_read_complete()
58 if (ki->term_func) { in cachefiles_read_complete()
60 if (ki->object->cookie->inval_counter == ki->inval_counter) in cachefiles_read_complete()
61 ki->skipped += ret; in cachefiles_read_complete()
66 ki->term_func(ki->term_func_priv, ret); in cachefiles_read_complete()
69 cachefiles_put_kiocb(ki); in cachefiles_read_complete()
83 struct cachefiles_kiocb *ki; in cachefiles_read() local
135 ki = kzalloc(sizeof(struct cachefiles_kiocb), GFP_KERNEL); in cachefiles_read()
136 if (!ki) in cachefiles_read()
139 refcount_set(&ki->ki_refcnt, 2); in cachefiles_read()
140 ki->iocb.ki_filp = file; in cachefiles_read()
141 ki->iocb.ki_pos = start_pos + skipped; in cachefiles_read()
142 ki->iocb.ki_flags = IOCB_DIRECT; in cachefiles_read()
143 ki->iocb.ki_ioprio = get_current_ioprio(); in cachefiles_read()
144 ki->skipped = skipped; in cachefiles_read()
145 ki->object = object; in cachefiles_read()
146 ki->inval_counter = cres->inval_counter; in cachefiles_read()
147 ki->term_func = term_func; in cachefiles_read()
148 ki->term_func_priv = term_func_priv; in cachefiles_read()
149 ki->was_async = true; in cachefiles_read()
151 if (ki->term_func) in cachefiles_read()
152 ki->iocb.ki_complete = cachefiles_read_complete; in cachefiles_read()
154 get_file(ki->iocb.ki_filp); in cachefiles_read()
157 trace_cachefiles_read(object, file_inode(file), ki->iocb.ki_pos, len - skipped); in cachefiles_read()
161 ret = vfs_iocb_iter_read(file, &ki->iocb, iter); in cachefiles_read()
177 ki->was_async = false; in cachefiles_read()
178 cachefiles_read_complete(&ki->iocb, ret); in cachefiles_read()
185 cachefiles_put_kiocb(ki); in cachefiles_read()
258 struct cachefiles_kiocb *ki = container_of(iocb, struct cachefiles_kiocb, iocb); in cachefiles_write_complete() local
259 struct cachefiles_object *object = ki->object; in cachefiles_write_complete()
260 struct inode *inode = file_inode(ki->iocb.ki_filp); in cachefiles_write_complete()
264 if (ki->was_async) in cachefiles_write_complete()
271 atomic_long_sub(ki->b_writing, &object->volume->cache->b_writing); in cachefiles_write_complete()
273 if (ki->term_func) in cachefiles_write_complete()
274 ki->term_func(ki->term_func_priv, ret); in cachefiles_write_complete()
275 cachefiles_put_kiocb(ki); in cachefiles_write_complete()
289 struct cachefiles_kiocb *ki; in __cachefiles_write() local
301 ki = kzalloc(sizeof(struct cachefiles_kiocb), GFP_KERNEL); in __cachefiles_write()
302 if (!ki) { in __cachefiles_write()
308 refcount_set(&ki->ki_refcnt, 2); in __cachefiles_write()
309 ki->iocb.ki_filp = file; in __cachefiles_write()
310 ki->iocb.ki_pos = start_pos; in __cachefiles_write()
311 ki->iocb.ki_flags = IOCB_DIRECT | IOCB_WRITE; in __cachefiles_write()
312 ki->iocb.ki_ioprio = get_current_ioprio(); in __cachefiles_write()
313 ki->object = object; in __cachefiles_write()
314 ki->start = start_pos; in __cachefiles_write()
315 ki->len = len; in __cachefiles_write()
316 ki->term_func = term_func; in __cachefiles_write()
317 ki->term_func_priv = term_func_priv; in __cachefiles_write()
318 ki->was_async = true; in __cachefiles_write()
319 ki->b_writing = (len + (1 << cache->bshift) - 1) >> cache->bshift; in __cachefiles_write()
321 if (ki->term_func) in __cachefiles_write()
322 ki->iocb.ki_complete = cachefiles_write_complete; in __cachefiles_write()
323 atomic_long_add(ki->b_writing, &cache->b_writing); in __cachefiles_write()
325 get_file(ki->iocb.ki_filp); in __cachefiles_write()
328 trace_cachefiles_write(object, file_inode(file), ki->iocb.ki_pos, len); in __cachefiles_write()
332 ret = vfs_iocb_iter_write(file, &ki->iocb, iter); in __cachefiles_write()
348 ki->was_async = false; in __cachefiles_write()
349 cachefiles_write_complete(&ki->iocb, ret); in __cachefiles_write()
354 cachefiles_put_kiocb(ki); in __cachefiles_write()