Skip to content

Commit 5e58644

Browse files
amotinlundman
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 5167d43 commit 5e58644

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
@@ -264,6 +264,27 @@ typedef struct dmu_buf_impl {
264264
*/
265265
uint8_t db_level;
266266

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

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

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

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

342337
#define DBUF_HASH_MUTEX(h, idx) \

0 commit comments

Comments
 (0)