From: Michael Tokarev <mjt@tls.msk.ru>
To: Ingo Oeser <ioe-lkml@rameria.de>
Cc: Wu Fengguang <wfg@mail.ustc.edu.cn>,
Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org, Jens Axboe <axboe@suse.de>
Subject: Re: [PATCH 4/5] readahead: backoff on I/O error
Date: Sat, 10 Jun 2006 23:48:45 +0400 [thread overview]
Message-ID: <448B221D.3080907@tls.msk.ru> (raw)
In-Reply-To: <200606102033.46844.ioe-lkml@rameria.de>
Ingo Oeser wrote:
> Hi Fengguang,
>
> On Friday, 9. June 2006 10:08, Wu Fengguang wrote:
>> Backoff readahead size exponentially on I/O error.
>
>> With this patch, retries are expected to be reduced from, say, 256, to 5.
>
> 1. Would you mind to push this patch to -stable?
>
> Reason: If killing a drive was hit in the field, this should be critical
> enough.
Well, it looks like I'm the only one in this world who's drive was
fired this way... ;) Note it's a combination of two issues: it's
definitely a buggy firmware (or hardware) - it should not fire,
no matter how you're hitting it from software - and the readahead+
EIO logic. So.. well, I don't want to try another drive really,
but it *seems* like it will eventually "recover". Not that it's
possible still to watch a DVD with a single scratch (one unreadable
block) anyway with current code (it will freeze and freeze and freeze
again and again), but well, it's not really THAT critical. My drive
is already dead, nothing worse can happen to it anyway ;)
> 2. Could you disable (at least optionally) read ahead complety
> on the first IO error?
>
> Reason: In a data recovery situation (hitting EIO quite often,
> but not really sequentially) readahead is counter productive.
> E.g. trying to save an old CD with the cdparanoia software.
I'm thinking about all this again.. well. Read-ahead is definitely
very useful on a CD (I'm referring to all optical media here, be it
DVD, or BlueRay, or whatever; floppies too, but there it's less useful
due to speed of the whole thing) - I mean, say, DVDs are played more
smoothly if readahead is enabled; a "live CD" distro will be more
responsive if readahead is enabled, and so on - the effect of RA is
trivially visible.
But still, for a scratched CD, it might be a good idea to turn RA off
while playing it, completely - by means of, eg, blockdev --setra 0,
or something like that. Yes not many (end)users know this tool, yes
it's privileged (oh well), but it helps.
Why I recall --setra is: when kernel will start reducing RA by its
own, next question will be "why my CD is too slow?" -- after playing
a scratched CD, you insert another one, and RA is *still* zero...
So I'm not really sure how simple the solution should be.
I *think* here we have some logic error, either fundamental or something
simple.
I mean the following.
Let's say an application requests block number N, which is NOT in cache.
The kernel, with readahead set, tries to read blocks N..N+R (R = readahead
value). In.. hmm. one request? So the question is whenever this one
big request, if block number N+R failed, will be completed partially, or
will fail entirely? I think the right way is to complete that request
partially, filling buffer cache with blocks N..N+R-1. Now, when an app
tries to access block N+1, it's already in the cache, and all goes well
up to block number N+R which is unreadable. So kernel tries to request
blocks N+R..N+2R, fails, and returns an error to application.. which will
next (possible) request block number N+R+1, the kernel will try to read
blocks N+R+1..N+2R+1, will succeed, and everything will go just fine,
with the same readahead value, and with bad block being retried only twice.
So the question really is whenever that large request fails as a whole,
or partially succeeds. As Jens Axboe explained, it depends on the driver
(or hardware? Will, say, a hard drive behave sanely in this case, returning
partial data instead of faling the whole request? Is it ever possible
for a drive to return such "partially successeful" result?)
If it's really difficult/impossible to "fix" this "fail the whole thing"
case, when yes, the only way to go is to disable (or reduce) readahead,
because it's the only way left to fix the problem... But is it impossible?
Speaking of the patch, it seems to work fine - *alot* better than current
kernel code, I tried one slightly scratched CD - a process reading it
"unstalls" in some more-or-less sane time (still large but it's not
half an hour as before ;)
/mjt
next prev parent reply other threads:[~2006-06-10 19:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20060609080801.741901069@localhost.localdomain>
2006-06-09 8:08 ` [PATCH 0/5] Adaptive readahead updates 2 Wu Fengguang
[not found] ` <20060609081119.231751179@localhost.localdomain>
2006-06-09 8:08 ` [PATCH 1/5] readahead: no RA_FLAG_EOF on single page file Wu Fengguang
[not found] ` <20060609081120.054527393@localhost.localdomain>
2006-06-09 8:08 ` [PATCH 3/5] readahead: call scheme - no fastcall for readahead_cache_hit() Wu Fengguang
[not found] ` <20060609081120.531013274@localhost.localdomain>
2006-06-09 8:08 ` [PATCH 4/5] readahead: backoff on I/O error Wu Fengguang
2006-06-10 18:33 ` Ingo Oeser
2006-06-10 19:48 ` Michael Tokarev [this message]
[not found] ` <20060612011245.GA5214@mail.ustc.edu.cn>
2006-06-12 1:12 ` Wu Fengguang
2006-06-12 3:43 ` Andrew Morton
2006-06-12 11:06 ` Michael Tokarev
2006-06-17 6:38 ` Michael Tokarev
2006-06-17 7:00 ` Michael Tokarev
[not found] ` <20060609081121.002572642@localhost.localdomain>
2006-06-09 8:08 ` [PATCH 5/5] readahead: remove size limit on read_ahead_kb Wu Fengguang
2006-06-11 5:34 [PATCH 4/5] readahead: backoff on I/O error Just Marc
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=448B221D.3080907@tls.msk.ru \
--to=mjt@tls.msk.ru \
--cc=akpm@osdl.org \
--cc=axboe@suse.de \
--cc=ioe-lkml@rameria.de \
--cc=linux-kernel@vger.kernel.org \
--cc=wfg@mail.ustc.edu.cn \
/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