diff options
author | Theodore Ts'o <tytso@mit.edu> | 2009-05-03 16:33:44 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2009-05-03 16:33:44 -0400 |
commit | ca0faba0e8ac844dc0279825eb8db876b5962ea5 (patch) | |
tree | 186acf88dda5958f44ec80349778f815cb172895 /fs/ext4 | |
parent | d444c3c38189b3f18337a213855ac1c07af4e2d9 (diff) |
ext4: Move the ext4_sb.h header file into ext4.h
There is no longer a reason for a separate ext4_sb.h header file, so
move it into ext4.h just to make life easier for developers to find
the relevant data structures and typedefs. Should also speed up
compiles slightly, too.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/ext4.h | 144 | ||||
-rw-r--r-- | fs/ext4/ext4_sb.h | 163 |
2 files changed, 140 insertions, 167 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index ba57d669cb65..af3c906e705b 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -25,6 +25,10 @@ | |||
25 | #include <linux/rbtree.h> | 25 | #include <linux/rbtree.h> |
26 | #include <linux/seqlock.h> | 26 | #include <linux/seqlock.h> |
27 | #include <linux/mutex.h> | 27 | #include <linux/mutex.h> |
28 | #include <linux/timer.h> | ||
29 | #include <linux/wait.h> | ||
30 | #include <linux/blockgroup_lock.h> | ||
31 | #include <linux/percpu_counter.h> | ||
28 | 32 | ||
29 | /* | 33 | /* |
30 | * The fourth extended filesystem constants/structures | 34 | * The fourth extended filesystem constants/structures |
@@ -195,9 +199,6 @@ struct flex_groups { | |||
195 | #define EXT4_BG_BLOCK_UNINIT 0x0002 /* Block bitmap not in use */ | 199 | #define EXT4_BG_BLOCK_UNINIT 0x0002 /* Block bitmap not in use */ |
196 | #define EXT4_BG_INODE_ZEROED 0x0004 /* On-disk itable initialized to zero */ | 200 | #define EXT4_BG_INODE_ZEROED 0x0004 /* On-disk itable initialized to zero */ |
197 | 201 | ||
198 | #ifdef __KERNEL__ | ||
199 | #include "ext4_sb.h" | ||
200 | #endif | ||
201 | /* | 202 | /* |
202 | * Macro-instructions used to manage group descriptors | 203 | * Macro-instructions used to manage group descriptors |
203 | */ | 204 | */ |
@@ -809,6 +810,136 @@ struct ext4_super_block { | |||
809 | }; | 810 | }; |
810 | 811 | ||
811 | #ifdef __KERNEL__ | 812 | #ifdef __KERNEL__ |
813 | /* | ||
814 | * fourth extended-fs super-block data in memory | ||
815 | */ | ||
816 | struct ext4_sb_info { | ||
817 | unsigned long s_desc_size; /* Size of a group descriptor in bytes */ | ||
818 | unsigned long s_inodes_per_block;/* Number of inodes per block */ | ||
819 | unsigned long s_blocks_per_group;/* Number of blocks in a group */ | ||
820 | unsigned long s_inodes_per_group;/* Number of inodes in a group */ | ||
821 | unsigned long s_itb_per_group; /* Number of inode table blocks per group */ | ||
822 | unsigned long s_gdb_count; /* Number of group descriptor blocks */ | ||
823 | unsigned long s_desc_per_block; /* Number of group descriptors per block */ | ||
824 | ext4_group_t s_groups_count; /* Number of groups in the fs */ | ||
825 | unsigned long s_overhead_last; /* Last calculated overhead */ | ||
826 | unsigned long s_blocks_last; /* Last seen block count */ | ||
827 | loff_t s_bitmap_maxbytes; /* max bytes for bitmap files */ | ||
828 | struct buffer_head * s_sbh; /* Buffer containing the super block */ | ||
829 | struct ext4_super_block *s_es; /* Pointer to the super block in the buffer */ | ||
830 | struct buffer_head **s_group_desc; | ||
831 | unsigned long s_mount_opt; | ||
832 | ext4_fsblk_t s_sb_block; | ||
833 | uid_t s_resuid; | ||
834 | gid_t s_resgid; | ||
835 | unsigned short s_mount_state; | ||
836 | unsigned short s_pad; | ||
837 | int s_addr_per_block_bits; | ||
838 | int s_desc_per_block_bits; | ||
839 | int s_inode_size; | ||
840 | int s_first_ino; | ||
841 | unsigned int s_inode_readahead_blks; | ||
842 | spinlock_t s_next_gen_lock; | ||
843 | u32 s_next_generation; | ||
844 | u32 s_hash_seed[4]; | ||
845 | int s_def_hash_version; | ||
846 | int s_hash_unsigned; /* 3 if hash should be signed, 0 if not */ | ||
847 | struct percpu_counter s_freeblocks_counter; | ||
848 | struct percpu_counter s_freeinodes_counter; | ||
849 | struct percpu_counter s_dirs_counter; | ||
850 | struct percpu_counter s_dirtyblocks_counter; | ||
851 | struct blockgroup_lock *s_blockgroup_lock; | ||
852 | struct proc_dir_entry *s_proc; | ||
853 | struct kobject s_kobj; | ||
854 | struct completion s_kobj_unregister; | ||
855 | |||
856 | /* Journaling */ | ||
857 | struct inode *s_journal_inode; | ||
858 | struct journal_s *s_journal; | ||
859 | struct list_head s_orphan; | ||
860 | struct mutex s_orphan_lock; | ||
861 | struct mutex s_resize_lock; | ||
862 | unsigned long s_commit_interval; | ||
863 | u32 s_max_batch_time; | ||
864 | u32 s_min_batch_time; | ||
865 | struct block_device *journal_bdev; | ||
866 | #ifdef CONFIG_JBD2_DEBUG | ||
867 | struct timer_list turn_ro_timer; /* For turning read-only (crash simulation) */ | ||
868 | wait_queue_head_t ro_wait_queue; /* For people waiting for the fs to go read-only */ | ||
869 | #endif | ||
870 | #ifdef CONFIG_QUOTA | ||
871 | char *s_qf_names[MAXQUOTAS]; /* Names of quota files with journalled quota */ | ||
872 | int s_jquota_fmt; /* Format of quota to use */ | ||
873 | #endif | ||
874 | unsigned int s_want_extra_isize; /* New inodes should reserve # bytes */ | ||
875 | |||
876 | #ifdef EXTENTS_STATS | ||
877 | /* ext4 extents stats */ | ||
878 | unsigned long s_ext_min; | ||
879 | unsigned long s_ext_max; | ||
880 | unsigned long s_depth_max; | ||
881 | spinlock_t s_ext_stats_lock; | ||
882 | unsigned long s_ext_blocks; | ||
883 | unsigned long s_ext_extents; | ||
884 | #endif | ||
885 | |||
886 | /* for buddy allocator */ | ||
887 | struct ext4_group_info ***s_group_info; | ||
888 | struct inode *s_buddy_cache; | ||
889 | long s_blocks_reserved; | ||
890 | spinlock_t s_reserve_lock; | ||
891 | spinlock_t s_md_lock; | ||
892 | tid_t s_last_transaction; | ||
893 | unsigned short *s_mb_offsets; | ||
894 | unsigned int *s_mb_maxs; | ||
895 | |||
896 | /* tunables */ | ||
897 | unsigned long s_stripe; | ||
898 | unsigned int s_mb_stream_request; | ||
899 | unsigned int s_mb_max_to_scan; | ||
900 | unsigned int s_mb_min_to_scan; | ||
901 | unsigned int s_mb_stats; | ||
902 | unsigned int s_mb_order2_reqs; | ||
903 | unsigned int s_mb_group_prealloc; | ||
904 | /* where last allocation was done - for stream allocation */ | ||
905 | unsigned long s_mb_last_group; | ||
906 | unsigned long s_mb_last_start; | ||
907 | |||
908 | /* history to debug policy */ | ||
909 | struct ext4_mb_history *s_mb_history; | ||
910 | int s_mb_history_cur; | ||
911 | int s_mb_history_max; | ||
912 | int s_mb_history_num; | ||
913 | spinlock_t s_mb_history_lock; | ||
914 | int s_mb_history_filter; | ||
915 | |||
916 | /* stats for buddy allocator */ | ||
917 | spinlock_t s_mb_pa_lock; | ||
918 | atomic_t s_bal_reqs; /* number of reqs with len > 1 */ | ||
919 | atomic_t s_bal_success; /* we found long enough chunks */ | ||
920 | atomic_t s_bal_allocated; /* in blocks */ | ||
921 | atomic_t s_bal_ex_scanned; /* total extents scanned */ | ||
922 | atomic_t s_bal_goals; /* goal hits */ | ||
923 | atomic_t s_bal_breaks; /* too long searches */ | ||
924 | atomic_t s_bal_2orders; /* 2^order hits */ | ||
925 | spinlock_t s_bal_lock; | ||
926 | unsigned long s_mb_buddies_generated; | ||
927 | unsigned long long s_mb_generation_time; | ||
928 | atomic_t s_mb_lost_chunks; | ||
929 | atomic_t s_mb_preallocated; | ||
930 | atomic_t s_mb_discarded; | ||
931 | |||
932 | /* locality groups */ | ||
933 | struct ext4_locality_group *s_locality_groups; | ||
934 | |||
935 | /* for write statistics */ | ||
936 | unsigned long s_sectors_written_start; | ||
937 | u64 s_kbytes_written; | ||
938 | |||
939 | unsigned int s_log_groups_per_flex; | ||
940 | struct flex_groups *s_flex_groups; | ||
941 | }; | ||
942 | |||
812 | static inline struct ext4_sb_info *EXT4_SB(struct super_block *sb) | 943 | static inline struct ext4_sb_info *EXT4_SB(struct super_block *sb) |
813 | { | 944 | { |
814 | return sb->s_fs_info; | 945 | return sb->s_fs_info; |
@@ -824,7 +955,6 @@ static inline struct timespec ext4_current_time(struct inode *inode) | |||
824 | current_fs_time(inode->i_sb) : CURRENT_TIME_SEC; | 955 | current_fs_time(inode->i_sb) : CURRENT_TIME_SEC; |
825 | } | 956 | } |
826 | 957 | ||
827 | |||
828 | static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino) | 958 | static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino) |
829 | { | 959 | { |
830 | return ino == EXT4_ROOT_INO || | 960 | return ino == EXT4_ROOT_INO || |
@@ -833,6 +963,12 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino) | |||
833 | (ino >= EXT4_FIRST_INO(sb) && | 963 | (ino >= EXT4_FIRST_INO(sb) && |
834 | ino <= le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count)); | 964 | ino <= le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count)); |
835 | } | 965 | } |
966 | |||
967 | static inline spinlock_t * | ||
968 | sb_bgl_lock(struct ext4_sb_info *sbi, unsigned int block_group) | ||
969 | { | ||
970 | return bgl_lock_ptr(sbi->s_blockgroup_lock, block_group); | ||
971 | } | ||
836 | #else | 972 | #else |
837 | /* Assume that user mode programs are passing in an ext4fs superblock, not | 973 | /* Assume that user mode programs are passing in an ext4fs superblock, not |
838 | * a kernel struct super_block. This will allow us to call the feature-test | 974 | * a kernel struct super_block. This will allow us to call the feature-test |
diff --git a/fs/ext4/ext4_sb.h b/fs/ext4/ext4_sb.h deleted file mode 100644 index 2d36223d5f57..000000000000 --- a/fs/ext4/ext4_sb.h +++ /dev/null | |||
@@ -1,163 +0,0 @@ | |||
1 | /* | ||
2 | * ext4_sb.h | ||
3 | * | ||
4 | * Copyright (C) 1992, 1993, 1994, 1995 | ||
5 | * Remy Card (card@masi.ibp.fr) | ||
6 | * Laboratoire MASI - Institut Blaise Pascal | ||
7 | * Universite Pierre et Marie Curie (Paris VI) | ||
8 | * | ||
9 | * from | ||
10 | * | ||
11 | * linux/include/linux/minix_fs_sb.h | ||
12 | * | ||
13 | * Copyright (C) 1991, 1992 Linus Torvalds | ||
14 | */ | ||
15 | |||
16 | #ifndef _EXT4_SB | ||
17 | #define _EXT4_SB | ||
18 | |||
19 | #ifdef __KERNEL__ | ||
20 | #include <linux/timer.h> | ||
21 | #include <linux/wait.h> | ||
22 | #include <linux/blockgroup_lock.h> | ||
23 | #include <linux/percpu_counter.h> | ||
24 | #endif | ||
25 | #include <linux/rbtree.h> | ||
26 | |||
27 | /* | ||
28 | * fourth extended-fs super-block data in memory | ||
29 | */ | ||
30 | struct ext4_sb_info { | ||
31 | unsigned long s_desc_size; /* Size of a group descriptor in bytes */ | ||
32 | unsigned long s_inodes_per_block;/* Number of inodes per block */ | ||
33 | unsigned long s_blocks_per_group;/* Number of blocks in a group */ | ||
34 | unsigned long s_inodes_per_group;/* Number of inodes in a group */ | ||
35 | unsigned long s_itb_per_group; /* Number of inode table blocks per group */ | ||
36 | unsigned long s_gdb_count; /* Number of group descriptor blocks */ | ||
37 | unsigned long s_desc_per_block; /* Number of group descriptors per block */ | ||
38 | ext4_group_t s_groups_count; /* Number of groups in the fs */ | ||
39 | unsigned long s_overhead_last; /* Last calculated overhead */ | ||
40 | unsigned long s_blocks_last; /* Last seen block count */ | ||
41 | loff_t s_bitmap_maxbytes; /* max bytes for bitmap files */ | ||
42 | struct buffer_head * s_sbh; /* Buffer containing the super block */ | ||
43 | struct ext4_super_block *s_es; /* Pointer to the super block in the buffer */ | ||
44 | struct buffer_head **s_group_desc; | ||
45 | unsigned long s_mount_opt; | ||
46 | ext4_fsblk_t s_sb_block; | ||
47 | uid_t s_resuid; | ||
48 | gid_t s_resgid; | ||
49 | unsigned short s_mount_state; | ||
50 | unsigned short s_pad; | ||
51 | int s_addr_per_block_bits; | ||
52 | int s_desc_per_block_bits; | ||
53 | int s_inode_size; | ||
54 | int s_first_ino; | ||
55 | unsigned int s_inode_readahead_blks; | ||
56 | spinlock_t s_next_gen_lock; | ||
57 | u32 s_next_generation; | ||
58 | u32 s_hash_seed[4]; | ||
59 | int s_def_hash_version; | ||
60 | int s_hash_unsigned; /* 3 if hash should be signed, 0 if not */ | ||
61 | struct percpu_counter s_freeblocks_counter; | ||
62 | struct percpu_counter s_freeinodes_counter; | ||
63 | struct percpu_counter s_dirs_counter; | ||
64 | struct percpu_counter s_dirtyblocks_counter; | ||
65 | struct blockgroup_lock *s_blockgroup_lock; | ||
66 | struct proc_dir_entry *s_proc; | ||
67 | struct kobject s_kobj; | ||
68 | struct completion s_kobj_unregister; | ||
69 | |||
70 | /* Journaling */ | ||
71 | struct inode *s_journal_inode; | ||
72 | struct journal_s *s_journal; | ||
73 | struct list_head s_orphan; | ||
74 | struct mutex s_orphan_lock; | ||
75 | struct mutex s_resize_lock; | ||
76 | unsigned long s_commit_interval; | ||
77 | u32 s_max_batch_time; | ||
78 | u32 s_min_batch_time; | ||
79 | struct block_device *journal_bdev; | ||
80 | #ifdef CONFIG_JBD2_DEBUG | ||
81 | struct timer_list turn_ro_timer; /* For turning read-only (crash simulation) */ | ||
82 | wait_queue_head_t ro_wait_queue; /* For people waiting for the fs to go read-only */ | ||
83 | #endif | ||
84 | #ifdef CONFIG_QUOTA | ||
85 | char *s_qf_names[MAXQUOTAS]; /* Names of quota files with journalled quota */ | ||
86 | int s_jquota_fmt; /* Format of quota to use */ | ||
87 | #endif | ||
88 | unsigned int s_want_extra_isize; /* New inodes should reserve # bytes */ | ||
89 | |||
90 | #ifdef EXTENTS_STATS | ||
91 | /* ext4 extents stats */ | ||
92 | unsigned long s_ext_min; | ||
93 | unsigned long s_ext_max; | ||
94 | unsigned long s_depth_max; | ||
95 | spinlock_t s_ext_stats_lock; | ||
96 | unsigned long s_ext_blocks; | ||
97 | unsigned long s_ext_extents; | ||
98 | #endif | ||
99 | |||
100 | /* for buddy allocator */ | ||
101 | struct ext4_group_info ***s_group_info; | ||
102 | struct inode *s_buddy_cache; | ||
103 | long s_blocks_reserved; | ||
104 | spinlock_t s_reserve_lock; | ||
105 | spinlock_t s_md_lock; | ||
106 | tid_t s_last_transaction; | ||
107 | unsigned short *s_mb_offsets; | ||
108 | unsigned int *s_mb_maxs; | ||
109 | |||
110 | /* tunables */ | ||
111 | unsigned long s_stripe; | ||
112 | unsigned int s_mb_stream_request; | ||
113 | unsigned int s_mb_max_to_scan; | ||
114 | unsigned int s_mb_min_to_scan; | ||
115 | unsigned int s_mb_stats; | ||
116 | unsigned int s_mb_order2_reqs; | ||
117 | unsigned int s_mb_group_prealloc; | ||
118 | /* where last allocation was done - for stream allocation */ | ||
119 | unsigned long s_mb_last_group; | ||
120 | unsigned long s_mb_last_start; | ||
121 | |||
122 | /* history to debug policy */ | ||
123 | struct ext4_mb_history *s_mb_history; | ||
124 | int s_mb_history_cur; | ||
125 | int s_mb_history_max; | ||
126 | int s_mb_history_num; | ||
127 | spinlock_t s_mb_history_lock; | ||
128 | int s_mb_history_filter; | ||
129 | |||
130 | /* stats for buddy allocator */ | ||
131 | spinlock_t s_mb_pa_lock; | ||
132 | atomic_t s_bal_reqs; /* number of reqs with len > 1 */ | ||
133 | atomic_t s_bal_success; /* we found long enough chunks */ | ||
134 | atomic_t s_bal_allocated; /* in blocks */ | ||
135 | atomic_t s_bal_ex_scanned; /* total extents scanned */ | ||
136 | atomic_t s_bal_goals; /* goal hits */ | ||
137 | atomic_t s_bal_breaks; /* too long searches */ | ||
138 | atomic_t s_bal_2orders; /* 2^order hits */ | ||
139 | spinlock_t s_bal_lock; | ||
140 | unsigned long s_mb_buddies_generated; | ||
141 | unsigned long long s_mb_generation_time; | ||
142 | atomic_t s_mb_lost_chunks; | ||
143 | atomic_t s_mb_preallocated; | ||
144 | atomic_t s_mb_discarded; | ||
145 | |||
146 | /* locality groups */ | ||
147 | struct ext4_locality_group *s_locality_groups; | ||
148 | |||
149 | /* for write statistics */ | ||
150 | unsigned long s_sectors_written_start; | ||
151 | u64 s_kbytes_written; | ||
152 | |||
153 | unsigned int s_log_groups_per_flex; | ||
154 | struct flex_groups *s_flex_groups; | ||
155 | }; | ||
156 | |||
157 | static inline spinlock_t * | ||
158 | sb_bgl_lock(struct ext4_sb_info *sbi, unsigned int block_group) | ||
159 | { | ||
160 | return bgl_lock_ptr(sbi->s_blockgroup_lock, block_group); | ||
161 | } | ||
162 | |||
163 | #endif /* _EXT4_SB */ | ||