Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1770768ybk; Thu, 21 May 2020 15:04:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpv+uuYA6rm9WPN9FgDu+Tget5mkLGYwM5GDS5M5qmeAwwfOfQ4FlhhYbFTMFDgSOeqO9L X-Received: by 2002:a17:907:20c6:: with SMTP id qq6mr5415823ejb.194.1590098642067; Thu, 21 May 2020 15:04:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590098642; cv=none; d=google.com; s=arc-20160816; b=dPqCL/jDdorc26eROikesuw3V8tku+T7ZWgNad+v6cKNkySWV2MO27eLRn+SNn5j0p 9RzpjpkhSeqNF+LhQ6K7w6I0n9ooy5rtgsNaSS4ChOnJBdHPXmVN7eWeZJDNJA6oe4dJ 097tNd1UTlgc1IDz2oOPwRz11jl/WuNXlHFHeN1rdZRgq0lnvPl5JRaCArMFFtkhv62C bgeOXbXX9Io7t4vCiVQhZ9MDq7fRvsQhtFz5UTKNo8IvI5dXthbjKmHeBoF9g1+jxzxp dW9eU238OOPaeg6M4IC6u95i9q4+zjcGC4CvvTJA4RpYcQPeZ7siy7AgzIcp0tC1mAcz r7Wg== 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=712JEoD9Q+5DCelzu3ymh5fGm3LAwj8propyYUV/jPA=; b=KOEj+9+dAxvBDks70FwgOig7IQDXPbwCcSVRi/Z/eTFcSDau82AcYS09nj8aCIoN4v NeqdFhvUaMD1NJbo4IpSTPIH6BjswXGkDbeUYUMopvQC1b+qvp05jWhglKeRncIZpmxW OcA1KiXUrVJ5HriRx2w/XwBO19WTcb29GNt7zJwXFVFBY8qeDQWCTjC+bSllLNGihfLq HtdFMhEUs6ef5kzzbuG32bzRC7vfi/3VC1S85NU12PZLoSBxW/jYFe7zN0daA31ZWOcC TFIoCLL4kOB8hhBETzi1OHPCmXlrj5QO72sN1+1MFedMgSkVCHHIulbsjyNUeqnhP8yt Wn0Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c24si3836025ejm.745.2020.05.21.15.03.39; Thu, 21 May 2020 15:04:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730405AbgEUWBt (ORCPT + 99 others); Thu, 21 May 2020 18:01:49 -0400 Received: from mail104.syd.optusnet.com.au ([211.29.132.246]:52852 "EHLO mail104.syd.optusnet.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729308AbgEUWBs (ORCPT ); Thu, 21 May 2020 18:01:48 -0400 Received: from dread.disaster.area (pa49-195-157-175.pa.nsw.optusnet.com.au [49.195.157.175]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 2A8CF82075E; Fri, 22 May 2020 08:01:45 +1000 (AEST) Received: from dave by dread.disaster.area with local (Exim 4.92.3) (envelope-from ) id 1jbtFz-0000Vf-A3; Fri, 22 May 2020 08:01:39 +1000 Date: Fri, 22 May 2020 08:01:39 +1000 From: Dave Chinner To: Matthew Wilcox Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 10/36] fs: Make page_mkwrite_check_truncate thp-aware Message-ID: <20200521220139.GS2005@dread.disaster.area> References: <20200515131656.12890-1-willy@infradead.org> <20200515131656.12890-11-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200515131656.12890-11-willy@infradead.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.3 cv=X6os11be c=1 sm=1 tr=0 a=ONQRW0k9raierNYdzxQi9Q==:117 a=ONQRW0k9raierNYdzxQi9Q==:17 a=kj9zAlcOel0A:10 a=sTwFKg_x9MkA:10 a=JfrnYn6hAAAA:8 a=7-415B0cAAAA:8 a=KGgwbdxBNGb1bfa4TRwA:9 a=axUvvhqyyT9HjbU9:21 a=46PWhYHqkOUzt59A:21 a=CjuIK1q_8ugA:10 a=1CNFftbPRP8L7MoqJWF3:22 a=biEYGPWJfzWAr4FL6Ov7:22 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 15, 2020 at 06:16:30AM -0700, Matthew Wilcox wrote: > From: "Matthew Wilcox (Oracle)" > > If the page is compound, check the last index in the page and return > the appropriate size. Change the return type to ssize_t in case we ever > support pages larger than 2GB. > > Signed-off-by: Matthew Wilcox (Oracle) > --- > include/linux/pagemap.h | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h > index 1a0bb387948c..c75d7fb7ccbc 100644 > --- a/include/linux/pagemap.h > +++ b/include/linux/pagemap.h > @@ -827,22 +827,22 @@ static inline unsigned long dir_pages(struct inode *inode) > * @page: the page to check > * @inode: the inode to check the page against > * > - * Returns the number of bytes in the page up to EOF, > + * Return: The number of bytes in the page up to EOF, > * or -EFAULT if the page was truncated. > */ > -static inline int page_mkwrite_check_truncate(struct page *page, > +static inline ssize_t page_mkwrite_check_truncate(struct page *page, > struct inode *inode) > { > loff_t size = i_size_read(inode); > pgoff_t index = size >> PAGE_SHIFT; > - int offset = offset_in_page(size); > + unsigned long offset = offset_in_thp(page, size); > > if (page->mapping != inode->i_mapping) > return -EFAULT; > > /* page is wholly inside EOF */ > - if (page->index < index) > - return PAGE_SIZE; > + if (page->index + hpage_nr_pages(page) - 1 < index) > + return thp_size(page); Can we make these interfaces all use the same namespace prefix? Here we have a mix of thp and hpage and I have no clue how hpages are different to thps. If they refer to the same thing (i.e. huge pages) then can we please make the API consistent before splattering it all over the filesystem code? Cheers, Dave. -- Dave Chinner david@fromorbit.com