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 909A0C433EF for ; Fri, 3 Dec 2021 16:32:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 108B36B0073; Fri, 3 Dec 2021 11:32:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0B8826B0074; Fri, 3 Dec 2021 11:32:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EC1B06B0075; Fri, 3 Dec 2021 11:31:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0018.hostedemail.com [216.40.44.18]) by kanga.kvack.org (Postfix) with ESMTP id DA2D06B0073 for ; Fri, 3 Dec 2021 11:31:59 -0500 (EST) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 9761E184B2F35 for ; Fri, 3 Dec 2021 16:31:49 +0000 (UTC) X-FDA: 78877024338.24.40350CA Received: from mail-io1-f41.google.com (mail-io1-f41.google.com [209.85.166.41]) by imf08.hostedemail.com (Postfix) with ESMTP id C799930000B3 for ; Fri, 3 Dec 2021 16:31:51 +0000 (UTC) Received: by mail-io1-f41.google.com with SMTP id m9so4522529iop.0 for ; Fri, 03 Dec 2021 08:31:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20210112.gappssmtp.com; s=20210112; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ZcsX6oN4wS3zxJ3zo+xbdu1vWpMx9AGIYv2p8B7anf4=; b=J39C5XMln9NSv4mKVH0f60Rj2Tni4VHIJgOixZw0aVawRw1TM4FWwNnO1VBv0UeeXI urieMrjLrysvTC3/aEvrK38PCTJnmWqzxHLoXy6DmYyygPktD5kApE0mlI3fURGolGh9 Px6IPzaQbZ9JjEscJPMbBpevvEfrNpmYjBSwKLCtTdt/Tey0sk6MeNKXEdhquFs7C2iP wWiuW48nmOMG4Mp5pZTKHzqh1qyxM95YsRswWPwqrxJgED6kV9UYT0MJGV5tzqQr/Gak fjl3PmBv/eXcxNEaFptCn6834WUww/2d+KGNwL2lVFkxSV2CA6u6I1I3KnJk4Y33Fyw/ F+xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ZcsX6oN4wS3zxJ3zo+xbdu1vWpMx9AGIYv2p8B7anf4=; b=5LU9S+Vt7UShHgC0BBLlJ1vZ+FnFZFvpS5ICW5arm08uDYToxX3v1YKL63qbOFUjDC 61+6stJc7gkJi0fgGC0Z3W4pOkeBTZXo5dhqizQsBy+qmLtYA92w0t3tql5fu/l28Xmr HmJ1jk1NWL8/5JQvRPwt/mY4bJv2bQ3VAGuZZB9/cJ4WKvXXDE+iI0h9cTNcmNVrRrWH vwzqL4tb5sSbQjWnT7tOkbEjFaAAXrlc7tD/6Do7ZIwCznMFRay+Ud9gQzwrt8W1EwI0 Y7eYoASfKWq6Vt4lDpxew+86LdbTgqMLeSQhCODtoYTqQ60QyiKqiavIWqheGe136bgu ca2w== X-Gm-Message-State: AOAM530DsitPb5AUoWkB4b/pCKYQT4V19H8xGRmZZaw69T7msLYtZHOW XbSNlFXOF462fpRENul1Gd6H3iGViMzZ0cx7 X-Google-Smtp-Source: ABdhPJwXBcVITgjbtxedzF/PeDC+NWPIrYNnBdxaRzCwCahRYAUIGGze/XL0MK4m2FkN1edpilU6/A== X-Received: by 2002:a05:6602:42:: with SMTP id z2mr22055851ioz.208.1638549107877; Fri, 03 Dec 2021 08:31:47 -0800 (PST) Received: from [192.168.1.30] ([207.135.234.126]) by smtp.gmail.com with ESMTPSA id 11sm1982828ilq.23.2021.12.03.08.31.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 03 Dec 2021 08:31:47 -0800 (PST) Subject: Re: [PATCH 1/2] mm: move filemap_range_needs_writeback() into header From: Jens Axboe To: Matthew Wilcox Cc: linux-block@vger.kernel.org, linux-mm@kvack.org References: <20211203153829.298893-1-axboe@kernel.dk> <20211203153829.298893-2-axboe@kernel.dk> Message-ID: <5e92c117-0cdb-9ea6-3f1c-912e683c4e51@kernel.dk> Date: Fri, 3 Dec 2021 09:31:47 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: C799930000B3 X-Stat-Signature: 5pb7guwgj9zktb8ccx6bxh14zwdwe487 Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=kernel-dk.20210112.gappssmtp.com header.s=20210112 header.b=J39C5XMl; spf=pass (imf08.hostedemail.com: domain of axboe@kernel.dk designates 209.85.166.41 as permitted sender) smtp.mailfrom=axboe@kernel.dk; dmarc=none X-HE-Tag: 1638549111-794862 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 12/3/21 9:24 AM, Jens Axboe wrote: > On 12/3/21 9:16 AM, Matthew Wilcox wrote: >> 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. > > Good idea, I'll make that change. That does introduce a dependency from fs.h -> pagemap.h which isn't trivially resolvable... What if we just rename the above funciton to mapping_has_pages() or something instead? -- Jens Axboe