From: Xiao Ni <xni@redhat.com>
To: linan666@huaweicloud.com
Cc: song@kernel.org, yukuai@fnnas.com, linux-raid@vger.kernel.org,
linux-kernel@vger.kernel.org, yangerkun@huawei.com,
yi.zhang@huawei.com
Subject: Re: [PATCH 04/15] md/raid1: use folio for tmppage
Date: Tue, 20 Jan 2026 11:38:50 +0800 [thread overview]
Message-ID: <e6f77ede-444b-4d5c-9353-b18f84376ee7@redhat.com> (raw)
In-Reply-To: <CALTww2-bCOHsK=iXqkTokFBdG=kxc6NsdgtyfWPXBaSX6pmcAA@mail.gmail.com>
在 2026/1/19 11:20, Xiao Ni 写道:
> On Wed, Dec 17, 2025 at 8:11 PM <linan666@huaweicloud.com> wrote:
>> From: Li Nan <linan122@huawei.com>
>>
>> Convert tmppage to tmpfolio and use it throughout in raid1.
>>
>> Signed-off-by: Li Nan <linan122@huawei.com>
>> ---
>> drivers/md/raid1.h | 2 +-
>> drivers/md/raid1.c | 18 ++++++++++--------
>> 2 files changed, 11 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/md/raid1.h b/drivers/md/raid1.h
>> index c98d43a7ae99..d480b3a8c2c4 100644
>> --- a/drivers/md/raid1.h
>> +++ b/drivers/md/raid1.h
>> @@ -101,7 +101,7 @@ struct r1conf {
>> /* temporary buffer to synchronous IO when attempting to repair
>> * a read error.
>> */
>> - struct page *tmppage;
>> + struct folio *tmpfolio;
>>
>> /* When taking over an array from a different personality, we store
>> * the new thread here until we fully activate the array.
>> diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
>> index 407925951299..43453f1a04f4 100644
>> --- a/drivers/md/raid1.c
>> +++ b/drivers/md/raid1.c
>> @@ -2417,8 +2417,8 @@ static void fix_read_error(struct r1conf *conf, struct r1bio *r1_bio)
>> rdev->recovery_offset >= sect + s)) &&
>> rdev_has_badblock(rdev, sect, s) == 0) {
>> atomic_inc(&rdev->nr_pending);
>> - if (sync_page_io(rdev, sect, s<<9,
>> - conf->tmppage, REQ_OP_READ, false))
>> + if (sync_folio_io(rdev, sect, s<<9, 0,
>> + conf->tmpfolio, REQ_OP_READ, false))
>> success = 1;
>> rdev_dec_pending(rdev, mddev);
>> if (success)
>> @@ -2447,7 +2447,8 @@ static void fix_read_error(struct r1conf *conf, struct r1bio *r1_bio)
>> !test_bit(Faulty, &rdev->flags)) {
>> atomic_inc(&rdev->nr_pending);
>> r1_sync_page_io(rdev, sect, s,
>> - conf->tmppage, REQ_OP_WRITE);
>> + folio_page(conf->tmpfolio, 0),
>> + REQ_OP_WRITE);
>> rdev_dec_pending(rdev, mddev);
>> }
>> }
>> @@ -2461,7 +2462,8 @@ static void fix_read_error(struct r1conf *conf, struct r1bio *r1_bio)
>> !test_bit(Faulty, &rdev->flags)) {
>> atomic_inc(&rdev->nr_pending);
>> if (r1_sync_page_io(rdev, sect, s,
>> - conf->tmppage, REQ_OP_READ)) {
>> + folio_page(conf->tmpfolio, 0),
>> + REQ_OP_READ)) {
>> atomic_add(s, &rdev->corrected_errors);
>> pr_info("md/raid1:%s: read error corrected (%d sectors at %llu on %pg)\n",
>> mdname(mddev), s,
>> @@ -3120,8 +3122,8 @@ static struct r1conf *setup_conf(struct mddev *mddev)
>> if (!conf->mirrors)
>> goto abort;
>>
>> - conf->tmppage = alloc_page(GFP_KERNEL);
>> - if (!conf->tmppage)
>> + conf->tmpfolio = folio_alloc(GFP_KERNEL, 0);
>> + if (!conf->tmpfolio)
>> goto abort;
>>
>> r1bio_size = offsetof(struct r1bio, bios[mddev->raid_disks * 2]);
>> @@ -3196,7 +3198,7 @@ static struct r1conf *setup_conf(struct mddev *mddev)
>> if (conf) {
>> mempool_destroy(conf->r1bio_pool);
>> kfree(conf->mirrors);
>> - safe_put_page(conf->tmppage);
>> + folio_put(conf->tmpfolio);
>> kfree(conf->nr_pending);
>> kfree(conf->nr_waiting);
>> kfree(conf->nr_queued);
>> @@ -3310,7 +3312,7 @@ static void raid1_free(struct mddev *mddev, void *priv)
>>
>> mempool_destroy(conf->r1bio_pool);
>> kfree(conf->mirrors);
>> - safe_put_page(conf->tmppage);
>> + folio_put(conf->tmpfolio);
>> kfree(conf->nr_pending);
>> kfree(conf->nr_waiting);
>> kfree(conf->nr_queued);
>> --
>> 2.39.2
>>
> Hi Nan
>
> Same question for patch04 and patch05, tmpage is used in read io path.
> From the cover letter, this patch set wants to resolve the multi pages
> in sync io path. Is it better to keep them for your future patch set?
>
> Best Regards
> Xiao
>
> Xiao
After reading patch06, I understand here. r1_sync_page_io needs to
change to r1_sync_folio_io to handle sync read error. Please ignore my
above comments. patch04 and patch05 look good to me.
Best Regards
Xiao
next prev parent reply other threads:[~2026-01-20 3:38 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-17 11:59 [PATCH 00/15] folio support for sync I/O in RAID linan666
2025-12-17 11:59 ` [PATCH 01/15] md/raid1,raid10: clean up of RESYNC_SECTORS linan666
2025-12-17 12:00 ` [PATCH 02/15] md: introduce sync_folio_io for folio support in RAID linan666
2025-12-17 12:00 ` [PATCH 03/15] md: use folio for bb_folio linan666
2026-01-19 3:03 ` Xiao Ni
2026-01-20 11:49 ` Li Nan
2025-12-17 12:00 ` [PATCH 04/15] md/raid1: use folio for tmppage linan666
2026-01-19 3:20 ` Xiao Ni
2026-01-20 3:38 ` Xiao Ni [this message]
2026-01-20 11:51 ` Li Nan
2025-12-17 12:00 ` [PATCH 05/15] md/raid10: " linan666
2025-12-17 12:00 ` [PATCH 06/15] md/raid1,raid10: use folio for sync path IO linan666
2025-12-27 1:34 ` Li Nan
2026-01-20 15:53 ` Xiao Ni
2026-01-22 2:12 ` Li Nan
2026-01-22 7:01 ` Xiao Ni
2025-12-17 12:00 ` [PATCH 07/15] md: Clean up folio sync support related code linan666
2026-01-20 16:01 ` Xiao Ni
2025-12-17 12:00 ` [PATCH 08/15] md/raid1: clean up useless sync_blocks handling in raid1_sync_request linan666
2025-12-17 12:00 ` [PATCH 09/15] md/raid1: fix IO error at logical block size granularity linan666
2025-12-17 12:00 ` [PATCH 10/15] md/raid10: " linan666
2025-12-17 12:00 ` [PATCH 11/15] md/raid1,raid10: clean up resync_fetch_folio linan666
2025-12-17 12:00 ` [PATCH 12/15] md: clean up resync_free_folio linan666
2025-12-17 12:00 ` [PATCH 13/15] md/raid1: clean up sync IO size calculation in raid1_sync_request linan666
2025-12-17 12:00 ` [PATCH 14/15] md/raid10: clean up sync IO size calculation in raid10_sync_request linan666
2025-12-17 12:00 ` [PATCH 15/15] md/raid1,raid10: fall back to smaller order if sync folio alloc fails linan666
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=e6f77ede-444b-4d5c-9353-b18f84376ee7@redhat.com \
--to=xni@redhat.com \
--cc=linan666@huaweicloud.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=song@kernel.org \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.com \
--cc=yukuai@fnnas.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