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 branch 'for-linus' of git://git.kernel.dk/linux-block

Pull block fixes from Jens Axboe:
"A small set of fixes for -rc2 - two fixes for BFQ, documentation and
code, and a removal of an unused variable in nbd. Outside of that, a
small collection of fixes from the usual crew on the nvme side"

* 'for-linus' of git://git.kernel.dk/linux-block:
nvmet: don't report 0-bytes in serial number
nvmet: preserve controller serial number between reboots
nvmet: Move serial number from controller to subsystem
nvmet: prefix version configfs file with attr
nvme-pci: Fix an error handling path in 'nvme_probe()'
nvme-pci: Remove nvme_setup_prps BUG_ON
nvme-pci: add another device ID with stripe quirk
nvmet-fc: fix byte swapping in nvmet_fc_ls_create_association
nvme: fix byte swapping in the streams code
nbd: kill unused ret in recv_work
bfq: dispatch request to prevent queue stalling after the request completion
bfq: fix typos in comments about B-WF2Q+ algorithm

+92 -37
+3
block/bfq-iosched.c
··· 4299 4299 bfq_bfqq_expire(bfqd, bfqq, false, 4300 4300 BFQQE_NO_MORE_REQUESTS); 4301 4301 } 4302 + 4303 + if (!bfqd->rq_in_driver) 4304 + bfq_schedule_dispatch(bfqd); 4302 4305 } 4303 4306 4304 4307 static void bfq_put_rq_priv_body(struct bfq_queue *bfqq)
+1 -1
block/bfq-iosched.h
··· 52 52 struct bfq_service_tree { 53 53 /* tree for active entities (i.e., those backlogged) */ 54 54 struct rb_root active; 55 - /* tree for idle entities (i.e., not backlogged, with V <= F_i)*/ 55 + /* tree for idle entities (i.e., not backlogged, with V < F_i)*/ 56 56 struct rb_root idle; 57 57 58 58 /* idle entity with minimum F_i */
+1 -1
block/bfq-wf2q.c
··· 1297 1297 * 1298 1298 * This function searches the first schedulable entity, starting from the 1299 1299 * root of the tree and going on the left every time on this side there is 1300 - * a subtree with at least one eligible (start >= vtime) entity. The path on 1300 + * a subtree with at least one eligible (start <= vtime) entity. The path on 1301 1301 * the right is followed only if a) the left subtree contains no eligible 1302 1302 * entities and b) no eligible entity has been found yet. 1303 1303 */
-2
drivers/block/nbd.c
··· 626 626 struct nbd_device *nbd = args->nbd; 627 627 struct nbd_config *config = nbd->config; 628 628 struct nbd_cmd *cmd; 629 - int ret = 0; 630 629 631 630 while (1) { 632 631 cmd = nbd_read_stat(nbd, args->index); ··· 635 636 mutex_lock(&nsock->tx_lock); 636 637 nbd_mark_nsock_dead(nbd, nsock, 1); 637 638 mutex_unlock(&nsock->tx_lock); 638 - ret = PTR_ERR(cmd); 639 639 break; 640 640 } 641 641
+1 -1
drivers/nvme/host/core.c
··· 336 336 337 337 c.directive.opcode = nvme_admin_directive_recv; 338 338 c.directive.nsid = cpu_to_le32(nsid); 339 - c.directive.numd = sizeof(*s); 339 + c.directive.numd = cpu_to_le32(sizeof(*s)); 340 340 c.directive.doper = NVME_DIR_RCV_ST_OP_PARAM; 341 341 c.directive.dtype = NVME_DIR_STREAMS; 342 342
+32 -11
drivers/nvme/host/pci.c
··· 539 539 } 540 540 #endif 541 541 542 - static bool nvme_setup_prps(struct nvme_dev *dev, struct request *req) 542 + static blk_status_t nvme_setup_prps(struct nvme_dev *dev, struct request *req) 543 543 { 544 544 struct nvme_iod *iod = blk_mq_rq_to_pdu(req); 545 545 struct dma_pool *pool; ··· 556 556 557 557 length -= (page_size - offset); 558 558 if (length <= 0) 559 - return true; 559 + return BLK_STS_OK; 560 560 561 561 dma_len -= (page_size - offset); 562 562 if (dma_len) { ··· 569 569 570 570 if (length <= page_size) { 571 571 iod->first_dma = dma_addr; 572 - return true; 572 + return BLK_STS_OK; 573 573 } 574 574 575 575 nprps = DIV_ROUND_UP(length, page_size); ··· 585 585 if (!prp_list) { 586 586 iod->first_dma = dma_addr; 587 587 iod->npages = -1; 588 - return false; 588 + return BLK_STS_RESOURCE; 589 589 } 590 590 list[0] = prp_list; 591 591 iod->first_dma = prp_dma; ··· 595 595 __le64 *old_prp_list = prp_list; 596 596 prp_list = dma_pool_alloc(pool, GFP_ATOMIC, &prp_dma); 597 597 if (!prp_list) 598 - return false; 598 + return BLK_STS_RESOURCE; 599 599 list[iod->npages++] = prp_list; 600 600 prp_list[0] = old_prp_list[i - 1]; 601 601 old_prp_list[i - 1] = cpu_to_le64(prp_dma); ··· 609 609 break; 610 610 if (dma_len > 0) 611 611 continue; 612 - BUG_ON(dma_len < 0); 612 + if (unlikely(dma_len < 0)) 613 + goto bad_sgl; 613 614 sg = sg_next(sg); 614 615 dma_addr = sg_dma_address(sg); 615 616 dma_len = sg_dma_len(sg); 616 617 } 617 618 618 - return true; 619 + return BLK_STS_OK; 620 + 621 + bad_sgl: 622 + if (WARN_ONCE(1, "Invalid SGL for payload:%d nents:%d\n", 623 + blk_rq_payload_bytes(req), iod->nents)) { 624 + for_each_sg(iod->sg, sg, iod->nents, i) { 625 + dma_addr_t phys = sg_phys(sg); 626 + pr_warn("sg[%d] phys_addr:%pad offset:%d length:%d " 627 + "dma_address:%pad dma_length:%d\n", i, &phys, 628 + sg->offset, sg->length, 629 + &sg_dma_address(sg), 630 + sg_dma_len(sg)); 631 + } 632 + } 633 + return BLK_STS_IOERR; 634 + 619 635 } 620 636 621 637 static blk_status_t nvme_map_data(struct nvme_dev *dev, struct request *req, ··· 653 637 DMA_ATTR_NO_WARN)) 654 638 goto out; 655 639 656 - if (!nvme_setup_prps(dev, req)) 640 + ret = nvme_setup_prps(dev, req); 641 + if (ret != BLK_STS_OK) 657 642 goto out_unmap; 658 643 659 644 ret = BLK_STS_IOERR; ··· 2299 2282 2300 2283 result = nvme_dev_map(dev); 2301 2284 if (result) 2302 - goto free; 2285 + goto put_pci; 2303 2286 2304 2287 INIT_WORK(&dev->ctrl.reset_work, nvme_reset_work); 2305 2288 INIT_WORK(&dev->remove_work, nvme_remove_dead_ctrl_work); ··· 2308 2291 2309 2292 result = nvme_setup_prp_pools(dev); 2310 2293 if (result) 2311 - goto put_pci; 2294 + goto unmap; 2312 2295 2313 2296 quirks |= check_dell_samsung_bug(pdev); 2314 2297 ··· 2325 2308 2326 2309 release_pools: 2327 2310 nvme_release_prp_pools(dev); 2311 + unmap: 2312 + nvme_dev_unmap(dev); 2328 2313 put_pci: 2329 2314 put_device(dev->dev); 2330 - nvme_dev_unmap(dev); 2331 2315 free: 2332 2316 kfree(dev->queues); 2333 2317 kfree(dev); ··· 2482 2464 .driver_data = NVME_QUIRK_STRIPE_SIZE | 2483 2465 NVME_QUIRK_DEALLOCATE_ZEROES, }, 2484 2466 { PCI_VDEVICE(INTEL, 0x0a54), 2467 + .driver_data = NVME_QUIRK_STRIPE_SIZE | 2468 + NVME_QUIRK_DEALLOCATE_ZEROES, }, 2469 + { PCI_VDEVICE(INTEL, 0x0a55), 2485 2470 .driver_data = NVME_QUIRK_STRIPE_SIZE | 2486 2471 NVME_QUIRK_DEALLOCATE_ZEROES, }, 2487 2472 { PCI_VDEVICE(INTEL, 0xf1a5), /* Intel 600P/P3100 */
+14 -2
drivers/nvme/target/admin-cmd.c
··· 168 168 nvmet_req_complete(req, status); 169 169 } 170 170 171 + static void copy_and_pad(char *dst, int dst_len, const char *src, int src_len) 172 + { 173 + int len = min(src_len, dst_len); 174 + 175 + memcpy(dst, src, len); 176 + if (dst_len > len) 177 + memset(dst + len, ' ', dst_len - len); 178 + } 179 + 171 180 static void nvmet_execute_identify_ctrl(struct nvmet_req *req) 172 181 { 173 182 struct nvmet_ctrl *ctrl = req->sq->ctrl; 174 183 struct nvme_id_ctrl *id; 175 184 u16 status = 0; 185 + const char model[] = "Linux"; 176 186 177 187 id = kzalloc(sizeof(*id), GFP_KERNEL); 178 188 if (!id) { ··· 194 184 id->vid = 0; 195 185 id->ssvid = 0; 196 186 197 - memset(id->sn, ' ', sizeof(id->sn)); 198 - snprintf(id->sn, sizeof(id->sn), "%llx", ctrl->serial); 187 + bin2hex(id->sn, &ctrl->subsys->serial, 188 + min(sizeof(ctrl->subsys->serial), sizeof(id->sn) / 2)); 189 + copy_and_pad(id->mn, sizeof(id->mn), model, sizeof(model) - 1); 190 + copy_and_pad(id->fr, sizeof(id->fr), UTS_RELEASE, strlen(UTS_RELEASE)); 199 191 200 192 memset(id->mn, ' ', sizeof(id->mn)); 201 193 strncpy((char *)id->mn, "Linux", sizeof(id->mn));
+26 -4
drivers/nvme/target/configfs.c
··· 650 650 651 651 CONFIGFS_ATTR(nvmet_subsys_, attr_allow_any_host); 652 652 653 - static ssize_t nvmet_subsys_version_show(struct config_item *item, 653 + static ssize_t nvmet_subsys_attr_version_show(struct config_item *item, 654 654 char *page) 655 655 { 656 656 struct nvmet_subsys *subsys = to_subsys(item); ··· 666 666 (int)NVME_MINOR(subsys->ver)); 667 667 } 668 668 669 - static ssize_t nvmet_subsys_version_store(struct config_item *item, 669 + static ssize_t nvmet_subsys_attr_version_store(struct config_item *item, 670 670 const char *page, size_t count) 671 671 { 672 672 struct nvmet_subsys *subsys = to_subsys(item); ··· 684 684 685 685 return count; 686 686 } 687 - CONFIGFS_ATTR(nvmet_subsys_, version); 687 + CONFIGFS_ATTR(nvmet_subsys_, attr_version); 688 + 689 + static ssize_t nvmet_subsys_attr_serial_show(struct config_item *item, 690 + char *page) 691 + { 692 + struct nvmet_subsys *subsys = to_subsys(item); 693 + 694 + return snprintf(page, PAGE_SIZE, "%llx\n", subsys->serial); 695 + } 696 + 697 + static ssize_t nvmet_subsys_attr_serial_store(struct config_item *item, 698 + const char *page, size_t count) 699 + { 700 + struct nvmet_subsys *subsys = to_subsys(item); 701 + 702 + down_write(&nvmet_config_sem); 703 + sscanf(page, "%llx\n", &subsys->serial); 704 + up_write(&nvmet_config_sem); 705 + 706 + return count; 707 + } 708 + CONFIGFS_ATTR(nvmet_subsys_, attr_serial); 688 709 689 710 static struct configfs_attribute *nvmet_subsys_attrs[] = { 690 711 &nvmet_subsys_attr_attr_allow_any_host, 691 - &nvmet_subsys_attr_version, 712 + &nvmet_subsys_attr_attr_version, 713 + &nvmet_subsys_attr_attr_serial, 692 714 NULL, 693 715 }; 694 716
+2 -3
drivers/nvme/target/core.c
··· 767 767 memcpy(ctrl->subsysnqn, subsysnqn, NVMF_NQN_SIZE); 768 768 memcpy(ctrl->hostnqn, hostnqn, NVMF_NQN_SIZE); 769 769 770 - /* generate a random serial number as our controllers are ephemeral: */ 771 - get_random_bytes(&ctrl->serial, sizeof(ctrl->serial)); 772 - 773 770 kref_init(&ctrl->ref); 774 771 ctrl->subsys = subsys; 775 772 ··· 925 928 return NULL; 926 929 927 930 subsys->ver = NVME_VS(1, 3, 0); /* NVMe 1.3.0 */ 931 + /* generate a random serial number as our controllers are ephemeral: */ 932 + get_random_bytes(&subsys->serial, sizeof(subsys->serial)); 928 933 929 934 switch (type) { 930 935 case NVME_NQN_NVME:
+4 -4
drivers/nvme/target/fc.c
··· 1174 1174 */ 1175 1175 if (iod->rqstdatalen < FCNVME_LSDESC_CRA_RQST_MINLEN) 1176 1176 ret = VERR_CR_ASSOC_LEN; 1177 - else if (rqst->desc_list_len < 1178 - cpu_to_be32(FCNVME_LSDESC_CRA_RQST_MIN_LISTLEN)) 1177 + else if (be32_to_cpu(rqst->desc_list_len) < 1178 + FCNVME_LSDESC_CRA_RQST_MIN_LISTLEN) 1179 1179 ret = VERR_CR_ASSOC_RQST_LEN; 1180 1180 else if (rqst->assoc_cmd.desc_tag != 1181 1181 cpu_to_be32(FCNVME_LSDESC_CREATE_ASSOC_CMD)) 1182 1182 ret = VERR_CR_ASSOC_CMD; 1183 - else if (rqst->assoc_cmd.desc_len < 1184 - cpu_to_be32(FCNVME_LSDESC_CRA_CMD_DESC_MIN_DESCLEN)) 1183 + else if (be32_to_cpu(rqst->assoc_cmd.desc_len) < 1184 + FCNVME_LSDESC_CRA_CMD_DESC_MIN_DESCLEN) 1185 1185 ret = VERR_CR_ASSOC_CMD_LEN; 1186 1186 else if (!rqst->assoc_cmd.ersp_ratio || 1187 1187 (be16_to_cpu(rqst->assoc_cmd.ersp_ratio) >=
+1 -1
drivers/nvme/target/nvmet.h
··· 112 112 113 113 struct mutex lock; 114 114 u64 cap; 115 - u64 serial; 116 115 u32 cc; 117 116 u32 csts; 118 117 ··· 151 152 u16 max_qid; 152 153 153 154 u64 ver; 155 + u64 serial; 154 156 char *subsysnqn; 155 157 156 158 struct config_group group;
+7 -7
include/linux/nvme.h
··· 963 963 }; 964 964 965 965 struct streams_directive_params { 966 - __u16 msl; 967 - __u16 nssa; 968 - __u16 nsso; 966 + __le16 msl; 967 + __le16 nssa; 968 + __le16 nsso; 969 969 __u8 rsvd[10]; 970 - __u32 sws; 971 - __u16 sgs; 972 - __u16 nsa; 973 - __u16 nso; 970 + __le32 sws; 971 + __le16 sgs; 972 + __le16 nsa; 973 + __le16 nso; 974 974 __u8 rsvd2[6]; 975 975 }; 976 976