From: Christoph Hellwig <hch@lst.de>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: Kevin Wolf <kwolf@redhat.com>, Christoph Hellwig <hch@lst.de>,
Lyu Mitnick <mitnick.lyu@gmail.com>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Question about total_sectors in block/vpc.c
Date: Mon, 11 Apr 2011 20:14:17 +0200 [thread overview]
Message-ID: <20110411181417.GC8877@lst.de> (raw)
In-Reply-To: <BANLkTi=-x2AgNnQ8t9H=kaAT45Az3m782w@mail.gmail.com>
On Sat, Apr 09, 2011 at 09:05:41PM +0100, Stefan Hajnoczi wrote:
> On Sat, Apr 9, 2011 at 5:51 PM, Lyu Mitnick <mitnick.lyu@gmail.com> wrote:
> > Hell all,
> > I have take a look of block/vpc.c and meet a question in vpc_create().?At
> > the line
> > 550, the code is:
> > total_sectors = options->value.n / 512;
> > I am wondering whether the size between?total_sectors * 512
> > and?options->value.n
> > would be discard.
>
> Yes, it rounds down. This reflects the assumption that a block device
> cannot be addressed below 512 byte sectors. Because of this block
> devices size must be a multiple of 512 bytes.
>
> I think a reasonable protection would be to have block.c:bdrv_create()
> fail if size is not a multiple of BDRV_SECTOR_SIZE. This way other
> image formats are protected too.
There are block devices that aren't alignment to 512 bytes. Audio CDROMs are
the most prominent example, or AS/400 disks. I don't think these matter for
emulation, but if we'd ever implement DIF/DIX emulation inside qemu we'd
have to store the protection information somewhere. It still wouldn't
work with existing disk format, so adding the above check into the formats
bdrv_create routines sounds fine, but doing it in the core block code
might not be an overly smart idea.
next prev parent reply other threads:[~2011-04-12 1:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-09 16:51 [Qemu-devel] Question about total_sectors in block/vpc.c Lyu Mitnick
2011-04-09 20:05 ` Stefan Hajnoczi
2011-04-10 9:02 ` Lyu Mitnick
2011-04-11 8:33 ` Stefan Hajnoczi
2011-04-13 20:59 ` Lyu Mitnick
2011-04-14 8:37 ` Kevin Wolf
2011-04-15 20:40 ` Lyu Mitnick
2011-04-18 13:13 ` Kevin Wolf
2011-04-11 18:14 ` Christoph Hellwig [this message]
2011-04-11 22:40 ` Lyu Mitnick
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=20110411181417.GC8877@lst.de \
--to=hch@lst.de \
--cc=kwolf@redhat.com \
--cc=mitnick.lyu@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.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).