Print this page
patch first-pass

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 ↓ 525 lines elided ↑ open up ↑
 526  526   * Users requesting "immediate eviction" are notified as soon as the dbuf
 527  527   * is only referenced by dirty records (dirties == holds).  Otherwise the
 528  528   * notification occurs after eviction processing for the dbuf begins.
 529  529   */
 530  530  typedef struct dmu_buf_user {
 531  531          /*
 532  532           * Asynchronous user eviction callback state.
 533  533           */
 534  534          taskq_ent_t     dbu_tqent;
 535  535  
 536      -        /* This instance's eviction function pointer. */
      536 +        /*
      537 +         * This instance's eviction function pointers.
      538 +         *
      539 +         * dbu_evict_func_prep is called synchronously while dbu_evict_func
      540 +         * is executed asynchronously on a taskq.
      541 +         */
      542 +        dmu_buf_evict_func_t *dbu_evict_func_prep;
 537  543          dmu_buf_evict_func_t *dbu_evict_func;
 538  544  #ifdef ZFS_DEBUG
 539  545          /*
 540  546           * Pointer to user's dbuf pointer.  NULL for clients that do
 541  547           * not associate a dbuf with their user data.
 542  548           *
 543  549           * The dbuf pointer is cleared upon eviction so as to catch
 544  550           * use-after-evict bugs in clients.
 545  551           */
 546  552          dmu_buf_t **dbu_clear_on_evict_dbufp;
↓ open down ↓ 3 lines elided ↑ open up ↑
 550  556  /*
 551  557   * Initialize the given dmu_buf_user_t instance with the eviction function
 552  558   * evict_func, to be called when the user is evicted.
 553  559   *
 554  560   * NOTE: This function should only be called once on a given dmu_buf_user_t.
 555  561   *       To allow enforcement of this, dbu must already be zeroed on entry.
 556  562   */
 557  563  #ifdef __lint
 558  564  /* Very ugly, but it beats issuing suppression directives in many Makefiles. */
 559  565  extern void
 560      -dmu_buf_init_user(dmu_buf_user_t *dbu, dmu_buf_evict_func_t *evict_func,
 561      -    dmu_buf_t **clear_on_evict_dbufp);
      566 +dmu_buf_init_user(dmu_buf_user_t *dbu, dmu_buf_evict_func_t *evict_func_prep,
      567 +    dmu_buf_evict_func_t *evict_func, dmu_buf_t **clear_on_evict_dbufp);
 562  568  #else /* __lint */
 563  569  inline void
 564      -dmu_buf_init_user(dmu_buf_user_t *dbu, dmu_buf_evict_func_t *evict_func,
 565      -    dmu_buf_t **clear_on_evict_dbufp)
      570 +dmu_buf_init_user(dmu_buf_user_t *dbu, dmu_buf_evict_func_t *evict_func_prep,
      571 +    dmu_buf_evict_func_t *evict_func, dmu_buf_t **clear_on_evict_dbufp)
 566  572  {
      573 +        ASSERT(dbu->dbu_evict_func_prep == NULL);
 567  574          ASSERT(dbu->dbu_evict_func == NULL);
 568  575          ASSERT(evict_func != NULL);
      576 +        dbu->dbu_evict_func_prep = evict_func_prep;
 569  577          dbu->dbu_evict_func = evict_func;
 570  578  #ifdef ZFS_DEBUG
 571  579          dbu->dbu_clear_on_evict_dbufp = clear_on_evict_dbufp;
 572  580  #endif
 573  581  }
 574  582  #endif /* __lint */
 575  583  
 576  584  /*
 577  585   * Attach user data to a dbuf and mark it for normal (when the dbuf's
 578  586   * data is cleared or its reference count goes to zero) eviction processing.
↓ open down ↓ 367 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX