- map = mmap(io_u->xfer_buf, buflen, PROT_READ, MAP_PRIVATE|OS_MAP_ANON, 0, 0);
- if (map == MAP_FAILED) {
- td_verror(td, errno, "mmap io_u");
- return -1;
+ if (sd->vmsplice_to_user_map) {
+ map = mmap(io_u->xfer_buf, buflen, PROT_READ, MAP_PRIVATE|OS_MAP_ANON, 0, 0);
+ if (map == MAP_FAILED) {
+ td_verror(td, errno, "mmap io_u");
+ return -1;
+ }
+
+ p = map;
+ } else {
+ map = NULL;
+ p = io_u->xfer_buf;