lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <3fe2e132-f5bd-466a-b43b-7a2ac27813d7@fnnas.com>
Date: Thu, 5 Feb 2026 00:57:20 +0800
From: "Yu Kuai" <yukuai@...as.com>
To: <linan666@...weicloud.com>, <song@...nel.org>
Cc: <xni@...hat.com>, <linux-raid@...r.kernel.org>, 
	<linux-kernel@...r.kernel.org>, <yangerkun@...wei.com>, 
	<yi.zhang@...wei.com>, <yukuai@...as.com>
Subject: Re: [PATCH v2 10/14] md/raid1,raid10: clean up resync_fetch_folio

Hi,

在 2026/1/28 15:57, linan666@...weicloud.com 写道:
> From: Li Nan <linan122@...wei.com>
>
> The helper resync_fetch_folio() only returns the folio member without
> any additional logic. Clean it up by accessing rf->folio directly.
>
> Signed-off-by: Li Nan <linan122@...wei.com>
> ---
>   drivers/md/raid1-10.c |  7 +------
>   drivers/md/raid1.c    | 10 ++++------
>   drivers/md/raid10.c   |  3 +--
>   3 files changed, 6 insertions(+), 14 deletions(-)

Again, I think this patch should be merged into patch 5.

>
> diff --git a/drivers/md/raid1-10.c b/drivers/md/raid1-10.c
> index 568ab002691f..2ff1f8855900 100644
> --- a/drivers/md/raid1-10.c
> +++ b/drivers/md/raid1-10.c
> @@ -55,11 +55,6 @@ static inline void resync_free_folio(struct resync_folio *rf)
>   	folio_put(rf->folio);
>   }
>   
> -static inline struct folio *resync_fetch_folio(struct resync_folio *rf)
> -{
> -	return rf->folio;
> -}
> -
>   /*
>    * 'strct resync_folio' stores actual pages used for doing the resync
>    *  IO, and it is per-bio, so make .bi_private points to it.
> @@ -74,7 +69,7 @@ static void md_bio_reset_resync_folio(struct bio *bio, struct resync_folio *rf,
>   			       int size)
>   {
>   	/* initialize bvec table again */
> -	if (WARN_ON(!bio_add_folio(bio, resync_fetch_folio(rf),
> +	if (WARN_ON(!bio_add_folio(bio, rf->folio,
>   				   min_t(int, size, RESYNC_BLOCK_SIZE),
>   				   0))) {
>   		bio->bi_status = BLK_STS_RESOURCE;
> diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
> index 27e3b2375b16..a303349eeff4 100644
> --- a/drivers/md/raid1.c
> +++ b/drivers/md/raid1.c
> @@ -2981,8 +2981,8 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr,
>   		max_sector = sector_nr + good_sectors;
>   	nr_sectors = 0;
>   	do {
> -		struct folio *folio;
>   		int len = RESYNC_BLOCK_SIZE;
> +
>   		if (sector_nr + (len>>9) > max_sector)
>   			len = (max_sector - sector_nr) << 9;
>   		if (len == 0)
> @@ -2996,13 +2996,11 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr,
>   			len = sync_blocks<<9;
>   
>   		for (i = 0 ; i < conf->raid_disks * 2; i++) {
> -			struct resync_folio *rf;
> -
>   			bio = r1_bio->bios[i];
> -			rf = get_resync_folio(bio);
>   			if (bio->bi_end_io) {
> -				folio = resync_fetch_folio(rf);
> -				bio_add_folio_nofail(bio, folio, len, 0);
> +				struct resync_folio *rf = get_resync_folio(bio);
> +
> +				bio_add_folio_nofail(bio, rf->folio, len, 0);
>   			}
>   		}
>   		nr_sectors += len>>9;
> diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
> index 06257eea97ed..d8a5fadfc933 100644
> --- a/drivers/md/raid10.c
> +++ b/drivers/md/raid10.c
> @@ -3630,9 +3630,8 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
>   			break;
>   		for (bio= biolist ; bio ; bio=bio->bi_next) {
>   			struct resync_folio *rf = get_resync_folio(bio);
> -			struct folio *folio = resync_fetch_folio(rf);
>   
> -			if (WARN_ON(!bio_add_folio(bio, folio, len, 0))) {
> +			if (WARN_ON(!bio_add_folio(bio, rf->folio, len, 0))) {
>   				bio->bi_status = BLK_STS_RESOURCE;
>   				bio_endio(bio);
>   				*skipped = 1;

-- 
Thansk,
Kuai

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ