Print this page
10592 misc. metaslab and vdev related ZoL bug fixes
Portions contributed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed by: Giuseppe Di Natale <guss80@gmail.com>
Reviewed by: George Melikov <mail@gmelikov.ru>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed by: Tony Hutter <hutter2@llnl.gov>
Reviewed by: Kody Kantor <kody.kantor@joyent.com>
Approved by: Dan McDonald <danmcd@joyent.com>

@@ -22,11 +22,11 @@
  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
 /*
- * Copyright (c) 2012, 2017 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2018 by Delphix. All rights reserved.
  */
 
 #ifndef _SYS_SPACE_MAP_H
 #define _SYS_SPACE_MAP_H
 

@@ -53,15 +53,22 @@
  *
  * Note the smp_object is no longer used but remains in the structure
  * for backward compatibility.
  */
 typedef struct space_map_phys {
-        uint64_t        smp_object;     /* on-disk space map object */
-        uint64_t        smp_objsize;    /* size of the object */
-        int64_t         smp_alloc;      /* space allocated from the map */
-        uint64_t        smp_pad[5];     /* reserved */
+        /* object number: not needed but kept for backwards compatibility */
+        uint64_t        smp_object;
 
+        /* length of the object in bytes */
+        uint64_t        smp_length;
+
+        /* space allocated from the map */
+        int64_t         smp_alloc;
+
+        /* reserved */
+        uint64_t        smp_pad[5];
+
         /*
          * The smp_histogram maintains a histogram of free regions. Each
          * bucket, smp_histogram[i], contains the number of free regions
          * whose size is:
          * 2^(i+sm_shift) <= size of free region in bytes < 2^(i+sm_shift+1)

@@ -79,12 +86,10 @@
  */
 typedef struct space_map {
         uint64_t        sm_start;       /* start of map */
         uint64_t        sm_size;        /* size of map */
         uint8_t         sm_shift;       /* unit shift */
-        uint64_t        sm_length;      /* synced length */
-        int64_t         sm_alloc;       /* synced space allocated */
         objset_t        *sm_os;         /* objset for this map */
         uint64_t        sm_object;      /* object id for this map */
         uint32_t        sm_blksz;       /* block size for space map */
         dmu_buf_t       *sm_dbuf;       /* space_map_phys_t dbuf */
         space_map_phys_t *sm_phys;      /* on-disk space map */

@@ -187,22 +192,24 @@
 boolean_t sm_entry_is_double_word(uint64_t e);
 
 typedef int (*sm_cb_t)(space_map_entry_t *sme, void *arg);
 
 int space_map_load(space_map_t *sm, range_tree_t *rt, maptype_t maptype);
-int space_map_iterate(space_map_t *sm, sm_cb_t callback, void *arg);
+int space_map_load_length(space_map_t *sm, range_tree_t *rt, maptype_t maptype,
+    uint64_t length);
+int space_map_iterate(space_map_t *sm, uint64_t length,
+    sm_cb_t callback, void *arg);
 int space_map_incremental_destroy(space_map_t *sm, sm_cb_t callback, void *arg,
     dmu_tx_t *tx);
 
+boolean_t space_map_histogram_verify(space_map_t *sm, range_tree_t *rt);
 void space_map_histogram_clear(space_map_t *sm);
 void space_map_histogram_add(space_map_t *sm, range_tree_t *rt,
     dmu_tx_t *tx);
 
-void space_map_update(space_map_t *sm);
-
 uint64_t space_map_object(space_map_t *sm);
-uint64_t space_map_allocated(space_map_t *sm);
+int64_t space_map_allocated(space_map_t *sm);
 uint64_t space_map_length(space_map_t *sm);
 
 void space_map_write(space_map_t *sm, range_tree_t *rt, maptype_t maptype,
     uint64_t vdev_id, dmu_tx_t *tx);
 uint64_t space_map_estimate_optimal_size(space_map_t *sm, range_tree_t *rt,

@@ -214,12 +221,10 @@
 
 int space_map_open(space_map_t **smp, objset_t *os, uint64_t object,
     uint64_t start, uint64_t size, uint8_t shift);
 void space_map_close(space_map_t *sm);
 
-int64_t space_map_alloc_delta(space_map_t *sm);
-
 #ifdef  __cplusplus
 }
 #endif
 
 #endif  /* _SYS_SPACE_MAP_H */