kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: Valdis.Kletnieks@vt.edu (Valdis.Kletnieks at vt.edu)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Conceptual questions about device driver
Date: Fri, 02 Aug 2013 10:24:08 -0400	[thread overview]
Message-ID: <25238.1375453448@turing-police.cc.vt.edu> (raw)
In-Reply-To: Your message of "Thu, 01 Aug 2013 23:21:48 -0400." <4332d757-cefb-4427-a6c7-e0d0211c97ed@email.android.com>

On Thu, 01 Aug 2013 23:21:48 -0400, Greg Freemyer said:

> I should know, but I don't think your question makes sense.  Data transfers
> are axles immediately upon receipt by the drive.  When the drive actually puts
> it to stable storage there is not another ack message.

> I believe disk drives can typically cache a handful of tracks at a time.
> They can do a elevator sort internally on the tracks so the right order is not
> guarenteed but that has nothing to do with acks back to the driver.

In fact, the way that disk drives will flat-out lie about what they're doing
is a major challenge for filesystem designers.  In every filesystem, there are
places where things have to be committed to disk in a certain order for it
to maintain logical consistency in case of a crash mid-operation. For instance,
it's usually better to de-allocate blocks from a file, then add the blocks to
the free list, because a crash in between the two steps results in blocks you
can't allocate. That's better than the other way around, where after the crash
you can re-allocate blocks off the free list and overwrite existing data...

However, actual hardware is known to lie about *ALL* of the following:

1) Whether or not it has actually written a given block to disk.
2) What order writes happened in.
3) How large the disk's write buffer is (so you can't spam the drive with
dummy writes to force eviction of a write you care about)
4) Whether the disk's buffer cache is write-through or write-behind.
5) Whether a cache-flush request has completed, or merely been accepted
6) Whether the battery backup on a disk cache is enabled and functional
7) Whether there actually is a battery backup or not
8) Whether a disk's write cache is enabled or not.
9) Whether a disk *has* a write cache or not.

And that's just the hardware screw-ups that I've gotten burned by personally.
There's an even longer list of stupid hardware tricks I've heard about from
others over beers. ;)

This is why good filesystem designers almost always burn out and resort to
heavy drinking at a young age. ;)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 865 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130802/18d854cc/attachment.bin 

  reply	other threads:[~2013-08-02 14:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-01 20:55 Conceptual questions about device driver neha naik
2013-08-02  3:21 ` Greg Freemyer
2013-08-02 14:24   ` Valdis.Kletnieks at vt.edu [this message]
2013-08-02  5:32 ` Rajat Sharma
2013-08-02 19:56   ` Greg Freemyer
2013-08-02 21:10     ` neha naik
2013-08-02 22:33       ` Greg Freemyer
2013-08-02  5:55 ` Kumar Amit Mehta
  -- strict thread matches above, loose matches on Subject: below --
2013-08-03  3:55 Rajat Sharma
2013-08-03  4:39 Rajat Sharma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=25238.1375453448@turing-police.cc.vt.edu \
    --to=valdis.kletnieks@vt.edu \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).