Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp446188lqp; Thu, 21 Mar 2024 06:17:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVYLMcUr9KaRapJA0AmcmZ7En+Qo9mMnrNtQQGxT/YhWbmcsJ160VGjArl8P+4MWLVE8DUtFOfYLSCan5r8cRbc1hMrEGdaP2ggxdbxjA== X-Google-Smtp-Source: AGHT+IFxhgv8KZZTM1OuteNR9mrLyGpqGmLlCHJxstn5f1nTJFpDChc5KfUdnnPNoT+mH9st9eWJ X-Received: by 2002:ac8:5bd0:0:b0:431:2863:3a5e with SMTP id b16-20020ac85bd0000000b0043128633a5emr831575qtb.1.1711027036375; Thu, 21 Mar 2024 06:17:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711027036; cv=pass; d=google.com; s=arc-20160816; b=rx7bd4YHzzIrTACiL3RzS4ubnVW8tcvmBGhQ4T60SOrD3ffzF/cFKoUgyyanbc3dx1 yhcwwLB2Pmpp80SRCKozHQDPWKXePpq172HqIaKTZLWGlmLTONAacPXZ5OUFJUdzs+FH Vm5DHB93c6855C4JEYWYNYoSSD9PfHtJB73+mjojuHFQTg9XgWbUtrbyoewpTzB188gM A1IUFSb5RfbSwQ9KhyEgkIZI0Dlzn0UKaHjDdVSkG1jxZoD/guCtKabvAtqE1EOaroJF zk57RmzUgvT/vnAulyTKoy9iPa3/HC/6IncvCGMZY6c+OXqlh5ERbdxwQEX0cLyPVHPk 5ZrQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=uZLAkEXZaFL4i4DZj/gsthYEyBtLICxQJ2QiuVvtwrg=; fh=hTDDgOs6UeYLL9b6GvD5KQqb1t24mhES3qSwJd33RnU=; b=XQqyRBZQl2ZbfyM4dF2h957gP125ogdILn7iuGrWuP3a6EY4UOloLAptBlTlkxVqJ2 +gjNRGFrDgamj8GQs5+eB4R7bm8sUhQOo+zQnhvKSRpubsOkOXFGfTp7CByVEhFY9GZQ FRHeceQvfFhumDjyuZ/nlbU1I9BSduDmFQeDXqSalpssIK48LrkjlG68HpgdGjdxLAJx hgJ476FL6uFVN3/1doY8OYTqJLmLBLj7STlTVtcbNfxKB4KU1LgJ2/c85TM6p+kduFNf swugX86c2Ba8xrBNlahaxfXLHZOjw9d4HIoaFGPDG+IHMTYGLl7PLrLmkfNKWvvfJgtP R1fg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-110084-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110084-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id w32-20020a05622a192000b0042ee2cad0ffsi13159603qtc.204.2024.03.21.06.17.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 06:17:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-110084-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-110084-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110084-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 050D11C220B4 for ; Thu, 21 Mar 2024 13:17:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 61CF084FB7; Thu, 21 Mar 2024 13:16:56 +0000 (UTC) Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E26BF84A35; Thu, 21 Mar 2024 13:16:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.191 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711027015; cv=none; b=Dq46x20xXC2k5MvTXRhs8UUKVP9jdSEgE8o8+3UmoMslgvv09PVA4dmyzDhbp/ZkSM+ckPgfB5shNpyGHLGIzQTLbkG2EoHpd4xeYpegXkc19wK3T7/OdOv1ozLDbnN2uOz+xnYqbxq8BRFCoEbChzZjlY0svwnABYe05pDZH4U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711027015; c=relaxed/simple; bh=SHnQtw4dKc0R/ujzvDsJeNwStpWmku6bHV78paAk1vM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tYWO1FdkqDmYwbt+eDyt7hL5QYJ/+sS1IU/scHrBov44F7UNarGTJhGMVTHipB8adHs4Rsa7skpUlvKwsXlxu9IGRzcGgvxxZ900vul2cdSOCzKzaE0Gd6kK4S5TI+CNMcYX7qrXScXVp3WjOpZfYRbBFouBNHiLah2yIvBE+7g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.191 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.214]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4V0mF614tJz1GCJd; Thu, 21 Mar 2024 21:16:26 +0800 (CST) Received: from dggpemm100001.china.huawei.com (unknown [7.185.36.93]) by mail.maildlp.com (Postfix) with ESMTPS id 9E1E51A016C; Thu, 21 Mar 2024 21:16:50 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Thu, 21 Mar 2024 21:16:50 +0800 From: Kefeng Wang To: Alexander Viro , Benjamin LaHaise , Christian Brauner , Jan Kara , , Matthew Wilcox CC: , , Kefeng Wang Subject: [PATCH v2 2/3] fs: aio: use a folio in aio_free_ring() Date: Thu, 21 Mar 2024 21:16:39 +0800 Message-ID: <20240321131640.948634-3-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240321131640.948634-1-wangkefeng.wang@huawei.com> References: <20240321131640.948634-1-wangkefeng.wang@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm100001.china.huawei.com (7.185.36.93) Use a folio throughout aio_free_ring() to remove calls to compound_head(), also move pr_debug after folio check to remove unnecessary print. Signed-off-by: Kefeng Wang --- fs/aio.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/fs/aio.c b/fs/aio.c index 60da236ad575..738654b58bfb 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -334,14 +334,15 @@ static void aio_free_ring(struct kioctx *ctx) put_aio_ring_file(ctx); for (i = 0; i < ctx->nr_pages; i++) { - struct page *page; - pr_debug("pid(%d) [%d] page->count=%d\n", current->pid, i, - page_count(ctx->ring_pages[i])); - page = ctx->ring_pages[i]; - if (!page) + struct folio *folio = page_folio(ctx->ring_pages[i]); + + if (!folio) continue; + + pr_debug("pid(%d) [%d] folio->count=%d\n", current->pid, i, + folio_ref_count(folio)); ctx->ring_pages[i] = NULL; - put_page(page); + folio_put(folio); } if (ctx->ring_pages && ctx->ring_pages != ctx->internal_pages) { -- 2.27.0