add support for configurable max allocated requests and local req cache
[archipelago] / xseg / peers / kernel / xsegbd.h
index 4142f02..416ecce 100644 (file)
@@ -8,8 +8,17 @@
 
 #include <linux/kernel.h>
 #include <linux/types.h>
+#include <linux/wait.h>
 #include <xseg/xseg.h>
-#include <xq/xq.h>
+#include <xtypes/xq.h>
+
+struct xsegbd_device;
+
+struct xsegbd_pending {
+       struct request *request;
+       struct completion *comp;
+       struct xsegbd_device *dev;
+};
 
 struct xsegbd {
        char name[XSEGBD_SEGMENT_NAMELEN];
@@ -18,22 +27,26 @@ struct xsegbd {
 };
 
 struct xsegbd_device {
-       spinlock_t lock;
+       struct xseg *xseg;
+       spinlock_t rqlock;
        struct request_queue *blk_queue;
        struct gendisk *gd;
        int id;
        int major;
        sector_t sectors;
        uint64_t segsize;
-       uint32_t src_portno, dst_portno, nr_requests;
+       xport src_portno, dst_portno;
+       uint32_t  nr_requests;
        struct xq blk_queue_pending;
        struct xsegbd *xsegbd;
-       char *_blk_queue_mem;
-       struct request **blk_req_pending;
+       struct xsegbd_pending *blk_req_pending;
        struct device dev;
        struct list_head node;
-       char name[XSEGBD_TARGET_NAMELEN + 1];
-       uint32_t namesize;
+       char target[XSEGBD_TARGET_NAMELEN + 1];
+       uint32_t targetlen;
 };
 
+void __xsegbd_get(struct xsegbd_device *xsegbd_dev);
+void __xsegbd_put(struct xsegbd_device *xsegbd_dev);
+struct xsegbd_device *__xsegbd_get_dev(unsigned long id);
 #endif