| 201 | |
| 202 | |
| 203 | BOOLEAN |
| 204 | Ext2LoadGroup(IN PEXT2_VCB Vcb) |
| 205 | { |
| 206 | struct super_block *sb = &Vcb->sb; |
| 207 | struct ext4_sb_info *sbi = &Vcb->sbi; |
| 208 | ext3_fsblk_t sb_block = 1; |
| 209 | unsigned long i; |
| 210 | BOOLEAN rc = FALSE; |
| 211 | |
| 212 | __try { |
| 213 | |
| 214 | ExAcquireResourceExclusiveLite(&Vcb->sbi.s_gd_lock, TRUE); |
| 215 | |
| 216 | if (NULL == sbi->s_gd) { |
| 217 | sbi->s_gd = kzalloc(sbi->s_gdb_count * sizeof(struct ext3_gd), |
| 218 | GFP_KERNEL); |
| 219 | } |
| 220 | if (sbi->s_gd == NULL) { |
| 221 | DEBUG(DL_ERR, ("Ext2LoadGroup: not enough memory.\n")); |
| 222 | __leave; |
| 223 | } |
| 224 | |
| 225 | if (BLOCK_SIZE != EXT3_MIN_BLOCK_SIZE) { |
| 226 | sb_block = EXT4_MIN_BLOCK_SIZE / BLOCK_SIZE; |
| 227 | } |
| 228 | |
| 229 | for (i = 0; i < sbi->s_gdb_count; i++) { |
| 230 | sbi->s_gd[i].block = descriptor_loc(sb, sb_block, i); |
| 231 | if (!sbi->s_gd[i].block) { |
| 232 | DEBUG(DL_ERR, ("Ext2LoadGroup: can't locate group descriptor %d\n", i)); |
| 233 | __leave; |
| 234 | } |
| 235 | } |
| 236 | |
| 237 | if (!Ext2LoadGroupBH(Vcb)) { |
| 238 | DEBUG(DL_ERR, ("Ext2LoadGroup: Failed to load group descriptions !\n")); |
| 239 | __leave; |
| 240 | } |
| 241 | |
| 242 | if (!ext4_check_descriptors(sb)) { |
| 243 | DbgBreak(); |
| 244 | DEBUG(DL_ERR, ("Ext2LoadGroup: group descriptors corrupted !\n")); |
| 245 | __leave; |
| 246 | } |
| 247 | |
| 248 | SetFlag(Vcb->Flags, VCB_GD_LOADED); |
| 249 | rc = TRUE; |
| 250 | |
| 251 | } __finally { |
| 252 | |
| 253 | if (!rc) |
| 254 | Ext2PutGroup(Vcb); |
| 255 | |
| 256 | ExReleaseResourceLite(&Vcb->sbi.s_gd_lock); |
| 257 | } |
| 258 | |
| 259 | return rc; |
| 260 | } |
no test coverage detected