diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2014-03-14 10:06:32 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-04-01 23:19:12 -0400 |
commit | 4597e695b8baa3e2620da89c7593be70cf20566b (patch) | |
tree | f8e8cf56e4b154e8bef5e6ae2aa802526ccd1668 /include/linux | |
parent | dd20908a8a06b22c171f6c3fcdbdbd65bed07505 (diff) |
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>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/fs.h | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 23b2a35d712e..e80659ed78fc 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -769,9 +769,6 @@ static inline int ra_has_index(struct file_ra_state *ra, pgoff_t index) | |||
769 | index < ra->start + ra->size); | 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 | struct file { | 772 | struct file { |
776 | union { | 773 | union { |
777 | struct llist_node fu_llist; | 774 | struct llist_node fu_llist; |
@@ -809,9 +806,6 @@ struct file { | |||
809 | struct list_head f_tfile_llink; | 806 | struct list_head f_tfile_llink; |
810 | #endif /* #ifdef CONFIG_EPOLL */ | 807 | #endif /* #ifdef CONFIG_EPOLL */ |
811 | struct address_space *f_mapping; | 808 | struct address_space *f_mapping; |
812 | #ifdef CONFIG_DEBUG_WRITECOUNT | ||
813 | unsigned long f_mnt_write_state; | ||
814 | #endif | ||
815 | } __attribute__((aligned(4))); /* lest something weird decides that 2 is OK */ | 809 | } __attribute__((aligned(4))); /* lest something weird decides that 2 is OK */ |
816 | 810 | ||
817 | struct file_handle { | 811 | struct file_handle { |
@@ -829,49 +823,6 @@ static inline struct file *get_file(struct file *f) | |||
829 | #define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) | 823 | #define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) |
830 | #define file_count(x) atomic_long_read(&(x)->f_count) | 824 | #define file_count(x) atomic_long_read(&(x)->f_count) |
831 | 825 | ||
832 | #ifdef CONFIG_DEBUG_WRITECOUNT | ||
833 | static inline void file_take_write(struct file *f) | ||
834 | { | ||
835 | WARN_ON(f->f_mnt_write_state != 0); | ||
836 | f->f_mnt_write_state = FILE_MNT_WRITE_TAKEN; | ||
837 | } | ||
838 | static inline void file_release_write(struct file *f) | ||
839 | { | ||
840 | f->f_mnt_write_state |= FILE_MNT_WRITE_RELEASED; | ||
841 | } | ||
842 | static inline void file_reset_write(struct file *f) | ||
843 | { | ||
844 | f->f_mnt_write_state = 0; | ||
845 | } | ||
846 | static inline void file_check_state(struct file *f) | ||
847 | { | ||
848 | /* | ||
849 | * At this point, either both or neither of these bits | ||
850 | * should be set. | ||
851 | */ | ||
852 | WARN_ON(f->f_mnt_write_state == FILE_MNT_WRITE_TAKEN); | ||
853 | WARN_ON(f->f_mnt_write_state == FILE_MNT_WRITE_RELEASED); | ||
854 | } | ||
855 | static inline int file_check_writeable(struct file *f) | ||
856 | { | ||
857 | if (f->f_mnt_write_state == FILE_MNT_WRITE_TAKEN) | ||
858 | return 0; | ||
859 | printk(KERN_WARNING "writeable file with no " | ||
860 | "mnt_want_write()\n"); | ||
861 | WARN_ON(1); | ||
862 | return -EINVAL; | ||
863 | } | ||
864 | #else /* !CONFIG_DEBUG_WRITECOUNT */ | ||
865 | static inline void file_take_write(struct file *filp) {} | ||
866 | static inline void file_release_write(struct file *filp) {} | ||
867 | static inline void file_reset_write(struct file *filp) {} | ||
868 | static inline void file_check_state(struct file *filp) {} | ||
869 | static inline int file_check_writeable(struct file *filp) | ||
870 | { | ||
871 | return 0; | ||
872 | } | ||
873 | #endif /* CONFIG_DEBUG_WRITECOUNT */ | ||
874 | |||
875 | #define MAX_NON_LFS ((1UL<<31) - 1) | 826 | #define MAX_NON_LFS ((1UL<<31) - 1) |
876 | 827 | ||
877 | /* Page cache limit. The filesystems should put that into their s_maxbytes | 828 | /* Page cache limit. The filesystems should put that into their s_maxbytes |