Commit 83fd9c7f65634ac440a6b9b7a63ba562f213ac60

Authored by Goldwyn Rodrigues
Committed by Joel Becker
1 parent 95fa859a26

Reorganize data elements to reduce struct sizes

Thanks for the comments. I have incorportated them all.

CONFIG_OCFS2_FS_STATS is enabled and CONFIG_DEBUG_LOCK_ALLOC is disabled.
Statistics now look like -
ocfs2_write_ctxt: 2144 - 2136 = 8
ocfs2_inode_info: 1960 - 1848 = 112
ocfs2_journal: 168 - 160 = 8
ocfs2_lock_res: 336 - 304 = 32
ocfs2_refcount_tree: 512 - 472 = 40

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.de>
Signed-off-by: Joel Becker <joel.becker@oracle.com>

Showing 5 changed files with 24 additions and 19 deletions Side-by-side Diff

... ... @@ -883,8 +883,8 @@
883 883 * out in so that future reads from that region will get
884 884 * zero's.
885 885 */
886   - struct page *w_pages[OCFS2_MAX_CTXT_PAGES];
887 886 unsigned int w_num_pages;
  887 + struct page *w_pages[OCFS2_MAX_CTXT_PAGES];
888 888 struct page *w_target_page;
889 889  
890 890 /*
... ... @@ -46,26 +46,23 @@
46 46 /* These fields are protected by ip_lock */
47 47 spinlock_t ip_lock;
48 48 u32 ip_open_count;
49   - u32 ip_clusters;
50 49 struct list_head ip_io_markers;
  50 + u32 ip_clusters;
51 51  
  52 + u16 ip_dyn_features;
52 53 struct mutex ip_io_mutex;
53   -
54 54 u32 ip_flags; /* see below */
55 55 u32 ip_attr; /* inode attributes */
56   - u16 ip_dyn_features;
57 56  
58 57 /* protected by recovery_lock. */
59 58 struct inode *ip_next_orphan;
60 59  
61   - u32 ip_dir_start_lookup;
62   -
63 60 struct ocfs2_caching_info ip_metadata_cache;
64   -
65 61 struct ocfs2_extent_map ip_extent_map;
66   -
67 62 struct inode vfs_inode;
68 63 struct jbd2_inode ip_jinode;
  64 +
  65 + u32 ip_dir_start_lookup;
69 66  
70 67 /* Only valid if the inode is the dir. */
71 68 u32 ip_last_used_slot;
... ... @@ -67,11 +67,12 @@
67 67 struct buffer_head *j_bh; /* Journal disk inode block */
68 68 atomic_t j_num_trans; /* Number of transactions
69 69 * currently in the system. */
  70 + spinlock_t j_lock;
70 71 unsigned long j_trans_id;
71 72 struct rw_semaphore j_trans_barrier;
72 73 wait_queue_head_t j_checkpointed;
73 74  
74   - spinlock_t j_lock;
  75 + /* both fields protected by j_lock*/
75 76 struct list_head j_la_cleanups;
76 77 struct work_struct j_recovery_work;
77 78 };
... ... @@ -150,25 +150,32 @@
150 150 struct ocfs2_lock_res {
151 151 void *l_priv;
152 152 struct ocfs2_lock_res_ops *l_ops;
153   - spinlock_t l_lock;
154 153  
  154 +
155 155 struct list_head l_blocked_list;
156 156 struct list_head l_mask_waiters;
157 157  
158   - enum ocfs2_lock_type l_type;
159 158 unsigned long l_flags;
160 159 char l_name[OCFS2_LOCK_ID_MAX_LEN];
161   - int l_level;
162 160 unsigned int l_ro_holders;
163 161 unsigned int l_ex_holders;
164   - struct ocfs2_dlm_lksb l_lksb;
  162 + unsigned char l_level;
165 163  
  164 + /* Data packed - type enum ocfs2_lock_type */
  165 + unsigned char l_type;
  166 +
166 167 /* used from AST/BAST funcs. */
167   - enum ocfs2_ast_action l_action;
168   - enum ocfs2_unlock_action l_unlock_action;
169   - int l_requested;
170   - int l_blocking;
  168 + /* Data packed - enum type ocfs2_ast_action */
  169 + unsigned char l_action;
  170 + /* Data packed - enum type ocfs2_unlock_action */
  171 + unsigned char l_unlock_action;
  172 + unsigned char l_requested;
  173 + unsigned char l_blocking;
171 174 unsigned int l_pending_gen;
  175 +
  176 + spinlock_t l_lock;
  177 +
  178 + struct ocfs2_dlm_lksb l_lksb;
172 179  
173 180 wait_queue_head_t l_event;
174 181  
fs/ocfs2/refcounttree.h
... ... @@ -21,14 +21,14 @@
21 21 struct rb_node rf_node;
22 22 u64 rf_blkno;
23 23 u32 rf_generation;
  24 + struct kref rf_getcnt;
24 25 struct rw_semaphore rf_sem;
25 26 struct ocfs2_lock_res rf_lockres;
26   - struct kref rf_getcnt;
27 27 int rf_removed;
28 28  
29 29 /* the following 4 fields are used by caching_info. */
30   - struct ocfs2_caching_info rf_ci;
31 30 spinlock_t rf_lock;
  31 + struct ocfs2_caching_info rf_ci;
32 32 struct mutex rf_io_mutex;
33 33 struct super_block *rf_sb;
34 34 };