[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH][3/4][IOMGR] Add I/O request manager interface into blktap


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: "Satoshi Uchida" <s-uchida@xxxxxxxxxxxxx>
  • Date: Mon, 30 Jul 2007 17:51:14 +0900
  • Delivery-date: Mon, 30 Jul 2007 01:50:14 -0700
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>
  • Thread-index: AcfShsjVeyhK5fJhSJe6rAFeMjYGBg==

This patch adds I/O request management interface into blktap.

 --------------------------------------------------
 Satoshi UCHIDA 
    NEC Corporation, Japan


# HG changeset patch
# User s-uchida@xxxxxxxxxxxxx
# Date 1184302196 -32400
# Node ID e64625df946b81ac1a5f8be7c5d0ae2aad618d7c
# Parent  ce1e6cb8e92dc12d16ecb8f8a3a02cb2773e54e3
[IOMGR,BLKTAP] Add I/O request management for virtual block devices into blktap.

  Signed-off-by  Satoshi UCHIDA <s-uchida@xxxxxxxxxxxxx>

diff -r ce1e6cb8e92d -r e64625df946b drivers/xen/blktap/blktap.c
--- a/drivers/xen/blktap/blktap.c       Fri Jul 13 13:48:12 2007 +0900
+++ b/drivers/xen/blktap/blktap.c       Fri Jul 13 13:49:56 2007 +0900
@@ -54,6 +54,10 @@
 #include <linux/poll.h>
 #include <asm/tlbflush.h>
 
+#ifdef CONFIG_XEN_IOMGR
+#include <xen/iomgr.h>
+#endif
+
 #define MAX_TAP_DEV 256     /*the maximum number of tapdisk ring devices    */
 #define MAX_DEV_NAME 100    /*the max tapdisk ring device name e.g. blktap0 */
 
@@ -938,6 +942,11 @@ static void free_req(pending_req_t *req)
        spin_lock_irqsave(&pending_free_lock, flags);
 
        alloc_pending_reqs--;
+       
+#ifdef CONFIG_XEN_IOMGR
+       do_iomgr_free_request(req->blkif->be->dev);
+#endif
+
        req->inuse = 0;
        if (mmap_lock && (req->mem_idx == mmap_alloc-1)) {
                mmap_inuse--;
@@ -1056,6 +1065,10 @@ int tap_blkif_schedule(void *arg)
        if (debug_lvl)
                printk(KERN_DEBUG "%s: started\n", current->comm);
 
+#ifdef CONFIG_XEN_IOMGR
+       do_iomgr_dev_start(blkif->be->dev);
+#endif
+
        while (!kthread_should_stop()) {
                wait_event_interruptible(
                        blkif->wq,
@@ -1064,6 +1077,10 @@ int tap_blkif_schedule(void *arg)
                        pending_free_wq,
                        !list_empty(&pending_free) || kthread_should_stop());
 
+#ifdef CONFIG_XEN_IOMGR
+               do_iomgr_waiting_request(blkif->be->dev);
+#endif
+
                blkif->waiting_reqs = 0;
                smp_mb(); /* clear flag *before* checking for work */
 
@@ -1078,6 +1095,10 @@ int tap_blkif_schedule(void *arg)
                print_stats(blkif);
        if (debug_lvl)
                printk(KERN_DEBUG "%s: exiting\n", current->comm);
+
+#ifdef CONFIG_XEN_IOMGR
+       do_iomgr_dev_stop(blkif->be->dev);
+#endif
 
        blkif->xenblkd = NULL;
        blkif_put(blkif);
@@ -1108,7 +1129,7 @@ static int blktap_read_ufe_ring(tap_blki
        /* for each outstanding message on the UFEring  */
        rp = info->ufe_ring.sring->rsp_prod;
        rmb();
-        
+
        for (i = info->ufe_ring.rsp_cons; i != rp; i++) {
                blkif_response_t res;
                resp = RING_GET_RESPONSE(&info->ufe_ring, i);
@@ -1232,11 +1253,25 @@ static int do_block_io_op(blkif_t *blkif
                        break;          
                }
 
+#ifdef CONFIG_XEN_IOMGR
+               if (do_iomgr_allow_request(blkif->be->dev)) {
+                       more_to_do = 1;
+                       break;
+               }
+#endif
+
                pending_req = alloc_req();
                if (NULL == pending_req) {
+#ifdef CONFIG_XEN_IOMGR
+                       do_iomgr_oo_abort_request(blkif->be->dev);
+#endif
                        blkif->st_oo_req++;
                        more_to_do = 1;
                        break;
+#ifdef CONFIG_XEN_IOMGR
+               } else {
+                       do_iomgr_alloc_request(blkif->be->dev);
+#endif
                }
 
                switch (blkif->blk_protocol) {
diff -r ce1e6cb8e92d -r e64625df946b drivers/xen/blktap/common.h
--- a/drivers/xen/blktap/common.h       Fri Jul 13 13:48:12 2007 +0900
+++ b/drivers/xen/blktap/common.h       Fri Jul 13 13:49:56 2007 +0900
@@ -41,6 +41,7 @@
 #include <xen/blkif.h>
 #include <xen/gnttab.h>
 #include <xen/driver_util.h>
+#include <xen/xenbus.h>
 
 #define DPRINTK(_f, _a...) pr_debug("(file=%s, line=%d) " _f, \
                                     __FILE__ , __LINE__ , ## _a )
@@ -87,6 +88,15 @@ typedef struct blkif_st {
        uint64_t        sectors;
 } blkif_t;
 
+struct backend_info
+{
+       struct xenbus_device *dev;
+       blkif_t *blkif;
+       struct xenbus_watch backend_watch;
+       int xenbus_id;
+       int group_added;
+};
+
 blkif_t *tap_alloc_blkif(domid_t domid);
 void tap_blkif_free(blkif_t *blkif);
 int tap_blkif_map(blkif_t *blkif, unsigned long shared_page, 
diff -r ce1e6cb8e92d -r e64625df946b drivers/xen/blktap/xenbus.c
--- a/drivers/xen/blktap/xenbus.c       Fri Jul 13 13:48:12 2007 +0900
+++ b/drivers/xen/blktap/xenbus.c       Fri Jul 13 13:49:56 2007 +0900
@@ -39,16 +39,6 @@
 #include <linux/kthread.h>
 #include <xen/xenbus.h>
 #include "common.h"
-
-
-struct backend_info
-{
-       struct xenbus_device *dev;
-       blkif_t *blkif;
-       struct xenbus_watch backend_watch;
-       int xenbus_id;
-       int group_added;
-};
 
 
 static void connect(struct backend_info *);


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.