Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965443AbeAMEW3 (ORCPT + 1 other); Fri, 12 Jan 2018 23:22:29 -0500 Received: from mail-wr0-f196.google.com ([209.85.128.196]:39619 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965407AbeAMEW1 (ORCPT ); Fri, 12 Jan 2018 23:22:27 -0500 X-Google-Smtp-Source: ACJfBov5urfykOMC4lDlVVYQ+zJnnbg0C42RlBPPNBylQLjzI8Hn4WX3NJQk93PGXuS5fe0D9Bu/Mg== Date: Sat, 13 Jan 2018 06:22:24 +0200 From: Pavel Vazharov To: Coly Li Cc: mlyle@lyle.org, kent.overstreet@gmail.com, linux-bcache@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] bcache: io.c: Fix check against error_limit in case of io errors Message-Id: <20180113062224.3e72adb5152ac52e0e3f9d2e@gmail.com> In-Reply-To: References: <1515766051-13380-1-git-send-email-freakpv@gmail.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Sat, 13 Jan 2018 11:40:54 +0800 Coly Li wrote: > On 12/01/2018 10:07 PM, Pavel Vazharov wrote: > > The actual sysfs io_error_limit value is left shifted IO_ERROR_SHIFT > > times before it is stored in the error_limit. > > This fixes the un-registering of the cache set when the io_errors reach > > the error_limit value. > > > > Signed-off-by: Pavel Vazharov > > --- > > drivers/md/bcache/io.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/md/bcache/io.c b/drivers/md/bcache/io.c > > index fac97ec..1ef6ae2 100644 > > --- a/drivers/md/bcache/io.c > > +++ b/drivers/md/bcache/io.c > > @@ -93,7 +93,7 @@ void bch_count_io_errors(struct cache *ca, blk_status_t error, const char *m) > > &ca->io_errors); > > errors >>= IO_ERROR_SHIFT; > > > > - if (errors < ca->set->error_limit) > > + if (errors < (ca->set->error_limit >> IO_ERROR_SHIFT)) > > pr_err("%s: IO error on %s, recovering", > > bdevname(ca->bdev, buf), m); > > else > > > > Hi Pavel, > > A similar fix is also in my device failure patch set, its name is, > bcache: set error_limit correctly > The difference is, I remove the bit shift of error_limit. > > -- > Coly Li Hi Coly, I see your patch. I think it's better solution. Originally, I was wondering why the shifting of error_limit is needed when it's set via sysfs just to shift it back here. -- Pavel Vazharov