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