Unconditionally support unmapped BIOs. This was another shim for

supporting older kernels. However, all supported versions of FreeBSD
have unmapped I/Os (as do several that have gone EOL), remove it. It's
unlikely the driver would work on the older kernels anyway at this
point.
This commit is contained in:
Warner Losh 2019-02-27 22:16:59 +00:00
parent d706306d49
commit 45d7e233a5
4 changed files with 1 additions and 34 deletions

View File

@ -1056,11 +1056,7 @@ nvme_ctrlr_passthrough_cmd(struct nvme_controller *ctrlr,
buf->b_data = pt->buf;
buf->b_bufsize = pt->len;
buf->b_iocmd = pt->is_read ? BIO_READ : BIO_WRITE;
#ifdef NVME_UNMAPPED_BIO_SUPPORT
if (vmapbuf(buf, 1) < 0) {
#else
if (vmapbuf(buf) < 0) {
#endif
ret = EFAULT;
goto err;
}

View File

@ -357,10 +357,8 @@ nvme_construct_child_bios(struct bio *bp, uint32_t alignment, int *num_bios)
caddr_t data;
uint32_t rem_bcount;
int i;
#ifdef NVME_UNMAPPED_BIO_SUPPORT
struct vm_page **ma;
uint32_t ma_offset;
#endif
*num_bios = nvme_get_num_segments(bp->bio_offset, bp->bio_bcount,
alignment);
@ -373,10 +371,8 @@ nvme_construct_child_bios(struct bio *bp, uint32_t alignment, int *num_bios)
cur_offset = bp->bio_offset;
rem_bcount = bp->bio_bcount;
data = bp->bio_data;
#ifdef NVME_UNMAPPED_BIO_SUPPORT
ma_offset = bp->bio_ma_offset;
ma = bp->bio_ma;
#endif
for (i = 0; i < *num_bios; i++) {
child = child_bios[i];
@ -386,7 +382,6 @@ nvme_construct_child_bios(struct bio *bp, uint32_t alignment, int *num_bios)
child->bio_bcount = min(rem_bcount,
alignment - (cur_offset & (alignment - 1)));
child->bio_flags = bp->bio_flags;
#ifdef NVME_UNMAPPED_BIO_SUPPORT
if (bp->bio_flags & BIO_UNMAPPED) {
child->bio_ma_offset = ma_offset;
child->bio_ma = ma;
@ -398,9 +393,7 @@ nvme_construct_child_bios(struct bio *bp, uint32_t alignment, int *num_bios)
ma += child->bio_ma_n;
if (ma_offset != 0)
ma -= 1;
} else
#endif
{
} else {
child->bio_data = data;
data += child->bio_bcount;
}
@ -599,9 +592,7 @@ nvme_ns_construct(struct nvme_namespace *ns, uint32_t id,
if (res != 0)
return (ENXIO);
#ifdef NVME_UNMAPPED_BIO_SUPPORT
ns->cdev->si_flags |= SI_UNMAPPED;
#endif
return (0);
}

View File

@ -112,16 +112,6 @@ MALLOC_DECLARE(M_NVME);
#define CACHE_LINE_SIZE (64)
#endif
/*
* Use presence of the BIO_UNMAPPED flag to determine whether unmapped I/O
* support and the bus_dmamap_load_bio API are available on the target
* kernel. This will ease porting back to earlier stable branches at a
* later point.
*/
#ifdef BIO_UNMAPPED
#define NVME_UNMAPPED_BIO_SUPPORT
#endif
extern uma_zone_t nvme_request_zone;
extern int32_t nvme_retry_count;
@ -134,9 +124,7 @@ struct nvme_completion_poll_status {
#define NVME_REQUEST_VADDR 1
#define NVME_REQUEST_NULL 2 /* For requests with no payload. */
#define NVME_REQUEST_UIO 3
#ifdef NVME_UNMAPPED_BIO_SUPPORT
#define NVME_REQUEST_BIO 4
#endif
#define NVME_REQUEST_CCB 5
struct nvme_request {
@ -506,14 +494,8 @@ nvme_allocate_request_bio(struct bio *bio, nvme_cb_fn_t cb_fn, void *cb_arg)
req = _nvme_allocate_request(cb_fn, cb_arg);
if (req != NULL) {
#ifdef NVME_UNMAPPED_BIO_SUPPORT
req->type = NVME_REQUEST_BIO;
req->u.bio = bio;
#else
req->type = NVME_REQUEST_VADDR;
req->u.payload = bio->bio_data;
req->payload_size = bio->bio_bcount;
#endif
}
return (req);
}

View File

@ -954,7 +954,6 @@ _nvme_qpair_submit_request(struct nvme_qpair *qpair, struct nvme_request *req)
case NVME_REQUEST_NULL:
nvme_qpair_submit_tracker(tr->qpair, tr);
break;
#ifdef NVME_UNMAPPED_BIO_SUPPORT
case NVME_REQUEST_BIO:
KASSERT(req->u.bio->bio_bcount <= qpair->ctrlr->max_xfer_size,
("bio->bio_bcount (%jd) exceeds max_xfer_size (%d)\n",
@ -966,7 +965,6 @@ _nvme_qpair_submit_request(struct nvme_qpair *qpair, struct nvme_request *req)
nvme_printf(qpair->ctrlr,
"bus_dmamap_load_bio returned 0x%x!\n", err);
break;
#endif
case NVME_REQUEST_CCB:
err = bus_dmamap_load_ccb(tr->qpair->dma_tag_payload,
tr->payload_dma_map, req->u.payload,