From: "Martin K. Petersen" <martin.petersen@oracle.com>
To: linux-scsi@vger.kernel.org
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Subject: [PATCH 10/14] block: Relocate bio integrity flags
Date: Fri, 25 Jul 2014 16:34:25 -0400 [thread overview]
Message-ID: <1406320469-29352-11-git-send-email-martin.petersen@oracle.com> (raw)
In-Reply-To: <1406320469-29352-1-git-send-email-martin.petersen@oracle.com>
Move flags affecting the integrity code out of the bio bi_flags and into
the block integrity payload.
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
---
block/bio-integrity.c | 4 ++--
drivers/scsi/sd_dif.c | 4 ++--
include/linux/bio.h | 9 ++++++++-
include/linux/blk_types.h | 6 ++----
4 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index 3a54e695b445..63460cc34abe 100644
--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -98,7 +98,7 @@ void bio_integrity_free(struct bio *bio)
struct bio_integrity_payload *bip = bio_integrity(bio);
struct bio_set *bs = bio->bi_pool;
- if (bip->bip_owns_buf)
+ if (bip->bip_flags & BIP_BLOCK_INTEGRITY)
kfree(page_address(bip->bip_vec->bv_page) +
bip->bip_vec->bv_offset);
@@ -299,7 +299,7 @@ int bio_integrity_prep(struct bio *bio)
return -EIO;
}
- bip->bip_owns_buf = 1;
+ bip->bip_flags |= BIP_BLOCK_INTEGRITY;
bip->bip_iter.bi_size = len;
bip_set_seed(bip, bio->bi_iter.bi_sector);
diff --git a/drivers/scsi/sd_dif.c b/drivers/scsi/sd_dif.c
index 1e971c6f8c2b..4ce636fdc15f 100644
--- a/drivers/scsi/sd_dif.c
+++ b/drivers/scsi/sd_dif.c
@@ -326,7 +326,7 @@ void sd_dif_prepare(struct request *rq, sector_t hw_sector,
unsigned int j;
/* Already remapped? */
- if (bio_flagged(bio, BIO_MAPPED_INTEGRITY))
+ if (bip->bip_flags & BIP_MAPPED_INTEGRITY)
break;
virt = bip_get_seed(bip) & 0xffffffff;
@@ -347,7 +347,7 @@ void sd_dif_prepare(struct request *rq, sector_t hw_sector,
kunmap_atomic(sdt);
}
- bio->bi_flags |= (1 << BIO_MAPPED_INTEGRITY);
+ bip->bip_flags |= BIP_MAPPED_INTEGRITY;
}
}
diff --git a/include/linux/bio.h b/include/linux/bio.h
index b43f8acc845e..2657425629a8 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -314,7 +314,7 @@ struct bio_integrity_payload {
unsigned short bip_slab; /* slab the bip came from */
unsigned short bip_vcnt; /* # of integrity bio_vecs */
- unsigned bip_owns_buf:1; /* should free bip_buf */
+ unsigned short bip_flags; /* control flags */
struct work_struct bip_work; /* I/O completion */
@@ -322,6 +322,13 @@ struct bio_integrity_payload {
struct bio_vec bip_inline_vecs[0];/* embedded bvec array */
};
+enum bip_flags {
+ BIP_BLOCK_INTEGRITY = 1 << 0, /* block layer owns integrity data */
+ BIP_MAPPED_INTEGRITY = 1 << 1, /* ref tag has been remapped */
+ BIP_CTRL_NOCHECK = 1 << 2, /* disable HBA integrity checking */
+ BIP_DISK_NOCHECK = 1 << 3, /* disable disk integrity checking */
+};
+
static inline sector_t bip_get_seed(struct bio_integrity_payload *bip)
{
return bip->bip_iter.bi_sector;
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 0b7084f7c136..c96939d488ed 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -120,10 +120,8 @@ struct bio {
#define BIO_USER_MAPPED 6 /* contains user pages */
#define BIO_EOPNOTSUPP 7 /* not supported */
#define BIO_NULL_MAPPED 8 /* contains invalid user pages */
-#define BIO_FS_INTEGRITY 9 /* fs owns integrity data, not block layer */
-#define BIO_QUIET 10 /* Make BIO Quiet */
-#define BIO_MAPPED_INTEGRITY 11/* integrity metadata has been remapped */
-#define BIO_SNAP_STABLE 12 /* bio data must be snapshotted during write */
+#define BIO_QUIET 9 /* Make BIO Quiet */
+#define BIO_SNAP_STABLE 10 /* bio data must be snapshotted during write */
/*
* Flags starting here get preserved by bio_reset() - this includes
--
1.9.3
next prev parent reply other threads:[~2014-07-25 20:33 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-25 20:34 Block/SCSI data integrity update v2 Martin K. Petersen
2014-07-25 20:34 ` [PATCH 01/14] block: Get rid of bdev_integrity_enabled() Martin K. Petersen
2014-07-25 20:34 ` [PATCH 02/14] block: Replace bi_integrity with bi_special Martin K. Petersen
2014-07-26 15:24 ` Christoph Hellwig
2014-08-06 13:15 ` Sagi Grimberg
2014-07-25 20:34 ` [PATCH 03/14] block: Remove integrity tagging functions Martin K. Petersen
2014-08-06 13:16 ` Sagi Grimberg
2014-07-25 20:34 ` [PATCH 04/14] block: Remove bip_buf Martin K. Petersen
2014-07-25 20:34 ` [PATCH 05/14] block: Deprecate the use of the term sector in the context of block integrity Martin K. Petersen
2014-07-26 15:25 ` Christoph Hellwig
2014-08-06 13:32 ` Sagi Grimberg
2014-08-06 13:43 ` Sagi Grimberg
2014-07-25 20:34 ` [PATCH 06/14] block: Make protection interval calculation generic Martin K. Petersen
2014-07-26 15:26 ` Christoph Hellwig
2014-08-06 15:43 ` Sagi Grimberg
2014-07-25 20:34 ` [PATCH 07/14] block: Clean up the code used to generate and verify integrity metadata Martin K. Petersen
2014-07-25 20:34 ` [PATCH 08/14] block: Add prefix to block integrity profile flags Martin K. Petersen
2014-07-25 20:34 ` [PATCH 09/14] block: Add a disk flag to block integrity profile Martin K. Petersen
2014-07-25 20:34 ` Martin K. Petersen [this message]
2014-07-25 20:34 ` [PATCH 11/14] block: Integrity checksum flag Martin K. Petersen
2014-08-06 15:43 ` Sagi Grimberg
2014-07-25 20:34 ` [PATCH 12/14] block: Don't merge requests if integrity flags differ Martin K. Petersen
2014-07-25 20:34 ` [PATCH 13/14] block: Add T10 Protection Information functions Martin K. Petersen
2014-07-25 20:34 ` [PATCH 14/14] sd: Honor block layer integrity handling flags Martin K. Petersen
2014-07-26 16:23 ` Block/SCSI data integrity update v2 Christoph Hellwig
2014-07-26 16:33 ` Martin K. Petersen
2014-07-29 12:29 ` Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2014-08-28 19:31 Block/SCSI data integrity update v3 Martin K. Petersen
2014-08-28 19:31 ` [PATCH 10/14] block: Relocate bio integrity flags Martin K. Petersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1406320469-29352-11-git-send-email-martin.petersen@oracle.com \
--to=martin.petersen@oracle.com \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).