ext4: allocate ->s_blockgroup_lock separately
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / fs / ext4 / ext4_sb.h
blob4e4d9cc3f40d855a0bcb3b98edb0c4ac8963cc62
1 /*
2 * ext4_sb.h
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)
9 * from
11 * linux/include/linux/minix_fs_sb.h
13 * Copyright (C) 1991, 1992 Linus Torvalds
16 #ifndef _EXT4_SB
17 #define _EXT4_SB
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>
28 * fourth extended-fs super-block data in memory
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;
68 /* Journaling */
69 struct inode *s_journal_inode;
70 struct journal_s *s_journal;
71 struct list_head s_orphan;
72 unsigned long s_commit_interval;
73 u32 s_max_batch_time;
74 u32 s_min_batch_time;
75 struct block_device *journal_bdev;
76 #ifdef CONFIG_JBD2_DEBUG
77 struct timer_list turn_ro_timer; /* For turning read-only (crash simulation) */
78 wait_queue_head_t ro_wait_queue; /* For people waiting for the fs to go read-only */
79 #endif
80 #ifdef CONFIG_QUOTA
81 char *s_qf_names[MAXQUOTAS]; /* Names of quota files with journalled quota */
82 int s_jquota_fmt; /* Format of quota to use */
83 #endif
84 unsigned int s_want_extra_isize; /* New inodes should reserve # bytes */
86 #ifdef EXTENTS_STATS
87 /* ext4 extents stats */
88 unsigned long s_ext_min;
89 unsigned long s_ext_max;
90 unsigned long s_depth_max;
91 spinlock_t s_ext_stats_lock;
92 unsigned long s_ext_blocks;
93 unsigned long s_ext_extents;
94 #endif
96 /* for buddy allocator */
97 struct ext4_group_info ***s_group_info;
98 struct inode *s_buddy_cache;
99 long s_blocks_reserved;
100 spinlock_t s_reserve_lock;
101 spinlock_t s_md_lock;
102 tid_t s_last_transaction;
103 unsigned short *s_mb_offsets;
104 unsigned int *s_mb_maxs;
106 /* tunables */
107 unsigned long s_stripe;
108 unsigned int s_mb_stream_request;
109 unsigned int s_mb_max_to_scan;
110 unsigned int s_mb_min_to_scan;
111 unsigned int s_mb_stats;
112 unsigned int s_mb_order2_reqs;
113 unsigned int s_mb_group_prealloc;
114 /* where last allocation was done - for stream allocation */
115 unsigned long s_mb_last_group;
116 unsigned long s_mb_last_start;
118 /* history to debug policy */
119 struct ext4_mb_history *s_mb_history;
120 int s_mb_history_cur;
121 int s_mb_history_max;
122 int s_mb_history_num;
123 spinlock_t s_mb_history_lock;
124 int s_mb_history_filter;
126 /* stats for buddy allocator */
127 spinlock_t s_mb_pa_lock;
128 atomic_t s_bal_reqs; /* number of reqs with len > 1 */
129 atomic_t s_bal_success; /* we found long enough chunks */
130 atomic_t s_bal_allocated; /* in blocks */
131 atomic_t s_bal_ex_scanned; /* total extents scanned */
132 atomic_t s_bal_goals; /* goal hits */
133 atomic_t s_bal_breaks; /* too long searches */
134 atomic_t s_bal_2orders; /* 2^order hits */
135 spinlock_t s_bal_lock;
136 unsigned long s_mb_buddies_generated;
137 unsigned long long s_mb_generation_time;
138 atomic_t s_mb_lost_chunks;
139 atomic_t s_mb_preallocated;
140 atomic_t s_mb_discarded;
142 /* locality groups */
143 struct ext4_locality_group *s_locality_groups;
145 unsigned int s_log_groups_per_flex;
146 struct flex_groups *s_flex_groups;
149 static inline spinlock_t *
150 sb_bgl_lock(struct ext4_sb_info *sbi, unsigned int block_group)
152 return bgl_lock_ptr(sbi->s_blockgroup_lock, block_group);
155 #endif /* _EXT4_SB */