diff --git a/lib/ftl/ftl_band.h b/lib/ftl/ftl_band.h index cba5e709a..82dabe3d1 100644 --- a/lib/ftl/ftl_band.h +++ b/lib/ftl/ftl_band.h @@ -64,6 +64,9 @@ struct ftl_band_md { /* nv_cache p2l md region associated with band */ enum ftl_layout_region_type p2l_md_region; + /* Reserved */ + uint8_t reserved[4]; + /* Sequence ID when band was opened */ uint64_t seq; @@ -78,7 +81,10 @@ struct ftl_band_md { /* CRC32 checksum of the associated P2L map when band is in closed state */ uint32_t p2l_map_checksum; -} __attribute__((aligned(FTL_BLOCK_SIZE))); + + /* Reserved */ + uint8_t reserved2[4028]; +} __attribute__((packed)); SPDK_STATIC_ASSERT(sizeof(struct ftl_band_md) == FTL_BLOCK_SIZE, "Incorrect metadata size"); diff --git a/lib/ftl/ftl_nv_cache.h b/lib/ftl/ftl_nv_cache.h index c32fc413d..d68493985 100644 --- a/lib/ftl/ftl_nv_cache.h +++ b/lib/ftl/ftl_nv_cache.h @@ -83,7 +83,10 @@ struct ftl_nv_cache_chunk_md { /* CRC32 checksum of the associated P2L map when chunk is in closed state */ uint32_t p2l_map_checksum; -} __attribute__((aligned(FTL_BLOCK_SIZE))); + + /* Reserved */ + uint8_t reserved[4052]; +} __attribute__((packed)); #define FTL_NV_CACHE_CHUNK_MD_SIZE sizeof(struct ftl_nv_cache_chunk_md) SPDK_STATIC_ASSERT(FTL_NV_CACHE_CHUNK_MD_SIZE == FTL_BLOCK_SIZE, diff --git a/lib/ftl/ftl_sb_common.h b/lib/ftl/ftl_sb_common.h index c667e288b..d0b26bed4 100644 --- a/lib/ftl/ftl_sb_common.h +++ b/lib/ftl/ftl_sb_common.h @@ -33,13 +33,17 @@ struct ftl_superblock_gc_info { uint64_t band_phys_id; /* May be updating multiple fields at the same time, clearing/setting this marks the transaction */ uint64_t is_valid; -}; +} __attribute__((packed)); +SPDK_STATIC_ASSERT(sizeof(struct ftl_superblock_gc_info) == 32, + "ftl_superblock_gc_info incorrect size"); struct ftl_superblock_header { uint64_t magic; uint64_t crc; uint64_t version; -}; +} __attribute__((packed)); +SPDK_STATIC_ASSERT(sizeof(struct ftl_superblock_header) == 24, + "ftl_superblock_header incorrect size"); struct ftl_superblock_md_region { uint32_t type; @@ -47,7 +51,9 @@ struct ftl_superblock_md_region { uint64_t blk_offs; uint64_t blk_sz; ftl_df_obj_id df_next; -}; +} __attribute__((packed)); +SPDK_STATIC_ASSERT(sizeof(struct ftl_superblock_md_region) == 32, + "ftl_superblock_md_region incorrect size"); struct ftl_superblock_shm { /* SHM initialization completed */ diff --git a/lib/ftl/ftl_sb_current.h b/lib/ftl/ftl_sb_current.h index b4ab2f656..4a8f233eb 100644 --- a/lib/ftl/ftl_sb_current.h +++ b/lib/ftl/ftl_sb_current.h @@ -32,12 +32,8 @@ struct ftl_superblock { /* Maximum IO depth per band relocate */ uint64_t max_reloc_qdepth; - /* Reserved fields */ - uint64_t reserved; - - bool reserved3; - - uint32_t reserved2; + /* Reserved field */ + uint8_t reserved3[16]; /* Last L2P checkpoint +1 (i.e. min_seq_id, 0:no ckpt) */ uint64_t ckpt_seq_id; @@ -45,7 +41,7 @@ struct ftl_superblock { struct ftl_superblock_gc_info gc_info; struct ftl_superblock_md_region md_layout_head; -}; +} __attribute__((packed)); SPDK_STATIC_ASSERT(offsetof(struct ftl_superblock, header) == 0, "Invalid placement of header");