makefs: Align the block buffer used in ZFS mode
For some dnode types, particularly ZAPs, we want the buffer to have uint64_t alignment. Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
e3917bb256
commit
187084dddd
@ -34,6 +34,7 @@
|
||||
|
||||
#include <assert.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdalign.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
@ -69,7 +70,13 @@ struct dnode_cursor {
|
||||
void
|
||||
zfs_prep_opts(fsinfo_t *fsopts)
|
||||
{
|
||||
zfs_opt_t *zfs = ecalloc(1, sizeof(*zfs));
|
||||
size_t align;
|
||||
|
||||
align = alignof(uint64_t);
|
||||
zfs_opt_t *zfs = aligned_alloc(align, roundup2(sizeof(*zfs), align));
|
||||
if (zfs == NULL)
|
||||
err(1, "aligned_alloc");
|
||||
memset(zfs, 0, sizeof(*zfs));
|
||||
|
||||
const option_t zfs_options[] = {
|
||||
{ '\0', "bootfs", &zfs->bootfs, OPT_STRPTR,
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include <sys/queue.h>
|
||||
|
||||
#include <bitstring.h>
|
||||
#include <stdalign.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "makefs.h"
|
||||
@ -65,10 +66,13 @@ struct dataset_desc {
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
bool nowarn;
|
||||
/*
|
||||
* Block buffer, needs to be aligned for various on-disk structures,
|
||||
* ZAPs, etc..
|
||||
*/
|
||||
char filebuf[MAXBLOCKSIZE] __aligned(alignof(uint64_t));
|
||||
|
||||
/* I/O buffer, just for convenience. */
|
||||
char filebuf[MAXBLOCKSIZE];
|
||||
bool nowarn;
|
||||
|
||||
/* Pool parameters. */
|
||||
const char *poolname;
|
||||
|
Loading…
Reference in New Issue
Block a user