From patchwork Thu Jun 1 09:32:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 9758961 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2E8836038E for ; Thu, 1 Jun 2017 09:34:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1197A284C3 for ; Thu, 1 Jun 2017 09:34:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 065D4284D1; Thu, 1 Jun 2017 09:34:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF2A9284C3 for ; Thu, 1 Jun 2017 09:34:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751787AbdFAJdt (ORCPT ); Thu, 1 Jun 2017 05:33:49 -0400 Received: from mx2.suse.de ([195.135.220.15]:50851 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751673AbdFAJdW (ORCPT ); Thu, 1 Jun 2017 05:33:22 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 7985BADF6; Thu, 1 Jun 2017 09:33:15 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 68FE71E35BB; Thu, 1 Jun 2017 11:33:12 +0200 (CEST) From: Jan Kara To: Cc: Hugh Dickins , David Howells , linux-afs@lists.infradead.org, Ryusuke Konishi , linux-nilfs@vger.kernel.org, Bob Peterson , cluster-devel@redhat.com, Jaegeuk Kim , linux-f2fs-devel@lists.sourceforge.net, tytso@mit.edu, linux-ext4@vger.kernel.org, Ilya Dryomov , "Yan, Zheng" , ceph-devel@vger.kernel.org, linux-btrfs@vger.kernel.org, David Sterba , "Darrick J . Wong" , linux-xfs@vger.kernel.org, Nadia Yvette Chambers , Jan Kara Subject: [PATCH 34/35] mm: Make find_get_entries_tag() update index Date: Thu, 1 Jun 2017 11:32:44 +0200 Message-Id: <20170601093245.29238-35-jack@suse.cz> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20170601093245.29238-1-jack@suse.cz> References: <20170601093245.29238-1-jack@suse.cz> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Make find_get_entries_tag() update 'start' to index the next page for iteration. Signed-off-by: Jan Kara --- fs/dax.c | 3 +-- include/linux/pagemap.h | 2 +- mm/filemap.c | 8 ++++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index c204445a69b0..4b295c544fd4 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -841,7 +841,7 @@ int dax_writeback_mapping_range(struct address_space *mapping, pagevec_init(&pvec, 0); while (!done) { - pvec.nr = find_get_entries_tag(mapping, start_index, + pvec.nr = find_get_entries_tag(mapping, &start_index, PAGECACHE_TAG_TOWRITE, PAGEVEC_SIZE, pvec.pages, indices); @@ -859,7 +859,6 @@ int dax_writeback_mapping_range(struct address_space *mapping, if (ret < 0) goto out; } - start_index = indices[pvec.nr - 1] + 1; } out: put_dax(dax_dev); diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index df128a56f44b..1dc7e54ec32a 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -365,7 +365,7 @@ static inline unsigned find_get_pages_tag(struct address_space *mapping, return find_get_pages_range_tag(mapping, index, (pgoff_t)-1, tag, nr_pages, pages); } -unsigned find_get_entries_tag(struct address_space *mapping, pgoff_t start, +unsigned find_get_entries_tag(struct address_space *mapping, pgoff_t *start, int tag, unsigned int nr_entries, struct page **entries, pgoff_t *indices); diff --git a/mm/filemap.c b/mm/filemap.c index e55100459710..3eb05c91c07a 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -1731,7 +1731,7 @@ EXPORT_SYMBOL(find_get_pages_range_tag); * Like find_get_entries, except we only return entries which are tagged with * @tag. */ -unsigned find_get_entries_tag(struct address_space *mapping, pgoff_t start, +unsigned find_get_entries_tag(struct address_space *mapping, pgoff_t *start, int tag, unsigned int nr_entries, struct page **entries, pgoff_t *indices) { @@ -1744,7 +1744,7 @@ unsigned find_get_entries_tag(struct address_space *mapping, pgoff_t start, rcu_read_lock(); radix_tree_for_each_tagged(slot, &mapping->page_tree, - &iter, start, tag) { + &iter, *start, tag) { struct page *head, *page; repeat: page = radix_tree_deref_slot(slot); @@ -1786,6 +1786,10 @@ unsigned find_get_entries_tag(struct address_space *mapping, pgoff_t start, break; } rcu_read_unlock(); + + if (ret) + *start = indices[ret - 1] + 1; + return ret; } EXPORT_SYMBOL(find_get_entries_tag);