FreeBSD ZFS
The Zettabyte File System
Functions

dmu_object.c File Reference

#include <sys/dmu.h>
#include <sys/dmu_objset.h>
#include <sys/dmu_tx.h>
#include <sys/dnode.h>
Include dependency graph for dmu_object.c:

Go to the source code of this file.

Functions

uint64_t dmu_object_alloc (objset_t *os, dmu_object_type_t ot, int blocksize, dmu_object_type_t bonustype, int bonuslen, dmu_tx_t *tx)
 Chooses an unallocated object number and returns a new object that uses it in *objectp.
int dmu_object_claim (objset_t *os, uint64_t object, dmu_object_type_t ot, int blocksize, dmu_object_type_t bonustype, int bonuslen, dmu_tx_t *tx)
 Allocates an object for the specified object number.
int dmu_object_reclaim (objset_t *os, uint64_t object, dmu_object_type_t ot, int blocksize, dmu_object_type_t bonustype, int bonuslen)
int dmu_object_free (objset_t *os, uint64_t object, dmu_tx_t *tx)
 Free an object from this objset.
int dmu_object_next (objset_t *os, uint64_t *objectp, boolean_t hole, uint64_t txg)
 Find the next allocated or free object.

Function Documentation

uint64_t dmu_object_alloc ( objset_t os,
dmu_object_type_t  ot,
int  blocksize,
dmu_object_type_t  bonus_type,
int  bonus_len,
dmu_tx_t tx 
)

Chooses an unallocated object number and returns a new object that uses it in *objectp.

Allocate an object from this objset. The range of object numbers available is (0, DN_MAX_OBJECT). Object 0 is the meta-dnode.

The transaction must be assigned to a txg. The newly allocated object will be "held" in the transaction (ie. you can modify the newly allocated object in this transaction).

Returns:
0 on success or an errno on failure

Definition at line 31 of file dmu_object.c.

int dmu_object_claim ( objset_t os,
uint64_t  object,
dmu_object_type_t  ot,
int  blocksize,
dmu_object_type_t  bonus_type,
int  bonus_len,
dmu_tx_t tx 
)

Allocates an object for the specified object number.

Return values:
0Success
EEXISTThe object number is already allocated

Definition at line 86 of file dmu_object.c.

int dmu_object_free ( objset_t os,
uint64_t  object,
dmu_tx_t tx 
)

Free an object from this objset.

The object's data will be freed as well (ie. you don't need to call dmu_free(object, 0, -1, tx)).

The object need not be held in the transaction.

Return values:
0Success
EBUSYThere are holds on this object's buffers (via dmu_buf_hold()) or tx holds on the object (via dmu-tx_hold_object()) so it cannot be freed
ENOENTThe object is not allocated

Definition at line 164 of file dmu_object.c.

int dmu_object_next ( objset_t os,
uint64_t *  objectp,
boolean_t  hole,
uint64_t  txg 
)

Find the next allocated or free object.

Parameters:
[in,out]objectpWill be updated to the next object which is allocated
[in]txgignore objects which have not been modified since txt
Invariant:
Can only be called on a objset with no dirty data.
Return values:
0Success
ENOENTThere are no more objects

Definition at line 185 of file dmu_object.c.

int dmu_object_reclaim ( objset_t os,
uint64_t  object,
dmu_object_type_t  ot,
int  blocksize,
dmu_object_type_t  bonustype,
int  bonuslen 
)

Definition at line 106 of file dmu_object.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines