aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6/xfs_buf.h
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2010-09-24 05:59:15 -0400
committerAlex Elder <aelder@sgi.com>2010-10-18 16:07:57 -0400
commit50f59e8eed85ec4c79bc2454ed50c7886f6c5ebf (patch)
treeffb2fa359ee0751ce2f0f6dd29afc39eeda1ca86 /fs/xfs/linux-2.6/xfs_buf.h
parent74f75a0cb7033918eb0fa4a50df25091ac75c16e (diff)
xfs: pack xfs_buf structure more tightly
pahole reports the struct xfs_buf has quite a few holes in it, so packing the structure better will reduce the size of it by 16 bytes. Also, move all the fields used in cache lookups into the first cacheline. Before on x86_64: /* size: 320, cachelines: 5 */ /* sum members: 298, holes: 6, sum holes: 22 */ After on x86_64: /* size: 304, cachelines: 5 */ /* padding: 6 */ /* last cacheline: 48 bytes */ Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_buf.h')
-rw-r--r--fs/xfs/linux-2.6/xfs_buf.h30
1 files changed, 19 insertions, 11 deletions
diff --git a/fs/xfs/linux-2.6/xfs_buf.h b/fs/xfs/linux-2.6/xfs_buf.h
index c79882ecb513..161333785f69 100644
--- a/fs/xfs/linux-2.6/xfs_buf.h
+++ b/fs/xfs/linux-2.6/xfs_buf.h
@@ -162,33 +162,41 @@ typedef int (*xfs_buf_bdstrat_t)(struct xfs_buf *);
162#define XB_PAGES 2 162#define XB_PAGES 2
163 163
164typedef struct xfs_buf { 164typedef struct xfs_buf {
165 /*
166 * first cacheline holds all the fields needed for an uncontended cache
167 * hit to be fully processed. The semaphore straddles the cacheline
168 * boundary, but the counter and lock sits on the first cacheline,
169 * which is the only bit that is touched if we hit the semaphore
170 * fast-path on locking.
171 */
172 struct rb_node b_rbnode; /* rbtree node */
173 xfs_off_t b_file_offset; /* offset in file */
174 size_t b_buffer_length;/* size of buffer in bytes */
175 atomic_t b_hold; /* reference count */
176 xfs_buf_flags_t b_flags; /* status flags */
165 struct semaphore b_sema; /* semaphore for lockables */ 177 struct semaphore b_sema; /* semaphore for lockables */
166 unsigned long b_queuetime; /* time buffer was queued */ 178
167 atomic_t b_pin_count; /* pin count */
168 wait_queue_head_t b_waiters; /* unpin waiters */ 179 wait_queue_head_t b_waiters; /* unpin waiters */
169 struct list_head b_list; 180 struct list_head b_list;
170 xfs_buf_flags_t b_flags; /* status flags */
171 struct rb_node b_rbnode; /* rbtree node */
172 struct xfs_perag *b_pag; /* contains rbtree root */ 181 struct xfs_perag *b_pag; /* contains rbtree root */
173 xfs_buftarg_t *b_target; /* buffer target (device) */ 182 xfs_buftarg_t *b_target; /* buffer target (device) */
174 atomic_t b_hold; /* reference count */
175 xfs_daddr_t b_bn; /* block number for I/O */ 183 xfs_daddr_t b_bn; /* block number for I/O */
176 xfs_off_t b_file_offset; /* offset in file */
177 size_t b_buffer_length;/* size of buffer in bytes */
178 size_t b_count_desired;/* desired transfer size */ 184 size_t b_count_desired;/* desired transfer size */
179 void *b_addr; /* virtual address of buffer */ 185 void *b_addr; /* virtual address of buffer */
180 struct work_struct b_iodone_work; 186 struct work_struct b_iodone_work;
181 atomic_t b_io_remaining; /* #outstanding I/O requests */
182 xfs_buf_iodone_t b_iodone; /* I/O completion function */ 187 xfs_buf_iodone_t b_iodone; /* I/O completion function */
183 xfs_buf_relse_t b_relse; /* releasing function */ 188 xfs_buf_relse_t b_relse; /* releasing function */
184 struct completion b_iowait; /* queue for I/O waiters */ 189 struct completion b_iowait; /* queue for I/O waiters */
185 void *b_fspriv; 190 void *b_fspriv;
186 void *b_fspriv2; 191 void *b_fspriv2;
187 unsigned short b_error; /* error code on I/O */
188 unsigned int b_page_count; /* size of page array */
189 unsigned int b_offset; /* page offset in first page */
190 struct page **b_pages; /* array of page pointers */ 192 struct page **b_pages; /* array of page pointers */
191 struct page *b_page_array[XB_PAGES]; /* inline pages */ 193 struct page *b_page_array[XB_PAGES]; /* inline pages */
194 unsigned long b_queuetime; /* time buffer was queued */
195 atomic_t b_pin_count; /* pin count */
196 atomic_t b_io_remaining; /* #outstanding I/O requests */
197 unsigned int b_page_count; /* size of page array */
198 unsigned int b_offset; /* page offset in first page */
199 unsigned short b_error; /* error code on I/O */
192#ifdef XFS_BUF_LOCK_TRACKING 200#ifdef XFS_BUF_LOCK_TRACKING
193 int b_last_holder; 201 int b_last_holder;
194#endif 202#endif