Re: Spindle speed of Hard Disk- How to find

From: P.T. Breuer (ptb_at_oboe.it.uc3m.es)
Date: 05/01/04


Date: Sat, 1 May 2004 13:51:23 +0200

Kasper Dupont <kasperd@daimi.au.dk> wrote:
> "P.T. Breuer" wrote:
> > Unfortunately, that's byte-at-a-time, which is slow.
>
> Actually that is not the case. Using raw devices you must
> read a number of full sectors at a time. And it must to a
> sector aligned address.

I'm not aware of that. I have written character interfaces to block
devices and I have placed no restriction like that, but maybe it's
implicit. Let's see .... The idea is that one makes a fileops struct
which points at a typical char device interface. The "raw read and
write ops" make a kiovec out of the user request. You then walk the
pages of the iovec and make block requests out of each page (plus
offset), as a single-buffer request, and drop them onto your block
device queue.

Can't say that I've tested the result too far, however!

Umm .. since the block request counts in sectors, yes, it looks like we
can only make block requests straightforwardly if the original i/o was
sector aligned. Otherwise we are going to have to over-ask and select
what we want out of the response. It can be done, though.

> The performance can be good. I have had throughputs that
> were 50% higher than the cached reads reported by hdparm.
>
> The performance is very dependent on the number of sectors
> you read at a time. And it is not very predictable. IIRC
> I got good performance with 32KB and 128KB reads, but 64KB
> reads were a litle slower.
>
> I think raw devices combined with aio should give the best
> performance you can possible get from your hardware.
>
> But in this particular case I don't think performance
> really matters.
>
> > And you can't mount a character device!
>
> Why would you want to do that?

To get a whole file system which worked without (device) buffering.
(Yes, I know about the dentry cache ...).

> > The 2.6 way is to open the device with O_DIRECT. Unfortunately, reads
> > and writes have to be page aligned thereafter,
>
> Are you sure it is page aligned? I would expect sector
> aligned to be enough. (Not that it really makes much of
> a difference).

It varies/has varied. General consensus is that page alignment is safe
and if you get anything else to work you are essentially being lucky.
The reasoning is that you are doing without the VMS, so you must do the
work that the VMS would normally do for you. In that is included the
idea of only submitting requests to the device that are block-aligned.

But yes, even some file systems (xfs) issue sector aligned requests
when the block size is larger than a sector! And the block layer
requests can happily deal with sector sizes. So there is an indication
that sector alignment may be alright at that level ... but then there
are the horrors of pagestore backing .. shudder. I would stick to page
alignment for safety.

> I think reads done using the glibc stdio will actually
> be page aligned. But other than that you shouldn't

It has not been my experience. It is perfectly clear that read() and
write() are not page aligned, since you supply the buffer directly.
printf, maybe?

> expect programs to align their reads. I have modified a
> few of my own programs to align read buffers, but I only
> did so when I actually needed to use the program on a
> raw device (for performance reasons).

Interesting.

Peter



Relevant Pages

  • Re: dd(1) performance when copiing a disk to another (fwd)
    ... First issue: chopping requests. ... But the other issue is alignment. ... Therefore in addition to the size hint, a stripe width and stripe ... The first slice therefore starts in sector number 63. ...
    (freebsd-performance)
  • Re: Poor raid 1 performance?
    ... >> skipping the odd-numbered sector which is in between. ... With consequtive requests ... > other half to the other one, resulting in both drives reading ... And since the media have been written sequentially (I assume it, ...
    (comp.sys.ibm.pc.hardware.storage)
  • Re: 2.6.24-rc3-mm1: I/O error, system hangs
    ... I/O error, dev sda, sector 16460 ... We are blocking even special commands (ie requests with PREEMPT not set) ... This fixes a thinko of the FAILFAST handling: ...
    (Linux-Kernel)
  • Re: regression: disk error loop (panic?) ide_do_rw_disk-bad:
    ... On Tue, 17 Jul 2007, Bartlomiej Zolnierkiewicz wrote: ... last git changes to git give me the following error: ... Sure, ide-disk doesn't like non-fs requests, but I'm wondering why the ... stay as a zero (the IDE layer has some "turn zero into current sector ...
    (Linux-Kernel)
  • Re: DPC in Windows 2003
    ... I wonder where the check against the buffer size and alignment (sector ... Another words - is it kosher to fail requests that are ...
    (microsoft.public.development.device.drivers)