ext4_sb.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. int s_hash_unsigned; /* 3 if hash should be signed, 0 if not */
  58. struct percpu_counter s_freeblocks_counter;
  59. struct percpu_counter s_freeinodes_counter;
  60. struct percpu_counter s_dirs_counter;
  61. struct percpu_counter s_dirtyblocks_counter;
  62. struct blockgroup_lock *s_blockgroup_lock;
  63. struct proc_dir_entry *s_proc;
  64. struct kobject s_kobj;
  65. struct completion s_kobj_unregister;
  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. u32 s_max_batch_time;
  72. u32 s_min_batch_time;
  73. struct block_device *journal_bdev;
  74. #ifdef CONFIG_JBD2_DEBUG
  75. struct timer_list turn_ro_timer; /* For turning read-only (crash simulation) */
  76. wait_queue_head_t ro_wait_queue; /* For people waiting for the fs to go read-only */
  77. #endif
  78. #ifdef CONFIG_QUOTA
  79. char *s_qf_names[MAXQUOTAS]; /* Names of quota files with journalled quota */
  80. int s_jquota_fmt; /* Format of quota to use */
  81. #endif
  82. unsigned int s_want_extra_isize; /* New inodes should reserve # bytes */
  83. #ifdef EXTENTS_STATS
  84. /* ext4 extents stats */
  85. unsigned long s_ext_min;
  86. unsigned long s_ext_max;
  87. unsigned long s_depth_max;
  88. spinlock_t s_ext_stats_lock;
  89. unsigned long s_ext_blocks;
  90. unsigned long s_ext_extents;
  91. #endif
  92. /* for buddy allocator */
  93. struct ext4_group_info ***s_group_info;
  94. struct inode *s_buddy_cache;
  95. long s_blocks_reserved;
  96. spinlock_t s_reserve_lock;
  97. spinlock_t s_md_lock;
  98. tid_t s_last_transaction;
  99. unsigned short *s_mb_offsets;
  100. unsigned int *s_mb_maxs;
  101. /* tunables */
  102. unsigned long s_stripe;
  103. unsigned int s_mb_stream_request;
  104. unsigned int s_mb_max_to_scan;
  105. unsigned int s_mb_min_to_scan;
  106. unsigned int s_mb_stats;
  107. unsigned int s_mb_order2_reqs;
  108. unsigned int s_mb_group_prealloc;
  109. /* where last allocation was done - for stream allocation */
  110. unsigned long s_mb_last_group;
  111. unsigned long s_mb_last_start;
  112. /* history to debug policy */
  113. struct ext4_mb_history *s_mb_history;
  114. int s_mb_history_cur;
  115. int s_mb_history_max;
  116. int s_mb_history_num;
  117. spinlock_t s_mb_history_lock;
  118. int s_mb_history_filter;
  119. /* stats for buddy allocator */
  120. spinlock_t s_mb_pa_lock;
  121. atomic_t s_bal_reqs; /* number of reqs with len > 1 */
  122. atomic_t s_bal_success; /* we found long enough chunks */
  123. atomic_t s_bal_allocated; /* in blocks */
  124. atomic_t s_bal_ex_scanned; /* total extents scanned */
  125. atomic_t s_bal_goals; /* goal hits */
  126. atomic_t s_bal_breaks; /* too long searches */
  127. atomic_t s_bal_2orders; /* 2^order hits */
  128. spinlock_t s_bal_lock;
  129. unsigned long s_mb_buddies_generated;
  130. unsigned long long s_mb_generation_time;
  131. atomic_t s_mb_lost_chunks;
  132. atomic_t s_mb_preallocated;
  133. atomic_t s_mb_discarded;
  134. /* locality groups */
  135. struct ext4_locality_group *s_locality_groups;
  136. /* for write statistics */
  137. unsigned long s_sectors_written_start;
  138. u64 s_kbytes_written;
  139. unsigned int s_log_groups_per_flex;
  140. struct flex_groups *s_flex_groups;
  141. };
  142. static inline spinlock_t *
  143. sb_bgl_lock(struct ext4_sb_info *sbi, unsigned int block_group)
  144. {
  145. return bgl_lock_ptr(sbi->s_blockgroup_lock, block_group);
  146. }
  147. #endif /* _EXT4_SB */