try to fix layer1

This commit is contained in:
FactorialN 2023-11-27 22:12:11 -08:00
parent 256ae04094
commit 12cb090fcf
2 changed files with 3 additions and 3 deletions

View File

@ -4,7 +4,7 @@ Fs::Fs(RawDisk *disk) : disk(disk) {
superblock = SuperBlock_Data();
inode_manager = new INode_Manager_Freelist(this, 1, 1 + NUM_INODE_BLOCKS);
datablock_manager =
new DataBlock_Manager_Bitmap(this, 1 + NUM_INODE_BLOCKS, NUM_BLOCKS);
new DataBlock_Manager_Bitmap(this, 1 + NUM_INODE_BLOCKS, disk->diskSize/IO_BLOCK_SIZE);
};
Fs::~Fs() {

View File

@ -65,12 +65,12 @@ int main(int argc, char *argv[]) {
1); // the first 8 bytes of 4k I/O block will store
// the next address(after 2048*4k I/O block)
// test the end of the datablock
H->read_block(NUM_BLOCKS - DATABLOCKS_PER_BITMAP_BLOCK - 1, buffer);
H->read_block(fs->disk->diskSize/IO_BLOCK_SIZE - DATABLOCKS_PER_BITMAP_BLOCK - 1, buffer);
t = 0;
for (int j = 0; j < 8; j++)
t |= ((u_int64_t)(unsigned char)buffer[j]) << (8 * j);
assert(t == NUM_BLOCKS - DATABLOCKS_PER_BITMAP_BLOCK - 1);
assert(t == fs->disk->diskSize/IO_BLOCK_SIZE - DATABLOCKS_PER_BITMAP_BLOCK - 1);
/***************************test inode
* de/allocation**********************************/