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 94EDDC433F5 for ; Fri, 3 Dec 2021 16:17:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E868D6B0073; Fri, 3 Dec 2021 11:17:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E35CD6B0074; Fri, 3 Dec 2021 11:17:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D24D86B0075; Fri, 3 Dec 2021 11:17:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0217.hostedemail.com [216.40.44.217]) by kanga.kvack.org (Postfix) with ESMTP id BFCAB6B0073 for ; Fri, 3 Dec 2021 11:17:07 -0500 (EST) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 83AB685D54 for ; Fri, 3 Dec 2021 16:16:57 +0000 (UTC) X-FDA: 78876986874.28.57C31E7 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf25.hostedemail.com (Postfix) with ESMTP id 3D29BB000187 for ; Fri, 3 Dec 2021 16:16:56 +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=z5lBZX9MrCtSgBxcdrFbiXIPCPltTB5SEppdL+CtI5s=; b=WT3vXA/jKvgz7yn6wK1ZtFRz8s iVMqFKwQZv6Ww0lbYQkqNFGSpSIUFmK+6IxLMpZe9bHtV/Ligi3BsudrFzfX9LwiILs2iigvf6nGJ e1wV9ri53sgZfuGb9CsWUAtIO/+trNQuX1ERIdT5v9SlaBPrbQzPSI7eOQPJyi7zsKsW2viYnS+VH 4PI+XKlfBQbSSl8FDT87pTy2EPgHcMtglGYsD5zAoa1gZ7S2ifXRmV9VvdLlcD3w/kDdYMNR7AufJ q79O/Q/Tsx+BE2UvmlVG0Wbx/QmJuTscZOzuoXpFMWUTUIlhru3WMTbA3WQgb5p+AOoW60lN2aiDF w456jtNQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mtBEz-009KtR-T8; Fri, 03 Dec 2021 16:16:54 +0000 Date: Fri, 3 Dec 2021 16:16:53 +0000 From: Matthew Wilcox To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 1/2] mm: move filemap_range_needs_writeback() into header Message-ID: References: <20211203153829.298893-1-axboe@kernel.dk> <20211203153829.298893-2-axboe@kernel.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211203153829.298893-2-axboe@kernel.dk> X-Rspamd-Queue-Id: 3D29BB000187 Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="WT3vXA/j"; spf=none (imf25.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-Rspamd-Server: rspam04 X-Stat-Signature: e6dfk9a7oar9gmh3fueh9f95tin8y9fb X-HE-Tag: 1638548216-350830 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, Dec 03, 2021 at 08:38:28AM -0700, Jens Axboe wrote: > +++ b/include/linux/fs.h fs.h is the wrong place for these functions; they're pagecache functionality, so they should be in pagemap.h. > +/* Returns true if writeback might be needed or already in progress. */ > +static inline bool mapping_needs_writeback(struct address_space *mapping) > +{ > + return mapping->nrpages; > +} I don't like this function -- mapping_needs_writeback says to me that it tests a flag in mapping->flags. Plus, it does exactly the same thing as !mapping_empty(), so perhaps ... > +static inline bool filemap_range_needs_writeback(struct address_space *mapping, > + loff_t start_byte, > + loff_t end_byte) > +{ > + if (!mapping_needs_writeback(mapping)) > + return false; just make this if (mapping_empty(mapping)) return false; Other than that, no objections to making this static inline.