Commit 94598ba8 authored by Stefan Behrens's avatar Stefan Behrens Committed by Chris Mason

Btrfs: introduce common define for max number of mirrors

Readahead already has a define for the max number of mirrors. Scrub
needs such a define now, the rest of the code will need something
like this soon. Therefore the define was added to ctree.h and removed
from the readahead code.
Signed-off-by: default avatarStefan Behrens <sbehrens@giantdisaster.de>
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent ea466794
...@@ -48,6 +48,8 @@ struct btrfs_ordered_sum; ...@@ -48,6 +48,8 @@ struct btrfs_ordered_sum;
#define BTRFS_MAGIC "_BHRfS_M" #define BTRFS_MAGIC "_BHRfS_M"
#define BTRFS_MAX_MIRRORS 2
#define BTRFS_MAX_LEVEL 8 #define BTRFS_MAX_LEVEL 8
#define BTRFS_COMPAT_EXTENT_TREE_V0 #define BTRFS_COMPAT_EXTENT_TREE_V0
......
...@@ -54,7 +54,6 @@ ...@@ -54,7 +54,6 @@
* than the 2 started one after another. * than the 2 started one after another.
*/ */
#define MAX_MIRRORS 2
#define MAX_IN_FLIGHT 6 #define MAX_IN_FLIGHT 6
struct reada_extctl { struct reada_extctl {
...@@ -71,7 +70,7 @@ struct reada_extent { ...@@ -71,7 +70,7 @@ struct reada_extent {
struct list_head extctl; struct list_head extctl;
struct kref refcnt; struct kref refcnt;
spinlock_t lock; spinlock_t lock;
struct reada_zone *zones[MAX_MIRRORS]; struct reada_zone *zones[BTRFS_MAX_MIRRORS];
int nzones; int nzones;
struct btrfs_device *scheduled_for; struct btrfs_device *scheduled_for;
}; };
...@@ -84,7 +83,8 @@ struct reada_zone { ...@@ -84,7 +83,8 @@ struct reada_zone {
spinlock_t lock; spinlock_t lock;
int locked; int locked;
struct btrfs_device *device; struct btrfs_device *device;
struct btrfs_device *devs[MAX_MIRRORS]; /* full list, incl self */ struct btrfs_device *devs[BTRFS_MAX_MIRRORS]; /* full list, incl
* self */
int ndevs; int ndevs;
struct kref refcnt; struct kref refcnt;
}; };
...@@ -365,9 +365,9 @@ static struct reada_extent *reada_find_extent(struct btrfs_root *root, ...@@ -365,9 +365,9 @@ static struct reada_extent *reada_find_extent(struct btrfs_root *root,
if (ret || !bbio || length < blocksize) if (ret || !bbio || length < blocksize)
goto error; goto error;
if (bbio->num_stripes > MAX_MIRRORS) { if (bbio->num_stripes > BTRFS_MAX_MIRRORS) {
printk(KERN_ERR "btrfs readahead: more than %d copies not " printk(KERN_ERR "btrfs readahead: more than %d copies not "
"supported", MAX_MIRRORS); "supported", BTRFS_MAX_MIRRORS);
goto error; goto error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment