* [Qemu-devel] [PATCH] file-posix: Implement co versions of discard/flush
@ 2018-06-21 17:19 Kevin Wolf
2018-06-21 19:36 ` no-reply
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Kevin Wolf @ 2018-06-21 17:19 UTC (permalink / raw)
To: qemu-block; +Cc: kwolf, qemu-devel
This simplifies file-posix by implementing the coroutine variants of
the discard and flush BlockDriver callbacks. These were the last
remaining users of paio_submit(), which can be removed now.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/file-posix.c | 72 ++++++++++++++++++------------------------------------
1 file changed, 24 insertions(+), 48 deletions(-)
diff --git a/block/file-posix.c b/block/file-posix.c
index fa918f2bdb..7b8eecafcd 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -1747,31 +1747,6 @@ static inline int paio_submit_co(BlockDriverState *bs, int fd,
return paio_submit_co_full(bs, fd, offset, -1, 0, qiov, bytes, type);
}
-static BlockAIOCB *paio_submit(BlockDriverState *bs, int fd,
- int64_t offset, QEMUIOVector *qiov, int bytes,
- BlockCompletionFunc *cb, void *opaque, int type)
-{
- RawPosixAIOData *acb = g_new(RawPosixAIOData, 1);
- ThreadPool *pool;
-
- acb->bs = bs;
- acb->aio_type = type;
- acb->aio_fildes = fd;
-
- acb->aio_nbytes = bytes;
- acb->aio_offset = offset;
-
- if (qiov) {
- acb->aio_iov = qiov->iov;
- acb->aio_niov = qiov->niov;
- assert(qiov->size == acb->aio_nbytes);
- }
-
- trace_paio_submit(acb, opaque, offset, bytes, type);
- pool = aio_get_thread_pool(bdrv_get_aio_context(bs));
- return thread_pool_submit_aio(pool, aio_worker, acb, cb, opaque);
-}
-
static int coroutine_fn raw_co_prw(BlockDriverState *bs, uint64_t offset,
uint64_t bytes, QEMUIOVector *qiov, int type)
{
@@ -1838,15 +1813,17 @@ static void raw_aio_unplug(BlockDriverState *bs)
#endif
}
-static BlockAIOCB *raw_aio_flush(BlockDriverState *bs,
- BlockCompletionFunc *cb, void *opaque)
+static int raw_co_flush_to_disk(BlockDriverState *bs)
{
BDRVRawState *s = bs->opaque;
+ int ret;
- if (fd_open(bs) < 0)
- return NULL;
+ ret = fd_open(bs);
+ if (ret < 0) {
+ return ret;
+ }
- return paio_submit(bs, s->fd, 0, NULL, 0, cb, opaque, QEMU_AIO_FLUSH);
+ return paio_submit_co(bs, s->fd, 0, NULL, 0, QEMU_AIO_FLUSH);
}
static void raw_close(BlockDriverState *bs)
@@ -2503,14 +2480,12 @@ static void coroutine_fn raw_co_invalidate_cache(BlockDriverState *bs,
#endif /* !__linux__ */
}
-static coroutine_fn BlockAIOCB *raw_aio_pdiscard(BlockDriverState *bs,
- int64_t offset, int bytes,
- BlockCompletionFunc *cb, void *opaque)
+static coroutine_fn int
+raw_co_pdiscard(BlockDriverState *bs, int64_t offset, int bytes)
{
BDRVRawState *s = bs->opaque;
- return paio_submit(bs, s->fd, offset, NULL, bytes,
- cb, opaque, QEMU_AIO_DISCARD);
+ return paio_submit_co(bs, s->fd, offset, NULL, bytes, QEMU_AIO_DISCARD);
}
static int coroutine_fn raw_co_pwrite_zeroes(
@@ -2629,8 +2604,8 @@ BlockDriver bdrv_file = {
.bdrv_co_preadv = raw_co_preadv,
.bdrv_co_pwritev = raw_co_pwritev,
- .bdrv_aio_flush = raw_aio_flush,
- .bdrv_aio_pdiscard = raw_aio_pdiscard,
+ .bdrv_co_flush_to_disk = raw_co_flush_to_disk,
+ .bdrv_co_pdiscard = raw_co_pdiscard,
.bdrv_co_copy_range_from = raw_co_copy_range_from,
.bdrv_co_copy_range_to = raw_co_copy_range_to,
.bdrv_refresh_limits = raw_refresh_limits,
@@ -2995,17 +2970,18 @@ static int fd_open(BlockDriverState *bs)
return -EIO;
}
-static coroutine_fn BlockAIOCB *hdev_aio_pdiscard(BlockDriverState *bs,
- int64_t offset, int bytes,
- BlockCompletionFunc *cb, void *opaque)
+static coroutine_fn int
+hdev_co_pdiscard(BlockDriverState *bs, int64_t offset, int bytes)
{
BDRVRawState *s = bs->opaque;
+ int ret;
- if (fd_open(bs) < 0) {
- return NULL;
+ ret = fd_open(bs);
+ if (ret < 0) {
+ return ret;
}
- return paio_submit(bs, s->fd, offset, NULL, bytes,
- cb, opaque, QEMU_AIO_DISCARD|QEMU_AIO_BLKDEV);
+ return paio_submit_co(bs, s->fd, offset, NULL, bytes,
+ QEMU_AIO_DISCARD|QEMU_AIO_BLKDEV);
}
static coroutine_fn int hdev_co_pwrite_zeroes(BlockDriverState *bs,
@@ -3109,8 +3085,8 @@ static BlockDriver bdrv_host_device = {
.bdrv_co_preadv = raw_co_preadv,
.bdrv_co_pwritev = raw_co_pwritev,
- .bdrv_aio_flush = raw_aio_flush,
- .bdrv_aio_pdiscard = hdev_aio_pdiscard,
+ .bdrv_co_flush_to_disk = raw_co_flush_to_disk,
+ .bdrv_co_pdiscard = hdev_co_pdiscard,
.bdrv_co_copy_range_from = raw_co_copy_range_from,
.bdrv_co_copy_range_to = raw_co_copy_range_to,
.bdrv_refresh_limits = raw_refresh_limits,
@@ -3234,7 +3210,7 @@ static BlockDriver bdrv_host_cdrom = {
.bdrv_co_preadv = raw_co_preadv,
.bdrv_co_pwritev = raw_co_pwritev,
- .bdrv_aio_flush = raw_aio_flush,
+ .bdrv_co_flush_to_disk = raw_co_flush_to_disk,
.bdrv_refresh_limits = raw_refresh_limits,
.bdrv_io_plug = raw_aio_plug,
.bdrv_io_unplug = raw_aio_unplug,
@@ -3364,7 +3340,7 @@ static BlockDriver bdrv_host_cdrom = {
.bdrv_co_preadv = raw_co_preadv,
.bdrv_co_pwritev = raw_co_pwritev,
- .bdrv_aio_flush = raw_aio_flush,
+ .bdrv_co_flush_to_disk = raw_co_flush_to_disk,
.bdrv_refresh_limits = raw_refresh_limits,
.bdrv_io_plug = raw_aio_plug,
.bdrv_io_unplug = raw_aio_unplug,
--
2.13.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] file-posix: Implement co versions of discard/flush
2018-06-21 17:19 [Qemu-devel] [PATCH] file-posix: Implement co versions of discard/flush Kevin Wolf
@ 2018-06-21 19:36 ` no-reply
2018-06-22 11:51 ` Eric Blake
2018-06-29 7:31 ` Kevin Wolf
2 siblings, 0 replies; 4+ messages in thread
From: no-reply @ 2018-06-21 19:36 UTC (permalink / raw)
To: kwolf; +Cc: famz, qemu-block, qemu-devel
Hi,
This series seems to have some coding style problems. See output below for
more information:
Type: series
Message-id: 20180621171925.28925-1-kwolf@redhat.com
Subject: [Qemu-devel] [PATCH] file-posix: Implement co versions of discard/flush
=== TEST SCRIPT BEGIN ===
#!/bin/bash
BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
commits="$(git log --format=%H --reverse $BASE..)"
for c in $commits; do
echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
failed=1
echo
fi
n=$((n+1))
done
exit $failed
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
5c6a508b5c file-posix: Implement co versions of discard/flush
=== OUTPUT BEGIN ===
Checking PATCH 1/1: file-posix: Implement co versions of discard/flush...
ERROR: spaces required around that '|' (ctx:VxV)
#123: FILE: block/file-posix.c:2949:
+ QEMU_AIO_DISCARD|QEMU_AIO_BLKDEV);
^
ERROR: code indent should never use tabs
#133: FILE: block/file-posix.c:3053:
+ .bdrv_co_flush_to_disk^I= raw_co_flush_to_disk,$
ERROR: code indent should never use tabs
#143: FILE: block/file-posix.c:3178:
+ .bdrv_co_flush_to_disk^I= raw_co_flush_to_disk,$
ERROR: code indent should never use tabs
#152: FILE: block/file-posix.c:3308:
+ .bdrv_co_flush_to_disk^I= raw_co_flush_to_disk,$
total: 4 errors, 0 warnings, 131 lines checked
Your patch has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===
Test command exited with code: 1
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] file-posix: Implement co versions of discard/flush
2018-06-21 17:19 [Qemu-devel] [PATCH] file-posix: Implement co versions of discard/flush Kevin Wolf
2018-06-21 19:36 ` no-reply
@ 2018-06-22 11:51 ` Eric Blake
2018-06-29 7:31 ` Kevin Wolf
2 siblings, 0 replies; 4+ messages in thread
From: Eric Blake @ 2018-06-22 11:51 UTC (permalink / raw)
To: Kevin Wolf, qemu-block; +Cc: qemu-devel
On 06/21/2018 12:19 PM, Kevin Wolf wrote:
> This simplifies file-posix by implementing the coroutine variants of
> the discard and flush BlockDriver callbacks. These were the last
> remaining users of paio_submit(), which can be removed now.
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
> block/file-posix.c | 72 ++++++++++++++++++------------------------------------
> 1 file changed, 24 insertions(+), 48 deletions(-)
The patchew complaints about formatting are valid. With those fixed,
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] file-posix: Implement co versions of discard/flush
2018-06-21 17:19 [Qemu-devel] [PATCH] file-posix: Implement co versions of discard/flush Kevin Wolf
2018-06-21 19:36 ` no-reply
2018-06-22 11:51 ` Eric Blake
@ 2018-06-29 7:31 ` Kevin Wolf
2 siblings, 0 replies; 4+ messages in thread
From: Kevin Wolf @ 2018-06-29 7:31 UTC (permalink / raw)
To: qemu-block; +Cc: qemu-devel
Am 21.06.2018 um 19:19 hat Kevin Wolf geschrieben:
> This simplifies file-posix by implementing the coroutine variants of
> the discard and flush BlockDriver callbacks. These were the last
> remaining users of paio_submit(), which can be removed now.
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Applied to the block branch.
Kevin
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-06-29 7:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-21 17:19 [Qemu-devel] [PATCH] file-posix: Implement co versions of discard/flush Kevin Wolf
2018-06-21 19:36 ` no-reply
2018-06-22 11:51 ` Eric Blake
2018-06-29 7:31 ` Kevin Wolf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.