Update core ZFS code from build 121 to build 141.
[zfs.git] / module / zfs / include / sys / dbuf.h
index 2678525..4c05806 100644 (file)
@@ -19,8 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  */
 
 #ifndef        _SYS_DBUF_H
@@ -38,7 +37,6 @@
 extern "C" {
 #endif
 
-#define        DB_BONUS_BLKID (-1ULL)
 #define        IN_DMU_SYNC 2
 
 /*
@@ -75,7 +73,6 @@ typedef enum dbuf_states {
        DB_EVICTING
 } dbuf_states_t;
 
-struct objset_impl;
 struct dnode;
 struct dmu_tx;
 
@@ -134,6 +131,7 @@ typedef struct dbuf_dirty_record {
                        arc_buf_t *dr_data;
                        blkptr_t dr_overridden_by;
                        override_states_t dr_override_state;
+                       uint8_t dr_copies;
                } dl;
        } dt;
 } dbuf_dirty_record_t;
@@ -148,7 +146,7 @@ typedef struct dmu_buf_impl {
        dmu_buf_t db;
 
        /* the objset we belong to */
-       struct objset_impl *db_objset;
+       struct objset *db_objset;
 
        /*
         * the dnode we belong to (NULL when evicted)
@@ -242,6 +240,10 @@ uint64_t dbuf_whichblock(struct dnode *di, uint64_t offset);
 
 dmu_buf_impl_t *dbuf_create_tlib(struct dnode *dn, char *data);
 void dbuf_create_bonus(struct dnode *dn);
+int dbuf_spill_set_blksz(dmu_buf_t *db, uint64_t blksz, dmu_tx_t *tx);
+void dbuf_spill_hold(struct dnode *dn, dmu_buf_impl_t **dbp, void *tag);
+
+void dbuf_rm_spill(struct dnode *dn, dmu_tx_t *tx);
 
 dmu_buf_impl_t *dbuf_hold(struct dnode *dn, uint64_t blkid, void *tag);
 dmu_buf_impl_t *dbuf_hold_level(struct dnode *dn, int level, uint64_t blkid,
@@ -255,6 +257,7 @@ void dbuf_add_ref(dmu_buf_impl_t *db, void *tag);
 uint64_t dbuf_refcount(dmu_buf_impl_t *db);
 
 void dbuf_rele(dmu_buf_impl_t *db, void *tag);
+void dbuf_rele_and_unlock(dmu_buf_impl_t *db, void *tag);
 
 dmu_buf_impl_t *dbuf_find(struct dnode *dn, uint8_t level, uint64_t blkid);
 
@@ -266,6 +269,7 @@ void dmu_buf_will_fill(dmu_buf_t *db, dmu_tx_t *tx);
 void dmu_buf_fill_done(dmu_buf_t *db, dmu_tx_t *tx);
 void dbuf_assign_arcbuf(dmu_buf_impl_t *db, arc_buf_t *buf, dmu_tx_t *tx);
 dbuf_dirty_record_t *dbuf_dirty(dmu_buf_impl_t *db, dmu_tx_t *tx);
+arc_buf_t *dbuf_loan_arcbuf(dmu_buf_impl_t *db);
 
 void dbuf_clear(dmu_buf_impl_t *db);
 void dbuf_evict(dmu_buf_impl_t *db);
@@ -273,6 +277,7 @@ void dbuf_evict(dmu_buf_impl_t *db);
 void dbuf_setdirty(dmu_buf_impl_t *db, dmu_tx_t *tx);
 void dbuf_unoverride(dbuf_dirty_record_t *dr);
 void dbuf_sync_list(list_t *list, dmu_tx_t *tx);
+void dbuf_release_bp(dmu_buf_impl_t *db);
 
 void dbuf_free_range(struct dnode *dn, uint64_t start, uint64_t end,
     struct dmu_tx *);
@@ -324,7 +329,7 @@ _NOTE(CONSTCOND) } while (0)
 #define        dprintf_dbuf_bp(db, bp, fmt, ...) do {                  \
        if (zfs_flags & ZFS_DEBUG_DPRINTF) {                    \
        char *__blkbuf = kmem_alloc(BP_SPRINTF_LEN, KM_SLEEP);  \
-       sprintf_blkptr(__blkbuf, BP_SPRINTF_LEN, bp);           \
+       sprintf_blkptr(__blkbuf, bp);                           \
        dprintf_dbuf(db, fmt " %s\n", __VA_ARGS__, __blkbuf);   \
        kmem_free(__blkbuf, BP_SPRINTF_LEN);                    \
        }                                                       \