Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp305333lqp; Thu, 21 Mar 2024 01:28:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVm9WgVYvY6UkW98zxFRgMwo8BeOD6e4UcVcrA6KlZ5ATH4i4JwGFsZxQFVzoOMYgFquatFGHgXxeBlW7/hM/s0fUTONtpNb9MpIVnLSw== X-Google-Smtp-Source: AGHT+IFtjIfsyMMx8Bha7UdkWPXlJhimk8VUs5xjkdUKmzO/7ZV01n6GGf/Y65UbKhlXQrSrE+Kb X-Received: by 2002:a05:6358:c00d:b0:17f:1c95:c7d3 with SMTP id kv13-20020a056358c00d00b0017f1c95c7d3mr5165937rwc.13.1711009685201; Thu, 21 Mar 2024 01:28:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711009685; cv=pass; d=google.com; s=arc-20160816; b=UfgdpQjgeQFtRDYDNxAlpclLn50a9IqTMZLknLin6oTk3TfjA+54ZbmaqLCnCSshkU NLbU5OOHEuXLFNoO3mbQF7rIY8kei0WzrWH5AU78Z+e9e1QGI+jXQldfFzfvIO9Pim09 m2gThzXn0j5ZAw1WJ9WCxUVQTXXP9tQUWMNaTRK0cNehB45F6EFW9ekEw9+5IfCvBn+y QDM0wGcBjB1C9Uk/IEmVrEdlei24hhuSJ/Q12ytIwN7I679YW/r7qmvT9QYCIpX4X2Sq fnXQndW3LB14UlCuUDvWm3uW4sFsw2jjZ0XnNnxxFq0BOLdLl/lqvGhpkn3QFUCIzYtE +9gw== 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=L2jARw1cobWiiMRw5AhHn4+YSfcUOJZUt2gdZ1bLXxg=; fh=hTDDgOs6UeYLL9b6GvD5KQqb1t24mhES3qSwJd33RnU=; b=onYDD2v6TpxhGNjGyfR8H5M6w3ElSahuvEIHtrMT9y0U8OWGtUlkzAmbu9P7+qy7zJ UxaZnIsbzoUAZUgy+wpnGubn3S3wmHWi3WvmHv5zfrBUVyCNUyeN2ABPQJndz2Kiq0au q4XLjFz2M0R3EeuMK5Q4TnwwOr7KKDupvkjuCnMGlEdFpePhjlQXSQFEWgLke4upH1QY zMHuXC2XxC0soTmX9hc9mJrg3nACEnSLye1BTw9c8j0iGu5uAGlIxEE3YwqdQ4CTWNFT 7jj7DL4HSTKf1DHG/cqjDcCVx6BTm/TQP1FjRb32uM1TTKeP8Rf4UdjrX55URKhiVgep ylvg==; 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-109784-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109784-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id k23-20020a635617000000b005e49edf6458si13521163pgb.753.2024.03.21.01.28.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 01:28:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-109784-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; 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-109784-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-109784-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id CD3382819EB for ; Thu, 21 Mar 2024 08:28:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4502769975; Thu, 21 Mar 2024 08:27:45 +0000 (UTC) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (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 547EE56450; Thu, 21 Mar 2024 08:27:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711009664; cv=none; b=AAIouMJmxzUYWOT4WdTAaccNx6iMr6qKiau0aNcEAmiTCJ+ukrarPPtOINJN+5qORwoNnklNXhJ8tsWqoN9vS+p84VDelk0XEd7S2xB77r9R4N3hoFiNUeElRki727LTzoaRCHUTHkpieSeqvvBDEVw42wMeavywq4ykeoUkfTs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711009664; c=relaxed/simple; bh=qx5vHNazRjcBBazlPi/1CY3SCPXV75gaKD4xNYfO9BU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Of59hMW4c1zGLWMWVsXPcK7qFACp+hu1ciO4715DvJK8yO+qD1fxL1veiPpdKqzhDD0wXW0QlticUBt2YkQX/K6klzbDoV0w+eiJrGjE/aKOJOvySYA3WEQlZyqDJA5vaslUbvhjqynVYz3EJwZzBUt17WvdocDH/ZT26rq+kPo= 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.188 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.163.174]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4V0dmr5dzhzXjDb; Thu, 21 Mar 2024 16:25:00 +0800 (CST) Received: from dggpemm100001.china.huawei.com (unknown [7.185.36.93]) by mail.maildlp.com (Postfix) with ESMTPS id B4E0A140FEF; Thu, 21 Mar 2024 16:27:38 +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 16:27:38 +0800 From: Kefeng Wang To: Alexander Viro , Benjamin LaHaise , Christian Brauner , Jan Kara , , Matthew Wilcox CC: , , Kefeng Wang Subject: [PATCH 1/3] fs: aio: use a folio in aio_setup_ring() Date: Thu, 21 Mar 2024 16:27:31 +0800 Message-ID: <20240321082733.614329-2-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240321082733.614329-1-wangkefeng.wang@huawei.com> References: <20240321082733.614329-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: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm100001.china.huawei.com (7.185.36.93) Use a folio throughout aio_setup_ring() to remove calls to compound_head(). Signed-off-by: Kefeng Wang --- fs/aio.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/fs/aio.c b/fs/aio.c index 9cdaa2faa536..d7f6c8705016 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -527,17 +527,20 @@ static int aio_setup_ring(struct kioctx *ctx, unsigned int nr_events) } for (i = 0; i < nr_pages; i++) { - struct page *page; - page = find_or_create_page(file->f_mapping, - i, GFP_USER | __GFP_ZERO); - if (!page) + struct folio *folio; + + folio = __filemap_get_folio(file->f_mapping, i, + FGP_LOCK | FGP_ACCESSED | FGP_CREAT, + GFP_USER | __GFP_ZERO); + if (!folio) break; - pr_debug("pid(%d) page[%d]->count=%d\n", - current->pid, i, page_count(page)); - SetPageUptodate(page); - unlock_page(page); - ctx->ring_pages[i] = page; + pr_debug("pid(%d) [%d] folio->count=%d\n", current->pid, i, + folio_ref_count(folio)); + folio_mark_uptodate(folio); + folio_unlock(folio); + + ctx->ring_pages[i] = &folio->page; } ctx->nr_pages = i; -- 2.27.0