WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH][2/4][IOMGR] Add I/O request manager interface into blkback
From: "Satoshi Uchida" <s-uchida@xxxxxxxxxxxxx>
Date: Mon, 30 Jul 2007 17:51:03 +0900
Delivery-date: Mon, 30 Jul 2007 01:49:45 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcfShsIorNWElp8MTEWlD+XcKhR4kA==
This patch adds I/O request management interface into blkback.

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


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

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

diff -r f4ebae5f2274 -r ce1e6cb8e92d drivers/xen/blkback/blkback.c
--- a/drivers/xen/blkback/blkback.c     Fri Jul 13 13:45:30 2007 +0900
+++ b/drivers/xen/blkback/blkback.c     Fri Jul 13 13:48:12 2007 +0900
@@ -41,6 +41,10 @@
 #include <xen/balloon.h>
 #include <asm/hypervisor.h>
 #include "common.h"
+
+#ifdef CONFIG_XEN_IOMGR
+#include <xen/iomgr.h>
+#endif
 
 /*
  * These are rather arbitrary. They are fairly large because adjacent requests
@@ -138,6 +142,10 @@ static void free_req(pending_req_t *req)
        spin_unlock_irqrestore(&pending_free_lock, flags);
        if (was_empty)
                wake_up(&pending_free_wq);
+
+#ifdef CONFIG_XEN_IOMGR
+       do_iomgr_free_request(req->blkif->be->dev);
+#endif
 }
 
 static void unplug_queue(blkif_t *blkif)
@@ -206,6 +214,10 @@ int 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()) {
                if(try_to_freeze())
@@ -218,6 +230,10 @@ int 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 */
 
@@ -233,6 +249,10 @@ int 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);
@@ -316,11 +336,25 @@ static int do_block_io_op(blkif_t *blkif
                if (RING_REQUEST_CONS_OVERFLOW(&blk_rings->common, rc))
                        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 f4ebae5f2274 -r ce1e6cb8e92d drivers/xen/blkback/common.h
--- a/drivers/xen/blkback/common.h      Fri Jul 13 13:45:30 2007 +0900
+++ b/drivers/xen/blkback/common.h      Fri Jul 13 13:48:12 2007 +0900
@@ -96,6 +96,16 @@ typedef struct blkif_st {
        grant_ref_t    shmem_ref;
 } blkif_t;
 
+struct backend_info
+{
+       struct xenbus_device *dev;
+       blkif_t *blkif;
+       struct xenbus_watch backend_watch;
+       unsigned major;
+       unsigned minor;
+       char *mode;
+};
+
 blkif_t *blkif_alloc(domid_t domid);
 void blkif_disconnect(blkif_t *blkif);
 void blkif_free(blkif_t *blkif);
diff -r f4ebae5f2274 -r ce1e6cb8e92d drivers/xen/blkback/xenbus.c
--- a/drivers/xen/blkback/xenbus.c      Fri Jul 13 13:45:30 2007 +0900
+++ b/drivers/xen/blkback/xenbus.c      Fri Jul 13 13:48:12 2007 +0900
@@ -26,16 +26,6 @@
 #define DPRINTK(fmt, args...)                          \
        pr_debug("blkback/xenbus (%s:%d) " fmt ".\n",   \
                 __FUNCTION__, __LINE__, ##args)
-
-struct backend_info
-{
-       struct xenbus_device *dev;
-       blkif_t *blkif;
-       struct xenbus_watch backend_watch;
-       unsigned major;
-       unsigned minor;
-       char *mode;
-};
 
 static void connect(struct backend_info *);
 static int connect_ring(struct backend_info *);


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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH][2/4][IOMGR] Add I/O request manager interface into blkback, Satoshi Uchida <=