Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2003723lqo; Mon, 13 May 2024 05:23:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUKeYg6HeluToPw2BIdEQq/ipw+Qu/kkzWnaSWYsiEfcilc9dNJJBhFPjTRzpkIDgxOwn0Dx+t0IG1A+VGpJzgIQ7PZsW5LkiVPmEsaxA== X-Google-Smtp-Source: AGHT+IFKmKp2DXfAblfjrV0q12foUsWFhuNATc9JTMf6TILLZaSrPsaf77LA0b3yKVbpzTjO6q+2 X-Received: by 2002:a05:6512:2214:b0:51f:c112:9d67 with SMTP id 2adb3069b0e04-52210579230mr9222491e87.51.1715602996562; Mon, 13 May 2024 05:23:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715602996; cv=pass; d=google.com; s=arc-20160816; b=kXW9H/Y7ju5uiKfeSLCcy5fBSGFrUrDUJL1KygRBMJ3JRpghltx7vrSV31xbQFi75f YxpyYOdvdiulQVdNqAGtzVzqPuxeUByDUlIoebzFVL7POiTubg/ejmeV4GW6PHTooVwi ZjbZgtAjeh+jNGmWNe6fb/e9xPTEeEWRK8/l0q19MN0nzFHj/JFAKl0A9XlsUKs5Nb8R oX/bVzGgCHNGZm2M3+KVeSu+9kjSrm5EceIOJj+HJH7LxdEUE7XeIv2ZsDIRO8TalxSO C81XSoPRaHFBF35xeK4SuvxjXgifwUa1zLa9BmBID1qfB27Q6rW89gH1y8YjcjnAxFEd bGJg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=7Ih71/Watz1cdPTWlkmWtBwlP9ZcU5ZJPsGWDZOPS0Y=; fh=x1hxqqybGe6mM+FQuAdJcmECLvNHzLkMghaDpMBOO3Y=; b=uB2Oc0JEefaKwdKvsV3D8mKDg9hs0isOT6gt0kVZtu18XIFK2acAbNwMJeaELB6yP5 ZnWylTpgVBYeTWqvV2QyvIAhxnIwS0G50uZjO+bGdVFXO4vovFEivhxS0EJ1cbIO/YEt mj6DooEVDcOa4Gg7iJm6RZlK1Sm4BWpXhrIoezAKeAQhUh28MezsmThUH/Jh72E3eHJB mogWWq1lOhTpjDi1QqDRa9JTS0O90NNO7fClyLGL0l1q93KlY73bRcnUbHJ7SMW6e5A6 GznNrqUWtZq4QDIXFsl9sP81svA7dD9uCyniR1j/gBh3PJnvrzsYTK3JNMWhUWqumdfu +EWA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@acm.org header.s=mr01 header.b=jzT6xeI3; arc=pass (i=1 spf=pass spfdomain=acm.org dkim=pass dkdomain=acm.org dmarc=pass fromdomain=acm.org); spf=pass (google.com: domain of linux-kernel+bounces-177551-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-177551-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=acm.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5733c3289d6si4895007a12.419.2024.05.13.05.23.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 05:23:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-177551-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@acm.org header.s=mr01 header.b=jzT6xeI3; arc=pass (i=1 spf=pass spfdomain=acm.org dkim=pass dkdomain=acm.org dmarc=pass fromdomain=acm.org); spf=pass (google.com: domain of linux-kernel+bounces-177551-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-177551-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=acm.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 48A0B1F23B91 for ; Mon, 13 May 2024 12:23:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 50C5014F9C8; Mon, 13 May 2024 12:23:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b="jzT6xeI3" Received: from 008.lax.mailroute.net (008.lax.mailroute.net [199.89.1.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 06BE114EC5E; Mon, 13 May 2024 12:23:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=199.89.1.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715602986; cv=none; b=aEpvjtEbFh0kOLECbCUiC2PeZlwIMeyySqCEEdtxJAdhXR8UCY1t9SjKKU1j1OBsWeOZvbTIkTj7LCmRM+kJjQwFff8z2tx7uxBZqOCDBUUHRXaVxlm7R79OCYGnw+2CLiCxJJn4jKKHXIwHLXnv1E7yxrqLNTLsiJYwpPmaJd4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715602986; c=relaxed/simple; bh=GMpp0dPFuIFfvEUduPyIjFcKlLnBpiSg9daDEDmMREo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=lTbCEDmoImQbPZtEd015bqs/NgWxm3yrLzT7C+QzanKiRLejU3OtGamWaxEWDKeM6eTVRvEBCx6+FkmU/xp0G47gBpZ4xAXM6PbkDp0fEHvEFhTgpqWWzAcCV0qGG7uZ2jWU/Dd1JHPnLM5xGIpC08b5n+47Ujf2tPKkW6IYkbs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org; spf=pass smtp.mailfrom=acm.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b=jzT6xeI3; arc=none smtp.client-ip=199.89.1.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=acm.org Received: from localhost (localhost [127.0.0.1]) by 008.lax.mailroute.net (Postfix) with ESMTP id 4VdJXy1tR4z6Cnk90; Mon, 13 May 2024 12:22:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=acm.org; h= content-transfer-encoding:content-type:content-type:in-reply-to :from:from:content-language:references:subject:subject :user-agent:mime-version:date:date:message-id:received:received; s=mr01; t=1715602962; x=1718194963; bh=7Ih71/Watz1cdPTWlkmWtBwl P9ZcU5ZJPsGWDZOPS0Y=; b=jzT6xeI3w+cBrbZgW+L7A5crY0hWa6Q4mx/1MHQE B8JU1uAtmpxRvcx8kY5GQZBcuGgyo2OONYgKdIgmhlAvT6oKhREKiOFVCBfTCmHA a3JXZoC1XANZmc9Z/saTfeC99ouZ0tuRaxaafBSKRBySDS3d6wwcjB+VOxYoJYuG Kshui5g5ctx5ZcnXxJ/HO/HaeHSThdryHdvqM/b3bwdcbQkcR27Z6D6ISOpRZDCi 6N1JwHxIu+EMOmqRUAf+7TGxu6V+wD0lNfW+An2y4fbLVOVBDm6pCyNoR80qHnHM 9X88dvEGxU9nWcY+IUWLez3lumEp7uNOlnogIavx0EP7hg== X-Virus-Scanned: by MailRoute Received: from 008.lax.mailroute.net ([127.0.0.1]) by localhost (008.lax [127.0.0.1]) (mroute_mailscanner, port 10029) with LMTP id 6kRT-qnGtJMv; Mon, 13 May 2024 12:22:42 +0000 (UTC) Received: from [172.20.0.79] (unknown [8.9.45.205]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bvanassche@acm.org) by 008.lax.mailroute.net (Postfix) with ESMTPSA id 4VdJXV0Dx6z6Cnk8s; Mon, 13 May 2024 12:22:33 +0000 (UTC) Message-ID: <1b618942-a0fe-45d9-90de-eede429e7284@acm.org> Date: Mon, 13 May 2024 06:22:31 -0600 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/3] rust: block: introduce `kernel::block::mq` module To: Andreas Hindborg , Jens Axboe , Christoph Hellwig , Keith Busch , Damien Le Moal , Hannes Reinecke , Ming Lei , "linux-block@vger.kernel.org" Cc: Andreas Hindborg , Wedson Almeida Filho , Greg KH , Matthew Wilcox , Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Alice Ryhl , Chaitanya Kulkarni , Luis Chamberlain , Yexuan Yang <1182282462@bupt.edu.cn>, =?UTF-8?Q?Sergio_Gonz=C3=A1lez_Collado?= , Joel Granados , "Pankaj Raghav (Samsung)" , Daniel Gomez , Niklas Cassel , Philipp Stanner , Conor Dooley , Johannes Thumshirn , =?UTF-8?Q?Matias_Bj=C3=B8rling?= , open list , "rust-for-linux@vger.kernel.org" , "lsf-pc@lists.linux-foundation.org" , "gost.dev@samsung.com" References: <20240512183950.1982353-1-nmi@metaspace.dk> <20240512183950.1982353-2-nmi@metaspace.dk> Content-Language: en-US From: Bart Van Assche In-Reply-To: <20240512183950.1982353-2-nmi@metaspace.dk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable On 5/12/24 11:39, Andreas Hindborg wrote: > + /// Set the logical block size of the device. > + /// > + /// This is the smallest unit the storage device can address. It i= s > + /// typically 512 bytes. Hmm ... all block devices that I have encountered recently have a logical block size of 4096 bytes. Isn't this the preferred logical block size for SSDs and for SMR hard disks? > + /// Set the physical block size of the device. > + /// > + /// This is the smallest unit a physical storage device can write > + /// atomically. It is usually the same as the logical block size b= ut may be > + /// bigger. One example is SATA drives with 4KB sectors that expos= e a > + /// 512-byte logical block size to the operating system. Please be consistent and change "4 KB sectors" into "4 KB physical block size". I think that the physical block size can also be smaller than the logical block size. From the SCSI SBC standard: Table 91 =E2=80=94 LOGICAL BLOCKS PER PHYSICAL BLOCK EXPONENT field ----- ------------------------------------------------------------ Code Description ----- ------------------------------------------------------------ 0 One or more physical blocks per logical block (the number of physical blocks per logical block is not reported). n > 0 2**n logical blocks per physical block ----- ------------------------------------------------------------ > +impl GenDisk { > + /// Call to tell the block layer the capacity of the device in sec= tors (512B). Why to use any other unit than bytes in Rust block::mq APIs? sector_t was introduced before 64-bit CPUs became available to reduce the number of bytes required to represent offsets. I don't think that this is still a concern today. Hence my proposal to be consistent in the Rust=20 block::mq API and to use bytes as the unit in all APIs. Thanks, Bart.