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.

blktrace: handle BLKTRACESETUP2 ioctl

Handle the BLKTRACESETUP2 ioctl, requesting an extended version of the
blktrace protocol from user-space.

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Johannes Thumshirn and committed by
Jens Axboe
4ae8efb4 3f672281

+37
+1
block/ioctl.c
··· 691 691 692 692 /* Incompatible alignment on i386 */ 693 693 case BLKTRACESETUP: 694 + case BLKTRACESETUP2: 694 695 return blk_trace_ioctl(bdev, cmd, argp); 695 696 default: 696 697 break;
+36
kernel/trace/blktrace.c
··· 749 749 } 750 750 EXPORT_SYMBOL_GPL(blk_trace_setup); 751 751 752 + static int blk_trace_setup2(struct request_queue *q, char *name, dev_t dev, 753 + struct block_device *bdev, char __user *arg) 754 + { 755 + struct blk_user_trace_setup2 buts2; 756 + struct blk_trace *bt; 757 + 758 + if (copy_from_user(&buts2, arg, sizeof(buts2))) 759 + return -EFAULT; 760 + 761 + if (!buts2.buf_size || !buts2.buf_nr) 762 + return -EINVAL; 763 + 764 + if (buts2.flags != 0) 765 + return -EINVAL; 766 + 767 + mutex_lock(&q->debugfs_mutex); 768 + bt = blk_trace_setup_prepare(q, name, dev, buts2.buf_size, buts2.buf_nr, 769 + bdev); 770 + if (IS_ERR(bt)) { 771 + mutex_unlock(&q->debugfs_mutex); 772 + return PTR_ERR(bt); 773 + } 774 + blk_trace_setup_finalize(q, name, 2, bt, &buts2); 775 + mutex_unlock(&q->debugfs_mutex); 776 + 777 + if (copy_to_user(arg, &buts2, sizeof(buts2))) { 778 + blk_trace_remove(q); 779 + return -EFAULT; 780 + } 781 + return 0; 782 + } 783 + 752 784 #if defined(CONFIG_COMPAT) && defined(CONFIG_X86_64) 753 785 static int compat_blk_trace_setup(struct request_queue *q, char *name, 754 786 dev_t dev, struct block_device *bdev, ··· 871 839 char b[BDEVNAME_SIZE]; 872 840 873 841 switch (cmd) { 842 + case BLKTRACESETUP2: 843 + snprintf(b, sizeof(b), "%pg", bdev); 844 + ret = blk_trace_setup2(q, b, bdev->bd_dev, bdev, arg); 845 + break; 874 846 case BLKTRACESETUP: 875 847 snprintf(b, sizeof(b), "%pg", bdev); 876 848 ret = blk_trace_setup(q, b, bdev->bd_dev, bdev, arg);