From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35522) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFsgV-0005TY-LH for qemu-devel@nongnu.org; Wed, 22 Jun 2016 20:39:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFsgT-0005VT-O6 for qemu-devel@nongnu.org; Wed, 22 Jun 2016 20:39:54 -0400 Date: Thu, 23 Jun 2016 08:39:42 +0800 From: Fam Zheng Message-ID: <20160623003942.GB17307@ad.usersys.redhat.com> References: <1466625064-11280-1-git-send-email-jsnow@redhat.com> <1466625064-11280-3-git-send-email-jsnow@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1466625064-11280-3-git-send-email-jsnow@redhat.com> Subject: Re: [Qemu-devel] [PATCH 2/3] mirror: limit niov to IOV_MAX elements, again List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow Cc: qemu-block@nongnu.org, kwolf@redhat.com, jcody@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com On Wed, 06/22 15:51, John Snow wrote: > During the refactor of mirror_iteration in e5b43573, > we regressed the fix introduced in cae98cb8. > > This patch re-adds IOV_MAX checking to cases where we > aren't checking alignment (and size) already. > > Signed-off-by: John Snow > --- > block/mirror.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/block/mirror.c b/block/mirror.c > index 2ba9642..377339d 100644 > --- a/block/mirror.c > +++ b/block/mirror.c > @@ -231,11 +231,14 @@ static int mirror_do_read(MirrorBlockJob *s, int64_t sector_num, > int sectors_per_chunk, nb_chunks; > int ret; > MirrorOp *op; > + int max_sectors; > > sectors_per_chunk = s->granularity >> BDRV_SECTOR_BITS; > + max_sectors = sectors_per_chunk * s->max_iov; > > /* We can only handle as much as buf_size at a time. */ > nb_sectors = MIN(s->buf_size >> BDRV_SECTOR_BITS, nb_sectors); > + nb_sectors = MIN(max_sectors, nb_sectors); > assert(nb_sectors); > ret = nb_sectors; > > -- > 2.4.11 > Reviewed-by: Fam Zheng