From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33787) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zvi1c-00074A-66 for qemu-devel@nongnu.org; Mon, 09 Nov 2015 03:42:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zvi1b-0002Z0-9T for qemu-devel@nongnu.org; Mon, 09 Nov 2015 03:42:04 -0500 Sender: Paolo Bonzini References: <1447039178-17208-1-git-send-email-arei.gonglei@huawei.com> From: Paolo Bonzini Message-ID: <56405C50.1010600@redhat.com> Date: Mon, 9 Nov 2015 09:41:52 +0100 MIME-Version: 1.0 In-Reply-To: <1447039178-17208-1-git-send-email-arei.gonglei@huawei.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2] virtio-blk: trivial code optimization List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: arei.gonglei@huawei.com, qemu-devel@nongnu.org Cc: stefanha@redhat.com, qemu-block@nongnu.org On 09/11/2015 04:19, arei.gonglei@huawei.com wrote: > + * 1. requests are not sequential > + * 2. merge would exceed maximum number of IOVs > + * 3. merge would exceed maximum transfer length of backend device > + */ > + if (sector_num + nb_sectors != req->sector_num || > + niov > IOV_MAX - req->qiov.niov || > + req->qiov.size / BDRV_SECTOR_SIZE + nb_sectors > max_xfer_len) { Hi Gonglei, the third condition should also be changed to "new > max - old". Thanks, Paolo