Skip to content

Commit

Permalink
Pack dmu_buf_impl_t by 16 bytes
Browse files Browse the repository at this point in the history
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
  • Loading branch information
amotin authored and tonyhutter committed Nov 26, 2024
1 parent 384b53b commit 1f5e1b9
Showing 1 changed file with 24 additions and 29 deletions.
53 changes: 24 additions & 29 deletions include/sys/dbuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,27 @@ typedef struct dmu_buf_impl {
*/
uint8_t db_level;

/* This block was freed while a read or write was active. */
uint8_t db_freed_in_flight;

/*
* Evict user data as soon as the dirty and reference counts are equal.
*/
uint8_t db_user_immediate_evict;

/*
* dnode_evict_dbufs() or dnode_evict_bonus() tried to evict this dbuf,
* but couldn't due to outstanding references. Evict once the refcount
* drops to 0.
*/
uint8_t db_pending_evict;

/* Number of TXGs in which this buffer is dirty. */
uint8_t db_dirtycnt;

/* The buffer was partially read. More reads may follow. */
uint8_t db_partial_read;

/*
* Protects db_buf's contents if they contain an indirect block or data
* block of the meta-dnode. We use this lock to protect the structure of
Expand All @@ -280,6 +301,9 @@ typedef struct dmu_buf_impl {
*/
dbuf_states_t db_state;

/* In which dbuf cache this dbuf is, if any. */
dbuf_cached_state_t db_caching_status;

/*
* Refcount accessed by dmu_buf_{hold,rele}.
* If nonzero, the buffer can't be destroyed.
Expand All @@ -296,39 +320,10 @@ typedef struct dmu_buf_impl {
/* Link in dbuf_cache or dbuf_metadata_cache */
multilist_node_t db_cache_link;

/* Tells us which dbuf cache this dbuf is in, if any */
dbuf_cached_state_t db_caching_status;

uint64_t db_hash;

/* Data which is unique to data (leaf) blocks: */

/* User callback information. */
dmu_buf_user_t *db_user;

/*
* Evict user data as soon as the dirty and reference
* counts are equal.
*/
uint8_t db_user_immediate_evict;

/*
* This block was freed while a read or write was
* active.
*/
uint8_t db_freed_in_flight;

/*
* dnode_evict_dbufs() or dnode_evict_bonus() tried to
* evict this dbuf, but couldn't due to outstanding
* references. Evict once the refcount drops to 0.
*/
uint8_t db_pending_evict;

uint8_t db_dirtycnt;

/* The buffer was partially read. More reads may follow. */
uint8_t db_partial_read;
} dmu_buf_impl_t;

#define DBUF_HASH_MUTEX(h, idx) \
Expand Down

0 comments on commit 1f5e1b9

Please sign in to comment.