All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Mark Lord <kernel@teksavvy.com>
Cc: IDE/ATA development list <linux-ide@vger.kernel.org>
Subject: Re: [PATCH] libata-eh don't waste time retrying media errors (v2)
Date: Wed, 2 May 2012 08:54:14 -0700	[thread overview]
Message-ID: <20120502155414.GB21677@google.com> (raw)
In-Reply-To: <4FA0A3F7.7000401@teksavvy.com>

On Tue, May 01, 2012 at 11:03:19PM -0400, Mark Lord wrote:
> ATA and SATA drives have had built-in retries for media errors
> for as long as they've been commonplace in computers (early 1990s).
> 
> When libata stumbles across a bad sector, it can waste minutes
> sitting there doing retry after retry before finally giving up
> and letting the higher layers deal with it.
> 
> This patch removes retries for media errors only.
> 
> Signed-off-by: Mark Lord <mlord@pobox.com>
> ---
> version 2; the original patch changed more than intended.
> 
> --- linux/drivers/ata/libata-eh.c.orig	2012-04-27 13:17:35.000000000 -0400
> +++ linux/drivers/ata/libata-eh.c	2012-05-01 22:40:00.182425015 -0400
> @@ -2122,7 +2122,8 @@
>  		if (qc->flags & ATA_QCFLAG_IO ||
>  		    (!(qc->err_mask & AC_ERR_INVALID) &&
>  		     qc->err_mask != AC_ERR_DEV))
> -			qc->flags |= ATA_QCFLAG_RETRY;
> +			if (!(qc->err_mask & AC_ERR_MEDIA))
> +				qc->flags |= ATA_QCFLAG_RETRY;

It can be combined like the following,

	if (!(qc->err_mask & AC_ERR_MEDIA) &&
	    (qc->flags & ATA_QCFLAG_IO ||
	     (!(qc->err_mask & AC_ERR_INVALID) &&
	      qc->err_mask != AC_ERR_DEV)))

which doesn't look any prettier.  Hmm... maybe using local vars would
make it better?

	bool emedia = qc->err_mask & AC_ERR_MEDIA;
	bool einval = qc->err_mask & AC_ERR_INVALID;
	bool edev = qc->err_mask == AC_ERR_DEV;
	bool is_io = qc->flags & ATA_QCFLAG_IO;

	if (!emedia && (is_io || (!einval && !edev)))

-- 
tejun

  reply	other threads:[~2012-05-02 15:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-01 20:12 ata_eh_link_autopsy: Bug? Mark Lord
2012-05-01 20:27 ` Mark Lord
2012-05-01 21:58   ` Tejun Heo
2012-05-01 23:48     ` Mark Lord
2012-05-01 23:52       ` Mark Lord
2012-05-02  0:00       ` [PATCH] libata-eh don't waste time retrying media errors Mark Lord
2012-05-02  3:03         ` [PATCH] libata-eh don't waste time retrying media errors (v2) Mark Lord
2012-05-02 15:54           ` Tejun Heo [this message]
2012-05-02 19:10             ` Mark Lord
2012-05-02 19:22             ` [PATCH] libata-eh don't waste time retrying media errors (v3) Mark Lord
2012-05-02 19:33               ` Tejun Heo
2012-05-02 19:43                 ` Mark Lord
2012-05-02 19:46                   ` Tejun Heo
2012-05-04  2:25                     ` Jeff Garzik
2012-05-04  3:04                       ` Mark Lord

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=20120502155414.GB21677@google.com \
    --to=htejun@gmail.com \
    --cc=kernel@teksavvy.com \
    --cc=linux-ide@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.