policy justification for requiring that block devices use power-of-two block sizes?
This question applies to all unices, but I'm interested mainly in the Linux kernel -- unless there are unices that don't have this restriction.
It seems like allowing non-power-of-two block sizes would greatly simplify things. However this is not allowed.
Question: is there something preventing a policy change to allow non-power-of-two block sizes for block devices? If not, what was the justification for the policy?
block-device
|
show 9 more comments
This question applies to all unices, but I'm interested mainly in the Linux kernel -- unless there are unices that don't have this restriction.
It seems like allowing non-power-of-two block sizes would greatly simplify things. However this is not allowed.
Question: is there something preventing a policy change to allow non-power-of-two block sizes for block devices? If not, what was the justification for the policy?
block-device
Motivation: a lot of "block layer wrappers" involve adding some small amount of extra metadata to each block. For example: dm-integrity adds a hash, dm-raid adds a generation number in RAID5 mode to close the RAID5 write hole, etc.
– user4718
Sep 6 '18 at 8:10
Unfortunately this small amount of extra metadata cannot be stored in the same block of the underlying device, so most drivers (including mdraid raid5, dm-integrity, LVM, bcache and similar) are forced to resort to keeping the data in an external journal, which is a much more complicated solution.
– user4718
Sep 6 '18 at 8:10
1
Doing this correctly in a way that is robust against power failures is almost as complicated as designing a proper filesystem, which is one reason why features like this have been pushed up into monolithic filesystems (like btrfs) instead of maintained as cleanly separated, small, and interchangeable elements in a layered design.
– user4718
Sep 6 '18 at 8:11
One of the most useful wrappers would be one which adds a checksum on every write and returns an I/O error on read if the checksum is invalid. For an underlying disk with 4k blocks and a 128-bit checksum this would mean a block size of 3968 exposed to the upper layers of the stack. For magnetic media no seeking back and forth between a block and the journal is required, since the checksum is stored in the same underlying device block as the data it covers.
– user4718
Sep 6 '18 at 8:11
Upper layers of the stack which choose a no-overwrite policy (i.e. COW or journal-like usage) could then safely assume that writes are all-or-nothing and even after a power failure no partially-written blocks will ever read back (of course write re-ordering is still a concern).
– user4718
Sep 6 '18 at 8:11
|
show 9 more comments
This question applies to all unices, but I'm interested mainly in the Linux kernel -- unless there are unices that don't have this restriction.
It seems like allowing non-power-of-two block sizes would greatly simplify things. However this is not allowed.
Question: is there something preventing a policy change to allow non-power-of-two block sizes for block devices? If not, what was the justification for the policy?
block-device
This question applies to all unices, but I'm interested mainly in the Linux kernel -- unless there are unices that don't have this restriction.
It seems like allowing non-power-of-two block sizes would greatly simplify things. However this is not allowed.
Question: is there something preventing a policy change to allow non-power-of-two block sizes for block devices? If not, what was the justification for the policy?
block-device
block-device
edited 1 hour ago
Rui F Ribeiro
39.6k1479132
39.6k1479132
asked Sep 6 '18 at 8:10
user4718user4718
1042
1042
Motivation: a lot of "block layer wrappers" involve adding some small amount of extra metadata to each block. For example: dm-integrity adds a hash, dm-raid adds a generation number in RAID5 mode to close the RAID5 write hole, etc.
– user4718
Sep 6 '18 at 8:10
Unfortunately this small amount of extra metadata cannot be stored in the same block of the underlying device, so most drivers (including mdraid raid5, dm-integrity, LVM, bcache and similar) are forced to resort to keeping the data in an external journal, which is a much more complicated solution.
– user4718
Sep 6 '18 at 8:10
1
Doing this correctly in a way that is robust against power failures is almost as complicated as designing a proper filesystem, which is one reason why features like this have been pushed up into monolithic filesystems (like btrfs) instead of maintained as cleanly separated, small, and interchangeable elements in a layered design.
– user4718
Sep 6 '18 at 8:11
One of the most useful wrappers would be one which adds a checksum on every write and returns an I/O error on read if the checksum is invalid. For an underlying disk with 4k blocks and a 128-bit checksum this would mean a block size of 3968 exposed to the upper layers of the stack. For magnetic media no seeking back and forth between a block and the journal is required, since the checksum is stored in the same underlying device block as the data it covers.
– user4718
Sep 6 '18 at 8:11
Upper layers of the stack which choose a no-overwrite policy (i.e. COW or journal-like usage) could then safely assume that writes are all-or-nothing and even after a power failure no partially-written blocks will ever read back (of course write re-ordering is still a concern).
– user4718
Sep 6 '18 at 8:11
|
show 9 more comments
Motivation: a lot of "block layer wrappers" involve adding some small amount of extra metadata to each block. For example: dm-integrity adds a hash, dm-raid adds a generation number in RAID5 mode to close the RAID5 write hole, etc.
– user4718
Sep 6 '18 at 8:10
Unfortunately this small amount of extra metadata cannot be stored in the same block of the underlying device, so most drivers (including mdraid raid5, dm-integrity, LVM, bcache and similar) are forced to resort to keeping the data in an external journal, which is a much more complicated solution.
– user4718
Sep 6 '18 at 8:10
1
Doing this correctly in a way that is robust against power failures is almost as complicated as designing a proper filesystem, which is one reason why features like this have been pushed up into monolithic filesystems (like btrfs) instead of maintained as cleanly separated, small, and interchangeable elements in a layered design.
– user4718
Sep 6 '18 at 8:11
One of the most useful wrappers would be one which adds a checksum on every write and returns an I/O error on read if the checksum is invalid. For an underlying disk with 4k blocks and a 128-bit checksum this would mean a block size of 3968 exposed to the upper layers of the stack. For magnetic media no seeking back and forth between a block and the journal is required, since the checksum is stored in the same underlying device block as the data it covers.
– user4718
Sep 6 '18 at 8:11
Upper layers of the stack which choose a no-overwrite policy (i.e. COW or journal-like usage) could then safely assume that writes are all-or-nothing and even after a power failure no partially-written blocks will ever read back (of course write re-ordering is still a concern).
– user4718
Sep 6 '18 at 8:11
Motivation: a lot of "block layer wrappers" involve adding some small amount of extra metadata to each block. For example: dm-integrity adds a hash, dm-raid adds a generation number in RAID5 mode to close the RAID5 write hole, etc.
– user4718
Sep 6 '18 at 8:10
Motivation: a lot of "block layer wrappers" involve adding some small amount of extra metadata to each block. For example: dm-integrity adds a hash, dm-raid adds a generation number in RAID5 mode to close the RAID5 write hole, etc.
– user4718
Sep 6 '18 at 8:10
Unfortunately this small amount of extra metadata cannot be stored in the same block of the underlying device, so most drivers (including mdraid raid5, dm-integrity, LVM, bcache and similar) are forced to resort to keeping the data in an external journal, which is a much more complicated solution.
– user4718
Sep 6 '18 at 8:10
Unfortunately this small amount of extra metadata cannot be stored in the same block of the underlying device, so most drivers (including mdraid raid5, dm-integrity, LVM, bcache and similar) are forced to resort to keeping the data in an external journal, which is a much more complicated solution.
– user4718
Sep 6 '18 at 8:10
1
1
Doing this correctly in a way that is robust against power failures is almost as complicated as designing a proper filesystem, which is one reason why features like this have been pushed up into monolithic filesystems (like btrfs) instead of maintained as cleanly separated, small, and interchangeable elements in a layered design.
– user4718
Sep 6 '18 at 8:11
Doing this correctly in a way that is robust against power failures is almost as complicated as designing a proper filesystem, which is one reason why features like this have been pushed up into monolithic filesystems (like btrfs) instead of maintained as cleanly separated, small, and interchangeable elements in a layered design.
– user4718
Sep 6 '18 at 8:11
One of the most useful wrappers would be one which adds a checksum on every write and returns an I/O error on read if the checksum is invalid. For an underlying disk with 4k blocks and a 128-bit checksum this would mean a block size of 3968 exposed to the upper layers of the stack. For magnetic media no seeking back and forth between a block and the journal is required, since the checksum is stored in the same underlying device block as the data it covers.
– user4718
Sep 6 '18 at 8:11
One of the most useful wrappers would be one which adds a checksum on every write and returns an I/O error on read if the checksum is invalid. For an underlying disk with 4k blocks and a 128-bit checksum this would mean a block size of 3968 exposed to the upper layers of the stack. For magnetic media no seeking back and forth between a block and the journal is required, since the checksum is stored in the same underlying device block as the data it covers.
– user4718
Sep 6 '18 at 8:11
Upper layers of the stack which choose a no-overwrite policy (i.e. COW or journal-like usage) could then safely assume that writes are all-or-nothing and even after a power failure no partially-written blocks will ever read back (of course write re-ordering is still a concern).
– user4718
Sep 6 '18 at 8:11
Upper layers of the stack which choose a no-overwrite policy (i.e. COW or journal-like usage) could then safely assume that writes are all-or-nothing and even after a power failure no partially-written blocks will ever read back (of course write re-ordering is still a concern).
– user4718
Sep 6 '18 at 8:11
|
show 9 more comments
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f467231%2fpolicy-justification-for-requiring-that-block-devices-use-power-of-two-block-siz%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f467231%2fpolicy-justification-for-requiring-that-block-devices-use-power-of-two-block-siz%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Motivation: a lot of "block layer wrappers" involve adding some small amount of extra metadata to each block. For example: dm-integrity adds a hash, dm-raid adds a generation number in RAID5 mode to close the RAID5 write hole, etc.
– user4718
Sep 6 '18 at 8:10
Unfortunately this small amount of extra metadata cannot be stored in the same block of the underlying device, so most drivers (including mdraid raid5, dm-integrity, LVM, bcache and similar) are forced to resort to keeping the data in an external journal, which is a much more complicated solution.
– user4718
Sep 6 '18 at 8:10
1
Doing this correctly in a way that is robust against power failures is almost as complicated as designing a proper filesystem, which is one reason why features like this have been pushed up into monolithic filesystems (like btrfs) instead of maintained as cleanly separated, small, and interchangeable elements in a layered design.
– user4718
Sep 6 '18 at 8:11
One of the most useful wrappers would be one which adds a checksum on every write and returns an I/O error on read if the checksum is invalid. For an underlying disk with 4k blocks and a 128-bit checksum this would mean a block size of 3968 exposed to the upper layers of the stack. For magnetic media no seeking back and forth between a block and the journal is required, since the checksum is stored in the same underlying device block as the data it covers.
– user4718
Sep 6 '18 at 8:11
Upper layers of the stack which choose a no-overwrite policy (i.e. COW or journal-like usage) could then safely assume that writes are all-or-nothing and even after a power failure no partially-written blocks will ever read back (of course write re-ordering is still a concern).
– user4718
Sep 6 '18 at 8:11