From: Eric Blake <eblake@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
Max Reitz <mreitz@redhat.com>,
qemu-block@nongnu.org
Cc: kwolf@redhat.com, den@openvz.org, qemu-devel@nongnu.org
Subject: Re: [PATCH 3/3] block: fail on open when file size is unaligned to request_alignment
Date: Thu, 12 Mar 2020 06:31:22 -0500 [thread overview]
Message-ID: <ebd77000-d761-1d9d-a6fb-4a719c2b7c8c@redhat.com> (raw)
In-Reply-To: <c30d19ae-52c0-455e-8ff1-0af7a853ef0f@virtuozzo.com>
On 3/12/20 4:06 AM, Vladimir Sementsov-Ogievskiy wrote:
>>> So the real solution would probably... Be to align the file size up to
>>> the alignment?
>>
>> Or to bite the bullet and finally implement byte-accurate size
>> everywhere (instead of our current insistence on rounding size up to
>> 512-byte multiples). If we have to deal with unaligned tails anyways,
>> it's better to make the code universally applicable whether that
>> unaligned tail is to 512 or to 4k, than to have it work for 512 but to
>> fail for 4k.
>>
>
> But how it helps with the problem of files unaligned to
> request_alignment defined by driver?
In a byte-accurate world, no driver should ever report an unaligned
size. If the driver is capable of sub-sector sizes, it is also capable
of sub-sector I/O and should state as such in its request_alignment.
The block layer then takes care of ensuring that any access of the final
unaligned sector or 4k region either leaves the bytes past EOF alone, or
at most reads those bytes as zeroes, and maybe permits attempts to write
no-op zeroes to those bytes, but gracefully forbids attempts to store
data that would cause the file to be resized.
But that's the ideal world, and it requires a lot of code auditing to
get there. It probably won't happen in time for the 5.0 release.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
next prev parent reply other threads:[~2020-03-12 11:32 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-30 15:22 [PATCH 0/3] request_alignment vs file size Vladimir Sementsov-Ogievskiy
2020-01-30 15:22 ` [PATCH 1/3] block/file-posix: add raw_getlength_fd Vladimir Sementsov-Ogievskiy
2020-03-11 10:21 ` Max Reitz
2020-01-30 15:22 ` [PATCH 2/3] block/file-posix: consider file size when fallback to max_align Vladimir Sementsov-Ogievskiy
2020-03-11 10:46 ` Max Reitz
2020-01-30 15:22 ` [PATCH 3/3] block: fail on open when file size is unaligned to request_alignment Vladimir Sementsov-Ogievskiy
2020-03-11 11:06 ` Max Reitz
2020-03-11 12:29 ` Eric Blake
2020-03-12 9:06 ` Vladimir Sementsov-Ogievskiy
2020-03-12 11:31 ` Eric Blake [this message]
2020-03-12 11:59 ` Vladimir Sementsov-Ogievskiy
2020-03-12 12:06 ` Vladimir Sementsov-Ogievskiy
2020-03-23 13:00 ` Max Reitz
2020-01-30 15:52 ` [PATCH 0/3] request_alignment vs file size no-reply
2020-01-30 16:06 ` Vladimir Sementsov-Ogievskiy
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=ebd77000-d761-1d9d-a6fb-4a719c2b7c8c@redhat.com \
--to=eblake@redhat.com \
--cc=den@openvz.org \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@virtuozzo.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).