netfs: Implement unbuffered/DIO read support
[linux-2.6-microblaze.git] / include / linux / netfs.h
index 70f578c..7c13095 100644 (file)
@@ -226,6 +226,7 @@ enum netfs_io_origin {
        NETFS_READPAGE,                 /* This read is a synchronous read */
        NETFS_READ_FOR_WRITE,           /* This read is to prepare a write */
        NETFS_WRITEBACK,                /* This write was triggered by writepages */
+       NETFS_DIO_READ,                 /* This is a direct I/O read */
        nr__netfs_io_origin
 } __mode(byte);
 
@@ -240,6 +241,7 @@ struct netfs_io_request {
        };
        struct inode            *inode;         /* The file being accessed */
        struct address_space    *mapping;       /* The mapping being accessed */
+       struct kiocb            *iocb;          /* AIO completion vector */
        struct netfs_cache_resources cache_resources;
        struct list_head        proc_link;      /* Link in netfs_iorequests */
        struct list_head        subrequests;    /* Contributory I/O operations */
@@ -249,12 +251,14 @@ struct netfs_io_request {
        struct bio_vec          *direct_bv;     /* DIO buffer list (when handling iovec-iter) */
        unsigned int            direct_bv_count; /* Number of elements in direct_bv[] */
        unsigned int            debug_id;
+       unsigned int            rsize;          /* Maximum read size (0 for none) */
        unsigned int            wsize;          /* Maximum write size (0 for none) */
        unsigned int            subreq_counter; /* Next subreq->debug_index */
        atomic_t                nr_outstanding; /* Number of ops in progress */
        atomic_t                nr_copy_ops;    /* Number of copy-to-cache ops in progress */
        size_t                  submitted;      /* Amount submitted for I/O so far */
        size_t                  len;            /* Length of the request */
+       size_t                  transferred;    /* Amount to be indicated as transferred */
        short                   error;          /* 0 or error that occurred */
        enum netfs_io_origin    origin;         /* Origin of the request */
        bool                    direct_bv_unpin; /* T if direct_bv[] must be unpinned */
@@ -271,6 +275,8 @@ struct netfs_io_request {
 #define NETFS_RREQ_IN_PROGRESS         5       /* Unlocked when the request completes */
 #define NETFS_RREQ_WRITE_TO_CACHE      7       /* Need to write to the cache */
 #define NETFS_RREQ_UPLOAD_TO_SERVER    8       /* Need to write to the server */
+#define NETFS_RREQ_NONBLOCK            9       /* Don't block if possible (O_NONBLOCK) */
+#define NETFS_RREQ_BLOCKED             10      /* We blocked */
        const struct netfs_request_ops *netfs_ops;
        void (*cleanup)(struct netfs_io_request *req);
 };
@@ -367,6 +373,9 @@ struct netfs_cache_ops {
                               loff_t *_data_start, size_t *_data_len);
 };
 
+/* High-level read API. */
+ssize_t netfs_unbuffered_read_iter(struct kiocb *iocb, struct iov_iter *iter);
+
 /* High-level write API */
 ssize_t netfs_perform_write(struct kiocb *iocb, struct iov_iter *iter,
                            struct netfs_group *netfs_group);