test on top of GuangZhe's fix on layer1
This commit is contained in:
parent
dcf097a411
commit
3814ee0409
@ -9,8 +9,8 @@ one inode equipped with one 512 bytes block
|
|||||||
*****************************************************/
|
*****************************************************/
|
||||||
#define SECTOR_SIZE 512
|
#define SECTOR_SIZE 512
|
||||||
#define IO_BLOCK_SIZE 4096
|
#define IO_BLOCK_SIZE 4096
|
||||||
#define MAX_INODE 524288
|
#define MAX_INODE 2048
|
||||||
#define MAX_BLOCKNUM MAX_INODE*2 //62914560
|
#define MAX_BLOCKNUM 51200 //62914560
|
||||||
|
|
||||||
class SuperBlock{
|
class SuperBlock{
|
||||||
|
|
||||||
@ -169,8 +169,8 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!notFull){
|
if (!notFull){
|
||||||
printf("HEADER REMOVAL DETECTED %llu %llu\n", freeListHead, freeBlockNum);
|
|
||||||
u_int64_t next_header = read_byte_at(0, buffer);
|
u_int64_t next_header = read_byte_at(0, buffer);
|
||||||
|
printf("HEADER MOVE (Cause: Alloc) %llu -> %llu (%llu)\n", freeListHead, next_header, freeBlockNum);
|
||||||
SuperBlock::writeFreeListHead(disk, next_header);
|
SuperBlock::writeFreeListHead(disk, next_header);
|
||||||
}
|
}
|
||||||
return freeBlockNum;
|
return freeBlockNum;
|
||||||
@ -291,6 +291,7 @@ public:
|
|||||||
if(!nowInList){
|
if(!nowInList){
|
||||||
u_int64_t freeListHead = SuperBlock::getFreeListHead(disk);
|
u_int64_t freeListHead = SuperBlock::getFreeListHead(disk);
|
||||||
write_byte_at(freeListHead, 0, buffer);
|
write_byte_at(freeListHead, 0, buffer);
|
||||||
|
printf("HEADER MOVE (Cause: Dealloc) %llu -> %llu\n", freeListHead, freeBlockHead);
|
||||||
SuperBlock::writeFreeListHead(disk, freeBlockHead);
|
SuperBlock::writeFreeListHead(disk, freeBlockHead);
|
||||||
}
|
}
|
||||||
disk.rawdisk_write(freeBlockHead, buffer, sizeof(buffer));
|
disk.rawdisk_write(freeBlockHead, buffer, sizeof(buffer));
|
||||||
|
@ -81,8 +81,10 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
// Test Big File (Use direct, single indirect, double indirect)
|
// Test Big File (Use direct, single indirect, double indirect)
|
||||||
printf("=== Big File Test ===\n");
|
printf("=== Big File Test ===\n");
|
||||||
|
u_int64_t lastAllc = 0;
|
||||||
for(int j=0;j<5000;j++){
|
for(int j=0;j<5000;j++){
|
||||||
u_int64_t allcBlockNum = inode_inside[0].datablock_allocate(*H);
|
u_int64_t allcBlockNum = inode_inside[0].datablock_allocate(*H);
|
||||||
|
lastAllc = allcBlockNum;
|
||||||
u_int64_t fh = SuperBlock::getFreeListHead(*H);
|
u_int64_t fh = SuperBlock::getFreeListHead(*H);
|
||||||
if (allcBlockNum % 2048 != 0 || allcBlockNum < 2048*512 || allcBlockNum >= 25*2048*512 || fh >= 51200*512) {
|
if (allcBlockNum % 2048 != 0 || allcBlockNum < 2048*512 || allcBlockNum >= 25*2048*512 || fh >= 51200*512) {
|
||||||
printf("%d, Alloc Block Number: %llu\n", j, allcBlockNum);
|
printf("%d, Alloc Block Number: %llu\n", j, allcBlockNum);
|
||||||
@ -90,6 +92,7 @@ int main(int argc, char *argv[]) {
|
|||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
printf("last allocate for big file: %llu\n", lastAllc);
|
||||||
printf("Finished Allocating\n");
|
printf("Finished Allocating\n");
|
||||||
printf("freeListHead: %d \n", SuperBlock::getFreeListHead(*H));
|
printf("freeListHead: %d \n", SuperBlock::getFreeListHead(*H));
|
||||||
for(int j=0;j<5000;j++){
|
for(int j=0;j<5000;j++){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user