scst: use t10_pi_tuple

Use t10_pi_tuple instead of scst_dif_tuple.

Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6215 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2015-06-05 02:15:09 +00:00
parent 2d2621536e
commit a4fc2e5638
2 changed files with 22 additions and 16 deletions

View File

@@ -760,11 +760,13 @@ enum scst_exec_context {
** T10-PI (DIF) support
*************************************************************/
struct scst_dif_tuple {
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0)
struct t10_pi_tuple {
__be16 guard_tag;
__be16 app_tag;
__be32 ref_tag;
};
#endif
/*
* Defines where and how to deal with DIF tags. Can be OR'ed to get

View File

@@ -45,6 +45,10 @@
#include <linux/writeback.h>
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)
#include <linux/t10-pi.h>
#endif
#ifdef INSIDE_KERNEL_TREE
#include <scst/scst.h>
#else
@@ -5575,7 +5579,7 @@ static int scst_ws_push_single_write(struct scst_write_same_priv *wsp,
for_each_sg(dif_sg, s, dif_sg_cnt, i) {
int left = (s->length - s->offset) >> SCST_DIF_TAG_SHIFT;
struct scst_dif_tuple *t = sg_virt(s);
struct t10_pi_tuple *t = sg_virt(s);
TRACE_DBG("sg %p, offset %d, length %d, left %d", s,
s->offset, s->length, left);
while (left > 0) {
@@ -5906,11 +5910,11 @@ void scst_write_same(struct scst_cmd *cmd)
sBUG_ON(left != 0); /* crash here to avoid data corruption */
if (scst_cmd_needs_dif_buf(cmd)) {
struct scst_dif_tuple *t;
struct t10_pi_tuple *t;
struct scatterlist *tags_sg = NULL;
int tags_len = 0;
t = (struct scst_dif_tuple *)scst_get_dif_buf(cmd, &tags_sg, &tags_len);
t = (struct t10_pi_tuple *)scst_get_dif_buf(cmd, &tags_sg, &tags_len);
wsp->app_tag = t->app_tag;
wsp->ref_tag = be32_to_cpu(t->ref_tag);
@@ -7702,7 +7706,7 @@ static int scst_verify_dif_type1(struct scst_cmd *cmd)
int len, tags_len = 0, tag_size = 1 << SCST_DIF_TAG_SHIFT;
struct scatterlist *tags_sg = NULL;
uint8_t *buf, *tags_buf = NULL;
const struct scst_dif_tuple *t = NULL; /* to silence compiler warning */
const struct t10_pi_tuple *t = NULL; /* to silence compiler warning */
uint64_t lba = cmd->lba;
int block_size = dev->block_size, block_shift = dev->block_shift;
__be16 (*crc_fn)(const void *buffer, unsigned int len);
@@ -7737,7 +7741,7 @@ static int scst_verify_dif_type1(struct scst_cmd *cmd)
TRACE_DBG("tags_buf %p", tags_buf);
TRACE_BUFF_FLAG(TRACE_DEBUG, "Tags to verify",
tags_buf, tags_len);
t = (struct scst_dif_tuple *)tags_buf;
t = (struct t10_pi_tuple *)tags_buf;
}
if (t->app_tag == SCST_DIF_NO_CHECK_ALL_APP_TAG) {
@@ -7864,7 +7868,7 @@ static int scst_generate_dif_type1(struct scst_cmd *cmd)
int len, tags_len = 0, tag_size = 1 << SCST_DIF_TAG_SHIFT;
struct scatterlist *tags_sg = NULL;
uint8_t *buf, *tags_buf = NULL;
struct scst_dif_tuple *t = NULL; /* to silence compiler warning */
struct t10_pi_tuple *t = NULL; /* to silence compiler warning */
uint64_t lba = cmd->lba;
int block_size = dev->block_size, block_shift = dev->block_shift;
__be16 (*crc_fn)(const void *buffer, unsigned int len);
@@ -7900,7 +7904,7 @@ static int scst_generate_dif_type1(struct scst_cmd *cmd)
TRACE_DBG("tags_sg %p, tags_buf %p, tags_len %d",
tags_sg, tags_buf, tags_len);
EXTRACHECKS_BUG_ON(tags_len <= 0);
t = (struct scst_dif_tuple *)tags_buf;
t = (struct t10_pi_tuple *)tags_buf;
}
t->app_tag = dev->dev_dif_static_app_tag;
@@ -8151,7 +8155,7 @@ static int scst_verify_dif_type2(struct scst_cmd *cmd)
int len, tags_len = 0, tag_size = 1 << SCST_DIF_TAG_SHIFT;
struct scatterlist *tags_sg = NULL;
uint8_t *buf, *tags_buf = NULL;
const struct scst_dif_tuple *t = NULL; /* to silence compiler warning */
const struct t10_pi_tuple *t = NULL; /* to silence compiler warning */
uint64_t lba = cmd->lba;
int block_size = dev->block_size, block_shift = dev->block_shift;
__be16 (*crc_fn)(const void *buffer, unsigned int len);
@@ -8187,7 +8191,7 @@ static int scst_verify_dif_type2(struct scst_cmd *cmd)
if (tags_buf == NULL) {
tags_buf = scst_get_dif_buf(cmd, &tags_sg, &tags_len);
EXTRACHECKS_BUG_ON(tags_len <= 0);
t = (struct scst_dif_tuple *)tags_buf;
t = (struct t10_pi_tuple *)tags_buf;
}
if (t->app_tag == SCST_DIF_NO_CHECK_ALL_APP_TAG) {
@@ -8281,7 +8285,7 @@ static int scst_generate_dif_type2(struct scst_cmd *cmd)
int len, tags_len = 0, tag_size = 1 << SCST_DIF_TAG_SHIFT;
struct scatterlist *tags_sg = NULL;
uint8_t *buf, *tags_buf = NULL;
struct scst_dif_tuple *t = NULL; /* to silence compiler warning */
struct t10_pi_tuple *t = NULL; /* to silence compiler warning */
int block_size = dev->block_size, block_shift = dev->block_shift;
__be16 (*crc_fn)(const void *buffer, unsigned int len);
uint32_t ref_tag = scst_cmd_get_dif_exp_ref_tag(cmd);
@@ -8320,7 +8324,7 @@ static int scst_generate_dif_type2(struct scst_cmd *cmd)
TRACE_DBG("tags_sg %p, tags_buf %p, tags_len %d",
tags_sg, tags_buf, tags_len);
EXTRACHECKS_BUG_ON(tags_len <= 0);
t = (struct scst_dif_tuple *)tags_buf;
t = (struct t10_pi_tuple *)tags_buf;
}
t->app_tag = app_tag_masked;
@@ -8370,7 +8374,7 @@ static int scst_verify_dif_type3(struct scst_cmd *cmd)
int len, tags_len = 0, tag_size = 1 << SCST_DIF_TAG_SHIFT;
struct scatterlist *tags_sg = NULL;
uint8_t *buf, *tags_buf = NULL;
const struct scst_dif_tuple *t = NULL; /* to silence compiler warning */
const struct t10_pi_tuple *t = NULL; /* to silence compiler warning */
uint64_t lba = cmd->lba;
int block_size = dev->block_size, block_shift = dev->block_shift;
__be16 (*crc_fn)(const void *buffer, unsigned int len);
@@ -8402,7 +8406,7 @@ static int scst_verify_dif_type3(struct scst_cmd *cmd)
if (tags_buf == NULL) {
tags_buf = scst_get_dif_buf(cmd, &tags_sg, &tags_len);
EXTRACHECKS_BUG_ON(tags_len <= 0);
t = (struct scst_dif_tuple *)tags_buf;
t = (struct t10_pi_tuple *)tags_buf;
}
if ((t->app_tag == SCST_DIF_NO_CHECK_ALL_APP_TAG) &&
@@ -8497,7 +8501,7 @@ static int scst_generate_dif_type3(struct scst_cmd *cmd)
int len, tags_len = 0, tag_size = 1 << SCST_DIF_TAG_SHIFT;
struct scatterlist *tags_sg = NULL;
uint8_t *buf, *tags_buf = NULL;
struct scst_dif_tuple *t = NULL; /* to silence compiler warning */
struct t10_pi_tuple *t = NULL; /* to silence compiler warning */
int block_size = dev->block_size, block_shift = dev->block_shift;
__be16 (*crc_fn)(const void *buffer, unsigned int len);
@@ -8532,7 +8536,7 @@ static int scst_generate_dif_type3(struct scst_cmd *cmd)
TRACE_DBG("tags_sg %p, tags_buf %p, tags_len %d",
tags_sg, tags_buf, tags_len);
EXTRACHECKS_BUG_ON(tags_len <= 0);
t = (struct scst_dif_tuple *)tags_buf;
t = (struct t10_pi_tuple *)tags_buf;
}
t->app_tag = dev->dev_dif_static_app_tag;