mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 01:49:46 +00:00
block: rename tuple_size field in blk_integrity to metadata_size
The tuple_size field in blk_integrity currently represents the total size of metadata associated with each data interval. To make the meaning more explicit, rename tuple_size to metadata_size. This is a purely mechanical rename with no functional changes. Suggested-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Anuj Gupta <anuj20.g@samsung.com> Link: https://lore.kernel.org/20250630090548.3317-2-anuj20.g@samsung.com Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
committed by
Christian Brauner
parent
19272b37aa
commit
c6603b1d65
@@ -54,10 +54,10 @@ static bool bi_offload_capable(struct blk_integrity *bi)
|
|||||||
{
|
{
|
||||||
switch (bi->csum_type) {
|
switch (bi->csum_type) {
|
||||||
case BLK_INTEGRITY_CSUM_CRC64:
|
case BLK_INTEGRITY_CSUM_CRC64:
|
||||||
return bi->tuple_size == sizeof(struct crc64_pi_tuple);
|
return bi->metadata_size == sizeof(struct crc64_pi_tuple);
|
||||||
case BLK_INTEGRITY_CSUM_CRC:
|
case BLK_INTEGRITY_CSUM_CRC:
|
||||||
case BLK_INTEGRITY_CSUM_IP:
|
case BLK_INTEGRITY_CSUM_IP:
|
||||||
return bi->tuple_size == sizeof(struct t10_pi_tuple);
|
return bi->metadata_size == sizeof(struct t10_pi_tuple);
|
||||||
default:
|
default:
|
||||||
pr_warn_once("%s: unknown integrity checksum type:%d\n",
|
pr_warn_once("%s: unknown integrity checksum type:%d\n",
|
||||||
__func__, bi->csum_type);
|
__func__, bi->csum_type);
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ static ssize_t format_show(struct device *dev, struct device_attribute *attr,
|
|||||||
{
|
{
|
||||||
struct blk_integrity *bi = dev_to_bi(dev);
|
struct blk_integrity *bi = dev_to_bi(dev);
|
||||||
|
|
||||||
if (!bi->tuple_size)
|
if (!bi->metadata_size)
|
||||||
return sysfs_emit(page, "none\n");
|
return sysfs_emit(page, "none\n");
|
||||||
return sysfs_emit(page, "%s\n", blk_integrity_profile_name(bi));
|
return sysfs_emit(page, "%s\n", blk_integrity_profile_name(bi));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ static int blk_validate_integrity_limits(struct queue_limits *lim)
|
|||||||
{
|
{
|
||||||
struct blk_integrity *bi = &lim->integrity;
|
struct blk_integrity *bi = &lim->integrity;
|
||||||
|
|
||||||
if (!bi->tuple_size) {
|
if (!bi->metadata_size) {
|
||||||
if (bi->csum_type != BLK_INTEGRITY_CSUM_NONE ||
|
if (bi->csum_type != BLK_INTEGRITY_CSUM_NONE ||
|
||||||
bi->tag_size || ((bi->flags & BLK_INTEGRITY_REF_TAG))) {
|
bi->tag_size || ((bi->flags & BLK_INTEGRITY_REF_TAG))) {
|
||||||
pr_warn("invalid PI settings.\n");
|
pr_warn("invalid PI settings.\n");
|
||||||
@@ -875,7 +875,7 @@ bool queue_limits_stack_integrity(struct queue_limits *t,
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (ti->flags & BLK_INTEGRITY_STACKED) {
|
if (ti->flags & BLK_INTEGRITY_STACKED) {
|
||||||
if (ti->tuple_size != bi->tuple_size)
|
if (ti->metadata_size != bi->metadata_size)
|
||||||
goto incompatible;
|
goto incompatible;
|
||||||
if (ti->interval_exp != bi->interval_exp)
|
if (ti->interval_exp != bi->interval_exp)
|
||||||
goto incompatible;
|
goto incompatible;
|
||||||
@@ -891,7 +891,7 @@ bool queue_limits_stack_integrity(struct queue_limits *t,
|
|||||||
ti->flags |= (bi->flags & BLK_INTEGRITY_DEVICE_CAPABLE) |
|
ti->flags |= (bi->flags & BLK_INTEGRITY_DEVICE_CAPABLE) |
|
||||||
(bi->flags & BLK_INTEGRITY_REF_TAG);
|
(bi->flags & BLK_INTEGRITY_REF_TAG);
|
||||||
ti->csum_type = bi->csum_type;
|
ti->csum_type = bi->csum_type;
|
||||||
ti->tuple_size = bi->tuple_size;
|
ti->metadata_size = bi->metadata_size;
|
||||||
ti->pi_offset = bi->pi_offset;
|
ti->pi_offset = bi->pi_offset;
|
||||||
ti->interval_exp = bi->interval_exp;
|
ti->interval_exp = bi->interval_exp;
|
||||||
ti->tag_size = bi->tag_size;
|
ti->tag_size = bi->tag_size;
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ static void t10_pi_generate(struct blk_integrity_iter *iter,
|
|||||||
pi->ref_tag = 0;
|
pi->ref_tag = 0;
|
||||||
|
|
||||||
iter->data_buf += iter->interval;
|
iter->data_buf += iter->interval;
|
||||||
iter->prot_buf += bi->tuple_size;
|
iter->prot_buf += bi->metadata_size;
|
||||||
iter->seed++;
|
iter->seed++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -105,7 +105,7 @@ static blk_status_t t10_pi_verify(struct blk_integrity_iter *iter,
|
|||||||
|
|
||||||
next:
|
next:
|
||||||
iter->data_buf += iter->interval;
|
iter->data_buf += iter->interval;
|
||||||
iter->prot_buf += bi->tuple_size;
|
iter->prot_buf += bi->metadata_size;
|
||||||
iter->seed++;
|
iter->seed++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ next:
|
|||||||
static void t10_pi_type1_prepare(struct request *rq)
|
static void t10_pi_type1_prepare(struct request *rq)
|
||||||
{
|
{
|
||||||
struct blk_integrity *bi = &rq->q->limits.integrity;
|
struct blk_integrity *bi = &rq->q->limits.integrity;
|
||||||
const int tuple_sz = bi->tuple_size;
|
const int tuple_sz = bi->metadata_size;
|
||||||
u32 ref_tag = t10_pi_ref_tag(rq);
|
u32 ref_tag = t10_pi_ref_tag(rq);
|
||||||
u8 offset = bi->pi_offset;
|
u8 offset = bi->pi_offset;
|
||||||
struct bio *bio;
|
struct bio *bio;
|
||||||
@@ -177,7 +177,7 @@ static void t10_pi_type1_complete(struct request *rq, unsigned int nr_bytes)
|
|||||||
{
|
{
|
||||||
struct blk_integrity *bi = &rq->q->limits.integrity;
|
struct blk_integrity *bi = &rq->q->limits.integrity;
|
||||||
unsigned intervals = nr_bytes >> bi->interval_exp;
|
unsigned intervals = nr_bytes >> bi->interval_exp;
|
||||||
const int tuple_sz = bi->tuple_size;
|
const int tuple_sz = bi->metadata_size;
|
||||||
u32 ref_tag = t10_pi_ref_tag(rq);
|
u32 ref_tag = t10_pi_ref_tag(rq);
|
||||||
u8 offset = bi->pi_offset;
|
u8 offset = bi->pi_offset;
|
||||||
struct bio *bio;
|
struct bio *bio;
|
||||||
@@ -234,7 +234,7 @@ static void ext_pi_crc64_generate(struct blk_integrity_iter *iter,
|
|||||||
put_unaligned_be48(0ULL, pi->ref_tag);
|
put_unaligned_be48(0ULL, pi->ref_tag);
|
||||||
|
|
||||||
iter->data_buf += iter->interval;
|
iter->data_buf += iter->interval;
|
||||||
iter->prot_buf += bi->tuple_size;
|
iter->prot_buf += bi->metadata_size;
|
||||||
iter->seed++;
|
iter->seed++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -289,7 +289,7 @@ static blk_status_t ext_pi_crc64_verify(struct blk_integrity_iter *iter,
|
|||||||
|
|
||||||
next:
|
next:
|
||||||
iter->data_buf += iter->interval;
|
iter->data_buf += iter->interval;
|
||||||
iter->prot_buf += bi->tuple_size;
|
iter->prot_buf += bi->metadata_size;
|
||||||
iter->seed++;
|
iter->seed++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -299,7 +299,7 @@ next:
|
|||||||
static void ext_pi_type1_prepare(struct request *rq)
|
static void ext_pi_type1_prepare(struct request *rq)
|
||||||
{
|
{
|
||||||
struct blk_integrity *bi = &rq->q->limits.integrity;
|
struct blk_integrity *bi = &rq->q->limits.integrity;
|
||||||
const int tuple_sz = bi->tuple_size;
|
const int tuple_sz = bi->metadata_size;
|
||||||
u64 ref_tag = ext_pi_ref_tag(rq);
|
u64 ref_tag = ext_pi_ref_tag(rq);
|
||||||
u8 offset = bi->pi_offset;
|
u8 offset = bi->pi_offset;
|
||||||
struct bio *bio;
|
struct bio *bio;
|
||||||
@@ -340,7 +340,7 @@ static void ext_pi_type1_complete(struct request *rq, unsigned int nr_bytes)
|
|||||||
{
|
{
|
||||||
struct blk_integrity *bi = &rq->q->limits.integrity;
|
struct blk_integrity *bi = &rq->q->limits.integrity;
|
||||||
unsigned intervals = nr_bytes >> bi->interval_exp;
|
unsigned intervals = nr_bytes >> bi->interval_exp;
|
||||||
const int tuple_sz = bi->tuple_size;
|
const int tuple_sz = bi->metadata_size;
|
||||||
u64 ref_tag = ext_pi_ref_tag(rq);
|
u64 ref_tag = ext_pi_ref_tag(rq);
|
||||||
u8 offset = bi->pi_offset;
|
u8 offset = bi->pi_offset;
|
||||||
struct bio *bio;
|
struct bio *bio;
|
||||||
|
|||||||
@@ -1189,11 +1189,11 @@ static int crypt_integrity_ctr(struct crypt_config *cc, struct dm_target *ti)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bi->tuple_size < cc->used_tag_size) {
|
if (bi->metadata_size < cc->used_tag_size) {
|
||||||
ti->error = "Integrity profile tag size mismatch.";
|
ti->error = "Integrity profile tag size mismatch.";
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
cc->tuple_size = bi->tuple_size;
|
cc->tuple_size = bi->metadata_size;
|
||||||
if (1 << bi->interval_exp != cc->sector_size) {
|
if (1 << bi->interval_exp != cc->sector_size) {
|
||||||
ti->error = "Integrity profile sector size mismatch.";
|
ti->error = "Integrity profile sector size mismatch.";
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|||||||
@@ -3906,8 +3906,8 @@ static void dm_integrity_io_hints(struct dm_target *ti, struct queue_limits *lim
|
|||||||
struct blk_integrity *bi = &limits->integrity;
|
struct blk_integrity *bi = &limits->integrity;
|
||||||
|
|
||||||
memset(bi, 0, sizeof(*bi));
|
memset(bi, 0, sizeof(*bi));
|
||||||
bi->tuple_size = ic->tag_size;
|
bi->metadata_size = ic->tag_size;
|
||||||
bi->tag_size = bi->tuple_size;
|
bi->tag_size = bi->metadata_size;
|
||||||
bi->interval_exp =
|
bi->interval_exp =
|
||||||
ic->sb->log2_sectors_per_block + SECTOR_SHIFT;
|
ic->sb->log2_sectors_per_block + SECTOR_SHIFT;
|
||||||
}
|
}
|
||||||
@@ -4746,18 +4746,18 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned int argc, char **argv
|
|||||||
ti->error = "Integrity profile not supported";
|
ti->error = "Integrity profile not supported";
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
/*printk("tag_size: %u, tuple_size: %u\n", bi->tag_size, bi->tuple_size);*/
|
/*printk("tag_size: %u, metadata_size: %u\n", bi->tag_size, bi->metadata_size);*/
|
||||||
if (bi->tuple_size < ic->tag_size) {
|
if (bi->metadata_size < ic->tag_size) {
|
||||||
r = -EINVAL;
|
r = -EINVAL;
|
||||||
ti->error = "The integrity profile is smaller than tag size";
|
ti->error = "The integrity profile is smaller than tag size";
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
if ((unsigned long)bi->tuple_size > PAGE_SIZE / 2) {
|
if ((unsigned long)bi->metadata_size > PAGE_SIZE / 2) {
|
||||||
r = -EINVAL;
|
r = -EINVAL;
|
||||||
ti->error = "Too big tuple size";
|
ti->error = "Too big tuple size";
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
ic->tuple_size = bi->tuple_size;
|
ic->tuple_size = bi->metadata_size;
|
||||||
if (1 << bi->interval_exp != ic->sectors_per_block << SECTOR_SHIFT) {
|
if (1 << bi->interval_exp != ic->sectors_per_block << SECTOR_SHIFT) {
|
||||||
r = -EINVAL;
|
r = -EINVAL;
|
||||||
ti->error = "Integrity profile sector size mismatch";
|
ti->error = "Integrity profile sector size mismatch";
|
||||||
|
|||||||
@@ -1506,7 +1506,7 @@ static int btt_blk_init(struct btt *btt)
|
|||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (btt_meta_size(btt) && IS_ENABLED(CONFIG_BLK_DEV_INTEGRITY)) {
|
if (btt_meta_size(btt) && IS_ENABLED(CONFIG_BLK_DEV_INTEGRITY)) {
|
||||||
lim.integrity.tuple_size = btt_meta_size(btt);
|
lim.integrity.metadata_size = btt_meta_size(btt);
|
||||||
lim.integrity.tag_size = btt_meta_size(btt);
|
lim.integrity.tag_size = btt_meta_size(btt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1866,7 +1866,7 @@ static bool nvme_init_integrity(struct nvme_ns_head *head,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
bi->tuple_size = head->ms;
|
bi->metadata_size = head->ms;
|
||||||
bi->pi_offset = info->pi_offset;
|
bi->pi_offset = info->pi_offset;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ static void nvmet_bdev_ns_enable_integrity(struct nvmet_ns *ns)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (bi->csum_type == BLK_INTEGRITY_CSUM_CRC) {
|
if (bi->csum_type == BLK_INTEGRITY_CSUM_CRC) {
|
||||||
ns->metadata_size = bi->tuple_size;
|
ns->metadata_size = bi->metadata_size;
|
||||||
if (bi->flags & BLK_INTEGRITY_REF_TAG)
|
if (bi->flags & BLK_INTEGRITY_REF_TAG)
|
||||||
ns->pi_type = NVME_NS_DPS_PI_TYPE1;
|
ns->pi_type = NVME_NS_DPS_PI_TYPE1;
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ void sd_dif_config_host(struct scsi_disk *sdkp, struct queue_limits *lim)
|
|||||||
if (type != T10_PI_TYPE3_PROTECTION)
|
if (type != T10_PI_TYPE3_PROTECTION)
|
||||||
bi->flags |= BLK_INTEGRITY_REF_TAG;
|
bi->flags |= BLK_INTEGRITY_REF_TAG;
|
||||||
|
|
||||||
bi->tuple_size = sizeof(struct t10_pi_tuple);
|
bi->metadata_size = sizeof(struct t10_pi_tuple);
|
||||||
|
|
||||||
if (dif && type) {
|
if (dif && type) {
|
||||||
bi->flags |= BLK_INTEGRITY_DEVICE_CAPABLE;
|
bi->flags |= BLK_INTEGRITY_DEVICE_CAPABLE;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ int blk_rq_integrity_map_user(struct request *rq, void __user *ubuf,
|
|||||||
static inline bool
|
static inline bool
|
||||||
blk_integrity_queue_supports_integrity(struct request_queue *q)
|
blk_integrity_queue_supports_integrity(struct request_queue *q)
|
||||||
{
|
{
|
||||||
return q->limits.integrity.tuple_size;
|
return q->limits.integrity.metadata_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct blk_integrity *blk_get_integrity(struct gendisk *disk)
|
static inline struct blk_integrity *blk_get_integrity(struct gendisk *disk)
|
||||||
@@ -74,7 +74,7 @@ static inline unsigned int bio_integrity_intervals(struct blk_integrity *bi,
|
|||||||
static inline unsigned int bio_integrity_bytes(struct blk_integrity *bi,
|
static inline unsigned int bio_integrity_bytes(struct blk_integrity *bi,
|
||||||
unsigned int sectors)
|
unsigned int sectors)
|
||||||
{
|
{
|
||||||
return bio_integrity_intervals(bi, sectors) * bi->tuple_size;
|
return bio_integrity_intervals(bi, sectors) * bi->metadata_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool blk_integrity_rq(struct request *rq)
|
static inline bool blk_integrity_rq(struct request *rq)
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ enum blk_integrity_checksum {
|
|||||||
struct blk_integrity {
|
struct blk_integrity {
|
||||||
unsigned char flags;
|
unsigned char flags;
|
||||||
enum blk_integrity_checksum csum_type;
|
enum blk_integrity_checksum csum_type;
|
||||||
unsigned char tuple_size;
|
unsigned char metadata_size;
|
||||||
unsigned char pi_offset;
|
unsigned char pi_offset;
|
||||||
unsigned char interval_exp;
|
unsigned char interval_exp;
|
||||||
unsigned char tag_size;
|
unsigned char tag_size;
|
||||||
|
|||||||
Reference in New Issue
Block a user