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 ABE8BC38A2D for ; Mon, 24 Oct 2022 19:42:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0515D940009; Mon, 24 Oct 2022 15:42:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0015B940007; Mon, 24 Oct 2022 15:42:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E328C940009; Mon, 24 Oct 2022 15:42:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id D39ED940007 for ; Mon, 24 Oct 2022 15:42:52 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 97C14C02CC for ; Mon, 24 Oct 2022 19:42:52 +0000 (UTC) X-FDA: 80056865784.16.FC6902A Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf24.hostedemail.com (Postfix) with ESMTP id 3264718000C for ; Mon, 24 Oct 2022 19:42:51 +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=59TRiYUXIr5hwsRyZRrFskT3Jp1v+y3YCFk34nmAHUA=; b=RWaoMVk6BPHICeFJGa64P+TtYS lq+sEC3X3P6L3UTF8roXaBRlKW/dn6ZZSPv8sql0Bq94mmfKcGyd20heEGzrmKOPxJk3I3q5ocDIn rZQPq90/4mybKupKG3u4huHqxJCrrWGNEOuPBYM2rIb6H9WuW6yrLD6np+IyZE9bNS7zRunkvbrVS kGzoHEUY7j5v5JqpULdFDMYN3lKANNwQv8Kwkz7gBZ7ecSVjXla5q64p4LZsQu4fbmarbbcif9lXY o1WMbUkytqszHQgfmeS7hcb6y9ciIzemtb9F2l0G/ZP1Xp4kGUxgavPMMqfxbqbGFy/C6jzVp77bS Tdoa8djA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1on3LB-00FglR-TA; Mon, 24 Oct 2022 19:42:30 +0000 Date: Mon, 24 Oct 2022 20:42:29 +0100 From: Matthew Wilcox To: "Vishal Moola (Oracle)" Cc: linux-fsdevel@vger.kernel.org, linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org, linux-btrfs@vger.kernel.org, ceph-devel@vger.kernel.org, linux-cifs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com, linux-nilfs@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v3 02/23] filemap: Added filemap_get_folios_tag() Message-ID: References: <20221017202451.4951-1-vishal.moola@gmail.com> <20221017202451.4951-3-vishal.moola@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221017202451.4951-3-vishal.moola@gmail.com> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666640572; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=59TRiYUXIr5hwsRyZRrFskT3Jp1v+y3YCFk34nmAHUA=; b=ZTL75C3eb/cbdyTuiC3LgW9mahUgVKdb/5PvjXQujPGKsE7+DMKyVXcn7iQMwy0fMgnHw/ fRomfd5Bs4/7qhpfaRhJl1TOnRpS3jo3aPHUIsxcGsEB8DQUNBu6Hpan04QcEfVEFoWMPm cWdBmZg/YW8LyyMwMFFJvS4NStTzSH0= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=RWaoMVk6; spf=none (imf24.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666640572; a=rsa-sha256; cv=none; b=74PwGXBo3TK9WenXaBaInhFvbDgJOMCdbKRLqyfqCjxXdIDlz+w3CP/CHGqER4KnGVRhHU jMfroJPYd8T8RWF2i2cQuJeISj7wXxGMv+GQq2AJSNLrx05M1Sda+yil99H32K0mt+5J/X ykwyHY0slHVZ6ujWqlTlswjbk3bMS/c= X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 3264718000C X-Rspam-User: Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=RWaoMVk6; spf=none (imf24.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-Stat-Signature: cy3cu1kgg71hdj6bwht1skzws5wnty6j X-HE-Tag: 1666640571-396542 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 Mon, Oct 17, 2022 at 01:24:30PM -0700, Vishal Moola (Oracle) wrote: > This is the equivalent of find_get_pages_range_tag(), except for folios > instead of pages. > > One noteable difference is filemap_get_folios_tag() does not take in a > maximum pages argument. It instead tries to fill a folio batch and stops > either once full (15 folios) or reaching the end of the search range. > > The new function supports large folios, the initial function did not > since all callers don't use large folios. Reviewed-by: Matthew Wilcow (Oracle) > +/** > + * filemap_get_folios_tag - Get a batch of folios matching @tag. > + * @mapping: The address_space to search > + * @start: The starting page index > + * @end: The final page index (inclusive) > + * @tag: The tag index > + * @fbatch: The batch to fill > + * > + * Same as filemap_get_folios, but only returning folios tagged with @tag If you add () after filemap_get_folios, it turns into a nice link in the html documentation. > + * > + * Return: The number of folios found Missing full stop at the end of this line. > + * Also update @start to index the next folio for traversal Ditto. > + */ > +unsigned filemap_get_folios_tag(struct address_space *mapping, pgoff_t *start, > + pgoff_t end, xa_mark_t tag, struct folio_batch *fbatch) > +{ > + XA_STATE(xas, &mapping->i_pages, *start); > + struct folio *folio; > + > + rcu_read_lock(); > + while ((folio = find_get_entry(&xas, end, tag)) != NULL) { > + /* Shadow entries should never be tagged, but this iteration > + * is lockless so there is a window for page reclaim to evict > + * a page we saw tagged. Skip over it. > + */ For multiline comments, the "/*" should be on a line by itself.