Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp566389ybm; Mon, 20 May 2019 23:01:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqwpg5bD5DUxdBf4ik+NHyai3gvaY1GRaFEkFVvFFdW+fWcHIlxg73xR4yRsJsRMMc+M7uyd X-Received: by 2002:a17:902:10c:: with SMTP id 12mr80716239plb.61.1558418481440; Mon, 20 May 2019 23:01:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558418481; cv=none; d=google.com; s=arc-20160816; b=OlLjL91MyUTxN2z2A/RHLot3z22Rkf0Cs8FrMwqWRma4gKUlfvqgLusv5fVXIcsGGI jnne+64GJVfXutBZj/2HblNthVsDsNJP9/6PbzYsw+5ELa+PiHA1FkDcJop8Plel3WY3 bNRBtLxvKoSGacDoK+bmZYYYVDRea8aXAggwv+dOC/P2fiQXaj9yRyCHl322i5uYLeCs UFfqJdW0z0oRqDoJ9cHLqDIVmBQBIPCtmzCYsVYwWmzfqas1CApCI73zMYpXdCB9LGZZ 53UhLZHyXsLiyBnIuG0pIy+pqHO9Iipxo/WD35IKwDijXUsvZP7dIDlHSW5YKuCRwRlk GckA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=AFJexFuFkQtgep9ej8Oax/FWg9d9zce2LMAbaZR8bz0=; b=SUCBl3P377kj38QzK7T3cmzwLvBUkgN8TxcXGlbvmQB2Cuy3VVCZmraMuzpqh4QqOh 8Qp4pYsqOeSAznigSDRvTQY9GKWu5RZLLUbvRnmX6H7JYJ2ZZbfeA3KCzeH1xdzBVjF4 r8++AsC0eFH8YysVr9q9nJmMI6BPrsSnfTGQRYm4pgNs4cH6x9iIw/Xp3zfqo1iPDtM0 TOa+4UbNDNlFre5X8yPsxUQ4dk/IfykMUTeWk4MD5dX6a1TdOAqiOe9A2AwXTy19ruGA we3VZdbnqqdxDe1MHsS5o46XjNkcG27fa7XNezywAtLKZp/QHVZkTo332URkaoH8uo78 gQhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AXaHRONs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 14si22154634pfu.76.2019.05.20.23.01.03; Mon, 20 May 2019 23:01:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AXaHRONs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727779AbfEUF7x (ORCPT + 99 others); Tue, 21 May 2019 01:59:53 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:46307 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725835AbfEUF7x (ORCPT ); Tue, 21 May 2019 01:59:53 -0400 Received: by mail-qt1-f195.google.com with SMTP id z19so19072044qtz.13; Mon, 20 May 2019 22:59:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AFJexFuFkQtgep9ej8Oax/FWg9d9zce2LMAbaZR8bz0=; b=AXaHRONsav7diI2ncW4TwuNgXcylolW1VNwsd89FVxhq96s2Y5WA4Rp4zITKEjUIQZ fYlyPKAz4DUY47zRSIDQgsqcapiH0nBmv/e7dXebSQUe3u0Pmvlf2hdjoNzTPZFP+98r CegOC0cljHpjpBMcdFZYftRfLpkniu8nEtN/kkrIgdG7rNMdqfQb3XLW6Zi8pqbm6iZU MYanbICS3xQNwQTonClX4Tx78EFsB6+XVM3LA9DJ/al90SiIiukhGTZ4zXJ70opvKJqb xRz350cIsJOAN5YuSgVupdXq5WcID3AI1FlzDE6JkA60cIqzwiFQceWcpCgwbzykIm9g b+DQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AFJexFuFkQtgep9ej8Oax/FWg9d9zce2LMAbaZR8bz0=; b=PBqXz82H+5leOpu4GCr1flCfmz4QyuR+hkqzEOcfL5DSoas7XbQIwzwZ5YOlY06+Eo NPBEpdaoUHpqp+GoBg+TvwOC7OBSVhDj0u5mzmNu0Oo5RXgz0elhK+uYAHT/P8I3J5j7 M706o9I24YVb1dKFoBZY77zaZuGhbSpXbvRCE3TAzRO4Wjxsri/Q/Fttnb1rTf4FCmhr UqKZNSTpS4YrgJbmToWGAqeVLA8t5wiPpDIG4ARtfEw0mBhvlRM79lzsyv4SA3769n4q KJIh/GfeKMU0kn0lQXB6tMrgSox47Wofc2GnhKPlDaSHxz0ElnbV/2oKTrUkadXYiXkR 5xpA== X-Gm-Message-State: APjAAAVp6t5XgPITw2xU/ndW8gFAK3gCeNmRSSghilffDbcJPnzg4NA8 r9bhTYwO1FrYm1lzsRPN+CLSJte/OdoRWIXYCLE= X-Received: by 2002:ac8:2af4:: with SMTP id c49mr46564688qta.83.1558418391734; Mon, 20 May 2019 22:59:51 -0700 (PDT) MIME-Version: 1.0 References: <20190509111849.22927-1-marcos.souza.org@gmail.com> <20190516112317.GA8611@geeko> In-Reply-To: From: Song Liu Date: Mon, 20 May 2019 22:59:40 -0700 Message-ID: Subject: Re: [PATCH] drivers: md: Unify common definitions of raid1 and raid10 To: Marcos Paulo de Souza Cc: open list , NeilBrown , Shaohua Li , "open list:SOFTWARE RAID (Multiple Disks) SUPPORT" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 16, 2019 at 8:39 AM Song Liu wrote: > > On Thu, May 16, 2019 at 4:24 AM Marcos Paulo de Souza > wrote: > > > > ping. > > Applied to https://github.com/liu-song-6/linux/tree/md-next. > > Thanks for the patch. I will process it after the merge window closes. > > Song > > > On Thu, May 09, 2019 at 08:18:49AM -0300, Marcos Paulo de Souza wrote: > > > These definitions are being moved to raid1-10.c. > > > > > > Signed-off-by: Marcos Paulo de Souza > > > --- > > > drivers/md/raid1-10.c | 25 +++++++++++++++++++++++++ > > > drivers/md/raid1.c | 29 ++--------------------------- > > > drivers/md/raid10.c | 27 +-------------------------- > > > 3 files changed, 28 insertions(+), 53 deletions(-) > > > > > > diff --git a/drivers/md/raid1-10.c b/drivers/md/raid1-10.c > > > index 400001b815db..7d968bf08e54 100644 > > > --- a/drivers/md/raid1-10.c > > > +++ b/drivers/md/raid1-10.c > > > @@ -3,6 +3,31 @@ > > > #define RESYNC_BLOCK_SIZE (64*1024) > > > #define RESYNC_PAGES ((RESYNC_BLOCK_SIZE + PAGE_SIZE-1) / PAGE_SIZE) > > > > > > +/* > > > + * Number of guaranteed raid bios in case of extreme VM load: > > > + */ > > > +#define NR_RAID_BIOS 256 > > > + > > > +/* when we get a read error on a read-only array, we redirect to another > > > + * device without failing the first device, or trying to over-write to > > > + * correct the read error. To keep track of bad blocks on a per-bio > > > + * level, we store IO_BLOCKED in the appropriate 'bios' pointer > > > + */ > > > +#define IO_BLOCKED ((struct bio *)1) > > > +/* When we successfully write to a known bad-block, we need to remove the > > > + * bad-block marking which must be done from process context. So we record > > > + * the success by setting devs[n].bio to IO_MADE_GOOD > > > + */ > > > +#define IO_MADE_GOOD ((struct bio *)2) > > > + > > > +#define BIO_SPECIAL(bio) ((unsigned long)bio <= 2) > > > + > > > +/* When there are this many requests queue to be written by > > > + * the raid thread, we become 'congested' to provide back-pressure > > > + * for writeback. > > > + */ > > > +static int max_queued_requests = 1024; > > > + > > > /* for managing resync I/O pages */ > > > struct resync_pages { > > > void *raid_bio; > > > diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c > > > index 0c8a098d220e..bb052c35bf29 100644 > > > --- a/drivers/md/raid1.c > > > +++ b/drivers/md/raid1.c > > > @@ -50,31 +50,6 @@ > > > (1L << MD_HAS_PPL) | \ > > > (1L << MD_HAS_MULTIPLE_PPLS)) > > > > > > -/* > > > - * Number of guaranteed r1bios in case of extreme VM load: > > > - */ > > > -#define NR_RAID1_BIOS 256 > > > - > > > -/* when we get a read error on a read-only array, we redirect to another > > > - * device without failing the first device, or trying to over-write to > > > - * correct the read error. To keep track of bad blocks on a per-bio > > > - * level, we store IO_BLOCKED in the appropriate 'bios' pointer > > > - */ > > > -#define IO_BLOCKED ((struct bio *)1) > > > -/* When we successfully write to a known bad-block, we need to remove the > > > - * bad-block marking which must be done from process context. So we record > > > - * the success by setting devs[n].bio to IO_MADE_GOOD > > > - */ > > > -#define IO_MADE_GOOD ((struct bio *)2) > > > - > > > -#define BIO_SPECIAL(bio) ((unsigned long)bio <= 2) > > > - > > > -/* When there are this many requests queue to be written by > > > - * the raid1 thread, we become 'congested' to provide back-pressure > > > - * for writeback. > > > - */ > > > -static int max_queued_requests = 1024; > > > - > > > static void allow_barrier(struct r1conf *conf, sector_t sector_nr); > > > static void lower_barrier(struct r1conf *conf, sector_t sector_nr); > > > > > > @@ -2955,7 +2930,7 @@ static struct r1conf *setup_conf(struct mddev *mddev) > > > if (!conf->poolinfo) > > > goto abort; > > > conf->poolinfo->raid_disks = mddev->raid_disks * 2; > > > - err = mempool_init(&conf->r1bio_pool, NR_RAID1_BIOS, r1bio_pool_alloc, > > > + err = mempool_init(&conf->r1bio_pool, NR_RAID_BIOS, r1bio_pool_alloc, > > > r1bio_pool_free, conf->poolinfo); > > > if (err) > > > goto abort; > > > @@ -3240,7 +3215,7 @@ static int raid1_reshape(struct mddev *mddev) > > > newpoolinfo->mddev = mddev; > > > newpoolinfo->raid_disks = raid_disks * 2; > > > > > > - ret = mempool_init(&newpool, NR_RAID1_BIOS, r1bio_pool_alloc, > > > + ret = mempool_init(&newpool, NR_RAID_BIOS, r1bio_pool_alloc, > > > r1bio_pool_free, newpoolinfo); > > > if (ret) { > > > kfree(newpoolinfo); > > > diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c > > > index 3b6880dd648d..24cb116d950f 100644 > > > --- a/drivers/md/raid10.c > > > +++ b/drivers/md/raid10.c > > > @@ -73,31 +73,6 @@ > > > * [B A] [D C] [B A] [E C D] > > > */ > > > > > > -/* > > > - * Number of guaranteed r10bios in case of extreme VM load: > > > - */ > > > -#define NR_RAID10_BIOS 256 > > > - > > > -/* when we get a read error on a read-only array, we redirect to another > > > - * device without failing the first device, or trying to over-write to > > > - * correct the read error. To keep track of bad blocks on a per-bio > > > - * level, we store IO_BLOCKED in the appropriate 'bios' pointer > > > - */ > > > -#define IO_BLOCKED ((struct bio *)1) > > > -/* When we successfully write to a known bad-block, we need to remove the > > > - * bad-block marking which must be done from process context. So we record > > > - * the success by setting devs[n].bio to IO_MADE_GOOD > > > - */ > > > -#define IO_MADE_GOOD ((struct bio *)2) > > > - > > > -#define BIO_SPECIAL(bio) ((unsigned long)bio <= 2) > > > - > > > -/* When there are this many requests queued to be written by > > > - * the raid10 thread, we become 'congested' to provide back-pressure > > > - * for writeback. > > > - */ > > > -static int max_queued_requests = 1024; > > > - > > > static void allow_barrier(struct r10conf *conf); > > > static void lower_barrier(struct r10conf *conf); > > > static int _enough(struct r10conf *conf, int previous, int ignore); > > > @@ -3684,7 +3659,7 @@ static struct r10conf *setup_conf(struct mddev *mddev) > > > > > > conf->geo = geo; > > > conf->copies = copies; > > > - err = mempool_init(&conf->r10bio_pool, NR_RAID10_BIOS, r10bio_pool_alloc, > > > + err = mempool_init(&conf->r10bio_pool, NR_RAID_BIOS, r10bio_pool_alloc, > > > r10bio_pool_free, conf); > > > if (err) > > > goto out; > > > -- > > > 2.21.0 > > > > > > > -- > > Thanks, > > Marcos