dmu.h (200726) | dmu.h (209962) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 47 unchanged lines hidden (view full) --- 56struct dsl_pool; 57struct dnode; 58struct drr_begin; 59struct drr_end; 60struct zbookmark; 61struct spa; 62struct nvlist; 63struct objset_impl; | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 47 unchanged lines hidden (view full) --- 56struct dsl_pool; 57struct dnode; 58struct drr_begin; 59struct drr_end; 60struct zbookmark; 61struct spa; 62struct nvlist; 63struct objset_impl; |
64struct arc_buf; |
|
64struct file; 65 66typedef struct objset objset_t; 67typedef struct dmu_tx dmu_tx_t; 68typedef struct dsl_dir dsl_dir_t; 69 70typedef enum dmu_object_type { 71 DMU_OT_NONE, --- 39 unchanged lines hidden (view full) --- 111 DMU_OT_POOL_PROPS, /* ZAP */ 112 DMU_OT_DSL_PERMS, /* ZAP */ 113 DMU_OT_ACL, /* ACL */ 114 DMU_OT_SYSACL, /* SYSACL */ 115 DMU_OT_FUID, /* FUID table (Packed NVLIST UINT8) */ 116 DMU_OT_FUID_SIZE, /* FUID table size UINT64 */ 117 DMU_OT_NEXT_CLONES, /* ZAP */ 118 DMU_OT_SCRUB_QUEUE, /* ZAP */ | 65struct file; 66 67typedef struct objset objset_t; 68typedef struct dmu_tx dmu_tx_t; 69typedef struct dsl_dir dsl_dir_t; 70 71typedef enum dmu_object_type { 72 DMU_OT_NONE, --- 39 unchanged lines hidden (view full) --- 112 DMU_OT_POOL_PROPS, /* ZAP */ 113 DMU_OT_DSL_PERMS, /* ZAP */ 114 DMU_OT_ACL, /* ACL */ 115 DMU_OT_SYSACL, /* SYSACL */ 116 DMU_OT_FUID, /* FUID table (Packed NVLIST UINT8) */ 117 DMU_OT_FUID_SIZE, /* FUID table size UINT64 */ 118 DMU_OT_NEXT_CLONES, /* ZAP */ 119 DMU_OT_SCRUB_QUEUE, /* ZAP */ |
120 DMU_OT_USERGROUP_USED, /* ZAP */ 121 DMU_OT_USERGROUP_QUOTA, /* ZAP */ |
|
119 DMU_OT_NUMTYPES 120} dmu_object_type_t; 121 122typedef enum dmu_objset_type { 123 DMU_OST_NONE, 124 DMU_OST_META, 125 DMU_OST_ZFS, 126 DMU_OST_ZVOL, --- 26 unchanged lines hidden (view full) --- 153 154/* 155 * The maximum number of bytes that can be accessed as part of one 156 * operation, including metadata. 157 */ 158#define DMU_MAX_ACCESS (10<<20) /* 10MB */ 159#define DMU_MAX_DELETEBLKCNT (20480) /* ~5MB of indirect blocks */ 160 | 122 DMU_OT_NUMTYPES 123} dmu_object_type_t; 124 125typedef enum dmu_objset_type { 126 DMU_OST_NONE, 127 DMU_OST_META, 128 DMU_OST_ZFS, 129 DMU_OST_ZVOL, --- 26 unchanged lines hidden (view full) --- 156 157/* 158 * The maximum number of bytes that can be accessed as part of one 159 * operation, including metadata. 160 */ 161#define DMU_MAX_ACCESS (10<<20) /* 10MB */ 162#define DMU_MAX_DELETEBLKCNT (20480) /* ~5MB of indirect blocks */ 163 |
164#define DMU_USERUSED_OBJECT (-1ULL) 165#define DMU_GROUPUSED_OBJECT (-2ULL) 166 |
|
161/* 162 * Public routines to create, destroy, open, and close objsets. 163 */ 164int dmu_objset_open(const char *name, dmu_objset_type_t type, int mode, 165 objset_t **osp); 166int dmu_objset_open_ds(struct dsl_dataset *ds, dmu_objset_type_t type, 167 objset_t **osp); 168void dmu_objset_close(objset_t *os); 169int dmu_objset_evict_dbufs(objset_t *os); 170int dmu_objset_create(const char *name, dmu_objset_type_t type, 171 objset_t *clone_parent, uint64_t flags, 172 void (*func)(objset_t *os, void *arg, cred_t *cr, dmu_tx_t *tx), void *arg); 173int dmu_objset_destroy(const char *name); 174int dmu_snapshots_destroy(char *fsname, char *snapname); 175int dmu_objset_rollback(objset_t *os); | 167/* 168 * Public routines to create, destroy, open, and close objsets. 169 */ 170int dmu_objset_open(const char *name, dmu_objset_type_t type, int mode, 171 objset_t **osp); 172int dmu_objset_open_ds(struct dsl_dataset *ds, dmu_objset_type_t type, 173 objset_t **osp); 174void dmu_objset_close(objset_t *os); 175int dmu_objset_evict_dbufs(objset_t *os); 176int dmu_objset_create(const char *name, dmu_objset_type_t type, 177 objset_t *clone_parent, uint64_t flags, 178 void (*func)(objset_t *os, void *arg, cred_t *cr, dmu_tx_t *tx), void *arg); 179int dmu_objset_destroy(const char *name); 180int dmu_snapshots_destroy(char *fsname, char *snapname); 181int dmu_objset_rollback(objset_t *os); |
176int dmu_objset_snapshot(char *fsname, char *snapname, boolean_t recursive); | 182int dmu_objset_snapshot(char *fsname, char *snapname, struct nvlist *props, 183 boolean_t recursive); |
177int dmu_objset_rename(const char *name, const char *newname, 178 boolean_t recursive); 179int dmu_objset_find(char *name, int func(char *, void *), void *arg, 180 int flags); 181void dmu_objset_byteswap(void *buf, size_t size); 182 183typedef struct dmu_buf { 184 uint64_t db_object; /* object that this buffer is part of */ --- 210 unchanged lines hidden (view full) --- 395 * 396 * The transaction (tx) must be assigned to a txg (ie. you've called 397 * dmu_tx_assign()). The buffer's object must be held in the tx 398 * (ie. you've called dmu_tx_hold_object(tx, db->db_object)). 399 */ 400void dmu_buf_will_dirty(dmu_buf_t *db, dmu_tx_t *tx); 401 402/* | 184int dmu_objset_rename(const char *name, const char *newname, 185 boolean_t recursive); 186int dmu_objset_find(char *name, int func(char *, void *), void *arg, 187 int flags); 188void dmu_objset_byteswap(void *buf, size_t size); 189 190typedef struct dmu_buf { 191 uint64_t db_object; /* object that this buffer is part of */ --- 210 unchanged lines hidden (view full) --- 402 * 403 * The transaction (tx) must be assigned to a txg (ie. you've called 404 * dmu_tx_assign()). The buffer's object must be held in the tx 405 * (ie. you've called dmu_tx_hold_object(tx, db->db_object)). 406 */ 407void dmu_buf_will_dirty(dmu_buf_t *db, dmu_tx_t *tx); 408 409/* |
410 * Tells if the given dbuf is freeable. 411 */ 412boolean_t dmu_buf_freeable(dmu_buf_t *); 413 414/* |
|
403 * You must create a transaction, then hold the objects which you will 404 * (or might) modify as part of this transaction. Then you must assign 405 * the transaction to a transaction group. Once the transaction has 406 * been assigned, you can modify buffers which belong to held objects as 407 * part of this transaction. You can't modify buffers before the 408 * transaction has been assigned; you can't modify buffers which don't 409 * belong to objects which this transaction holds; you can't hold 410 * objects once the transaction has been assigned. You may hold an --- 8 unchanged lines hidden (view full) --- 419 420#define DMU_NEW_OBJECT (-1ULL) 421#define DMU_OBJECT_END (-1ULL) 422 423dmu_tx_t *dmu_tx_create(objset_t *os); 424void dmu_tx_hold_write(dmu_tx_t *tx, uint64_t object, uint64_t off, int len); 425void dmu_tx_hold_free(dmu_tx_t *tx, uint64_t object, uint64_t off, 426 uint64_t len); | 415 * You must create a transaction, then hold the objects which you will 416 * (or might) modify as part of this transaction. Then you must assign 417 * the transaction to a transaction group. Once the transaction has 418 * been assigned, you can modify buffers which belong to held objects as 419 * part of this transaction. You can't modify buffers before the 420 * transaction has been assigned; you can't modify buffers which don't 421 * belong to objects which this transaction holds; you can't hold 422 * objects once the transaction has been assigned. You may hold an --- 8 unchanged lines hidden (view full) --- 431 432#define DMU_NEW_OBJECT (-1ULL) 433#define DMU_OBJECT_END (-1ULL) 434 435dmu_tx_t *dmu_tx_create(objset_t *os); 436void dmu_tx_hold_write(dmu_tx_t *tx, uint64_t object, uint64_t off, int len); 437void dmu_tx_hold_free(dmu_tx_t *tx, uint64_t object, uint64_t off, 438 uint64_t len); |
427void dmu_tx_hold_zap(dmu_tx_t *tx, uint64_t object, int add, char *name); | 439void dmu_tx_hold_zap(dmu_tx_t *tx, uint64_t object, int add, const char *name); |
428void dmu_tx_hold_bonus(dmu_tx_t *tx, uint64_t object); 429void dmu_tx_abort(dmu_tx_t *tx); 430int dmu_tx_assign(dmu_tx_t *tx, uint64_t txg_how); 431void dmu_tx_wait(dmu_tx_t *tx); 432void dmu_tx_commit(dmu_tx_t *tx); 433 434/* 435 * Free up the data blocks for a defined range of a file. If size is --- 6 unchanged lines hidden (view full) --- 442int dmu_free_object(objset_t *os, uint64_t object); 443 444/* 445 * Convenience functions. 446 * 447 * Canfail routines will return 0 on success, or an errno if there is a 448 * nonrecoverable I/O error. 449 */ | 440void dmu_tx_hold_bonus(dmu_tx_t *tx, uint64_t object); 441void dmu_tx_abort(dmu_tx_t *tx); 442int dmu_tx_assign(dmu_tx_t *tx, uint64_t txg_how); 443void dmu_tx_wait(dmu_tx_t *tx); 444void dmu_tx_commit(dmu_tx_t *tx); 445 446/* 447 * Free up the data blocks for a defined range of a file. If size is --- 6 unchanged lines hidden (view full) --- 454int dmu_free_object(objset_t *os, uint64_t object); 455 456/* 457 * Convenience functions. 458 * 459 * Canfail routines will return 0 on success, or an errno if there is a 460 * nonrecoverable I/O error. 461 */ |
462#define DMU_READ_PREFETCH 0 /* prefetch */ 463#define DMU_READ_NO_PREFETCH 1 /* don't prefetch */ |
|
450int dmu_read(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, | 464int dmu_read(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, |
451 void *buf); | 465 void *buf, uint32_t flags); |
452void dmu_write(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, 453 const void *buf, dmu_tx_t *tx); 454int dmu_read_uio(objset_t *os, uint64_t object, struct uio *uio, uint64_t size); 455int dmu_write_uio(objset_t *os, uint64_t object, struct uio *uio, uint64_t size, 456 dmu_tx_t *tx); 457int dmu_write_pages(objset_t *os, uint64_t object, uint64_t offset, 458 uint64_t size, struct page *pp, dmu_tx_t *tx); | 466void dmu_write(objset_t *os, uint64_t object, uint64_t offset, uint64_t size, 467 const void *buf, dmu_tx_t *tx); 468int dmu_read_uio(objset_t *os, uint64_t object, struct uio *uio, uint64_t size); 469int dmu_write_uio(objset_t *os, uint64_t object, struct uio *uio, uint64_t size, 470 dmu_tx_t *tx); 471int dmu_write_pages(objset_t *os, uint64_t object, uint64_t offset, 472 uint64_t size, struct page *pp, dmu_tx_t *tx); |
473struct arc_buf *dmu_request_arcbuf(dmu_buf_t *handle, int size); 474void dmu_return_arcbuf(struct arc_buf *buf); 475void dmu_assign_arcbuf(dmu_buf_t *handle, uint64_t offset, struct arc_buf *buf, 476 dmu_tx_t *tx); |
|
459 460extern int zfs_prefetch_disable; 461 462/* 463 * Asynchronously try to read in the data. 464 */ 465void dmu_prefetch(objset_t *os, uint64_t object, uint64_t offset, 466 uint64_t len); --- 90 unchanged lines hidden (view full) --- 557extern dmu_objset_type_t dmu_objset_type(objset_t *os); 558extern uint64_t dmu_objset_id(objset_t *os); 559extern int dmu_snapshot_list_next(objset_t *os, int namelen, char *name, 560 uint64_t *id, uint64_t *offp, boolean_t *case_conflict); 561extern int dmu_snapshot_realname(objset_t *os, char *name, char *real, 562 int maxlen, boolean_t *conflict); 563extern int dmu_dir_list_next(objset_t *os, int namelen, char *name, 564 uint64_t *idp, uint64_t *offp); | 477 478extern int zfs_prefetch_disable; 479 480/* 481 * Asynchronously try to read in the data. 482 */ 483void dmu_prefetch(objset_t *os, uint64_t object, uint64_t offset, 484 uint64_t len); --- 90 unchanged lines hidden (view full) --- 575extern dmu_objset_type_t dmu_objset_type(objset_t *os); 576extern uint64_t dmu_objset_id(objset_t *os); 577extern int dmu_snapshot_list_next(objset_t *os, int namelen, char *name, 578 uint64_t *id, uint64_t *offp, boolean_t *case_conflict); 579extern int dmu_snapshot_realname(objset_t *os, char *name, char *real, 580 int maxlen, boolean_t *conflict); 581extern int dmu_dir_list_next(objset_t *os, int namelen, char *name, 582 uint64_t *idp, uint64_t *offp); |
583 584typedef void objset_used_cb_t(objset_t *os, dmu_object_type_t bonustype, 585 void *oldbonus, void *newbonus, uint64_t oldused, uint64_t newused, 586 dmu_tx_t *tx); 587extern void dmu_objset_register_type(dmu_objset_type_t ost, 588 objset_used_cb_t *cb); |
|
565extern void dmu_objset_set_user(objset_t *os, void *user_ptr); 566extern void *dmu_objset_get_user(objset_t *os); 567 568/* 569 * Return the txg number for the given assigned transaction. 570 */ 571uint64_t dmu_tx_get_txg(dmu_tx_t *tx); 572 --- 66 unchanged lines hidden --- | 589extern void dmu_objset_set_user(objset_t *os, void *user_ptr); 590extern void *dmu_objset_get_user(objset_t *os); 591 592/* 593 * Return the txg number for the given assigned transaction. 594 */ 595uint64_t dmu_tx_get_txg(dmu_tx_t *tx); 596 --- 66 unchanged lines hidden --- |