diff options
author | Eric Blake <eblake@redhat.com> | 2016-06-23 16:37:24 -0600 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2016-07-05 16:46:26 +0200 |
commit | a5b8dd2ce83208cd7d6eb4562339ecf5aae13574 (patch) | |
tree | eea17f09c6a183d2526f90798c6f6097db506195 /include | |
parent | d9e0dfa2462e32cc5c6c49401ad7bff36453f75c (diff) |
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>
Diffstat (limited to 'include')
-rw-r--r-- | include/block/block_int.h | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/include/block/block_int.h b/include/block/block_int.h index a3e69fd93a..8f061ebf79 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -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, |