int error;
/*
+ * Enforce hammer filesystem version requirements
+ */
+ if (trans->hmp->version < HAMMER_VOL_VERSION_FIVE) {
+ kprintf("hammer: Filesystem must be upgraded to v5 "
+ "before you can run dedup\n");
+ return (EOPNOTSUPP);
+ }
+
+ /*
* Cursor1, return an error -> candidate goes to pass2 list
*/
error = hammer_init_cursor(trans, &cursor1, NULL, NULL);
* (3) Data overwrite for nohistory operations covered by REDO records
* can be supported (instead of rolling a new block allocation),
* by rolling UNDO for the prior contents of the data.
+ *
+ * HAMMER VERSION 5 CHANGES
+ *
+ * Hammer version 5 contains a minor adjustment making layer2's bytes_free
+ * field signed, allowing dedup to push it into the negative domain.
*/
#define HAMMER_HEAD_ONDISK_SIZE 32
#define HAMMER_HEAD_ALIGN 8
#define HAMMER_VOL_VERSION_MIN 1 /* minimum supported version */
#define HAMMER_VOL_VERSION_DEFAULT 4 /* newfs default version */
-#define HAMMER_VOL_VERSION_WIP 5 /* version >= this is WIP */
-#define HAMMER_VOL_VERSION_MAX 4 /* maximum supported version */
+#define HAMMER_VOL_VERSION_WIP 6 /* version >= this is WIP */
+#define HAMMER_VOL_VERSION_MAX 5 /* maximum supported version */
#define HAMMER_VOL_VERSION_ONE 1
#define HAMMER_VOL_VERSION_TWO 2 /* new dirent layout (2.3+) */
#define HAMMER_VOL_VERSION_THREE 3 /* new snapshot layout (2.5+) */
#define HAMMER_VOL_VERSION_FOUR 4 /* new undo/flush (2.5+) */
+#define HAMMER_VOL_VERSION_FIVE 5 /* dedup (2.9+) */
/*
* Record types are fairly straightforward. The B-Tree includes the record
ksnprintf(ver->description, sizeof(ver->description),
"New undo/flush, faster flush/sync (DragonFly 2.5+)");
break;
+ case 5:
+ ksnprintf(ver->description, sizeof(ver->description),
+ "Adjustments for dedup support (DragonFly 2.9+)");
+ break;
default:
ksnprintf(ver->description, sizeof(ver->description),
"Unknown");