From: Markus Armbruster <armbru@redhat.com>
To: Ekaterina Tumanova <tumanova@linux.vnet.ibm.com>
Cc: kwolf@redhat.com, thuth@linux.vnet.ibm.com,
borntraeger@de.ibm.com,
Public KVM Mailing List <qemu-devel@nongnu.org>,
mihajlov@linux.vnet.ibm.com, dahi@linux.vnet.ibm.com,
stefanha@redhat.com, cornelia.huck@de.ibm.com,
pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH v4 3/5] block: Add driver methods to probe blocksizes and geometry
Date: Tue, 16 Dec 2014 18:02:15 +0100 [thread overview]
Message-ID: <87vblb5y08.fsf@blackfin.pond.sub.org> (raw)
In-Reply-To: <1418728219-40595-4-git-send-email-tumanova@linux.vnet.ibm.com> (Ekaterina Tumanova's message of "Tue, 16 Dec 2014 12:10:17 +0100")
Ekaterina Tumanova <tumanova@linux.vnet.ibm.com> writes:
> Introduce driver methods of defining disk blocksizes (physical and
> logical) and hard drive geometry.
> Methods are only implemented for "host_device". For "raw" devices
> driver calls child's method.
>
> For now geometry detection will only work for DASD devices. To check
> that a local check_for_dasd function was introduced. It calls BIODASDINFO2
> ioctl and returns its rc.
>
> Blocksizes detection function will probe sizes for DASD devices and
> set default for other devices.
>
> Signed-off-by: Ekaterina Tumanova <tumanova@linux.vnet.ibm.com>
> ---
> block/raw-posix.c | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> block/raw_bsd.c | 14 ++++++++
> 2 files changed, 111 insertions(+)
>
> diff --git a/block/raw-posix.c b/block/raw-posix.c
> index 38172ca..e1e7b29 100644
> --- a/block/raw-posix.c
> +++ b/block/raw-posix.c
> @@ -56,6 +56,7 @@
> #include <linux/cdrom.h>
> #include <linux/fd.h>
> #include <linux/fs.h>
> +#include <linux/hdreg.h>
> #ifndef FS_NOCOW_FL
> #define FS_NOCOW_FL 0x00800000 /* Do not cow file */
> #endif
> @@ -90,6 +91,10 @@
> #include <xfs/xfs.h>
> #endif
>
> +#ifdef __s390__
> +#include <asm/dasd.h>
> +#endif
> +
> //#define DEBUG_FLOPPY
>
> //#define DEBUG_BLOCK
> @@ -238,6 +243,23 @@ static int probe_logical_blocksize(int fd, unsigned int *sector_size)
> #undef SECTOR_SIZE
> }
>
> +/**
> + * Get physical block size of @fd.
> + * On success, store it in @blk_size and return 0.
> + * On failure, return -errno.
> + */
> +static int probe_physical_blocksize(int fd, unsigned int *blk_size)
> +{
> +#ifdef BLKPBSZGET
> + if (ioctl(fd, BLKPBSZGET, blk_size) < 0) {
> + return -errno;
> + }
> + return 0;
> +#else
> + return -ENOTSUP;
> +#endif
> +}
> +
> static void raw_probe_alignment(BlockDriverState *bs, int fd, Error **errp)
> {
> BDRVRawState *s = bs->opaque;
> @@ -660,6 +682,79 @@ static void raw_refresh_limits(BlockDriverState *bs, Error **errp)
> bs->bl.opt_mem_alignment = s->buf_align;
> }
>
> +static int check_for_dasd(int fd)
> +{
> +#ifdef BIODASDINFO2
> + struct dasd_information2_t info = {0};
> +
> + return ioctl(fd, BIODASDINFO2, &info);
> +#else
> + return -ENOTSUP;
> +#endif
> +}
This function is confused about its return value: 0/-1 vs. 0/-errno.
Please return -1 instead of -ENOTSUP, or replace it by an is_dasd()
returning bool.
[...]
next prev parent reply other threads:[~2014-12-16 17:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-16 11:10 [Qemu-devel] [PATCH v4 0/5] Geometry and blocksize detection for backing devices Ekaterina Tumanova
2014-12-16 11:10 ` [Qemu-devel] [PATCH v4 1/5] block: add bdrv functions for geometry and blocksize Ekaterina Tumanova
2014-12-16 16:43 ` Markus Armbruster
2014-12-17 15:26 ` David Hildenbrand
2014-12-16 11:10 ` [Qemu-devel] [PATCH v4 2/5] raw-posix: Factor block size detection out of raw_probe_alignment() Ekaterina Tumanova
2014-12-16 16:55 ` Markus Armbruster
2014-12-16 11:10 ` [Qemu-devel] [PATCH v4 3/5] block: Add driver methods to probe blocksizes and geometry Ekaterina Tumanova
2014-12-16 17:02 ` Markus Armbruster [this message]
2014-12-16 11:10 ` [Qemu-devel] [PATCH v4 4/5] block-backend: Add wrappers for blocksizes and geometry probing Ekaterina Tumanova
2014-12-16 11:10 ` [Qemu-devel] [PATCH v4 5/5] BlockConf: Call backend functions to detect geometry and blocksizes Ekaterina Tumanova
2014-12-16 11:38 ` [Qemu-devel] [PATCH v4 0/5] Geometry and blocksize detection for backing devices Christian Borntraeger
2014-12-16 17:05 ` Markus Armbruster
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=87vblb5y08.fsf@blackfin.pond.sub.org \
--to=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@redhat.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 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.