From: "Yu Kuai" <yukuai@fnnas.com>
To: <linan666@huaweicloud.com>, <song@kernel.org>
Cc: <xni@redhat.com>, <linux-raid@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <yangerkun@huawei.com>,
<yi.zhang@huawei.com>, <yukuai@fnnas.com>
Subject: Re: [PATCH v2 02/14] md: introduce sync_folio_io for folio support in RAID
Date: Thu, 5 Feb 2026 00:38:47 +0800 [thread overview]
Message-ID: <3f79f293-2a77-43ad-b28d-a21ab59e112c@fnnas.com> (raw)
In-Reply-To: <20260128075708.2259525-3-linan666@huaweicloud.com>
Hi,
在 2026/1/28 15:56, linan666@huaweicloud.com 写道:
> From: Li Nan <linan122@huawei.com>
>
> Prepare for folio support in RAID by introducing sync_folio_io(),
> matching sync_page_io()'s functionality. Differences are:
>
> - Replace input parameter 'page' with 'folio'
> - Replace __bio_add_page() calls with bio_add_folio_nofail()
> - Add new parameter 'off' to prepare for adding a folio to bio in segments,
> e.g. in fix_recovery_read_error()
>
> sync_page_io() will be removed once full folio support is complete.
>
> Signed-off-by: Li Nan <linan122@huawei.com>
> ---
> drivers/md/md.h | 2 ++
> drivers/md/md.c | 27 +++++++++++++++++++++++++++
> 2 files changed, 29 insertions(+)
>
> diff --git a/drivers/md/md.h b/drivers/md/md.h
> index a083f37374d0..410f8a6b75e7 100644
> --- a/drivers/md/md.h
> +++ b/drivers/md/md.h
> @@ -920,6 +920,8 @@ void md_write_metadata(struct mddev *mddev, struct md_rdev *rdev,
> extern int md_super_wait(struct mddev *mddev);
> extern int sync_page_io(struct md_rdev *rdev, sector_t sector, int size,
> struct page *page, blk_opf_t opf, bool metadata_op);
> +extern int sync_folio_io(struct md_rdev *rdev, sector_t sector, int size,
> + int off, struct folio *folio, blk_opf_t opf, bool metadata_op);
> extern void md_do_sync(struct md_thread *thread);
> extern void md_new_event(void);
> extern void md_allow_write(struct mddev *mddev);
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 5df2220b1bd1..b8c8a16cf037 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -1192,6 +1192,33 @@ int sync_page_io(struct md_rdev *rdev, sector_t sector, int size,
> }
> EXPORT_SYMBOL_GPL(sync_page_io);
>
> +int sync_folio_io(struct md_rdev *rdev, sector_t sector, int size, int off,
> + struct folio *folio, blk_opf_t opf, bool metadata_op)
> +{
> + struct bio bio;
> + struct bio_vec bvec;
> +
> + if (metadata_op && rdev->meta_bdev)
> + bio_init(&bio, rdev->meta_bdev, &bvec, 1, opf);
> + else
> + bio_init(&bio, rdev->bdev, &bvec, 1, opf);
> +
> + if (metadata_op)
> + bio.bi_iter.bi_sector = sector + rdev->sb_start;
> + else if (rdev->mddev->reshape_position != MaxSector &&
> + (rdev->mddev->reshape_backwards ==
> + (sector >= rdev->mddev->reshape_position)))
> + bio.bi_iter.bi_sector = sector + rdev->new_data_offset;
> + else
> + bio.bi_iter.bi_sector = sector + rdev->data_offset;
Above code are the same as sync_page_io(), I think you can just remove sync_page_io()
directly in this patch, and convert to sync_folio_io() by passing in page_folio(page).
> + bio_add_folio_nofail(&bio, folio, size, off);
> +
> + submit_bio_wait(&bio);
> +
> + return !bio.bi_status;
Please also change return value to bool, and replace the checking to
bio.bi_status == BLK_STS_OK.
> +}
> +EXPORT_SYMBOL_GPL(sync_folio_io);
> +
> static int read_disk_sb(struct md_rdev *rdev, int size)
> {
> if (rdev->sb_loaded)
--
Thansk,
Kuai
next prev parent reply other threads:[~2026-02-04 16:40 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-28 7:56 [PATCH v2 00/14] folio support for sync I/O in RAID linan666
2026-01-28 7:56 ` [PATCH v2 01/14] md/raid1,raid10: clean up of RESYNC_SECTORS linan666
2026-02-04 16:29 ` Yu Kuai
2026-01-28 7:56 ` [PATCH v2 02/14] md: introduce sync_folio_io for folio support in RAID linan666
2026-02-04 16:38 ` Yu Kuai [this message]
2026-01-28 7:56 ` [PATCH v2 03/14] md/raid1: use folio for tmppage linan666
2026-02-04 16:45 ` Yu Kuai
2026-02-05 7:23 ` Li Nan
2026-02-05 7:33 ` Yu Kuai
2026-02-06 9:07 ` Li Nan
2026-01-28 7:56 ` [PATCH v2 04/14] md/raid10: " linan666
2026-01-28 7:56 ` [PATCH v2 05/14] md/raid1,raid10: use folio for sync path IO linan666
2026-01-28 7:57 ` [PATCH v2 06/14] md: Clean up folio sync support related code linan666
2026-02-04 16:52 ` Yu Kuai
2026-02-05 7:27 ` Li Nan
2026-01-28 7:57 ` [PATCH v2 07/14] md/raid1: clean up useless sync_blocks handling in raid1_sync_request linan666
2026-01-28 7:57 ` [PATCH v2 08/14] md/raid1: fix IO error at logical block size granularity linan666
2026-02-04 16:54 ` Yu Kuai
2026-01-28 7:57 ` [PATCH v2 09/14] md/raid10: " linan666
2026-02-04 16:55 ` Yu Kuai
2026-01-28 7:57 ` [PATCH v2 10/14] md/raid1,raid10: clean up resync_fetch_folio linan666
2026-02-04 16:57 ` Yu Kuai
2026-01-28 7:57 ` [PATCH v2 11/14] md: clean up resync_free_folio linan666
2026-02-04 16:59 ` Yu Kuai
2026-01-28 7:57 ` [PATCH v2 12/14] md/raid1: clean up sync IO size calculation in raid1_sync_request linan666
2026-01-28 7:57 ` [PATCH v2 13/14] md/raid10: clean up sync IO size calculation in raid10_sync_request linan666
2026-01-28 7:57 ` [PATCH v2 14/14] md/raid1,raid10: fall back to smaller order if sync folio alloc fails linan666
2026-02-04 16:48 ` Yu Kuai
2026-02-05 7:29 ` Li Nan
2026-02-04 17:02 ` [PATCH v2 00/14] folio support for sync I/O in RAID Yu Kuai
2026-02-05 12:57 ` Li Nan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3f79f293-2a77-43ad-b28d-a21ab59e112c@fnnas.com \
--to=yukuai@fnnas.com \
--cc=linan666@huaweicloud.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=song@kernel.org \
--cc=xni@redhat.com \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox