Skip to content

Commit e303a29

Browse files
amotinixhamza
authored andcommitted
Pack dmu_buf_impl_t by 16 bytes
On 64bit FreeBSD this reduces one from 296 to 280 bytes. On small block workloads dbufs may consume gigabytes of ARC, and this saves 5% of it. Reviewed-by: Tino Reichardt <[email protected]> Reviewed-by: Brian Atkinson <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Alexander Motin <[email protected]> Sponsored by: iXsystems, Inc. Closes openzfs#16684
1 parent 4b9e7f4 commit e303a29

File tree

1 file changed

+24
-29
lines changed

1 file changed

+24
-29
lines changed

include/sys/dbuf.h

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,27 @@ typedef struct dmu_buf_impl {
263263
*/
264264
uint8_t db_level;
265265

266+
/* This block was freed while a read or write was active. */
267+
uint8_t db_freed_in_flight;
268+
269+
/*
270+
* Evict user data as soon as the dirty and reference counts are equal.
271+
*/
272+
uint8_t db_user_immediate_evict;
273+
274+
/*
275+
* dnode_evict_dbufs() or dnode_evict_bonus() tried to evict this dbuf,
276+
* but couldn't due to outstanding references. Evict once the refcount
277+
* drops to 0.
278+
*/
279+
uint8_t db_pending_evict;
280+
281+
/* Number of TXGs in which this buffer is dirty. */
282+
uint8_t db_dirtycnt;
283+
284+
/* The buffer was partially read. More reads may follow. */
285+
uint8_t db_partial_read;
286+
266287
/*
267288
* Protects db_buf's contents if they contain an indirect block or data
268289
* block of the meta-dnode. We use this lock to protect the structure of
@@ -287,6 +308,9 @@ typedef struct dmu_buf_impl {
287308
*/
288309
dbuf_states_t db_state;
289310

311+
/* In which dbuf cache this dbuf is, if any. */
312+
dbuf_cached_state_t db_caching_status;
313+
290314
/*
291315
* Refcount accessed by dmu_buf_{hold,rele}.
292316
* If nonzero, the buffer can't be destroyed.
@@ -303,39 +327,10 @@ typedef struct dmu_buf_impl {
303327
/* Link in dbuf_cache or dbuf_metadata_cache */
304328
multilist_node_t db_cache_link;
305329

306-
/* Tells us which dbuf cache this dbuf is in, if any */
307-
dbuf_cached_state_t db_caching_status;
308-
309330
uint64_t db_hash;
310331

311-
/* Data which is unique to data (leaf) blocks: */
312-
313332
/* User callback information. */
314333
dmu_buf_user_t *db_user;
315-
316-
/*
317-
* Evict user data as soon as the dirty and reference
318-
* counts are equal.
319-
*/
320-
uint8_t db_user_immediate_evict;
321-
322-
/*
323-
* This block was freed while a read or write was
324-
* active.
325-
*/
326-
uint8_t db_freed_in_flight;
327-
328-
/*
329-
* dnode_evict_dbufs() or dnode_evict_bonus() tried to
330-
* evict this dbuf, but couldn't due to outstanding
331-
* references. Evict once the refcount drops to 0.
332-
*/
333-
uint8_t db_pending_evict;
334-
335-
uint8_t db_dirtycnt;
336-
337-
/* The buffer was partially read. More reads may follow. */
338-
uint8_t db_partial_read;
339334
} dmu_buf_impl_t;
340335

341336
#define DBUF_HASH_MUTEX(h, idx) \

0 commit comments

Comments
 (0)