Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1295108lqj; Mon, 3 Jun 2024 17:27:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVsO6i+1FHw3JSXAWRpWSH9b6pWmLjSVFo6tqOnDlY1x90WouJvEmhLiOO6DFI3NqfWR5O0GkW+Rg7qUww57YKqdWwxHin0idj7hLJTWg== X-Google-Smtp-Source: AGHT+IGAr0EIa7SmShREvKA3ykvdJ3zxe4oAhe4UlE6+Auu3zMa4Lt5mZlIf4qPOJbpE6J13Ou/u X-Received: by 2002:a17:90a:f6d7:b0:2b3:d512:d487 with SMTP id 98e67ed59e1d1-2c1dc5ccd70mr9482142a91.39.1717460848428; Mon, 03 Jun 2024 17:27:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717460848; cv=pass; d=google.com; s=arc-20160816; b=NHeNQnfqaEwBu1+Zi65gV7RuMS2Hj/RrAj8RDk81Bah0+lAf1feeBIInM1HqzkGtdb n+bbIkZbBEdatDcde7I1/hzl8caSpBwTFpc2IWUTfaWv7wMd4BG1+Uv7/26fBfnXFOdB MpXwByDd+eL2QNIK7uigsFknxdLj6rXvznVnsIF+S4t/kpHaqslQ8Vy+dFWMlIGQ7qYl l8+u8WBW1pcZtee1uGcP+KftgczJMb2RgUjyzHVf0BGBEPMiINc5qP92YJEds95mdwiF 4YmdbNxTM8GYfXakOSXv+PFJT1i4BjrxxEei/hTqdLPkOjDLl7TLvodL4j8WwYVfQrug 1sYQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=B3gYSeR22FHk/H63N5QKIzZFhN7radWE7HTLdWSrTW4=; fh=xvzuL4pWJGso1Zq+EyrMDnLC4SqqtYV11Kz2z/9+t78=; b=WvEaHz7zaDR1RhASgfJsr5V9Uc6v0EFrpUjBoAAe/RsT88gmPIDTpkiuzXM7jaRCvA vv1pMAhmd4lbxJEn+kT/UkQvGAY9NsUwtNR96B5akDbqHiHWVd94fOnGqZOZ9Cv6Werj OdLSGwoXHGXKpcNwUczjDZjCDgVKfs+jl2ZJFgnVnVEp17ucAamOpXMo+oLAGcu5boNU W7PiyAXurjRQ4RyOqEorx/MhErcxByukL+1iz/x0LIifHnaNlIgli0hFv6tKQayoxwA2 LnOPiHm1KPD6+oTAyifrVIYMmWKVbrUryxHQaOUCQCnXAMCsoLQJH6Me8NHSvCA8gfpw Rwmw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@metaspace-dk.20230601.gappssmtp.com header.s=20230601 header.b=hDlmctC0; arc=pass (i=1 dkim=pass dkdomain=metaspace-dk.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-199632-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199632-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2c20cdeb535si4629061a91.153.2024.06.03.17.27.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 17:27:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-199632-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@metaspace-dk.20230601.gappssmtp.com header.s=20230601 header.b=hDlmctC0; arc=pass (i=1 dkim=pass dkdomain=metaspace-dk.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-199632-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199632-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 3384CB2706F for ; Mon, 3 Jun 2024 19:18:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A638E13B59E; Mon, 3 Jun 2024 19:15:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=metaspace-dk.20230601.gappssmtp.com header.i=@metaspace-dk.20230601.gappssmtp.com header.b="hDlmctC0" Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E81EC13D24F for ; Mon, 3 Jun 2024 19:15:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717442119; cv=none; b=as5+1/zkTcRAECcz9L53JSBLbFcT2MPxdufn3PPlsKUUPkvoF5Qr5aHD6tkKjmrd/rVar+bKGOMCccOcvMl5cPosC2eOwZEtBym9Oljnzn57D+3o9Vp5eeK3J/jnaUpV5o4Cz7hfXa0lBhz6Ws6iKIBRdKpzuAQj+aC3hqrMJJg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717442119; c=relaxed/simple; bh=u3t0ocUfsdb3hvZ3j1iQpvNqlGBmE9PoE/Vra50k+lM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=qlcCQrmQ5FN2qskY2nGevFRKfCRzC+VvsdIg7KEFLxbZptyyWLYXPItm0qRsnuyAVQBfWVLtwenQ7Wpb+ADMo1MPrxL1HXJECiNXRinKTs1gaykJ/EnWDjbF5Pf8o/wOVIMvvLWuLdfXSAEK8kCQ5IYnjB+BhDhs+SX3jXhuZOI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=metaspace.dk; spf=none smtp.mailfrom=metaspace.dk; dkim=pass (2048-bit key) header.d=metaspace-dk.20230601.gappssmtp.com header.i=@metaspace-dk.20230601.gappssmtp.com header.b=hDlmctC0; arc=none smtp.client-ip=209.85.218.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=metaspace.dk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=metaspace.dk Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-a634e03339dso521476266b.3 for ; Mon, 03 Jun 2024 12:15:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=metaspace-dk.20230601.gappssmtp.com; s=20230601; t=1717442115; x=1718046915; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=B3gYSeR22FHk/H63N5QKIzZFhN7radWE7HTLdWSrTW4=; b=hDlmctC0QQgNQQqIpppS/6l+ka0eMmKm5ZpnmXIpYEr2YTmY+9ug3jMw2demcoAe5N jh73dUfD61yL1VJumFFXNOXZVoCEov3fc7bj31JkgtNo64MQ+YXnGXmTwuEmwAEN2K0U 1r0438FkyVVQxpa9EN6LBFZzyG+w4HRWLVcUwMaFyQgpBUK0PHOxwgBOpGE6pqduyTJ2 CFz0OlkffTpOjuFSLJ6cgmqEXkeWBljS6sBGt7zT1GHdt6XPheVRAFkpA/yb0UT4fO/r euX5CC6c3yp5o4TUbqHf3kn2JOIFCwwzB7V6wQUhHdtfgQgIiT2n9t5iOwaTpws4aumC S4RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717442115; x=1718046915; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=B3gYSeR22FHk/H63N5QKIzZFhN7radWE7HTLdWSrTW4=; b=vCCHoIWx7fGMdEtpIP3B169MjbJf9KiLY2eiLT7g/bLM2WDT4zQY7THrOsqu2O6Pqr RSMcFNOxB2lm7XNkIGdOpdaboLPV11wWOrimZZljv1yBgHKbo0D7sny4ygiRJHfIGylS NU4ljqtf3f5eE3O0lXADI7fP/MJN+FQ87oxLOVY5gCTaFzLWqLbxPnufzLygBPDYWGoc 2n5IwF1V8ePV3yUUiquEbrhWyJnQO6raJ9cQ7LKgFX0iOZRK5NqOlo366KDndc3HNh7J DUC+8UZm/QRSy3pJVULdyGCKcdQMAWP3M/LhoLX8/G1aG5fHLjM4pMG4m83hAAPt4zI2 YvAg== X-Forwarded-Encrypted: i=1; AJvYcCUhUtsjbYw/kY+iwQWOUTDXIaQNQe8dsTkKqyGfns99aRdDUUDLK0yxoK6nPsO5VMRh9EApWgsPgp4XdvJwNCQ2xf6A0OwXN8+aMlsm X-Gm-Message-State: AOJu0Yy15robPUXjxVygQ2kgnXt1SyydbiZJIJUoWJMfiWVLCf9iXqGM xQsUrqlB6kqJYpfd6dPrBq52zZW5+gKLIJ8cA0DkBs2KWM+5SOjO6OMJFxaxA6k= X-Received: by 2002:a17:906:ca57:b0:a68:a117:2635 with SMTP id a640c23a62f3a-a68a117287fmr493697166b.22.1717442115351; Mon, 03 Jun 2024 12:15:15 -0700 (PDT) Received: from localhost ([79.142.230.34]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a68c38b3803sm362409466b.112.2024.06.03.12.15.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 12:15:15 -0700 (PDT) From: Andreas Hindborg To: Jens Axboe , Christoph Hellwig , Keith Busch , Damien Le Moal , Bart Van Assche , Hannes Reinecke , Ming Lei , "linux-block@vger.kernel.org" Cc: Andreas Hindborg , Greg KH , Matthew Wilcox , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Alice Ryhl , Chaitanya Kulkarni , Luis Chamberlain , Yexuan Yang <1182282462@bupt.edu.cn>, =?UTF-8?q?Sergio=20Gonz=C3=A1lez=20Collado?= , Joel Granados , "Pankaj Raghav (Samsung)" , Daniel Gomez , Niklas Cassel , Philipp Stanner , Conor Dooley , Johannes Thumshirn , =?UTF-8?q?Matias=20Bj=C3=B8rling?= , open list , "rust-for-linux@vger.kernel.org" , "lsf-pc@lists.linux-foundation.org" , "gost.dev@samsung.com" Subject: [PATCH v5 0/3] Rust block device driver API and null block driver Date: Mon, 3 Jun 2024 21:14:52 +0200 Message-ID: <20240603191455.968301-1-nmi@metaspace.dk> X-Mailer: git-send-email 2.45.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Andreas Hindborg Hi! Here is the fifth iteration!. This revision includes a check to validate the block size in the abstractions rather than in the driver. Also, the `GenDisk` type state was changed to a builder pattern. V4 is here [1]. Changes from v4: - validate block size in abstractions instead of in driver code - refactor `GenDisk` to builder pattern instead of type state - refactor `Request::try_end` and `Request::end_ok` methods` - fix formatting errors - fix and clarify a number of safety comments - fix typos in documentation Thanks to all those who had spare cycles to suggest improvements! Best regards, Andreas Hindborg Link: https://lore.kernel.org/all/20240601134005.621714-1-nmi@metaspace.dk/ [1] Andreas Hindborg (3): rust: block: introduce `kernel::block::mq` module rust: block: add rnull, Rust null_blk implementation MAINTAINERS: add entry for Rust block device driver API MAINTAINERS | 14 ++ drivers/block/Kconfig | 9 ++ drivers/block/Makefile | 3 + drivers/block/rnull.rs | 73 +++++++++ rust/bindings/bindings_helper.h | 3 + rust/helpers.c | 16 ++ rust/kernel/block.rs | 5 + rust/kernel/block/mq.rs | 98 +++++++++++ rust/kernel/block/mq/gen_disk.rs | 215 ++++++++++++++++++++++++ rust/kernel/block/mq/operations.rs | 237 +++++++++++++++++++++++++++ rust/kernel/block/mq/raw_writer.rs | 55 +++++++ rust/kernel/block/mq/request.rs | 252 +++++++++++++++++++++++++++++ rust/kernel/block/mq/tag_set.rs | 85 ++++++++++ rust/kernel/error.rs | 6 + rust/kernel/lib.rs | 2 + 15 files changed, 1073 insertions(+) create mode 100644 drivers/block/rnull.rs create mode 100644 rust/kernel/block.rs create mode 100644 rust/kernel/block/mq.rs create mode 100644 rust/kernel/block/mq/gen_disk.rs create mode 100644 rust/kernel/block/mq/operations.rs create mode 100644 rust/kernel/block/mq/raw_writer.rs create mode 100644 rust/kernel/block/mq/request.rs create mode 100644 rust/kernel/block/mq/tag_set.rs base-commit: 1613e604df0cd359cf2a7fbd9be7a0bcfacfabd0 -- 2.45.1