From: Stefan Hajnoczi <stefanha@redhat.com>
To: Ekaterina Tumanova <tumanova@linux.vnet.ibm.com>
Cc: kwolf@redhat.com, thuth@linux.vnet.ibm.com,
dahi@linux.vnet.ibm.com, Stefan Hajnoczi <stefanha@gmail.com>,
Public KVM Mailing List <qemu-devel@nongnu.org>,
armbru@redhat.com, borntraeger@de.ibm.com,
cornelia.huck@de.ibm.com, pbonzini@redhat.com,
mihajlov@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [PATCH v5 2/5] raw-posix: Refactor logical block size detection.
Date: Tue, 13 Jan 2015 15:24:38 +0000 [thread overview]
Message-ID: <20150113152438.GA26676@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <54B4ED57.4000304@linux.vnet.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 1746 bytes --]
On Tue, Jan 13, 2015 at 01:03:03PM +0300, Ekaterina Tumanova wrote:
> On 01/02/2015 02:52 PM, Stefan Hajnoczi wrote:
> >On Thu, Dec 18, 2014 at 12:18:01PM +0100, Ekaterina Tumanova wrote:
> >>+#if defined(BLKSSZGET)
> >>+# define SECTOR_SIZE BLKSSZGET
> >>+#elif defined(DKIOCGETBLOCKSIZE)
> >>+# define SECTOR_SIZE DKIOCGETBLOCKSIZE
> >>+#elif defined(DIOCGSECTORSIZE)
> >>+# define SECTOR_SIZE DIOCGSECTORSIZE
> >>+#else
> >>+ return -ENOTSUP
> >>+#endif
> >>+ if (ioctl(fd, SECTOR_SIZE, sector_size) < 0) {
> >>+ return -errno;
> >>+ }
> >>+ return 0;
> >>+#undef SECTOR_SIZE
> >
> >Not a reason to respin, but I would have preferred simply moving the old
> >code.
> >
> >I think the new code works because BLKSSZGET is Linux, DKIOCGETBLOCKSIZE
> >is Mac OS, and DIOCGSECTORSIZE is FreeBSD.
> >
> >If there is a host OS where more than one ioctl is available and the
> >first one fails then the new code is broken. The old code didn't use
> >#elif so each ioctl had a chance to run.
> >
>
> In this case, why should it have a chance to run, if we only use one
> result at a time? (Old code overwrites first result with the second)
>
> Plus as far as I understand, in this hypothetical case of 2 ioctls
> defined, one will most probably will be a redefinition of another.
As code reviewer, I don't know exactly what all supported host OSes do
(Linux, *BSD, Solaris, AIX, etc).
If you leave the control flow unchanged then I'm confident that this
patch doesn't introduce a bug.
If you rewrite the control flow, then the semantics are different but I
can't verify that they are correct in all cases.
Spurious code changes make the life of code reviewers harder.
Stefan
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2015-01-13 15:24 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-18 11:17 [Qemu-devel] [PATCH v5 0/5] Geometry and blocksize detection for backing devices Ekaterina Tumanova
2014-12-18 11:18 ` [Qemu-devel] [PATCH v5 1/5] block: add bdrv functions for geometry and blocksize Ekaterina Tumanova
2014-12-18 11:18 ` [Qemu-devel] [PATCH v5 2/5] raw-posix: Refactor logical block size detection Ekaterina Tumanova
2015-01-02 11:52 ` Stefan Hajnoczi
2015-01-13 10:03 ` Ekaterina Tumanova
2015-01-13 15:24 ` Stefan Hajnoczi [this message]
2014-12-18 11:18 ` [Qemu-devel] [PATCH v5 3/5] block: Add driver methods to probe blocksizes and geometry Ekaterina Tumanova
2014-12-18 12:43 ` Thomas Huth
2015-01-02 12:11 ` Stefan Hajnoczi
2014-12-18 11:18 ` [Qemu-devel] [PATCH v5 4/5] block-backend: Add wrappers for blocksizes and geometry probing Ekaterina Tumanova
2014-12-18 14:45 ` Thomas Huth
2015-01-02 12:34 ` Stefan Hajnoczi
2014-12-18 11:18 ` [Qemu-devel] [PATCH v5 5/5] BlockConf: Call backend functions to detect geometry and blocksizes Ekaterina Tumanova
2014-12-18 14:55 ` Thomas Huth
2015-01-02 12:46 ` Stefan Hajnoczi
2014-12-18 15:59 ` [Qemu-devel] [PATCH v5 0/5] Geometry and blocksize detection for backing devices Christian Borntraeger
2015-01-02 12:57 ` Stefan Hajnoczi
2015-01-13 8:32 ` Christian Borntraeger
2015-01-13 10:51 ` Markus Armbruster
2015-01-13 16:04 ` Stefan Hajnoczi
2015-01-13 17:27 ` Markus Armbruster
2015-01-13 19:07 ` Christian Borntraeger
2015-01-14 13:57 ` Stefan Hajnoczi
2015-01-02 11:30 ` Stefan Hajnoczi
2015-01-13 9:59 ` Ekaterina Tumanova
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=20150113152438.GA26676@stefanha-thinkpad.redhat.com \
--to=stefanha@redhat.com \
--cc=armbru@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=cornelia.huck@de.ibm.com \
--cc=dahi@linux.vnet.ibm.com \
--cc=kwolf@redhat.com \
--cc=mihajlov@linux.vnet.ibm.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
--cc=thuth@linux.vnet.ibm.com \
--cc=tumanova@linux.vnet.ibm.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).