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-changelog

[Xen-changelog] bug fixes to tap and parallax.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] bug fixes to tap and parallax.
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Sat, 04 Jun 2005 14:00:22 +0000
Delivery-date: Sun, 05 Jun 2005 11:00:52 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
ChangeSet 1.1665.1.6, 2005/06/04 15:00:22+01:00, akw27@xxxxxxxxxxxxxxxxxxxxxx

        bug fixes to tap and parallax.
        
        Signed-off-by: andrew.warfield@xxxxxxxxxxxx



 linux-2.6.11-xen-sparse/drivers/xen/blktap/blktap_controlmsg.c |    1 
 linux-2.6.11-xen-sparse/drivers/xen/blktap/blktap_datapath.c   |   18 +-
 tools/blktap/blktaplib.c                                       |   30 ++--
 tools/blktap/parallax.c                                        |   61 
++++++++--
 tools/blktap/radix.c                                           |    1 
 tools/blktap/vdi.c                                             |    9 +
 tools/blktap/vdi.h                                             |    3 
 7 files changed, 83 insertions(+), 40 deletions(-)


diff -Nru a/linux-2.6.11-xen-sparse/drivers/xen/blktap/blktap_controlmsg.c 
b/linux-2.6.11-xen-sparse/drivers/xen/blktap/blktap_controlmsg.c
--- a/linux-2.6.11-xen-sparse/drivers/xen/blktap/blktap_controlmsg.c    
2005-06-05 07:01:35 -04:00
+++ b/linux-2.6.11-xen-sparse/drivers/xen/blktap/blktap_controlmsg.c    
2005-06-05 07:01:35 -04:00
@@ -443,6 +443,7 @@
              (blktap_mode & BLKTAP_MODE_COPY_FE) ) {
             
             blktap_write_ctrl_ring(msg);
+            blktap_kick_user();
         }
         
         switch ( msg->subtype )
diff -Nru a/linux-2.6.11-xen-sparse/drivers/xen/blktap/blktap_datapath.c 
b/linux-2.6.11-xen-sparse/drivers/xen/blktap/blktap_datapath.c
--- a/linux-2.6.11-xen-sparse/drivers/xen/blktap/blktap_datapath.c      
2005-06-05 07:01:35 -04:00
+++ b/linux-2.6.11-xen-sparse/drivers/xen/blktap/blktap_datapath.c      
2005-06-05 07:01:35 -04:00
@@ -82,6 +82,8 @@
 
 /*-----[ Ring helpers ]---------------------------------------------------*/
 
+static void maybe_trigger_blktap_schedule(void);
+
 inline int write_resp_to_fe_ring(blkif_t *blkif, blkif_response_t *rsp)
 {
     blkif_response_t *resp_d;
@@ -125,6 +127,9 @@
     RING_PUSH_RESPONSES(&blkif->blk_ring);
     notify_via_evtchn(blkif->evtchn);
     DPRINTK("notified FE(dom %u)\n", blkif->domid);
+
+    /* We just feed up a batch of request slots... */
+    maybe_trigger_blktap_schedule();
     
 }
 
@@ -219,15 +224,10 @@
                 add_to_blkdev_list_tail(blkif);
             blkif_put(blkif);
         }
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-        /* Push the batch through to disc. */
-        run_task_queue(&tq_disk);
-#endif
     }
 }
 
-static void maybe_trigger_blkio_schedule(void)
+static void maybe_trigger_blktap_schedule(void)
 {
     /*
      * Needed so that two processes, who together make the following predicate
@@ -236,7 +236,7 @@
      */
     smp_mb();
 
-    if ( (NR_ACTIVE_REQS < (MAX_ACTIVE_REQS)) && /* XXX!!! was M_A_R/2*/
+    if ( (NR_ACTIVE_REQS < (MAX_ACTIVE_REQS/2)) &&
          !list_empty(&blkio_schedule_list) ) 
         wake_up(&blkio_schedule_wait);
 }
@@ -262,7 +262,7 @@
     blkif_t *blkif = dev_id;
 
     add_to_blkdev_list_tail(blkif);
-    maybe_trigger_blkio_schedule();
+    maybe_trigger_blktap_schedule();
     return IRQ_HANDLED;
 }
 
@@ -280,8 +280,6 @@
     int more_to_do = 0;
     int notify_be = 0, notify_user = 0;
     
-    DPRINTK("PT got FE interrupt.\n");
-
     if (NR_ACTIVE_REQS == MAX_ACTIVE_REQS) return 1;
     
     /* lock both rings */
diff -Nru a/tools/blktap/blktaplib.c b/tools/blktap/blktaplib.c
--- a/tools/blktap/blktaplib.c  2005-06-05 07:01:35 -04:00
+++ b/tools/blktap/blktaplib.c  2005-06-05 07:01:35 -04:00
@@ -34,7 +34,7 @@
 #else
 #define DPRINTF(_f, _a...) ((void)0)
 #endif
-#define DEBUG_RING_IDXS 1
+#define DEBUG_RING_IDXS 0
 
 #define POLLRDNORM     0x040 
 
@@ -171,27 +171,27 @@
     response_hook_t *rsp_hook;
     ctrl_hook_t     *ctrl_hook;
     
-    printf("Control Hooks:\n");
+    DPRINTF("Control Hooks:\n");
     ctrl_hook = ctrl_hook_chain;
     while (ctrl_hook != NULL)
     {
-        printf("  [0x%p] %s\n", ctrl_hook->func, ctrl_hook->name);
+        DPRINTF("  [0x%p] %s\n", ctrl_hook->func, ctrl_hook->name);
         ctrl_hook = ctrl_hook->next;
     }
     
-    printf("Request Hooks:\n");
+    DPRINTF("Request Hooks:\n");
     req_hook = request_hook_chain;
     while (req_hook != NULL)
     {
-        printf("  [0x%p] %s\n", req_hook->func, req_hook->name);
+        DPRINTF("  [0x%p] %s\n", req_hook->func, req_hook->name);
         req_hook = req_hook->next;
     }
     
-    printf("Response Hooks:\n");
+    DPRINTF("Response Hooks:\n");
     rsp_hook = response_hook_chain;
     while (rsp_hook != NULL)
     {
-        printf("  [0x%p] %s\n", rsp_hook->func, rsp_hook->name);
+        DPRINTF("  [0x%p] %s\n", rsp_hook->func, rsp_hook->name);
         rsp_hook = rsp_hook->next;
     }
 }
@@ -300,7 +300,7 @@
     ph->events      = events;
     ph->active      = 1;
     
-    printf("Added fd %d at ph index %d, now %d phs.\n", fd, ph_cons-1, 
+    DPRINTF("Added fd %d at ph index %d, now %d phs.\n", fd, ph_cons-1, 
             nr_pollhooks());
     
     return 0;
@@ -318,7 +318,7 @@
             break;
         }
         
-    printf("Removed fd %d at ph index %d, now %d phs.\n", fd, i, 
+    DPRINTF("Removed fd %d at ph index %d, now %d phs.\n", fd, i, 
             nr_pollhooks());
 }
 
@@ -337,7 +337,6 @@
 
 void __attribute__ ((constructor)) blktaplib_init(void)
 {
-    printf("[[ C O N S T R U C T O R ]]\n");
     pollhook_init();
 }
 
@@ -385,7 +384,7 @@
 
     /* assign the rings to the mapped memory */
     csring = (ctrl_sring_t *)blktap_mem;
-    BACK_RING_INIT(&ctrl_ring, csring, CONTROL_RING_MEM);
+    BACK_RING_INIT(&ctrl_ring, csring, PAGE_SIZE);
     
     sring = (blkif_sring_t *)((unsigned long)blktap_mem + PAGE_SIZE);
     FRONT_RING_INIT(&be_ring, sring, PAGE_SIZE);
@@ -393,10 +392,7 @@
     sring = (blkif_sring_t *)((unsigned long)blktap_mem + (2 *PAGE_SIZE));
     BACK_RING_INIT(&fe_ring, sring, PAGE_SIZE);
 
-    mmap_vstart = (unsigned long)blktap_mem + (BLKTAP_RING_PAGES << 
PAGE_SHIFT);
-    
-    printf("fe_ring mapped at: %p\n", fe_ring.sring);
-    printf("be_ring mapped at: %p\n", be_ring.sring);
+    mmap_vstart = (unsigned long)blktap_mem +(BLKTAP_RING_PAGES << PAGE_SHIFT);
 
     ioctl(fd, BLKTAP_IOCTL_SETMODE, BLKTAP_MODE_INTERPOSE );
 
@@ -560,7 +556,9 @@
 }
 
 void got_sig_int() {
-    printf("quitting -- returning to passthrough mode.\n");
+    DPRINTF("quitting -- returning to passthrough mode.\n");
     if (fd > 0) ioctl(fd, BLKTAP_IOCTL_SETMODE, BLKTAP_MODE_PASSTHROUGH );
+    close(fd);
+    fd = 0;
     exit(0);
 } 
diff -Nru a/tools/blktap/parallax.c b/tools/blktap/parallax.c
--- a/tools/blktap/parallax.c   2005-06-05 07:01:35 -04:00
+++ b/tools/blktap/parallax.c   2005-06-05 07:01:35 -04:00
@@ -88,17 +88,14 @@
     blkif->domid  = domid;
     blkif->handle = handle;
     blkif->status = DISCONNECTED;
-/*
-    spin_lock_init(&blkif->vbd_lock);
-    spin_lock_init(&blkif->blk_ring_lock);
-    atomic_set(&blkif->refcnt, 0);
-*/
+
     pblkif = &blkif_hash[BLKIF_HASH(domid, handle)];
     while ( *pblkif != NULL )
     {
         if ( ((*pblkif)->domid == domid) && ((*pblkif)->handle == handle) )
         {
-            DPRINTF("Could not create blkif: already exists\n");
+            DPRINTF("Could not create blkif: already exists (%d,%d)\n",
+                domid, handle);
             create->status = BLKIF_BE_STATUS_INTERFACE_EXISTS;
             free(blkif);
             return;
@@ -142,7 +139,6 @@
 
  destroy:
     *pblkif = blkif->hash_next;
-    /* destroy_all_vbds(blkif); */
     free(blkif);
     destroy->status = BLKIF_BE_STATUS_OKAY;
 }
@@ -184,10 +180,38 @@
         vdip = &(*vdip)->next;
     *vdip = vdi;
     
-    DPRINTF("vbd_grow: happy return!\n"); 
+    DPRINTF("blkif_create succeeded\n"); 
     create->status = BLKIF_BE_STATUS_OKAY;
 }
 
+void vbd_destroy(blkif_be_vbd_destroy_t *destroy)
+{
+    blkif_t            *blkif;
+    vdi_t              *vdi, **vdip;
+    blkif_vdev_t        vdevice = destroy->vdevice;
+    
+    blkif = blkif_find_by_handle(destroy->domid, destroy->blkif_handle);
+    if ( blkif == NULL )
+    {
+        DPRINTF("vbd_destroy attempted for non-existent blkif (%u,%u)\n", 
+                destroy->domid, destroy->blkif_handle); 
+        destroy->status = BLKIF_BE_STATUS_INTERFACE_NOT_FOUND;
+        return;
+    }
+
+    vdip = &blkif->vdi_hash[VDI_HASH(vdevice)];
+    while ((*vdip != NULL) && ((*vdip)->vdevice != vdevice))
+        vdip = &(*vdip)->next;
+
+    if (*vdip != NULL) 
+    {
+        vdi = *vdip;
+        *vdip = vdi->next;
+        vdi_put(vdi);
+    }
+        
+}
+

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] bug fixes to tap and parallax., BitKeeper Bot <=