From patchwork Fri May 18 16:48:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10411353 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 A8BD86031B for ; Fri, 18 May 2018 16:50:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A2132844E for ; Fri, 18 May 2018 16:50:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8F272288BD; Fri, 18 May 2018 16:50: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 401162844E for ; Fri, 18 May 2018 16:50:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 49B676B0630; Fri, 18 May 2018 12:50:00 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 4201C6B0632; Fri, 18 May 2018 12:50:00 -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 2996E6B0633; Fri, 18 May 2018 12:50:00 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl0-f70.google.com (mail-pl0-f70.google.com [209.85.160.70]) by kanga.kvack.org (Postfix) with ESMTP id DB6AE6B0630 for ; Fri, 18 May 2018 12:49:59 -0400 (EDT) Received: by mail-pl0-f70.google.com with SMTP id b36-v6so5392709pli.2 for ; Fri, 18 May 2018 09:49:59 -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=i8D5mcMNS6KxKAAsb+aGA9l1KaX1rkC7sUYp/IK5jw1mqwyh/jrEwePySoql1JXiP2 W+Q2BsF2stfV9/d1JAKh5HdiOAxlo/CG3ndOzmVLe/qEmMokfmoE+e9R+Q2K8zJ2OwjG RvhYLbqJ2WvrFtlLb3LGl++i3+LQahC848OyyuvS/HQWOz2uVfdJ/qo7/dlL6nAFwvY0 ePK09kppLNID4rb2h8GYVhzOJQwGfqb6bG1Y8Z6yBVZwwRJpOs+T5oIImqCLAGdzz4J3 5ZlwqGFJx4X+SfmIU5qbOYlEv+6jiVNHI7AJdR478VYqC1AWbM+V4IHGjFETI91vatNn N9PA== X-Gm-Message-State: ALKqPweIcvD2AlJS2yIhFYs8g2g/M10MDgoDNF+XWc3Jsl1dVZyp5om0 va8CLj5NgeZPla9mqVjqyE1hRGdGS7eN5/jkF1FvYgNujYv2r8YWtkXfW3JpkKe9FuNPbfcatvC 03mQxoUWMEXjAeMZvrndlNGZSjHldr2Z3TrCoQHUoLkqgsIrnC24l8XQekE3sBco= X-Received: by 2002:a63:7c04:: with SMTP id x4-v6mr8017971pgc.67.1526662199575; Fri, 18 May 2018 09:49:59 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpVIO+wVR1IqPSlkddRXTvSNzF6B3gzUwwbn42gTx/T+25fyl7OTiLWF22k4VxTKMSk/Mf/ X-Received: by 2002:a63:7c04:: with SMTP id x4-v6mr8017940pgc.67.1526662198827; Fri, 18 May 2018 09:49:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526662198; cv=none; d=google.com; s=arc-20160816; b=mBrtl09mrcUMiJEHKOE11/JV3aUM+ZdF6ZKqKWn4qnd0RYnGoDuTJ23fiU/RchwwLH 4l1npAIhfLqBj+0haQK9yvq6KR8+Vr54WzotEYMExMZ1Thny9Gv2Q18+bRf1+/o/suJN gYgFGr7GKE7jWjU94peZt61lSmgE0wHhnLk0oD4dC/cGwtWZAFKbJnyHKYJn/hba+nNq wHYRguHBMlM+UFfnXBdN9rjvRj0TJ7V7eCF9z8jHHC5ZQ+AeRJFr8s3G46FvBI23X3rd ZwsdnEzWwkTaWkHaTBWRZjXDaAXVccxMpPG87I23hs+15sTTne49FMtdUOtbseZqRB0E h8hA== 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=s+ddJPMUsDUF+y3cV1A88lK6HuZW59N/WJnPPI+3VqiqEC5X4A9e+NmnY9wVBT9JTY sb6+oArwrN1iMC8sUwBDNurnlyYpbwADId4WnuM05yE4STfdOxhEeLzfZ74dbrK2HXro 0IUU04ITbqU9Af6yHi7nfvhE3vcW1/1RWqBjEmTkol5IQA9JEIxOf9UC7wdjKrTsKeek EXpNDpjmr0NX4eaud6PouCA24AVgmoc7yOKIm481e9xhAgGSDrCGkCYi+qJ09DPKCfwM uJl6Gll7CEk/HCHDMTwTpLj+Vc32BtDMnauUIC5W2iAUFfGHRe0okXAC+dnDJTdBbiAO yDHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20170209 header.b=fQ6mmGB6; spf=pass (google.com: best guess record for domain of batv+77ddf8e9b1b344f28472+5381+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+77ddf8e9b1b344f28472+5381+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 r63-v6si7548236plb.366.2018.05.18.09.49.58 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 May 2018 09:49:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of batv+77ddf8e9b1b344f28472+5381+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=fQ6mmGB6; spf=pass (google.com: best guess record for domain of batv+77ddf8e9b1b344f28472+5381+infradead.org+hch@bombadil.srs.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom=BATV+77ddf8e9b1b344f28472+5381+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=fQ6mmGB6ytsEoxviqRfVZ/Gnm 3WKNgjh4IibokQBT/T/7f1+CwB1zFe0ydkiATeWM25WmPOfAhSasKbo2oJNZVugsL++ThmEhvo7Pr zDIvcbZqKSjy25lPzf7atHAkI6qQPoUWYZbsJ2IU6bC7R5ZKx0lDWfaBCIqG93UX9XvmWTvZvafZx PFSBJVL+vndIQBJYSJPLDyh0MjgPcUclqTauAAj5cfXG7R0Ej8r6v9TImBATDVh3TYDN/KYWZm7GC /ndgfXUEPeIvALx8+eeBzxFJLfunsz9P0d9oznGvB2Q69XbCVBV9I7ulWxnC3Dg8zAr5ACWPhkptI td+iMvYjQ==; Received: from 80-109-164-210.cable.dynamic.surfer.at ([80.109.164.210] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fJiZo-00074E-MV; Fri, 18 May 2018 16:49:57 +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 28/34] xfs: remove the imap_valid flag Date: Fri, 18 May 2018 18:48:24 +0200 Message-Id: <20180518164830.1552-29-hch@lst.de> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180518164830.1552-1-hch@lst.de> References: <20180518164830.1552-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