qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, qemu-devel@nongnu.org
Subject: [PULL 15/18] block: Improve comments in BlockLimits
Date: Wed, 29 Oct 2025 13:06:31 +0100	[thread overview]
Message-ID: <20251029120634.288467-16-kwolf@redhat.com> (raw)
In-Reply-To: <20251029120634.288467-1-kwolf@redhat.com>

Patches to expose the limits in QAPI have made clear that the existing
documentation of BlockLimits could be improved: The meaning of
min_mem_alignment and opt_mem_alignment could be clearer, and talking
about better alignment values isn't helpful when we only detect these
values and never choose them.

Make the changes in the BlockLimits documentation now, so that the
patches exposing the fields in QAPI can use descriptions consistent with
it.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20251024123041.51254-2-kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 include/block/block_int-common.h | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/include/block/block_int-common.h b/include/block/block_int-common.h
index c55b35da8e..f2a4e863fc 100644
--- a/include/block/block_int-common.h
+++ b/include/block/block_int-common.h
@@ -817,10 +817,10 @@ typedef struct BlockLimits {
     int64_t max_pdiscard;
 
     /*
-     * Optimal alignment for discard requests in bytes. A power of 2
-     * is best but not mandatory.  Must be a multiple of
-     * bl.request_alignment, and must be less than max_pdiscard if
-     * that is set. May be 0 if bl.request_alignment is good enough
+     * Optimal alignment for discard requests in bytes. Note that this doesn't
+     * have to be a power of two. Must be a multiple of bl.request_alignment,
+     * and must be less than max_pdiscard if that is set. May be 0 if
+     * bl.request_alignment is good enough.
      */
     uint32_t pdiscard_alignment;
 
@@ -831,11 +831,10 @@ typedef struct BlockLimits {
     int64_t max_pwrite_zeroes;
 
     /*
-     * Optimal alignment for write zeroes requests in bytes. A power
-     * of 2 is best but not mandatory.  Must be a multiple of
-     * bl.request_alignment, and must be less than max_pwrite_zeroes
-     * if that is set. May be 0 if bl.request_alignment is good
-     * enough
+     * Optimal alignment for write zeroes requests in bytes. Note that this
+     * doesn't have to be a power of two. Must be a multiple of
+     * bl.request_alignment, and must be less than max_pwrite_zeroes if that is
+     * set. May be 0 if bl.request_alignment is good enough.
      */
     uint32_t pwrite_zeroes_alignment;
 
@@ -863,18 +862,23 @@ typedef struct BlockLimits {
     uint64_t max_hw_transfer;
 
     /*
-     * Maximal number of scatter/gather elements allowed by the hardware.
+     * Maximum number of scatter/gather elements allowed by the hardware.
      * Applies whenever transfers to the device bypass the kernel I/O
      * scheduler, for example with SG_IO.  If larger than max_iov
      * or if zero, blk_get_max_hw_iov will fall back to max_iov.
      */
     int max_hw_iov;
 
-
-    /* memory alignment, in bytes so that no bounce buffer is needed */
+    /*
+     * Minimal required memory alignment in bytes for zero-copy I/O to succeed.
+     * For unaligned requests, a bounce buffer will be used.
+     */
     size_t min_mem_alignment;
 
-    /* memory alignment, in bytes, for bounce buffer */
+    /*
+     * Optimal memory alignment in bytes. This is the alignment used for any
+     * buffer allocations QEMU performs internally.
+     */
     size_t opt_mem_alignment;
 
     /* maximum number of iovec elements */
-- 
2.51.0



  parent reply	other threads:[~2025-10-29 12:11 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-29 12:06 [PULL 00/18] Block layer patches Kevin Wolf
2025-10-29 12:06 ` [PULL 01/18] tests/qemu-iotests: Mark the 'inactive-node-nbd' as unsupported with -luks Kevin Wolf
2025-10-29 12:06 ` [PULL 02/18] block: remove 'detached-header' option from opts after use Kevin Wolf
2025-10-29 12:06 ` [PULL 03/18] block: fix luks 'amend' when run in coroutine Kevin Wolf
2025-10-31 10:18   ` Michael Tokarev
2025-10-31 11:05     ` Daniel P. Berrangé
2025-10-29 12:06 ` [PULL 04/18] block/monitor: Use hmp_handle_error to report error Kevin Wolf
2025-10-29 12:06 ` [PULL 05/18] block/curl.c: Fix CURLOPT_VERBOSE parameter type Kevin Wolf
2025-10-29 12:06 ` [PULL 06/18] iotests: Adjust nbd expected outputs to match current behavior Kevin Wolf
2025-10-29 12:06 ` [PULL 07/18] iotests: Adjust fuse-allow-other expected output Kevin Wolf
2025-10-29 12:06 ` [PULL 08/18] block: enable stats-intervals for storage devices Kevin Wolf
2025-10-29 12:06 ` [PULL 09/18] MAINTAINERS: Mark VHDX block driver as "Odd Fixes" Kevin Wolf
2025-10-29 12:06 ` [PULL 10/18] include/block/block_int-common: document when resize callback is used Kevin Wolf
2025-10-29 12:06 ` [PULL 11/18] block: make bdrv_co_parent_cb_resize() a proper IO API function Kevin Wolf
2025-10-29 12:06 ` [PULL 12/18] block: implement 'resize' callback for child_of_bds class Kevin Wolf
2025-10-29 12:06 ` [PULL 13/18] iotests: add test for resizing a node below filters Kevin Wolf
2025-10-29 12:06 ` [PULL 14/18] iotests: add test for resizing a 'file' node below a 'raw' node Kevin Wolf
2025-10-29 12:06 ` Kevin Wolf [this message]
2025-10-29 12:06 ` [PULL 16/18] block: Expose block limits for images in QMP Kevin Wolf
2025-10-29 12:06 ` [PULL 17/18] qemu-img info: Optionally show block limits Kevin Wolf
2025-10-29 12:06 ` [PULL 18/18] qemu-img info: Add cache mode option Kevin Wolf
2025-10-31  9:25 ` [PULL 00/18] Block layer patches Richard Henderson

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=20251029120634.288467-16-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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).