[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 12/18] block: move bdrv_qiov_is_aligned to file-posix
From: |
Kevin Wolf |
Subject: |
[PULL 12/18] block: move bdrv_qiov_is_aligned to file-posix |
Date: |
Fri, 30 Sep 2022 18:52:16 +0200 |
From: Keith Busch <kbusch@kernel.org>
There is only user of bdrv_qiov_is_aligned(), so move the alignment
function to there and make it static.
Signed-off-by: Keith Busch <kbusch@kernel.org>
Message-Id: <20220929200523.3218710-2-kbusch@meta.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
include/block/block-io.h | 1 -
block/file-posix.c | 21 +++++++++++++++++++++
block/io.c | 21 ---------------------
3 files changed, 21 insertions(+), 22 deletions(-)
diff --git a/include/block/block-io.h b/include/block/block-io.h
index fd25ffa9be..492f95fc05 100644
--- a/include/block/block-io.h
+++ b/include/block/block-io.h
@@ -150,7 +150,6 @@ void *qemu_blockalign(BlockDriverState *bs, size_t size);
void *qemu_blockalign0(BlockDriverState *bs, size_t size);
void *qemu_try_blockalign(BlockDriverState *bs, size_t size);
void *qemu_try_blockalign0(BlockDriverState *bs, size_t size);
-bool bdrv_qiov_is_aligned(BlockDriverState *bs, QEMUIOVector *qiov);
void bdrv_enable_copy_on_read(BlockDriverState *bs);
void bdrv_disable_copy_on_read(BlockDriverState *bs);
diff --git a/block/file-posix.c b/block/file-posix.c
index 256de1f456..989dfc4586 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -2061,6 +2061,27 @@ static int coroutine_fn
raw_thread_pool_submit(BlockDriverState *bs,
return thread_pool_submit_co(pool, func, arg);
}
+/*
+ * Check if all memory in this vector is sector aligned.
+ */
+static bool bdrv_qiov_is_aligned(BlockDriverState *bs, QEMUIOVector *qiov)
+{
+ int i;
+ size_t alignment = bdrv_min_mem_align(bs);
+ IO_CODE();
+
+ for (i = 0; i < qiov->niov; i++) {
+ if ((uintptr_t) qiov->iov[i].iov_base % alignment) {
+ return false;
+ }
+ if (qiov->iov[i].iov_len % alignment) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
static int coroutine_fn raw_co_prw(BlockDriverState *bs, uint64_t offset,
uint64_t bytes, QEMUIOVector *qiov, int
type)
{
diff --git a/block/io.c b/block/io.c
index 51d8f943a4..c3200bcdff 100644
--- a/block/io.c
+++ b/block/io.c
@@ -3227,27 +3227,6 @@ void *qemu_try_blockalign0(BlockDriverState *bs, size_t
size)
return mem;
}
-/*
- * Check if all memory in this vector is sector aligned.
- */
-bool bdrv_qiov_is_aligned(BlockDriverState *bs, QEMUIOVector *qiov)
-{
- int i;
- size_t alignment = bdrv_min_mem_align(bs);
- IO_CODE();
-
- for (i = 0; i < qiov->niov; i++) {
- if ((uintptr_t) qiov->iov[i].iov_base % alignment) {
- return false;
- }
- if (qiov->iov[i].iov_len % alignment) {
- return false;
- }
- }
-
- return true;
-}
-
void bdrv_io_plug(BlockDriverState *bs)
{
BdrvChild *child;
--
2.37.3
- [PULL 02/18] block/qcow2-bitmap: Add missing cast to silent GCC error, (continued)
- [PULL 02/18] block/qcow2-bitmap: Add missing cast to silent GCC error, Kevin Wolf, 2022/09/30
- [PULL 01/18] qcow2: fix memory leak in qcow2_read_extensions, Kevin Wolf, 2022/09/30
- [PULL 06/18] block: use bdrv_is_sg() helper instead of raw bs->sg reading, Kevin Wolf, 2022/09/30
- [PULL 04/18] block: pass OnOffAuto instead of bool to block_acct_setup(), Kevin Wolf, 2022/09/30
- [PULL 03/18] qemu-img: Wean documentation and help output off '?' for help, Kevin Wolf, 2022/09/30
- [PULL 07/18] block: make serializing requests functions 'void', Kevin Wolf, 2022/09/30
- [PULL 05/18] block: add missed block_acct_setup with new block device init procedure, Kevin Wolf, 2022/09/30
- [PULL 08/18] gluster: stop using .bdrv_needs_filename, Kevin Wolf, 2022/09/30
- [PULL 14/18] piix_ide_reset: Use pci_set_* functions instead of direct access, Kevin Wolf, 2022/09/30
- [PULL 09/18] block/qcow2: Keep auto_backing_file if possible, Kevin Wolf, 2022/09/30
- [PULL 12/18] block: move bdrv_qiov_is_aligned to file-posix,
Kevin Wolf <=
- [PULL 10/18] block/qed: Keep auto_backing_file if possible, Kevin Wolf, 2022/09/30
- [PULL 16/18] hw/ide/core: Clear LBA and drive bits for EXECUTE DEVICE DIAGNOSTIC, Kevin Wolf, 2022/09/30
- [PULL 15/18] tests/qtest/ide-test.c: Create disk image for use as a secondary, Kevin Wolf, 2022/09/30
- [PULL 13/18] block: use the request length for iov alignment, Kevin Wolf, 2022/09/30
- [PULL 17/18] tests/qtest/ide-test: Verify that DIAGNOSTIC clears DEV to zero, Kevin Wolf, 2022/09/30
- [PULL 18/18] hw/ide/core.c: Implement ATA INITIALIZE_DEVICE_PARAMETERS command, Kevin Wolf, 2022/09/30
- [PULL 11/18] iotests/backing-file-invalidation: Add new test, Kevin Wolf, 2022/09/30