int numStripes = getNumStripes(blocks.length);
for (int i = 0; i < numStripes; i++) {
System.arraycopy(parityBlocks, pPos, newList, pos, numParityBlocks);
for (int j = pos; j < pos + numParityBlocks; j++) {
blocksMap.updateINode(newList[j],
new RaidBlockInfo(newList[j], parityReplication, j), inode,
parityReplication, true);
}
pPos += numParityBlocks;
pos += numParityBlocks;
for (int j = 0; j < numDataBlocks && sPos < blocks.length;
j++, pos++, sPos++) {
newList[pos] = blocks[sPos];
if (checksums != null) {
if (blocks[sPos].getChecksum() != BlockInfo.NO_BLOCK_CHECKSUM
&& blocks[sPos].getChecksum() != checksums[sPos]) {
throw new IOException("Checksum mismatch for the " + sPos +
"th source blocks. New=" + checksums[sPos] +
", Existing=" + blocks[sPos].getChecksum());
}
blocks[sPos].setChecksum(checksums[sPos]);
}
blocksMap.updateINode(newList[pos], new RaidBlockInfo(newList[pos],
replication, pos), inode, replication, true);
}
}
return newList;
}