sys/vfs/hammer: Use HAMMER_BUFSIZE_DOALIGN() and variants
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Mon, 7 Nov 2016 15:12:54 +0000 (00:12 +0900)
committerTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Tue, 8 Nov 2016 14:20:47 +0000 (23:20 +0900)
This should have been in bbc5e78b (failed to catch these).

sys/vfs/hammer/hammer_object.c
sys/vfs/hammer/hammer_ondisk.c
sys/vfs/hammer/hammer_vnops.c

index a81abeb..bc82b38 100644 (file)
@@ -1186,8 +1186,7 @@ hammer_ip_sync_record_cursor(hammer_cursor_t cursor, hammer_record_t record)
        if (record->type == HAMMER_MEM_RECORD_DATA &&
            hammer_record_needs_overwrite_delete(record)) {
                file_offset = record->leaf.base.key - record->leaf.data_len;
-               bytes = (record->leaf.data_len + HAMMER_BUFMASK) &
-                       ~HAMMER_BUFMASK;
+               bytes = HAMMER_BUFSIZE_DOALIGN(record->leaf.data_len);
                KKASSERT((file_offset & HAMMER_BUFMASK) == 0);
                error = hammer_ip_delete_range(
                                cursor, record->ip,
index 5e759d8..83db7bc 100644 (file)
@@ -1657,8 +1657,7 @@ hammer_alloc_data(hammer_transaction_t trans, int32_t data_len,
                        zone = hammer_data_zone_index(data_len);
                        if (zone == HAMMER_ZONE_LARGE_DATA_INDEX) {
                                /* round up */
-                               data_len = (data_len + HAMMER_BUFMASK) &
-                                          ~HAMMER_BUFMASK;
+                               data_len = HAMMER_BUFSIZE_DOALIGN(data_len);
                        }
                        break;
                default:
index 55549fb..45b8b41 100644 (file)
@@ -1055,11 +1055,9 @@ hammer_vop_getattr(struct vop_getattr_args *ap)
        vap->va_gen = 1;        /* hammer inums are unique for all time */
        vap->va_blocksize = HAMMER_BUFSIZE;
        if (ip->ino_data.size >= HAMMER_XDEMARC) {
-               vap->va_bytes = (ip->ino_data.size + HAMMER_XBUFMASK64) &
-                               ~HAMMER_XBUFMASK64;
+               vap->va_bytes = HAMMER_XBUFSIZE64_DOALIGN(ip->ino_data.size);
        } else if (ip->ino_data.size > HAMMER_HBUFSIZE) {
-               vap->va_bytes = (ip->ino_data.size + HAMMER_BUFMASK64) &
-                               ~HAMMER_BUFMASK64;
+               vap->va_bytes = HAMMER_BUFSIZE64_DOALIGN(ip->ino_data.size);
        } else {
                vap->va_bytes = HAMMER_DATA_DOALIGN(ip->ino_data.size);
        }