Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2211803pxa; Mon, 24 Aug 2020 08:10:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJATiNRArvzK3nlvfqKocPZTcgg0QMnqwdln0B+l8fDuf8A4fLqI+vnQXk2O2QHCMhJHRy X-Received: by 2002:a17:906:5914:: with SMTP id h20mr2004093ejq.346.1598281850740; Mon, 24 Aug 2020 08:10:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598281850; cv=none; d=google.com; s=arc-20160816; b=JLO+KBG4IsDAF0HMbbWp0Jz9IXWYYXGdmWBnKpI+T/b4TJABex270YWJnTf/Vbk/cN SgwQHauyDunz8wK3HZ6urBDdZni5sd0dj2TYivzTIcCF+SbHbNKoncgr8vwBuuafB/XM YMhhf9q/pHzW5wov8+I4aS8+n0YsJVVT+K+CtgED0jJbREer3s6ZN9XbSyp5ayQy7NoN kcaHc/DhLWU8172w6rIE/EkxAlR3r+lYKtc7XyLoSz1CgiuISDPAvuuJbTfn1Z5j6C3A n69m4fEsA+p4VwA1NsM5OHrKdhG6EXKhik7e7XqFwiLZTyvOj63fXrdWCEF78QwMX9LI vgEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ubi2ubkSzmcUgKFA9Ty93Z77356b507gvbujH4zOh5I=; b=I7UvNbgAq21u0bbDRogCt8W5tftclv5MmrQVG/FAjrdbWzuck44J9ukh0OMT88yT8q tJ5gY8X47bIHEujMPyAlQciDSf2Ggf85sGtho1/wPphNJoWzm6STEWE0H8D75yVdszhU kolwG2Qb/C08oE6N2IF+upL9CN/8cvHdSdewLHUe+VTN0LWWB/pbLaWV0FuQh4Ze5n/8 75Q046ifJUpnmZuHyS7u6L9Wr77ZkUMscARkYR7zI5ETq5FPki45k75ATZwI6pEJQUvl 27sBlMtl8HwfqXCCEjUmBWxtr74cv9VhXD91ptMBNBod1SegxjZxWrOi7hQAg2SGdYwv Xpyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=uxRmPdWX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g6si747971edv.515.2020.08.24.08.10.27; Mon, 24 Aug 2020 08:10:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=uxRmPdWX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726950AbgHXPIk (ORCPT + 99 others); Mon, 24 Aug 2020 11:08:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726882AbgHXPGX (ORCPT ); Mon, 24 Aug 2020 11:06:23 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD2C1C061755; Mon, 24 Aug 2020 07:55:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=ubi2ubkSzmcUgKFA9Ty93Z77356b507gvbujH4zOh5I=; b=uxRmPdWXScdnVsVqrOytVE+3pX AfNakxy/jXMIeQk1mrNaeGszT7gwlzKTJW4zKApginebWwL+8a3GK4DkxG6e3qtrAe6OrV/rKKFoW WLNCWseG6+ZfPiG28STSAnIkkdgyq235kHqwtyi/vvSXY+y7bgCoAFnPzakWr6aGmDXahjy54ojPB iKqWCmjjJVSdMq9U0v1TgmYdal24DeOA1OsPiilA1dB1RlJ6PO11/ekIBoyS6VDi9neoy4W6nvdUh iLjbjh4KAsGEnlLZkShdZexS2paK0ywCcCD/CrO9rGrJhFXFnlTClKUaO0WHz77iQg6i2VilcP4LE lDXtmWtg==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kADsP-0002m7-MX; Mon, 24 Aug 2020 14:55:14 +0000 From: "Matthew Wilcox (Oracle)" To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , "Darrick J . Wong" , linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org, Christoph Hellwig Subject: [PATCH 4/9] iomap: Use bitmap ops to set uptodate bits Date: Mon, 24 Aug 2020 15:55:05 +0100 Message-Id: <20200824145511.10500-5-willy@infradead.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200824145511.10500-1-willy@infradead.org> References: <20200824145511.10500-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that the bitmap is protected by a spinlock, we can use the more efficient bitmap ops instead of individual test/set bit ops. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- fs/iomap/buffered-io.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 639d54a4177e..dbf9572dabe9 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -134,19 +134,11 @@ iomap_iop_set_range_uptodate(struct page *page, unsigned off, unsigned len) struct inode *inode = page->mapping->host; unsigned first = off >> inode->i_blkbits; unsigned last = (off + len - 1) >> inode->i_blkbits; - bool uptodate = true; unsigned long flags; - unsigned int i; spin_lock_irqsave(&iop->uptodate_lock, flags); - for (i = 0; i < i_blocks_per_page(inode, page); i++) { - if (i >= first && i <= last) - set_bit(i, iop->uptodate); - else if (!test_bit(i, iop->uptodate)) - uptodate = false; - } - - if (uptodate) + bitmap_set(iop->uptodate, first, last - first + 1); + if (bitmap_full(iop->uptodate, i_blocks_per_page(inode, page))) SetPageUptodate(page); spin_unlock_irqrestore(&iop->uptodate_lock, flags); } -- 2.28.0