From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 0291C2F859; Tue, 7 Nov 2023 22:18:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="hntptVlG" Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12E5599; Tue, 7 Nov 2023 14:18:13 -0800 (PST) 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=DTT5lzbKGZqy0lWVmsfN05x9UU5Qeehz1tYRPwYDIGo=; b=hntptVlG3/jEmDW7kzZmTNMvzW z7P8vzjPmCqbYJSY1MJVupXyVM4ey2OWa6b06yys+B3he60kg6pfFRaLgTxEhMh0RaPA84LYyBg5A pOtvTryiYWYBk8YFjAr9kM2itvYwsaJXffoAq06O3cdBiajQRBHBq81pB4bj+Q+F5/POEGcFc/cCH sz73sKNRthRLyTbOChotcqmoe7Ispr7XzU4EVEYKaHRn2QCIaKA+pErg8qblvxRIZ6c3Ud8ZYAsKJ APxHwKbIpi+jVXsY/U/MzIeN1jKivgptYE6CxkUh/rVE15lYNNJEM+TH5dUEW5R3r+9aMBfkQWPaw B6ZG7dcw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1r0UOb-00Erdc-QE; Tue, 07 Nov 2023 22:18:05 +0000 Date: Tue, 7 Nov 2023 22:18:05 +0000 From: Matthew Wilcox To: Wedson Almeida Filho Cc: Alexander Viro , Christian Brauner , Kent Overstreet , Greg Kroah-Hartman , linux-fsdevel@vger.kernel.org, rust-for-linux@vger.kernel.org, Wedson Almeida Filho Subject: Re: [RFC PATCH 10/19] rust: fs: introduce `FileSystem::read_folio` Message-ID: References: <20231018122518.128049-1-wedsonaf@gmail.com> <20231018122518.128049-11-wedsonaf@gmail.com> Precedence: bulk X-Mailing-List: rust-for-linux@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: <20231018122518.128049-11-wedsonaf@gmail.com> On Wed, Oct 18, 2023 at 09:25:09AM -0300, Wedson Almeida Filho wrote: > @@ -36,6 +39,9 @@ pub trait FileSystem { > > /// Returns the inode corresponding to the directory entry with the given name. > fn lookup(parent: &INode, name: &[u8]) -> Result>>; > + > + /// Reads the contents of the inode into the given folio. > + fn read_folio(inode: &INode, folio: LockedFolio<'_>) -> Result; > } > This really shouldn't be a per-filesystem operation. We have operations split up into mapping_ops, inode_ops and file_ops for a reason. In this case, read_folio() can have a very different implementation for, eg, symlinks, directories and files. So we want to have different aops for each of symlinks, directories and files. We should maintain that separation for filesystems written in Rust too. Unless there's a good reason to change it, and then we should change it in C too.