public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Caleb Sander Mateos <csander@purestorage.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	Anuj Gupta <anuj20.g@samsung.com>, Christoph Hellwig <hch@lst.de>,
	Caleb Sander Mateos <csander@purestorage.com>
Subject: [PATCH v2 2/3] block: replace gfp_t with bool in bio_integrity_prep()
Date: Thu,  8 Jan 2026 10:22:11 -0700	[thread overview]
Message-ID: <20260108172212.1402119-3-csander@purestorage.com> (raw)
In-Reply-To: <20260108172212.1402119-1-csander@purestorage.com>

Since commit ec7f31b2a2d3 ("block: make bio auto-integrity deadlock
safe"), the gfp_t gfp variable in bio_integrity_prep() is no longer
passed to an allocation function. It's only used to compute the
zero_buffer argument to bio_integrity_alloc_buf(). So change the
variable to bool zero_buffer to simplify the code.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
---
 block/bio-integrity-auto.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/block/bio-integrity-auto.c b/block/bio-integrity-auto.c
index cff025b06be1..605403b52c90 100644
--- a/block/bio-integrity-auto.c
+++ b/block/bio-integrity-auto.c
@@ -107,11 +107,11 @@ bool __bio_integrity_endio(struct bio *bio)
 bool bio_integrity_prep(struct bio *bio)
 {
 	struct blk_integrity *bi = blk_get_integrity(bio->bi_bdev->bd_disk);
 	struct bio_integrity_data *bid;
 	bool set_flags = true;
-	gfp_t gfp = GFP_NOIO;
+	bool zero_buffer = false;
 
 	if (!bi)
 		return true;
 
 	if (!bio_sectors(bio))
@@ -137,13 +137,14 @@ bool bio_integrity_prep(struct bio *bio)
 		 */
 		if (bi->flags & BLK_INTEGRITY_NOGENERATE) {
 			if (bi_offload_capable(bi))
 				return true;
 			set_flags = false;
-			gfp |= __GFP_ZERO;
-		} else if (bi->metadata_size > bi->pi_tuple_size)
-			gfp |= __GFP_ZERO;
+			zero_buffer = true;
+		} else {
+			zero_buffer = bi->metadata_size > bi->pi_tuple_size;
+		}
 		break;
 	default:
 		return true;
 	}
 
@@ -152,11 +153,11 @@ bool bio_integrity_prep(struct bio *bio)
 
 	bid = mempool_alloc(&bid_pool, GFP_NOIO);
 	bio_integrity_init(bio, &bid->bip, &bid->bvec, 1);
 	bid->bio = bio;
 	bid->bip.bip_flags |= BIP_BLOCK_INTEGRITY;
-	bio_integrity_alloc_buf(bio, gfp & __GFP_ZERO);
+	bio_integrity_alloc_buf(bio, zero_buffer);
 
 	bip_set_seed(&bid->bip, bio->bi_iter.bi_sector);
 
 	if (set_flags) {
 		if (bi->csum_type == BLK_INTEGRITY_CSUM_IP)
-- 
2.45.2


  parent reply	other threads:[~2026-01-08 17:22 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-08 17:22 [PATCH v2 0/3] block: zero non-PI portion of auto integrity buffer Caleb Sander Mateos
2026-01-08 17:22 ` [PATCH v2 1/3] " Caleb Sander Mateos
2026-01-09  5:51   ` Christoph Hellwig
2026-01-08 17:22 ` Caleb Sander Mateos [this message]
2026-01-08 22:28   ` [PATCH v2 2/3] block: replace gfp_t with bool in bio_integrity_prep() Anuj gupta
2026-01-09  5:52   ` Christoph Hellwig
2026-01-08 17:22 ` [PATCH v2 3/3] block: use pi_tuple_size in bi_offload_capable() Caleb Sander Mateos
2026-01-08 22:39   ` Anuj gupta
2026-01-09  5:53   ` Christoph Hellwig
2026-01-08 21:37 ` [PATCH v2 0/3] block: zero non-PI portion of auto integrity buffer Martin K. Petersen
2026-01-09 13:57 ` Jens Axboe
2026-01-09 16:29   ` Caleb Sander Mateos
2026-01-10 17:21     ` Jens Axboe
2026-01-10 17:28       ` Jens Axboe
2026-01-10 20:05       ` Caleb Sander Mateos

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=20260108172212.1402119-3-csander@purestorage.com \
    --to=csander@purestorage.com \
    --cc=anuj20.g@samsung.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.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