On 21/02/2017 03:42, Eric Blake wrote:
> +    /* Send NBD_INFO_BLOCK_SIZE always, but tweak the minimum size
> +     * according to whether the client requested it, and according to
> +     * whether this is OPT_INFO or OPT_GO. */
> +    /* minimum - 1 for back-compat, or 512 if client is new enough.
> +     * TODO: consult blk_bs(blk)->request_align? */
> +    sizes[0] = (opt == NBD_OPT_INFO || blocksize) ? BDRV_SECTOR_SIZE : 1;
> +    /* preferred - At least 4096, but larger as appropriate. */
> +    sizes[1] = MAX(blk_get_opt_transfer(exp->blk), 4096);

Can we just say zero if the preferred transfer size is unknown?

Apart from this, it looks good.

Paolo

> +    /* maximum - At most 32M, but smaller as appropriate. */
> +    sizes[2] = MIN(blk_get_max_transfer(exp->blk), NBD_MAX_BUFFER_SIZE);
> +    TRACE("advertising minimum 0x%" PRIx32 ", preferred 0x%" PRIx32
> +          ", maximum 0x%" PRIx32, sizes[0], sizes[1], sizes[2]);

Reply via email to