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