get_next_cluster_forDR
2017-03-21 16:38:49 0 举报
`get_next_cluster_forDR` 是一个函数,用于获取分布式恢复(Distributed Recovery,简称DR)过程中的下一个数据块集群。在分布式系统中,数据通常被分散存储在不同的节点上,以提高系统的可靠性和容错能力。当某个节点出现故障时,分布式恢复机制会自动将该节点上的数据迁移到其他正常节点上,以保持数据的完整性和可用性。在这个过程中,`get_next_cluster_forDR` 函数会根据预设的策略和算法,确定需要恢复的数据块所在的集群,并将其返回给调用者。这个函数可以帮助实现快速、高效的数据恢复,确保分布式系统在面临节点故障时仍能保持稳定运行。
作者其他创作
大纲/内容
否
end
偶数取低位next_cluster=le16(*((uint16_t*)&staticbuffer[offset_o]))&0x0FFF;
是FAT16upart_type==UP_FAT16
是
clearBuffer
start
staticbuffer
右移next_cluster=le16((*((uint16_t*)&staticbuffer[offset_o])))4;
staticbuffer = (unsigned char*)MALLOC(buffer_size);clearBuffer = true;newFile = false;
offset_s=(cluster+cluster/2)/disk_car-sector_size;offset_o=(cluster+cluster/2)%disk_car-sector_size;
计算该簇在fat的位置p16=(const uint16_t*)staticbuffer;offset_s=cluster/(disk_car-sector_size/2);offset_o=cluster%(disk_car-sector_size/2);
释放free(staticbuffer);
计算该簇在fat的位置p16=(const uint16_t*)staticbuffer;offset_s=cluster/(disk_car-sector_size/4);offset_o=cluster%(disk_car-sector_size/4);
prevOffset_s = offset_s;prevOffset = offset;clearBuffer = true;
是FAT12upart_type==UP_FAT12
计算该簇在fat的位置
offset_s!=prevOffset_s || prevOffset != offset
prevOffset = offset;prevOffset_s = 0;
free(staticbuffer);staticbuffer = NULL;
newFile || staticbuffer==NULL
是FAT32upart_type==UP_FAT32
计算下一簇next_cluster=le16(p16[offset_o]);
为奇数cluster&1)!=0
计算下一簇next_cluster=le32(p32[offset_o]);
收藏
收藏
0 条评论
下一页