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.

scsi: sg: Remove deprecated sg-big-buff

These deprecated sysctl has been broken since commit 26d1c80fd61e
("scsi/sg: move sg-big-buff sysctl to scsi/sg.c") and nobody has found
this. I believe it's time to remove it, which will allow us to clean up a
significant amount of code.

Signed-off-by: Yang Erkun <yangerkun@huawei.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Link: https://patch.msgid.link/20260127062044.3034148-4-yangerkun@huawei.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Yang Erkun and committed by
Martin K. Petersen
50209dec d06a310b

+11 -48
+11 -48
drivers/scsi/sg.c
··· 81 81 82 82 #define SG_DEFAULT_TIMEOUT mult_frac(SG_DEFAULT_TIMEOUT_USER, HZ, USER_HZ) 83 83 84 - static int sg_big_buff = SG_DEF_RESERVED_SIZE; 85 84 /* N.B. This variable is readable and writeable via 86 - /proc/scsi/sg/def_reserved_size . Each time sg_open() is called a buffer 87 - of this size (or less if there is not enough memory) will be reserved 88 - for use by this file descriptor. [Deprecated usage: this variable is also 89 - readable via /proc/sys/kernel/sg-big-buff if the sg driver is built into 90 - the kernel (i.e. it is not a module).] */ 91 - static int def_reserved_size = -1; /* picks up init parameter */ 85 + * /proc/scsi/sg/def_reserved_size . Each time sg_open() is called a buffer 86 + * of this size (or less if there is not enough memory) will be reserved 87 + * for use by this file descriptor. 88 + */ 89 + 90 + /* picks up init parameter */ 91 + static int def_reserved_size = SG_DEF_RESERVED_SIZE; 92 92 static int sg_allow_dio = SG_ALLOW_DIO_DEF; 93 93 94 94 static int scatter_elem_sz = SG_SCATTER_SZ; ··· 1663 1663 MODULE_PARM_DESC(def_reserved_size, "size of buffer reserved for each fd"); 1664 1664 MODULE_PARM_DESC(allow_dio, "allow direct I/O (default: 0 (disallow))"); 1665 1665 1666 - #ifdef CONFIG_SYSCTL 1667 - #include <linux/sysctl.h> 1668 - 1669 - static const struct ctl_table sg_sysctls[] = { 1670 - { 1671 - .procname = "sg-big-buff", 1672 - .data = &sg_big_buff, 1673 - .maxlen = sizeof(int), 1674 - .mode = 0444, 1675 - .proc_handler = proc_dointvec, 1676 - }, 1677 - }; 1678 - 1679 - static struct ctl_table_header *hdr; 1680 - static void register_sg_sysctls(void) 1681 - { 1682 - if (!hdr) 1683 - hdr = register_sysctl("kernel", sg_sysctls); 1684 - } 1685 - 1686 - static void unregister_sg_sysctls(void) 1687 - { 1688 - unregister_sysctl_table(hdr); 1689 - } 1690 - #else 1691 - #define register_sg_sysctls() do { } while (0) 1692 - #define unregister_sg_sysctls() do { } while (0) 1693 - #endif /* CONFIG_SYSCTL */ 1694 - 1695 1666 static int __init 1696 1667 init_sg(void) 1697 1668 { ··· 1672 1701 scatter_elem_sz = PAGE_SIZE; 1673 1702 scatter_elem_sz_prev = scatter_elem_sz; 1674 1703 } 1675 - if (def_reserved_size >= 0) 1676 - sg_big_buff = def_reserved_size; 1677 - else 1678 - def_reserved_size = sg_big_buff; 1679 1704 1680 1705 rc = register_chrdev_region(MKDEV(SCSI_GENERIC_MAJOR, 0), 1681 1706 SG_MAX_DEVS, "sg"); ··· 1683 1716 sg_sysfs_valid = 1; 1684 1717 rc = scsi_register_interface(&sg_interface); 1685 1718 if (0 == rc) { 1686 - register_sg_sysctls(); 1687 1719 #ifdef CONFIG_SCSI_PROC_FS 1688 1720 sg_proc_init(); 1689 1721 #endif /* CONFIG_SCSI_PROC_FS */ ··· 1697 1731 static void __exit 1698 1732 exit_sg(void) 1699 1733 { 1700 - unregister_sg_sysctls(); 1701 1734 #ifdef CONFIG_SCSI_PROC_FS 1702 1735 remove_proc_subtree("scsi/sg", NULL); 1703 1736 #endif /* CONFIG_SCSI_PROC_FS */ ··· 2172 2207 write_unlock_irqrestore(&sdp->sfd_lock, iflags); 2173 2208 SCSI_LOG_TIMEOUT(3, sg_printk(KERN_INFO, sdp, 2174 2209 "sg_add_sfp: sfp=0x%p\n", sfp)); 2175 - if (unlikely(sg_big_buff != def_reserved_size)) 2176 - sg_big_buff = def_reserved_size; 2177 2210 2178 - bufflen = min_t(int, sg_big_buff, 2211 + bufflen = min_t(int, def_reserved_size, 2179 2212 max_sectors_bytes(sdp->device->request_queue)); 2180 2213 sg_build_reserve(sfp, bufflen); 2181 2214 SCSI_LOG_TIMEOUT(3, sg_printk(KERN_INFO, sdp, ··· 2401 2438 2402 2439 static int sg_proc_single_open_dressz(struct inode *inode, struct file *file) 2403 2440 { 2404 - return single_open(file, sg_proc_seq_show_int, &sg_big_buff); 2441 + return single_open(file, sg_proc_seq_show_int, &def_reserved_size); 2405 2442 } 2406 2443 2407 2444 static ssize_t ··· 2418 2455 if (err) 2419 2456 return err; 2420 2457 if (k <= 1048576) { /* limit "big buff" to 1 MB */ 2421 - sg_big_buff = k; 2458 + def_reserved_size = k; 2422 2459 return count; 2423 2460 } 2424 2461 return -ERANGE; ··· 2591 2628 2592 2629 if (it && (0 == it->index)) 2593 2630 seq_printf(s, "max_active_device=%d def_reserved_size=%d\n", 2594 - (int)it->max, sg_big_buff); 2631 + (int)it->max, def_reserved_size); 2595 2632 2596 2633 read_lock_irqsave(&sg_index_lock, iflags); 2597 2634 sdp = it ? sg_lookup_dev(it->index) : NULL;