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 collection of fixes from this series. The most important here is a
regression fix for an issue that some folks would hit in blk-merge.c,
and the NVMe queue depth limit for the screwed up Apple "nvme"
controller.

In more detail, this pull request contains:

- a set of fixes for null_blk, including a fix for a few corner cases
where we could hang the device. From Arianna and Paolo.

- lightnvm:
- A build improvement from Keith.
- Update the qemu pci id detection from Matias.
- Error handling fixes for leaks and other little fixes from
Sudip and Wenwei.

- fix from Eric where BLKRRPART would not return EBUSY for whole
device mounts, only when partitions were mounted.

- fix from Jan Kara, where EOF O_DIRECT reads would return
negatively.

- remove check for rq_mergeable() when checking limits for cloned
requests. The check doesn't make any sense. It's assuming that
since NOMERGE is set on the request that we don't have to
recalculate limits since the request didn't change, but that's not
true if the request has been redirected. From Hannes.

- correctly get the bio front segment value set for single segment
bio's, fixing a BUG() in blk-merge. From Ming"

* 'for-linus' of git://git.kernel.dk/linux-block:
nvme: temporary fix for Apple controller reset
null_blk: change type of completion_nsec to unsigned long
null_blk: guarantee device restart in all irq modes
null_blk: set a separate timer for each command
blk-merge: fix computing bio->bi_seg_front_size in case of single segment
direct-io: Fix negative return from dio read beyond eof
block: Always check queue limits for cloned requests
lightnvm: missing nvm_lock acquire
lightnvm: unconverted ppa returned in get_bb_tbl
lightnvm: refactor and change vendor id for qemu
lightnvm: do device max sectors boundary check first
lightnvm: fix ioctl memory leaks
lightnvm: free memory when gennvm register fails
lightnvm: Simplify config when disabled
Return EBUSY from BLKRRPART for mounted whole-dev fs

+160 -142
+7 -14
block/blk-core.c
··· 2114 2114 EXPORT_SYMBOL(submit_bio); 2115 2115 2116 2116 /** 2117 - * blk_rq_check_limits - Helper function to check a request for the queue limit 2117 + * blk_cloned_rq_check_limits - Helper function to check a cloned request 2118 + * for new the queue limits 2118 2119 * @q: the queue 2119 2120 * @rq: the request being checked 2120 2121 * ··· 2126 2125 * after it is inserted to @q, it should be checked against @q before 2127 2126 * the insertion using this generic function. 2128 2127 * 2129 - * This function should also be useful for request stacking drivers 2130 - * in some cases below, so export this function. 2131 2128 * Request stacking drivers like request-based dm may change the queue 2132 - * limits while requests are in the queue (e.g. dm's table swapping). 2133 - * Such request stacking drivers should check those requests against 2134 - * the new queue limits again when they dispatch those requests, 2135 - * although such checkings are also done against the old queue limits 2136 - * when submitting requests. 2129 + * limits when retrying requests on other queues. Those requests need 2130 + * to be checked against the new queue limits again during dispatch. 2137 2131 */ 2138 - int blk_rq_check_limits(struct request_queue *q, struct request *rq) 2132 + static int blk_cloned_rq_check_limits(struct request_queue *q, 2133 + struct request *rq) 2139 2134 { 2140 - if (!rq_mergeable(rq)) 2141 - return 0; 2142 - 2143 2135 if (blk_rq_sectors(rq) > blk_queue_get_max_sectors(q, rq->cmd_flags)) { 2144 2136 printk(KERN_ERR "%s: over max size limit.\n", __func__); 2145 2137 return -EIO; ··· 2152 2158 2153 2159 return 0; 2154 2160 } 2155 - EXPORT_SYMBOL_GPL(blk_rq_check_limits); 2156 2161 2157 2162 /** 2158 2163 * blk_insert_cloned_request - Helper for stacking drivers to submit a request ··· 2163 2170 unsigned long flags; 2164 2171 int where = ELEVATOR_INSERT_BACK; 2165 2172 2166 - if (blk_rq_check_limits(q, rq)) 2173 + if (blk_cloned_rq_check_limits(q, rq)) 2167 2174 return -EIO; 2168 2175 2169 2176 if (rq->rq_disk &&
+3
block/blk-merge.c
··· 103 103 bvprv = bv; 104 104 bvprvp = &bvprv; 105 105 sectors += bv.bv_len >> 9; 106 + 107 + if (nsegs == 1 && seg_size > front_seg_size) 108 + front_seg_size = seg_size; 106 109 continue; 107 110 } 108 111 new_segment:
+1 -1
block/partition-generic.c
··· 397 397 struct hd_struct *part; 398 398 int res; 399 399 400 - if (bdev->bd_part_count) 400 + if (bdev->bd_part_count || bdev->bd_super) 401 401 return -EBUSY; 402 402 res = invalidate_partition(disk, 0); 403 403 if (res)
+33 -61
drivers/block/null_blk.c
··· 18 18 struct bio *bio; 19 19 unsigned int tag; 20 20 struct nullb_queue *nq; 21 + struct hrtimer timer; 21 22 }; 22 23 23 24 struct nullb_queue { ··· 49 48 static int null_major; 50 49 static int nullb_indexes; 51 50 static struct kmem_cache *ppa_cache; 52 - 53 - struct completion_queue { 54 - struct llist_head list; 55 - struct hrtimer timer; 56 - }; 57 - 58 - /* 59 - * These are per-cpu for now, they will need to be configured by the 60 - * complete_queues parameter and appropriately mapped. 61 - */ 62 - static DEFINE_PER_CPU(struct completion_queue, completion_queues); 63 51 64 52 enum { 65 53 NULL_IRQ_NONE = 0, ··· 132 142 device_param_cb(irqmode, &null_irqmode_param_ops, &irqmode, S_IRUGO); 133 143 MODULE_PARM_DESC(irqmode, "IRQ completion handler. 0-none, 1-softirq, 2-timer"); 134 144 135 - static int completion_nsec = 10000; 136 - module_param(completion_nsec, int, S_IRUGO); 145 + static unsigned long completion_nsec = 10000; 146 + module_param(completion_nsec, ulong, S_IRUGO); 137 147 MODULE_PARM_DESC(completion_nsec, "Time in ns to complete a request in hardware. Default: 10,000ns"); 138 148 139 149 static int hw_queue_depth = 64; ··· 170 180 put_tag(cmd->nq, cmd->tag); 171 181 } 172 182 183 + static enum hrtimer_restart null_cmd_timer_expired(struct hrtimer *timer); 184 + 173 185 static struct nullb_cmd *__alloc_cmd(struct nullb_queue *nq) 174 186 { 175 187 struct nullb_cmd *cmd; ··· 182 190 cmd = &nq->cmds[tag]; 183 191 cmd->tag = tag; 184 192 cmd->nq = nq; 193 + if (irqmode == NULL_IRQ_TIMER) { 194 + hrtimer_init(&cmd->timer, CLOCK_MONOTONIC, 195 + HRTIMER_MODE_REL); 196 + cmd->timer.function = null_cmd_timer_expired; 197 + } 185 198 return cmd; 186 199 } 187 200 ··· 217 220 218 221 static void end_cmd(struct nullb_cmd *cmd) 219 222 { 223 + struct request_queue *q = NULL; 224 + 220 225 switch (queue_mode) { 221 226 case NULL_Q_MQ: 222 227 blk_mq_end_request(cmd->rq, 0); ··· 229 230 break; 230 231 case NULL_Q_BIO: 231 232 bio_endio(cmd->bio); 232 - break; 233 + goto free_cmd; 233 234 } 234 235 236 + if (cmd->rq) 237 + q = cmd->rq->q; 238 + 239 + /* Restart queue if needed, as we are freeing a tag */ 240 + if (q && !q->mq_ops && blk_queue_stopped(q)) { 241 + unsigned long flags; 242 + 243 + spin_lock_irqsave(q->queue_lock, flags); 244 + if (blk_queue_stopped(q)) 245 + blk_start_queue(q); 246 + spin_unlock_irqrestore(q->queue_lock, flags); 247 + } 248 + free_cmd: 235 249 free_cmd(cmd); 236 250 } 237 251 238 252 static enum hrtimer_restart null_cmd_timer_expired(struct hrtimer *timer) 239 253 { 240 - struct completion_queue *cq; 241 - struct llist_node *entry; 242 - struct nullb_cmd *cmd; 243 - 244 - cq = &per_cpu(completion_queues, smp_processor_id()); 245 - 246 - while ((entry = llist_del_all(&cq->list)) != NULL) { 247 - entry = llist_reverse_order(entry); 248 - do { 249 - struct request_queue *q = NULL; 250 - 251 - cmd = container_of(entry, struct nullb_cmd, ll_list); 252 - entry = entry->next; 253 - if (cmd->rq) 254 - q = cmd->rq->q; 255 - end_cmd(cmd); 256 - 257 - if (q && !q->mq_ops && blk_queue_stopped(q)) { 258 - spin_lock(q->queue_lock); 259 - if (blk_queue_stopped(q)) 260 - blk_start_queue(q); 261 - spin_unlock(q->queue_lock); 262 - } 263 - } while (entry); 264 - } 254 + end_cmd(container_of(timer, struct nullb_cmd, timer)); 265 255 266 256 return HRTIMER_NORESTART; 267 257 } 268 258 269 259 static void null_cmd_end_timer(struct nullb_cmd *cmd) 270 260 { 271 - struct completion_queue *cq = &per_cpu(completion_queues, get_cpu()); 261 + ktime_t kt = ktime_set(0, completion_nsec); 272 262 273 - cmd->ll_list.next = NULL; 274 - if (llist_add(&cmd->ll_list, &cq->list)) { 275 - ktime_t kt = ktime_set(0, completion_nsec); 276 - 277 - hrtimer_start(&cq->timer, kt, HRTIMER_MODE_REL_PINNED); 278 - } 279 - 280 - put_cpu(); 263 + hrtimer_start(&cmd->timer, kt, HRTIMER_MODE_REL); 281 264 } 282 265 283 266 static void null_softirq_done_fn(struct request *rq) ··· 357 376 { 358 377 struct nullb_cmd *cmd = blk_mq_rq_to_pdu(bd->rq); 359 378 379 + if (irqmode == NULL_IRQ_TIMER) { 380 + hrtimer_init(&cmd->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); 381 + cmd->timer.function = null_cmd_timer_expired; 382 + } 360 383 cmd->rq = bd->rq; 361 384 cmd->nq = hctx->driver_data; 362 385 ··· 797 812 submit_queues = 1; 798 813 799 814 mutex_init(&lock); 800 - 801 - /* Initialize a separate list for each CPU for issuing softirqs */ 802 - for_each_possible_cpu(i) { 803 - struct completion_queue *cq = &per_cpu(completion_queues, i); 804 - 805 - init_llist_head(&cq->list); 806 - 807 - if (irqmode != NULL_IRQ_TIMER) 808 - continue; 809 - 810 - hrtimer_init(&cq->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); 811 - cq->timer.function = null_cmd_timer_expired; 812 - } 813 815 814 816 null_major = register_blkdev(0, "nullb"); 815 817 if (null_major < 0)
+55 -39
drivers/lightnvm/core.c
··· 123 123 } 124 124 EXPORT_SYMBOL(nvm_unregister_mgr); 125 125 126 + /* register with device with a supported manager */ 127 + static int register_mgr(struct nvm_dev *dev) 128 + { 129 + struct nvmm_type *mt; 130 + int ret = 0; 131 + 132 + list_for_each_entry(mt, &nvm_mgrs, list) { 133 + ret = mt->register_mgr(dev); 134 + if (ret > 0) { 135 + dev->mt = mt; 136 + break; /* successfully initialized */ 137 + } 138 + } 139 + 140 + if (!ret) 141 + pr_info("nvm: no compatible nvm manager found.\n"); 142 + 143 + return ret; 144 + } 145 + 126 146 static struct nvm_dev *nvm_find_nvm_dev(const char *name) 127 147 { 128 148 struct nvm_dev *dev; ··· 241 221 242 222 static int nvm_init(struct nvm_dev *dev) 243 223 { 244 - struct nvmm_type *mt; 245 224 int ret = -EINVAL; 246 225 247 226 if (!dev->q || !dev->ops) ··· 271 252 goto err; 272 253 } 273 254 274 - /* register with device with a supported manager */ 275 - list_for_each_entry(mt, &nvm_mgrs, list) { 276 - ret = mt->register_mgr(dev); 277 - if (ret < 0) 278 - goto err; /* initialization failed */ 279 - if (ret > 0) { 280 - dev->mt = mt; 281 - break; /* successfully initialized */ 282 - } 283 - } 284 - 285 - if (!ret) { 286 - pr_info("nvm: no compatible manager found.\n"); 255 + down_write(&nvm_lock); 256 + ret = register_mgr(dev); 257 + up_write(&nvm_lock); 258 + if (ret < 0) 259 + goto err; 260 + if (!ret) 287 261 return 0; 288 - } 289 262 290 263 pr_info("nvm: registered %s [%u/%u/%u/%u/%u/%u]\n", 291 264 dev->name, dev->sec_per_pg, dev->nr_planes, ··· 319 308 if (ret) 320 309 goto err_init; 321 310 311 + if (dev->ops->max_phys_sect > 256) { 312 + pr_info("nvm: max sectors supported is 256.\n"); 313 + ret = -EINVAL; 314 + goto err_init; 315 + } 316 + 322 317 if (dev->ops->max_phys_sect > 1) { 323 318 dev->ppalist_pool = dev->ops->create_dma_pool(dev->q, 324 319 "ppalist"); ··· 333 316 ret = -ENOMEM; 334 317 goto err_init; 335 318 } 336 - } else if (dev->ops->max_phys_sect > 256) { 337 - pr_info("nvm: max sectors supported is 256.\n"); 338 - ret = -EINVAL; 339 - goto err_init; 340 319 } 341 320 342 321 down_write(&nvm_lock); ··· 348 335 349 336 void nvm_unregister(char *disk_name) 350 337 { 351 - struct nvm_dev *dev = nvm_find_nvm_dev(disk_name); 338 + struct nvm_dev *dev; 352 339 340 + down_write(&nvm_lock); 341 + dev = nvm_find_nvm_dev(disk_name); 353 342 if (!dev) { 354 343 pr_err("nvm: could not find device %s to unregister\n", 355 344 disk_name); 345 + up_write(&nvm_lock); 356 346 return; 357 347 } 358 348 359 - down_write(&nvm_lock); 360 349 list_del(&dev->devices); 361 350 up_write(&nvm_lock); 362 351 ··· 376 361 { 377 362 struct nvm_ioctl_create_simple *s = &create->conf.s; 378 363 struct request_queue *tqueue; 379 - struct nvmm_type *mt; 380 364 struct gendisk *tdisk; 381 365 struct nvm_tgt_type *tt; 382 366 struct nvm_target *t; 383 367 void *targetdata; 384 368 int ret = 0; 385 369 370 + down_write(&nvm_lock); 386 371 if (!dev->mt) { 387 - /* register with device with a supported NVM manager */ 388 - list_for_each_entry(mt, &nvm_mgrs, list) { 389 - ret = mt->register_mgr(dev); 390 - if (ret < 0) 391 - return ret; /* initialization failed */ 392 - if (ret > 0) { 393 - dev->mt = mt; 394 - break; /* successfully initialized */ 395 - } 396 - } 397 - 398 - if (!ret) { 399 - pr_info("nvm: no compatible nvm manager found.\n"); 400 - return -ENODEV; 372 + ret = register_mgr(dev); 373 + if (!ret) 374 + ret = -ENODEV; 375 + if (ret < 0) { 376 + up_write(&nvm_lock); 377 + return ret; 401 378 } 402 379 } 403 380 404 381 tt = nvm_find_target_type(create->tgttype); 405 382 if (!tt) { 406 383 pr_err("nvm: target type %s not found\n", create->tgttype); 384 + up_write(&nvm_lock); 407 385 return -EINVAL; 408 386 } 409 387 410 - down_write(&nvm_lock); 411 388 list_for_each_entry(t, &dev->online_targets, list) { 412 389 if (!strcmp(create->tgtname, t->disk->disk_name)) { 413 390 pr_err("nvm: target name already exists.\n"); ··· 483 476 struct nvm_dev *dev; 484 477 struct nvm_ioctl_create_simple *s; 485 478 479 + down_write(&nvm_lock); 486 480 dev = nvm_find_nvm_dev(create->dev); 481 + up_write(&nvm_lock); 487 482 if (!dev) { 488 483 pr_err("nvm: device not found\n"); 489 484 return -EINVAL; ··· 544 535 return -EINVAL; 545 536 } 546 537 538 + down_write(&nvm_lock); 547 539 dev = nvm_find_nvm_dev(devname); 540 + up_write(&nvm_lock); 548 541 if (!dev) { 549 542 pr_err("nvm: device not found\n"); 550 543 return -EINVAL; ··· 691 680 info->tgtsize = tgt_iter; 692 681 up_write(&nvm_lock); 693 682 694 - if (copy_to_user(arg, info, sizeof(struct nvm_ioctl_info))) 683 + if (copy_to_user(arg, info, sizeof(struct nvm_ioctl_info))) { 684 + kfree(info); 695 685 return -EFAULT; 686 + } 696 687 697 688 kfree(info); 698 689 return 0; ··· 737 724 738 725 devices->nr_devices = i; 739 726 740 - if (copy_to_user(arg, devices, sizeof(struct nvm_ioctl_get_devices))) 727 + if (copy_to_user(arg, devices, 728 + sizeof(struct nvm_ioctl_get_devices))) { 729 + kfree(devices); 741 730 return -EFAULT; 731 + } 742 732 743 733 kfree(devices); 744 734 return 0;
+11 -7
drivers/lightnvm/gennvm.c
··· 75 75 struct nvm_block *blk; 76 76 int i; 77 77 78 - ppa = dev_to_generic_addr(gn->dev, ppa); 79 78 lun = &gn->luns[(dev->nr_luns * ppa.g.ch) + ppa.g.lun]; 80 79 81 80 for (i = 0; i < nr_blocks; i++) { ··· 186 187 ppa.g.lun = lun->vlun.id; 187 188 ppa = generic_to_dev_addr(dev, ppa); 188 189 189 - ret = dev->ops->get_bb_tbl(dev->q, ppa, 190 + ret = dev->ops->get_bb_tbl(dev, ppa, 190 191 dev->blks_per_lun, 191 192 gennvm_block_bb, gn); 192 193 if (ret) ··· 204 205 } 205 206 206 207 return 0; 208 + } 209 + 210 + static void gennvm_free(struct nvm_dev *dev) 211 + { 212 + gennvm_blocks_free(dev); 213 + gennvm_luns_free(dev); 214 + kfree(dev->mp); 215 + dev->mp = NULL; 207 216 } 208 217 209 218 static int gennvm_register(struct nvm_dev *dev) ··· 241 234 242 235 return 1; 243 236 err: 244 - kfree(gn); 237 + gennvm_free(dev); 245 238 return ret; 246 239 } 247 240 248 241 static void gennvm_unregister(struct nvm_dev *dev) 249 242 { 250 - gennvm_blocks_free(dev); 251 - gennvm_luns_free(dev); 252 - kfree(dev->mp); 253 - dev->mp = NULL; 243 + gennvm_free(dev); 254 244 } 255 245 256 246 static struct nvm_block *gennvm_get_blk(struct nvm_dev *dev,
+2 -1
drivers/nvme/host/Makefile
··· 1 1 2 2 obj-$(CONFIG_BLK_DEV_NVME) += nvme.o 3 3 4 - nvme-y += pci.o scsi.o lightnvm.o 4 + lightnvm-$(CONFIG_NVM) := lightnvm.o 5 + nvme-y += pci.o scsi.o $(lightnvm-y)
+12 -16
drivers/nvme/host/lightnvm.c
··· 22 22 23 23 #include "nvme.h" 24 24 25 - #ifdef CONFIG_NVM 26 - 27 25 #include <linux/nvme.h> 28 26 #include <linux/bitops.h> 29 27 #include <linux/lightnvm.h> ··· 355 357 return ret; 356 358 } 357 359 358 - static int nvme_nvm_get_bb_tbl(struct request_queue *q, struct ppa_addr ppa, 360 + static int nvme_nvm_get_bb_tbl(struct nvm_dev *nvmdev, struct ppa_addr ppa, 359 361 int nr_blocks, nvm_bb_update_fn *update_bbtbl, 360 362 void *priv) 361 363 { 364 + struct request_queue *q = nvmdev->q; 362 365 struct nvme_ns *ns = q->queuedata; 363 366 struct nvme_dev *dev = ns->dev; 364 367 struct nvme_nvm_command c = {}; ··· 403 404 goto out; 404 405 } 405 406 407 + ppa = dev_to_generic_addr(nvmdev, ppa); 406 408 ret = update_bbtbl(ppa, nr_blocks, bb_tbl->blk, priv); 407 409 if (ret) { 408 410 ret = -EINTR; ··· 571 571 nvm_unregister(disk_name); 572 572 } 573 573 574 + /* move to shared place when used in multiple places. */ 575 + #define PCI_VENDOR_ID_CNEX 0x1d1d 576 + #define PCI_DEVICE_ID_CNEX_WL 0x2807 577 + #define PCI_DEVICE_ID_CNEX_QEMU 0x1f1f 578 + 574 579 int nvme_nvm_ns_supported(struct nvme_ns *ns, struct nvme_id_ns *id) 575 580 { 576 581 struct nvme_dev *dev = ns->dev; 577 582 struct pci_dev *pdev = to_pci_dev(dev->dev); 578 583 579 584 /* QEMU NVMe simulator - PCI ID + Vendor specific bit */ 580 - if (pdev->vendor == PCI_VENDOR_ID_INTEL && pdev->device == 0x5845 && 585 + if (pdev->vendor == PCI_VENDOR_ID_CNEX && 586 + pdev->device == PCI_DEVICE_ID_CNEX_QEMU && 581 587 id->vs[0] == 0x1) 582 588 return 1; 583 589 584 590 /* CNEX Labs - PCI ID + Vendor specific bit */ 585 - if (pdev->vendor == 0x1d1d && pdev->device == 0x2807 && 591 + if (pdev->vendor == PCI_VENDOR_ID_CNEX && 592 + pdev->device == PCI_DEVICE_ID_CNEX_WL && 586 593 id->vs[0] == 0x1) 587 594 return 1; 588 595 589 596 return 0; 590 597 } 591 - #else 592 - int nvme_nvm_register(struct request_queue *q, char *disk_name) 593 - { 594 - return 0; 595 - } 596 - void nvme_nvm_unregister(struct request_queue *q, char *disk_name) {}; 597 - int nvme_nvm_ns_supported(struct nvme_ns *ns, struct nvme_id_ns *id) 598 - { 599 - return 0; 600 - } 601 - #endif /* CONFIG_NVM */
+14
drivers/nvme/host/nvme.h
··· 136 136 int nvme_sg_io32(struct nvme_ns *ns, unsigned long arg); 137 137 int nvme_sg_get_version_num(int __user *ip); 138 138 139 + #ifdef CONFIG_NVM 139 140 int nvme_nvm_ns_supported(struct nvme_ns *ns, struct nvme_id_ns *id); 140 141 int nvme_nvm_register(struct request_queue *q, char *disk_name); 141 142 void nvme_nvm_unregister(struct request_queue *q, char *disk_name); 143 + #else 144 + static inline int nvme_nvm_register(struct request_queue *q, char *disk_name) 145 + { 146 + return 0; 147 + } 148 + 149 + static inline void nvme_nvm_unregister(struct request_queue *q, char *disk_name) {}; 150 + 151 + static inline int nvme_nvm_ns_supported(struct nvme_ns *ns, struct nvme_id_ns *id) 152 + { 153 + return 0; 154 + } 155 + #endif /* CONFIG_NVM */ 142 156 143 157 #endif /* _NVME_H */
+12
drivers/nvme/host/pci.c
··· 2708 2708 dev->q_depth = min_t(int, NVME_CAP_MQES(cap) + 1, NVME_Q_DEPTH); 2709 2709 dev->db_stride = 1 << NVME_CAP_STRIDE(cap); 2710 2710 dev->dbs = ((void __iomem *)dev->bar) + 4096; 2711 + 2712 + /* 2713 + * Temporary fix for the Apple controller found in the MacBook8,1 and 2714 + * some MacBook7,1 to avoid controller resets and data loss. 2715 + */ 2716 + if (pdev->vendor == PCI_VENDOR_ID_APPLE && pdev->device == 0x2001) { 2717 + dev->q_depth = 2; 2718 + dev_warn(dev->dev, "detected Apple NVMe controller, set " 2719 + "queue depth=%u to work around controller resets\n", 2720 + dev->q_depth); 2721 + } 2722 + 2711 2723 if (readl(&dev->bar->vs) >= NVME_VS(1, 2)) 2712 2724 dev->cmb = nvme_map_cmb(dev); 2713 2725
+9 -1
fs/direct-io.c
··· 1169 1169 } 1170 1170 } 1171 1171 1172 + /* Once we sampled i_size check for reads beyond EOF */ 1173 + dio->i_size = i_size_read(inode); 1174 + if (iov_iter_rw(iter) == READ && offset >= dio->i_size) { 1175 + if (dio->flags & DIO_LOCKING) 1176 + mutex_unlock(&inode->i_mutex); 1177 + kmem_cache_free(dio_cache, dio); 1178 + goto out; 1179 + } 1180 + 1172 1181 /* 1173 1182 * For file extending writes updating i_size before data writeouts 1174 1183 * complete can expose uninitialized blocks in dumb filesystems. ··· 1231 1222 sdio.next_block_for_io = -1; 1232 1223 1233 1224 dio->iocb = iocb; 1234 - dio->i_size = i_size_read(inode); 1235 1225 1236 1226 spin_lock_init(&dio->bio_lock); 1237 1227 dio->refcount = 1;
-1
include/linux/blkdev.h
··· 773 773 extern void blk_requeue_request(struct request_queue *, struct request *); 774 774 extern void blk_add_request_payload(struct request *rq, struct page *page, 775 775 unsigned int len); 776 - extern int blk_rq_check_limits(struct request_queue *q, struct request *rq); 777 776 extern int blk_lld_busy(struct request_queue *q); 778 777 extern int blk_rq_prep_clone(struct request *rq, struct request *rq_src, 779 778 struct bio_set *bs, gfp_t gfp_mask,
+1 -1
include/linux/lightnvm.h
··· 179 179 typedef int (nvm_id_fn)(struct request_queue *, struct nvm_id *); 180 180 typedef int (nvm_get_l2p_tbl_fn)(struct request_queue *, u64, u32, 181 181 nvm_l2p_update_fn *, void *); 182 - typedef int (nvm_op_bb_tbl_fn)(struct request_queue *, struct ppa_addr, int, 182 + typedef int (nvm_op_bb_tbl_fn)(struct nvm_dev *, struct ppa_addr, int, 183 183 nvm_bb_update_fn *, void *); 184 184 typedef int (nvm_op_set_bb_fn)(struct request_queue *, struct nvm_rq *, int); 185 185 typedef int (nvm_submit_io_fn)(struct request_queue *, struct nvm_rq *);