A quick and easy performance improvement
Logan Shaw
lshaw at emitinc.com
Wed Jul 26 21:20:44 IST 2006
On Wed, 26 Jul 2006, Julian Field wrote:
> But you have absolutely no control whatsoever of the mapping from logical
> disk block number to physical location on the disk. Who's to say that your
> disk doesn't start from the inside and work outwards. You have *absolutely*
> no control nor knowledge of how this is laid out. Do they use a complete
> platter before the next one, or do they use the platters in turn for each
> disk block? You have no way of knowing or controlling this configuration.
> Pretending to know how a disk is laid out these days is a total fallacy.
Hmm, I have a different understanding about that issue.
The way I understand it, in the old days, disks packed the same
number of data into a sector regardless of whether it was near
the spindle or near the edge of the platter. This made sense
because changing the angular velocity of the platter is not
even close to feasible and old drives' electronics read at a
fixed data rate. Hence, a fixed amount of data would occur
within a given change of angle, even though that meant lower
linear density on the outside and higher linear density on
the inside of the platter.
On those old disks, one could really know which head, track,
and sector number corresponded to what part of the disk.
Then two changes happened.
The first change was that the linear density was increased near
the outer edge of the platter. This was accomplished not by
changing the rotational speed of the platter but by changing
the electronics so that they read and write at a data rate
(different clock). There is still variation in linear density
because there are not that many different clock rates, but the
variation is much smaller and thus you can pack more on a disk.
The second change was that bad-block remapping can sometimes
be done in the disk's on-board controller.
So, on to the implications. Both changes make distance from
spindle a non-linear function of logical block number. However,
as I understand it, the first change makes it non-linear
but still leaves it as a non-decreasing function. That is,
if block B has a logical block number which is double that
of block A, then block B won't be exactly twice as far from
the spindle as block A is. BUT, it is still guaranteed to be
further away from the spindle (or at least no closer). As for
the second change, so few blocks are affected (hopefully!)
that the effect is pretty much negligible.
To summarize, the way I understand it, the mapping between
logical block number and actual location isn't as simple as it
used to be, but there still remains a very strong correlation
between being far apart in the logical block address space
and having high seek times.
> With journalling filesystems this is totally irrelevant. They just replay the
> log (a matter of milliseconds) and come back up.
With one tiny exception: that you're not on an operating system
where you've corrupted some important boot files and the boot
loader can't understand the journal. Usually the journal
replay happens after the kernel is loaded, so if the kernel
or other files used early in the boot process are damaged,
it could prevent a boot even on a journaled filesystem.
Or at least this is the reason Sun gave for a long time for
not recommending turning on the journal for the root filesystem.
- Logan
More information about the MailScanner
mailing list