aboutsummaryrefslogtreecommitdiff
path: root/block/raw-posix.c
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2016-06-23 16:37:24 -0600
committerKevin Wolf <kwolf@redhat.com>2016-07-05 16:46:26 +0200
commita5b8dd2ce83208cd7d6eb4562339ecf5aae13574 (patch)
treeeea17f09c6a183d2526f90798c6f6097db506195 /block/raw-posix.c
parentd9e0dfa2462e32cc5c6c49401ad7bff36453f75c (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 'block/raw-posix.c')
-rw-r--r--block/raw-posix.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/block/raw-posix.c b/block/raw-posix.c
index 8da2f94ec4..d3d7cce807 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -302,22 +302,22 @@ static void raw_probe_alignment(BlockDriverState *bs, int fd, Error **errp)
/* For SCSI generic devices the alignment is not really used.
With buffered I/O, we don't have any restrictions. */
if (bdrv_is_sg(bs) || !s->needs_alignment) {
- bs->request_alignment = 1;
+ bs->bl.request_alignment = 1;
s->buf_align = 1;
return;
}
- bs->request_alignment = 0;
+ bs->bl.request_alignment = 0;
s->buf_align = 0;
/* Let's try to use the logical blocksize for the alignment. */
- if (probe_logical_blocksize(fd, &bs->request_alignment) < 0) {
- bs->request_alignment = 0;
+ if (probe_logical_blocksize(fd, &bs->bl.request_alignment) < 0) {
+ bs->bl.request_alignment = 0;
}
#ifdef CONFIG_XFS
if (s->is_xfs) {
struct dioattr da;
if (xfsctl(NULL, fd, XFS_IOC_DIOINFO, &da) >= 0) {
- bs->request_alignment = da.d_miniosz;
+ bs->bl.request_alignment = da.d_miniosz;
/* The kernel returns wrong information for d_mem */
/* s->buf_align = da.d_mem; */
}
@@ -337,19 +337,19 @@ static void raw_probe_alignment(BlockDriverState *bs, int fd, Error **errp)
qemu_vfree(buf);
}
- if (!bs->request_alignment) {
+ if (!bs->bl.request_alignment) {
size_t align;
buf = qemu_memalign(s->buf_align, max_align);
for (align = 512; align <= max_align; align <<= 1) {
if (raw_is_io_aligned(fd, buf, align)) {
- bs->request_alignment = align;
+ bs->bl.request_alignment = align;
break;
}
}
qemu_vfree(buf);
}
- if (!s->buf_align || !bs->request_alignment) {
+ if (!s->buf_align || !bs->bl.request_alignment) {
error_setg(errp, "Could not find working O_DIRECT alignment. "
"Try cache.direct=off.");
}