qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
	qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, edgar.kaziakhmedov@virtuozzo.com,
	Paolo Bonzini <pbonzini@redhat.com>,
	Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 3/4] nbd/client: Support requests of additional block sizing info
Date: Wed, 23 May 2018 10:40:55 -0500	[thread overview]
Message-ID: <27e395fd-51e6-1b40-cfa2-c59ae8d3aea1@redhat.com> (raw)
In-Reply-To: <0df1a90d-bcca-ac1e-0f17-b982faefc253@virtuozzo.com>

On 05/22/2018 10:33 AM, Vladimir Sementsov-Ogievskiy wrote:
> 02.05.2018 00:13, Eric Blake wrote:
>> The NBD spec is clarifying [1] that a server may want to advertise
>> different limits for READ/WRITE (in our case, 32M) than for
>> TRIM/ZERO (in our case, nearly 4G).  Implement the client
>> side support for these alternate limits, by always requesting
>> the new information (a compliant server must ignore the
>> request if it is unknown), and by validating anything reported
>> by the server before populating the block layer limits.

I still need to do a v2 of this series based on feedback from the NBD 
list, but answering your question in the meantime:


>>       bs->bl.request_alignment = min ? min : BDRV_SECTOR_SIZE;
>> -    bs->bl.max_pdiscard = max;
>> -    bs->bl.max_pwrite_zeroes = max;
>> +    if (s->info.max_trim) {
>> +        bs->bl.max_pdiscard = MIN(s->info.max_trim, 
>> BDRV_REQUEST_MAX_BYTES);
>> +    } else {
>> +        bs->bl.max_pdiscard = max;
>> +    }
>> +    bs->bl.pdiscard_alignment = s->info.min_trim;
>> +    if (s->info.max_zero) {
>> +        bs->bl.max_pwrite_zeroes = MIN(s->info.max_zero,
>> +                                       BDRV_REQUEST_MAX_BYTES);
>> +    } else {
>> +        bs->bl.max_pwrite_zeroes = max;
>> +    }
>> +    bs->bl.pwrite_zeroes_alignment = s->info.min_zero;
>>       bs->bl.max_transfer = max;
> 
> Should not max_transfer be updated too? Looks like it limits all 
> requests, is it right?

max_transfer affects read and write requests, but not write_zero 
requests (where max_pwrite_zeroes is used instead) or trim requests 
(where max_pdiscard is used instead).  Which is precisely the semantics 
we want - the NBD extension is mirroring the fact that qemu already has 
a way to track independent limits for trim/zero that can be larger than 
the normal limits for read/write, because trim/zero do not involve a 
transfer of a large data buffer.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

  reply	other threads:[~2018-05-23 15:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-01 21:13 [Qemu-devel] [PATCH 0/4] Support larger NBD_CMD_WRITE_ZEROES Eric Blake
2018-05-01 21:13 ` [Qemu-devel] [PATCH 1/4] nbd: Prepare for additional block sizing info Eric Blake
2018-05-03  8:20   ` Vladimir Sementsov-Ogievskiy
2018-05-01 21:13 ` [Qemu-devel] [PATCH 2/4] nbd/client: Refactor in preparation for more limits Eric Blake
2018-05-03  8:29   ` Vladimir Sementsov-Ogievskiy
2018-05-01 21:13 ` [Qemu-devel] [PATCH 3/4] nbd/client: Support requests of additional block sizing info Eric Blake
2018-05-03  9:17   ` Vladimir Sementsov-Ogievskiy
2018-05-03 14:49     ` Eric Blake
2018-05-03 15:51       ` Vladimir Sementsov-Ogievskiy
2018-05-22 15:33   ` Vladimir Sementsov-Ogievskiy
2018-05-23 15:40     ` Eric Blake [this message]
2018-05-01 21:13 ` [Qemu-devel] [PATCH 4/4] nbd/server: " Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=27e395fd-51e6-1b40-cfa2-c59ae8d3aea1@redhat.com \
    --to=eblake@redhat.com \
    --cc=edgar.kaziakhmedov@virtuozzo.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).