From patchwork Mon Oct 9 15:13:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 9993675 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 6FDEE60216 for ; Mon, 9 Oct 2017 15:15:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6293428807 for ; Mon, 9 Oct 2017 15:15:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 57A092880B; Mon, 9 Oct 2017 15:15:22 +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=ham 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 CF2CA28807 for ; Mon, 9 Oct 2017 15:15:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754687AbdJIPOx (ORCPT ); Mon, 9 Oct 2017 11:14:53 -0400 Received: from mx2.suse.de ([195.135.220.15]:49786 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754649AbdJIPOJ (ORCPT ); Mon, 9 Oct 2017 11:14:09 -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 mx2.suse.de (Postfix) with ESMTP id 6813EABE8; Mon, 9 Oct 2017 15:14:06 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id B6BDF1E35D7; Mon, 9 Oct 2017 17:14:00 +0200 (CEST) From: Jan Kara To: Andrew Morton Cc: , , Daniel Jordan , Jan Kara Subject: [PATCH 10/16] mm: Use pagevec_lookup_range_tag() in __filemap_fdatawait_range() Date: Mon, 9 Oct 2017 17:13:53 +0200 Message-Id: <20171009151359.31984-11-jack@suse.cz> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20171009151359.31984-1-jack@suse.cz> References: <20171009151359.31984-1-jack@suse.cz> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use pagevec_lookup_range_tag() in __filemap_fdatawait_range() as it is interested only in pages from given range. Remove unnecessary code resulting from this. Reviewed-by: Daniel Jordan Signed-off-by: Jan Kara --- mm/filemap.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index cf74d0dacc6a..229481d258bc 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -420,19 +420,17 @@ static void __filemap_fdatawait_range(struct address_space *mapping, return; pagevec_init(&pvec, 0); - while ((index <= end) && - (nr_pages = pagevec_lookup_tag(&pvec, mapping, &index, - PAGECACHE_TAG_WRITEBACK, - min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1)) != 0) { + while (index <= end) { unsigned i; + nr_pages = pagevec_lookup_range_tag(&pvec, mapping, &index, + end, PAGECACHE_TAG_WRITEBACK, PAGEVEC_SIZE); + if (!nr_pages) + break; + for (i = 0; i < nr_pages; i++) { struct page *page = pvec.pages[i]; - /* until radix tree lookup accepts end_index */ - if (page->index > end) - continue; - wait_on_page_writeback(page); ClearPageError(page); }