From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54285) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsC0e-0004W7-6H for qemu-devel@nongnu.org; Thu, 27 Jun 2013 09:13:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UsC0W-00043R-3B for qemu-devel@nongnu.org; Thu, 27 Jun 2013 09:13:12 -0400 Received: from mx.ipv6.kamp.de ([2a02:248:0:51::16]:45424 helo=mx01.kamp.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1UsC0V-000437-PQ for qemu-devel@nongnu.org; Thu, 27 Jun 2013 09:13:04 -0400 From: Peter Lieven Date: Thu, 27 Jun 2013 15:11:34 +0200 Message-Id: <1372338695-411-11-git-send-email-pl@kamp.de> In-Reply-To: <1372338695-411-1-git-send-email-pl@kamp.de> References: <1372338695-411-1-git-send-email-pl@kamp.de> Subject: [Qemu-devel] [PATCHv2 10/11] iscsi: ignore aio_discard if unsupported List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, pbonzini@redhat.com, Peter Lieven , ronniesahlberg@gmail.com, stefanha@redhat.com if the target does not support UNMAP or the request is too big silently ignore the discard request. Signed-off-by: Peter Lieven --- block/iscsi.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/block/iscsi.c b/block/iscsi.c index e9ecfce..0567b46 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -694,6 +694,14 @@ iscsi_aio_discard(BlockDriverState *bs, acb->sector_num = sector_num; acb->retries = ISCSI_CMD_RETRIES; + if (!iscsilun->lbpu || + sector_qemu2lun(nb_sectors, iscsilun) > iscsilun->max_unmap) { + /* silently ignore discard request */ + acb->status = 0; + iscsi_schedule_bh(acb); + return &acb->common; + } + if (iscsi_aio_discard_acb(acb) != 0) { qemu_aio_release(acb); return NULL; -- 1.7.9.5