|
|
383d26 |
From c4d49803aeb1d6304c2728cb1475f8314ae1f8a8 Mon Sep 17 00:00:00 2001
|
|
|
383d26 |
From: John Snow <jsnow@redhat.com>
|
|
|
383d26 |
Date: Mon, 6 May 2019 17:56:22 +0200
|
|
|
383d26 |
Subject: [PATCH 12/53] block: Add bdrv_get_request_alignment()
|
|
|
383d26 |
|
|
|
383d26 |
RH-Author: John Snow <jsnow@redhat.com>
|
|
|
383d26 |
Message-id: <20190506175629.11079-13-jsnow@redhat.com>
|
|
|
383d26 |
Patchwork-id: 87195
|
|
|
383d26 |
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 12/19] block: Add bdrv_get_request_alignment()
|
|
|
383d26 |
Bugzilla: 1692018
|
|
|
383d26 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
383d26 |
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
|
|
383d26 |
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
|
|
383d26 |
|
|
|
383d26 |
From: Eric Blake <eblake@redhat.com>
|
|
|
383d26 |
|
|
|
383d26 |
The next patch needs access to a device's minimum permitted
|
|
|
383d26 |
alignment, since NBD wants to advertise this to clients. Add
|
|
|
383d26 |
an accessor function, borrowing from blk_get_max_transfer()
|
|
|
383d26 |
for accessing a backend's block limits.
|
|
|
383d26 |
|
|
|
383d26 |
Signed-off-by: Eric Blake <eblake@redhat.com>
|
|
|
383d26 |
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
|
|
|
383d26 |
Message-Id: <20190329042750.14704-6-eblake@redhat.com>
|
|
|
383d26 |
(cherry picked from commit 4841211e0d1628cd386b35835676d7f6f9a4fa9d)
|
|
|
383d26 |
Signed-off-by: John Snow <jsnow@redhat.com>
|
|
|
383d26 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
383d26 |
---
|
|
|
383d26 |
block/block-backend.c | 7 +++++++
|
|
|
383d26 |
include/sysemu/block-backend.h | 1 +
|
|
|
383d26 |
2 files changed, 8 insertions(+)
|
|
|
383d26 |
|
|
|
383d26 |
diff --git a/block/block-backend.c b/block/block-backend.c
|
|
|
383d26 |
index 52eebeb..f6480f6 100644
|
|
|
383d26 |
--- a/block/block-backend.c
|
|
|
383d26 |
+++ b/block/block-backend.c
|
|
|
383d26 |
@@ -1834,6 +1834,13 @@ int blk_get_flags(BlockBackend *blk)
|
|
|
383d26 |
}
|
|
|
383d26 |
}
|
|
|
383d26 |
|
|
|
383d26 |
+/* Returns the minimum request alignment, in bytes; guaranteed nonzero */
|
|
|
383d26 |
+uint32_t blk_get_request_alignment(BlockBackend *blk)
|
|
|
383d26 |
+{
|
|
|
383d26 |
+ BlockDriverState *bs = blk_bs(blk);
|
|
|
383d26 |
+ return bs ? bs->bl.request_alignment : BDRV_SECTOR_SIZE;
|
|
|
383d26 |
+}
|
|
|
383d26 |
+
|
|
|
383d26 |
/* Returns the maximum transfer length, in bytes; guaranteed nonzero */
|
|
|
383d26 |
uint32_t blk_get_max_transfer(BlockBackend *blk)
|
|
|
383d26 |
{
|
|
|
383d26 |
diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h
|
|
|
383d26 |
index 6b6d882..815b6e5 100644
|
|
|
383d26 |
--- a/include/sysemu/block-backend.h
|
|
|
383d26 |
+++ b/include/sysemu/block-backend.h
|
|
|
383d26 |
@@ -178,6 +178,7 @@ bool blk_is_available(BlockBackend *blk);
|
|
|
383d26 |
void blk_lock_medium(BlockBackend *blk, bool locked);
|
|
|
383d26 |
void blk_eject(BlockBackend *blk, bool eject_flag);
|
|
|
383d26 |
int blk_get_flags(BlockBackend *blk);
|
|
|
383d26 |
+uint32_t blk_get_request_alignment(BlockBackend *blk);
|
|
|
383d26 |
uint32_t blk_get_max_transfer(BlockBackend *blk);
|
|
|
383d26 |
int blk_get_max_iov(BlockBackend *blk);
|
|
|
383d26 |
void blk_set_guest_block_size(BlockBackend *blk, int align);
|
|
|
383d26 |
--
|
|
|
383d26 |
1.8.3.1
|
|
|
383d26 |
|