HAMMER Utilities: Sync with recent changes.
authorMatthew Dillon <dillon@dragonflybsd.org>
Tue, 6 May 2008 00:15:35 +0000 (00:15 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Tue, 6 May 2008 00:15:35 +0000 (00:15 +0000)
* Add some missing crc initializations.

* Fix an assertion that was breaking newfs_hammer on large disks.

sbin/hammer/ondisk.c
sbin/newfs_hammer/newfs_hammer.c

index 0f0d12e..5c4ac94 100644 (file)
@@ -31,7 +31,7 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  * 
- * $DragonFly: src/sbin/hammer/ondisk.c,v 1.16 2008/05/05 20:34:52 dillon Exp $
+ * $DragonFly: src/sbin/hammer/ondisk.c,v 1.17 2008/05/06 00:15:33 dillon Exp $
  */
 
 #include <sys/types.h>
@@ -564,7 +564,7 @@ format_undomap(hammer_volume_ondisk_t ondisk)
        scan = blockmap->next_offset;
        limit_index = undo_limit / HAMMER_LARGEBLOCK_SIZE;
 
-       assert(limit_index < HAMMER_UNDO_LAYER2);
+       assert(limit_index <= HAMMER_UNDO_LAYER2);
 
        for (n = 0; n < limit_index; ++n) {
                layer2->u.phys_offset = alloc_bigblock(NULL, scan);
index d11e5e6..c07f95c 100644 (file)
@@ -31,7 +31,7 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  * 
- * $DragonFly: src/sbin/newfs_hammer/newfs_hammer.c,v 1.23 2008/04/29 01:11:02 dillon Exp $
+ * $DragonFly: src/sbin/newfs_hammer/newfs_hammer.c,v 1.24 2008/05/06 00:15:35 dillon Exp $
  */
 
 #include "newfs_hammer.h"
@@ -488,11 +488,15 @@ format_root(void)
        rec->inode.ino_mtime  = rec->base.base.create_tid;
        rec->inode.ino_size   = 0;
        rec->inode.ino_nlinks = 1;
+       rec->base.signature = HAMMER_RECORD_SIGNATURE_GOOD;
+       rec->base.rec_crc = crc32(&rec->base.rec_crc + 1,
+                               HAMMER_RECORD_SIZE - sizeof(rec->base.rec_crc));
 
        /*
         * Create the root of the B-Tree.  The root is a leaf node so we
         * do not have to worry about boundary elements.
         */
+       bnode->signature = HAMMER_BTREE_SIGNATURE_GOOD;
        bnode->count = 1;
        bnode->type = HAMMER_BTREE_TYPE_LEAF;
 
@@ -502,6 +506,10 @@ format_root(void)
        elm->leaf.data_offset = rec->base.data_off;
        elm->leaf.data_len = rec->base.data_len;
        elm->leaf.data_crc = rec->base.data_crc;
+
+       bnode->crc = crc32(&bnode->crc + 1,
+                          sizeof(*bnode) - sizeof(bnode->crc));
+
        return(btree_off);
 }