blob: 258088ab3c6bab4e3bad8ce5b5c987532dc9a90d [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/include/linux/ext3_fs_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 _LINUX_EXT3_FS_SB
17#define _LINUX_EXT3_FS_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 * third extended-fs super-block data in memory
29 */
30struct ext3_sb_info {
31 unsigned long s_frag_size; /* Size of a fragment in bytes */
32 unsigned long s_frags_per_block;/* Number of fragments per block */
33 unsigned long s_inodes_per_block;/* Number of inodes per block */
34 unsigned long s_frags_per_group;/* Number of fragments in a group */
35 unsigned long s_blocks_per_group;/* Number of blocks in a group */
36 unsigned long s_inodes_per_group;/* Number of inodes in a group */
37 unsigned long s_itb_per_group; /* Number of inode table blocks per group */
38 unsigned long s_gdb_count; /* Number of group descriptor blocks */
39 unsigned long s_desc_per_block; /* Number of group descriptors per block */
40 unsigned long s_groups_count; /* Number of groups in the fs */
Badari Pulavartya71ce8c2007-07-15 23:41:59 -070041 unsigned long s_overhead_last; /* Last calculated overhead */
42 unsigned long s_blocks_last; /* Last seen block count */
Linus Torvalds1da177e2005-04-16 15:20:36 -070043 struct buffer_head * s_sbh; /* Buffer containing the super block */
44 struct ext3_super_block * s_es; /* Pointer to the super block in the buffer */
45 struct buffer_head ** s_group_desc;
46 unsigned long s_mount_opt;
Miklos Szeredi571beed2007-10-16 23:26:26 -070047 ext3_fsblk_t s_sb_block;
Linus Torvalds1da177e2005-04-16 15:20:36 -070048 uid_t s_resuid;
49 gid_t s_resgid;
50 unsigned short s_mount_state;
51 unsigned short s_pad;
52 int s_addr_per_block_bits;
53 int s_desc_per_block_bits;
54 int s_inode_size;
55 int s_first_ino;
56 spinlock_t s_next_gen_lock;
57 u32 s_next_generation;
58 u32 s_hash_seed[4];
59 int s_def_hash_version;
Theodore Ts'o5e1f8c92008-10-28 13:21:55 -040060 int s_hash_unsigned; /* 3 if hash should be signed, 0 if not */
Linus Torvalds1da177e2005-04-16 15:20:36 -070061 struct percpu_counter s_freeblocks_counter;
62 struct percpu_counter s_freeinodes_counter;
63 struct percpu_counter s_dirs_counter;
Pekka Enberg5df096d2009-01-07 18:07:25 -080064 struct blockgroup_lock *s_blockgroup_lock;
Linus Torvalds1da177e2005-04-16 15:20:36 -070065
66 /* root of the per fs reservation window tree */
67 spinlock_t s_rsv_window_lock;
68 struct rb_root s_rsv_window_root;
69 struct ext3_reserve_window_node s_rsv_window_head;
70
71 /* Journaling */
72 struct inode * s_journal_inode;
73 struct journal_s * s_journal;
74 struct list_head s_orphan;
Eric Sandeenb8a052d2009-12-14 13:00:30 -060075 struct mutex s_orphan_lock;
Eric Sandeen96d2a492009-12-14 13:01:05 -060076 struct mutex s_resize_lock;
Linus Torvalds1da177e2005-04-16 15:20:36 -070077 unsigned long s_commit_interval;
78 struct block_device *journal_bdev;
79#ifdef CONFIG_JBD_DEBUG
80 struct timer_list turn_ro_timer; /* For turning read-only (crash simulation) */
81 wait_queue_head_t ro_wait_queue; /* For people waiting for the fs to go read-only */
82#endif
83#ifdef CONFIG_QUOTA
84 char *s_qf_names[MAXQUOTAS]; /* Names of quota files with journalled quota */
85 int s_jquota_fmt; /* Format of quota to use */
86#endif
87};
88
Pekka Enbergc644f0e2009-01-04 12:00:48 -080089static inline spinlock_t *
90sb_bgl_lock(struct ext3_sb_info *sbi, unsigned int block_group)
91{
Pekka Enberg5df096d2009-01-07 18:07:25 -080092 return bgl_lock_ptr(sbi->s_blockgroup_lock, block_group);
Pekka Enbergc644f0e2009-01-04 12:00:48 -080093}
94
Linus Torvalds1da177e2005-04-16 15:20:36 -070095#endif /* _LINUX_EXT3_FS_SB */