On 09/03/2016 13:11, Olaf Hering wrote: > What is the purpose of the bdrv_check_request() call in bdrv_co_discard? > > It seems a frontend cant possibly know what the limit is in the > qemu-of-the-day, I found no interface to propagate > BDRV_REQUEST_MAX_SECTORS into the guest.
It depends on the backend. For example SCSI uses the block limits VPD page. It has a default max-unmap-size of 1 GiB, which happens to be smaller than BDRV_REQUEST_MAX_SECTORS too. It probably should range check max_unmap_size and max_io_size against BDRV_REQUEST_MAX_SECTORS, and reject anything bigger than that, though. Paolo > I think to handle nb_sectors > BDRV_REQUEST_MAX_SECTORS bdrv_co_discard > has to split the request into smaller chunks, just as it does a few > lines down in the function.