Skip to contentSkip to conversation

size-in-bytes

PATCH [email protected] 1 participant 1 message Feb 21, 2002

lore
Share & tools
lore
#0 lore raw

From: Benjamin LaHaise <[email protected]>

Using the number of sectors in kernel is perhaps more efficient, but it is a microoptimization that won't show up on any benchmarks.

Yes. Since we have to go to 64-bit anyway it is not more space-efficient, but of course shifting over 3 positions is slightly faster than shifting over 12 positions. But as you say, timewise there is no measurable difference, while the code becomes much simpler.

There is also the point that a block device need not have a size that is an integral number of sectors. That is most obvious with the loop device, but also occurs elsewhere.
The partition making ioctls (and the loop mount options) allow one to give a starting offset in bytes.

Thus, there are applications where it is really useful to have the precise size, rather than the approximate size in sectors. Also nbd uses the size in bytes, while amiga uses 256-byte sectors.

Andries