From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89674C433F5 for ; Mon, 30 May 2022 12:35:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C78776B0071; Mon, 30 May 2022 08:35:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C237B6B0072; Mon, 30 May 2022 08:35:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B15356B0073; Mon, 30 May 2022 08:35:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id A30AB6B0071 for ; Mon, 30 May 2022 08:35:38 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 6F7A1114D for ; Mon, 30 May 2022 12:35:38 +0000 (UTC) X-FDA: 79522355556.10.E5BAEFD Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf28.hostedemail.com (Postfix) with ESMTP id 64C39C0058 for ; Mon, 30 May 2022 12:35:00 +0000 (UTC) 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=dFSvQ2p+PYCQYBpVQZ7x7gApgkNJyLuRaXgrYRdhROg=; b=Qc4vcR6+59jwit6jmTm/TVBbDF Q+Now18yJlb9I2tQeWyYZxEIu6xZYjCIAMATc21+USERvL9YKLDk5dz+Wrl0r8Dh5LQJRfOKJbOEn uDHFI8m5xTgoX0traET9cbYuSIG2Nd14NqMH7hLnrQHhuY5ntSefnoQa61UEq7fgCXj1o1WaAIenF 9beiDr9MzTGOZJGHVuFwyJ9IgGLmJDY4K6V1H02m6GVyTK3+4UMXl/HxoEs5jjA1y98ogtzeN0HGx 5Q9EDDbJtIohcL5Mi03F2+Tetg+Seij30a0tUt0mY4kcyEPel7wDBv6pSXXFGL4j9Sk612nTHakhw qI8yMDew==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nvecO-004TDL-QB; Mon, 30 May 2022 12:35:32 +0000 Date: Mon, 30 May 2022 13:35:32 +0100 From: Matthew Wilcox To: Christoph Hellwig Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 14/24] remap_range: Remove check of uptodate flag Message-ID: References: <20220527155036.524743-1-willy@infradead.org> <20220527155036.524743-15-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=Qc4vcR6+; dmarc=none; spf=none (imf28.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 64C39C0058 X-Stat-Signature: 5x9g7ccswnf5xn5htzdo1zy578wca3fb X-HE-Tag: 1653914100-220824 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, May 27, 2022 at 10:59:03PM -0700, Christoph Hellwig wrote: > On Fri, May 27, 2022 at 04:50:26PM +0100, Matthew Wilcox (Oracle) wrote: > > read_mapping_folio() returns an ERR_PTR if the folio is not > > uptodate, so this check is simply dead code. > > Looks good: > > Reviewed-by: Christoph Hellwig > > > /* Read a page's worth of file data into the page cache. */ > > static struct folio *vfs_dedupe_get_folio(struct file *file, loff_t pos) > > { > > + return read_mapping_folio(file->f_mapping, pos >> PAGE_SHIFT, file); > > } > > But I wonder if this isn't useful enough to go to filemap.c in one form > or another. It looks like it should be, but most in-kernel users of read_mapping_folio() and its friends want to pass NULL for file as they don't have an open file. Indeed, this code used to until I realised we actually do have open files here, so should pass them. I don't think it affects anything; the only users who need the struct file are network filesystems, and nobody does dedupe across the network. If it's not done transparently by the server, it's an obvious server offload operation.