ext4_sb.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /*
  2. * ext4_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. #ifndef _EXT4_SB
  16. #define _EXT4_SB
  17. #ifdef __KERNEL__
  18. #include <linux/timer.h>
  19. #include <linux/wait.h>
  20. #include <linux/blockgroup_lock.h>
  21. #include <linux/percpu_counter.h>
  22. #endif
  23. #include <linux/rbtree.h>
  24. /*
  25. * fourth extended-fs super-block data in memory
  26. */
  27. struct ext4_sb_info {
  28. unsigned long s_desc_size; /* Size of a group descriptor in bytes */
  29. unsigned long s_inodes_per_block;/* Number of inodes per block */
  30. unsigned long s_blocks_per_group;/* Number of blocks in a group */
  31. unsigned long s_inodes_per_group;/* Number of inodes in a group */
  32. unsigned long s_itb_per_group; /* Number of inode table blocks per group */
  33. unsigned long s_gdb_count; /* Number of group descriptor blocks */
  34. unsigned long s_desc_per_block; /* Number of group descriptors per block */
  35. ext4_group_t s_groups_count; /* Number of groups in the fs */
  36. unsigned long s_overhead_last; /* Last calculated overhead */
  37. unsigned long s_blocks_last; /* Last seen block count */
  38. loff_t s_bitmap_maxbytes; /* max bytes for bitmap files */
  39. struct buffer_head * s_sbh; /* Buffer containing the super block */
  40. struct ext4_super_block *s_es; /* Pointer to the super block in the buffer */
  41. struct buffer_head **s_group_desc;
  42. unsigned long s_mount_opt;
  43. ext4_fsblk_t s_sb_block;
  44. uid_t s_resuid;
  45. gid_t s_resgid;
  46. unsigned short s_mount_state;
  47. unsigned short s_pad;
  48. int s_addr_per_block_bits;
  49. int s_desc_per_block_bits;
  50. int s_inode_size;
  51. int s_first_ino;
  52. unsigned int s_inode_readahead_blks;
  53. spinlock_t s_next_gen_lock;
  54. u32 s_next_generation;
  55. u32 s_hash_seed[4];
  56. int s_def_hash_version;
  57. struct percpu_counter s_freeblocks_counter;
  58. struct percpu_counter s_freeinodes_counter;
  59. struct percpu_counter s_dirs_counter;
  60. struct percpu_counter s_dirtyblocks_counter;
  61. struct blockgroup_lock s_blockgroup_lock;
  62. struct proc_dir_entry *s_proc;
  63. /* root of the per fs reservation window tree */
  64. spinlock_t s_rsv_window_lock;
  65. struct rb_root s_rsv_window_root;
  66. /* Journaling */
  67. struct inode *s_journal_inode;
  68. struct journal_s *s_journal;
  69. struct list_head s_orphan;
  70. unsigned long s_commit_interval;
  71. struct block_device *journal_bdev;
  72. #ifdef CONFIG_JBD2_DEBUG
  73. struct timer_list turn_ro_timer; /* For turning read-only (crash simulation) */
  74. wait_queue_head_t ro_wait_queue; /* For people waiting for the fs to go read-only */
  75. #endif
  76. #ifdef CONFIG_QUOTA
  77. char *s_qf_names[MAXQUOTAS]; /* Names of quota files with journalled quota */
  78. int s_jquota_fmt; /* Format of quota to use */
  79. #endif
  80. unsigned int s_want_extra_isize; /* New inodes should reserve # bytes */
  81. #ifdef EXTENTS_STATS
  82. /* ext4 extents stats */
  83. unsigned long s_ext_min;
  84. unsigned long s_ext_max;
  85. unsigned long s_depth_max;
  86. spinlock_t s_ext_stats_lock;
  87. unsigned long s_ext_blocks;
  88. unsigned long s_ext_extents;
  89. #endif
  90. /* for buddy allocator */
  91. struct ext4_group_info ***s_group_info;
  92. struct inode *s_buddy_cache;
  93. long s_blocks_reserved;
  94. spinlock_t s_reserve_lock;
  95. spinlock_t s_md_lock;
  96. tid_t s_last_transaction;
  97. unsigned short *s_mb_offsets, *s_mb_maxs;
  98. /* tunables */
  99. unsigned long s_stripe;
  100. unsigned int s_mb_stream_request;
  101. unsigned int s_mb_max_to_scan;
  102. unsigned int s_mb_min_to_scan;
  103. unsigned int s_mb_stats;
  104. unsigned int s_mb_order2_reqs;
  105. unsigned int s_mb_group_prealloc;
  106. /* where last allocation was done - for stream allocation */
  107. unsigned long s_mb_last_group;
  108. unsigned long s_mb_last_start;
  109. /* history to debug policy */
  110. struct ext4_mb_history *s_mb_history;
  111. int s_mb_history_cur;
  112. int s_mb_history_max;
  113. int s_mb_history_num;
  114. spinlock_t s_mb_history_lock;
  115. int s_mb_history_filter;
  116. /* stats for buddy allocator */
  117. spinlock_t s_mb_pa_lock;
  118. atomic_t s_bal_reqs; /* number of reqs with len > 1 */
  119. atomic_t s_bal_success; /* we found long enough chunks */
  120. atomic_t s_bal_allocated; /* in blocks */
  121. atomic_t s_bal_ex_scanned; /* total extents scanned */
  122. atomic_t s_bal_goals; /* goal hits */
  123. atomic_t s_bal_breaks; /* too long searches */
  124. atomic_t s_bal_2orders; /* 2^order hits */
  125. spinlock_t s_bal_lock;
  126. unsigned long s_mb_buddies_generated;
  127. unsigned long long s_mb_generation_time;
  128. atomic_t s_mb_lost_chunks;
  129. atomic_t s_mb_preallocated;
  130. atomic_t s_mb_discarded;
  131. /* locality groups */
  132. struct ext4_locality_group *s_locality_groups;
  133. unsigned int s_log_groups_per_flex;
  134. struct flex_groups *s_flex_groups;
  135. };
  136. #endif /* _EXT4_SB */