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 | 653 | disk->flags &= ~GENHD_FL_UP; |
| 654 | 654 | |
| 655 | 655 | sysfs_remove_link(&disk_to_dev(disk)->kobj, "bdi"); |
| 656 | − bdi_unregister(&disk->queue->backing_dev_info); | |
| 657 | 656 | blk_unregister_queue(disk); |
| 658 | 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 | 1750 | struct nvme_iod *iod; |
| 1751 | 1751 | dma_addr_t meta_dma = 0; |
| 1752 | 1752 | void *meta = NULL; |
| 1753 | + void __user *metadata; | |
| 1753 | 1754 | |
| 1754 | 1755 | if (copy_from_user(&io, uio, sizeof(io))) |
| 1755 | 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 | 1764 | meta_len = 0; |
| 1764 | 1765 | } |
| 1765 | 1766 | |
| 1767 | + metadata = (void __user *)(unsigned long)io.metadata; | |
| 1768 | + | |
| 1766 | 1769 | write = io.opcode & 1; |
| 1767 | 1770 | |
| 1768 | 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 | 1789 | if (meta_len) { |
| 1787 | 1790 | meta = dma_alloc_coherent(&dev->pci_dev->dev, meta_len, |
| 1788 | 1791 | &meta_dma, GFP_KERNEL); |
| 1792 | + | |
| 1789 | 1793 | if (!meta) { |
| 1790 | 1794 | status = -ENOMEM; |
| 1791 | 1795 | goto unmap; |
| 1792 | 1796 | } |
| 1793 | 1797 | if (write) { |
| 1794 | − if (copy_from_user(meta, (void __user *)io.metadata, | |
| 1795 | − meta_len)) { | |
| 1798 | + if (copy_from_user(meta, metadata, meta_len)) { | |
| 1796 | 1799 | status = -EFAULT; |
| 1797 | 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 | 1822 | nvme_free_iod(dev, iod); |
| 1820 | 1823 | if (meta) { |
| 1821 | 1824 | if (status == NVME_SC_SUCCESS && !write) { |
| 1822 | − if (copy_to_user((void __user *)io.metadata, meta, | |
| 1823 | − meta_len)) | |
| 1825 | + if (copy_to_user(metadata, meta, meta_len)) | |
| 1824 | 1826 | status = -EFAULT; |
| 1825 | 1827 | } |
| 1826 | 1828 | dma_free_coherent(&dev->pci_dev->dev, meta_len, meta, meta_dma); |
| @@ -116,7 +116,6 @@ __printf(3, 4) · 115 unmodified lines | ||
| 116 | 116 | int bdi_register(struct backing_dev_info *bdi, struct device *parent, |
| 117 | 117 | const char *fmt, ...); |
| 118 | 118 | int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); |
| 119 | −void bdi_unregister(struct backing_dev_info *bdi); | |
| 120 | 119 | int __must_check bdi_setup_and_register(struct backing_dev_info *, char *); |
| 121 | 120 | void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages, |
| 122 | 121 | enum wb_reason reason); |
| @@ -250,7 +250,6 @@ DEFINE_EVENT(writeback_class, name, \ · 249 unmodified lines | ||
| 250 | 250 | DEFINE_WRITEBACK_EVENT(writeback_nowork); |
| 251 | 251 | DEFINE_WRITEBACK_EVENT(writeback_wake_background); |
| 252 | 252 | DEFINE_WRITEBACK_EVENT(writeback_bdi_register); |
| 253 | −DEFINE_WRITEBACK_EVENT(writeback_bdi_unregister); | |
| 254 | 253 | |
| 255 | 254 | DECLARE_EVENT_CLASS(wbc_class, |
| 256 | 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 | 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 | 362 | static void bdi_wb_init(struct bdi_writeback *wb, struct backing_dev_info *bdi) |
| 380 | 363 | { |
| 381 | 364 | memset(wb, 0, sizeof(*wb)); |
| @@ -443,6 +426,7 @@ void bdi_destroy(struct backing_dev_info *bdi) · 61 unmodified lines | ||
| 443 | 426 | int i; |
| 444 | 427 | |
| 445 | 428 | bdi_wb_shutdown(bdi); |
| 429 | + bdi_set_min_ratio(bdi, 0); | |
| 446 | 430 | |
| 447 | 431 | WARN_ON(!list_empty(&bdi->work_list)); |
| 448 | 432 | WARN_ON(delayed_work_pending(&bdi->wb.dwork)); |