qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Klaus Jensen <its@irrelevant.dk>
To: Sam Li <faithilikerun@gmail.com>
Cc: qemu-devel@nongnu.org, dmitry.fomichev@wdc.com,
	Markus Armbruster <armbru@redhat.com>,
	Eric Blake <eblake@redhat.com>,
	qemu-block@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>,
	Kevin Wolf <kwolf@redhat.com>, Fam Zheng <fam@euphon.net>,
	damien.lemoal@opensource.wdc.com, hare@suse.de,
	Hanna Reitz <hreitz@redhat.com>
Subject: Re: [PATCH v9 3/7] block: add block layer APIs resembling Linux ZonedBlockDevice ioctls
Date: Tue, 20 Sep 2022 10:51:12 +0200	[thread overview]
Message-ID: <Yyl/AC9X7uHyeTCu@apples> (raw)
In-Reply-To: <20220910052759.27517-4-faithilikerun@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2579 bytes --]

On Sep 10 13:27, Sam Li wrote:
> Add a new zoned_host_device BlockDriver. The zoned_host_device option
> accepts only zoned host block devices. By adding zone management
> operations in this new BlockDriver, users can use the new block
> layer APIs including Report Zone and four zone management operations
> (open, close, finish, reset).
> 
> Qemu-io uses the new APIs to perform zoned storage commands of the device:
> zone_report(zrp), zone_open(zo), zone_close(zc), zone_reset(zrs),
> zone_finish(zf).
> 
> For example, to test zone_report, use following command:
> $ ./build/qemu-io --image-opts -n driver=zoned_host_device, filename=/dev/nullb0
> -c "zrp offset nr_zones"
> 
> Signed-off-by: Sam Li <faithilikerun@gmail.com>
> Reviewed-by: Hannes Reinecke <hare@suse.de>
> ---
>  block/block-backend.c             | 145 ++++++++++++++
>  block/file-posix.c                | 323 +++++++++++++++++++++++++++++-
>  block/io.c                        |  41 ++++
>  include/block/block-io.h          |   7 +
>  include/block/block_int-common.h  |  21 ++
>  include/block/raw-aio.h           |   6 +-
>  include/sysemu/block-backend-io.h |  17 ++
>  meson.build                       |   1 +
>  qapi/block-core.json              |   8 +-
>  qemu-io-cmds.c                    | 143 +++++++++++++
>  10 files changed, 708 insertions(+), 4 deletions(-)
> 
> +/*
> + * zone management operations - Execute an operation on a zone
> + */
> +static int coroutine_fn raw_co_zone_mgmt(BlockDriverState *bs, BlockZoneOp op,
> +        int64_t offset, int64_t len) {
> +#if defined(CONFIG_BLKZONED)
> +    BDRVRawState *s = bs->opaque;
> +    RawPosixAIOData acb;
> +    int64_t zone_sector, zone_sector_mask;
> +    const char *zone_op_name;
> +    unsigned long zone_op;
> +    bool is_all = false;
> +
> +    zone_sector = bs->bl.zone_sectors;
> +    zone_sector_mask = zone_sector - 1;
> +    if (offset & zone_sector_mask) {
> +        error_report("sector offset %" PRId64 " is not aligned to zone size "
> +                     "%" PRId64 "", offset, zone_sector);
> +        return -EINVAL;
> +    }
> +
> +    if (len & zone_sector_mask) {
> +        error_report("number of sectors %" PRId64 " is not aligned to zone size"
> +                      " %" PRId64 "", len, zone_sector);
> +        return -EINVAL;
> +    }

These checks impose a power-of-two constraint on the zone size. Can they
be changed to divisions to lift that constraint? I don't see anything in
this patch set that relies on power of two zone sizes.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  parent reply	other threads:[~2022-09-20  9:26 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-10  5:27 [PATCH v9 0/7] Add support for zoned device Sam Li
2022-09-10  5:27 ` [PATCH v9 1/7] include: add zoned device structs Sam Li
2022-09-15  8:05   ` Eric Blake
2022-09-15 10:06     ` Sam Li
2022-09-16 15:16       ` Stefan Hajnoczi
2022-09-19  0:50         ` Sam Li
2022-09-19  8:04           ` Damien Le Moal
2022-09-19  8:06             ` Sam Li
2022-09-10  5:27 ` [PATCH v9 2/7] file-posix: introduce helper functions for sysfs attributes Sam Li
2022-09-11  4:56   ` Damien Le Moal
2022-09-10  5:27 ` [PATCH v9 3/7] block: add block layer APIs resembling Linux ZonedBlockDevice ioctls Sam Li
2022-09-11  5:31   ` Damien Le Moal
2022-09-11  6:33     ` Sam Li
2022-09-11  6:48       ` Damien Le Moal
2022-09-11  7:30         ` Sam Li
2022-09-11  7:02   ` Damien Le Moal
2022-09-16 16:00   ` Stefan Hajnoczi
2022-09-20  8:51   ` Klaus Jensen [this message]
2022-09-20 13:21     ` Sam Li
2022-09-21  4:44     ` Damien Le Moal
2022-09-21  9:08       ` Klaus Jensen
2022-09-10  5:27 ` [PATCH v9 4/7] raw-format: add zone operations to pass through requests Sam Li
2022-09-11  5:32   ` Damien Le Moal
2022-09-10  5:27 ` [PATCH v9 5/7] config: add check to block layer Sam Li
2022-09-11  5:34   ` Damien Le Moal
2022-09-11  6:54     ` Sam Li
2022-09-11  7:05       ` Damien Le Moal
2022-09-16 15:22   ` Stefan Hajnoczi
2022-09-10  5:27 ` [PATCH v9 6/7] qemu-iotests: test new zone operations Sam Li
2022-09-10  5:27 ` [PATCH v9 7/7] docs/zoned-storage: add zoned device documentation Sam Li
2022-09-11  5:38   ` Damien Le Moal

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=Yyl/AC9X7uHyeTCu@apples \
    --to=its@irrelevant.dk \
    --cc=armbru@redhat.com \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=dmitry.fomichev@wdc.com \
    --cc=eblake@redhat.com \
    --cc=faithilikerun@gmail.com \
    --cc=fam@euphon.net \
    --cc=hare@suse.de \
    --cc=hreitz@redhat.com \
    --cc=kwolf@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).