Skip to content

Commit 74aa8c2

Browse files
martinkpetersenJens Axboe
authored andcommitted
block: Introduce integrity data ownership flag
A filesystem might supply its own integrity metadata. Introduce a flag that indicates whether the filesystem or the block layer owns the integrity buffer. Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
1 parent b04accc commit 74aa8c2

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

‎fs/bio-integrity.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ void bio_integrity_free(struct bio *bio, struct bio_set *bs)
107107
BUG_ON(bip == NULL);
108108

109109
/* A cloned bio doesn't own the integrity metadata */
110-
if (!bio_flagged(bio, BIO_CLONED) && bip->bip_buf != NULL)
110+
if (!bio_flagged(bio, BIO_CLONED) && !bio_flagged(bio, BIO_FS_INTEGRITY)
111+
&& bip->bip_buf != NULL)
111112
kfree(bip->bip_buf);
112113

113114
mempool_free(bip->bip_vec, bs->bvec_pools[bip->bip_pool]);

‎include/linux/bio.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ struct bio {
109109
#define BIO_EOPNOTSUPP 7 /* not supported */
110110
#define BIO_CPU_AFFINE 8 /* complete bio on same CPU as submitted */
111111
#define BIO_NULL_MAPPED 9 /* contains invalid user pages */
112+
#define BIO_FS_INTEGRITY 10 /* fs owns integrity data, not block layer */
112113
#define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag)))
113114

114115
/*

0 commit comments

Comments
 (0)