Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp674080yba; Thu, 9 May 2019 04:21:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqxHDgbuh0IxcaVJZ0NndzbdI2aTxrBRpzibsnOLwHK697rbSVvnHP+rCYP4ZCZKYKvOqU5y X-Received: by 2002:a63:161d:: with SMTP id w29mr4630523pgl.395.1557400893259; Thu, 09 May 2019 04:21:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557400893; cv=none; d=google.com; s=arc-20160816; b=ijhSg8+Kgvg5lueAt6zOPMDUDcDr5hwBnvIyPmCrC4FbGzmx6mBLQxs7CKnB5IXgBP KmCYcbDoeYKWKZRv/uVcFTY96+oGHOO2lX5b1PM/X4oIviunfLR/Q62UtBBcNsNCU0Lm 1G7W18VVLenv9+Yd7WYbp6xwwq4oghOtPaPg8T6QKQ3KvR9aS5HRxqO4B93XpHtW4MtR PGT7C6DVnn0GEWXHnLayq2T/IMLhUHcmHGuVuoT5gIWs1x9tWPnOagWypOeWvmotEM+s D7DTWqCsC+cf/462iGKUJxOVkfeNIIVOGd5FfjZuPbcX/BW6/Se7g0LWTMZ+Z0KCFrcB AwfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=/Svie9yUR/Ki3ERUJrCqza9pq7RGH5A+LU5XetAHZSY=; b=U8m5uAkCJi5Y8sXrZ8M0RoL0JB1FoqM8JapbhhIi0bnZFc2VoxUjpzO2TJmKU5Rs4W qspF2X1izuv7pUGAznruv1H7JycQ68Kz5iAq7/wEeOJREvaQ2dOJBE2x+L3dFJ/YqWRr 1sZT2jkm0Q+6v3y6qZu5QUhsG/PPA1+qy9BNhcyKbi2IItrOnDNIlMDz6sjHp8kLSKVA MY1EV25WK2kS3nvWMOE+NUTC00tVb1OBt7dpbFJSrXHPbeL2Pad+N+oBqubMg+zmR98e ZRVnVyRlao99daGRM0TWXx2yRqE1gzV7FFadxAm0/eQEn+uWsTAafXR5sVZEDd3ef/5a VY8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lRoMKFsz; 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 b12si2761271pgl.77.2019.05.09.04.21.16; Thu, 09 May 2019 04:21:33 -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=lRoMKFsz; 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 S1726709AbfEILTK (ORCPT + 99 others); Thu, 9 May 2019 07:19:10 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:36481 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726078AbfEILTK (ORCPT ); Thu, 9 May 2019 07:19:10 -0400 Received: by mail-ed1-f68.google.com with SMTP id a8so1691417edx.3; Thu, 09 May 2019 04:19:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/Svie9yUR/Ki3ERUJrCqza9pq7RGH5A+LU5XetAHZSY=; b=lRoMKFszdaZJXqdKVeaIsXxiaARvYZ0Yf1JHwCDUwRDmQuL9eCEjpJelCnhhWZsvzY yxj38hYULI9qscPUamGzBPjFQradK7txRfFQcDw9mv9eHdzDPQk5WxFMvtyjIW4wAC8Y xbib3RucZ9PZpigU012rkrGjQgbDMZb9wNpDq3S2bWezcO2CREUMgDbhQTbj/LspgqkZ 7h3pDrtuwsF38yZIBbBY5idgTCUI0jtkHdMfK8xp+RnmtMuDzZEAVhLI2T+y/JoJbhPk GEi4Hk8yqCWjXC68CeZS56kDye5pB/LPj5daU/WcP0pPYPcUisL0+vP3J17GXjLPi8pJ EoIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=/Svie9yUR/Ki3ERUJrCqza9pq7RGH5A+LU5XetAHZSY=; b=sDjOdK89nYlsMj4o0c5pO/UjlXqPXukGSwRcF9ql8W2O6d4aZsSZ+qqRgaRr4/RZU1 jW1yufBhJBCF+IgeJM+7rVIyYzG/G5OAkCVwCGM7+OQC/mjglUgUU5zrarPLcGKPPlpe 79mom8wtct3dlCalgE/oyY2N0UkQle8+/JJPhWXJ71MMF0OkvxpFuZ+FAX0DDieWSp0L ZaPZYb6AxBfA1OYEhZjlk5HHPc7YtHSfoSZuqFFS9zJXO2DVhZ+r52wr2tgBwCVs109U pfDWN9gV0E71zWryxisZcLaoQ43bjoRcei2wUnDZwo7LqmnMZwYgXHZfXd4PtmbLynyy Uddg== X-Gm-Message-State: APjAAAV5h7ZidImViu4LmP7qFCqKLGm/sQoZQraVPvpBkZUmRMGxMTNh fDwlXycrZNL578skmXR5QiE2JfmE X-Received: by 2002:a17:906:2447:: with SMTP id a7mr2693190ejb.235.1557400747703; Thu, 09 May 2019 04:19:07 -0700 (PDT) Received: from geeko.suse.cz (189.114.218.127.dynamic.adsl.gvt.net.br. [189.114.218.127]) by smtp.gmail.com with ESMTPSA id j3sm290382edh.82.2019.05.09.04.19.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 May 2019 04:19:05 -0700 (PDT) From: Marcos Paulo de Souza To: linux-kernel@vger.kernel.org Cc: neilb@suse.com, Marcos Paulo de Souza , Shaohua Li , linux-raid@vger.kernel.org (open list:SOFTWARE RAID (Multiple Disks) SUPPORT) Subject: [PATCH] drivers: md: Unify common definitions of raid1 and raid10 Date: Thu, 9 May 2019 08:18:49 -0300 Message-Id: <20190509111849.22927-1-marcos.souza.org@gmail.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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