From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33145) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDXFP-0002br-Nr for qemu-devel@nongnu.org; Thu, 16 Jun 2016 09:22:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bDXFN-0005mV-RS for qemu-devel@nongnu.org; Thu, 16 Jun 2016 09:22:14 -0400 References: <1465939839-30097-1-git-send-email-eblake@redhat.com> <1465939839-30097-8-git-send-email-eblake@redhat.com> <20160616052502.GI12178@ad.usersys.redhat.com> From: Paolo Bonzini Message-ID: <93d6d9db-9850-f60a-9f3a-23724c27aee4@redhat.com> Date: Thu, 16 Jun 2016 15:22:00 +0200 MIME-Version: 1.0 In-Reply-To: <20160616052502.GI12178@ad.usersys.redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 07/17] block: Give nonzero result to blk_get_max_transfer_length() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng , Eric Blake Cc: qemu-devel@nongnu.org, kwolf@redhat.com, qemu-block@nongnu.org, "Michael S. Tsirkin" , Max Reitz , Stefan Hajnoczi On 16/06/2016 07:25, Fam Zheng wrote: >> > + assert(max_xfer_len); >> > + stl_be_p(&r->buf[8], max_xfer_len); >> > + /* Also take care of the opt xfer len. */ >> > + if (ldl_be_p(&r->buf[12]) > max_xfer_len) { >> > + stl_be_p(&r->buf[12], max_xfer_len); > Paolo: should we take s->blocksize into account? I missed it when I wro= te this > piece of code. Hmm, the maximum and optimal transfer length is in logical blocks, so yes= . There is one thing that isn't great: at least Linux reads the capacity before the block limits page, but we cannot know for sure that everyone does it. I think it's a good idea to send a READ CAPACITY(10) at startup, like we do in get_stream_blocksize. We only need it for the blocksize, not for the capacity, so it's not necessary to use READ CAPACITY(16). The snooping is still necessary for the max_lba (which is used by scsi_disk_dma_command), so we might as well keep the assignment to s->blocksize in there too. But let's add a best effort READ CAPACITY(10) at startup. Paolo