Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp497396yba; Thu, 18 Apr 2019 05:03:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqwhpDmIcTMZmvCdgmy4VhyN/Vxw2LZLCUhOYcJ/62lSp0GpvEwbuPfYjShXASkPTBeNXi2t X-Received: by 2002:a17:902:2f84:: with SMTP id t4mr73145575plb.6.1555589027929; Thu, 18 Apr 2019 05:03:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555589027; cv=none; d=google.com; s=arc-20160816; b=SSgD5kiJW/FlRK5Sqi0S1sXAy/4j5bYSBso7XE+rTTspsYmZmmIvt2sHXX6L5FW88I nMa08V3BpKSo0/2OKauGIUlz/Wphn60WD9oGVXr+auSY23+D63viMGd0xd2RKumSbAZj r6zb71zCxiVo/b07lErb2zNrjrP2LP7XAKGF9Ter1Dz3FUXPR0/fQtc8HB0Zz+Tb0Jto boWFMg4BVVWstZoRi0+WR8OZehS3wGTjKFGLN1mvQfv5MsN3fix4xPPUgUoO1q3WRqTH wGKxngzzt+BbF4rMsmkrQE+YfhS+QVOAIXxK4G0pW2XzGpDtyw0XhlNcaIrul/FsEOiu w4Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=S78YZJAKtE8N2Uzsmqz3nEmuAtHZYrQ7X+IGoi6+ZFA=; b=kfvZ7bkAWsKYO/Uk5LmJWhlVpiEKJZDS0pSN+/svMX+38SWziFVFNJEnzTp7RH6bTK /sD7v6rCjwiJUQ9Om0pYwpoVisN4GNildKNSmD1RIXC3jJQ0zNumw6lLiBMoyxuiE46X Ma70xnhIz10USNYZ1hTSbVsA1NcMRf5K/kqvAeuxC0hCb7Wl0zydtNen7OvXxaVr6XKk dIfgqn3mB9tjGLZ4QCkg3felXmpdncxQIE8Dskv/JoviSIojblXxSPm77D8BfoZQdglZ Huv6dpZvN6SCm14C7bxYj7V3Whfpgf0rdNWE8xpzpNWpRfdFAjNbUmURM5eWTetbkJQ8 H3qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@owltronix-com.20150623.gappssmtp.com header.s=20150623 header.b=teyby3rV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u4si1971622pls.183.2019.04.18.05.03.28; Thu, 18 Apr 2019 05:03:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@owltronix-com.20150623.gappssmtp.com header.s=20150623 header.b=teyby3rV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388913AbfDRMCP (ORCPT + 99 others); Thu, 18 Apr 2019 08:02:15 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:40797 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388686AbfDRMCP (ORCPT ); Thu, 18 Apr 2019 08:02:15 -0400 Received: by mail-lj1-f193.google.com with SMTP id q66so1693241ljq.7 for ; Thu, 18 Apr 2019 05:02:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=owltronix-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=S78YZJAKtE8N2Uzsmqz3nEmuAtHZYrQ7X+IGoi6+ZFA=; b=teyby3rVsiZUtnrIRk/rXJGJfwYtwLla94602mogMtMk0tJtj/p8RgBo56D259Y/zw h65IL66mNgAB1vfw15WTnxMLwfGb9Xz5+QceZ8JG3OmMlwz/Ja5IBc3DsSR+Ck5dGGcW 03Z7fLgEDYnvGf9Ys+g/Osw3CbzPQRCedzn/WnYsZB781bIf+7xk72jSmZoLonCliEL1 gx7phwuRilAdoR2XFVbpdp+oztvrHwiQ9m2l1ncfD0xF8PvA4H9KIWpGl7Y1tHrerINk KvA9u/zUArUG+nuPGvA7t5QRU7g1mgR1TSLit/rO5rEdOjN5CLq7QG/lXGG03LQuMKD8 vEbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=S78YZJAKtE8N2Uzsmqz3nEmuAtHZYrQ7X+IGoi6+ZFA=; b=luYudjFxcz5m8iOkhjUTHYQaaWIa0+ut1EVaF1hHNiZbv+3BMNjST4rkBGr80BtGiS i2dcV0UfyJ0abvYAuJhFGv4Zf7rrBWFr2INq1IXULZtegW28q1QXEj41XOxcbfoY6YEj naDeA3StM7fKvZT7ZCTuG7iJ/vvt6/PDIJXGOGQR/6Uwv04RDgaKh8PjO/4HjZb9IYfb DeqnmrOX4WAojlHfAPJla2knIKvL2QTthcbY2251cTGfogOfC2EXffc+z0MSWlrNeaK2 OFn/fI5c4d3abRpKzuvS/LcKwMjOtnGhEXk0VzmLtwG+m1Pm1P1n0yhVnxW+TrYEqJ0a eZZg== X-Gm-Message-State: APjAAAWhHKmIb49KH/pRi7PinX2YMQCoMcTik3tuhdfCpXK/XgUtmM3l AfoP2sJqHk0QKUSzPpLTOzitIA== X-Received: by 2002:a2e:5b5c:: with SMTP id p89mr50731370ljb.177.1555588933021; Thu, 18 Apr 2019 05:02:13 -0700 (PDT) Received: from titan.bredbandsbolaget.se (c-bebee655.03-91-6d6c6d4.bbcust.telenor.se. [85.230.190.190]) by smtp.gmail.com with ESMTPSA id l16sm409659lfk.44.2019.04.18.05.02.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 18 Apr 2019 05:02:11 -0700 (PDT) From: hans@owltronix.com To: =?UTF-8?q?Matias=20Bj=C3=B8rling?= Cc: =?UTF-8?q?Javier=20Gonz=C3=A1lez?= , Igor Konopko , Heiner Litz , Klaus Jensen , Simon Lund , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Hans Holmberg Subject: [RFC PATCH 0/1] Introduce a new target: lzbd - LightNVM Zoned Block Device Date: Thu, 18 Apr 2019 14:01:24 +0200 Message-Id: <1555588885-22546-1-git-send-email-hans@owltronix.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans Holmberg Introduce a new target: lzbd - LightNVM Zoned Block Device The new target makes it possible to expose an Open-Channel 2.0 SSD as one or more zoned block devices exposing BLK_ZONE_TYPE_SEQWRITE_REQ zones. I've been playing around with this the last couple of months and now I'd love to get some feedback. It's very been useful to look at null_blk's zone support when doing the plumbing work and Simon and Klaus has also been very helpful when figuring out the design. Thanks guys! Naming is sometimes the hardest thing. I named this thing lzbd, as I found that most descriptive acronym. NOTE: This is an early prototype and lacking some vital features at the moment. It is worth looking at and playing around with for those interested, but beware of dragons :) See the lzbd documentation(Documentation/lightnvm/lzbd.txt) for my ideas on how a full implementation would look like. What is supported(for now): * Reads * Sequential writes * Unaligned writes (a per-zone ws_opt alignment buffer is used) * Zone resets * Zone reporting * Wear leveling(sort of, wear indices are not upated on reset yet) I've mainly tested in QEMU (cunits=0, ws_min=4, ws_opt=8). The zoned block device tests in blktests (tests/zbd) passes, and I've done a bunch of general smoke testing(aligned/unaligned writes with verification using dd and fio, ..), so the general plumbing seems to hold up, but more testing is needed. Performance is definately not what it should be yet. Only one chunk per zone is being written to at a time, effectively rate-limiting writes per zone, which is an interesting constraint, but probably not what we want. What is not supported(yet): * Metadata persistance (when the instance is removed, data is lost) - Zone to chunks mapping needs to be stored * Sync handling (flushing alignment buffers) - Zone Aligment buffer needs to be flushed to disk * Write error handling - Write errors will require zone -> chunk remapping of the failing chunk. * Chuck reset error handling (chunks going offline) * Updating wear indices on chunk resets - This is low hanging fruit to fix * Cunits read buffering Final thoughts, for now: Since lzbd (and pblk for that matter) are not entirely unlike file systems, it would be nice to create a mkfs/fsck/dmzadm-like tool that would: * Format the drive and persist instance configuration in a superblock contained in the instance metadata. * Repair broken(i.e. powerfailed) instances Per-sector metadata is currently not utilized in lzbd, but would be helpful in recovery scenarios. The patch is based on Matias for5.2/core branch in the github openchannel project. It is also available at [1] (branch for-5.2/lzbd) Thanks, Hans [1] CNEX Labs linux github project: https://github.com/CNEX-Labs/linux Hans Holmberg (1): lightnvm: add lzbd - a zoned block device target Documentation/lightnvm/lzbd.txt | 122 +++++++++++ drivers/lightnvm/Kconfig | 11 + drivers/lightnvm/Makefile | 3 + drivers/lightnvm/lzbd-io.c | 342 +++++++++++++++++++++++++++++++ drivers/lightnvm/lzbd-target.c | 392 +++++++++++++++++++++++++++++++++++ drivers/lightnvm/lzbd-user.c | 310 ++++++++++++++++++++++++++++ drivers/lightnvm/lzbd-zone.c | 444 ++++++++++++++++++++++++++++++++++++++++ drivers/lightnvm/lzbd.h | 139 +++++++++++++ 8 files changed, 1763 insertions(+) create mode 100644 Documentation/lightnvm/lzbd.txt create mode 100644 drivers/lightnvm/lzbd-io.c create mode 100644 drivers/lightnvm/lzbd-target.c create mode 100644 drivers/lightnvm/lzbd-user.c create mode 100644 drivers/lightnvm/lzbd-zone.c create mode 100644 drivers/lightnvm/lzbd.h -- 2.7.4