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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4723FC433F5 for ; Mon, 14 Feb 2022 23:32:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229880AbiBNXcx (ORCPT ); Mon, 14 Feb 2022 18:32:53 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:53234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232163AbiBNXcw (ORCPT ); Mon, 14 Feb 2022 18:32:52 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FA3C10AEFF for ; Mon, 14 Feb 2022 15:32:41 -0800 (PST) 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: Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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!