aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse/fuse_i.h
diff options
context:
space:
mode:
authorMaxim Patlasov <mpatlasov@parallels.com>2012-12-14 10:20:41 -0500
committerMiklos Szeredi <mszeredi@suse.cz>2013-04-17 15:50:59 -0400
commit01e9d11a3e79035ca5cd89b035435acd4ba61ee1 (patch)
tree514830e4188f2799b91239cd669ef1629ce3e278 /fs/fuse/fuse_i.h
parent187c5c36330bc8d15674d9e6d2a2412de6b1034d (diff)
fuse: add support of async IO
The patch implements a framework to process an IO request asynchronously. The idea is to associate several fuse requests with a single kiocb by means of fuse_io_priv structure. The structure plays the same role for FUSE as 'struct dio' for direct-io.c. The framework is supposed to be used like this: - someone (who wants to process an IO asynchronously) allocates fuse_io_priv and initializes it setting 'async' field to non-zero value. - as soon as fuse request is filled, it can be submitted (in non-blocking way) by fuse_async_req_send() - when all submitted requests are ACKed by userspace, io->reqs drops to zero triggering aio_complete() In case of IO initiated by libaio, aio_complete() will finish processing the same way as in case of dio_complete() calling aio_complete(). But the framework may be also used for internal FUSE use when initial IO request was synchronous (from user perspective), but it's beneficial to process it asynchronously. Then the caller should wait on kiocb explicitly and aio_complete() will wake the caller up. Signed-off-by: Maxim Patlasov <mpatlasov@parallels.com> Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Diffstat (limited to 'fs/fuse/fuse_i.h')
-rw-r--r--fs/fuse/fuse_i.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 6bf30f2af901..aea072413c47 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -228,6 +228,20 @@ enum fuse_req_state {
228 FUSE_REQ_FINISHED 228 FUSE_REQ_FINISHED
229}; 229};
230 230
231/** The request IO state (for asynchronous processing) */
232struct fuse_io_priv {
233 int async;
234 spinlock_t lock;
235 unsigned reqs;
236 ssize_t bytes;
237 size_t size;
238 __u64 offset;
239 bool write;
240 int err;
241 struct kiocb *iocb;
242 struct file *file;
243};
244
231/** 245/**
232 * A request to the client 246 * A request to the client
233 */ 247 */
@@ -332,6 +346,9 @@ struct fuse_req {
332 /** Inode used in the request or NULL */ 346 /** Inode used in the request or NULL */
333 struct inode *inode; 347 struct inode *inode;
334 348
349 /** AIO control block */
350 struct fuse_io_priv *io;
351
335 /** Link on fi->writepages */ 352 /** Link on fi->writepages */
336 struct list_head writepages_entry; 353 struct list_head writepages_entry;
337 354