sys/vfs/hammer: Add HAMMER_UNDO_DOALIGN()
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Wed, 9 Nov 2016 15:56:25 +0000 (00:56 +0900)
committerTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Fri, 11 Nov 2016 18:15:39 +0000 (03:15 +0900)
The only reason it's "DOALIGN" instead of just "ALIGN" is
because that's how macros have been named in HAMMER1/2.
"ALIGN" macros represent alignment size.

sbin/hammer/cmd_blockmap.c
sbin/hammer/cmd_show.c
sys/vfs/hammer/hammer_disk.h

index ed6092b..d6bc636 100644 (file)
@@ -359,8 +359,7 @@ check_undo(hammer_blockmap_t undomap)
                     head->hdr_size > HAMMER_UNDO_ALIGN -
                        ((u_int)scan_offset & HAMMER_UNDO_MASK)) {
                        printf("Illegal size, skipping to next boundary\n");
-                       scan_offset = (scan_offset + HAMMER_UNDO_MASK) &
-                                       ~HAMMER_UNDO_MASK64;
+                       scan_offset = HAMMER_UNDO_DOALIGN(scan_offset);
                } else {
                        scan_offset += head->hdr_size;
                }
index 3b870d8..22099dd 100644 (file)
@@ -1069,8 +1069,7 @@ hammer_cmd_show_undo(void)
                                    ((u_int)scan_offset & HAMMER_UNDO_MASK)) {
                        printf("Illegal size field, skipping to "
                               "next boundary\n");
-                       scan_offset = (scan_offset + HAMMER_UNDO_MASK) &
-                                       ~HAMMER_UNDO_MASK64;
+                       scan_offset = HAMMER_UNDO_DOALIGN(scan_offset);
                } else {
                        scan_offset += head->head.hdr_size;
                }
index 1159f1d..849e361 100644 (file)
@@ -570,6 +570,8 @@ typedef struct hammer_blockmap_layer2 {
 #define HAMMER_UNDO_ALIGN64            ((uint64_t)512)
 #define HAMMER_UNDO_MASK               (HAMMER_UNDO_ALIGN - 1)
 #define HAMMER_UNDO_MASK64             (HAMMER_UNDO_ALIGN64 - 1)
+#define HAMMER_UNDO_DOALIGN(offset)    \
+       (((offset) + HAMMER_UNDO_MASK) & ~HAMMER_UNDO_MASK64)
 
 typedef struct hammer_fifo_head {
        uint16_t hdr_signature;