From patchwork Thu Dec 13 22:25:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Sandeen X-Patchwork-Id: 10730025 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A8389112E for ; Thu, 13 Dec 2018 22:25:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9993F2C95D for ; Thu, 13 Dec 2018 22:25:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8E58E2C961; Thu, 13 Dec 2018 22:25:47 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 4E6B72C960 for ; Thu, 13 Dec 2018 22:25:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728168AbeLMWZq (ORCPT ); Thu, 13 Dec 2018 17:25:46 -0500 Received: from sandeen.net ([63.231.237.45]:44428 "EHLO sandeen.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727911AbeLMWZn (ORCPT ); Thu, 13 Dec 2018 17:25:43 -0500 Received: by sandeen.net (Postfix, from userid 500) id D713333D5; Thu, 13 Dec 2018 16:25:32 -0600 (CST) From: Eric Sandeen To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: Christoph@sandeen.net, Hellwig@sandeen.net, Subject: [PATCH 3/3] iomap: optimize iomap_is_partially_uptodate for full page range Date: Thu, 13 Dec 2018 16:25:29 -0600 Message-Id: <1544739929-21651-4-git-send-email-sandeen@sandeen.net> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544739929-21651-1-git-send-email-sandeen@sandeen.net> References: <1544739929-21651-1-git-send-email-sandeen@sandeen.net> 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 From: Eric Sandeen We only call ->is_partially_uptodate to look for an uptodate range within a not-uptodate page. If the range covers all blocks in the page, there is no point to checking each block individually - if the whole range (i.e. the whole page) were uptodate, the page would be uptodate as well. Hence in this case, we can return early and skip the loop. This is similar to what is done in block_is_partially_uptodate(). Signed-off-by: Eric Sandeen Signed-off-by: Eric Sandeen --- fs/iomap.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/iomap.c b/fs/iomap.c index ce837d9..7d7d985 100644 --- a/fs/iomap.c +++ b/fs/iomap.c @@ -515,6 +515,10 @@ struct iomap_readpage_ctx { first = from >> inode->i_blkbits; last = (from + len - 1) >> inode->i_blkbits; + /* If page wasn't uptodate and range covers all blocks: no partial */ + if (first == 0 && last == (PAGE_SIZE - 1) >> inode->i_blkbits) + return 0; + if (iop) { for (i = first; i <= last; i++) if (!test_bit(i, iop->uptodate))