Skip to content

Commit

Permalink
scst_vdisk: Port to Linux kernel v6.11
Browse files Browse the repository at this point in the history
Support for the following block layer changes in the Linux kernel v6.11:

- e9f5f44ad372 ("block: remove the blk_integrity_profile structure")
  • Loading branch information
lnocturno committed Sep 4, 2024
1 parent 8c6a968 commit ec1b85a
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions scst/src/dev_handlers/scst_vdisk.c
Original file line number Diff line number Diff line change
Expand Up @@ -983,48 +983,51 @@ static int vdisk_init_block_integrity(struct scst_vdisk_dev *virt_dev)

#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0)
bi_profile_name = bi->name;
#else
#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 11, 0)
bi_profile_name = bi->profile->name;
#else
bi_profile_name = blk_integrity_profile_name(bi);
#endif

TRACE_DBG("BI name %s", bi_profile_name);

if (!strcmp(bi_profile_name, "T10-DIF-TYPE1-CRC")) {
dev->dev_dif_ip_not_supported = 1;
if (virt_dev->dif_type != 1) {
PRINT_ERROR("Integrity type mismatch, %d expected, "
"but block device has 1 (dev %s)",
virt_dev->dif_type, dev->virt_name);
PRINT_ERROR(
"Integrity type mismatch, %d expected, but block device has 1 (dev %s)",
virt_dev->dif_type, dev->virt_name);
res = -EINVAL;
goto out_close;
}
} else if (!strcmp(bi_profile_name, "T10-DIF-TYPE1-IP")) {
if (virt_dev->dif_type != 1) {
PRINT_ERROR("Integrity type mismatch, %d expected, "
"but block device has 1 (dev %s)",
virt_dev->dif_type, dev->virt_name);
PRINT_ERROR(
"Integrity type mismatch, %d expected, but block device has 1 (dev %s)",
virt_dev->dif_type, dev->virt_name);
res = -EINVAL;
goto out_close;
}
} else if (!strcmp(bi_profile_name, "T10-DIF-TYPE3-CRC")) {
dev->dev_dif_ip_not_supported = 1;
if (virt_dev->dif_type != 3) {
PRINT_ERROR("Integrity type mismatch, %d expected, "
"but block device has 1 (dev %s)",
virt_dev->dif_type, dev->virt_name);
PRINT_ERROR(
"Integrity type mismatch, %d expected, but block device has 1 (dev %s)",
virt_dev->dif_type, dev->virt_name);
res = -EINVAL;
goto out_close;
}
} else if (!strcmp(bi_profile_name, "T10-DIF-TYPE3-IP")) {
if (virt_dev->dif_type != 3) {
PRINT_ERROR("Integrity type mismatch, %d expected, "
"but block device has 3 (dev %s)",
virt_dev->dif_type, dev->virt_name);
PRINT_ERROR(
"Integrity type mismatch, %d expected, but block device has 3 (dev %s)",
virt_dev->dif_type, dev->virt_name);
res = -EINVAL;
goto out_close;
}
} else {
PRINT_ERROR("Unable to understand integrity name %s"
"(dev %s)", bi_profile_name, dev->virt_name);
PRINT_ERROR("Unable to understand integrity name %s (dev %s)",
bi_profile_name, dev->virt_name);
res = -EINVAL;
goto out_close;
}
Expand All @@ -1033,15 +1036,15 @@ static int vdisk_init_block_integrity(struct scst_vdisk_dev *virt_dev)

if ((virt_dev->dif_mode & SCST_DIF_MODE_DEV_CHECK) &&
!(virt_dev->dif_mode & SCST_DIF_MODE_DEV_STORE)) {
PRINT_ERROR("Blockio dev_check is not possible without "
"dev_store (dev %s)", dev->virt_name);
PRINT_ERROR("Blockio dev_check is not possible without dev_store (dev %s)",
dev->virt_name);
res = -EINVAL;
goto out_close;
}

if (!(virt_dev->dif_mode & SCST_DIF_MODE_DEV_CHECK))
PRINT_WARNING("Blk integrity implies dev_check (dev %s)",
dev->virt_name);
dev->virt_name);

out_no_bi:
res = 0;
Expand Down

0 comments on commit ec1b85a

Please sign in to comment.