Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to Linux kernel v6.11 #251

Merged
merged 3 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
12 changes: 11 additions & 1 deletion scst/src/scst_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -8431,6 +8431,16 @@ static struct request *blk_make_request(struct request_queue *q,
}
#endif

static inline unsigned int
queue_dma_pad_mask(const struct request_queue *q)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 11, 0)
return q->dma_pad_mask;
#else
return q->limits.dma_pad_mask;
#endif
}

/* __blk_map_kern_sg - map kernel data to a request for REQ_TYPE_BLOCK_PC */
static struct request *__blk_map_kern_sg(struct request_queue *q,
struct scatterlist *sgl, int nents, struct blk_kern_sg_work *bw,
Expand Down Expand Up @@ -8553,7 +8563,7 @@ static struct request *__blk_map_kern_sg(struct request_queue *q,
}

/* Total length must satisfy DMA padding alignment */
if ((tot_len & q->dma_pad_mask) && bw != NULL) {
if (bw && (tot_len & queue_dma_pad_mask(q))) {
rq = ERR_PTR(-EINVAL);
goto out_free_bios;
}
Expand Down
7 changes: 5 additions & 2 deletions scst_local/scst_local.c
Original file line number Diff line number Diff line change
Expand Up @@ -1500,8 +1500,11 @@ static DRIVER_REMOVE_RET scst_local_driver_remove(struct device *dev)
return (DRIVER_REMOVE_RET)0;
}

static int scst_local_bus_match(struct device *dev,
struct device_driver *dev_driver)
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 11, 0)
static int scst_local_bus_match(struct device *dev, struct device_driver *drv)
#else
static int scst_local_bus_match(struct device *dev, const struct device_driver *drv)
#endif
{
TRACE_ENTRY();

Expand Down