ext4: move /proc setup and teardown out of mballoc.c
[GitHub/LineageOS/android_kernel_samsung_universal7580.git] / fs / ext4 / ext4_sb.h
CommitLineData
ac27a0ec 1/*
3dcf5451 2 * ext4_sb.h
ac27a0ec
DK
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
3dcf5451
CH
16#ifndef _EXT4_SB
17#define _EXT4_SB
ac27a0ec
DK
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/*
8a35694e 28 * fourth extended-fs super-block data in memory
ac27a0ec 29 */
617ba13b 30struct ext4_sb_info {
0d1ee42f 31 unsigned long s_desc_size; /* Size of a group descriptor in bytes */
ac27a0ec 32 unsigned long s_inodes_per_block;/* Number of inodes per block */
ac27a0ec
DK
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 */
fd2d4291 38 ext4_group_t s_groups_count; /* Number of groups in the fs */
5e70030d
BP
39 unsigned long s_overhead_last; /* Last calculated overhead */
40 unsigned long s_blocks_last; /* Last seen block count */
e2b46574 41 loff_t s_bitmap_maxbytes; /* max bytes for bitmap files */
ac27a0ec 42 struct buffer_head * s_sbh; /* Buffer containing the super block */
af5bc92d
TT
43 struct ext4_super_block *s_es; /* Pointer to the super block in the buffer */
44 struct buffer_head **s_group_desc;
ac27a0ec 45 unsigned long s_mount_opt;
d9c9bef1 46 ext4_fsblk_t s_sb_block;
ac27a0ec
DK
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 spinlock_t s_next_gen_lock;
56 u32 s_next_generation;
57 u32 s_hash_seed[4];
58 int s_def_hash_version;
59 struct percpu_counter s_freeblocks_counter;
60 struct percpu_counter s_freeinodes_counter;
61 struct percpu_counter s_dirs_counter;
6bc6e63f 62 struct percpu_counter s_dirtyblocks_counter;
ac27a0ec 63 struct blockgroup_lock s_blockgroup_lock;
9f6200bb 64 struct proc_dir_entry *s_proc;
ac27a0ec
DK
65
66 /* root of the per fs reservation window tree */
67 spinlock_t s_rsv_window_lock;
68 struct rb_root s_rsv_window_root;
617ba13b 69 struct ext4_reserve_window_node s_rsv_window_head;
ac27a0ec
DK
70
71 /* Journaling */
af5bc92d
TT
72 struct inode *s_journal_inode;
73 struct journal_s *s_journal;
ac27a0ec
DK
74 struct list_head s_orphan;
75 unsigned long s_commit_interval;
76 struct block_device *journal_bdev;
e23291b9 77#ifdef CONFIG_JBD2_DEBUG
ac27a0ec
DK
78 struct timer_list turn_ro_timer; /* For turning read-only (crash simulation) */
79 wait_queue_head_t ro_wait_queue; /* For people waiting for the fs to go read-only */
80#endif
81#ifdef CONFIG_QUOTA
82 char *s_qf_names[MAXQUOTAS]; /* Names of quota files with journalled quota */
83 int s_jquota_fmt; /* Format of quota to use */
84#endif
ef7f3835 85 unsigned int s_want_extra_isize; /* New inodes should reserve # bytes */
a86c6181
AT
86
87#ifdef EXTENTS_STATS
88 /* ext4 extents stats */
89 unsigned long s_ext_min;
90 unsigned long s_ext_max;
91 unsigned long s_depth_max;
92 spinlock_t s_ext_stats_lock;
93 unsigned long s_ext_blocks;
94 unsigned long s_ext_extents;
95#endif
c9de560d
AT
96
97 /* for buddy allocator */
98 struct ext4_group_info ***s_group_info;
99 struct inode *s_buddy_cache;
100 long s_blocks_reserved;
101 spinlock_t s_reserve_lock;
102 struct list_head s_active_transaction;
103 struct list_head s_closed_transaction;
104 struct list_head s_committed_transaction;
105 spinlock_t s_md_lock;
106 tid_t s_last_transaction;
107 unsigned short *s_mb_offsets, *s_mb_maxs;
108
109 /* tunables */
110 unsigned long s_stripe;
111 unsigned long s_mb_stream_request;
112 unsigned long s_mb_max_to_scan;
113 unsigned long s_mb_min_to_scan;
114 unsigned long s_mb_stats;
115 unsigned long s_mb_order2_reqs;
116 unsigned long s_mb_group_prealloc;
117 /* where last allocation was done - for stream allocation */
118 unsigned long s_mb_last_group;
119 unsigned long s_mb_last_start;
120
121 /* history to debug policy */
122 struct ext4_mb_history *s_mb_history;
123 int s_mb_history_cur;
124 int s_mb_history_max;
125 int s_mb_history_num;
c9de560d
AT
126 spinlock_t s_mb_history_lock;
127 int s_mb_history_filter;
128
129 /* stats for buddy allocator */
130 spinlock_t s_mb_pa_lock;
131 atomic_t s_bal_reqs; /* number of reqs with len > 1 */
132 atomic_t s_bal_success; /* we found long enough chunks */
133 atomic_t s_bal_allocated; /* in blocks */
134 atomic_t s_bal_ex_scanned; /* total extents scanned */
135 atomic_t s_bal_goals; /* goal hits */
136 atomic_t s_bal_breaks; /* too long searches */
137 atomic_t s_bal_2orders; /* 2^order hits */
138 spinlock_t s_bal_lock;
139 unsigned long s_mb_buddies_generated;
140 unsigned long long s_mb_generation_time;
141 atomic_t s_mb_lost_chunks;
142 atomic_t s_mb_preallocated;
143 atomic_t s_mb_discarded;
144
145 /* locality groups */
146 struct ext4_locality_group *s_locality_groups;
772cb7c8
JS
147
148 unsigned int s_log_groups_per_flex;
149 struct flex_groups *s_flex_groups;
ac27a0ec
DK
150};
151
3dcf5451 152#endif /* _EXT4_SB */