Skip to content

Commit

Permalink
dm persistent data: packed struct should have an aligned() attribute too
Browse files Browse the repository at this point in the history
Otherwise most non-x86 architectures (e.g. riscv, arm) will resort to
byte-by-byte access.

Cc: [email protected]
Signed-off-by: Joe Thornber <[email protected]>
Signed-off-by: Mike Snitzer <[email protected]>
  • Loading branch information
jthornber authored and snitm committed Apr 19, 2021
1 parent f73e2e7 commit a88b235
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions drivers/md/persistent-data/dm-btree-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ struct node_header {
__le32 max_entries;
__le32 value_size;
__le32 padding;
} __packed;
} __attribute__((packed, aligned(8)));

struct btree_node {
struct node_header header;
__le64 keys[];
} __packed;
} __attribute__((packed, aligned(8)));


/*
Expand Down
8 changes: 4 additions & 4 deletions drivers/md/persistent-data/dm-space-map-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct disk_index_entry {
__le64 blocknr;
__le32 nr_free;
__le32 none_free_before;
} __packed;
} __attribute__ ((packed, aligned(8)));


#define MAX_METADATA_BITMAPS 255
Expand All @@ -43,7 +43,7 @@ struct disk_metadata_index {
__le64 blocknr;

struct disk_index_entry index[MAX_METADATA_BITMAPS];
} __packed;
} __attribute__ ((packed, aligned(8)));

struct ll_disk;

Expand Down Expand Up @@ -86,15 +86,15 @@ struct disk_sm_root {
__le64 nr_allocated;
__le64 bitmap_root;
__le64 ref_count_root;
} __packed;
} __attribute__ ((packed, aligned(8)));

#define ENTRIES_PER_BYTE 4

struct disk_bitmap_header {
__le32 csum;
__le32 not_used;
__le64 blocknr;
} __packed;
} __attribute__ ((packed, aligned(8)));

enum allocation_event {
SM_NONE,
Expand Down

0 comments on commit a88b235

Please sign in to comment.