From patchwork Wed May 9 07:48:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10388551 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 CA94260548 for ; Wed, 9 May 2018 07:50:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BCD6F28E05 for ; Wed, 9 May 2018 07:50:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B1B0B28E65; Wed, 9 May 2018 07:50:56 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 5956728E05 for ; Wed, 9 May 2018 07:50:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933848AbeEIHuK (ORCPT ); Wed, 9 May 2018 03:50:10 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:53074 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933806AbeEIHuJ (ORCPT ); Wed, 9 May 2018 03:50:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=7ijlrOqrDFO3yQSlK7bK/+CRIlXTd08Elic7eQLoG9w=; b=aXaUe67WZHZaIgA6LOKM5jACY FV0hLnkRXcEd4Z9v2gva07b1nw/GxElp3kUpBG1mS4x1GCKGrJjVexw02oxqc3UFvjdrE25pp/lbF Fxs8cKCQwpDrfR3pzrYrK1u+Bmv89okHkzg+Px5HXuZy/w5u3IKUc5npgdXLnQz8sRFmqaEcsofFl 5Mdxj+WeR50XudqALtIIWv2DHxu4XGf7ZZ4pYVXZkloVr0PB6ch3WqmOBAzG8GfLac2a2O6He4YVW t5nXJIMsjXLYuk9265SlXSoc7TomOJtSlIrWC01TQyF2JMTeREhQ/amTeK2PFLrQNR35t/btLyv46 disJM3dgg==; Received: from 213-225-15-246.nat.highway.a1.net ([213.225.15.246] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fGJrL-0001pp-NU; Wed, 09 May 2018 07:50:00 +0000 From: Christoph Hellwig To: linux-xfs@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 23/33] xfs: remove the imap_valid flag Date: Wed, 9 May 2018 09:48:20 +0200 Message-Id: <20180509074830.16196-24-hch@lst.de> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180509074830.16196-1-hch@lst.de> References: <20180509074830.16196-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Simplify the way we check for a valid imap - we know we have a valid mapping after xfs_map_blocks returned successfully, and we know we can call xfs_imap_valid on any imap, as it will always fail on a zero-initialized map. Signed-off-by: Christoph Hellwig --- fs/xfs/xfs_aops.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index 5da2e99b0559..7ebd686cb723 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c @@ -42,7 +42,6 @@ */ struct xfs_writepage_ctx { struct xfs_bmbt_irec imap; - bool imap_valid; unsigned int io_type; struct xfs_ioend *ioend; sector_t last_block; @@ -868,10 +867,6 @@ xfs_writepage_map( continue; } - /* Check to see if current map spans this file offset */ - if (wpc->imap_valid) - wpc->imap_valid = xfs_imap_valid(inode, &wpc->imap, - file_offset); /* * If we don't have a valid map, now it's time to get a new one * for this offset. This will convert delayed allocations @@ -879,16 +874,14 @@ xfs_writepage_map( * a valid map, it means we landed in a hole and we skip the * block. */ - if (!wpc->imap_valid) { + if (!xfs_imap_valid(inode, &wpc->imap, file_offset)) { error = xfs_map_blocks(inode, file_offset, &wpc->imap, &wpc->io_type); if (error) goto out; - wpc->imap_valid = xfs_imap_valid(inode, &wpc->imap, - file_offset); } - if (!wpc->imap_valid || wpc->io_type == XFS_IO_HOLE) { + if (wpc->io_type == XFS_IO_HOLE) { /* * set_page_dirty dirties all buffers in a page, independent * of their state. The dirty state however is entirely