From patchwork Wed Jul 19 09:58:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13318707 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 F0CFEC001B0 for ; Wed, 19 Jul 2023 09:59:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4DAB0280045; Wed, 19 Jul 2023 05:59:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 487E128004C; Wed, 19 Jul 2023 05:59:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 30641280045; Wed, 19 Jul 2023 05:59:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 134DB28004C for ; Wed, 19 Jul 2023 05:59:07 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id D0EB41A0166 for ; Wed, 19 Jul 2023 09:59:06 +0000 (UTC) X-FDA: 81027913092.12.3424FF7 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf13.hostedemail.com (Postfix) with ESMTP id C7EE620011 for ; Wed, 19 Jul 2023 09:59:03 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf13.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689760745; a=rsa-sha256; cv=none; b=sA7wa6rBJI1T9QwESBqn/xEzNaRHzVtHAD4QOpP+VNkVmtDfwb4yS3lUoCwQzq3reCaDFa 7x4s2q5iRTZgCQkWNJw/rDEW0J/AAi8frzAxz/qHcICeUXZmnKkzCzD39ez2/W9POPC+h+ EgKQDZUP794gTUyonQ89t3Oibrnmm/U= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf13.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689760745; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JkdEw75PGEAD1hzTApmf9Om0rkylUsU2dhCGnIkdYhw=; b=uF55+qZQpPpkSIauyObqvN03DR9/pL1E+2idPRwob1asFIq57YsTJRDTG4atmPlqd24RGC xWdZLxpW8riNwDDqmp48JT5lG0OBv7csChLHGzuj5vkJ1y5UImLayqF/jaobMNOUmpmkMS jlHZYlaAEMkCMoM1H/Tz6a13jo6IWC8= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4R5WRw64D0zLnrr; Wed, 19 Jul 2023 17:56:28 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by kwepemm600020.china.huawei.com (7.193.23.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Wed, 19 Jul 2023 17:58:55 +0800 From: Peng Zhang To: , , CC: , , , , ZhangPeng Subject: [PATCH v2 3/9] mm/page_io: convert bio_first_page_all() to bio_first_folio_all() Date: Wed, 19 Jul 2023 17:58:42 +0800 Message-ID: <20230719095848.3422629-4-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230719095848.3422629-1-zhangpeng362@huawei.com> References: <20230719095848.3422629-1-zhangpeng362@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: C7EE620011 X-Stat-Signature: byigmfwoduuitosug7bd5sbwf3oci1g4 X-Rspam-User: X-HE-Tag: 1689760743-768829 X-HE-Meta: U2FsdGVkX1+DC7o37XVGV7xDNMEPmbjveKqfhfMn3huQNcr0QbOu5cJksvlbivA1YclnhIlXPuNqpAZCXlwDzkFaAdt0b8XdjC1LiYfZSdEEAe5DZp3VTf0hVSGg2HqGY/3ZtWucgmuh9NnId1nDq22IMJL8Zkd+BytMY7hkJg8hawSVO1++8dXx4qesP5do9n+UQfKw0/EuHrPFdgUW0f4xTXs/bozfcdsitnu5CGuMb7NmAgyubgVKSPhRnYIInAixW1mBvnLJovR3s3zUPjuAHkQ58GSzDCYfesIL3K5rFK/HROlyd8eJEfQV1Olj7Rz4h086r/Eph76zpHDLo37ipRyUs64gRKojjzpb3pawt0Y9KDY7zJYKLtafjEg4WSHTJd3S82vw4zKgTd8Q0y/5PB7UDMTDiBdcg77A7lSl2EgJGsEkARSjO06N8nmhNyw3Mm1D+S7e4aVbFJJNzMW6qDF1KlQ4V8HbV9jzjUBfIbUTelxpRebd4EoaLrp63oebDxHS3WZnu4rdPscj9tJGAw8o4tlA5MKNHITYG1z6/Em8Q+UodwHtIzjkVOQ4c86fxje6WwN/0upR7p5f92vFezZ0qLFLUXBfiTYhhRjmCFJH5Z8LNcZQozY4jgElVhNvPfk9h9FkMpZx9u6D7xrcfpRPNfB7Gdwo3HK8pdoi/lnT641BtNh2cf1i1mrGAWm3YnTsFnAcHHIWMm5RqJlSQeZOVTiNEi9jK6/cudGKPnb/NeZc7wjfyCkwQ03Lvtpi42Rpr6eUHHFjvaeYYENjmEMQ+M4U4ezUWzyA73SLwbBjt+Mwn8xfh85rF5W4WmvVUKVwPCAugkqChRaNTNzSYTi8vCZ+VSq932ZtbCymmRsUJG7ERQB00NcPB9tR0Gn8+IsLQA3iEikuZ9GRyGfuR2Xs+nbTlo/bfLMu4gWCzP6LP/ljAuA7xtUVsudKE0K04OndcCv6+Sk9FKD EUqalZGX 8iQkYkDwEjCbtTQH7rArFSqCpF6/f0tiBTajvLcnDOzPTmlGDl1EP7qYM55BYt537p9+RtsqDfiEW9lbQm21fkNI5kCG/PJa6RG5oecMoEPAey2ltxJnePZr+peTBG9d20J4H621OkXMsJpj4XzE2sznIEmM7W6ngnmPwX3nnY7iYfh0t1A+ld3GpZscI9ASE8l3FYy4BAz7ipJ6BcQKUQL2JrVu2EvfhCcIx7qc06XUOgd3AJa8NJaorNKErRXUTh66i 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: From: ZhangPeng Convert bio_first_page_all() to bio_first_folio_all() to return a folio, which makes it easier to use. Suggested-by: Matthew Wilcox (Oracle) Signed-off-by: ZhangPeng --- Documentation/block/biovecs.rst | 2 +- drivers/block/drbd/drbd_bitmap.c | 2 +- fs/f2fs/data.c | 2 +- include/linux/bio.h | 4 ++-- kernel/power/swap.c | 2 +- mm/page_io.c | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Documentation/block/biovecs.rst b/Documentation/block/biovecs.rst index ddb867e0185b..258f6faed333 100644 --- a/Documentation/block/biovecs.rst +++ b/Documentation/block/biovecs.rst @@ -133,7 +133,7 @@ Usage of helpers: bio_for_each_segment_all() bio_for_each_bvec_all() bio_first_bvec_all() - bio_first_page_all() + bio_first_folio_all() bio_last_bvec_all() * The following helpers iterate over single-page segment. The passed 'struct diff --git a/drivers/block/drbd/drbd_bitmap.c b/drivers/block/drbd/drbd_bitmap.c index 85ca000a0564..ce1a07ba85ff 100644 --- a/drivers/block/drbd/drbd_bitmap.c +++ b/drivers/block/drbd/drbd_bitmap.c @@ -939,7 +939,7 @@ static void drbd_bm_endio(struct bio *bio) struct drbd_bm_aio_ctx *ctx = bio->bi_private; struct drbd_device *device = ctx->device; struct drbd_bitmap *b = device->bitmap; - unsigned int idx = bm_page_to_idx(bio_first_page_all(bio)); + unsigned int idx = bm_page_to_idx(&bio_first_folio_all(bio)->page); if ((ctx->flags & BM_AIO_COPY_PAGES) == 0 && !bm_test_page_unchanged(b->bm_pages[idx])) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 5882afe71d82..6706858de984 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -288,7 +288,7 @@ static void f2fs_post_read_work(struct work_struct *work) static void f2fs_read_end_io(struct bio *bio) { - struct f2fs_sb_info *sbi = F2FS_P_SB(bio_first_page_all(bio)); + struct f2fs_sb_info *sbi = F2FS_P_SB(&bio_first_folio_all(bio)->page); struct bio_post_read_ctx *ctx; bool intask = in_task(); diff --git a/include/linux/bio.h b/include/linux/bio.h index c4f5b5228105..7d2979d24530 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -248,9 +248,9 @@ static inline struct bio_vec *bio_first_bvec_all(struct bio *bio) return bio->bi_io_vec; } -static inline struct page *bio_first_page_all(struct bio *bio) +static inline struct folio *bio_first_folio_all(struct bio *bio) { - return bio_first_bvec_all(bio)->bv_page; + return page_folio(bio_first_bvec_all(bio)->bv_page); } static inline struct bio_vec *bio_last_bvec_all(struct bio *bio) diff --git a/kernel/power/swap.c b/kernel/power/swap.c index f6ebcd00c410..2796ce48ca4b 100644 --- a/kernel/power/swap.c +++ b/kernel/power/swap.c @@ -247,7 +247,7 @@ static void hib_finish_batch(struct hib_bio_batch *hb) static void hib_end_io(struct bio *bio) { struct hib_bio_batch *hb = bio->bi_private; - struct page *page = bio_first_page_all(bio); + struct page *page = &bio_first_folio_all(bio)->page; if (bio->bi_status) { pr_alert("Read-error on swap-device (%u:%u:%Lu)\n", diff --git a/mm/page_io.c b/mm/page_io.c index 5ddb5d9c5013..e21d570c873d 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -29,7 +29,7 @@ static void __end_swap_bio_write(struct bio *bio) { - struct page *page = bio_first_page_all(bio); + struct page *page = &bio_first_folio_all(bio)->page; if (bio->bi_status) { /* @@ -57,7 +57,7 @@ static void end_swap_bio_write(struct bio *bio) static void __end_swap_bio_read(struct bio *bio) { - struct page *page = bio_first_page_all(bio); + struct page *page = &bio_first_folio_all(bio)->page; if (bio->bi_status) { pr_alert_ratelimited("Read-error on swap-device (%u:%u:%llu)\n",