2006-10-11 04:20:50 -04:00
|
|
|
/*
|
2008-04-29 18:13:32 -04:00
|
|
|
* ext4_sb.h
|
2006-10-11 04:20:50 -04:00
|
|
|
*
|
|
|
|
* Copyright (C) 1992, 1993, 1994, 1995
|
|
|
|
* Remy Card (card@masi.ibp.fr)
|
|
|
|
* Laboratoire MASI - Institut Blaise Pascal
|
|
|
|
* Universite Pierre et Marie Curie (Paris VI)
|
|
|
|
*
|
|
|
|
* from
|
|
|
|
*
|
|
|
|
* linux/include/linux/minix_fs_sb.h
|
|
|
|
*
|
|
|
|
* Copyright (C) 1991, 1992 Linus Torvalds
|
|
|
|
*/
|
|
|
|
|
2008-04-29 18:13:32 -04:00
|
|
|
#ifndef _EXT4_SB
|
|
|
|
#define _EXT4_SB
|
2006-10-11 04:20:50 -04:00
|
|
|
|
|
|
|
#ifdef __KERNEL__
|
|
|
|
#include <linux/timer.h>
|
|
|
|
#include <linux/wait.h>
|
|
|
|
#include <linux/blockgroup_lock.h>
|
|
|
|
#include <linux/percpu_counter.h>
|
|
|
|
#endif
|
|
|
|
#include <linux/rbtree.h>
|
|
|
|
|
|
|
|
/*
|
2008-07-11 19:27:31 -04:00
|
|
|
* fourth extended-fs super-block data in memory
|
2006-10-11 04:20:50 -04:00
|
|
|
*/
|
2006-10-11 04:20:53 -04:00
|
|
|
struct ext4_sb_info {
|
2006-10-11 04:21:14 -04:00
|
|
|
unsigned long s_desc_size; /* Size of a group descriptor in bytes */
|
2006-10-11 04:20:50 -04:00
|
|
|
unsigned long s_inodes_per_block;/* Number of inodes per block */
|
|
|
|
unsigned long s_blocks_per_group;/* Number of blocks in a group */
|
|
|
|
unsigned long s_inodes_per_group;/* Number of inodes in a group */
|
|
|
|
unsigned long s_itb_per_group; /* Number of inode table blocks per group */
|
|
|
|
unsigned long s_gdb_count; /* Number of group descriptor blocks */
|
|
|
|
unsigned long s_desc_per_block; /* Number of group descriptors per block */
|
2008-01-28 23:58:27 -05:00
|
|
|
ext4_group_t s_groups_count; /* Number of groups in the fs */
|
2007-07-16 02:42:00 -04:00
|
|
|
unsigned long s_overhead_last; /* Last calculated overhead */
|
|
|
|
unsigned long s_blocks_last; /* Last seen block count */
|
2008-01-28 23:58:27 -05:00
|
|
|
loff_t s_bitmap_maxbytes; /* max bytes for bitmap files */
|
2006-10-11 04:20:50 -04:00
|
|
|
struct buffer_head * s_sbh; /* Buffer containing the super block */
|
2008-09-08 22:25:24 -04:00
|
|
|
struct ext4_super_block *s_es; /* Pointer to the super block in the buffer */
|
|
|
|
struct buffer_head **s_group_desc;
|
2006-10-11 04:20:50 -04:00
|
|
|
unsigned long s_mount_opt;
|
2007-10-17 02:26:27 -04:00
|
|
|
ext4_fsblk_t s_sb_block;
|
2006-10-11 04:20:50 -04:00
|
|
|
uid_t s_resuid;
|
|
|
|
gid_t s_resgid;
|
|
|
|
unsigned short s_mount_state;
|
|
|
|
unsigned short s_pad;
|
|
|
|
int s_addr_per_block_bits;
|
|
|
|
int s_desc_per_block_bits;
|
|
|
|
int s_inode_size;
|
|
|
|
int s_first_ino;
|
2008-10-09 23:53:47 -04:00
|
|
|
unsigned int s_inode_readahead_blks;
|
2006-10-11 04:20:50 -04:00
|
|
|
spinlock_t s_next_gen_lock;
|
|
|
|
u32 s_next_generation;
|
|
|
|
u32 s_hash_seed[4];
|
|
|
|
int s_def_hash_version;
|
2008-10-28 13:21:44 -04:00
|
|
|
int s_hash_unsigned; /* 3 if hash should be signed, 0 if not */
|
2006-10-11 04:20:50 -04:00
|
|
|
struct percpu_counter s_freeblocks_counter;
|
|
|
|
struct percpu_counter s_freeinodes_counter;
|
|
|
|
struct percpu_counter s_dirs_counter;
|
2008-10-10 09:39:00 -04:00
|
|
|
struct percpu_counter s_dirtyblocks_counter;
|
2009-02-15 18:07:52 -05:00
|
|
|
struct blockgroup_lock *s_blockgroup_lock;
|
2008-09-23 09:18:24 -04:00
|
|
|
struct proc_dir_entry *s_proc;
|
2009-03-31 09:10:09 -04:00
|
|
|
struct kobject s_kobj;
|
|
|
|
struct completion s_kobj_unregister;
|
2006-10-11 04:20:50 -04:00
|
|
|
|
|
|
|
/* Journaling */
|
2008-09-08 22:25:24 -04:00
|
|
|
struct inode *s_journal_inode;
|
|
|
|
struct journal_s *s_journal;
|
2006-10-11 04:20:50 -04:00
|
|
|
struct list_head s_orphan;
|
|
|
|
unsigned long s_commit_interval;
|
2009-01-03 20:27:38 -05:00
|
|
|
u32 s_max_batch_time;
|
|
|
|
u32 s_min_batch_time;
|
2006-10-11 04:20:50 -04:00
|
|
|
struct block_device *journal_bdev;
|
2007-07-18 08:57:06 -04:00
|
|
|
#ifdef CONFIG_JBD2_DEBUG
|
2006-10-11 04:20:50 -04:00
|
|
|
struct timer_list turn_ro_timer; /* For turning read-only (crash simulation) */
|
|
|
|
wait_queue_head_t ro_wait_queue; /* For people waiting for the fs to go read-only */
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_QUOTA
|
|
|
|
char *s_qf_names[MAXQUOTAS]; /* Names of quota files with journalled quota */
|
|
|
|
int s_jquota_fmt; /* Format of quota to use */
|
|
|
|
#endif
|
2007-07-18 09:15:20 -04:00
|
|
|
unsigned int s_want_extra_isize; /* New inodes should reserve # bytes */
|
2006-10-11 04:21:03 -04:00
|
|
|
|
|
|
|
#ifdef EXTENTS_STATS
|
|
|
|
/* ext4 extents stats */
|
|
|
|
unsigned long s_ext_min;
|
|
|
|
unsigned long s_ext_max;
|
|
|
|
unsigned long s_depth_max;
|
|
|
|
spinlock_t s_ext_stats_lock;
|
|
|
|
unsigned long s_ext_blocks;
|
|
|
|
unsigned long s_ext_extents;
|
|
|
|
#endif
|
2008-01-29 00:19:52 -05:00
|
|
|
|
|
|
|
/* for buddy allocator */
|
|
|
|
struct ext4_group_info ***s_group_info;
|
|
|
|
struct inode *s_buddy_cache;
|
|
|
|
long s_blocks_reserved;
|
|
|
|
spinlock_t s_reserve_lock;
|
|
|
|
spinlock_t s_md_lock;
|
|
|
|
tid_t s_last_transaction;
|
2008-12-17 00:48:39 -05:00
|
|
|
unsigned short *s_mb_offsets;
|
|
|
|
unsigned int *s_mb_maxs;
|
2008-01-29 00:19:52 -05:00
|
|
|
|
|
|
|
/* tunables */
|
|
|
|
unsigned long s_stripe;
|
2008-09-23 18:07:35 -04:00
|
|
|
unsigned int s_mb_stream_request;
|
|
|
|
unsigned int s_mb_max_to_scan;
|
|
|
|
unsigned int s_mb_min_to_scan;
|
|
|
|
unsigned int s_mb_stats;
|
|
|
|
unsigned int s_mb_order2_reqs;
|
|
|
|
unsigned int s_mb_group_prealloc;
|
2008-01-29 00:19:52 -05:00
|
|
|
/* where last allocation was done - for stream allocation */
|
|
|
|
unsigned long s_mb_last_group;
|
|
|
|
unsigned long s_mb_last_start;
|
|
|
|
|
|
|
|
/* history to debug policy */
|
|
|
|
struct ext4_mb_history *s_mb_history;
|
|
|
|
int s_mb_history_cur;
|
|
|
|
int s_mb_history_max;
|
|
|
|
int s_mb_history_num;
|
|
|
|
spinlock_t s_mb_history_lock;
|
|
|
|
int s_mb_history_filter;
|
|
|
|
|
|
|
|
/* stats for buddy allocator */
|
|
|
|
spinlock_t s_mb_pa_lock;
|
|
|
|
atomic_t s_bal_reqs; /* number of reqs with len > 1 */
|
|
|
|
atomic_t s_bal_success; /* we found long enough chunks */
|
|
|
|
atomic_t s_bal_allocated; /* in blocks */
|
|
|
|
atomic_t s_bal_ex_scanned; /* total extents scanned */
|
|
|
|
atomic_t s_bal_goals; /* goal hits */
|
|
|
|
atomic_t s_bal_breaks; /* too long searches */
|
|
|
|
atomic_t s_bal_2orders; /* 2^order hits */
|
|
|
|
spinlock_t s_bal_lock;
|
|
|
|
unsigned long s_mb_buddies_generated;
|
|
|
|
unsigned long long s_mb_generation_time;
|
|
|
|
atomic_t s_mb_lost_chunks;
|
|
|
|
atomic_t s_mb_preallocated;
|
|
|
|
atomic_t s_mb_discarded;
|
|
|
|
|
|
|
|
/* locality groups */
|
|
|
|
struct ext4_locality_group *s_locality_groups;
|
2008-07-11 19:27:31 -04:00
|
|
|
|
2009-02-28 19:39:58 -05:00
|
|
|
/* for write statistics */
|
|
|
|
unsigned long s_sectors_written_start;
|
|
|
|
u64 s_kbytes_written;
|
|
|
|
|
2008-07-11 19:27:31 -04:00
|
|
|
unsigned int s_log_groups_per_flex;
|
|
|
|
struct flex_groups *s_flex_groups;
|
2006-10-11 04:20:50 -04:00
|
|
|
};
|
|
|
|
|
2009-01-04 15:00:48 -05:00
|
|
|
static inline spinlock_t *
|
|
|
|
sb_bgl_lock(struct ext4_sb_info *sbi, unsigned int block_group)
|
|
|
|
{
|
2009-02-15 18:07:52 -05:00
|
|
|
return bgl_lock_ptr(sbi->s_blockgroup_lock, block_group);
|
2009-01-04 15:00:48 -05:00
|
|
|
}
|
|
|
|
|
2008-04-29 18:13:32 -04:00
|
|
|
#endif /* _EXT4_SB */
|