From patchwork Thu Mar 23 05:08:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Li X-Patchwork-Id: 1760146 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=P+mmVwuS; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PhthT3GLLz1yXt for ; Thu, 23 Mar 2023 16:10:33 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pfDCv-0006yR-EO; Thu, 23 Mar 2023 01:09:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pfDCt-0006kW-2o; Thu, 23 Mar 2023 01:09:47 -0400 Received: from mail-pj1-x1036.google.com ([2607:f8b0:4864:20::1036]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pfDCq-00037w-Mf; Thu, 23 Mar 2023 01:09:46 -0400 Received: by mail-pj1-x1036.google.com with SMTP id x15so10136338pjk.2; Wed, 22 Mar 2023 22:09:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679548182; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4E8gndD2asyocPN155ZzqxwgK2K7nT15tzIEILi0sRQ=; b=P+mmVwuSgOwM82fOjcDW7m8V7XeY2HBPVChbFs0DKvq5K3XKCXvz7sLa4HU3eWrKAp 75F+TOcBqpJj6A5M3ODPi6BnGSbZD2durPA/DsX5poU/vqTb5FR6qlKgHCc5RJc8UDBe /DRIr1dgT4hpXpku3YI9luI97VpcfLkv1wkvrDoQ5bkwBwTqSKSGbexpr+FxLHZYyB/y BlfeMZdRtdFOaVfKL8xIboE10NP9joRWfn2hGdciqKEx2qBUVOQiV45p7Cvz6cJgxgkX YMxfnn2I/DkHJqn/O8XpTS0jHAUUUIglRpJn/lemj93jIq78wQ4y83eHz9QqtK2LEHz6 85bQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679548182; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4E8gndD2asyocPN155ZzqxwgK2K7nT15tzIEILi0sRQ=; b=67F6XCscbhBkHLpDD5QyClwawbD3zXI5HWlr+mW7bgeGZjAHb7NXZKBHIKdOM4e9zb tEXfAnf4JhIFUJ+Q0x9fKMYj21kAk2zVFeYnc60rqPhdkEzpVvM0TWSEKrQeGgh/9CN5 VRtlDtiIGP863JQW1KrEO4lPycyKoZEb3pGv0hjirQPKFXhDcbVT9cV1Sp4BexU4hRB8 9uL3kFO7pmb3gF0m/CMY2LId/JZx/5tO1mBx6909mxMR9GfKZ1kYog+0s8b9qt8DOxaj ZdqH+mJb5eHE8fDb/QGyWsu4XJqN98vAqr3cWF8qXHnTkThgs6YJZd7L0Puw0hTYYcfR YDTw== X-Gm-Message-State: AO0yUKX2AEvhR8b8PQVhdYzoa9ktqPuPOhyNWHyWBGig0cPJgi002diZ tQ1YI4vcbX7/Sh1u3tO5awdyAznKdeErXdkj2rE= X-Google-Smtp-Source: AK7set9vPEOPkiNqAMWhmrZ7gnvLfl94KQj/bFdeAyteVawLY+J9hkxiOgSF72wTDYeO1XoAN6Nl6A== X-Received: by 2002:a05:6a20:2115:b0:da:a7db:48bb with SMTP id y21-20020a056a20211500b000daa7db48bbmr1750853pzy.42.1679548181964; Wed, 22 Mar 2023 22:09:41 -0700 (PDT) Received: from fedlinux.. ([106.84.129.82]) by smtp.gmail.com with ESMTPSA id y22-20020aa78556000000b00627eac32b11sm8157888pfn.192.2023.03.22.22.09.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Mar 2023 22:09:41 -0700 (PDT) From: Sam Li To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Hajnoczi , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Marc?= =?utf-8?q?-Andr=C3=A9_Lureau?= , Thomas Huth , damien.lemoal@opensource.wdc.com, Fam Zheng , hare@suse.de, dmitry.fomichev@wdc.com, =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Kevin Wolf , Hanna Reitz , Sam Li Subject: [PATCH v17 8/8] docs/zoned-storage: add zoned device documentation Date: Thu, 23 Mar 2023 13:08:34 +0800 Message-Id: <20230323050834.5199-9-faithilikerun@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230323050834.5199-1-faithilikerun@gmail.com> References: <20230323050834.5199-1-faithilikerun@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1036; envelope-from=faithilikerun@gmail.com; helo=mail-pj1-x1036.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Add the documentation about the zoned device support to virtio-blk emulation. Signed-off-by: Sam Li Reviewed-by: Stefan Hajnoczi Reviewed-by: Damien Le Moal Reviewed-by: Dmitry Fomichev --- docs/devel/zoned-storage.rst | 43 ++++++++++++++++++++++++++ docs/system/qemu-block-drivers.rst.inc | 6 ++++ 2 files changed, 49 insertions(+) create mode 100644 docs/devel/zoned-storage.rst diff --git a/docs/devel/zoned-storage.rst b/docs/devel/zoned-storage.rst new file mode 100644 index 0000000000..6a36133e51 --- /dev/null +++ b/docs/devel/zoned-storage.rst @@ -0,0 +1,43 @@ +============= +zoned-storage +============= + +Zoned Block Devices (ZBDs) divide the LBA space into block regions called zones +that are larger than the LBA size. They can only allow sequential writes, which +can reduce write amplification in SSDs, and potentially lead to higher +throughput and increased capacity. More details about ZBDs can be found at: + +https://zonedstorage.io/docs/introduction/zoned-storage + +1. Block layer APIs for zoned storage +------------------------------------- +QEMU block layer supports three zoned storage models: +- BLK_Z_HM: The host-managed zoned model only allows sequential writes access +to zones. It supports ZBD-specific I/O commands that can be used by a host to +manage the zones of a device. +- BLK_Z_HA: The host-aware zoned model allows random write operations in +zones, making it backward compatible with regular block devices. +- BLK_Z_NONE: The non-zoned model has no zones support. It includes both +regular and drive-managed ZBD devices. ZBD-specific I/O commands are not +supported. + +The block device information resides inside BlockDriverState. QEMU uses +BlockLimits struct(BlockDriverState::bl) that is continuously accessed by the +block layer while processing I/O requests. A BlockBackend has a root pointer to +a BlockDriverState graph(for example, raw format on top of file-posix). The +zoned storage information can be propagated from the leaf BlockDriverState all +the way up to the BlockBackend. If the zoned storage model in file-posix is +set to BLK_Z_HM, then block drivers will declare support for zoned host device. + +The block layer APIs support commands needed for zoned storage devices, +including report zones, four zone operations, and zone append. + +2. Emulating zoned storage controllers +-------------------------------------- +When the BlockBackend's BlockLimits model reports a zoned storage device, users +like the virtio-blk emulation or the qemu-io-cmds.c utility can use block layer +APIs for zoned storage emulation or testing. + +For example, to test zone_report on a null_blk device using qemu-io is: +$ path/to/qemu-io --image-opts -n driver=host_device,filename=/dev/nullb0 +-c "zrp offset nr_zones" diff --git a/docs/system/qemu-block-drivers.rst.inc b/docs/system/qemu-block-drivers.rst.inc index dfe5d2293d..105cb9679c 100644 --- a/docs/system/qemu-block-drivers.rst.inc +++ b/docs/system/qemu-block-drivers.rst.inc @@ -430,6 +430,12 @@ Hard disks you may corrupt your host data (use the ``-snapshot`` command line option or modify the device permissions accordingly). +Zoned block devices + Zoned block devices can be passed through to the guest if the emulated storage + controller supports zoned storage. Use ``--blockdev host_device, + node-name=drive0,filename=/dev/nullb0,cache.direct=on`` to pass through + ``/dev/nullb0`` as ``drive0``. + Windows ^^^^^^^