From patchwork Tue Jun 23 14:10:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 11620755 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 808B460D for ; Tue, 23 Jun 2020 14:10:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 699462070E for ; Tue, 23 Jun 2020 14:10:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592921449; bh=Cl6q/60CHd+iH3lwFAFRQYBmIwnQpT2sGcXYkx9o9jI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=eLHTjvJlxJoEi5tHXtwkSxX3GPQJ2Txrdr1Li7HcMmPFQY/kqZi/litAmcVK+R1+W S8Dg9Wng5vs0sHAIM50YyE8ddTfRWg3QAT2lBvg/Xgb7ewAB7ljUSJSs4hLpIv++FX 1gGoVEDemB2MHetBo0XPwZetfYBSPfzr7VFLhGt4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732758AbgFWOKs (ORCPT ); Tue, 23 Jun 2020 10:10:48 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:35432 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732720AbgFWOKr (ORCPT ); Tue, 23 Jun 2020 10:10:47 -0400 Received: by mail-wr1-f65.google.com with SMTP id g18so11639379wrm.2 for ; Tue, 23 Jun 2020 07:10:46 -0700 (PDT) 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=sV5CUIQ0FPCCH8t1O/qsA5k7l2axPb+0+551WKHTkO8=; b=tbUa/l95gdsfCEwn9IrviYBJtK9X/GLlZijY8L6YOGkpO1Zemyw5XZrfna3Dxj9q6/ On9Rm9tsuSgKyYVvoEFuKunIP6VRJoUjIcAUoX7u3aK/UEpr9PbZU9ohzQ9tedSs4kxv mV6Yu+E5EZsplKDe40EwAYKrj5MNi8x4uppfARy1YCe/8utMgB4ynUX7K/7ORbCurGl1 Gdm08ivPu59UFm4RWvHkd/aAh+A3oujngzKXs5pKtQTSTfPLDn8LNc3WN7DTOfLZGuRK EMryShad5inzyffTrGJR8+EwOXWkhfU/Ny46YXsO6q56k5RoROVwCZmNo55ShOSrt894 jAow== X-Gm-Message-State: AOAM533raZOP5allHBaUtfVzQec0KTqTSuZCrozq1VHA/GBL+hVNKsuq HPT9R4N2frwuxMwVWZVa7Zg= X-Google-Smtp-Source: ABdhPJz2LUwEnVU9emqf/9kckrBFfgSx4j4Vebp41wJgiDn05JQxBYmvV5DmUM/ejLoe1D5nwybjAw== X-Received: by 2002:adf:ef4a:: with SMTP id c10mr24476057wrp.32.1592921445696; Tue, 23 Jun 2020 07:10:45 -0700 (PDT) Received: from NUC.fritz.box ([2001:a62:1515:bd01:f64d:30ff:fe6c:acb5]) by smtp.gmail.com with ESMTPSA id n1sm22529497wrp.10.2020.06.23.07.10.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Jun 2020 07:10:45 -0700 (PDT) From: Johannes Thumshirn To: David Sterba Cc: linux-btrfs@vger.kernel.org, Qu Wenruo , Johannes Thumshirn Subject: [PATCH 1/4] btrfs-progs: use sub_stripes property from btrfs_raid_attr Date: Tue, 23 Jun 2020 16:10:16 +0200 Message-Id: <20200623141019.23991-2-jth@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200623141019.23991-1-jth@kernel.org> References: <20200623141019.23991-1-jth@kernel.org> MIME-Version: 1.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org From: Johannes Thumshirn Both btrfs_raid_attr and btrfs_raid_profile define the number of sub_stripes a raid type has. Use the one from btrfs_raid_attr and get rid of the field in btrfs_raid_profile. Signed-off-by: Johannes Thumshirn --- volumes.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/volumes.c b/volumes.c index 7c57d6cb..9d0eeed5 100644 --- a/volumes.c +++ b/volumes.c @@ -1002,61 +1002,51 @@ static const struct btrfs_raid_profile { int num_stripes; int max_stripes; int min_stripes; - int sub_stripes; } btrfs_raid_profile_table[BTRFS_NR_RAID_TYPES] = { [BTRFS_RAID_RAID10] = { .num_stripes = 0, .max_stripes = 0, .min_stripes = 4, - .sub_stripes = 2, }, [BTRFS_RAID_RAID1] = { .num_stripes = 0, .max_stripes = 0, .min_stripes = 2, - .sub_stripes = 1, }, [BTRFS_RAID_RAID1C3] = { .num_stripes = 0, .max_stripes = 0, .min_stripes = 3, - .sub_stripes = 1, }, [BTRFS_RAID_RAID1C4] = { .num_stripes = 0, .max_stripes = 0, .min_stripes = 4, - .sub_stripes = 1, }, [BTRFS_RAID_DUP] = { .num_stripes = 2, .max_stripes = 0, .min_stripes = 2, - .sub_stripes = 1, }, [BTRFS_RAID_RAID0] = { .num_stripes = 0, .max_stripes = 0, .min_stripes = 2, - .sub_stripes = 1, }, [BTRFS_RAID_SINGLE] = { .num_stripes = 1, .max_stripes = 0, .min_stripes = 1, - .sub_stripes = 1, }, [BTRFS_RAID_RAID5] = { .num_stripes = 0, .max_stripes = 0, .min_stripes = 2, - .sub_stripes = 1, }, [BTRFS_RAID_RAID6] = { .num_stripes = 0, .max_stripes = 0, .min_stripes = 3, - .sub_stripes = 1, }, }; @@ -1067,7 +1057,7 @@ static void init_alloc_chunk_ctl(struct btrfs_fs_info *info, ctl->num_stripes = btrfs_raid_profile_table[type].num_stripes; ctl->min_stripes = btrfs_raid_profile_table[type].min_stripes; - ctl->sub_stripes = btrfs_raid_profile_table[type].sub_stripes; + ctl->sub_stripes = btrfs_raid_array[type].sub_stripes; ctl->stripe_len = BTRFS_STRIPE_LEN; switch (type) { From patchwork Tue Jun 23 14:10:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 11620759 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BB47F1392 for ; Tue, 23 Jun 2020 14:10:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A16AB2070E for ; Tue, 23 Jun 2020 14:10:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592921451; bh=8Ri5c4guQ5YL9ZRSvFFB+S8kQg1w+lrqLfYLIxHYx8s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=r+YaQayxnvMFXRp6gW62y7cIb7f7fjj8Z4oSmAE3PNdLoIm3K3tDrXs7n7N50GJDT B8luManQDYGcddPlOzfi6TX5/N4cfAmj885xEQonLsv31keQE6ZUnuLf1FmMZ0ReSb V8zke1otNMZlxSlsjjTVBK3n//tjn1eRJPyWAihc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732789AbgFWOKt (ORCPT ); Tue, 23 Jun 2020 10:10:49 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:37211 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732698AbgFWOKs (ORCPT ); Tue, 23 Jun 2020 10:10:48 -0400 Received: by mail-wr1-f66.google.com with SMTP id a6so18727058wrm.4 for ; Tue, 23 Jun 2020 07:10:47 -0700 (PDT) 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=QmcKcZAjsn3+F4CzWeBv+oaA/7LF00tvvPTLk7owBR0=; b=MVhVwTtaXrWioOwOEk9/dTNoTlGWEG2u5aCqmeYjWHpTT+0P9++iJCgooawBM8SzVU wLZk0sUZ6Tln+PkMSETBzHmYtsu31RdzGTLl2AyXI3zc5XApleaVjDRv67RBKxd/EfcW J3ZwC4toCNEzY819mU1W/qinaQuLwzj5YX+8piiDT0ZedEUO/c2rZbO+iyGfjbbvmvHD GBkrtvQB0C710U8QjK38Gk0i6CuO4MaNa568ERi2OrJupqu40D/nJor6Ipjhpe99e76D PcXTe0BudgQ6rLU3McnclhC3+KqZg96dFTVebpgUZ42uqrVKVi3xHhwfsj0acE+qDcbl Moqw== X-Gm-Message-State: AOAM532eWq70f7g24tHhRzhr6GzqN8FcHlJaNeMk71Mq6cg6guwnZfo0 td3IH9OzBsZuvYwq2qG9Sw/XU+u/ X-Google-Smtp-Source: ABdhPJzoeYLCjlajl2DD7v7/hLzNzEIqI5bOwJJZjDoZ4kv6+wwBmYDdlcnfqlaT2jeyCUGW0t/how== X-Received: by 2002:adf:ec01:: with SMTP id x1mr4093309wrn.59.1592921446521; Tue, 23 Jun 2020 07:10:46 -0700 (PDT) Received: from NUC.fritz.box ([2001:a62:1515:bd01:f64d:30ff:fe6c:acb5]) by smtp.gmail.com with ESMTPSA id n1sm22529497wrp.10.2020.06.23.07.10.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Jun 2020 07:10:46 -0700 (PDT) From: Johannes Thumshirn To: David Sterba Cc: linux-btrfs@vger.kernel.org, Qu Wenruo , Johannes Thumshirn Subject: [PATCH 2/4] btrfs-progs: use minimal number of stripes from btrfs_raid_attr Date: Tue, 23 Jun 2020 16:10:17 +0200 Message-Id: <20200623141019.23991-3-jth@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200623141019.23991-1-jth@kernel.org> References: <20200623141019.23991-1-jth@kernel.org> MIME-Version: 1.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org From: Johannes Thumshirn Both btrfs_raid_attr and btrfs_raid_profile define the minimal number of stripes for each raid profile. The difference is in btrfs_raid_attr the number of stripes is called devs_min and in btrfs_raid_profile its called min_stripes. Signed-off-by: Johannes Thumshirn --- volumes.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/volumes.c b/volumes.c index 9d0eeed5..82d7a872 100644 --- a/volumes.c +++ b/volumes.c @@ -1001,52 +1001,42 @@ error: static const struct btrfs_raid_profile { int num_stripes; int max_stripes; - int min_stripes; } btrfs_raid_profile_table[BTRFS_NR_RAID_TYPES] = { [BTRFS_RAID_RAID10] = { .num_stripes = 0, .max_stripes = 0, - .min_stripes = 4, }, [BTRFS_RAID_RAID1] = { .num_stripes = 0, .max_stripes = 0, - .min_stripes = 2, }, [BTRFS_RAID_RAID1C3] = { .num_stripes = 0, .max_stripes = 0, - .min_stripes = 3, }, [BTRFS_RAID_RAID1C4] = { .num_stripes = 0, .max_stripes = 0, - .min_stripes = 4, }, [BTRFS_RAID_DUP] = { .num_stripes = 2, .max_stripes = 0, - .min_stripes = 2, }, [BTRFS_RAID_RAID0] = { .num_stripes = 0, .max_stripes = 0, - .min_stripes = 2, }, [BTRFS_RAID_SINGLE] = { .num_stripes = 1, .max_stripes = 0, - .min_stripes = 1, }, [BTRFS_RAID_RAID5] = { .num_stripes = 0, .max_stripes = 0, - .min_stripes = 2, }, [BTRFS_RAID_RAID6] = { .num_stripes = 0, .max_stripes = 0, - .min_stripes = 3, }, }; @@ -1056,11 +1046,14 @@ static void init_alloc_chunk_ctl(struct btrfs_fs_info *info, int type = ctl->type; ctl->num_stripes = btrfs_raid_profile_table[type].num_stripes; - ctl->min_stripes = btrfs_raid_profile_table[type].min_stripes; + ctl->min_stripes = btrfs_raid_array[type].devs_min; ctl->sub_stripes = btrfs_raid_array[type].sub_stripes; ctl->stripe_len = BTRFS_STRIPE_LEN; switch (type) { + case BTRFS_RAID_DUP: + ctl->min_stripes = 2; + break; case BTRFS_RAID_RAID1: case BTRFS_RAID_RAID1C3: case BTRFS_RAID_RAID1C4: From patchwork Tue Jun 23 14:10:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 11620757 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E0B8B1392 for ; Tue, 23 Jun 2020 14:10:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BED7B20706 for ; Tue, 23 Jun 2020 14:10:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592921450; bh=y8X72+vxGiV9SaigpaklT83f49cRFEIKPMmP3fFNNxk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=lKe2Zr4v21afDHDZy7OLqfiqzr04tlv0kDJhS3nT6zwwLewsXYVptJ/+Q7LKdREBp YIuhcBSjgKoTfEMZ6qEkChl8fqxFQR27cgP1tNvXGlIidu3QeSer1XrzaJ18o+Pri+ SjwwLmvAnSIly278ZvUDkoR3LqmbCB7/b9hXEqzU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732802AbgFWOKt (ORCPT ); Tue, 23 Jun 2020 10:10:49 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:45651 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732755AbgFWOKs (ORCPT ); Tue, 23 Jun 2020 10:10:48 -0400 Received: by mail-wr1-f65.google.com with SMTP id s10so731913wrw.12 for ; Tue, 23 Jun 2020 07:10:48 -0700 (PDT) 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=vf7rEy4zYlydqb4wnH629EGqC3tPkspLxmVn6rlL6DY=; b=bnDr08948IZWBnpr57hSNpwre7CtOLMFAdTitHOCCLAQuHjbd0jcltAfwAtjfvhm2V QwwPBCUqleJ6iUZXWRnkQ00+ciRiYaFgLCtQH2SMtit4AhPi2iHv6OtC1TbQznB3KS4t zHkk8o1B2wmvbKICMsGnjYra+xwj6s5KQq0dKWPZxiriFXM1nQSWC+sgVLkTD74ZyOs7 e/DHT9l36gW5UgozNzGe0/SJDTL2VpR4zolFbynQINZGC9VZ98aZePxzCBRimuzcNLf9 tl8piEyLaoklzzYc1ooYoYRmMGE5UNfLwGZ0hVq6PWENcqVPazfJN+VZqXpF3ZxX36t0 zHOQ== X-Gm-Message-State: AOAM533vKi92mqD2eQBArJ7AtNGJYoXn0XH0mMeVYHm5HwPOrdtGg4zs lyvoG734o+ETbNbyoqjYaN0= X-Google-Smtp-Source: ABdhPJxHgt+q5G3FnDP5j9WGPbPt5sW7/AljfSH9+Pfs6ElB0xtrnqCZAKsI1epFpTNdchNE5Mhd6w== X-Received: by 2002:adf:e908:: with SMTP id f8mr2337862wrm.3.1592921447564; Tue, 23 Jun 2020 07:10:47 -0700 (PDT) Received: from NUC.fritz.box ([2001:a62:1515:bd01:f64d:30ff:fe6c:acb5]) by smtp.gmail.com with ESMTPSA id n1sm22529497wrp.10.2020.06.23.07.10.46 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Jun 2020 07:10:46 -0700 (PDT) From: Johannes Thumshirn To: David Sterba Cc: linux-btrfs@vger.kernel.org, Qu Wenruo , Johannes Thumshirn Subject: [PATCH 3/4] btrfs-progs: remove unused btrfs_raid_profile::max_stripes Date: Tue, 23 Jun 2020 16:10:18 +0200 Message-Id: <20200623141019.23991-4-jth@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200623141019.23991-1-jth@kernel.org> References: <20200623141019.23991-1-jth@kernel.org> MIME-Version: 1.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org From: Johannes Thumshirn The max_stripes value of btrfs_raid_profile_table is unused, so we can just remove it as well. Signed-off-by: Johannes Thumshirn --- volumes.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/volumes.c b/volumes.c index 82d7a872..71c3735d 100644 --- a/volumes.c +++ b/volumes.c @@ -1000,43 +1000,33 @@ error: static const struct btrfs_raid_profile { int num_stripes; - int max_stripes; } btrfs_raid_profile_table[BTRFS_NR_RAID_TYPES] = { [BTRFS_RAID_RAID10] = { .num_stripes = 0, - .max_stripes = 0, }, [BTRFS_RAID_RAID1] = { .num_stripes = 0, - .max_stripes = 0, }, [BTRFS_RAID_RAID1C3] = { .num_stripes = 0, - .max_stripes = 0, }, [BTRFS_RAID_RAID1C4] = { .num_stripes = 0, - .max_stripes = 0, }, [BTRFS_RAID_DUP] = { .num_stripes = 2, - .max_stripes = 0, }, [BTRFS_RAID_RAID0] = { .num_stripes = 0, - .max_stripes = 0, }, [BTRFS_RAID_SINGLE] = { .num_stripes = 1, - .max_stripes = 0, }, [BTRFS_RAID_RAID5] = { .num_stripes = 0, - .max_stripes = 0, }, [BTRFS_RAID_RAID6] = { .num_stripes = 0, - .max_stripes = 0, }, }; From patchwork Tue Jun 23 14:10:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 11620761 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E5FD660D for ; Tue, 23 Jun 2020 14:10:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CE7C32070E for ; Tue, 23 Jun 2020 14:10:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592921452; bh=ERIt5bsIDNsDxB3w5QMhCDMAvWpICehJ29o9RBPvLzo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=vZ0pafhfQG5lJaoJJ7GAKtkkaXxp7GwtDoEZZGwUlpkXB1QYQlvguUqLxjEarjIVL RMm+V3nPykgq5xE6sbcKWj23oawytxjj7OOfz4yR8kymqy72BpcCMsbYci8wFSEdeP IR++BvGxgfce5lSLuodtgnvz8p70M9tO4iwnJB/0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732809AbgFWOKv (ORCPT ); Tue, 23 Jun 2020 10:10:51 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:40869 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732720AbgFWOKu (ORCPT ); Tue, 23 Jun 2020 10:10:50 -0400 Received: by mail-wm1-f68.google.com with SMTP id f139so1958098wmf.5 for ; Tue, 23 Jun 2020 07:10:48 -0700 (PDT) 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=8HQtq6/PsEMVkFh06uQcpZoI2BZq3AK+tD+s3Fzskfs=; b=HMQEIYV52Jpsxu19xq+vlFy0/x62KeOS/HEfbl9wN+ytyrFf8Kna7ow79znqxjpG8B q+UrPJIE+w3TUwilQW/FoSyvTFtk49Pt0AQc6WEQAi02Fm0/WPfpw5WW46tsUrBzrSwh 0MHf8vY47Kx1F1HgRgxgd+CYcqsIg4a5lutpmtfiOX+6od3V9lJ3m9kjS46crrqu4mRU pvMMBc6PqSgMsUQ242c5khw8zptbnWfHy/8THlQ8+efcEQPCFny7Drw0SVGve5lNf1OE 8yw/iVkb9sV57N6bvamrEoJiv8ei8aV9O6Ctb8COPwf+WCdUQcqB3nBOVhXysGWmff1G I0fw== X-Gm-Message-State: AOAM530NhepsA4GOsz6BI1WbuJgCg+E4kRGzysABrRMZCBQNDiAUGMYA XE3DdONmFRKl2shgR9wIeIo= X-Google-Smtp-Source: ABdhPJy768BpjQy9p0nAhjCH1VWZX4Hts+sFMDKaJLEP6bYG974hp0SbhFot7fuDjrYdA9QkcnL8kQ== X-Received: by 2002:a1c:449:: with SMTP id 70mr22591932wme.149.1592921448368; Tue, 23 Jun 2020 07:10:48 -0700 (PDT) Received: from NUC.fritz.box ([2001:a62:1515:bd01:f64d:30ff:fe6c:acb5]) by smtp.gmail.com with ESMTPSA id n1sm22529497wrp.10.2020.06.23.07.10.47 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Jun 2020 07:10:47 -0700 (PDT) From: Johannes Thumshirn To: David Sterba Cc: linux-btrfs@vger.kernel.org, Qu Wenruo , Johannes Thumshirn Subject: [PATCH 4/4] btrfs-progs: remove btrfs_raid_profile_table Date: Tue, 23 Jun 2020 16:10:19 +0200 Message-Id: <20200623141019.23991-5-jth@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200623141019.23991-1-jth@kernel.org> References: <20200623141019.23991-1-jth@kernel.org> MIME-Version: 1.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org From: Johannes Thumshirn For SINGLE and DUP RAID profiles we can get the num_stripes values from btrfs_raid_attr::dev:stripes. For all other RAID profiles the value is calculated anyways. As this was the last remaining member of the btrfs_raid_profile_table we can remove it as well. Signed-off-by: Johannes Thumshirn --- volumes.c | 34 +--------------------------------- 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/volumes.c b/volumes.c index 71c3735d..e8b4aad8 100644 --- a/volumes.c +++ b/volumes.c @@ -998,44 +998,12 @@ error: - 2 * sizeof(struct btrfs_chunk)) \ / sizeof(struct btrfs_stripe) + 1) -static const struct btrfs_raid_profile { - int num_stripes; -} btrfs_raid_profile_table[BTRFS_NR_RAID_TYPES] = { - [BTRFS_RAID_RAID10] = { - .num_stripes = 0, - }, - [BTRFS_RAID_RAID1] = { - .num_stripes = 0, - }, - [BTRFS_RAID_RAID1C3] = { - .num_stripes = 0, - }, - [BTRFS_RAID_RAID1C4] = { - .num_stripes = 0, - }, - [BTRFS_RAID_DUP] = { - .num_stripes = 2, - }, - [BTRFS_RAID_RAID0] = { - .num_stripes = 0, - }, - [BTRFS_RAID_SINGLE] = { - .num_stripes = 1, - }, - [BTRFS_RAID_RAID5] = { - .num_stripes = 0, - }, - [BTRFS_RAID_RAID6] = { - .num_stripes = 0, - }, -}; - static void init_alloc_chunk_ctl(struct btrfs_fs_info *info, struct alloc_chunk_ctl *ctl) { int type = ctl->type; - ctl->num_stripes = btrfs_raid_profile_table[type].num_stripes; + ctl->num_stripes = btrfs_raid_array[type].dev_stripes; ctl->min_stripes = btrfs_raid_array[type].devs_min; ctl->sub_stripes = btrfs_raid_array[type].sub_stripes; ctl->stripe_len = BTRFS_STRIPE_LEN;