Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1594891rbb; Mon, 26 Feb 2024 15:00:21 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUt15QiIQ+L8OTbn6Vv8401pA6iIaxtuI14+aGleAaPxuVLcVqzK3I+fLR3xhClbn9R0E3GwWH44LqbTpjQ8JFSMv5PoRjsZsGFocWPTA== X-Google-Smtp-Source: AGHT+IFnSLsQtlTQi9logMSDDjeyLqVfuv4LwrVPLawINSibgmKiC5pygMIOKKGiY455DMzhmto6 X-Received: by 2002:a5b:7cf:0:b0:dc6:4baa:cff8 with SMTP id t15-20020a5b07cf000000b00dc64baacff8mr561234ybq.43.1708988420811; Mon, 26 Feb 2024 15:00:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708988420; cv=pass; d=google.com; s=arc-20160816; b=I0iihb8vzgx3bZFpVZ0JszbjXO+VyaHr54yEtiSsbWkkphkbaB3/J1XAYBhexw+lXv yC1i5Uu3VjSVd59wSzWCzB9o+0gcEw7b4wrLU8sZvZ0+bvnzGorHrs7xFPLZLGSsYyWi 0GNZZ4m8EBfcOEE/7jhM/3ngreMuDQhgz9of0z1TPAw8jW5ZCSvxkCnCjYJaAKet0P99 hUYYW9Dp0/bbU7Y+51/Y2AZIBDjHTt10l9HdLVWvIba+PQglqpk86hiamLPPukM7TMwZ +9EsajUebXF1RPHkEJInYOkepZygUQXYorXZRTdmiqm1fivBeoi+csRymcP5UIEykEGY iNng== 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:sender:dkim-signature; bh=Zww+OwBsoYB5pURroMSrOkz/ZQvrjX3VS1JUC45kLpM=; fh=XK2wawOac/PN8UWYuzbWv68b6x4FfwQk3apx2IhYSS0=; b=OVcJ+GlhbGwE94IgyaFoc93HxblQj5m155TYvyF9LYFH3KU//KUd7x8t5pPeXFgtc4 3BkWsY8yjMu4PbUpmA4lLPL3a3EHzl3YQT4b85N+4xDXVIxMzxlvVAN9mlJchHXwEeUO FclGyL9KMcr/xp6ol7YBndvkEMeRaTr8yKzvRP3FyxpSiwtrV52Q4+vvZr18A885uN1q 1cJln5OznUJQ3O9UL2BIy1UjuM8CTomSXb8B6Ei8cBSV8apJTTsVGe3ABLsBuWXrri3M 70OMtAYQ4yls0SYp6oLJxyqgkGj3vD9iLW8nWb/GAGHBSxhxn1WgEeZVHgKKGVyajvVY tIbQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=WZv8aGO6; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-82428-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82428-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 f5-20020ac84645000000b0042e7f5eb8e2si3886781qto.388.2024.02.26.15.00.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 15:00:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82428-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=@gmail.com header.s=20230601 header.b=WZv8aGO6; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-82428-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82428-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 A7E7F1C2134D for ; Mon, 26 Feb 2024 23:00:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 10C5C135A54; Mon, 26 Feb 2024 23:00:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WZv8aGO6" Received: from mail-oo1-f49.google.com (mail-oo1-f49.google.com [209.85.161.49]) (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 57B49134CE3; Mon, 26 Feb 2024 23:00:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708988406; cv=none; b=oZLmMK7GrMs5bbjM/46RRU+bxFz2fwhBkZT5250AtoNFp+l9A57uLdZJiai0VvGQp7zFEHXJM8BiRMy1Ls7919ztyugNnYbVkaahCCi/53x2i0p7fKo34AmyWwcB+CS2r3+04KV4w6NZvgKnzSBLpzrqeovfl0LKdper3RD165Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708988406; c=relaxed/simple; bh=eDdDRpRLOs+TLu9DRUmMhRRpoJ/GPPb+1lbirKhJPXU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=t3SnwahZQIC9R8FhKxfQbEyzEbxovNP+LfwQkuyJSC0rhn6UAum09gvOesxyFhd+OhVppxHkQFNPcYxHvKUueJbfJx6LXLij6gm3bK6Y+QDsSYCYFQc/bYPI595xWH1kuPcCXV1aa2j8kzHnrP9mtVqEdsBVMY28L/xGWKWaYJE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=groves.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=WZv8aGO6; arc=none smtp.client-ip=209.85.161.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=groves.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oo1-f49.google.com with SMTP id 006d021491bc7-5a054fa636eso2001859eaf.0; Mon, 26 Feb 2024 15:00:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708988403; x=1709593203; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=Zww+OwBsoYB5pURroMSrOkz/ZQvrjX3VS1JUC45kLpM=; b=WZv8aGO6ryajzFRToQ2E9JUurbQjzqasuLOOQjViyK/CUZQ3tTji+DbKD93jlap9LL c67tsyu7ZYu6VvbSIBCZiqN9yEzx2dUPOBRJHzwiq3Uxoh5bZdVz1lt3af5zpIf59sbH RGIpzG/GMNJHyzRwwWakqgZAFN7NBhRer2ui4llSiW2n62Jx/nGd+e0Xer+6O4Azhjcf NLXvwpM5ajaQ3MMGKJiVyYiAR05TwBR57XqfKsPPMVtGDJWgdQ+J/zPieYmGLGwNxmSq +DOUYP6eZoNMJotduP9iaSXJc0/RMB4DWPRS6pooqwxr1rOKQuwBeNIfQI5qm8/PxELJ 26PQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708988403; x=1709593203; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Zww+OwBsoYB5pURroMSrOkz/ZQvrjX3VS1JUC45kLpM=; b=seBhbM+1W480hFZFbbeS4+zNAPMhcoVGbbQ0QlE9AhYbB6w52Ehvdlzb8/kSM3YRq2 wCXNxa0IvPDzJYDbnEabMbsYMAMaRPXpX3akhfhloXqAZ9Hf8XMLiMy6uiQ7OEbgkzZj D9Si1h+e/Fo2o/nVqQs+MahDcdgTb4rStC2IYDC4p94WJYUr0wfg/wEeJP1OUPkyOk2+ Wo2Ik+QRMdNEHd+6CN+cII3gKj5j6azzTznu8qVsdjQ1RERIEXihWF9w9QnnpFTH826T l+pZAhD+wprhsM55Amw5K5m4N+1/BNudQBV6Oxu8tfuGjYWgS5rNUr2pomhKjKLIZaX/ PmdQ== X-Forwarded-Encrypted: i=1; AJvYcCVTZCBPUfMFvAWFyVw1Oh7QFD19cZLxfvEpbwzIpuZZvZbPRepuy847zByakFLH1+nEYlbyxtubmMnoslj88smdV5oFcR75txp6dJVjMPua1GBvxY2sbIkn4GcgESnrTj7xJvooQ80vd99kHepY8udXStSrsGoGnVR6kmMs+4fxtNRvfJ2MKGrEaL7uTo9FPWWHuISZund0eOa8SK6+YDuSSw== X-Gm-Message-State: AOJu0YzgX5aPXutSkN859xcSvqc84MVcaXH/A5nZnUf4/8WnZBuAftoq oCTtEcChH6pGLKsZL5U6ekKoLqsPycOMDXBA4l+/b1HZuHs03BWbbNmFNBJyNcM= X-Received: by 2002:a05:6820:2c07:b0:5a0:651d:4238 with SMTP id dw7-20020a0568202c0700b005a0651d4238mr5467910oob.2.1708988403399; Mon, 26 Feb 2024 15:00:03 -0800 (PST) Received: from Borg-9.local (070-114-203-196.res.spectrum.com. [70.114.203.196]) by smtp.gmail.com with ESMTPSA id ej5-20020a0568200d0500b005a06c8ecf54sm1135729oob.25.2024.02.26.15.00.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 15:00:03 -0800 (PST) Sender: John Groves Date: Mon, 26 Feb 2024 17:00:00 -0600 From: John Groves To: Jonathan Cameron Cc: John Groves , Jonathan Corbet , Dan Williams , Vishal Verma , Dave Jiang , Alexander Viro , Christian Brauner , Jan Kara , Matthew Wilcox , linux-cxl@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, nvdimm@lists.linux.dev, john@jagalactic.com, Dave Chinner , Christoph Hellwig , dave.hansen@linux.intel.com, gregory.price@memverge.com Subject: Re: [RFC PATCH 13/20] famfs: Add iomap_ops Message-ID: References: <2996a7e757c3762a9a28c789645acd289f5f7bc0.1708709155.git.john@groves.net> <20240226133038.00006e23@Huawei.com> 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: <20240226133038.00006e23@Huawei.com> On 24/02/26 01:30PM, Jonathan Cameron wrote: > On Fri, 23 Feb 2024 11:41:57 -0600 > John Groves wrote: > > > This commit introduces the famfs iomap_ops. When either > > dax_iomap_fault() or dax_iomap_rw() is called, we get a callback > > via our iomap_begin() handler. The question being asked is > > "please resolve (file, offset) to (daxdev, offset)". The function > > famfs_meta_to_dax_offset() does this. > > > > The per-file metadata is just an extent list to the > > backing dax dev. The order of this resolution is O(N) for N > > extents. Note with the current user space, files usually have > > only one extent. > > > > Signed-off-by: John Groves > > > --- > > fs/famfs/famfs_file.c | 245 ++++++++++++++++++++++++++++++++++++++++++ > > 1 file changed, 245 insertions(+) > > create mode 100644 fs/famfs/famfs_file.c > > > > diff --git a/fs/famfs/famfs_file.c b/fs/famfs/famfs_file.c > > new file mode 100644 > > index 000000000000..fc667d5f7be8 > > --- /dev/null > > +++ b/fs/famfs/famfs_file.c > > @@ -0,0 +1,245 @@ > > > +static int > > +famfs_meta_to_dax_offset( > > + struct inode *inode, > > + struct iomap *iomap, > > + loff_t offset, > > + loff_t len, > > + unsigned int flags) > > +{ > > + struct famfs_file_meta *meta = (struct famfs_file_meta *)inode->i_private; > > i_private is void * so no need for explicit cast (C spec says this is always fine without) Yessir. > > > > + > > +/** > > + * famfs_iomap_begin() > > + * > > + * This function is pretty simple because files are > > + * * never partially allocated > > + * * never have holes (never sparse) > > + * * never "allocate on write" > > + */ > > +static int > > +famfs_iomap_begin( > > + struct inode *inode, > > + loff_t offset, > > + loff_t length, > > + unsigned int flags, > > + struct iomap *iomap, > > + struct iomap *srcmap) > > +{ > > + struct famfs_file_meta *meta = inode->i_private; > > + size_t size; > > + int rc; > > + > > + size = i_size_read(inode); > > + > > + WARN_ON(size != meta->file_size); > > + > > + rc = famfs_meta_to_dax_offset(inode, iomap, offset, length, flags); > > + > > + return rc; > return famfs_meta_... Done > > > +} > > > > +static vm_fault_t > > +famfs_filemap_map_pages( > > + struct vm_fault *vmf, > > + pgoff_t start_pgoff, > > + pgoff_t end_pgoff) > > +{ > > + vm_fault_t ret; > > + > > + ret = filemap_map_pages(vmf, start_pgoff, end_pgoff); > > + return ret; > return filename_map_pages().... Done, thanks John