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
On Thu, Jan 08, 2026 at 10:22:11AM -0700, Caleb Sander Mateos wrote:
> 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>
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
© 2016 - 2026 Red Hat, Inc.