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

dmu_send.c File Reference

#include <sys/dmu.h>
#include <sys/dmu_impl.h>
#include <sys/dmu_tx.h>
#include <sys/dbuf.h>
#include <sys/dnode.h>
#include <sys/zfs_context.h>
#include <sys/dmu_objset.h>
#include <sys/dmu_traverse.h>
#include <sys/dsl_dataset.h>
#include <sys/dsl_dir.h>
#include <sys/dsl_prop.h>
#include <sys/dsl_pool.h>
#include <sys/dsl_synctask.h>
#include <sys/zfs_ioctl.h>
#include <sys/zap.h>
#include <sys/zio_checksum.h>
#include <sys/zfs_znode.h>
#include <zfs_fletcher.h>
#include <sys/avl.h>
#include <sys/ddt.h>
#include <sys/zfs_onexit.h>
Include dependency graph for dmu_send.c:

Go to the source code of this file.

Data Structures

struct  recvbeginsyncarg
struct  restorearg
struct  guid_map_entry
struct  recvendsyncarg

Defines

#define BP_SPAN(dnp, level)
#define DO64(X)   (drr->drr_u.X = BSWAP_64(drr->drr_u.X))
#define DO32(X)   (drr->drr_u.X = BSWAP_32(drr->drr_u.X))

Typedefs

typedef struct guid_map_entry guid_map_entry_t

Functions

static int dump_bytes (dmu_sendarg_t *dsp, void *buf, int len)
static int dump_free (dmu_sendarg_t *dsp, uint64_t object, uint64_t offset, uint64_t length)
static int dump_data (dmu_sendarg_t *dsp, dmu_object_type_t type, uint64_t object, uint64_t offset, int blksz, const blkptr_t *bp, void *data)
static int dump_spill (dmu_sendarg_t *dsp, uint64_t object, int blksz, void *data)
static int dump_freeobjects (dmu_sendarg_t *dsp, uint64_t firstobj, uint64_t numobjs)
static int dump_dnode (dmu_sendarg_t *dsp, uint64_t object, dnode_phys_t *dnp)
static int backup_cb (spa_t *spa, zilog_t *zilog, const blkptr_t *bp, arc_buf_t *pbuf, const zbookmark_t *zb, const dnode_phys_t *dnp, void *arg)
int dmu_send (objset_t *tosnap, objset_t *fromsnap, boolean_t fromorigin, int outfd, struct file *fp, offset_t *off)
int dmu_send_estimate (objset_t *tosnap, objset_t *fromsnap, boolean_t fromorigin, uint64_t *sizep)
static int recv_new_check (void *arg1, void *arg2, dmu_tx_t *tx)
static void recv_new_sync (void *arg1, void *arg2, dmu_tx_t *tx)
static int recv_existing_check (void *arg1, void *arg2, dmu_tx_t *tx)
static void recv_existing_sync (void *arg1, void *arg2, dmu_tx_t *tx)
static boolean_t dmu_recv_verify_features (dsl_dataset_t *ds, struct drr_begin *drrb)
int dmu_recv_begin (char *tofs, char *tosnap, char *top_ds, struct drr_begin *drrb, boolean_t force, objset_t *origin, dmu_recv_cookie_t *drc)
 NB: callers *MUST* call dmu_recv_stream() if dmu_recv_begin() succeeds; otherwise we will leak the holds on the datasets.
static int guid_compare (const void *arg1, const void *arg2)
static void free_guid_map_onexit (void *arg)
static int restore_bytes (struct restorearg *ra, void *buf, int len, off_t off, ssize_t *resid)
static void * restore_read (struct restorearg *ra, int len)
static void backup_byteswap (dmu_replay_record_t *drr)
static int restore_object (struct restorearg *ra, objset_t *os, struct drr_object *drro)
static int restore_freeobjects (struct restorearg *ra, objset_t *os, struct drr_freeobjects *drrfo)
static int restore_write (struct restorearg *ra, objset_t *os, struct drr_write *drrw)
static int restore_write_byref (struct restorearg *ra, objset_t *os, struct drr_write_byref *drrwbr)
 Handle a DRR_WRITE_BYREF record.
static int restore_spill (struct restorearg *ra, objset_t *os, struct drr_spill *drrs)
static int restore_free (struct restorearg *ra, objset_t *os, struct drr_free *drrf)
int dmu_recv_stream (dmu_recv_cookie_t *drc, struct file *fp, offset_t *voffp, int cleanup_fd, uint64_t *action_handlep)
 NB: callers *must* call dmu_recv_end() if this succeeds.
static int recv_end_check (void *arg1, void *arg2, dmu_tx_t *tx)
static void recv_end_sync (void *arg1, void *arg2, dmu_tx_t *tx)
static int add_ds_to_guidmap (avl_tree_t *guid_map, dsl_dataset_t *ds)
static int dmu_recv_existing_end (dmu_recv_cookie_t *drc)
static int dmu_recv_new_end (dmu_recv_cookie_t *drc)
int dmu_recv_end (dmu_recv_cookie_t *drc)

Variables

int zfs_send_corrupt_data = B_FALSE
static char * dmu_recv_tag = "dmu_recv_tag"

Define Documentation

#define BP_SPAN (   dnp,
  level 
)
Value:
(((uint64_t)dnp->dn_datablkszsec) << (SPA_MINBLOCKSHIFT + \
        (level) * (dnp->dn_indblkshift - SPA_BLKPTRSHIFT)))

Definition at line 314 of file dmu_send.c.

#define DO32 (   X)    (drr->drr_u.X = BSWAP_32(drr->drr_u.X))
#define DO64 (   X)    (drr->drr_u.X = BSWAP_64(drr->drr_u.X))

Typedef Documentation


Function Documentation

static int add_ds_to_guidmap ( avl_tree_t *  guid_map,
dsl_dataset_t ds 
) [static]

Definition at line 1622 of file dmu_send.c.

static void backup_byteswap ( dmu_replay_record_t drr) [static]

Definition at line 1033 of file dmu_send.c.

static int backup_cb ( spa_t spa,
zilog_t zilog,
const blkptr_t bp,
arc_buf_t pbuf,
const zbookmark_t zb,
const dnode_phys_t dnp,
void *  arg 
) [static]

Definition at line 320 of file dmu_send.c.

int dmu_recv_begin ( char *  tofs,
char *  tosnap,
char *  top_ds,
struct drr_begin drrb,
boolean_t  force,
objset_t origin,
dmu_recv_cookie_t drc 
)

NB: callers *MUST* call dmu_recv_stream() if dmu_recv_begin() succeeds; otherwise we will leak the holds on the datasets.

Definition at line 805 of file dmu_send.c.

int dmu_recv_end ( dmu_recv_cookie_t drc)

Definition at line 1719 of file dmu_send.c.

static int dmu_recv_existing_end ( dmu_recv_cookie_t drc) [static]

Definition at line 1646 of file dmu_send.c.

static int dmu_recv_new_end ( dmu_recv_cookie_t drc) [static]

Definition at line 1687 of file dmu_send.c.

int dmu_recv_stream ( dmu_recv_cookie_t drc,
struct file *  fp,
offset_t *  voffp,
int  cleanup_fd,
uint64_t *  action_handlep 
)

NB: callers *must* call dmu_recv_end() if this succeeds.

Definition at line 1392 of file dmu_send.c.

static boolean_t dmu_recv_verify_features ( dsl_dataset_t ds,
struct drr_begin drrb 
) [static]

Definition at line 789 of file dmu_send.c.

int dmu_send ( objset_t tosnap,
objset_t fromsnap,
boolean_t  fromorigin,
int  outfd,
struct file *  fp,
offset_t *  off 
)

Definition at line 407 of file dmu_send.c.

int dmu_send_estimate ( objset_t tosnap,
objset_t fromsnap,
boolean_t  fromorigin,
uint64_t *  sizep 
)

Definition at line 541 of file dmu_send.c.

static int dump_bytes ( dmu_sendarg_t dsp,
void *  buf,
int  len 
) [static]

Definition at line 57 of file dmu_send.c.

static int dump_data ( dmu_sendarg_t dsp,
dmu_object_type_t  type,
uint64_t  object,
uint64_t  offset,
int  blksz,
const blkptr_t bp,
void *  data 
) [static]

Definition at line 157 of file dmu_send.c.

static int dump_dnode ( dmu_sendarg_t dsp,
uint64_t  object,
dnode_phys_t dnp 
) [static]

Definition at line 273 of file dmu_send.c.

static int dump_free ( dmu_sendarg_t dsp,
uint64_t  object,
uint64_t  offset,
uint64_t  length 
) [static]

Definition at line 91 of file dmu_send.c.

static int dump_freeobjects ( dmu_sendarg_t dsp,
uint64_t  firstobj,
uint64_t  numobjs 
) [static]

Definition at line 225 of file dmu_send.c.

static int dump_spill ( dmu_sendarg_t dsp,
uint64_t  object,
int  blksz,
void *  data 
) [static]

Definition at line 199 of file dmu_send.c.

static void free_guid_map_onexit ( void *  arg) [static]

Definition at line 960 of file dmu_send.c.

static int guid_compare ( const void *  arg1,
const void *  arg2 
) [static]

Definition at line 947 of file dmu_send.c.

static int recv_end_check ( void *  arg1,
void *  arg2,
dmu_tx_t tx 
) [static]

Definition at line 1595 of file dmu_send.c.

static void recv_end_sync ( void *  arg1,
void *  arg2,
dmu_tx_t tx 
) [static]

Definition at line 1604 of file dmu_send.c.

static int recv_existing_check ( void *  arg1,
void *  arg2,
dmu_tx_t tx 
) [static]

Definition at line 688 of file dmu_send.c.

static void recv_existing_sync ( void *  arg1,
void *  arg2,
dmu_tx_t tx 
) [static]

Definition at line 759 of file dmu_send.c.

static int recv_new_check ( void *  arg1,
void *  arg2,
dmu_tx_t tx 
) [static]

Definition at line 636 of file dmu_send.c.

static void recv_new_sync ( void *  arg1,
void *  arg2,
dmu_tx_t tx 
) [static]

Definition at line 664 of file dmu_send.c.

static int restore_bytes ( struct restorearg ra,
void *  buf,
int  len,
off_t  off,
ssize_t *  resid 
) [static]

Definition at line 975 of file dmu_send.c.

static int restore_free ( struct restorearg ra,
objset_t os,
struct drr_free drrf 
) [static]

Definition at line 1371 of file dmu_send.c.

static int restore_freeobjects ( struct restorearg ra,
objset_t os,
struct drr_freeobjects drrfo 
) [static]

Definition at line 1199 of file dmu_send.c.

static int restore_object ( struct restorearg ra,
objset_t os,
struct drr_object drro 
) [static]

Definition at line 1113 of file dmu_send.c.

static void* restore_read ( struct restorearg ra,
int  len 
) [static]

Definition at line 1001 of file dmu_send.c.

static int restore_spill ( struct restorearg ra,
objset_t os,
struct drr_spill drrs 
) [static]

Definition at line 1320 of file dmu_send.c.

static int restore_write ( struct restorearg ra,
objset_t os,
struct drr_write drrw 
) [static]

Definition at line 1223 of file dmu_send.c.

static int restore_write_byref ( struct restorearg ra,
objset_t os,
struct drr_write_byref drrwbr 
) [static]

Handle a DRR_WRITE_BYREF record.

This record is used in dedup'ed streams to refer to a copy of the data that is already on the system because it came in earlier in the stream. This function finds the earlier copy of the data, and uses that copy instead of data from the stream to fulfill this write.

Definition at line 1269 of file dmu_send.c.


Variable Documentation

char* dmu_recv_tag = "dmu_recv_tag" [static]

Definition at line 54 of file dmu_send.c.

int zfs_send_corrupt_data = B_FALSE

Definition at line 52 of file dmu_send.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines