| @@ -348,7 +348,7 @@ static int __blk_trace_remove(struct request_queue *q) · 347 unmodified lines |
| 348 | struct blk_trace *bt; | 348 | struct blk_trace *bt; |
| 349 | | 349 | |
| 350 | bt = rcu_replace_pointer(q->blk_trace, NULL, | 350 | bt = rcu_replace_pointer(q->blk_trace, NULL, |
| 351 | lockdep_is_held(&q->blk_trace_mutex)); | 351 | lockdep_is_held(&q->debugfs_mutex)); |
| 352 | if (!bt) | 352 | if (!bt) |
| 353 | return -EINVAL; | 353 | return -EINVAL; |
| 354 | | 354 | |
| @@ -362,9 +362,9 @@ int blk_trace_remove(struct request_queue *q) · 7 unmodified lines |
| 362 | { | 362 | { |
| 363 | int ret; | 363 | int ret; |
| 364 | | 364 | |
| 365 | mutex_lock(&q->blk_trace_mutex); | 365 | mutex_lock(&q->debugfs_mutex); |
| 366 | ret = __blk_trace_remove(q); | 366 | ret = __blk_trace_remove(q); |
| 367 | mutex_unlock(&q->blk_trace_mutex); | 367 | mutex_unlock(&q->debugfs_mutex); |
| 368 | | 368 | |
| 369 | return ret; | 369 | return ret; |
| 370 | } | 370 | } |
| @@ -483,14 +483,11 @@ static int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev, · 112 unmodified lines |
| 483 | struct dentry *dir = NULL; | 483 | struct dentry *dir = NULL; |
| 484 | int ret; | 484 | int ret; |
| 485 | | 485 | |
| 486 | lockdep_assert_held(&q->blk_trace_mutex); | 486 | lockdep_assert_held(&q->debugfs_mutex); |
| 487 | | 487 | |
| 488 | if (!buts->buf_size || !buts->buf_nr) | 488 | if (!buts->buf_size || !buts->buf_nr) |
| 489 | return -EINVAL; | 489 | return -EINVAL; |
| 490 | | 490 | |
| 491 | if (!blk_debugfs_root) | | |
| 492 | return -ENOENT; | | |
| 493 | | | |
| 494 | strncpy(buts->name, name, BLKTRACE_BDEV_SIZE); | 491 | strncpy(buts->name, name, BLKTRACE_BDEV_SIZE); |
| 495 | buts->name[BLKTRACE_BDEV_SIZE - 1] = '\0'; | 492 | buts->name[BLKTRACE_BDEV_SIZE - 1] = '\0'; |
| 496 | | 493 | |
| @@ -505,7 +502,7 @@ static int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev, · 8 unmodified lines |
| 505 | * we can be. | 502 | * we can be. |
| 506 | */ | 503 | */ |
| 507 | if (rcu_dereference_protected(q->blk_trace, | 504 | if (rcu_dereference_protected(q->blk_trace, |
| 508 | lockdep_is_held(&q->blk_trace_mutex))) { | 505 | lockdep_is_held(&q->debugfs_mutex))) { |
| 509 | pr_warn("Concurrent blktraces are not allowed on %s\n", | 506 | pr_warn("Concurrent blktraces are not allowed on %s\n", |
| 510 | buts->name); | 507 | buts->name); |
| 511 | return -EBUSY; | 508 | return -EBUSY; |
| @@ -524,18 +521,15 @@ static int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev, · 12 unmodified lines |
| 524 | if (!bt->msg_data) | 521 | if (!bt->msg_data) |
| 525 | goto err; | 522 | goto err; |
| 526 | | 523 | |
| 527 | #ifdef CONFIG_BLK_DEBUG_FS | | |
| 528 | /* | 524 | /* |
| 529 | * When tracing whole make_request drivers (multiqueue) block devices, | 525 | * When tracing the whole disk reuse the existing debugfs directory |
| 530 | * reuse the existing debugfs directory created by the block layer on | 526 | * created by the block layer on init. For partitions block devices, |
| 531 | * init. For request-based block devices, all partitions block devices, | | |
| 532 | * and scsi-generic block devices we create a temporary new debugfs | 527 | * and scsi-generic block devices we create a temporary new debugfs |
| 533 | * directory that will be removed once the trace ends. | 528 | * directory that will be removed once the trace ends. |
| 534 | */ | 529 | */ |
| 535 | if (queue_is_mq(q) && bdev && bdev == bdev->bd_contains) | 530 | if (bdev && bdev == bdev->bd_contains) |
| 536 | dir = q->debugfs_dir; | 531 | dir = q->debugfs_dir; |
| 537 | else | 532 | else |
| 538 | #endif | | |
| 539 | bt->dir = dir = debugfs_create_dir(buts->name, blk_debugfs_root); | 533 | bt->dir = dir = debugfs_create_dir(buts->name, blk_debugfs_root); |
| 540 | | 534 | |
| 541 | /* | 535 | /* |
| @@ -617,9 +611,9 @@ int blk_trace_setup(struct request_queue *q, char *name, dev_t dev, · 75 unmodified lines |
| 617 | { | 611 | { |
| 618 | int ret; | 612 | int ret; |
| 619 | | 613 | |
| 620 | mutex_lock(&q->blk_trace_mutex); | 614 | mutex_lock(&q->debugfs_mutex); |
| 621 | ret = __blk_trace_setup(q, name, dev, bdev, arg); | 615 | ret = __blk_trace_setup(q, name, dev, bdev, arg); |
| 622 | mutex_unlock(&q->blk_trace_mutex); | 616 | mutex_unlock(&q->debugfs_mutex); |
| 623 | | 617 | |
| 624 | return ret; | 618 | return ret; |
| 625 | } | 619 | } |
| @@ -665,7 +659,7 @@ static int __blk_trace_startstop(struct request_queue *q, int start) · 39 unmodified lines |
| 665 | struct blk_trace *bt; | 659 | struct blk_trace *bt; |
| 666 | | 660 | |
| 667 | bt = rcu_dereference_protected(q->blk_trace, | 661 | bt = rcu_dereference_protected(q->blk_trace, |
| 668 | lockdep_is_held(&q->blk_trace_mutex)); | 662 | lockdep_is_held(&q->debugfs_mutex)); |
| 669 | if (bt == NULL) | 663 | if (bt == NULL) |
| 670 | return -EINVAL; | 664 | return -EINVAL; |
| 671 | | 665 | |
| @@ -705,9 +699,9 @@ int blk_trace_startstop(struct request_queue *q, int start) · 33 unmodified lines |
| 705 | { | 699 | { |
| 706 | int ret; | 700 | int ret; |
| 707 | | 701 | |
| 708 | mutex_lock(&q->blk_trace_mutex); | 702 | mutex_lock(&q->debugfs_mutex); |
| 709 | ret = __blk_trace_startstop(q, start); | 703 | ret = __blk_trace_startstop(q, start); |
| 710 | mutex_unlock(&q->blk_trace_mutex); | 704 | mutex_unlock(&q->debugfs_mutex); |
| 711 | | 705 | |
| 712 | return ret; | 706 | return ret; |
| 713 | } | 707 | } |
| @@ -736,7 +730,7 @@ int blk_trace_ioctl(struct block_device *bdev, unsigned cmd, char __user *arg) · 22 unmodified lines |
| 736 | if (!q) | 730 | if (!q) |
| 737 | return -ENXIO; | 731 | return -ENXIO; |
| 738 | | 732 | |
| 739 | mutex_lock(&q->blk_trace_mutex); | 733 | mutex_lock(&q->debugfs_mutex); |
| 740 | | 734 | |
| 741 | switch (cmd) { | 735 | switch (cmd) { |
| 742 | case BLKTRACESETUP: | 736 | case BLKTRACESETUP: |
| @@ -763,7 +757,7 @@ int blk_trace_ioctl(struct block_device *bdev, unsigned cmd, char __user *arg) · 20 unmodified lines |
| 763 | break; | 757 | break; |
| 764 | } | 758 | } |
| 765 | | 759 | |
| 766 | mutex_unlock(&q->blk_trace_mutex); | 760 | mutex_unlock(&q->debugfs_mutex); |
| 767 | return ret; | 761 | return ret; |
| 768 | } | 762 | } |
| 769 | | 763 | |
| @@ -774,14 +768,14 @@ int blk_trace_ioctl(struct block_device *bdev, unsigned cmd, char __user *arg) · 4 unmodified lines |
| 774 | **/ | 768 | **/ |
| 775 | void blk_trace_shutdown(struct request_queue *q) | 769 | void blk_trace_shutdown(struct request_queue *q) |
| 776 | { | 770 | { |
| 777 | mutex_lock(&q->blk_trace_mutex); | 771 | mutex_lock(&q->debugfs_mutex); |
| 778 | if (rcu_dereference_protected(q->blk_trace, | 772 | if (rcu_dereference_protected(q->blk_trace, |
| 779 | lockdep_is_held(&q->blk_trace_mutex))) { | 773 | lockdep_is_held(&q->debugfs_mutex))) { |
| 780 | __blk_trace_startstop(q, 0); | 774 | __blk_trace_startstop(q, 0); |
| 781 | __blk_trace_remove(q); | 775 | __blk_trace_remove(q); |
| 782 | } | 776 | } |
| 783 | | 777 | |
| 784 | mutex_unlock(&q->blk_trace_mutex); | 778 | mutex_unlock(&q->debugfs_mutex); |
| 785 | } | 779 | } |
| 786 | | 780 | |
| 787 | #ifdef CONFIG_BLK_CGROUP | 781 | #ifdef CONFIG_BLK_CGROUP |
| @@ -1662,7 +1656,7 @@ static int blk_trace_remove_queue(struct request_queue *q) · 874 unmodified lines |
| 1662 | struct blk_trace *bt; | 1656 | struct blk_trace *bt; |
| 1663 | | 1657 | |
| 1664 | bt = rcu_replace_pointer(q->blk_trace, NULL, | 1658 | bt = rcu_replace_pointer(q->blk_trace, NULL, |
| 1665 | lockdep_is_held(&q->blk_trace_mutex)); | 1659 | lockdep_is_held(&q->debugfs_mutex)); |
| 1666 | if (bt == NULL) | 1660 | if (bt == NULL) |
| 1667 | return -EINVAL; | 1661 | return -EINVAL; |
| 1668 | | 1662 | |
| @@ -1837,10 +1831,10 @@ static ssize_t sysfs_blk_trace_attr_show(struct device *dev, · 168 unmodified lines |
| 1837 | if (q == NULL) | 1831 | if (q == NULL) |
| 1838 | goto out_bdput; | 1832 | goto out_bdput; |
| 1839 | | 1833 | |
| 1840 | mutex_lock(&q->blk_trace_mutex); | 1834 | mutex_lock(&q->debugfs_mutex); |
| 1841 | | 1835 | |
| 1842 | bt = rcu_dereference_protected(q->blk_trace, | 1836 | bt = rcu_dereference_protected(q->blk_trace, |
| 1843 | lockdep_is_held(&q->blk_trace_mutex)); | 1837 | lockdep_is_held(&q->debugfs_mutex)); |
| 1844 | if (attr == &dev_attr_enable) { | 1838 | if (attr == &dev_attr_enable) { |
| 1845 | ret = sprintf(buf, "%u\n", !!bt); | 1839 | ret = sprintf(buf, "%u\n", !!bt); |
| 1846 | goto out_unlock_bdev; | 1840 | goto out_unlock_bdev; |
| @@ -1858,7 +1852,7 @@ static ssize_t sysfs_blk_trace_attr_show(struct device *dev, · 11 unmodified lines |
| 1858 | ret = sprintf(buf, "%llu\n", bt->end_lba); | 1852 | ret = sprintf(buf, "%llu\n", bt->end_lba); |
| 1859 | | 1853 | |
| 1860 | out_unlock_bdev: | 1854 | out_unlock_bdev: |
| 1861 | mutex_unlock(&q->blk_trace_mutex); | 1855 | mutex_unlock(&q->debugfs_mutex); |
| 1862 | out_bdput: | 1856 | out_bdput: |
| 1863 | bdput(bdev); | 1857 | bdput(bdev); |
| 1864 | out: | 1858 | out: |
| @@ -1901,10 +1895,10 @@ static ssize_t sysfs_blk_trace_attr_store(struct device *dev, · 36 unmodified lines |
| 1901 | if (q == NULL) | 1895 | if (q == NULL) |
| 1902 | goto out_bdput; | 1896 | goto out_bdput; |
| 1903 | | 1897 | |
| 1904 | mutex_lock(&q->blk_trace_mutex); | 1898 | mutex_lock(&q->debugfs_mutex); |
| 1905 | | 1899 | |
| 1906 | bt = rcu_dereference_protected(q->blk_trace, | 1900 | bt = rcu_dereference_protected(q->blk_trace, |
| 1907 | lockdep_is_held(&q->blk_trace_mutex)); | 1901 | lockdep_is_held(&q->debugfs_mutex)); |
| 1908 | if (attr == &dev_attr_enable) { | 1902 | if (attr == &dev_attr_enable) { |
| 1909 | if (!!value == !!bt) { | 1903 | if (!!value == !!bt) { |
| 1910 | ret = 0; | 1904 | ret = 0; |
| @@ -1921,7 +1915,7 @@ static ssize_t sysfs_blk_trace_attr_store(struct device *dev, · 10 unmodified lines |
| 1921 | if (bt == NULL) { | 1915 | if (bt == NULL) { |
| 1922 | ret = blk_trace_setup_queue(q, bdev); | 1916 | ret = blk_trace_setup_queue(q, bdev); |
| 1923 | bt = rcu_dereference_protected(q->blk_trace, | 1917 | bt = rcu_dereference_protected(q->blk_trace, |
| 1924 | lockdep_is_held(&q->blk_trace_mutex)); | 1918 | lockdep_is_held(&q->debugfs_mutex)); |
| 1925 | } | 1919 | } |
| 1926 | | 1920 | |
| 1927 | if (ret == 0) { | 1921 | if (ret == 0) { |
| @@ -1936,7 +1930,7 @@ static ssize_t sysfs_blk_trace_attr_store(struct device *dev, · 8 unmodified lines |
| 1936 | } | 1930 | } |
| 1937 | | 1931 | |
| 1938 | out_unlock_bdev: | 1932 | out_unlock_bdev: |
| 1939 | mutex_unlock(&q->blk_trace_mutex); | 1933 | mutex_unlock(&q->debugfs_mutex); |
| 1940 | out_bdput: | 1934 | out_bdput: |
| 1941 | bdput(bdev); | 1935 | bdput(bdev); |
| 1942 | out: | 1936 | out: |