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>

authored by Goldwyn Rodrigues and committed by Joel Becker 75d9bbc7 f30d44f3

+9 -9
+9 -9
fs/ocfs2/super.c
··· 2105 snprintf(osb->dev_str, sizeof(osb->dev_str), "%u,%u", 2106 MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev)); 2107 2108 ocfs2_orphan_scan_init(osb); 2109 2110 status = ocfs2_recovery_init(osb); ··· 2151 status = -ENOMEM; 2152 goto bail; 2153 } 2154 - 2155 - osb->max_slots = le16_to_cpu(di->id2.i_super.s_max_slots); 2156 - if (osb->max_slots > OCFS2_MAX_SLOTS || osb->max_slots == 0) { 2157 - mlog(ML_ERROR, "Invalid number of node slots (%u)\n", 2158 - osb->max_slots); 2159 - status = -EINVAL; 2160 - goto bail; 2161 - } 2162 - mlog(0, "max_slots for this device: %u\n", osb->max_slots); 2163 2164 osb->slot_recovery_generations = 2165 kcalloc(osb->max_slots, sizeof(*osb->slot_recovery_generations),
··· 2105 snprintf(osb->dev_str, sizeof(osb->dev_str), "%u,%u", 2106 MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev)); 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 + 2117 ocfs2_orphan_scan_init(osb); 2118 2119 status = ocfs2_recovery_init(osb); ··· 2142 status = -ENOMEM; 2143 goto bail; 2144 } 2145 2146 osb->slot_recovery_generations = 2147 kcalloc(osb->max_slots, sizeof(*osb->slot_recovery_generations),