Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
sds
bake
Commits
72a714b9
Commit
72a714b9
authored
Jan 19, 2021
by
Philip Carns
Browse files
decouple alignment and superblock size
parent
61863b1c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/bake-file-backend.c
View file @
72a714b9
...
...
@@ -33,6 +33,12 @@
#define BAKE_ALIGN_UP(x) ((((unsigned long)(x)) + 4095) & (~(4095)))
#define BAKE_ALIGN_DOWN(x) ((unsigned long)(x) & (~(4095)))
/* The superblock contains metadata at the front of the log. This size is
* not tunable; it is set when the target is created. It must be a multiple
* of 4k to ensure that it works with directio on most (all?) platforms.
*/
#define BAKE_SUPERBLOCK_SIZE 4096
#define TRANSFER_DATA_READ 1
#define TRANSFER_DATA_WRITE 2
...
...
@@ -127,15 +133,16 @@ int bake_file_makepool(const char* file_name,
/* we'll put a full block at the front of the file, the first bytes of
* which will contain the bake_root_t
*/
ret
=
posix_memalign
((
void
**
)(
&
root
),
BAKE_ALIGNMENT
,
BAKE_ALIGNMENT
);
ret
=
posix_memalign
((
void
**
)(
&
root
),
BAKE_SUPERBLOCK_SIZE
,
BAKE_SUPERBLOCK_SIZE
);
assert
(
ret
==
0
);
memset
(
root
,
0
,
BAKE_
ALIGNMENT
);
memset
(
root
,
0
,
BAKE_
SUPERBLOCK_SIZE
);
/* store the target id for this bake pool at the root */
uuid_generate
(
root
->
pool_id
.
id
);
ret
=
write
(
fd
,
root
,
BAKE_
ALIGNMENT
);
if
(
ret
!=
BAKE_
ALIGNMENT
)
{
ret
=
write
(
fd
,
root
,
BAKE_
SUPERBLOCK_SIZE
);
if
(
ret
!=
BAKE_
SUPERBLOCK_SIZE
)
{
perror
(
"write"
);
free
(
root
);
return
(
BAKE_ERR_IO
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment