From patchwork Wed May 23 14:43:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10421653 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 3416860327 for ; Wed, 23 May 2018 14:46:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 24EE5289E2 for ; Wed, 23 May 2018 14:46:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 19A6728BBE; Wed, 23 May 2018 14:46:23 +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 AF1CD289E2 for ; Wed, 23 May 2018 14:46:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 84CB26B0285; Wed, 23 May 2018 10:45:29 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 7D27D6B0286; Wed, 23 May 2018 10:45:29 -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 64FD16B0287; Wed, 23 May 2018 10:45:29 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl0-f71.google.com (mail-pl0-f71.google.com [209.85.160.71]) by kanga.kvack.org (Postfix) with ESMTP id 1D4B76B0285 for ; Wed, 23 May 2018 10:45:29 -0400 (EDT) Received: by mail-pl0-f71.google.com with SMTP id f10-v6so14223270pln.21 for ; Wed, 23 May 2018 07:45:29 -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=HT2cZhxaNOaDJ1Efg1gVFD+MaNHwDAf/ra9euyGV2Ds=; b=QcnGPLcpQnooENl81SesMvW9oIhAC0z05kOS7xjh5kdCQpwEfEmPYiOi2HoSWKPkkO Sfd+HcGJeEr0MouWLV6vpdwwDcAMr88V8XITDOXhayxGk8mDGgM8COhvQ0jYLLCBNqcJ igLKcaxdnuW/SKpuxvicyeYKctTJ5IuzqTJLKgoHNX9PhKllkNxkX1Hpj1a2qzQk5tT5 lLc7TdnLHnb7qd8B+kM02wMfVPpXpQWB4XR1u4ashg+tpUU3N2Rb6on6DbEZHB7ewG4v 7dgir24GjlX7R5yQAjXP8PM8hMFmKk5xa7JAwOx+rWJFAJKyk3MMkQTkest5O3k57iCt VkOw== X-Gm-Message-State: ALKqPweBN7aMZdDvw6XjQo0n+/YiQ9dES6xwwWwgw7V6JkUh4y6BI3/a kvcC62ngPBTR1biXsk5U9BLlnDOaPmV0EEgzBidFSJXlIVOJiVF8qwiMInvBqFHSBPNtQTQ9oIw Pj4XzrCRAcc3NxnxuP4Uclvg0JfHQV/7bHrzk8i1Zjq07HUXPuEsf162xMqMoTjc= X-Received: by 2002:a62:7f91:: with SMTP id a139-v6mr3178524pfd.25.1527086728800; Wed, 23 May 2018 07:45:28 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpziUexQ43sG6jjndb6evZulZntHTftwlSWR6chNleJ+HpKQupBdUGbuaNVaaJaQQihF9tN X-Received: by 2002:a62:7f91:: with SMTP id a139-v6mr3178494pfd.25.1527086728030; Wed, 23 May 2018 07:45:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527086728; cv=none; d=google.com; s=arc-20160816; b=MDHC8C5xflRiACj3aMwTkOU3YnuOCyacR8OhClbeBBI6N+fUr/lK+YdBWMsKBX6/gd zsuh2p2x3/gNKexZhMipWm68Cz6H41VHT71evimWUIq1osJ7DW6wn6nTdVGbJOmpf8NH /SMXOKuUloj0/VUHUoovOqjQT8AVDJU4X8wuRjnvsLlrhlOSvpI95aGUhNxChbUHocGQ eu1k6jTDGXx1+PPZDUsBD9T0/ShylWvzZ3DRpYGEXAtCU7LD1a8nxAljXC1chjE2ipIu oMINz6yjCY2TCl6gIUeATTHLtk3Dbc03oc5P/OWgK8WjGXcKuZemoOsXqAn93RkRxjIe fFeg== 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=HT2cZhxaNOaDJ1Efg1gVFD+MaNHwDAf/ra9euyGV2Ds=; b=ME5XiuTIPhE3voieEbPgGdWAvFqrhVPVzqZLSF5fshYMMwp/Ch5Rr26Jt1aGlxFir8 +xASAZdcZiS485tArla3XE0qkzMLwgYo+vJKsJlRfZF5VJ2MDDdfSOLhC9DdtN6msfy1 2IXRFp3C156tHYwU1pM5DCt3EDWJx59h6+WiDFpjB1ZHOmA8Hxw2lPIJr4v6Z/bsCXOe b7KnhZF5qAT/MVssZdyYj6hDQeTAak29aA4qQJnqFH3TYCRc9E9u5PrnBI/W1FBZyycy r+CmNLHCP4h3MNrLGHVeKu9zrHUd6OvwZlxoZEFji5wzXjrBk5NLtMwibmxjoRrWB59T DF2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=esXnZnmq; spf=pass (google.com: best guess record for domain of batv+df5a2477ff0fa86e9985+5386+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+df5a2477ff0fa86e9985+5386+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 u70-v6si1952447pgc.376.2018.05.23.07.45.27 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 May 2018 07:45:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of batv+df5a2477ff0fa86e9985+5386+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=esXnZnmq; spf=pass (google.com: best guess record for domain of batv+df5a2477ff0fa86e9985+5386+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+df5a2477ff0fa86e9985+5386+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=HT2cZhxaNOaDJ1Efg1gVFD+MaNHwDAf/ra9euyGV2Ds=; b=esXnZnmqV27h8iCipfT+nE/St bBaYxOz4wT+iJrVZeRREJB6oeHNgFdQ3zx7I4oqdACXRjCzLPyQd8GRqYfkn3/QXwPHLuDEypQmrD COAfLNNSlhO6KPihmf2YAsviOlx6qiw65M1ZdYfOp/1wCwBB4n9Gzn9PXboLs8scBBoH552byG3I0 Jkzms8LrblADhZd8R84m45QoOx40JMTkpwX8rwS13yqlctVRBpsoCfz0RsZdbM6T0Hmd4AzsoPCZI a3QKulvot3lOBY42eTNV/nDTnLNvRKMLEOodgRl6RyWoi8XMMQvZ4cQ41LLVeYLxX8tMv8Rmcj+l8 pObQ0NdiQ==; Received: from 089144199016.atnat0008.highway.a1.net ([89.144.199.16] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fLV14-0001Uo-Pg; Wed, 23 May 2018 14:45:27 +0000 From: Christoph Hellwig To: linux-xfs@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 28/34] xfs: remove the imap_valid flag Date: Wed, 23 May 2018 16:43:51 +0200 Message-Id: <20180523144357.18985-29-hch@lst.de> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180523144357.18985-1-hch@lst.de> References: <20180523144357.18985-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 --- 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 82fd08c29f7f..f01c1dd737ec 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