Skip to content

Commit

Permalink
scst_lib: 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:

- e94b45d08b5d ("block: move dma_pad_mask into queue_limits")
  • Loading branch information
lnocturno committed Sep 4, 2024
1 parent aa086c9 commit 8c6a968
Showing 1 changed file with 11 additions and 1 deletion.
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

0 comments on commit 8c6a968

Please sign in to comment.