From: Anthony PERARD Subject: Re: [PATCH v3] xen_disk: split discard input to match internal representation Date: Wed, 23 Nov 2016 15:50:47 +0000 Message-ID: <20161123155047.GB1847@perard.uk.xensource.com> References: <20161123103912.26699-1-olaf@aepfle.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Return-path: Content-Disposition: inline In-Reply-To: <20161123103912.26699-1-olaf@aepfle.de> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org Sender: "Qemu-devel" To: Olaf Hering Cc: Kevin Wolf , Stefano Stabellini , qemu-block@nongnu.org, "open list:All patches CC here" , Max Reitz , "open list:X86" List-Id: xen-devel@lists.xenproject.org On Wed, Nov 23, 2016 at 10:39:12AM +0000, Olaf Hering wrote: > The guest sends discard requests as u64 sector/count pairs, but the > block layer operates internally with s64/s32 pairs. The conversion > leads to IO errors in the guest, the discard request is not processed. > > domU.cfg: > 'vdev=xvda, format=qcow2, backendtype=qdisk, target=/x.qcow2' > domU: > mkfs.ext4 -F /dev/xvda > Discarding device blocks: failed - Input/output error > > Fix this by splitting the request into chunks of BDRV_REQUEST_MAX_SECTORS. > Add input range checking to avoid overflow. > > Fixes f313520 ("xen_disk: add discard support") > > Signed-off-by: Olaf Hering Acked-by: Anthony PERARD -- Anthony PERARD