Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion block/bio-integrity-auto.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void bio_integrity_prep(struct bio *bio, unsigned int action)
bio_integrity_init(bio, &bid->bip, &bid->bvec, 1);
bid->bio = bio;
bid->bip.bip_flags |= BIP_BLOCK_INTEGRITY;
bio_integrity_alloc_buf(bio, action & BI_ACT_ZERO);
bio_integrity_alloc_buf(bio, GFP_NOIO, action & BI_ACT_ZERO);
if (action & BI_ACT_CHECK)
bio_integrity_setup_default(bio);

Expand Down
4 changes: 2 additions & 2 deletions block/bio-integrity-fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ unsigned int fs_bio_integrity_alloc(struct bio *bio)
if (!action)
return 0;

iib = mempool_alloc(&fs_bio_integrity_pool, GFP_NOIO);
iib = mempool_alloc(&fs_bio_integrity_pool, GFP_NOFS);
bio_integrity_init(bio, &iib->bip, &iib->bvec, 1);

bio_integrity_alloc_buf(bio, action & BI_ACT_ZERO);
bio_integrity_alloc_buf(bio, GFP_NOFS, action & BI_ACT_ZERO);
if (action & BI_ACT_CHECK)
bio_integrity_setup_default(bio);
return action;
Expand Down
9 changes: 4 additions & 5 deletions block/bio-integrity.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ unsigned int __bio_integrity_action(struct bio *bio)
}
return BI_ACT_BUFFER | BI_ACT_CHECK;
case REQ_OP_WRITE:
case REQ_OP_ZONE_APPEND:
/*
* Flush masquerading as write?
*/
Expand All @@ -64,20 +65,18 @@ unsigned int __bio_integrity_action(struct bio *bio)
}
EXPORT_SYMBOL_GPL(__bio_integrity_action);

void bio_integrity_alloc_buf(struct bio *bio, bool zero_buffer)
void bio_integrity_alloc_buf(struct bio *bio, gfp_t gfp, bool zero_buffer)
{
struct blk_integrity *bi = blk_get_integrity(bio->bi_bdev->bd_disk);
struct bio_integrity_payload *bip = bio_integrity(bio);
unsigned int len = bio_integrity_bytes(bi, bio_sectors(bio));
gfp_t gfp = GFP_NOIO | (zero_buffer ? __GFP_ZERO : 0);
void *buf;

buf = kmalloc(len, (gfp & ~__GFP_DIRECT_RECLAIM) |
__GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN);
buf = kmalloc(len, gfp | __GFP_NOWARN | (zero_buffer ? __GFP_ZERO : 0));
if (unlikely(!buf)) {
struct page *page;

page = mempool_alloc(&integrity_buf_pool, GFP_NOFS);
page = mempool_alloc(&integrity_buf_pool, gfp);
if (zero_buffer)
memset(page_address(page), 0, len);
bvec_set_page(&bip->bip_vec[0], page, len, 0);
Expand Down
2 changes: 1 addition & 1 deletion include/linux/bio-integrity.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ static inline int bio_integrity_add_page(struct bio *bio, struct page *page,
}
#endif /* CONFIG_BLK_DEV_INTEGRITY */

void bio_integrity_alloc_buf(struct bio *bio, bool zero_buffer);
void bio_integrity_alloc_buf(struct bio *bio, gfp_t gfp, bool zero_buffer);
void bio_integrity_free_buf(struct bio_integrity_payload *bip);
void bio_integrity_setup_default(struct bio *bio);

Expand Down
Loading