FreeBSD ZFS
The Zettabyte File System
Data Structures | Defines | Typedefs | Functions

sys/txg.h File Reference

#include <sys/spa.h>
#include <sys/zfs_context.h>
Include dependency graph for txg.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  txg_handle
struct  txg_node
struct  txg_list

Defines

#define TXG_CONCURRENT_STATES   3
 open, quiescing, syncing
#define TXG_SIZE   4
 next power of 2
#define TXG_MASK   (TXG_SIZE - 1)
 mask for size
#define TXG_INITIAL   TXG_SIZE
 initial txg
#define TXG_IDX   (txg & TXG_MASK)
#define TXG_DEFER_SIZE   2
 Number of txgs worth of frees we defer adding to in-core spacemaps.
#define TXG_WAIT   1ULL
#define TXG_NOWAIT   2ULL
#define TXG_CLEAN(txg)   ((txg) - 1)

Typedefs

typedef struct tx_cpu tx_cpu_t
typedef struct txg_handle txg_handle_t
typedef struct txg_node txg_node_t
typedef struct txg_list txg_list_t

Functions

void txg_init (struct dsl_pool *dp, uint64_t txg)
 Prepares the txg subsystem.
void txg_fini (struct dsl_pool *dp)
 Closes down the txg subsystem.
void txg_sync_start (struct dsl_pool *dp)
 Starts syncing transaction groups.
void txg_sync_stop (struct dsl_pool *dp)
 Stops syncing transaction groups.
uint64_t txg_hold_open (struct dsl_pool *dp, txg_handle_t *txghp)
void txg_rele_to_quiesce (txg_handle_t *txghp)
void txg_rele_to_sync (txg_handle_t *txghp)
void txg_register_callbacks (txg_handle_t *txghp, list_t *tx_callbacks)
void txg_delay (struct dsl_pool *dp, uint64_t txg, int ticks)
 Delay the caller by the specified number of ticks or until the txg closes (whichever comes first).
void txg_wait_synced (struct dsl_pool *dp, uint64_t txg)
 Wait until the given transaction group has finished syncing.
void txg_wait_open (struct dsl_pool *dp, uint64_t txg)
 Wait until the given transaction group, or one after it, is the open transaction group.
boolean_t txg_stalled (struct dsl_pool *dp)
 Are we waiting for the syncing transaction to complete?
boolean_t txg_sync_waiting (struct dsl_pool *dp)
void txg_list_create (txg_list_t *tl, size_t offset)
 Per-txg object lists.
void txg_list_destroy (txg_list_t *tl)
boolean_t txg_list_empty (txg_list_t *tl, uint64_t txg)
int txg_list_add (txg_list_t *tl, void *p, uint64_t txg)
 Add an entry to the list.
int txg_list_add_tail (txg_list_t *tl, void *p, uint64_t txg)
 Add an entry to the end of the list (walks list to find end).
void * txg_list_remove (txg_list_t *tl, uint64_t txg)
 Remove the head of the list and return it.
void * txg_list_remove_this (txg_list_t *tl, void *p, uint64_t txg)
 Remove a specific item from the list and return it.
int txg_list_member (txg_list_t *tl, void *p, uint64_t txg)
void * txg_list_head (txg_list_t *tl, uint64_t txg)
 Walk a txg list - only safe if you know it's not changing.
void * txg_list_next (txg_list_t *tl, void *p, uint64_t txg)

Define Documentation

#define TXG_CLEAN (   txg)    ((txg) - 1)

Definition at line 122 of file txg.h.

#define TXG_CONCURRENT_STATES   3

open, quiescing, syncing

Definition at line 39 of file txg.h.

#define TXG_DEFER_SIZE   2

Number of txgs worth of frees we defer adding to in-core spacemaps.

Definition at line 46 of file txg.h.

#define TXG_IDX   (txg & TXG_MASK)

Definition at line 43 of file txg.h.

#define TXG_INITIAL   TXG_SIZE

initial txg

Definition at line 42 of file txg.h.

#define TXG_MASK   (TXG_SIZE - 1)

mask for size

Definition at line 41 of file txg.h.

#define TXG_NOWAIT   2ULL

Definition at line 49 of file txg.h.

#define TXG_SIZE   4

next power of 2

Definition at line 40 of file txg.h.

#define TXG_WAIT   1ULL

Definition at line 48 of file txg.h.


Typedef Documentation

typedef struct tx_cpu tx_cpu_t

Definition at line 51 of file txg.h.

typedef struct txg_handle txg_handle_t
typedef struct txg_list txg_list_t
typedef struct txg_node txg_node_t

Function Documentation

void txg_delay ( dsl_pool_t dp,
uint64_t  txg,
int  ticks 
)

Delay the caller by the specified number of ticks or until the txg closes (whichever comes first).

This is intended to be used to throttle writers when the system nears its capacity.

Delay the caller by the specified number of ticks or until the txg closes (whichever comes first).

Abort the delay if this txg stalls or enters the quiesing state.

Definition at line 509 of file txg.c.

void txg_fini ( struct dsl_pool dp)

Closes down the txg subsystem.

Definition at line 96 of file txg.c.

uint64_t txg_hold_open ( struct dsl_pool dp,
txg_handle_t txghp 
)

Definition at line 231 of file txg.c.

void txg_init ( struct dsl_pool dp,
uint64_t  txg 
)

Prepares the txg subsystem.

Definition at line 60 of file txg.c.

int txg_list_add ( txg_list_t tl,
void *  p,
uint64_t  txg 
)

Add an entry to the list.

Returns:
0 if it's a new entry, 1 if it's already there.

Definition at line 631 of file txg.c.

int txg_list_add_tail ( txg_list_t tl,
void *  p,
uint64_t  txg 
)

Add an entry to the end of the list (walks list to find end).

Returns:
0 if it's a new entry, 1 if it's already there.

Definition at line 655 of file txg.c.

void txg_list_create ( txg_list_t tl,
size_t  offset 
)

Per-txg object lists.

Definition at line 596 of file txg.c.

void txg_list_destroy ( txg_list_t tl)

Definition at line 609 of file txg.c.

boolean_t txg_list_empty ( txg_list_t tl,
uint64_t  txg 
)

Definition at line 620 of file txg.c.

void* txg_list_head ( txg_list_t tl,
uint64_t  txg 
)

Walk a txg list - only safe if you know it's not changing.

Definition at line 739 of file txg.c.

int txg_list_member ( txg_list_t tl,
void *  p,
uint64_t  txg 
)

Definition at line 727 of file txg.c.

void* txg_list_next ( txg_list_t tl,
void *  p,
uint64_t  txg 
)

Definition at line 748 of file txg.c.

void* txg_list_remove ( txg_list_t tl,
uint64_t  txg 
)

Remove the head of the list and return it.

Definition at line 682 of file txg.c.

void* txg_list_remove_this ( txg_list_t tl,
void *  p,
uint64_t  txg 
)

Remove a specific item from the list and return it.

Definition at line 704 of file txg.c.

void txg_register_callbacks ( txg_handle_t txghp,
list_t *  tx_callbacks 
)

Definition at line 257 of file txg.c.

void txg_rele_to_quiesce ( txg_handle_t txghp)

Definition at line 249 of file txg.c.

void txg_rele_to_sync ( txg_handle_t txghp)

Definition at line 268 of file txg.c.

boolean_t txg_stalled ( struct dsl_pool dp)

Are we waiting for the syncing transaction to complete?

Return values:
TRUEWe are "backed up" waiting for the syncing transaction to complete
FALSEOtherwise

Definition at line 577 of file txg.c.

void txg_sync_start ( struct dsl_pool dp)

Starts syncing transaction groups.

Definition at line 133 of file txg.c.

void txg_sync_stop ( struct dsl_pool dp)

Stops syncing transaction groups.

Definition at line 194 of file txg.c.

boolean_t txg_sync_waiting ( struct dsl_pool dp)
Returns:
TRUE if someone is waiting for the next txg to sync

Definition at line 584 of file txg.c.

void txg_wait_open ( struct dsl_pool dp,
uint64_t  txg 
)

Wait until the given transaction group, or one after it, is the open transaction group.

Try to make this happen as soon as possible (eg. kick off any necessary syncs immediately). If txg == 0, wait for the next open txg.

Definition at line 557 of file txg.c.

void txg_wait_synced ( struct dsl_pool dp,
uint64_t  txg 
)

Wait until the given transaction group has finished syncing.

Try to make this happen as soon as possible (eg. kick off any necessary syncs immediately). If txg==0, wait for the currently open txg to finish syncing.

Definition at line 534 of file txg.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines