Skip to content

Commit

Permalink
bio-integrity: Add explicit field for owner of bip_buf
Browse files Browse the repository at this point in the history
This was the only real user of BIO_CLONED, which didn't have very clear
semantics. Convert to its own flag so we can get rid of BIO_CLONED.

Signed-off-by: Kent Overstreet <koverstreet@google.com>
CC: Jens Axboe <axboe@kernel.dk>
CC: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Kent Overstreet committed Mar 23, 2013
1 parent a38352e commit 29ed781
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 2 additions & 3 deletions fs/bio-integrity.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,7 @@ void bio_integrity_free(struct bio *bio)
struct bio_integrity_payload *bip = bio->bi_integrity;
struct bio_set *bs = bio->bi_pool;

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

if (bs) {
Expand Down Expand Up @@ -386,6 +384,7 @@ int bio_integrity_prep(struct bio *bio)
return -EIO;
}

bip->bip_owns_buf = 1;
bip->bip_buf = buf;
bip->bip_size = len;
bip->bip_sector = bio->bi_sector;
Expand Down
1 change: 1 addition & 0 deletions include/linux/bio.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ struct bio_integrity_payload {
unsigned short bip_slab; /* slab the bip came from */
unsigned short bip_vcnt; /* # of integrity bio_vecs */
unsigned short bip_idx; /* current bip_vec index */
unsigned bip_owns_buf:1; /* should free bip_buf */

struct work_struct bip_work; /* I/O completion */

Expand Down

0 comments on commit 29ed781

Please sign in to comment.