Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Martin K. Petersen and committed by
Jens Axboe
74aa8c2c b04accc4

+3 -1
+2 -1
fs/bio-integrity.c
··· 107 107 BUG_ON(bip == NULL); 108 108 109 109 /* 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) 111 112 kfree(bip->bip_buf); 112 113 113 114 mempool_free(bip->bip_vec, bs->bvec_pools[bip->bip_pool]);
+1
include/linux/bio.h
··· 109 109 #define BIO_EOPNOTSUPP 7 /* not supported */ 110 110 #define BIO_CPU_AFFINE 8 /* complete bio on same CPU as submitted */ 111 111 #define BIO_NULL_MAPPED 9 /* contains invalid user pages */ 112 + #define BIO_FS_INTEGRITY 10 /* fs owns integrity data, not block layer */ 112 113 #define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag))) 113 114 114 115 /*