sys/vfs/hammer: Add HAMMER_BIGBLOCK_DOALIGN()
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Mon, 7 Nov 2016 14:53:08 +0000 (23:53 +0900)
committerTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Tue, 8 Nov 2016 14:20:47 +0000 (23:20 +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/ondisk.c
sys/vfs/hammer/hammer_disk.h
sys/vfs/hammer/hammer_io.c
sys/vfs/hammer/hammer_ondisk.c

index 4d48e25..1357d1d 100644 (file)
@@ -695,8 +695,7 @@ format_undomap(struct volume_info *root_vol, int64_t *undo_buffer_size)
                if (undo_limit < HAMMER_BIGBLOCK_SIZE * HAMMER_MIN_UNDO_BIGBLOCKS)
                        undo_limit = HAMMER_BIGBLOCK_SIZE * HAMMER_MIN_UNDO_BIGBLOCKS;
        }
-       undo_limit = (undo_limit + HAMMER_BIGBLOCK_MASK64) &
-                    ~HAMMER_BIGBLOCK_MASK64;
+       undo_limit = HAMMER_BIGBLOCK_DOALIGN(undo_limit);
        if (undo_limit < HAMMER_BIGBLOCK_SIZE)
                undo_limit = HAMMER_BIGBLOCK_SIZE;
        if (undo_limit > HAMMER_BIGBLOCK_SIZE * HAMMER_MAX_UNDO_BIGBLOCKS)
index 3e928f7..d88ae28 100644 (file)
@@ -361,6 +361,9 @@ typedef uint32_t hammer_crc_t;
 #define HAMMER_BUFFERS_PER_BIGBLOCK_MASK64             \
        ((hammer_off_t)HAMMER_BUFFERS_PER_BIGBLOCK_MASK)
 
+#define HAMMER_BIGBLOCK_DOALIGN(offset)                                \
+       (((offset) + HAMMER_BIGBLOCK_MASK64) & ~HAMMER_BIGBLOCK_MASK64)
+
 /*
  * Maximum number of mirrors operating in master mode (multi-master
  * clustering and mirroring). Note that HAMMER1 does not support
index 487b512..b4d0c46 100644 (file)
@@ -1581,8 +1581,7 @@ hammer_io_indirect_read(hammer_mount_t hmp, struct bio *bio,
 
                hce = hammer_cluster_enable;
                if (hce > 0) {
-                       limit = (zone2_offset + HAMMER_BIGBLOCK_MASK64) &
-                               ~HAMMER_BIGBLOCK_MASK64;
+                       limit = HAMMER_BIGBLOCK_DOALIGN(zone2_offset);
                        limit -= zone2_offset;
                        cluster_readcb(volume->devvp, limit, buf_offset,
                                       bp->b_bufsize,
index 253bec5..5e759d8 100644 (file)
@@ -909,9 +909,7 @@ hammer_load_buffer(hammer_buffer_t buffer, int isnew)
                } else {
                        hammer_off_t limit;
 
-                       limit = (buffer->zone2_offset +
-                                HAMMER_BIGBLOCK_MASK64) &
-                               ~HAMMER_BIGBLOCK_MASK64;
+                       limit = HAMMER_BIGBLOCK_DOALIGN(buffer->zone2_offset);
                        limit -= buffer->zone2_offset;
                        error = hammer_io_read(volume->devvp, &buffer->io,
                                               limit);