2 * linux/include/linux/ext2_fs_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)
11 * linux/include/linux/minix_fs_sb.h
13 * Copyright (C) 1991, 1992 Linus Torvalds
16 #ifndef _LINUX_EXT2_FS_SB
17 #define _LINUX_EXT2_FS_SB
19 #include <linux/blockgroup_lock.h>
20 #include <linux/percpu_counter.h>
21 #include <linux/rbtree.h>
23 /* XXX Here for now... not interested in restructing headers JUST now */
25 /* data type for block offset of block group */
26 typedef int ext2_grpblk_t;
28 /* data type for filesystem-wide blocks number */
29 typedef unsigned long ext2_fsblk_t;
33 struct ext2_reserve_window {
34 ext2_fsblk_t _rsv_start; /* First byte reserved */
35 ext2_fsblk_t _rsv_end; /* Last byte reserved or 0 */
38 struct ext2_reserve_window_node {
39 struct rb_node rsv_node;
42 struct ext2_reserve_window rsv_window;
45 struct ext2_block_alloc_info {
46 /* information about reservation window */
47 struct ext2_reserve_window_node rsv_window_node;
49 * was i_next_alloc_block in ext2_inode_info
50 * is the logical (file-relative) number of the
51 * most-recently-allocated block in this file.
52 * We use this for detecting linearly ascending allocation requests.
54 __u32 last_alloc_logical_block;
56 * Was i_next_alloc_goal in ext2_inode_info
57 * is the *physical* companion to i_next_alloc_block.
58 * it the the physical block number of the block which was most-recentl
59 * allocated to this file. This give us the goal (target) for the next
60 * allocation when we detect linearly ascending requests.
62 ext2_fsblk_t last_alloc_physical_block;
65 #define rsv_start rsv_window._rsv_start
66 #define rsv_end rsv_window._rsv_end
69 * second extended-fs super-block data in memory
72 unsigned long s_frag_size; /* Size of a fragment in bytes */
73 unsigned long s_frags_per_block;/* Number of fragments per block */
74 unsigned long s_inodes_per_block;/* Number of inodes per block */
75 unsigned long s_frags_per_group;/* Number of fragments in a group */
76 unsigned long s_blocks_per_group;/* Number of blocks in a group */
77 unsigned long s_inodes_per_group;/* Number of inodes in a group */
78 unsigned long s_itb_per_group; /* Number of inode table blocks per group */
79 unsigned long s_gdb_count; /* Number of group descriptor blocks */
80 unsigned long s_desc_per_block; /* Number of group descriptors per block */
81 unsigned long s_groups_count; /* Number of groups in the fs */
82 unsigned long s_overhead_last; /* Last calculated overhead */
83 unsigned long s_blocks_last; /* Last seen block count */
84 struct buffer_head * s_sbh; /* Buffer containing the super block */
85 struct ext2_super_block * s_es; /* Pointer to the super block in the buffer */
86 struct buffer_head ** s_group_desc;
87 unsigned long s_mount_opt;
88 unsigned long s_sb_block;
91 unsigned short s_mount_state;
93 int s_addr_per_block_bits;
94 int s_desc_per_block_bits;
97 spinlock_t s_next_gen_lock;
98 u32 s_next_generation;
99 unsigned long s_dir_count;
101 struct percpu_counter s_freeblocks_counter;
102 struct percpu_counter s_freeinodes_counter;
103 struct percpu_counter s_dirs_counter;
104 struct blockgroup_lock *s_blockgroup_lock;
105 /* root of the per fs reservation window tree */
106 spinlock_t s_rsv_window_lock;
107 struct rb_root s_rsv_window_root;
108 struct ext2_reserve_window_node s_rsv_window_head;
111 static inline spinlock_t *
112 sb_bgl_lock(struct ext2_sb_info *sbi, unsigned int block_group)
114 return bgl_lock_ptr(sbi->s_blockgroup_lock, block_group);
117 #endif /* _LINUX_EXT2_FS_SB */