From: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
To: Eric Blake <eblake@redhat.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: Kevin Wolf <kwolf@redhat.com>, Fam Zheng <fam@euphon.net>,
Denis Lunev <den@virtuozzo.com>,
"open list:raw" <qemu-block@nongnu.org>,
Max Reitz <mreitz@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PULL 4/9] block: workaround for unaligned byte range in fallocate()
Date: Fri, 6 Sep 2019 12:51:18 +0000 [thread overview]
Message-ID: <1e5fb4a0-f6f8-5720-8de5-3bcd18f6de80@virtuozzo.com> (raw)
In-Reply-To: <20190905182132.3563-5-eblake@redhat.com>
Many thanks
Andrey
On 05/09/2019 21:21, Eric Blake wrote:
> From: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
>
> Revert the commit 118f99442d 'block/io.c: fix for the allocation failure'
> and use better error handling for file systems that do not support
> fallocate() for an unaligned byte range. Allow falling back to pwrite
> in case fallocate() returns EINVAL.
>
> Suggested-by: Kevin Wolf <kwolf@redhat.com>
> Suggested-by: Eric Blake <eblake@redhat.com>
> Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
> Reviewed-by: Eric Blake <eblake@redhat.com>
> Reviewed-by: Denis V. Lunev <den@openvz.org>
> Message-Id: <1566913973-15490-1-git-send-email-andrey.shinkevich@virtuozzo.com>
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
> block/io.c | 2 +-
> block/file-posix.c | 7 +++++++
> 2 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/block/io.c b/block/io.c
> index 0fa10831edb7..16a598fd0857 100644
> --- a/block/io.c
> +++ b/block/io.c
> @@ -1746,7 +1746,7 @@ static int coroutine_fn bdrv_co_do_pwrite_zeroes(BlockDriverState *bs,
> assert(!bs->supported_zero_flags);
> }
>
> - if (ret < 0 && !(flags & BDRV_REQ_NO_FALLBACK)) {
> + if (ret == -ENOTSUP && !(flags & BDRV_REQ_NO_FALLBACK)) {
> /* Fall back to bounce buffer if write zeroes is unsupported */
> BdrvRequestFlags write_flags = flags & ~BDRV_REQ_ZERO_WRITE;
>
> diff --git a/block/file-posix.c b/block/file-posix.c
> index 71f168ee2f13..87c5a4ccbdc8 100644
> --- a/block/file-posix.c
> +++ b/block/file-posix.c
> @@ -1588,6 +1588,13 @@ static int handle_aiocb_write_zeroes(void *opaque)
> if (s->has_write_zeroes) {
> int ret = do_fallocate(s->fd, FALLOC_FL_ZERO_RANGE,
> aiocb->aio_offset, aiocb->aio_nbytes);
> + if (ret == -EINVAL) {
> + /*
> + * Allow falling back to pwrite for file systems that
> + * do not support fallocate() for an unaligned byte range.
> + */
> + return -ENOTSUP;
> + }
> if (ret == 0 || ret != -ENOTSUP) {
> return ret;
> }
>
--
With the best regards,
Andrey Shinkevich
next prev parent reply other threads:[~2019-09-06 12:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-05 18:21 [Qemu-devel] [PULL 0/9] NBD patches through 2019-09-05 Eric Blake
2019-09-05 18:21 ` [Qemu-devel] [PULL 1/9] nbd: Advertise multi-conn for shared read-only connections Eric Blake
2019-09-05 18:21 ` [Qemu-devel] [PULL 2/9] nbd: Use g_autofree in a few places Eric Blake
2019-09-05 18:21 ` [Qemu-devel] [PULL 3/9] nbd: Tolerate more errors to structured reply request Eric Blake
2019-09-05 18:21 ` [Qemu-devel] [PULL 4/9] block: workaround for unaligned byte range in fallocate() Eric Blake
2019-09-06 12:51 ` Andrey Shinkevich [this message]
2019-09-05 18:21 ` [Qemu-devel] [PULL 5/9] docs: Update preferred NBD device syntax Eric Blake
2019-09-05 18:21 ` [Qemu-devel] [PULL 6/9] nbd: Improve per-export flag handling in server Eric Blake
2019-09-05 18:21 ` [Qemu-devel] [PULL 7/9] nbd: Prepare for NBD_CMD_FLAG_FAST_ZERO Eric Blake
2019-09-05 18:21 ` [Qemu-devel] [PULL 8/9] nbd: Implement client use of NBD FAST_ZERO Eric Blake
2019-09-05 18:21 ` [Qemu-devel] [PULL 9/9] nbd: Implement server " Eric Blake
2019-09-05 20:47 ` [Qemu-devel] [PULL 0/9] NBD patches through 2019-09-05 Eric Blake
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1e5fb4a0-f6f8-5720-8de5-3bcd18f6de80@virtuozzo.com \
--to=andrey.shinkevich@virtuozzo.com \
--cc=den@virtuozzo.com \
--cc=eblake@redhat.com \
--cc=fam@euphon.net \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).