Received: by 2002:a89:2d5:0:b0:1ef:f8eb:5d24 with SMTP id d21csp179637lqs; Sun, 17 Mar 2024 17:01:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVf8uLrIEsnwHiJWUKbNyHm5dUOo+AytV92Uq6YOjKfY9cNla+od7CtVnaj3Grwmk9QDs9c3bqWatZ8o9cu5VnvVjsBszbkzhPxcBl/PQ== X-Google-Smtp-Source: AGHT+IGOgiiE3qcPEF5+wcCrCf3lFkOrwKjGhi0rlu2Irk1yiL/xSNIkZdKcaYvMJwvIelkNHJZ/ X-Received: by 2002:a05:6122:3a0d:b0:4d3:3446:6bcb with SMTP id fp13-20020a0561223a0d00b004d334466bcbmr8459505vkb.16.1710720080676; Sun, 17 Mar 2024 17:01:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710720080; cv=pass; d=google.com; s=arc-20160816; b=pa6s17tz7Q9GJLKv6dIXZkQX5binI5CUT/fn4ZypzVugA1tscAz3m7oZBWbjGfk18w oUIUMCA+eB+osDcs40Q/mc3e8qtYm0OG7BPRXXuM0+ZbCHBPM1pOlugXrHf0JAiG0nZk /+m3pYd2TEHPaJ0g+stBAR3mSIalRaz0tDQIZNLXhCBZZwZZ7Rq33b0MqWEIJbjAVYpR Rr3xr8oCjLgV6fuqS8+gMXkThpeQEHuCgIS8wr+kmD3CzcpXuRuWWQ7F7ThDp9cxr4dM 70QJgv5chFQd4qKtgR0gNicnuMAV0LaSF5UCfRXzBkDeFJlNBY1TNte12czq2FqvsSkX Z9VA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=mhmd4DQYdANeIXg1gAXPMMRysX1z3GDQw6kVU6mRTr0=; fh=1FcdYm5qsO0F6LMV+op0FK5tx2rpziq2wxP1W1+3rys=; b=qMAQYZmufSK/v8r/C82OVEk/OMBrWwu6b/Ve4T5m/ZJbAQcI3whxMXKWAWOsoJcUdJ I0IEONEoqV4c7jPOPpBgjY88NOz71ZVOj0q3NVpVcD7w2HHLNyO9RcbMEWSAf9FpYfXC lDRGcqPdLrcPrvJH7EBZP0x1Xmp5mZE1nGwtcvCntojKtsF70nXNuMcRbMuBiY4HcRgH i7yKWgN8qFQzldQW1XkXpuxnv47riiDFueG40v4z5zdTfjxW+yBiSliYKxZjWVfqjkAE iLGU+5SH/XC9NNe5m3hO315L/jF6548BW5+7enkaQXhlk/BD7zipeHEzzcEXiLm4PgG9 43hg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=GTvPGMUA; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-105565-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-105565-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id kr25-20020a0562142b9900b006916700d754si6829789qvb.312.2024.03.17.17.01.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Mar 2024 17:01:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-105565-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=GTvPGMUA; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-105565-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-105565-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 6B3781C20F40 for ; Sun, 17 Mar 2024 21:34:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6AA7821353; Sun, 17 Mar 2024 21:34:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="GTvPGMUA" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 1D47320B35; Sun, 17 Mar 2024 21:34:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710711257; cv=none; b=tzgTcYuqIdEU+ZsAk4WywFkErjKLYdngzHabjY6FSmeQRWdLNoo1SvwNsNogaGL7F/WyMAbhJWC/uJZz+P1DLw90ydVbSMZAj+a1SZ6wp8vU0Hr5zyxGBPltHbMSCRklh862tQie8wXW8r8y9h/bG8ASggy0/rvqBaft087OYYw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710711257; c=relaxed/simple; bh=JL4f9CkTc1PhMvDJqtVSNWVDRsuHiAIaDHnKNLauDrw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=enX4jrTDhiLUdXmBu31tU2xPCdq8CIUP7g/MzLyVJ+SKJmreUv3MZUV9qazuoh58inKRl21pLalVYw0lwzrYFmu/cANC1Ei6m7xMnp1wcgUy77weHdf+jFTh+9+f6nIQOBHiAvhR1qQZvbApby7cRh+IyYNP4hlI1ABLXQ/NfQ8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=GTvPGMUA; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=mhmd4DQYdANeIXg1gAXPMMRysX1z3GDQw6kVU6mRTr0=; b=GTvPGMUANvAVfkSRGVTb9VOlGV LRmBd/rJHeORLF/hpnwFvVXYQ8IzeOFBmhW6ipeXMalh2qVUJeeX2HcLXblOxP+Zvi9TUF2CqvxBZ HX1Jf/9BLDdHOWcTuqdXXVSuuda74pmfKU/VDdbsKnMvh9+kIOU3JTUyV06ozqohwWWgxbMEDymBD x8E1j5UeBFZlyU0ojq437+xL0u+c3r9NOYgxZccJvEoB/iHdQntQoQ792/XOVEH7Sq9390GzPo44W cBZYUgdhveX0D3ffJEf1fp/tbI2zm7Id7MxH0Hto9FWfr5zQSFCym8nL7HYi2kBMagTPvnWZLA7Gt avc6qhtA==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rly8n-0000000Fe5u-2tqR; Sun, 17 Mar 2024 21:34:01 +0000 Date: Sun, 17 Mar 2024 21:34:01 +0000 From: Matthew Wilcox To: Andreas Hindborg Cc: Jens Axboe , Christoph Hellwig , Keith Busch , Damien Le Moal , Bart Van Assche , Hannes Reinecke , "linux-block@vger.kernel.org" , Andreas Hindborg , Niklas Cassel , Greg KH , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Benno Lossin , Alice Ryhl , Chaitanya Kulkarni , Luis Chamberlain , Yexuan Yang <1182282462@bupt.edu.cn>, Sergio =?iso-8859-1?Q?Gonz=E1lez?= Collado , Joel Granados , "Pankaj Raghav (Samsung)" , Daniel Gomez , open list , "rust-for-linux@vger.kernel.org" , "lsf-pc@lists.linux-foundation.org" , "gost.dev@samsung.com" Subject: Re: [RFC PATCH 0/5] Rust block device driver API and null block driver Message-ID: References: <20240313110515.70088-1-nmi@metaspace.dk> <874jd5qqpq.fsf@metaspace.dk> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <874jd5qqpq.fsf@metaspace.dk> On Sun, Mar 17, 2024 at 08:09:53AM +0100, Andreas Hindborg wrote: > I was under the impression that using folios also give the advantage > that handles are always head pages. No need to worry about head/tail > pages. If the driver moves to use higher order pages for larger block > sizes, would it then make sense with folios, or are page still > preferred? This is a good question. If you do enhance this driver to support larger block sizes, I would recommend indexing the xarray by sector number instead of page number. You would allocate a compound page, but at no point would you need to ask the page what order it is (you already know), you don't need to change the page flags, etc, etc. The page cache is in a bit of a different spot. It has to support multiple folio sizes for the same file; it has to support folios being split, it has to support lookup from users who don't know what the folio size is, etc, etc. I don't think there's ever a point at which you'd need to call compound_head() because you'd always look up the head page. You'd still want an iterator of some kind to copy to a compound page (because you can only map one at a time). And that might look a lot like the folio copying code. Probably the right way to handle this is for the folio copying code to call the page copying code since a folio is always composed of pages.