From patchwork Mon Sep 5 21:45:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vishal Moola X-Patchwork-Id: 12966578 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8317EECAAD3 for ; Mon, 5 Sep 2022 21:46:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B6DEE8022B; Mon, 5 Sep 2022 17:46:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B1C0380224; Mon, 5 Sep 2022 17:46:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9E4D08022B; Mon, 5 Sep 2022 17:46:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 8C70880224 for ; Mon, 5 Sep 2022 17:46:05 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 56BEA14065E for ; Mon, 5 Sep 2022 21:46:05 +0000 (UTC) X-FDA: 79879365090.28.461FACF Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) by imf02.hostedemail.com (Postfix) with ESMTP id 08EEE80074 for ; Mon, 5 Sep 2022 21:46:04 +0000 (UTC) Received: by mail-pj1-f44.google.com with SMTP id mj6so9389033pjb.1 for ; Mon, 05 Sep 2022 14:46:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=ffwlkhbya70pTRv/fpfe5oWt5Mb2pirf/lA8pBTQyDM=; b=lY1XwgXxMlS2BTmCTMapK/tq3+fDmhpyu3d2PUY0jjRfkG1Od68Y3dw4T35DDNTTx4 TVIIKu5wWf41RwMlBzKNotkCUjuYfZCjf5RQyv2kDrplK6ruS+XUx/EZIVm1lxQQg8S5 tPZ8qwPCWa83o1BqhjBaMQizXvLzcTddng+7Zq+MKjFkgDTd7JYWbSPgMtfAsmYnFz++ meHOlymzsCRIzJ8Dn7bSpdjBCRZv57nSO0MTOZozNntPRdo2akNSnCNvTuzKnQ36FEcy 2xajCYUQl5RFbve3ySfxmtNo4An2em5UOrFxPb0jgx/Vd+TMAcxML2L+Hp5XQxegjrAq nBqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=ffwlkhbya70pTRv/fpfe5oWt5Mb2pirf/lA8pBTQyDM=; b=bTblt2BfvecoM/SOGrZERPJXRrjMzntitgruvBJrBgPRRa6GkALaMk8BLBWD/Arakx a7MCbYU1S7gUU90sZ8w64U2sV/E25NGTWBTkHJfRs3+BwTzQvccBaOONX/b2Tyh6+CCi 72pDfxoSulEOEPtPkdwNuDE1385kk5ybfySvEuefGjx9aSvketkh7mQ7Fy8MXJnAmomc LL0AROvPREAdFdbZSxe520ltRh3galfg/RtqwZk7r4sBB78PVfDy7CYuGRc/1kStnBAm WGLG5caat7Fr0U+hjytQmzYUaDWXQ36JycuPWyfRHflasly4fGRQKcy8vFS+ulDvTk70 TL5g== X-Gm-Message-State: ACgBeo3BXQSyqXNTJv2DNIpFqz8dYR3VCZaSp/srNy3hc2P8EXOhUcbe pz1XN6mtkexLm9FrTn49dfzMK+boZqY= X-Google-Smtp-Source: AA6agR4MhvcgjsvSNve5IhswU6lghB0tnilpoqrbT4W/5EwR87thdNK4DMdRUqC7TTv0aAOry4XjQw== X-Received: by 2002:a17:90b:388d:b0:1ff:f17b:244d with SMTP id mu13-20020a17090b388d00b001fff17b244dmr21609542pjb.231.1662414363674; Mon, 05 Sep 2022 14:46:03 -0700 (PDT) Received: from vmfolio.. (c-73-189-111-8.hsd1.ca.comcast.net. [73.189.111.8]) by smtp.googlemail.com with ESMTPSA id c11-20020a170903234b00b0016ed5266a5csm3906793plh.170.2022.09.05.14.46.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 14:46:03 -0700 (PDT) From: "Vishal Moola (Oracle)" To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, akpm@linux-foundation.org, willy@infradead.org, "Vishal Moola (Oracle)" Subject: [PATCH] filemap: Convert filemap_range_has_writeback() to use folios Date: Mon, 5 Sep 2022 14:45:57 -0700 Message-Id: <20220905214557.868606-1-vishal.moola@gmail.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662414365; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=ffwlkhbya70pTRv/fpfe5oWt5Mb2pirf/lA8pBTQyDM=; b=BukRHq6hfUdsJsbFEXbt8B2eAV/VGcPyr6naPTvZTevjcuOxcnx4CB7Tm7Y8MBqd9mH6XO sI8EZGxh77R9nB8bHe+//jqSiqATDozWQ/f9/Xe0vWeGpW7+TifwaDWIaG+LCwGm761bEx Gg9QhIeNKTGwWNteJr3N7DKm6ZoTc5s= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=lY1XwgXx; spf=pass (imf02.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.44 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662414365; a=rsa-sha256; cv=none; b=re2RLqEDM9qXSabkKnGq2y/ntw/AdGCLyJeY0cEgTez6GzcEsHsHuuDHOeIvjoZkXZRfBK UzQm2ybKX+a0CprKkgRrsdtL+TLbW6yoGryFSQp43KlQ2Wh5RQMMqYGgwgTRpQJdn9pp5s wHC1dZtbdI/3t5GhSUO4nbYw70ExXAg= X-Rspam-User: Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=lY1XwgXx; spf=pass (imf02.hostedemail.com: domain of vishal.moola@gmail.com designates 209.85.216.44 as permitted sender) smtp.mailfrom=vishal.moola@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam07 X-Stat-Signature: 77n1kfzqya598rgoqgy6oyk5dm3m5tot X-Rspamd-Queue-Id: 08EEE80074 X-HE-Tag: 1662414364-312332 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: Removes 3 calls to compound_head(). Signed-off-by: Vishal Moola (Oracle) --- mm/filemap.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 15800334147b..a4c71b90491c 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -632,22 +632,23 @@ bool filemap_range_has_writeback(struct address_space *mapping, { XA_STATE(xas, &mapping->i_pages, start_byte >> PAGE_SHIFT); pgoff_t max = end_byte >> PAGE_SHIFT; - struct page *page; + struct folio *folio; if (end_byte < start_byte) return false; rcu_read_lock(); - xas_for_each(&xas, page, max) { - if (xas_retry(&xas, page)) + xas_for_each(&xas, folio, max) { + if (xas_retry(&xas, folio)) continue; - if (xa_is_value(page)) + if (xa_is_value(folio)) continue; - if (PageDirty(page) || PageLocked(page) || PageWriteback(page)) + if (folio_test_dirty(folio) || folio_test_locked(folio) || + folio_test_writeback(folio)) break; } rcu_read_unlock(); - return page != NULL; + return folio != NULL; } EXPORT_SYMBOL_GPL(filemap_range_has_writeback);