From patchwork Thu May 3 01:23:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lin Ming X-Patchwork-Id: 156591 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 09B5EB6F6E for ; Thu, 3 May 2012 11:23:14 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753789Ab2ECBXM (ORCPT ); Wed, 2 May 2012 21:23:12 -0400 Received: from mga09.intel.com ([134.134.136.24]:45515 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753428Ab2ECBXM (ORCPT ); Wed, 2 May 2012 21:23:12 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 02 May 2012 18:23:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.67,351,1309762800"; d="scan'208";a="139429665" Received: from minggr.sh.intel.com (HELO [10.239.36.45]) ([10.239.36.45]) by orsmga002.jf.intel.com with ESMTP; 02 May 2012 18:23:09 -0700 Subject: [PATCH] libata: skip old error history when counting probe trials From: Lin Ming To: Jeff Garzik Cc: linux-ide@vger.kernel.org, Martin Mokrejs , Grant Grundler , Gwendal Grignou Date: Thu, 03 May 2012 09:23:09 +0800 Message-ID: <1336008189.5520.25.camel@minggr> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org Commit d902747 introduced ATA_EFLAG_OLD_ER to mark entries in the error ring as cleared. But ata_count_probe_trials_cb() didn't check this flag and it still counts the old error history. So wrong probe trials count is returned and it causes problem, for example, SATA link speed is slowed down from 3.0Gbps to 1.5Gbps. Fix it by checking ATA_EFLAG_OLD_ER in ata_count_probe_trials_cb(). Cc: stable # 2.6.37+ Signed-off-by: Lin Ming --- drivers/ata/libata-eh.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index c61316e..d1fbd59 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c @@ -3501,7 +3501,8 @@ static int ata_count_probe_trials_cb(struct ata_ering_entry *ent, void *void_arg u64 now = get_jiffies_64(); int *trials = void_arg; - if (ent->timestamp < now - min(now, interval)) + if ((ent->eflags & ATA_EFLAG_OLD_ER) || + (ent->timestamp < now - min(now, interval))) return -1; (*trials)++;