Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1690486lqa; Mon, 29 Apr 2024 16:47:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXzqcZjiEvS+lIk2Dp56HcxPaNZuZbXU7ooSYCvCUzxBZNBOJRQHxgh3d0GUH/hvTkJEMu3IFjUlx84q7tLxC7NP8hHgmMMncJKjdUhmw== X-Google-Smtp-Source: AGHT+IHiZIgat1FPkU4YIJl/RBqcUSNhO1kM4vlna/+6V4vjO+A0frduSm3P5/VS/hDshY9JrskE X-Received: by 2002:a05:6870:7b52:b0:233:1901:7523 with SMTP id ji18-20020a0568707b5200b0023319017523mr13180631oab.55.1714434463720; Mon, 29 Apr 2024 16:47:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714434463; cv=pass; d=google.com; s=arc-20160816; b=jz450xtBBjIvOAiIoQ7YMXASySZGEo3903jqeso/1Kyzr4vWMt9blOo44UILwCwNCB 9MBzATXTVhefVenRm68ntSDU6PPHtm6QeZ6oK+QmfiQSQ5siey8PgRs2I2KJQy1MpLbV kH5n1gCEZUGKqcdFVXDggbGNi0EohYqR0I+rlHg4nT9+JitnmU7Brmk6Dby519jeV2Vy o/dDGrcHzoaoy0zKdZIgiVB/Qq1d07HcwASNil+MgR2V8VfIwOozFsXb14znrGzL5s1L 5gd3Gb5lwfhSG6dlDL/nEL4gRVnQrYxTs7xUksjUtCZVK1io5EXFaT8y7oVux30fNxJU cSBw== 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:dkim-signature; bh=neJzdRz9MNUmJ0r+KdRG51iWaNXVEV9Q2WvkNbVMuAo=; fh=dAzHnPySaVsc2F216PcyhuWf3SYZ3h/PiwaL+JqKo8s=; b=KdQZO6lG3dSyjG3zgDaxvFWnlkhnukwuEcO7B6lXvx6AbygG0ZlYhtUQ4d+djWOfyI IZCQ7W8XPnnM0SPJp2+zJMf7mfDvtbL75f9Z7tKVruvoeRyWTeCRsn2OlGXqO2GMAIWN ldtwKE++SIZvGqRk1OYD3IDOyt0OUc8Sk+lUMzVq036evw3glPB00Dv7bjoSiKTjCKFF mBv6gC2WYD+wPGV2vja0uIV9PnnpXDkFgJeKmXOmsz0a6eFo++0ZxkydaPOM0r4yZJx9 2qQTibd7hjEi9epSRIpV1MsshBwg0V6aQavrcttB789wFcWq/ZXQdRvtkuP6rNqGliCN n2og==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Jc0JoP+e; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-162909-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162909-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id h2-20020a056a00170200b006e629ca2803si21328431pfc.180.2024.04.29.16.47.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 16:47:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162909-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Jc0JoP+e; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-162909-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162909-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id EC68FB22BC8 for ; Mon, 29 Apr 2024 19:21:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 54D8713BAE9; Mon, 29 Apr 2024 19:21:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Jc0JoP+e" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 0923113AA3B; Mon, 29 Apr 2024 19:21:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714418496; cv=none; b=lbePcjylgjlyZkbmJM01kk1+M9d0CDZOYK1cWO7DC4L5bI/RC03LxkYKEwpHvulGmHCsh5mmlAK8gBcuJes2Fn+VT1mtYx2KATiuIw3ZMEJ9J5RMkTTbAd2XbXk36siEveHe08zL2mQm35Jbp1YkmgQAzTcaDBmPAEKcNfj+AhU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714418496; c=relaxed/simple; bh=jp0/hhNkqyvc+wcHZcmBPELue9y/n98F9TDt18ONk+w=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=lgAx6T7XRs0SE5R+TzH6KJH76qxmhcQTX/1yTowdZkvLepFo4m0zYpHaHj424KDCrbXdT3makDa/6hufNn8PzRPT2k3siMAjduvbPK5F05Z9gOMkv6kAVpdWg6AUs9bTg7VtCnLLFOob8F+e9QNnNbnxviwZhjjmr9DHRMF3wkA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=Jc0JoP+e; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org 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=neJzdRz9MNUmJ0r+KdRG51iWaNXVEV9Q2WvkNbVMuAo=; b=Jc0JoP+eKlc+BEPzMeneXAxsma j/OYXl9xWbSVrgWEs60bJmZmC5ymQ6SxfijEAStU0JqYGSMrjhQl6oNoCCKdGKJWUrSWku+ucHqTd PX1zm4qHityOpwJAN4lQlbZteHHAf1yVdNPaFECdf0EE0gXFMv7iJgeYnyrdgXnQBOwxRVi4j4q1K +NWVRPqo4iabfKD59KHwsIpvkgf1QQuiO/oAQl1F9jEZlKEvQhCb+NCFSPzmwkpI9i7cev5c5lHkB 6zsNABrfOfPUa8ebmNG6SglJtXXI0vKLoXXI5iLW3FpLMd/2fpU/w572XWrQS4/s+eomGeYpFOSvw sqIfsjmw==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1s1WYv-0000000D9vn-12aN; Mon, 29 Apr 2024 19:21:17 +0000 Date: Mon, 29 Apr 2024 20:21:17 +0100 From: Matthew Wilcox To: Kairui Song Cc: linux-mm@kvack.org, Andrew Morton , "Huang, Ying" , Chris Li , Barry Song , Ryan Roberts , Neil Brown , Minchan Kim , Hugh Dickins , David Hildenbrand , Yosry Ahmed , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 08/12] nfs: drop usage of folio_file_pos Message-ID: References: <20240429190500.30979-1-ryncsn@gmail.com> <20240429191138.34123-1-ryncsn@gmail.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: <20240429191138.34123-1-ryncsn@gmail.com> On Tue, Apr 30, 2024 at 03:11:34AM +0800, Kairui Song wrote: > +++ b/fs/nfs/file.c > @@ -588,7 +588,7 @@ static vm_fault_t nfs_vm_page_mkwrite(struct vm_fault *vmf) > > dfprintk(PAGECACHE, "NFS: vm_page_mkwrite(%pD2(%lu), offset %lld)\n", > filp, filp->f_mapping->host->i_ino, > - (long long)folio_file_pos(folio)); > + (long long)folio_pos(folio)); Yes, we can't call page_mkwrite() on a swapcache page. > +++ b/fs/nfs/nfstrace.h > @@ -960,7 +960,7 @@ DECLARE_EVENT_CLASS(nfs_folio_event, > __entry->fileid = nfsi->fileid; > __entry->fhandle = nfs_fhandle_hash(&nfsi->fh); > __entry->version = inode_peek_iversion_raw(inode); > - __entry->offset = folio_file_pos(folio); > + __entry->offset = folio_pos(folio); > __entry->count = nfs_folio_length(folio); > ), > > @@ -1008,7 +1008,7 @@ DECLARE_EVENT_CLASS(nfs_folio_event_done, > __entry->fileid = nfsi->fileid; > __entry->fhandle = nfs_fhandle_hash(&nfsi->fh); > __entry->version = inode_peek_iversion_raw(inode); > - __entry->offset = folio_file_pos(folio); > + __entry->offset = folio_pos(folio); These two I don't know about. > +++ b/fs/nfs/write.c > @@ -281,7 +281,7 @@ static void nfs_grow_file(struct folio *folio, unsigned int offset, > end_index = ((i_size - 1) >> folio_shift(folio)) << folio_order(folio); > if (i_size > 0 && folio_index(folio) < end_index) > goto out; > - end = folio_file_pos(folio) + (loff_t)offset + (loff_t)count; > + end = folio_pos(folio) + (loff_t)offset + (loff_t)count; This one concerns me. Are we sure we can't call nfs_grow_file() for a swapfile? > @@ -2073,7 +2073,7 @@ int nfs_wb_folio_cancel(struct inode *inode, struct folio *folio) > */ > int nfs_wb_folio(struct inode *inode, struct folio *folio) > { > - loff_t range_start = folio_file_pos(folio); > + loff_t range_start = folio_pos(folio); > loff_t range_end = range_start + (loff_t)folio_size(folio) - 1; Likewise here. Are we absolutely certain that swap I/O can't call this function?