All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: David Sterba <dsterba@suse.com>, anand.jain@oracle.com
Subject: [PATCH 12/15] btrfs: indtroduce raid-type to error-code table, for minimum device constraint
Date: Mon, 15 Feb 2016 18:34:36 +0100	[thread overview]
Message-ID: <d05a46053f82b1b716cad4178c91242ed515b166.1455556900.git.dsterba@suse.com> (raw)
In-Reply-To: <cover.1455556900.git.dsterba@suse.com>

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/volumes.c | 15 +++++++++++++++
 fs/btrfs/volumes.h |  2 +-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index ae94e06f3e61..a67249582a6f 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -118,6 +118,21 @@ const u64 btrfs_raid_group[BTRFS_NR_RAID_TYPES] = {
 	[BTRFS_RAID_RAID6]  = BTRFS_BLOCK_GROUP_RAID6,
 };
 
+/*
+ * Table to convert BTRFS_RAID_* to the error code if minimum number of devices
+ * condition is not met. Zero means there's no corresponding
+ * BTRFS_ERROR_DEV_*_NOT_MET value.
+ */
+const int btrfs_raid_mindev_error[BTRFS_NR_RAID_TYPES] = {
+	[BTRFS_RAID_RAID10] = BTRFS_ERROR_DEV_RAID10_MIN_NOT_MET,
+	[BTRFS_RAID_RAID1]  = BTRFS_ERROR_DEV_RAID1_MIN_NOT_MET,
+	[BTRFS_RAID_DUP]    = 0,
+	[BTRFS_RAID_RAID0]  = 0,
+	[BTRFS_RAID_SINGLE] = 0,
+	[BTRFS_RAID_RAID5]  = BTRFS_ERROR_DEV_RAID5_MIN_NOT_MET,
+	[BTRFS_RAID_RAID6]  = BTRFS_ERROR_DEV_RAID6_MIN_NOT_MET,
+};
+
 static int init_first_rw_device(struct btrfs_trans_handle *trans,
 				struct btrfs_root *root,
 				struct btrfs_device *device);
diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
index c73d027e2f8b..a13a538cb01e 100644
--- a/fs/btrfs/volumes.h
+++ b/fs/btrfs/volumes.h
@@ -340,7 +340,7 @@ struct btrfs_raid_attr {
 };
 
 extern const struct btrfs_raid_attr btrfs_raid_array[BTRFS_NR_RAID_TYPES];
-
+extern const int btrfs_raid_mindev_error[BTRFS_NR_RAID_TYPES];
 extern const u64 btrfs_raid_group[BTRFS_NR_RAID_TYPES];
 
 struct map_lookup {
-- 
2.7.1


  parent reply	other threads:[~2016-02-15 17:34 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-15 17:33 [PATCH 00/15] Device delete by id David Sterba
2016-02-15 17:33 ` [PATCH 01/15] btrfs: create a helper function to read the disk super David Sterba
2016-02-15 17:34 ` [PATCH 02/15] btrfs: create helper function __check_raid_min_devices() David Sterba
2016-02-15 17:34 ` [PATCH 03/15] btrfs: clean up and optimize __check_raid_min_device() David Sterba
2016-02-15 17:34 ` [PATCH 04/15] btrfs: create helper btrfs_find_device_by_user_input() David Sterba
2016-02-15 17:34 ` [PATCH 05/15] btrfs: make use of btrfs_find_device_by_user_input() David Sterba
2016-02-15 17:34 ` [PATCH 06/15] btrfs: enhance btrfs_find_device_by_user_input() to check device path David Sterba
2016-02-15 17:34 ` [PATCH 07/15] btrfs: make use of btrfs_scratch_superblocks() in btrfs_rm_device() David Sterba
2016-02-15 17:34 ` [PATCH 08/15] btrfs: introduce device delete by devid David Sterba
2016-02-15 17:34 ` [PATCH 09/15] btrfs: optimize check for stale device David Sterba
2016-02-15 17:34 ` [PATCH 10/15] btrfs: rename __check_raid_min_devices David Sterba
2016-02-16  9:07   ` Anand Jain
2016-02-15 17:34 ` [PATCH 11/15] btrfs: pass number of devices to btrfs_check_raid_min_devices David Sterba
2016-02-16  9:08   ` Anand Jain
2016-02-15 17:34 ` David Sterba [this message]
2016-02-16  9:09   ` [PATCH 12/15] btrfs: indtroduce raid-type to error-code table, for minimum device constraint Anand Jain
2016-02-15 17:34 ` [PATCH 13/15] btrfs: use existing device constraints table btrfs_raid_array David Sterba
2016-02-16  9:13   ` Anand Jain
2016-02-15 17:34 ` [PATCH 14/15] btrfs: rename btrfs_find_device_by_user_input David Sterba
2016-02-16  9:14   ` Anand Jain
2016-02-15 17:34 ` [PATCH 15/15] btrfs: rename flags for vol args v2 David Sterba
2016-02-16  9:18   ` Anand Jain
2016-02-16  9:43     ` David Sterba
2016-02-25 17:59 ` [PATCH 00/15] Device delete by id David Sterba
2016-03-11  8:16   ` Anand Jain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d05a46053f82b1b716cad4178c91242ed515b166.1455556900.git.dsterba@suse.com \
    --to=dsterba@suse.com \
    --cc=anand.jain@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.