From patchwork Wed May 30 10:00:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10438287 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 E82CC601E9 for ; Wed, 30 May 2018 10:01:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D9234288ED for ; Wed, 30 May 2018 10:01:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CE2EE288F1; Wed, 30 May 2018 10:01:46 +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=-2.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 70910288ED for ; Wed, 30 May 2018 10:01:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 710F76B0288; Wed, 30 May 2018 06:01:12 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6BE8C6B0289; Wed, 30 May 2018 06:01:12 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 589F86B028A; Wed, 30 May 2018 06:01:12 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl0-f72.google.com (mail-pl0-f72.google.com [209.85.160.72]) by kanga.kvack.org (Postfix) with ESMTP id 148F16B0288 for ; Wed, 30 May 2018 06:01:12 -0400 (EDT) Received: by mail-pl0-f72.google.com with SMTP id b31-v6so11090609plb.5 for ; Wed, 30 May 2018 03:01:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references; bh=CXemw10KtunZl4X6DIlJWomQUZY+IudLJZ99QGA4dhM=; b=gyWLzf7SwYJq2b9tCi6ed4diBajqHgWztN33AaFka0hgPxjuI9BEVN2dMeoIQybkoS /O2WTWTunM9IT+fylo8UfJspeYqFmllDVGcdZ31XUP5V1XCRiNj7pXAXJqEXkFQB9p2+ n1IPW/FyyArt35IrtE1ZoG6TSUPGylwFRZZEClelVJ5d/1EOhHsgd6AKcN9XaDZ1vFYX +tBc+BvIabEH+JY6xSVvBAOThNtWhaT+lusmgeWU1Ivct97EDwbEMTVAla73J84wvRcr R5AytBwaFajSINUFs6tyooEdNpipcrl++br20GtbRWRrAcKfVulrUU+oqg6m5RjJ2NOd MqBw== X-Gm-Message-State: ALKqPwe95Kbu+gAtV2FeGjNQlLmlz5g/zuCbmvmlMqTi4vxZq3krrEdb 1lh0WAu0h+7rULB8gJGhfG05jHq/KFbFbsn5WPDbTnCc510mzCtx7NtOQiFLxxMbJoJ5P+ylV9g 6mFvBG1Kth5BsFSGtLWkozDne2GZPlbgwmjmdEyn0crW9uTGtBXaPgsrLasd2jpc= X-Received: by 2002:a62:18d6:: with SMTP id 205-v6mr2150495pfy.242.1527674471772; Wed, 30 May 2018 03:01:11 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIOEv+VRuiX6hxoj5xcl0gHY+kMRr7URKAFKJf+onko/5HvFTKWeunZGDybmPTZS6T2y/d7 X-Received: by 2002:a62:18d6:: with SMTP id 205-v6mr2150430pfy.242.1527674471010; Wed, 30 May 2018 03:01:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527674470; cv=none; d=google.com; s=arc-20160816; b=U6PJFaCvD5XFFAeQ9QyeDs00D3GTVSYynUSml37HuExkE4ztEgtrWDMKeU4+dU0qvJ M57UWOjX+BVwwegae2DB3+bHV0Cy+5uTxB75plGPtNOQ4hQcDFXli2yLxCu2fAnVwBj3 FtDxF6FM9/98mjTMEnehP+mBRR8ko1FJrZnKDKOLz77oXVUUOaC8jccevAZDrXDRQbxq tYdDks0oZO6pZ0ZyDwBIifa4h52dXzt9FlcDelR+l50gu7UmpsaQxy0oZDLJwv0rB2Wn qzaKbiuDA8tGr3zJKSS9Eu5+kjOKLz7JR6vMkZ+1yV+spJdugeRH4EiqmDBsAoJX9kmy PccA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=CXemw10KtunZl4X6DIlJWomQUZY+IudLJZ99QGA4dhM=; b=1HOIYbkDD6jI2VDf7xLZp+3P2XGfn+gcVwOgKzBWRdyl4hMXq0PbCGLG9aUAsy2Prc y/ywtwb1eSTOVYKAajqKgkwmVi63Rtpd3HDYQxs97R9Pwy7xczlhydite9Z3H+taLtx3 jQIy8Jb7fDd2elWXI44bxkxRMUrlnh/a/xfiSxlRCJmDkG6Ne3EOOJtDR8erMlojGFDY G5QjSF1J/OZDrk3kM5afLLD/pZSA1/ASmxR7to5pHSttnhAFMYti3OoD5O8uwVh2QBP0 q3noBOWAeUuAdOb+10fiWvz2r1vqIWc79cqJg8zqS/w2alte3zPkLMrbW+Pq0aUmizZt wbHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=WoJQR8eJ; spf=pass (google.com: best guess record for domain of batv+1f4557cc97fec8e307c5+5393+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+1f4557cc97fec8e307c5+5393+infradead.org+hch@bombadil.srs.infradead.org Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id z124-v6si26882823pgb.241.2018.05.30.03.01.10 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 May 2018 03:01:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of batv+1f4557cc97fec8e307c5+5393+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=WoJQR8eJ; spf=pass (google.com: best guess record for domain of batv+1f4557cc97fec8e307c5+5393+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+1f4557cc97fec8e307c5+5393+infradead.org+hch@bombadil.srs.infradead.org 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=CXemw10KtunZl4X6DIlJWomQUZY+IudLJZ99QGA4dhM=; b=WoJQR8eJFOfyxcuq9LL9kxddW g2b1a26Wwu3TCVZPDZd7aY0Sd0EBIpQkjVPwQ88hoX1T3N6XcIKL2f78BsIoo8QMuHdKKEvSpAiFJ KsKAgwa1eIpnfMr9o53/p/3MqrdhusWMu0TwTLBVHqxibkLjxezQQYkbHHZW05NNt0y2eJcOb514v e4Seghzh3EDCCwEuH37bSnDe0pcfpuE0oG0XEFMiP5viaT4LFPZ6J+dipSIN0yPfzAQeOTqxoVdGA D04yS+yv7owmEYZFnSgRxr/Fqy1+mS8AH3flGdjABW2GYRSwnaqqhinorYnlBY8UyvS6zCnqXq/al 7u0SZokUw==; Received: from 213-225-38-123.nat.highway.a1.net ([213.225.38.123] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fNxum-00004y-O7; Wed, 30 May 2018 10:01:09 +0000 From: Christoph Hellwig To: linux-xfs@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 12/18] xfs: remove the imap_valid flag Date: Wed, 30 May 2018 12:00:07 +0200 Message-Id: <20180530100013.31358-13-hch@lst.de> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180530100013.31358-1-hch@lst.de> References: <20180530100013.31358-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html 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: 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 Reviewed-by: Darrick J. Wong Reviewed-by: Brian Foster --- 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 7dc13b0aae60..910b410e5a90 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; @@ -858,10 +857,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 @@ -869,16 +864,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