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 9734BC433EF for ; Mon, 14 Feb 2022 23:32:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D6ABE6B0075; Mon, 14 Feb 2022 18:32:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D1A306B007B; Mon, 14 Feb 2022 18:32:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BBAE66B007D; Mon, 14 Feb 2022 18:32:46 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0135.hostedemail.com [216.40.44.135]) by kanga.kvack.org (Postfix) with ESMTP id A90D26B0075 for ; Mon, 14 Feb 2022 18:32:46 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 59523180AD837 for ; Mon, 14 Feb 2022 23:32:46 +0000 (UTC) X-FDA: 79142987532.29.DE2447A Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf26.hostedemail.com (Postfix) with ESMTP id 62455140005 for ; Mon, 14 Feb 2022 23:32:45 +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=eWlSu+1yEMZxgs6DAl2lTEtG63DuTn18CmEDUAxtQ2g=; b=vsUo4kKE0QMDlOtG2OD2St7Kc6 VIUNnhjac+vNRtA/M8hHCy39wOsHMCXd921sh1f1haptuacJ8902FVXt6pO0aHcJvJ0M7Zi/0RXCY 4n6hKXtpLnRjKK49F8UEA95M4XysidrRXwhJgpaixAWMj+FLTEEmF6TlSakb1lxyegZMtBTP3ZhXi Q1rpFW0MM+a0j9ATpPlyH8vhf4CrgBZ79ApFcABwxiIGyQ9FXecWTXLqkZppXB7cida9Rz8+yi74f WLP/j7s99hJ6gPYxIU4u3ERstZ8dOzchYCS5pXGDyiUpjeh5vFYROVOirlvGqj2qHktyumkC4Bt7k bznXFMiA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nJkpj-00DLRD-0T; Mon, 14 Feb 2022 23:32:39 +0000 Date: Mon, 14 Feb 2022 23:32:38 +0000 From: Matthew Wilcox To: John Hubbard Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 02/10] mm/truncate: Inline invalidate_complete_page() into its one caller Message-ID: References: <20220214200017.3150590-1-willy@infradead.org> <20220214200017.3150590-3-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=vsUo4kKE; dmarc=none; spf=none (imf26.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: rspam10 X-Rspamd-Queue-Id: 62455140005 X-Stat-Signature: 4iei587uymwhahhtru1mmuay5dg7efs5 X-HE-Tag: 1644881565-205942 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000011, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Feb 14, 2022 at 03:09:09PM -0800, John Hubbard wrote: > > @@ -309,7 +288,10 @@ int invalidate_inode_page(struct page *page) > > It would be nice to retain some of the original comments. May I suggest > this (it has an additional paragraph) for an updated version of comments > above invalidate_inode_page(): > > /* > * Safely invalidate one page from its pagecache mapping. > * It only drops clean, unused pages. The page must be locked. > * > * This function can be called at any time, and is not supposed to throw away > * dirty pages. But pages can be marked dirty at any time too, so use > * remove_mapping(), which safely discards clean, unused pages. > * > * Returns 1 if the page is successfully invalidated, otherwise 0. > */ By the end of this series, it becomes: /** * invalidate_inode_page() - Remove an unused page from the pagecache. * @page: The page to remove. * * Safely invalidate one page from its pagecache mapping. * It only drops clean, unused pages. * * Context: Page must be locked. * Return: The number of pages successfully removed. */ > Also, as long as you're there, a newline after the mapping declaration > would bring this routine into compliance with that convention. Again, by the end, we're at: struct folio *folio = page_folio(page); struct address_space *mapping = folio_mapping(folio); /* The page may have been truncated before it was locked */ if (!mapping) return 0; return mapping_shrink_folio(mapping, folio); > hmmm, now I wonder why this isn't a boolean function. And I think the > reason is that it's quite old. We could make this return a bool and have the one user that cares call folio_nr_pages(). I don't have a strong preference. > Either way, looks good: > > Reviewed-by: John Hubbard Thanks!