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 4 of 9] Support more than 2 FDs per tapdisk

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 4 of 9] Support more than 2 FDs per tapdisk
From: Brendan Cully <brendan@xxxxxxxxx>
Date: Wed, 13 May 2009 17:19:32 -0700
Cc: andy@xxxxxxxxx
Delivery-date: Wed, 13 May 2009 17:22:42 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1242260368@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
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/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1242260368@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1f0f01bc86a5
# HG changeset patch
# User Brendan Cully <brendan@xxxxxxxxx>
# Date 1240355510 25200
# Node ID 99c01882edb65e702875afc76319e92b88966402
# Parent  b51238ea926948383500b94cd227321eb40a82dd
Support more than 2 FDs per tapdisk.
The Remus disk replication module needs this to be able to poll the
backup server as well as the underlying disk module.

Signed-off-by: Brendan Cully <brendan@xxxxxxxxx>

diff --git a/tools/blktap/drivers/tapdisk.c b/tools/blktap/drivers/tapdisk.c
--- a/tools/blktap/drivers/tapdisk.c
+++ b/tools/blktap/drivers/tapdisk.c
@@ -132,16 +132,19 @@
 {
        fd_list_entry_t *ptr;
        struct disk_driver *dd;
+       int i;
 
        ptr = fd_start;
        while (ptr != NULL) {
                if (ptr->tap_fd) {
                        FD_SET(ptr->tap_fd, readfds);
                        td_for_each_disk(ptr->s, dd) {
-                               if (dd->io_fd[READ]) 
-                                       FD_SET(dd->io_fd[READ], readfds);
-                               maxfds = (dd->io_fd[READ] > maxfds ? 
-                                         dd->io_fd[READ] : maxfds);
+                               for (i = 0; i < MAX_IOFD; i++) {
+                                       if (dd->io_fd[i]) 
+                                               FD_SET(dd->io_fd[i], readfds);
+                                       maxfds = (dd->io_fd[i] > maxfds ? 
+                                                 dd->io_fd[i] : maxfds);
+                               }
                        }
                        maxfds = (ptr->tap_fd > maxfds ? ptr->tap_fd : maxfds);
                }
@@ -820,13 +823,15 @@
                                int progress_made = 0;
                                struct disk_driver *dd;
                                tapdev_info_t *info = ptr->s->ring_info;
+                               int i;
 
                                td_for_each_disk(ptr->s, dd) {
-                                       if (dd->io_fd[READ] &&
-                                           FD_ISSET(dd->io_fd[READ], 
-                                                    &readfds)) {
-                                               io_done(dd, READ);
-                                               progress_made = 1;
+                                       for (i = 0; i < MAX_IOFD; i++) {
+                                               if (dd->io_fd[i] &&
+                                                   FD_ISSET(dd->io_fd[i], 
&readfds)) {
+                                                       io_done(dd, i);
+                                                       progress_made = 1;
+                                               }
                                        }
                                }
 
diff --git a/tools/blktap/drivers/tapdisk.h b/tools/blktap/drivers/tapdisk.h
--- a/tools/blktap/drivers/tapdisk.h
+++ b/tools/blktap/drivers/tapdisk.h
@@ -74,7 +74,7 @@
 #define SECTOR_SHIFT             9
 #define DEFAULT_SECTOR_SIZE    512
 
-#define MAX_IOFD                 2
+#define MAX_IOFD                 4
 
 #define BLK_NOT_ALLOCATED       99
 #define TD_NO_PARENT             1

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