[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 05/13] block: Switch to 64-bit bl.max_transfe
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH v2 05/13] block: Switch to 64-bit bl.max_transfer |
Date: |
Fri, 16 Nov 2018 17:32:17 +0100 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
Am 16.11.2018 um 16:54 hat Eric Blake geschrieben:
> On 11/16/18 9:32 AM, Kevin Wolf wrote:
> > Am 15.11.2018 um 17:28 hat Eric Blake geschrieben:
> > > On 11/15/18 9:45 AM, Kevin Wolf wrote:
> > > > Am 15.11.2018 um 03:03 hat Eric Blake geschrieben:
> > > > > This change has no semantic impact: all drivers either leave the
> > > > > value at 0 (no inherent 32-bit limit is still translated into
> > > > > fragmentation below 2G; see the previous patch for that audit), or
> > > > > set it to a value less than 2G. However, switching to a larger
> > > > > type and enforcing the 2G cap at the block layer makes it easier
> > > > > to audit specific drivers for their robustness to larger sizing,
> > > > > by letting them specify a value larger than INT_MAX if they have
> > > > > been audited to be 64-bit clean.
> > > > >
>
> > > > > +
> > > > > + /* Clamp max_transfer to 2G */
> > > > > + if (bs->bl.max_transfer > UINT32_MAX) {
> > > >
> > > > UINT32_MAX is 4G, not 2G.
> > > >
> > > > Would it make more sense to make BDRV_REQUEST_MAX_BYTES the maximum
> > > > anyway?
> > >
> > > D'oh. Yes, that's what I intended, possibly by spelling it INT_MAX (the
> > > fact that the 'if' goes away in patch 13 is not an excuse for sloppy
> > > coding
> > > in the meantime).
> >
> > INT_MAX is not a different spelling of BDRV_REQUEST_MAX_BYTES. The
> > latter is slightly lower (0x7ffffe00).
>
> Ah, but:
>
> > + if (bs->bl.max_transfer > UINT32_MAX) {
> > + bs->bl.max_transfer = QEMU_ALIGN_DOWN(BDRV_REQUEST_MAX_BYTES,
> > + MAX(bs->bl.opt_transfer,
> > +
> > bs->bl.request_alignment));
> > + }
>
> QEMU_ALIGN_DOWN() will change INT_MAX to BDRV_REQUEST_MAX_BYTES if
> bs->bl.request_alignment is 512 and opt_transfer is 0; and if either
> alignment number is larger than 512, max_transfer is capped even lower
> regardless of whether I was aligning INT_MAX or BDRV_REQUEST_MAX_BYTES down
> to an alignment boundary.
That's true. But why use INT_MAX and argue that it will be rounded to
the right value later when you can just use BDRV_REQUEST_MAX_BYTES,
which is obviously correct without additional correction?
Kevin
- [Qemu-devel] [PATCH v2 for-4.0 00/13] block: byte-based blocking read/write, Eric Blake, 2018/11/14
- [Qemu-devel] [PATCH v2 01/13] qcow2: Prefer byte-based calls into bs->file, Eric Blake, 2018/11/14
- [Qemu-devel] [PATCH v2 02/13] vdi: Switch to byte-based calls, Eric Blake, 2018/11/14
- [Qemu-devel] [PATCH v2 04/13] block: Removed unused sector-based blocking I/O, Eric Blake, 2018/11/14
- [Qemu-devel] [PATCH v2 03/13] vvfat: Switch to byte-based calls, Eric Blake, 2018/11/14
- [Qemu-devel] [PATCH v2 05/13] block: Switch to 64-bit bl.max_transfer, Eric Blake, 2018/11/14
[Qemu-devel] [PATCH v2 08/13] crypto: Audit for read/write 64-bit cleanness, Eric Blake, 2018/11/14
[Qemu-devel] [PATCH v2 07/13] blklogwrites: Audit for read/write 64-bit cleanness, Eric Blake, 2018/11/14
[Qemu-devel] [PATCH v2 06/13] blkdebug: Audit for read/write 64-bit cleanness, Eric Blake, 2018/11/14
[Qemu-devel] [PATCH v2 11/13] qcow2: Audit for read/write 64-bit cleanness, Eric Blake, 2018/11/14
[Qemu-devel] [PATCH v2 09/13] RFC: crypto: Rely on block layer for fragmentation, Eric Blake, 2018/11/14
[Qemu-devel] [PATCH v2 12/13] block: Document need for audit of read/write 64-bit cleanness, Eric Blake, 2018/11/14
[Qemu-devel] [PATCH v2 10/13] file-posix: Audit for read/write 64-bit cleanness, Eric Blake, 2018/11/14
[Qemu-devel] [PATCH v2 13/13] block: Enforce non-zero bl.max_transfer, Eric Blake, 2018/11/14