Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'for-linus-2019-10-03' of git://git.kernel.dk/linux-block

Pull block fixes from Jens Axboe:

- Mandate timespec64 for the io_uring timeout ABI (Arnd)

- Set of NVMe changes via Sagi:
- controller removal race fix from Balbir
- quirk additions from Gabriel and Jian-Hong
- nvme-pci power state save fix from Mario
- Add 64bit user commands (for 64bit registers) from Marta
- nvme-rdma/nvme-tcp fixes from Max, Mark and Me
- Minor cleanups and nits from James, Dan and John

- Two s390 dasd fixes (Jan, Stefan)

- Have loop change block size in DIO mode (Martijn)

- paride pg header ifdef guard (Masahiro)

- Two blk-mq queue scheduler tweaks, fixing an ordering issue on zoned
devices and suboptimal performance on others (Ming)

* tag 'for-linus-2019-10-03' of git://git.kernel.dk/linux-block: (22 commits)
block: sed-opal: fix sparse warning: convert __be64 data
block: sed-opal: fix sparse warning: obsolete array init.
block: pg: add header include guard
Revert "s390/dasd: Add discard support for ESE volumes"
s390/dasd: Fix error handling during online processing
io_uring: use __kernel_timespec in timeout ABI
loop: change queue block size to match when using DIO
blk-mq: apply normal plugging for HDD
blk-mq: honor IO scheduler for multiqueue devices
nvme-rdma: fix possible use-after-free in connect timeout
nvme: Move ctrl sqsize to generic space
nvme: Add ctrl attributes for queue_count and sqsize
nvme: allow 64-bit results in passthru commands
nvme: Add quirk for Kingston NVME SSD running FW E8FK11.T
nvmet-tcp: remove superflous check on request sgl
Added QUIRKs for ADATA XPG SX8200 Pro 512GB
nvme-rdma: Fix max_hw_sectors calculation
nvme: fix an error code in nvme_init_subsystem()
nvme-pci: Save PCI state before putting drive into deepest state
nvme-tcp: fix wrong stop condition in io_work
...

+218 -132
+9 -3
block/blk-mq.c
··· 1992 1992 /* bypass scheduler for flush rq */ 1993 1993 blk_insert_flush(rq); 1994 1994 blk_mq_run_hw_queue(data.hctx, true); 1995 - } else if (plug && (q->nr_hw_queues == 1 || q->mq_ops->commit_rqs)) { 1995 + } else if (plug && (q->nr_hw_queues == 1 || q->mq_ops->commit_rqs || 1996 + !blk_queue_nonrot(q))) { 1996 1997 /* 1997 1998 * Use plugging if we have a ->commit_rqs() hook as well, as 1998 1999 * we know the driver uses bd->last in a smart fashion. 2000 + * 2001 + * Use normal plugging if this disk is slow HDD, as sequential 2002 + * IO may benefit a lot from plug merging. 1999 2003 */ 2000 2004 unsigned int request_count = plug->rq_count; 2001 2005 struct request *last = NULL; ··· 2016 2012 } 2017 2013 2018 2014 blk_add_rq_to_plug(plug, rq); 2015 + } else if (q->elevator) { 2016 + blk_mq_sched_insert_request(rq, false, true, true); 2019 2017 } else if (plug && !blk_queue_nomerges(q)) { 2020 2018 /* 2021 2019 * We do limited plugging. If the bio can be merged, do that. ··· 2041 2035 blk_mq_try_issue_directly(data.hctx, same_queue_rq, 2042 2036 &cookie); 2043 2037 } 2044 - } else if ((q->nr_hw_queues > 1 && is_sync) || (!q->elevator && 2045 - !data.hctx->dispatch_busy)) { 2038 + } else if ((q->nr_hw_queues > 1 && is_sync) || 2039 + !data.hctx->dispatch_busy) { 2046 2040 blk_mq_try_issue_directly(data.hctx, rq, &cookie); 2047 2041 } else { 2048 2042 blk_mq_sched_insert_request(rq, false, true, true);
+3 -3
block/sed-opal.c
··· 129 129 { 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x84, 0x01 }, 130 130 131 131 /* tables */ 132 - [OPAL_TABLE_TABLE] 132 + [OPAL_TABLE_TABLE] = 133 133 { 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01 }, 134 134 [OPAL_LOCKINGRANGE_GLOBAL] = 135 135 { 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x00, 0x01 }, ··· 372 372 { 373 373 const struct d0_geometry_features *geo = data; 374 374 375 - dev->align = geo->alignment_granularity; 376 - dev->lowest_lba = geo->lowest_aligned_lba; 375 + dev->align = be64_to_cpu(geo->alignment_granularity); 376 + dev->lowest_lba = be64_to_cpu(geo->lowest_aligned_lba); 377 377 } 378 378 379 379 static int execute_step(struct opal_dev *dev,
+10
drivers/block/loop.c
··· 994 994 if (!(lo_flags & LO_FLAGS_READ_ONLY) && file->f_op->fsync) 995 995 blk_queue_write_cache(lo->lo_queue, true, false); 996 996 997 + if (io_is_direct(lo->lo_backing_file) && inode->i_sb->s_bdev) { 998 + /* In case of direct I/O, match underlying block size */ 999 + unsigned short bsize = bdev_logical_block_size( 1000 + inode->i_sb->s_bdev); 1001 + 1002 + blk_queue_logical_block_size(lo->lo_queue, bsize); 1003 + blk_queue_physical_block_size(lo->lo_queue, bsize); 1004 + blk_queue_io_min(lo->lo_queue, bsize); 1005 + } 1006 + 997 1007 loop_update_rotational(lo); 998 1008 loop_update_dio(lo); 999 1009 set_capacity(lo->lo_disk, size);
+113 -19
drivers/nvme/host/core.c
··· 102 102 */ 103 103 if (!ns->disk || test_and_set_bit(NVME_NS_DEAD, &ns->flags)) 104 104 return; 105 - revalidate_disk(ns->disk); 106 105 blk_set_queue_dying(ns->queue); 107 106 /* Forcibly unquiesce queues to avoid blocking dispatch */ 108 107 blk_mq_unquiesce_queue(ns->queue); 108 + /* 109 + * Revalidate after unblocking dispatchers that may be holding bd_butex 110 + */ 111 + revalidate_disk(ns->disk); 109 112 } 110 113 111 114 static void nvme_queue_scan(struct nvme_ctrl *ctrl) ··· 850 847 static int nvme_submit_user_cmd(struct request_queue *q, 851 848 struct nvme_command *cmd, void __user *ubuffer, 852 849 unsigned bufflen, void __user *meta_buffer, unsigned meta_len, 853 - u32 meta_seed, u32 *result, unsigned timeout) 850 + u32 meta_seed, u64 *result, unsigned timeout) 854 851 { 855 852 bool write = nvme_is_write(cmd); 856 853 struct nvme_ns *ns = q->queuedata; ··· 891 888 else 892 889 ret = nvme_req(req)->status; 893 890 if (result) 894 - *result = le32_to_cpu(nvme_req(req)->result.u32); 891 + *result = le64_to_cpu(nvme_req(req)->result.u64); 895 892 if (meta && !ret && !write) { 896 893 if (copy_to_user(meta_buffer, meta, meta_len)) 897 894 ret = -EFAULT; ··· 1338 1335 struct nvme_command c; 1339 1336 unsigned timeout = 0; 1340 1337 u32 effects; 1338 + u64 result; 1339 + int status; 1340 + 1341 + if (!capable(CAP_SYS_ADMIN)) 1342 + return -EACCES; 1343 + if (copy_from_user(&cmd, ucmd, sizeof(cmd))) 1344 + return -EFAULT; 1345 + if (cmd.flags) 1346 + return -EINVAL; 1347 + 1348 + memset(&c, 0, sizeof(c)); 1349 + c.common.opcode = cmd.opcode; 1350 + c.common.flags = cmd.flags; 1351 + c.common.nsid = cpu_to_le32(cmd.nsid); 1352 + c.common.cdw2[0] = cpu_to_le32(cmd.cdw2); 1353 + c.common.cdw2[1] = cpu_to_le32(cmd.cdw3); 1354 + c.common.cdw10 = cpu_to_le32(cmd.cdw10); 1355 + c.common.cdw11 = cpu_to_le32(cmd.cdw11); 1356 + c.common.cdw12 = cpu_to_le32(cmd.cdw12); 1357 + c.common.cdw13 = cpu_to_le32(cmd.cdw13); 1358 + c.common.cdw14 = cpu_to_le32(cmd.cdw14); 1359 + c.common.cdw15 = cpu_to_le32(cmd.cdw15); 1360 + 1361 + if (cmd.timeout_ms) 1362 + timeout = msecs_to_jiffies(cmd.timeout_ms); 1363 + 1364 + effects = nvme_passthru_start(ctrl, ns, cmd.opcode); 1365 + status = nvme_submit_user_cmd(ns ? ns->queue : ctrl->admin_q, &c, 1366 + (void __user *)(uintptr_t)cmd.addr, cmd.data_len, 1367 + (void __user *)(uintptr_t)cmd.metadata, 1368 + cmd.metadata_len, 0, &result, timeout); 1369 + nvme_passthru_end(ctrl, effects); 1370 + 1371 + if (status >= 0) { 1372 + if (put_user(result, &ucmd->result)) 1373 + return -EFAULT; 1374 + } 1375 + 1376 + return status; 1377 + } 1378 + 1379 + static int nvme_user_cmd64(struct nvme_ctrl *ctrl, struct nvme_ns *ns, 1380 + struct nvme_passthru_cmd64 __user *ucmd) 1381 + { 1382 + struct nvme_passthru_cmd64 cmd; 1383 + struct nvme_command c; 1384 + unsigned timeout = 0; 1385 + u32 effects; 1341 1386 int status; 1342 1387 1343 1388 if (!capable(CAP_SYS_ADMIN)) ··· 1456 1405 srcu_read_unlock(&head->srcu, idx); 1457 1406 } 1458 1407 1408 + static bool is_ctrl_ioctl(unsigned int cmd) 1409 + { 1410 + if (cmd == NVME_IOCTL_ADMIN_CMD || cmd == NVME_IOCTL_ADMIN64_CMD) 1411 + return true; 1412 + if (is_sed_ioctl(cmd)) 1413 + return true; 1414 + return false; 1415 + } 1416 + 1417 + static int nvme_handle_ctrl_ioctl(struct nvme_ns *ns, unsigned int cmd, 1418 + void __user *argp, 1419 + struct nvme_ns_head *head, 1420 + int srcu_idx) 1421 + { 1422 + struct nvme_ctrl *ctrl = ns->ctrl; 1423 + int ret; 1424 + 1425 + nvme_get_ctrl(ns->ctrl); 1426 + nvme_put_ns_from_disk(head, srcu_idx); 1427 + 1428 + switch (cmd) { 1429 + case NVME_IOCTL_ADMIN_CMD: 1430 + ret = nvme_user_cmd(ctrl, NULL, argp); 1431 + break; 1432 + case NVME_IOCTL_ADMIN64_CMD: 1433 + ret = nvme_user_cmd64(ctrl, NULL, argp); 1434 + break; 1435 + default: 1436 + ret = sed_ioctl(ctrl->opal_dev, cmd, argp); 1437 + break; 1438 + } 1439 + nvme_put_ctrl(ctrl); 1440 + return ret; 1441 + } 1442 + 1459 1443 static int nvme_ioctl(struct block_device *bdev, fmode_t mode, 1460 1444 unsigned int cmd, unsigned long arg) 1461 1445 { ··· 1508 1422 * seperately and drop the ns SRCU reference early. This avoids a 1509 1423 * deadlock when deleting namespaces using the passthrough interface. 1510 1424 */ 1511 - if (cmd == NVME_IOCTL_ADMIN_CMD || is_sed_ioctl(cmd)) { 1512 - struct nvme_ctrl *ctrl = ns->ctrl; 1513 - 1514 - nvme_get_ctrl(ns->ctrl); 1515 - nvme_put_ns_from_disk(head, srcu_idx); 1516 - 1517 - if (cmd == NVME_IOCTL_ADMIN_CMD) 1518 - ret = nvme_user_cmd(ctrl, NULL, argp); 1519 - else 1520 - ret = sed_ioctl(ctrl->opal_dev, cmd, argp); 1521 - 1522 - nvme_put_ctrl(ctrl); 1523 - return ret; 1524 - } 1425 + if (is_ctrl_ioctl(cmd)) 1426 + return nvme_handle_ctrl_ioctl(ns, cmd, argp, head, srcu_idx); 1525 1427 1526 1428 switch (cmd) { 1527 1429 case NVME_IOCTL_ID: ··· 1521 1447 break; 1522 1448 case NVME_IOCTL_SUBMIT_IO: 1523 1449 ret = nvme_submit_io(ns, argp); 1450 + break; 1451 + case NVME_IOCTL_IO64_CMD: 1452 + ret = nvme_user_cmd64(ns->ctrl, ns, argp); 1524 1453 break; 1525 1454 default: 1526 1455 if (ns->ndev) ··· 2366 2289 .vid = 0x14a4, 2367 2290 .fr = "22301111", 2368 2291 .quirks = NVME_QUIRK_SIMPLE_SUSPEND, 2292 + }, 2293 + { 2294 + /* 2295 + * This Kingston E8FK11.T firmware version has no interrupt 2296 + * after resume with actions related to suspend to idle 2297 + * https://bugzilla.kernel.org/show_bug.cgi?id=204887 2298 + */ 2299 + .vid = 0x2646, 2300 + .fr = "E8FK11.T", 2301 + .quirks = NVME_QUIRK_SIMPLE_SUSPEND, 2369 2302 } 2370 2303 }; 2371 2304 ··· 2627 2540 list_add_tail(&subsys->entry, &nvme_subsystems); 2628 2541 } 2629 2542 2630 - if (sysfs_create_link(&subsys->dev.kobj, &ctrl->device->kobj, 2631 - dev_name(ctrl->device))) { 2543 + ret = sysfs_create_link(&subsys->dev.kobj, &ctrl->device->kobj, 2544 + dev_name(ctrl->device)); 2545 + if (ret) { 2632 2546 dev_err(ctrl->device, 2633 2547 "failed to create sysfs link from subsystem.\n"); 2634 2548 goto out_put_subsystem; ··· 2926 2838 switch (cmd) { 2927 2839 case NVME_IOCTL_ADMIN_CMD: 2928 2840 return nvme_user_cmd(ctrl, NULL, argp); 2841 + case NVME_IOCTL_ADMIN64_CMD: 2842 + return nvme_user_cmd64(ctrl, NULL, argp); 2929 2843 case NVME_IOCTL_IO_CMD: 2930 2844 return nvme_dev_user_cmd(ctrl, argp); 2931 2845 case NVME_IOCTL_RESET: ··· 3135 3045 3136 3046 nvme_show_int_function(cntlid); 3137 3047 nvme_show_int_function(numa_node); 3048 + nvme_show_int_function(queue_count); 3049 + nvme_show_int_function(sqsize); 3138 3050 3139 3051 static ssize_t nvme_sysfs_delete(struct device *dev, 3140 3052 struct device_attribute *attr, const char *buf, ··· 3217 3125 &dev_attr_address.attr, 3218 3126 &dev_attr_state.attr, 3219 3127 &dev_attr_numa_node.attr, 3128 + &dev_attr_queue_count.attr, 3129 + &dev_attr_sqsize.attr, 3220 3130 NULL 3221 3131 }; 3222 3132
+1 -1
drivers/nvme/host/nvme.h
··· 221 221 u16 oacs; 222 222 u16 nssa; 223 223 u16 nr_streams; 224 + u16 sqsize; 224 225 u32 max_namespaces; 225 226 atomic_t abort_limit; 226 227 u8 vwc; ··· 270 269 u16 hmmaxd; 271 270 272 271 /* Fabrics only */ 273 - u16 sqsize; 274 272 u32 ioccsz; 275 273 u32 iorcsz; 276 274 u16 icdoff;
+13 -7
drivers/nvme/host/pci.c
··· 2946 2946 if (ret < 0) 2947 2947 goto unfreeze; 2948 2948 2949 + /* 2950 + * A saved state prevents pci pm from generically controlling the 2951 + * device's power. If we're using protocol specific settings, we don't 2952 + * want pci interfering. 2953 + */ 2954 + pci_save_state(pdev); 2955 + 2949 2956 ret = nvme_set_power_state(ctrl, ctrl->npss); 2950 2957 if (ret < 0) 2951 2958 goto unfreeze; 2952 2959 2953 2960 if (ret) { 2961 + /* discard the saved state */ 2962 + pci_load_saved_state(pdev, NULL); 2963 + 2954 2964 /* 2955 2965 * Clearing npss forces a controller reset on resume. The 2956 2966 * correct value will be resdicovered then. ··· 2968 2958 nvme_dev_disable(ndev, true); 2969 2959 ctrl->npss = 0; 2970 2960 ret = 0; 2971 - goto unfreeze; 2972 2961 } 2973 - /* 2974 - * A saved state prevents pci pm from generically controlling the 2975 - * device's power. If we're using protocol specific settings, we don't 2976 - * want pci interfering. 2977 - */ 2978 - pci_save_state(pdev); 2979 2962 unfreeze: 2980 2963 nvme_unfreeze(ctrl); 2981 2964 return ret; ··· 3093 3090 .driver_data = NVME_QUIRK_LIGHTNVM, }, 3094 3091 { PCI_DEVICE(0x10ec, 0x5762), /* ADATA SX6000LNP */ 3095 3092 .driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN, }, 3093 + { PCI_DEVICE(0x1cc1, 0x8201), /* ADATA SX8200PNP 512GB */ 3094 + .driver_data = NVME_QUIRK_NO_DEEPEST_PS | 3095 + NVME_QUIRK_IGNORE_DEV_SUBNQN, }, 3096 3096 { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_EXPRESS, 0xffffff) }, 3097 3097 { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2001) }, 3098 3098 { PCI_DEVICE(PCI_VENDOR_ID_APPLE, 0x2003) },
+13 -6
drivers/nvme/host/rdma.c
··· 427 427 static int nvme_rdma_get_max_fr_pages(struct ib_device *ibdev) 428 428 { 429 429 return min_t(u32, NVME_RDMA_MAX_SEGMENTS, 430 - ibdev->attrs.max_fast_reg_page_list_len); 430 + ibdev->attrs.max_fast_reg_page_list_len - 1); 431 431 } 432 432 433 433 static int nvme_rdma_create_queue_ib(struct nvme_rdma_queue *queue) ··· 437 437 const int cq_factor = send_wr_factor + 1; /* + RECV */ 438 438 int comp_vector, idx = nvme_rdma_queue_idx(queue); 439 439 enum ib_poll_context poll_ctx; 440 - int ret; 440 + int ret, pages_per_mr; 441 441 442 442 queue->device = nvme_rdma_find_get_device(queue->cm_id); 443 443 if (!queue->device) { ··· 479 479 goto out_destroy_qp; 480 480 } 481 481 482 + /* 483 + * Currently we don't use SG_GAPS MR's so if the first entry is 484 + * misaligned we'll end up using two entries for a single data page, 485 + * so one additional entry is required. 486 + */ 487 + pages_per_mr = nvme_rdma_get_max_fr_pages(ibdev) + 1; 482 488 ret = ib_mr_pool_init(queue->qp, &queue->qp->rdma_mrs, 483 489 queue->queue_size, 484 490 IB_MR_TYPE_MEM_REG, 485 - nvme_rdma_get_max_fr_pages(ibdev), 0); 491 + pages_per_mr, 0); 486 492 if (ret) { 487 493 dev_err(queue->ctrl->ctrl.device, 488 494 "failed to initialize MR pool sized %d for QID %d\n", ··· 620 614 if (!ret) { 621 615 set_bit(NVME_RDMA_Q_LIVE, &queue->flags); 622 616 } else { 623 - __nvme_rdma_stop_queue(queue); 617 + if (test_bit(NVME_RDMA_Q_ALLOCATED, &queue->flags)) 618 + __nvme_rdma_stop_queue(queue); 624 619 dev_info(ctrl->ctrl.device, 625 620 "failed to connect queue: %d ret=%d\n", idx, ret); 626 621 } ··· 827 820 if (error) 828 821 goto out_stop_queue; 829 822 830 - ctrl->ctrl.max_hw_sectors = 831 - (ctrl->max_fr_pages - 1) << (ilog2(SZ_4K) - 9); 823 + ctrl->ctrl.max_segments = ctrl->max_fr_pages; 824 + ctrl->ctrl.max_hw_sectors = ctrl->max_fr_pages << (ilog2(SZ_4K) - 9); 832 825 833 826 blk_mq_unquiesce_queue(ctrl->ctrl.admin_q); 834 827
+2 -2
drivers/nvme/host/tcp.c
··· 1042 1042 { 1043 1043 struct nvme_tcp_queue *queue = 1044 1044 container_of(w, struct nvme_tcp_queue, io_work); 1045 - unsigned long start = jiffies + msecs_to_jiffies(1); 1045 + unsigned long deadline = jiffies + msecs_to_jiffies(1); 1046 1046 1047 1047 do { 1048 1048 bool pending = false; ··· 1067 1067 if (!pending) 1068 1068 return; 1069 1069 1070 - } while (time_after(jiffies, start)); /* quota is exhausted */ 1070 + } while (!time_after(jiffies, deadline)); /* quota is exhausted */ 1071 1071 1072 1072 queue_work_on(queue->io_cpu, nvme_tcp_wq, &queue->io_work); 1073 1073 }
+8 -8
drivers/nvme/target/io-cmd-bdev.c
··· 11 11 void nvmet_bdev_set_limits(struct block_device *bdev, struct nvme_id_ns *id) 12 12 { 13 13 const struct queue_limits *ql = &bdev_get_queue(bdev)->limits; 14 - /* Number of physical blocks per logical block. */ 15 - const u32 ppl = ql->physical_block_size / ql->logical_block_size; 16 - /* Physical blocks per logical block, 0's based. */ 17 - const __le16 ppl0b = to0based(ppl); 14 + /* Number of logical blocks per physical block. */ 15 + const u32 lpp = ql->physical_block_size / ql->logical_block_size; 16 + /* Logical blocks per physical block, 0's based. */ 17 + const __le16 lpp0b = to0based(lpp); 18 18 19 19 /* 20 20 * For NVMe 1.2 and later, bit 1 indicates that the fields NAWUN, ··· 25 25 * field from the identify controller data structure should be used. 26 26 */ 27 27 id->nsfeat |= 1 << 1; 28 - id->nawun = ppl0b; 29 - id->nawupf = ppl0b; 30 - id->nacwu = ppl0b; 28 + id->nawun = lpp0b; 29 + id->nawupf = lpp0b; 30 + id->nacwu = lpp0b; 31 31 32 32 /* 33 33 * Bit 4 indicates that the fields NPWG, NPWA, NPDG, NPDA, and ··· 36 36 */ 37 37 id->nsfeat |= 1 << 4; 38 38 /* NPWG = Namespace Preferred Write Granularity. 0's based */ 39 - id->npwg = ppl0b; 39 + id->npwg = lpp0b; 40 40 /* NPWA = Namespace Preferred Write Alignment. 0's based */ 41 41 id->npwa = id->npwg; 42 42 /* NPDG = Namespace Preferred Deallocate Granularity. 0's based */
+4 -8
drivers/nvme/target/tcp.c
··· 348 348 349 349 return 0; 350 350 err: 351 - if (cmd->req.sg_cnt) 352 - sgl_free(cmd->req.sg); 351 + sgl_free(cmd->req.sg); 353 352 return NVME_SC_INTERNAL; 354 353 } 355 354 ··· 553 554 554 555 if (queue->nvme_sq.sqhd_disabled) { 555 556 kfree(cmd->iov); 556 - if (cmd->req.sg_cnt) 557 - sgl_free(cmd->req.sg); 557 + sgl_free(cmd->req.sg); 558 558 } 559 559 560 560 return 1; ··· 584 586 return -EAGAIN; 585 587 586 588 kfree(cmd->iov); 587 - if (cmd->req.sg_cnt) 588 - sgl_free(cmd->req.sg); 589 + sgl_free(cmd->req.sg); 589 590 cmd->queue->snd_cmd = NULL; 590 591 nvmet_tcp_put_cmd(cmd); 591 592 return 1; ··· 1307 1310 nvmet_req_uninit(&cmd->req); 1308 1311 nvmet_tcp_unmap_pdu_iovec(cmd); 1309 1312 kfree(cmd->iov); 1310 - if (cmd->req.sg_cnt) 1311 - sgl_free(cmd->req.sg); 1313 + sgl_free(cmd->req.sg); 1312 1314 } 1313 1315 1314 1316 static void nvmet_tcp_uninit_data_in_cmds(struct nvmet_tcp_queue *queue)
+11 -70
drivers/s390/block/dasd_eckd.c
··· 1553 1553 if (rc == 0) { 1554 1554 memcpy(&private->vsq, vsq, sizeof(*vsq)); 1555 1555 } else { 1556 - dev_warn(&device->cdev->dev, 1557 - "Reading the volume storage information failed with rc=%d\n", rc); 1556 + DBF_EVENT_DEVID(DBF_WARNING, device->cdev, 1557 + "Reading the volume storage information failed with rc=%d", rc); 1558 1558 } 1559 1559 1560 1560 if (useglobal) ··· 1737 1737 if (rc == 0) { 1738 1738 dasd_eckd_cpy_ext_pool_data(device, lcq); 1739 1739 } else { 1740 - dev_warn(&device->cdev->dev, 1741 - "Reading the logical configuration failed with rc=%d\n", rc); 1740 + DBF_EVENT_DEVID(DBF_WARNING, device->cdev, 1741 + "Reading the logical configuration failed with rc=%d", rc); 1742 1742 } 1743 1743 1744 1744 dasd_sfree_request(cqr, cqr->memdev); ··· 2020 2020 dasd_eckd_read_features(device); 2021 2021 2022 2022 /* Read Volume Information */ 2023 - rc = dasd_eckd_read_vol_info(device); 2024 - if (rc) 2025 - goto out_err3; 2023 + dasd_eckd_read_vol_info(device); 2026 2024 2027 2025 /* Read Extent Pool Information */ 2028 - rc = dasd_eckd_read_ext_pool_info(device); 2029 - if (rc) 2030 - goto out_err3; 2026 + dasd_eckd_read_ext_pool_info(device); 2031 2027 2032 2028 /* Read Device Characteristics */ 2033 2029 rc = dasd_generic_read_dev_chars(device, DASD_ECKD_MAGIC, ··· 2054 2058 readonly = dasd_device_is_ro(device); 2055 2059 if (readonly) 2056 2060 set_bit(DASD_FLAG_DEVICE_RO, &device->flags); 2057 - 2058 - if (dasd_eckd_is_ese(device)) 2059 - dasd_set_feature(device->cdev, DASD_FEATURE_DISCARD, 1); 2060 2061 2061 2062 dev_info(&device->cdev->dev, "New DASD %04X/%02X (CU %04X/%02X) " 2062 2063 "with %d cylinders, %d heads, %d sectors%s\n", ··· 3688 3695 return -EINVAL; 3689 3696 } 3690 3697 3691 - static struct dasd_ccw_req * 3692 - dasd_eckd_build_cp_discard(struct dasd_device *device, struct dasd_block *block, 3693 - struct request *req, sector_t first_trk, 3694 - sector_t last_trk) 3695 - { 3696 - return dasd_eckd_dso_ras(device, block, req, first_trk, last_trk, 1); 3697 - } 3698 - 3699 3698 static struct dasd_ccw_req *dasd_eckd_build_cp_cmd_single( 3700 3699 struct dasd_device *startdev, 3701 3700 struct dasd_block *block, ··· 4432 4447 cmdwtd = private->features.feature[12] & 0x40; 4433 4448 use_prefix = private->features.feature[8] & 0x01; 4434 4449 4435 - if (req_op(req) == REQ_OP_DISCARD) 4436 - return dasd_eckd_build_cp_discard(startdev, block, req, 4437 - first_trk, last_trk); 4438 - 4439 4450 cqr = NULL; 4440 4451 if (cdlspecial || dasd_page_cache) { 4441 4452 /* do nothing, just fall through to the cmd mode single case */ ··· 4710 4729 struct dasd_block *block, 4711 4730 struct request *req) 4712 4731 { 4713 - struct dasd_device *startdev = NULL; 4714 4732 struct dasd_eckd_private *private; 4715 - struct dasd_ccw_req *cqr; 4733 + struct dasd_device *startdev; 4716 4734 unsigned long flags; 4735 + struct dasd_ccw_req *cqr; 4717 4736 4718 - /* Discard requests can only be processed on base devices */ 4719 - if (req_op(req) != REQ_OP_DISCARD) 4720 - startdev = dasd_alias_get_start_dev(base); 4737 + startdev = dasd_alias_get_start_dev(base); 4721 4738 if (!startdev) 4722 4739 startdev = base; 4723 4740 private = startdev->private; ··· 5642 5663 dasd_eckd_read_features(device); 5643 5664 5644 5665 /* Read Volume Information */ 5645 - rc = dasd_eckd_read_vol_info(device); 5646 - if (rc) 5647 - goto out_err2; 5666 + dasd_eckd_read_vol_info(device); 5648 5667 5649 5668 /* Read Extent Pool Information */ 5650 - rc = dasd_eckd_read_ext_pool_info(device); 5651 - if (rc) 5652 - goto out_err2; 5669 + dasd_eckd_read_ext_pool_info(device); 5653 5670 5654 5671 /* Read Device Characteristics */ 5655 5672 rc = dasd_generic_read_dev_chars(device, DASD_ECKD_MAGIC, ··· 6496 6521 unsigned int logical_block_size = block->bp_block; 6497 6522 struct request_queue *q = block->request_queue; 6498 6523 struct dasd_device *device = block->base; 6499 - struct dasd_eckd_private *private; 6500 - unsigned int max_discard_sectors; 6501 - unsigned int max_bytes; 6502 - unsigned int ext_bytes; /* Extent Size in Bytes */ 6503 - int recs_per_trk; 6504 - int trks_per_cyl; 6505 - int ext_limit; 6506 - int ext_size; /* Extent Size in Cylinders */ 6507 6524 int max; 6508 - 6509 - private = device->private; 6510 - trks_per_cyl = private->rdc_data.trk_per_cyl; 6511 - recs_per_trk = recs_per_track(&private->rdc_data, 0, logical_block_size); 6512 6525 6513 6526 if (device->features & DASD_FEATURE_USERAW) { 6514 6527 /* ··· 6518 6555 /* With page sized segments each segment can be translated into one idaw/tidaw */ 6519 6556 blk_queue_max_segment_size(q, PAGE_SIZE); 6520 6557 blk_queue_segment_boundary(q, PAGE_SIZE - 1); 6521 - 6522 - if (dasd_eckd_is_ese(device)) { 6523 - /* 6524 - * Depending on the extent size, up to UINT_MAX bytes can be 6525 - * accepted. However, neither DASD_ECKD_RAS_EXTS_MAX nor the 6526 - * device limits should be exceeded. 6527 - */ 6528 - ext_size = dasd_eckd_ext_size(device); 6529 - ext_limit = min(private->real_cyl / ext_size, DASD_ECKD_RAS_EXTS_MAX); 6530 - ext_bytes = ext_size * trks_per_cyl * recs_per_trk * 6531 - logical_block_size; 6532 - max_bytes = UINT_MAX - (UINT_MAX % ext_bytes); 6533 - if (max_bytes / ext_bytes > ext_limit) 6534 - max_bytes = ext_bytes * ext_limit; 6535 - 6536 - max_discard_sectors = max_bytes / 512; 6537 - 6538 - blk_queue_max_discard_sectors(q, max_discard_sectors); 6539 - blk_queue_flag_set(QUEUE_FLAG_DISCARD, q); 6540 - q->limits.discard_granularity = ext_bytes; 6541 - q->limits.discard_alignment = ext_bytes; 6542 - } 6543 6558 } 6544 6559 6545 6560 static struct ccw_driver dasd_eckd_driver = {
+4 -4
fs/io_uring.c
··· 1892 1892 unsigned count, req_dist, tail_index; 1893 1893 struct io_ring_ctx *ctx = req->ctx; 1894 1894 struct list_head *entry; 1895 - struct timespec ts; 1895 + struct timespec64 ts; 1896 1896 1897 1897 if (unlikely(ctx->flags & IORING_SETUP_IOPOLL)) 1898 1898 return -EINVAL; 1899 1899 if (sqe->flags || sqe->ioprio || sqe->buf_index || sqe->timeout_flags || 1900 1900 sqe->len != 1) 1901 1901 return -EINVAL; 1902 - if (copy_from_user(&ts, (void __user *) (unsigned long) sqe->addr, 1903 - sizeof(ts))) 1902 + 1903 + if (get_timespec64(&ts, u64_to_user_ptr(sqe->addr))) 1904 1904 return -EFAULT; 1905 1905 1906 1906 /* ··· 1934 1934 1935 1935 hrtimer_init(&req->timeout.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); 1936 1936 req->timeout.timer.function = io_timeout_fn; 1937 - hrtimer_start(&req->timeout.timer, timespec_to_ktime(ts), 1937 + hrtimer_start(&req->timeout.timer, timespec64_to_ktime(ts), 1938 1938 HRTIMER_MODE_REL); 1939 1939 return 0; 1940 1940 }
+23
include/uapi/linux/nvme_ioctl.h
··· 45 45 __u32 result; 46 46 }; 47 47 48 + struct nvme_passthru_cmd64 { 49 + __u8 opcode; 50 + __u8 flags; 51 + __u16 rsvd1; 52 + __u32 nsid; 53 + __u32 cdw2; 54 + __u32 cdw3; 55 + __u64 metadata; 56 + __u64 addr; 57 + __u32 metadata_len; 58 + __u32 data_len; 59 + __u32 cdw10; 60 + __u32 cdw11; 61 + __u32 cdw12; 62 + __u32 cdw13; 63 + __u32 cdw14; 64 + __u32 cdw15; 65 + __u32 timeout_ms; 66 + __u64 result; 67 + }; 68 + 48 69 #define nvme_admin_cmd nvme_passthru_cmd 49 70 50 71 #define NVME_IOCTL_ID _IO('N', 0x40) ··· 75 54 #define NVME_IOCTL_RESET _IO('N', 0x44) 76 55 #define NVME_IOCTL_SUBSYS_RESET _IO('N', 0x45) 77 56 #define NVME_IOCTL_RESCAN _IO('N', 0x46) 57 + #define NVME_IOCTL_ADMIN64_CMD _IOWR('N', 0x47, struct nvme_passthru_cmd64) 58 + #define NVME_IOCTL_IO64_CMD _IOWR('N', 0x48, struct nvme_passthru_cmd64) 78 59 79 60 #endif /* _UAPI_LINUX_NVME_IOCTL_H */
+4 -1
include/uapi/linux/pg.h
··· 35 35 36 36 */ 37 37 38 + #ifndef _UAPI_LINUX_PG_H 39 + #define _UAPI_LINUX_PG_H 40 + 38 41 #define PG_MAGIC 'P' 39 42 #define PG_RESET 'Z' 40 43 #define PG_COMMAND 'C' ··· 64 61 65 62 }; 66 63 67 - /* end of pg.h */ 64 + #endif /* _UAPI_LINUX_PG_H */