Print this page
3741 zfs needs better comments
Submitted by:   Will Andrews <willa@spectralogic.com>
Submitted by:   Justin Gibbs <justing@spectralogic.com>
Submitted by:   Alan Somers <alans@spectralogic.com>
Reviewed by:    Matthew Ahrens <mahrens@delphix.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/sys/dmu.h
          +++ new/usr/src/uts/common/fs/zfs/sys/dmu.h
↓ open down ↓ 401 lines elided ↑ open up ↑
 402  402      struct zio_prop *zp);
 403  403  /*
 404  404   * The bonus data is accessed more or less like a regular buffer.
 405  405   * You must dmu_bonus_hold() to get the buffer, which will give you a
 406  406   * dmu_buf_t with db_offset==-1ULL, and db_size = the size of the bonus
 407  407   * data.  As with any normal buffer, you must call dmu_buf_read() to
 408  408   * read db_data, dmu_buf_will_dirty() before modifying it, and the
 409  409   * object must be held in an assigned transaction before calling
 410  410   * dmu_buf_will_dirty.  You may use dmu_buf_set_user() on the bonus
 411  411   * buffer as well.  You must release your hold with dmu_buf_rele().
      412 + *
      413 + * Returns ENOENT, EIO, or 0.
 412  414   */
 413  415  int dmu_bonus_hold(objset_t *os, uint64_t object, void *tag, dmu_buf_t **);
 414  416  int dmu_bonus_max(void);
 415  417  int dmu_set_bonus(dmu_buf_t *, int, dmu_tx_t *);
 416  418  int dmu_set_bonustype(dmu_buf_t *, dmu_object_type_t, dmu_tx_t *);
 417  419  dmu_object_type_t dmu_get_bonustype(dmu_buf_t *);
 418  420  int dmu_rm_spill(objset_t *, uint64_t, dmu_tx_t *);
 419  421  
 420  422  /*
 421  423   * Special spill buffer support used by "SA" framework
↓ open down ↓ 235 lines elided ↑ open up ↑
 657  659  extern const dmu_object_byteswap_info_t dmu_ot_byteswap[DMU_BSWAP_NUMFUNCS];
 658  660  
 659  661  /*
 660  662   * Get information on a DMU object.
 661  663   *
 662  664   * Return 0 on success or ENOENT if object is not allocated.
 663  665   *
 664  666   * If doi is NULL, just indicates whether the object exists.
 665  667   */
 666  668  int dmu_object_info(objset_t *os, uint64_t object, dmu_object_info_t *doi);
      669 +/* Like dmu_object_info, but faster if you have a held dnode in hand. */
 667  670  void dmu_object_info_from_dnode(struct dnode *dn, dmu_object_info_t *doi);
      671 +/* Like dmu_object_info, but faster if you have a held dbuf in hand. */
 668  672  void dmu_object_info_from_db(dmu_buf_t *db, dmu_object_info_t *doi);
      673 +/*
      674 + * Like dmu_object_info_from_db, but faster still when you only care about
      675 + * the size.  This is specifically optimized for zfs_getattr().
      676 + */
 669  677  void dmu_object_size_from_db(dmu_buf_t *db, uint32_t *blksize,
 670  678      u_longlong_t *nblk512);
 671  679  
 672  680  typedef struct dmu_objset_stats {
 673  681          uint64_t dds_num_clones; /* number of clones of this */
 674  682          uint64_t dds_creation_txg;
 675  683          uint64_t dds_guid;
 676  684          dmu_objset_type_t dds_type;
 677  685          uint8_t dds_is_snapshot;
 678  686          uint8_t dds_inconsistent;
↓ open down ↓ 126 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX