[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/6] ISCSI: redo how we set up the events
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 2/6] ISCSI: redo how we set up the events |
Date: |
Tue, 29 May 2012 11:20:08 +0200 |
From: Ronnie Sahlberg <address@hidden>
Call qemu_notify_event() after updating events. Otherwise, If we add
an event for -is-writeable but the socket is already writeable there
may be a delay before the event callback is actually triggered.
Those delays would in particular hurt performance during BIOS boot and
when the GRUB bootloader reads the kernel and initrd.
But first call out to the socket write functions directly, and only set up
the write event if the socket is full. This will happen very rarely and
this improves performance.
Signed-off-by: Ronnie Sahlberg <address@hidden>
---
block/iscsi.c | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/block/iscsi.c b/block/iscsi.c
index d37c4ee..db41bb7 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -39,6 +39,7 @@ typedef struct IscsiLun {
int lun;
int block_size;
unsigned long num_blocks;
+ int events;
} IscsiLun;
typedef struct IscsiAIOCB {
@@ -104,11 +105,27 @@ static void
iscsi_set_events(IscsiLun *iscsilun)
{
struct iscsi_context *iscsi = iscsilun->iscsi;
+ int ev;
- qemu_aio_set_fd_handler(iscsi_get_fd(iscsi), iscsi_process_read,
- (iscsi_which_events(iscsi) & POLLOUT)
- ? iscsi_process_write : NULL,
- iscsi_process_flush, iscsilun);
+ /* We always register a read handler. */
+ ev = POLLIN;
+ ev |= iscsi_which_events(iscsi);
+ if (ev != iscsilun->events) {
+ qemu_aio_set_fd_handler(iscsi_get_fd(iscsi),
+ iscsi_process_read,
+ (ev & POLLOUT) ? iscsi_process_write : NULL,
+ iscsi_process_flush,
+ iscsilun);
+
+ }
+
+ /* If we just added an event, the callback might be delayed
+ * unless we call qemu_notify_event().
+ */
+ if (ev & ~iscsilun->events) {
+ qemu_notify_event();
+ }
+ iscsilun->events = ev;
}
static void
--
1.7.10.1
- [Qemu-devel] [PULL 0/6] updated SCSI changes for 1.1.0-rc4, Paolo Bonzini, 2012/05/29
- [Qemu-devel] [PATCH 2/6] ISCSI: redo how we set up the events,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 1/6] scsi: declare vmstate_info_scsi_requests to be static, Paolo Bonzini, 2012/05/29
- [Qemu-devel] [PATCH 3/6] ISCSI: change num_blocks to 64-bit, Paolo Bonzini, 2012/05/29
- [Qemu-devel] [PATCH 4/6] ISCSI: get device type at connection time, Paolo Bonzini, 2012/05/29
- [Qemu-devel] [PATCH 5/6] ISCSI: Only call READCAPACITY16 for SBC devices, use READCAPACITY10 for MMC, Paolo Bonzini, 2012/05/29
- [Qemu-devel] [PATCH 6/6] ISCSI: Switch to using READ16/WRITE16 for I/O to the LUN, Paolo Bonzini, 2012/05/29
- Re: [Qemu-devel] [PULL 0/6] updated SCSI changes for 1.1.0-rc4, Anthony Liguori, 2012/05/29