Pull block layer fixes from Jens Axboe: "Sending this off now, as I'm not aware of other current bugs, nor do I expect further fixes before 4.1 final. This contains two fixes: - a fix for a bdi unregister warning that gets spewed on md, due to a regression introduced earlier in this cycle. From Neil Brown. - a fix for a compile warning for NVMe on 32-bit platforms, also a regression introduced in this cycle. From Arnd Bergmann" * 'for-linus' of git://git.kernel.dk/linux-block: NVMe: fix type warning on 32-bit block: discard bdi_unregister() in favour of bdi_destroy()
Unified · Split
| @@ -653,7 +653,6 @@ void del_gendisk(struct gendisk *disk) · 652 unmodified lines | |||
| 653 | disk->flags &= ~GENHD_FL_UP; | 653 | disk->flags &= ~GENHD_FL_UP; |
| 654 | 654 | ||
| 655 | sysfs_remove_link(&disk_to_dev(disk)->kobj, "bdi"); | 655 | sysfs_remove_link(&disk_to_dev(disk)->kobj, "bdi"); |
| 656 | bdi_unregister(&disk->queue->backing_dev_info); | ||
| 657 | blk_unregister_queue(disk); | 656 | blk_unregister_queue(disk); |
| 658 | blk_unregister_region(disk_devt(disk), disk->minors); | 657 | blk_unregister_region(disk_devt(disk), disk->minors); |
| 659 | 658 | ||
| @@ -1750,6 +1750,7 @@ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio) · 1749 unmodified lines | |||
| 1750 | struct nvme_iod *iod; | 1750 | struct nvme_iod *iod; |
| 1751 | dma_addr_t meta_dma = 0; | 1751 | dma_addr_t meta_dma = 0; |
| 1752 | void *meta = NULL; | 1752 | void *meta = NULL; |
| 1753 | void __user *metadata; | ||
| 1753 | 1754 | ||
| 1754 | if (copy_from_user(&io, uio, sizeof(io))) | 1755 | if (copy_from_user(&io, uio, sizeof(io))) |
| 1755 | return -EFAULT; | 1756 | return -EFAULT; |
| @@ -1763,6 +1764,8 @@ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio) · 7 unmodified lines | |||
| 1763 | meta_len = 0; | 1764 | meta_len = 0; |
| 1764 | } | 1765 | } |
| 1765 | 1766 | ||
| 1767 | metadata = (void __user *)(unsigned long)io.metadata; | ||
| 1768 | |||
| 1766 | write = io.opcode & 1; | 1769 | write = io.opcode & 1; |
| 1767 | 1770 | ||
| 1768 | switch (io.opcode) { | 1771 | switch (io.opcode) { |
| @@ -1786,13 +1789,13 @@ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio) · 17 unmodified lines | |||
| 1786 | if (meta_len) { | 1789 | if (meta_len) { |
| 1787 | meta = dma_alloc_coherent(&dev->pci_dev->dev, meta_len, | 1790 | meta = dma_alloc_coherent(&dev->pci_dev->dev, meta_len, |
| 1788 | &meta_dma, GFP_KERNEL); | 1791 | &meta_dma, GFP_KERNEL); |
| 1792 | |||
| 1789 | if (!meta) { | 1793 | if (!meta) { |
| 1790 | status = -ENOMEM; | 1794 | status = -ENOMEM; |
| 1791 | goto unmap; | 1795 | goto unmap; |
| 1792 | } | 1796 | } |
| 1793 | if (write) { | 1797 | if (write) { |
| 1794 | if (copy_from_user(meta, (void __user *)io.metadata, | 1798 | if (copy_from_user(meta, metadata, meta_len)) { |
| 1795 | meta_len)) { | ||
| 1796 | status = -EFAULT; | 1799 | status = -EFAULT; |
| 1797 | goto unmap; | 1800 | goto unmap; |
| 1798 | } | 1801 | } |
| @@ -1819,8 +1822,7 @@ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio) · 20 unmodified lines | |||
| 1819 | nvme_free_iod(dev, iod); | 1822 | nvme_free_iod(dev, iod); |
| 1820 | if (meta) { | 1823 | if (meta) { |
| 1821 | if (status == NVME_SC_SUCCESS && !write) { | 1824 | if (status == NVME_SC_SUCCESS && !write) { |
| 1822 | if (copy_to_user((void __user *)io.metadata, meta, | 1825 | if (copy_to_user(metadata, meta, meta_len)) |
| 1823 | meta_len)) | ||
| 1824 | status = -EFAULT; | 1826 | status = -EFAULT; |
| 1825 | } | 1827 | } |
| 1826 | dma_free_coherent(&dev->pci_dev->dev, meta_len, meta, meta_dma); | 1828 | dma_free_coherent(&dev->pci_dev->dev, meta_len, meta, meta_dma); |
| @@ -116,7 +116,6 @@ __printf(3, 4) · 115 unmodified lines | |||
| 116 | int bdi_register(struct backing_dev_info *bdi, struct device *parent, | 116 | int bdi_register(struct backing_dev_info *bdi, struct device *parent, |
| 117 | const char *fmt, ...); | 117 | const char *fmt, ...); |
| 118 | int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); | 118 | int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); |
| 119 | void bdi_unregister(struct backing_dev_info *bdi); | ||
| 120 | int __must_check bdi_setup_and_register(struct backing_dev_info *, char *); | 119 | int __must_check bdi_setup_and_register(struct backing_dev_info *, char *); |
| 121 | void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages, | 120 | void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages, |
| 122 | enum wb_reason reason); | 121 | enum wb_reason reason); |
| @@ -250,7 +250,6 @@ DEFINE_EVENT(writeback_class, name, \ · 249 unmodified lines | |||
| 250 | DEFINE_WRITEBACK_EVENT(writeback_nowork); | 250 | DEFINE_WRITEBACK_EVENT(writeback_nowork); |
| 251 | DEFINE_WRITEBACK_EVENT(writeback_wake_background); | 251 | DEFINE_WRITEBACK_EVENT(writeback_wake_background); |
| 252 | DEFINE_WRITEBACK_EVENT(writeback_bdi_register); | 252 | DEFINE_WRITEBACK_EVENT(writeback_bdi_register); |
| 253 | DEFINE_WRITEBACK_EVENT(writeback_bdi_unregister); | ||
| 254 | 253 | ||
| 255 | DECLARE_EVENT_CLASS(wbc_class, | 254 | DECLARE_EVENT_CLASS(wbc_class, |
| 256 | TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), | 255 | TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), |
| @@ -359,23 +359,6 @@ static void bdi_wb_shutdown(struct backing_dev_info *bdi) · 358 unmodified lines | |||
| 359 | flush_delayed_work(&bdi->wb.dwork); | 359 | flush_delayed_work(&bdi->wb.dwork); |
| 360 | } | 360 | } |
| 361 | 361 | ||
| 362 | /* | ||
| 363 | * Called when the device behind @bdi has been removed or ejected. | ||
| 364 | * | ||
| 365 | * We can't really do much here except for reducing the dirty ratio at | ||
| 366 | * the moment. In the future we should be able to set a flag so that | ||
| 367 | * the filesystem can handle errors at mark_inode_dirty time instead | ||
| 368 | * of only at writeback time. | ||
| 369 | */ | ||
| 370 | void bdi_unregister(struct backing_dev_info *bdi) | ||
| 371 | { | ||
| 372 | if (WARN_ON_ONCE(!bdi->dev)) | ||
| 373 | return; | ||
| 374 | |||
| 375 | bdi_set_min_ratio(bdi, 0); | ||
| 376 | } | ||
| 377 | EXPORT_SYMBOL(bdi_unregister); | ||
| 378 | |||
| 379 | static void bdi_wb_init(struct bdi_writeback *wb, struct backing_dev_info *bdi) | 362 | static void bdi_wb_init(struct bdi_writeback *wb, struct backing_dev_info *bdi) |
| 380 | { | 363 | { |
| 381 | memset(wb, 0, sizeof(*wb)); | 364 | memset(wb, 0, sizeof(*wb)); |
| @@ -443,6 +426,7 @@ void bdi_destroy(struct backing_dev_info *bdi) · 61 unmodified lines | |||
| 443 | int i; | 426 | int i; |
| 444 | 427 | ||
| 445 | bdi_wb_shutdown(bdi); | 428 | bdi_wb_shutdown(bdi); |
| 429 | bdi_set_min_ratio(bdi, 0); | ||
| 446 | 430 | ||
| 447 | WARN_ON(!list_empty(&bdi->work_list)); | 431 | WARN_ON(!list_empty(&bdi->work_list)); |
| 448 | WARN_ON(delayed_work_pending(&bdi->wb.dwork)); | 432 | WARN_ON(delayed_work_pending(&bdi->wb.dwork)); |