Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1448757pxb; Thu, 7 Oct 2021 08:02:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNcnnfvkjrAxoyeA7KjK+k7/syGgVeUF1V5+YheOPcHhg71ftJ3m3iU5vflEP7prTO8GiR X-Received: by 2002:a50:cf02:: with SMTP id c2mr7007977edk.325.1633618944680; Thu, 07 Oct 2021 08:02:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633618944; cv=none; d=google.com; s=arc-20160816; b=XUmtwehYjKVt9jC5KLL9Cv8BE0pr0YNs6rt/9u3/shp6vsWFuQWuXdrCEEmXazqq/m Lg0asmsju7dQ1Dlwn8Re4MfUdjLSGRGXRyTQKVkUF+bozYyFf1bo9unBwxIa0/kpE1s0 Vyovzh/evj32uYyEdP+bDpI0KJg0A6BVyKy+sJfb8BhKkaXNnJl6eaNV9xkrtLBgcLv/ GBaPlOg5BsWHggx9QPl2OGgRj1zeFJ/4mq24Gk45aJeYOfKa9a1Ct1pyUzz6zSQSh4+M rtoUzruT1zLVfoWETbbbWkW7vVq7rTYriXXVmzyz7T9zCbamt49lh34iXgOvHS+ofyHZ xRaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=UnliytdnOQZ52lrzs8bp/RQ5pdyHETxmE1pobE9e6b4=; b=WdAOcYXOsuQOpwSXBFbi4+k59aN6vzCL2J4CSVyEv2ZtfFE7KZ+1eRtJXclASBwCIh QLDXTrqpCveWKnqBAkjUZVtOnL3Jkibb4na6gGqOdbTHEag/B1/cfOlRHs0K8r72+xkw hkSTrmBRkkL3F/Qx9z0N/RnjXHXiCASRRxpbrj/N+uHkpdvQ9PeNX4jjKjxb91mTGOBN EgqZsuyDlPfH3NWGB5QWhBjaT/rrzGuJfS5m4ILVVCr5zekTSXAdEW5e6nPNg2juFZKa TBMXR+NLQNu0mOGx5jFzgrKWXkYjNqrUaHUDWNziV4uyAbEXLe3Rvd10k9NQMYFvBDDd qx5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Jg/Hk1q6"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s18si31222946eji.59.2021.10.07.08.01.57; Thu, 07 Oct 2021 08:02:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Jg/Hk1q6"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242243AbhJGPBE (ORCPT + 99 others); Thu, 7 Oct 2021 11:01:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:53964 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233392AbhJGPBB (ORCPT ); Thu, 7 Oct 2021 11:01:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 76AFF61130; Thu, 7 Oct 2021 14:59:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1633618747; bh=agUEa5tnymA5cLSQOimR3s7Rpv88HWpHN23UjSzV7aA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Jg/Hk1q6vizyHYdxD/J9WP3bsG8DOzxJZ76ABMmXUuxD+VzkvIwqX7aWmLDJ2Kyf3 esvsQUQ6KxlfDHCv4H0pgqsJcIFt2S80ugDdz6WIskyhj9P+NUdDWxcxeIhN3ynQoc DiylFI/xJPBRoteYwVoIXlmXa0oM1RFzR9WozWkxYfYgnV6arqmQxvx0fQGins3fZY Hx0rxC1KDb97PPZuEhlDMWts1qQ8D5gmIcTf3Ih/LX0XE7ks9NkgcM04A56FHeRvGH RoKUxFZ4yG8Ln4AyMsQtL6Mj8yHGWoNw6/6WEdOjuUngEkBFPFqL7KuqWfdouPECTR wgGOLLSdqM5Xw== Received: by mail-lf1-f53.google.com with SMTP id x27so26225877lfu.5; Thu, 07 Oct 2021 07:59:07 -0700 (PDT) X-Gm-Message-State: AOAM530zeLuo9m8Ukf8cUVAK9eTJabVCLW2Ad2u/vKDRBY54+EG4SVWe UPDjysqCV+xMevnQapSwJdpEQ+VeOmSqYXBkBDU= X-Received: by 2002:a05:6512:1052:: with SMTP id c18mr4661456lfb.223.1633618745817; Thu, 07 Oct 2021 07:59:05 -0700 (PDT) MIME-Version: 1.0 References: <20210913032003.2836583-1-fengli@smartx.com> In-Reply-To: From: Song Liu Date: Thu, 7 Oct 2021 07:58:54 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] md: allow to set the fail_fast on RAID1/RAID10 To: Li Feng Cc: linux-raid , open list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 7, 2021 at 12:00 AM Li Feng wrote: > > Continue ping... > > Thanks, > Feng Li Hmm.. this is weird. I didn't see previous emails in this thread. Could you please send it again? Thanks, Song > > Li Feng =E4=BA=8E2021=E5=B9=B49=E6=9C=8827=E6=97=A5= =E5=91=A8=E4=B8=80 =E4=B8=8B=E5=8D=889:24=E5=86=99=E9=81=93=EF=BC=9A > > > > Hi Song, > > > > What about this feature? > > > > Thanks, > > Feng Li > > > > Li Feng =E4=BA=8E2021=E5=B9=B49=E6=9C=8815=E6=97=A5= =E5=91=A8=E4=B8=89 =E4=B8=8B=E5=8D=8811:08=E5=86=99=E9=81=93=EF=BC=9A > > > > > > ping ... > > > > > > Thanks, > > > Feng Li > > > > > > Li Feng =E4=BA=8E2021=E5=B9=B49=E6=9C=8813=E6=97= =A5=E5=91=A8=E4=B8=80 =E4=B8=8A=E5=8D=8811:22=E5=86=99=E9=81=93=EF=BC=9A > > > > > > > > When the running RAID1/RAID10 need to be set with the fail_fast fla= g, > > > > we have to remove each device from RAID and re-add it again with th= e > > > > --fail_fast flag. > > > > > > > > Export the fail_fast flag to the userspace to support the read and > > > > write. > > > > > > > > Signed-off-by: Li Feng > > > > --- > > > > drivers/md/md.c | 30 ++++++++++++++++++++++++++++++ > > > > 1 file changed, 30 insertions(+) > > > > > > > > diff --git a/drivers/md/md.c b/drivers/md/md.c > > > > index ae8fe54ea358..ce63972a4555 100644 > > > > --- a/drivers/md/md.c > > > > +++ b/drivers/md/md.c > > > > @@ -3583,6 +3583,35 @@ ppl_size_store(struct md_rdev *rdev, const c= har *buf, size_t len) > > > > static struct rdev_sysfs_entry rdev_ppl_size =3D > > > > __ATTR(ppl_size, S_IRUGO|S_IWUSR, ppl_size_show, ppl_size_store); > > > > > > > > +static ssize_t > > > > +fail_fast_show(struct md_rdev *rdev, char *page) > > > > +{ > > > > + return sprintf(page, "%d\n", test_bit(FailFast, &rdev->flag= s)); > > > > +} > > > > + > > > > +static ssize_t > > > > +fail_fast_store(struct md_rdev *rdev, const char *buf, size_t len) > > > > +{ > > > > + int ret; > > > > + bool bit; > > > > + > > > > + ret =3D kstrtobool(buf, &bit); > > > > + if (ret) > > > > + return ret; > > > > + > > > > + if (test_bit(FailFast, &rdev->flags) && !bit) { > > > > + clear_bit(FailFast, &rdev->flags); > > > > + md_update_sb(rdev->mddev, 1); > > > > + } else if (!test_bit(FailFast, &rdev->flags) && bit) { > > > > + set_bit(FailFast, &rdev->flags); > > > > + md_update_sb(rdev->mddev, 1); > > > > + } > > > > + return len; > > > > +} > > > > + > > > > +static struct rdev_sysfs_entry rdev_fail_fast =3D > > > > +__ATTR(fail_fast, 0644, fail_fast_show, fail_fast_store); > > > > + > > > > static struct attribute *rdev_default_attrs[] =3D { > > > > &rdev_state.attr, > > > > &rdev_errors.attr, > > > > @@ -3595,6 +3624,7 @@ static struct attribute *rdev_default_attrs[]= =3D { > > > > &rdev_unack_bad_blocks.attr, > > > > &rdev_ppl_sector.attr, > > > > &rdev_ppl_size.attr, > > > > + &rdev_fail_fast.attr, > > > > NULL, > > > > }; > > > > static ssize_t > > > > -- > > > > 2.31.1 > > > >