[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 04/32] block: Clarify that @bytes is no limit on *pnum
From: |
Hanna Reitz |
Subject: |
[PULL 04/32] block: Clarify that @bytes is no limit on *pnum |
Date: |
Wed, 15 Sep 2021 19:52:50 +0200 |
.bdrv_co_block_status() implementations are free to return a *pnum that
exceeds @bytes, because bdrv_co_block_status() in block/io.c will clamp
*pnum as necessary.
On the other hand, if drivers' implementations return values for *pnum
that are as large as possible, our recently introduced block-status
cache will become more effective.
So, make a note in block_int.h that @bytes is no upper limit for *pnum.
Suggested-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20210812084148.14458-4-hreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
include/block/block_int.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 437d746733..5451f89b8d 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -348,6 +348,15 @@ struct BlockDriver {
* clamped to bdrv_getlength() and aligned to request_alignment,
* as well as non-NULL pnum, map, and file; in turn, the driver
* must return an error or set pnum to an aligned non-zero value.
+ *
+ * Note that @bytes is just a hint on how big of a region the
+ * caller wants to inspect. It is not a limit on *pnum.
+ * Implementations are free to return larger values of *pnum if
+ * doing so does not incur a performance penalty.
+ *
+ * block/io.c's bdrv_co_block_status() will utilize an unclamped
+ * *pnum value for the block-status cache on protocol nodes, prior
+ * to clamping *pnum for return to its caller.
*/
int coroutine_fn (*bdrv_co_block_status)(BlockDriverState *bs,
bool want_zero, int64_t offset, int64_t bytes, int64_t *pnum,
--
2.31.1
- [PULL 00/32] Block patches, Hanna Reitz, 2021/09/15
- [PULL 02/32] block: Drop BDS comment regarding bdrv_append(), Hanna Reitz, 2021/09/15
- [PULL 01/32] gluster: Align block-status tail, Hanna Reitz, 2021/09/15
- [PULL 04/32] block: Clarify that @bytes is no limit on *pnum,
Hanna Reitz <=
- [PULL 05/32] block/file-posix: Do not force-cap *pnum, Hanna Reitz, 2021/09/15
- [PULL 03/32] block: block-status cache for data regions, Hanna Reitz, 2021/09/15
- [PULL 06/32] block/gluster: Do not force-cap *pnum, Hanna Reitz, 2021/09/15
- [PULL 07/32] block/iscsi: Do not force-cap *pnum, Hanna Reitz, 2021/09/15
- [PULL 09/32] iotests: Fix use-{list,dict}-literal warnings, Hanna Reitz, 2021/09/15
- [PULL 13/32] mirror-top-perms: Fix AbnormalShutdown path, Hanna Reitz, 2021/09/15
- [PULL 08/32] iotests: Fix unspecified-encoding pylint warnings, Hanna Reitz, 2021/09/15
- [PULL 15/32] block/mirror: fix NULL pointer dereference in mirror_wait_on_conflicts(), Hanna Reitz, 2021/09/15
- [PULL 10/32] iotests/297: Drop 169 and 199 from the skip list, Hanna Reitz, 2021/09/15
- [PULL 14/32] iotests/297: Cover tests/, Hanna Reitz, 2021/09/15