Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp27490ybl; Mon, 12 Aug 2019 11:06:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqz12KtoTkH0dXj3GfmEJIb4fVr5Zyx89aW31pex7j8yutf3DrPnEjOC68lTO2SUwNO4AtaU X-Received: by 2002:aa7:968d:: with SMTP id f13mr11288087pfk.223.1565633209622; Mon, 12 Aug 2019 11:06:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565633209; cv=none; d=google.com; s=arc-20160816; b=aHjqnB9BeVys5BZ4wlpMIJNScrbXRcvTvy37hk1DA2gX9Pq5iDWaTwXSjrXxpoEKAz q66u34MuGZPPR8T9XVx6ncXKTk4ZYtRTzoy+7CjD+kzkIp6XIQphgbKunveb9oPEoD40 a7bFrzWiCBgt98nY81RMRa36eonO5HrAiUKc6FTDRgEbbGbvlwG7//TBMz1NgzW31dL3 wSBjSs9qPD+um788Y+QQDutSuc5zj990+OXLfSokEtElt4JzcassmRPuaQ2HB/6p6Ydm BluHot4Y4fzvrCSifz27zzdMy+91+VuQ73qpAKhoY1YkoDp2Sl7psGXKn3pQtoOZqUnA wMgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=knOm15ELluRYL0BGNYrfuncPSVkNPo3m3JSigFYXnxQ=; b=TJpc0LxbDojOFYRo3GeUxE+pTdBEcVCPge9Nr9V2RBnNjBZXvYhkfVfNudQXMkfLuR 2MZxjiWggpNMLs/T2I0mJTUFJOVXch6GlAdMmUNi2VmxDhtPshW7d7M7lN9dB13Nsww0 7pgYOGtFL3SHVuz+QdqZ+U7qP68wuVZox7StrELdD2zLufU/hdT37eMCxW/06U7LYpay 7DqX0CzDXUwrjeBv4SM8iswKBeHiiSofqsXr1LFhezaPXm81ZjeGwGLt3ffTBjHcmX7s OnoUQg7Z+ah2Qe8T/j3ScvWaidsPHtVVuAD9F9NmkF2PmCgveUavXGbZfVaNKEzjMo1h 7uPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 83si65260799pgc.207.2019.08.12.11.06.32; Mon, 12 Aug 2019 11:06:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726677AbfHLSF4 (ORCPT + 99 others); Mon, 12 Aug 2019 14:05:56 -0400 Received: from mga01.intel.com ([192.55.52.88]:56621 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726236AbfHLSF4 (ORCPT ); Mon, 12 Aug 2019 14:05:56 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Aug 2019 11:05:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,378,1559545200"; d="scan'208";a="177558391" Received: from iweiny-desk2.sc.intel.com ([10.3.52.157]) by fmsmga007.fm.intel.com with ESMTP; 12 Aug 2019 11:05:51 -0700 Date: Mon, 12 Aug 2019 11:05:51 -0700 From: Ira Weiny To: Dave Chinner Cc: Andrew Morton , Jason Gunthorpe , Dan Williams , Matthew Wilcox , Jan Kara , Theodore Ts'o , John Hubbard , Michal Hocko , linux-xfs@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-nvdimm@lists.01.org, linux-ext4@vger.kernel.org, linux-mm@kvack.org Subject: Re: [RFC PATCH v2 07/19] fs/xfs: Teach xfs to use new dax_layout_busy_page() Message-ID: <20190812180551.GC19746@iweiny-DESK2.sc.intel.com> References: <20190809225833.6657-1-ira.weiny@intel.com> <20190809225833.6657-8-ira.weiny@intel.com> <20190809233037.GB7777@dread.disaster.area> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190809233037.GB7777@dread.disaster.area> User-Agent: Mutt/1.11.1 (2018-12-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Aug 10, 2019 at 09:30:37AM +1000, Dave Chinner wrote: > On Fri, Aug 09, 2019 at 03:58:21PM -0700, ira.weiny@intel.com wrote: > > From: Ira Weiny > > > > dax_layout_busy_page() can now operate on a sub-range of the > > address_space provided. > > > > Have xfs specify the sub range to dax_layout_busy_page() > > Hmmm. I've got patches that change all these XFS interfaces to > support range locks. I'm not sure the way the ranges are passed here > is the best way to do it, and I suspect they aren't correct in some > cases, either.... > > > diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c > > index ff3c1fae5357..f0de5486f6c1 100644 > > --- a/fs/xfs/xfs_iops.c > > +++ b/fs/xfs/xfs_iops.c > > @@ -1042,10 +1042,16 @@ xfs_vn_setattr( > > xfs_ilock(ip, XFS_MMAPLOCK_EXCL); > > iolock = XFS_IOLOCK_EXCL | XFS_MMAPLOCK_EXCL; > > > > - error = xfs_break_layouts(inode, &iolock, BREAK_UNMAP); > > - if (error) { > > - xfs_iunlock(ip, XFS_MMAPLOCK_EXCL); > > - return error; > > + if (iattr->ia_size < inode->i_size) { > > + loff_t off = iattr->ia_size; > > + loff_t len = inode->i_size - iattr->ia_size; > > + > > + error = xfs_break_layouts(inode, &iolock, off, len, > > + BREAK_UNMAP); > > + if (error) { > > + xfs_iunlock(ip, XFS_MMAPLOCK_EXCL); > > + return error; > > + } > > This isn't right - truncate up still needs to break the layout on > the last filesystem block of the file, I'm not following this? From a user perspective they can't have done anything with the data beyond the EOF. So isn't it safe to allow EOF to grow without changing the layout of that last block? > and truncate down needs to > extend to "maximum file offset" because we remove all extents beyond > EOF on a truncate down. Ok, I was trying to allow a user to extend the file without conflicts if they were to have a pin on the 'beginning' of the original file. This sounds like you are saying that a layout lease must be dropped to do that? In some ways I think I understand what you are driving at and I think I see how I may have been playing "fast and loose" with the strictness of the layout lease. But from a user perspective if there is a part of the file which "does not exist" (beyond EOF) does it matter that the layout there may change? > > i.e. when we use preallocation, the extent map extends beyond EOF, > and layout leases need to be able to extend beyond the current EOF > to allow the lease owner to do extending writes, extending truncate, > preallocation beyond EOF, etc safely without having to get a new > lease to cover the new region in the extended file... I'm not following this. What determines when preallocation is done? Forgive my ignorance on file systems but how can we have a layout for every file which is "maximum file offset" for every file even if a file is only 1 page long? Thanks, Ira > > Cheers, > > Dave. > -- > Dave Chinner > david@fromorbit.com