public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Mikulas Patocka <mpatocka@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org,
	 "Md. Haris Iqbal" <haris.iqbal@ionos.com>,
	 Jack Wang <jinpu.wang@ionos.com>, Coly Li <colyli@kernel.org>,
	 Kent Overstreet <kent.overstreet@linux.dev>,
	 Mike Snitzer <snitzer@kernel.org>, Chris Mason <clm@fb.com>,
	 Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>,
	 Andreas Gruenbacher <agruenba@redhat.com>,
	 Carlos Maiolino <cem@kernel.org>,
	Damien Le Moal <dlemoal@kernel.org>,
	 Naohiro Aota <naohiro.aota@wdc.com>,
	Johannes Thumshirn <jth@kernel.org>,
	 "Rafael J. Wysocki" <rafael@kernel.org>,
	Pavel Machek <pavel@kernel.org>,
	 slava@dubeyko.com, glaubitz@physik.fu-berlin.de,
	frank.li@vivo.com,  linux-bcache@vger.kernel.org,
	dm-devel@lists.linux.dev,  linux-btrfs@vger.kernel.org,
	gfs2@lists.linux.dev,  linux-fsdevel@vger.kernel.org,
	linux-xfs@vger.kernel.org,  linux-pm@vger.kernel.org,
	Johannes Thumshirn <johannes.thumshirn@wdc.com>
Subject: Re: [PATCH 14/19] dm-integrity: use bio_add_virt_nofail
Date: Tue, 6 May 2025 11:37:42 +0200 (CEST)	[thread overview]
Message-ID: <0c339358-8139-aafb-dc30-6b96d42d25cf@redhat.com> (raw)
In-Reply-To: <20250430212159.2865803-15-hch@lst.de>



On Wed, 30 Apr 2025, Christoph Hellwig wrote:

> Convert the __bio_add_page(..., virt_to_page(), ...) pattern to the
> bio_add_virt_nofail helper implementing it, and do the same for the
> similar pattern using bio_add_page for adding the first segment after
> a bio allocation as that can't fail either.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

Acked-by: Mikulas Patocka <mpatocka@redhat.com>

> ---
>  drivers/md/dm-integrity.c | 16 ++++++----------
>  1 file changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c
> index 2a283feb3319..9dca9dbabfaa 100644
> --- a/drivers/md/dm-integrity.c
> +++ b/drivers/md/dm-integrity.c
> @@ -2557,14 +2557,8 @@ static void dm_integrity_inline_recheck(struct work_struct *w)
>  		char *mem;
>  
>  		outgoing_bio = bio_alloc_bioset(ic->dev->bdev, 1, REQ_OP_READ, GFP_NOIO, &ic->recheck_bios);
> -
> -		r = bio_add_page(outgoing_bio, virt_to_page(outgoing_data), ic->sectors_per_block << SECTOR_SHIFT, 0);
> -		if (unlikely(r != (ic->sectors_per_block << SECTOR_SHIFT))) {
> -			bio_put(outgoing_bio);
> -			bio->bi_status = BLK_STS_RESOURCE;
> -			bio_endio(bio);
> -			return;
> -		}
> +		bio_add_virt_nofail(outgoing_bio, outgoing_data,
> +				ic->sectors_per_block << SECTOR_SHIFT);
>  
>  		bip = bio_integrity_alloc(outgoing_bio, GFP_NOIO, 1);
>  		if (IS_ERR(bip)) {
> @@ -3211,7 +3205,8 @@ static void integrity_recalc_inline(struct work_struct *w)
>  
>  	bio = bio_alloc_bioset(ic->dev->bdev, 1, REQ_OP_READ, GFP_NOIO, &ic->recalc_bios);
>  	bio->bi_iter.bi_sector = ic->start + SB_SECTORS + range.logical_sector;
> -	__bio_add_page(bio, virt_to_page(recalc_buffer), range.n_sectors << SECTOR_SHIFT, offset_in_page(recalc_buffer));
> +	bio_add_virt_nofail(bio, recalc_buffer,
> +			range.n_sectors << SECTOR_SHIFT);
>  	r = submit_bio_wait(bio);
>  	bio_put(bio);
>  	if (unlikely(r)) {
> @@ -3228,7 +3223,8 @@ static void integrity_recalc_inline(struct work_struct *w)
>  
>  	bio = bio_alloc_bioset(ic->dev->bdev, 1, REQ_OP_WRITE, GFP_NOIO, &ic->recalc_bios);
>  	bio->bi_iter.bi_sector = ic->start + SB_SECTORS + range.logical_sector;
> -	__bio_add_page(bio, virt_to_page(recalc_buffer), range.n_sectors << SECTOR_SHIFT, offset_in_page(recalc_buffer));
> +	bio_add_virt_nofail(bio, recalc_buffer,
> +			range.n_sectors << SECTOR_SHIFT);
>  
>  	bip = bio_integrity_alloc(bio, GFP_NOIO, 1);
>  	if (unlikely(IS_ERR(bip))) {
> -- 
> 2.47.2
> 
> 


  reply	other threads:[~2025-05-06  9:38 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-30 21:21 add more bio helpers v2 Christoph Hellwig
2025-04-30 21:21 ` [PATCH 01/19] block: add a bio_add_virt_nofail helper Christoph Hellwig
2025-04-30 21:21 ` [PATCH 02/19] block: add a bdev_rw_virt helper Christoph Hellwig
2025-04-30 21:21 ` [PATCH 03/19] block: add a bio_add_max_vecs helper Christoph Hellwig
2025-05-01 18:50   ` Damien Le Moal
2025-05-02  8:11   ` Johannes Thumshirn
2025-05-02  9:16   ` Johannes Thumshirn
2025-04-30 21:21 ` [PATCH 04/19] block: add a bio_add_vmalloc helpers Christoph Hellwig
2025-05-01 18:52   ` Damien Le Moal
2025-05-02  9:20   ` Johannes Thumshirn
2025-04-30 21:21 ` [PATCH 05/19] block: remove the q argument from blk_rq_map_kern Christoph Hellwig
2025-04-30 21:21 ` [PATCH 06/19] block: pass the operation to bio_{map,copy}_kern Christoph Hellwig
2025-04-30 21:21 ` [PATCH 07/19] block: simplify bio_map_kern Christoph Hellwig
2025-05-01 18:56   ` Damien Le Moal
2025-05-02  7:05     ` Christoph Hellwig
2025-05-02  8:52   ` Johannes Thumshirn
2025-04-30 21:21 ` [PATCH 08/19] bcache: use bio_add_virt_nofail Christoph Hellwig
2025-04-30 21:21 ` [PATCH 09/19] rnbd-srv: " Christoph Hellwig
2025-04-30 21:21 ` [PATCH 10/19] gfs2: use bdev_rw_virt in gfs2_read_super Christoph Hellwig
2025-04-30 21:21 ` [PATCH 11/19] zonefs: use bdev_rw_virt in zonefs_read_super Christoph Hellwig
2025-04-30 21:21 ` [PATCH 12/19] PM: hibernate: split and simplify hib_submit_io Christoph Hellwig
2025-04-30 21:21 ` [PATCH 13/19] dm-bufio: use bio_add_virt_nofail Christoph Hellwig
2025-05-06  9:36   ` Mikulas Patocka
2025-04-30 21:21 ` [PATCH 14/19] dm-integrity: " Christoph Hellwig
2025-05-06  9:37   ` Mikulas Patocka [this message]
2025-04-30 21:21 ` [PATCH 15/19] xfs: simplify xfs_buf_submit_bio Christoph Hellwig
2025-05-01 18:57   ` Damien Le Moal
2025-05-01 19:51   ` Darrick J. Wong
2025-05-02  7:07     ` Christoph Hellwig
2025-04-30 21:21 ` [PATCH 16/19] xfs: simplify xfs_rw_bdev Christoph Hellwig
2025-04-30 21:21 ` [PATCH 17/19] xfs: simplify building the bio in xlog_write_iclog Christoph Hellwig
2025-05-01 18:58   ` Damien Le Moal
2025-05-01 19:51   ` Darrick J. Wong
2025-04-30 21:21 ` [PATCH 18/19] btrfs: use bdev_rw_virt in scrub_one_super Christoph Hellwig
2025-05-06 10:05   ` David Sterba
2025-04-30 21:21 ` [PATCH 19/19] hfsplus: use bdev_rw_virt in hfsplus_submit_bio Christoph Hellwig
2025-05-06  4:39   ` 回复: " 李扬韬
2025-05-06  4:47 ` add more bio helpers v2 Christoph Hellwig
2025-05-06  9:39   ` Mikulas Patocka
  -- strict thread matches above, loose matches on Subject: below --
2025-05-07 12:04 add more bio helpers v3 Christoph Hellwig
2025-05-07 12:04 ` [PATCH 14/19] dm-integrity: use bio_add_virt_nofail Christoph Hellwig

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=0c339358-8139-aafb-dc30-6b96d42d25cf@redhat.com \
    --to=mpatocka@redhat.com \
    --cc=agruenba@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=cem@kernel.org \
    --cc=clm@fb.com \
    --cc=colyli@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=dm-devel@lists.linux.dev \
    --cc=dsterba@suse.com \
    --cc=frank.li@vivo.com \
    --cc=gfs2@lists.linux.dev \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=haris.iqbal@ionos.com \
    --cc=hch@lst.de \
    --cc=jinpu.wang@ionos.com \
    --cc=johannes.thumshirn@wdc.com \
    --cc=josef@toxicpanda.com \
    --cc=jth@kernel.org \
    --cc=kent.overstreet@linux.dev \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=naohiro.aota@wdc.com \
    --cc=pavel@kernel.org \
    --cc=rafael@kernel.org \
    --cc=slava@dubeyko.com \
    --cc=snitzer@kernel.org \
    /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