Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp926828ybl; Fri, 9 Aug 2019 16:32:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqyg896EiY2jR2mDWZo6P6zyGw3++0y9dC2pSUjnCSvDJsZRXqsBwbeP1Tx3VEc/7Yx0cbmT X-Received: by 2002:a17:90b:d8b:: with SMTP id bg11mr11935238pjb.30.1565393539564; Fri, 09 Aug 2019 16:32:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565393539; cv=none; d=google.com; s=arc-20160816; b=xlxxR+EmOT+Xna4cG5xhc77SQWaCcsHdEOkhGXD62YzNv0ksLZrbCyE10TYNbX4gLy VLKIXy4dqkUvDR8hVd2zqOYrfOeURvQfobpOEpckF+EcqMDiu7B0fvjuUH2vPPj6xqNZ du4tuTZOz6nsqw+5k+71dvXFVMymr+uYkkyt0wbt6Et6MivRYlKH6JDAYXXqq5Rr9nUZ XgHucNuKiF/uSDP0CrX0BCThOJkxPclOoKNCpfPnRuhdsK+NLsvXtjF9q9v3MhT0hggT OOXvWdTxf7RhXDRo80XMd5dLDKMO/gICr5HWjYf+N4jNoicZ4+PZ0QHKU3YdeEdsBOuP zr3A== 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=VZqSj6TN0PrnZvnLK23CMSZjNWa6hNovkYWw1h0gFbk=; b=Yv7EyB8tjK9N2a/5BTHPO74+7QcPjgDWy3pXbd8k4FVgGGAl2ZkHZsr6uMGJ0QOYQq s2omHcQBT81C1JRlJLGsH0QAAOKL05r5oCLWTzecdE+TvNsxBkNlX8xc69djGByQuDkx OvnP/vYMygJDIxBrQvQ7lGj05OV6DtBPyPO4Q3Imml+b2fAfiFM92r9qPNtDv4JRkOSq SnvRuiVm9xqmsPlFtwOHs82i4uNyoh6hdosMOdqx6qR+qwJRtfoOuGKXQqWG/YwcWDlc F4zif75jJ/mBbEu+uKJiLu7ruEF1c6XIo9MGieMqLWi2Zr5eOLTiCdlAezjTlPFuKAqV 2RcQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o71si5393820pjb.8.2019.08.09.16.32.04; Fri, 09 Aug 2019 16:32:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-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-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726137AbfHIXbt (ORCPT + 99 others); Fri, 9 Aug 2019 19:31:49 -0400 Received: from mail105.syd.optusnet.com.au ([211.29.132.249]:60305 "EHLO mail105.syd.optusnet.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726053AbfHIXbt (ORCPT ); Fri, 9 Aug 2019 19:31:49 -0400 X-Greylist: delayed 504 seconds by postgrey-1.27 at vger.kernel.org; Fri, 09 Aug 2019 19:31:47 EDT Received: from dread.disaster.area (pa49-181-167-148.pa.nsw.optusnet.com.au [49.181.167.148]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id CE576364A0D; Sat, 10 Aug 2019 09:31:44 +1000 (AEST) Received: from dave by dread.disaster.area with local (Exim 4.92) (envelope-from ) id 1hwELF-0001Z4-7E; Sat, 10 Aug 2019 09:30:37 +1000 Date: Sat, 10 Aug 2019 09:30:37 +1000 From: Dave Chinner To: ira.weiny@intel.com 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: <20190809233037.GB7777@dread.disaster.area> References: <20190809225833.6657-1-ira.weiny@intel.com> <20190809225833.6657-8-ira.weiny@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190809225833.6657-8-ira.weiny@intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=P6RKvmIu c=1 sm=1 tr=0 a=gu9DDhuZhshYSb5Zs/lkOA==:117 a=gu9DDhuZhshYSb5Zs/lkOA==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=FmdZ9Uzk2mMA:10 a=QyXUC8HyAAAA:8 a=7-415B0cAAAA:8 a=Goxn531fkllQGndbsM8A:9 a=CjuIK1q_8ugA:10 a=biEYGPWJfzWAr4FL6Ov7:22 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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, and truncate down needs to extend to "maximum file offset" because we remove all extents beyond EOF on a truncate down. 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... Cheers, Dave. -- Dave Chinner david@fromorbit.com