diff options
author | Goldwyn Rodrigues <rgoldwyn@gmail.com> | 2010-10-11 13:57:09 -0400 |
---|---|---|
committer | Joel Becker <joel.becker@oracle.com> | 2010-10-11 16:56:32 -0400 |
commit | 75d9bbc73804285020aa4d99bd2a9600edea8945 (patch) | |
tree | 02b197462fb0c102b9ccb57266810ebf375a028f /fs | |
parent | f30d44f3e54a94e037da7a71d714b585dab28d9e (diff) |
Initialize max_slots early
Functions such as ocfs2_recovery_init() make use of osb->max_slots.
Initialize osb->max_slots early so the functions may use the correct
value.
Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.de>
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ocfs2/super.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 350e8b5a9396..b578644b6637 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -2105,6 +2105,15 @@ static int ocfs2_initialize_super(struct super_block *sb, | |||
2105 | snprintf(osb->dev_str, sizeof(osb->dev_str), "%u,%u", | 2105 | snprintf(osb->dev_str, sizeof(osb->dev_str), "%u,%u", |
2106 | MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev)); | 2106 | MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev)); |
2107 | 2107 | ||
2108 | osb->max_slots = le16_to_cpu(di->id2.i_super.s_max_slots); | ||
2109 | if (osb->max_slots > OCFS2_MAX_SLOTS || osb->max_slots == 0) { | ||
2110 | mlog(ML_ERROR, "Invalid number of node slots (%u)\n", | ||
2111 | osb->max_slots); | ||
2112 | status = -EINVAL; | ||
2113 | goto bail; | ||
2114 | } | ||
2115 | mlog(0, "max_slots for this device: %u\n", osb->max_slots); | ||
2116 | |||
2108 | ocfs2_orphan_scan_init(osb); | 2117 | ocfs2_orphan_scan_init(osb); |
2109 | 2118 | ||
2110 | status = ocfs2_recovery_init(osb); | 2119 | status = ocfs2_recovery_init(osb); |
@@ -2143,15 +2152,6 @@ static int ocfs2_initialize_super(struct super_block *sb, | |||
2143 | goto bail; | 2152 | goto bail; |
2144 | } | 2153 | } |
2145 | 2154 | ||
2146 | osb->max_slots = le16_to_cpu(di->id2.i_super.s_max_slots); | ||
2147 | if (osb->max_slots > OCFS2_MAX_SLOTS || osb->max_slots == 0) { | ||
2148 | mlog(ML_ERROR, "Invalid number of node slots (%u)\n", | ||
2149 | osb->max_slots); | ||
2150 | status = -EINVAL; | ||
2151 | goto bail; | ||
2152 | } | ||
2153 | mlog(0, "max_slots for this device: %u\n", osb->max_slots); | ||
2154 | |||
2155 | osb->slot_recovery_generations = | 2155 | osb->slot_recovery_generations = |
2156 | kcalloc(osb->max_slots, sizeof(*osb->slot_recovery_generations), | 2156 | kcalloc(osb->max_slots, sizeof(*osb->slot_recovery_generations), |
2157 | GFP_KERNEL); | 2157 | GFP_KERNEL); |