mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
block: Move request_alignment into BlockLimit
It makes more sense to have ALL block size limit constraints in the same struct. Improve the documentation while at it. Simplify a couple of conditionals, now that we have audited and documented that request_alignment is always non-zero. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
d9e0dfa246
commit
a5b8dd2ce8
12 changed files with 39 additions and 35 deletions
|
@ -324,6 +324,12 @@ struct BlockDriver {
|
|||
};
|
||||
|
||||
typedef struct BlockLimits {
|
||||
/* Alignment requirement, in bytes, for offset/length of I/O
|
||||
* requests. Must be a power of 2 less than INT_MAX; defaults to
|
||||
* 1 for drivers with modern byte interfaces, and to 512
|
||||
* otherwise. */
|
||||
uint32_t request_alignment;
|
||||
|
||||
/* maximum number of bytes that can be discarded at once (since it
|
||||
* is signed, it must be < 2G, if set), should be multiple of
|
||||
* pdiscard_alignment, but need not be power of 2. May be 0 if no
|
||||
|
@ -332,8 +338,8 @@ typedef struct BlockLimits {
|
|||
|
||||
/* optimal alignment for discard requests in bytes, must be power
|
||||
* of 2, less than max_pdiscard if that is set, and multiple of
|
||||
* bs->request_alignment. May be 0 if bs->request_alignment is
|
||||
* good enough */
|
||||
* bl.request_alignment. May be 0 if bl.request_alignment is good
|
||||
* enough */
|
||||
uint32_t pdiscard_alignment;
|
||||
|
||||
/* maximum number of bytes that can zeroized at once (since it is
|
||||
|
@ -343,12 +349,12 @@ typedef struct BlockLimits {
|
|||
|
||||
/* optimal alignment for write zeroes requests in bytes, must be
|
||||
* power of 2, less than max_pwrite_zeroes if that is set, and
|
||||
* multiple of bs->request_alignment. May be 0 if
|
||||
* bs->request_alignment is good enough */
|
||||
* multiple of bl.request_alignment. May be 0 if
|
||||
* bl.request_alignment is good enough */
|
||||
uint32_t pwrite_zeroes_alignment;
|
||||
|
||||
/* optimal transfer length in bytes (must be power of 2, and
|
||||
* multiple of bs->request_alignment), or 0 if no preferred size */
|
||||
* multiple of bl.request_alignment), or 0 if no preferred size */
|
||||
uint32_t opt_transfer;
|
||||
|
||||
/* maximal transfer length in bytes (need not be power of 2, but
|
||||
|
@ -356,10 +362,10 @@ typedef struct BlockLimits {
|
|||
* For now, anything larger than INT_MAX is clamped down. */
|
||||
uint32_t max_transfer;
|
||||
|
||||
/* memory alignment so that no bounce buffer is needed */
|
||||
/* memory alignment, in bytes so that no bounce buffer is needed */
|
||||
size_t min_mem_alignment;
|
||||
|
||||
/* memory alignment for bounce buffer */
|
||||
/* memory alignment, in bytes, for bounce buffer */
|
||||
size_t opt_mem_alignment;
|
||||
|
||||
/* maximum number of iovec elements */
|
||||
|
@ -465,8 +471,6 @@ struct BlockDriverState {
|
|||
/* I/O Limits */
|
||||
BlockLimits bl;
|
||||
|
||||
/* Alignment requirement for offset/length of I/O requests */
|
||||
unsigned int request_alignment;
|
||||
/* Flags honored during pwrite (so far: BDRV_REQ_FUA) */
|
||||
unsigned int supported_write_flags;
|
||||
/* Flags honored during pwrite_zeroes (so far: BDRV_REQ_FUA,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue