Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

get rid of DEBUG_WRITECOUNT

it only makes control flow in __fput() and friends more convoluted.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro 4597e695 dd20908a

-78
-1
arch/powerpc/configs/ppc6xx_defconfig
··· 1244 1244 CONFIG_DEBUG_HIGHMEM=y 1245 1245 CONFIG_DEBUG_INFO=y 1246 1246 CONFIG_DEBUG_VM=y 1247 - CONFIG_DEBUG_WRITECOUNT=y 1248 1247 CONFIG_DEBUG_LIST=y 1249 1248 CONFIG_DEBUG_SG=y 1250 1249 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
-1
arch/powerpc/configs/ps3_defconfig
··· 174 174 CONFIG_PROVE_LOCKING=y 175 175 CONFIG_DEBUG_LOCKDEP=y 176 176 CONFIG_DEBUG_INFO=y 177 - CONFIG_DEBUG_WRITECOUNT=y 178 177 CONFIG_DEBUG_MEMORY_INIT=y 179 178 CONFIG_DEBUG_LIST=y 180 179 CONFIG_RCU_CPU_STALL_TIMEOUT=60
-1
arch/s390/configs/default_defconfig
··· 550 550 CONFIG_DEBUG_LOCKDEP=y 551 551 CONFIG_DEBUG_ATOMIC_SLEEP=y 552 552 CONFIG_DEBUG_LOCKING_API_SELFTESTS=y 553 - CONFIG_DEBUG_WRITECOUNT=y 554 553 CONFIG_DEBUG_LIST=y 555 554 CONFIG_DEBUG_SG=y 556 555 CONFIG_DEBUG_NOTIFIERS=y
-1
arch/sh/configs/rsk7203_defconfig
··· 128 128 CONFIG_DEBUG_SPINLOCK_SLEEP=y 129 129 CONFIG_DEBUG_INFO=y 130 130 CONFIG_DEBUG_VM=y 131 - CONFIG_DEBUG_WRITECOUNT=y 132 131 CONFIG_DEBUG_LIST=y 133 132 CONFIG_DEBUG_SG=y 134 133 CONFIG_FRAME_POINTER=y
-1
arch/xtensa/configs/iss_defconfig
··· 627 627 # CONFIG_DEBUG_KOBJECT is not set 628 628 # CONFIG_DEBUG_INFO is not set 629 629 # CONFIG_DEBUG_VM is not set 630 - # CONFIG_DEBUG_WRITECOUNT is not set 631 630 # CONFIG_DEBUG_MEMORY_INIT is not set 632 631 # CONFIG_DEBUG_LIST is not set 633 632 # CONFIG_DEBUG_SG is not set
-1
arch/xtensa/configs/s6105_defconfig
··· 569 569 # CONFIG_DEBUG_INFO is not set 570 570 # CONFIG_DEBUG_VM is not set 571 571 CONFIG_DEBUG_NOMMU_REGIONS=y 572 - # CONFIG_DEBUG_WRITECOUNT is not set 573 572 # CONFIG_DEBUG_MEMORY_INIT is not set 574 573 # CONFIG_DEBUG_LIST is not set 575 574 # CONFIG_DEBUG_SG is not set
-5
fs/file_table.c
··· 52 52 static inline void file_free(struct file *f) 53 53 { 54 54 percpu_counter_dec(&nr_files); 55 - file_check_state(f); 56 55 call_rcu(&f->f_u.fu_rcuhead, file_free_rcu); 57 56 } 58 57 ··· 185 186 * that we can do debugging checks at __fput() 186 187 */ 187 188 if ((mode & FMODE_WRITE) && !special_file(path->dentry->d_inode->i_mode)) { 188 - file_take_write(file); 189 189 WARN_ON(mnt_clone_write(path->mnt)); 190 190 } 191 191 if ((mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) ··· 211 213 return; 212 214 213 215 put_write_access(inode); 214 - if (file_check_writeable(file) != 0) 215 - return; 216 216 __mnt_drop_write(mnt); 217 - file_release_write(file); 218 217 } 219 218 220 219 /* the real guts of fput() - releasing the last reference to file
-8
fs/open.c
··· 683 683 error = __get_file_write_access(inode, f->f_path.mnt); 684 684 if (error) 685 685 goto cleanup_file; 686 - file_take_write(f); 687 686 } 688 687 689 688 f->f_mapping = inode->i_mapping; ··· 730 731 fops_put(f->f_op); 731 732 if (f->f_mode & FMODE_WRITE) { 732 733 if (!special_file(inode->i_mode)) { 733 - /* 734 - * We don't consider this a real 735 - * mnt_want/drop_write() pair 736 - * because it all happenend right 737 - * here, so just reset the state. 738 - */ 739 734 put_write_access(inode); 740 - file_reset_write(f); 741 735 __mnt_drop_write(f->f_path.mnt); 742 736 } 743 737 }
-49
include/linux/fs.h
··· 769 769 index < ra->start + ra->size); 770 770 } 771 771 772 - #define FILE_MNT_WRITE_TAKEN 1 773 - #define FILE_MNT_WRITE_RELEASED 2 774 - 775 772 struct file { 776 773 union { 777 774 struct llist_node fu_llist; ··· 806 809 struct list_head f_tfile_llink; 807 810 #endif /* #ifdef CONFIG_EPOLL */ 808 811 struct address_space *f_mapping; 809 - #ifdef CONFIG_DEBUG_WRITECOUNT 810 - unsigned long f_mnt_write_state; 811 - #endif 812 812 } __attribute__((aligned(4))); /* lest something weird decides that 2 is OK */ 813 813 814 814 struct file_handle { ··· 822 828 } 823 829 #define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) 824 830 #define file_count(x) atomic_long_read(&(x)->f_count) 825 - 826 - #ifdef CONFIG_DEBUG_WRITECOUNT 827 - static inline void file_take_write(struct file *f) 828 - { 829 - WARN_ON(f->f_mnt_write_state != 0); 830 - f->f_mnt_write_state = FILE_MNT_WRITE_TAKEN; 831 - } 832 - static inline void file_release_write(struct file *f) 833 - { 834 - f->f_mnt_write_state |= FILE_MNT_WRITE_RELEASED; 835 - } 836 - static inline void file_reset_write(struct file *f) 837 - { 838 - f->f_mnt_write_state = 0; 839 - } 840 - static inline void file_check_state(struct file *f) 841 - { 842 - /* 843 - * At this point, either both or neither of these bits 844 - * should be set. 845 - */ 846 - WARN_ON(f->f_mnt_write_state == FILE_MNT_WRITE_TAKEN); 847 - WARN_ON(f->f_mnt_write_state == FILE_MNT_WRITE_RELEASED); 848 - } 849 - static inline int file_check_writeable(struct file *f) 850 - { 851 - if (f->f_mnt_write_state == FILE_MNT_WRITE_TAKEN) 852 - return 0; 853 - printk(KERN_WARNING "writeable file with no " 854 - "mnt_want_write()\n"); 855 - WARN_ON(1); 856 - return -EINVAL; 857 - } 858 - #else /* !CONFIG_DEBUG_WRITECOUNT */ 859 - static inline void file_take_write(struct file *filp) {} 860 - static inline void file_release_write(struct file *filp) {} 861 - static inline void file_reset_write(struct file *filp) {} 862 - static inline void file_check_state(struct file *filp) {} 863 - static inline int file_check_writeable(struct file *filp) 864 - { 865 - return 0; 866 - } 867 - #endif /* CONFIG_DEBUG_WRITECOUNT */ 868 831 869 832 #define MAX_NON_LFS ((1UL<<31) - 1) 870 833
-10
lib/Kconfig.debug
··· 1030 1030 of the BUG call as well as the EIP and oops trace. This aids 1031 1031 debugging but costs about 70-100K of memory. 1032 1032 1033 - config DEBUG_WRITECOUNT 1034 - bool "Debug filesystem writers count" 1035 - depends on DEBUG_KERNEL 1036 - help 1037 - Enable this to catch wrong use of the writers count in struct 1038 - vfsmount. This will increase the size of each file struct by 1039 - 32 bits. 1040 - 1041 - If unsure, say N. 1042 - 1043 1033 config DEBUG_LIST 1044 1034 bool "Debug linked list manipulation" 1045 1035 depends on DEBUG_KERNEL