|
|
b38b0f |
From f551451a4b9975121424cb0837df67d31d2528dc Mon Sep 17 00:00:00 2001
|
|
|
b38b0f |
From: Max Reitz <mreitz@redhat.com>
|
|
|
b38b0f |
Date: Tue, 23 Jul 2019 14:45:45 +0100
|
|
|
b38b0f |
Subject: [PATCH 07/14] block: Add bdrv_get_request_alignment()
|
|
|
b38b0f |
|
|
|
b38b0f |
RH-Author: Max Reitz <mreitz@redhat.com>
|
|
|
b38b0f |
Message-id: <20190723144546.23701-7-mreitz@redhat.com>
|
|
|
b38b0f |
Patchwork-id: 89653
|
|
|
b38b0f |
O-Subject: [RHEL-8.1.0 qemu-kvm PATCH 6/7] block: Add bdrv_get_request_alignment()
|
|
|
b38b0f |
Bugzilla: 1678979
|
|
|
b38b0f |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
b38b0f |
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
|
|
b38b0f |
RH-Acked-by: John Snow <jsnow@redhat.com>
|
|
|
b38b0f |
|
|
|
b38b0f |
From: Eric Blake <eblake@redhat.com>
|
|
|
b38b0f |
|
|
|
b38b0f |
The next patch needs access to a device's minimum permitted
|
|
|
b38b0f |
alignment, since NBD wants to advertise this to clients. Add
|
|
|
b38b0f |
an accessor function, borrowing from blk_get_max_transfer()
|
|
|
b38b0f |
for accessing a backend's block limits.
|
|
|
b38b0f |
|
|
|
b38b0f |
Signed-off-by: Eric Blake <eblake@redhat.com>
|
|
|
b38b0f |
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
|
|
b38b0f |
Message-Id: <20190329042750.14704-6-eblake@redhat.com>
|
|
|
b38b0f |
(cherry picked from commit 4841211e0d1628cd386b35835676d7f6f9a4fa9d)
|
|
|
b38b0f |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
|
b38b0f |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
b38b0f |
---
|
|
|
b38b0f |
block/block-backend.c | 7 +++++++
|
|
|
b38b0f |
include/sysemu/block-backend.h | 1 +
|
|
|
b38b0f |
2 files changed, 8 insertions(+)
|
|
|
b38b0f |
|
|
|
b38b0f |
diff --git a/block/block-backend.c b/block/block-backend.c
|
|
|
b38b0f |
index 7ae5832..0d623e4 100644
|
|
|
b38b0f |
--- a/block/block-backend.c
|
|
|
b38b0f |
+++ b/block/block-backend.c
|
|
|
b38b0f |
@@ -1807,6 +1807,13 @@ int blk_get_flags(BlockBackend *blk)
|
|
|
b38b0f |
}
|
|
|
b38b0f |
}
|
|
|
b38b0f |
|
|
|
b38b0f |
+/* Returns the minimum request alignment, in bytes; guaranteed nonzero */
|
|
|
b38b0f |
+uint32_t blk_get_request_alignment(BlockBackend *blk)
|
|
|
b38b0f |
+{
|
|
|
b38b0f |
+ BlockDriverState *bs = blk_bs(blk);
|
|
|
b38b0f |
+ return bs ? bs->bl.request_alignment : BDRV_SECTOR_SIZE;
|
|
|
b38b0f |
+}
|
|
|
b38b0f |
+
|
|
|
b38b0f |
/* Returns the maximum transfer length, in bytes; guaranteed nonzero */
|
|
|
b38b0f |
uint32_t blk_get_max_transfer(BlockBackend *blk)
|
|
|
b38b0f |
{
|
|
|
b38b0f |
diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h
|
|
|
b38b0f |
index 830d873..20f8bbb 100644
|
|
|
b38b0f |
--- a/include/sysemu/block-backend.h
|
|
|
b38b0f |
+++ b/include/sysemu/block-backend.h
|
|
|
b38b0f |
@@ -176,6 +176,7 @@ bool blk_is_available(BlockBackend *blk);
|
|
|
b38b0f |
void blk_lock_medium(BlockBackend *blk, bool locked);
|
|
|
b38b0f |
void blk_eject(BlockBackend *blk, bool eject_flag);
|
|
|
b38b0f |
int blk_get_flags(BlockBackend *blk);
|
|
|
b38b0f |
+uint32_t blk_get_request_alignment(BlockBackend *blk);
|
|
|
b38b0f |
uint32_t blk_get_max_transfer(BlockBackend *blk);
|
|
|
b38b0f |
int blk_get_max_iov(BlockBackend *blk);
|
|
|
b38b0f |
void blk_set_guest_block_size(BlockBackend *blk, int align);
|
|
|
b38b0f |
--
|
|
|
b38b0f |
1.8.3.1
|
|
|
b38b0f |
|