From 2a60b44d659163bad391fb4cad8850219683cfb6 Mon Sep 17 00:00:00 2001 From: Dmitry Gorbachev Date: Sun, 16 Aug 2009 01:20:22 +0000 Subject: [PATCH] Take inode size from Ext2 superblock. svn path=/trunk/; revision=42723 --- reactos/drivers/filesystems/ext2/inc/struct.h | 5 +++-- reactos/drivers/filesystems/ext2/src/fsctrl.c | 14 +++++++++++--- reactos/drivers/filesystems/ext2/src/io.c | 4 ++-- reactos/drivers/filesystems/ext2/src/metadata.c | 6 +++--- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/reactos/drivers/filesystems/ext2/inc/struct.h b/reactos/drivers/filesystems/ext2/inc/struct.h index 4a76c886df2..91c148e6a2a 100644 --- a/reactos/drivers/filesystems/ext2/inc/struct.h +++ b/reactos/drivers/filesystems/ext2/inc/struct.h @@ -452,8 +452,9 @@ typedef struct _Ext2VolumeControlBlock ULONG ReservedBlocksCount; ULONG FreeBlocksCount; ULONG FreeInodesCount; - ULONG LogBlockSize; // Block size = 1024 << LogBlockSize - + ULONG LogBlockSize; // Block size = 1024 << LogBlockSize + ULONG InodeSize; + // Group Information Saved up in the VCB... PtrExt2GroupDescriptors PtrGroupDescriptors; ULONG NoOfGroups; diff --git a/reactos/drivers/filesystems/ext2/src/fsctrl.c b/reactos/drivers/filesystems/ext2/src/fsctrl.c index 472dfbfc9b8..26837451394 100644 --- a/reactos/drivers/filesystems/ext2/src/fsctrl.c +++ b/reactos/drivers/filesystems/ext2/src/fsctrl.c @@ -368,6 +368,14 @@ Ext2MountVolume ( PtrVCB->NoOfGroups = ( SuperBlock->s_blocks_count - SuperBlock->s_first_data_block + SuperBlock->s_blocks_per_group - 1 ) / SuperBlock->s_blocks_per_group; + if( SuperBlock->s_rev_level ) + { + PtrVCB->InodeSize = SuperBlock->s_inode_size; + } + else + { + PtrVCB->InodeSize = sizeof( EXT2_INODE ); + } PtrVCB->PtrGroupDescriptors = Ext2AllocatePool( NonPagedPool, sizeof( Ext2GroupDescriptors ) * PtrVCB->NoOfGroups ); @@ -465,9 +473,9 @@ Ext2MountVolume ( ZeroSize.QuadPart = 0; if ( !NT_SUCCESS( Ext2CreateNewFCB( &PtrVCB->PtrRootDirectoryFCB, // Root FCB - ZeroSize, // AllocationSize, - ZeroSize, // EndOfFile, - PtrRootFileObject, // The Root Dircetory File Object + ZeroSize, // AllocationSize, + ZeroSize, // EndOfFile, + PtrRootFileObject, // The Root Dircetory File Object PtrVCB, PtrObjectName ) ) ) { diff --git a/reactos/drivers/filesystems/ext2/src/io.c b/reactos/drivers/filesystems/ext2/src/io.c index a09b83db5b5..24d93f71da0 100644 --- a/reactos/drivers/filesystems/ext2/src/io.c +++ b/reactos/drivers/filesystems/ext2/src/io.c @@ -184,7 +184,7 @@ NTSTATUS NTAPI Ext2PassDownMultiReadWriteIRP( } for( i = 0; i < Count; i++ ) { - DbgPrint("PASSING DOWN IRP %d TO TARGET DEVICE\n", i); + // DbgPrint("PASSING DOWN IRP %d TO TARGET DEVICE\n", i); IoCallDriver( PtrVCB->TargetDeviceObject, PtrIoRuns[ i].PtrAssociatedIrp ); } @@ -194,7 +194,7 @@ NTSTATUS NTAPI Ext2PassDownMultiReadWriteIRP( // Synchronous IO // Wait for the IO to complete... // - DbgPrint("DEADLY WAIT (%d)\n", KeGetCurrentIrql()); + DbgPrint("DEADLY WAIT (%d)\n", KeGetCurrentIrql()); KeWaitForSingleObject( PtrSyncEvent, Executive, KernelMode, FALSE, (PLARGE_INTEGER)NULL ); DbgPrint("DEADLY WAIT DONE\n"); diff --git a/reactos/drivers/filesystems/ext2/src/metadata.c b/reactos/drivers/filesystems/ext2/src/metadata.c index 468a1e46e99..7a6fb5aa60b 100644 --- a/reactos/drivers/filesystems/ext2/src/metadata.c +++ b/reactos/drivers/filesystems/ext2/src/metadata.c @@ -102,9 +102,9 @@ NTSTATUS NTAPI Ext2ReadInode ( NumberOfBytesToRead = sizeof(EXT2_INODE); // LogicalBlockSize; VolumeByteOffset.QuadPart = PtrVcb->PtrGroupDescriptors[ GroupNo ].InodeTablesBlock - * LogicalBlockSize + Index * sizeof(EXT2_INODE); + * LogicalBlockSize + Index * PtrVcb->InodeSize; //VolumeByteOffset.QuadPart = PtrVcb->InodeTableBlock[ GroupNo ] * LogicalBlockSize + - // Index * sizeof(EXT2_INODE); + // Index * PtrVcb->InodeSize; TempOffset.QuadPart = Ext2Align64( VolumeByteOffset.QuadPart, LogicalBlockSize ); if( TempOffset.QuadPart != VolumeByteOffset.QuadPart ) @@ -752,7 +752,7 @@ NTSTATUS NTAPI Ext2WriteInode( NumberOfBytesToRead = sizeof(EXT2_INODE); VolumeByteOffset.QuadPart = PtrVcb->PtrGroupDescriptors[ GroupNo ].InodeTablesBlock - * LogicalBlockSize + Index * sizeof(EXT2_INODE); + * LogicalBlockSize + Index * PtrVcb->InodeSize; TempOffset.QuadPart = Ext2Align64( VolumeByteOffset.QuadPart, LogicalBlockSize ); if( TempOffset.QuadPart != VolumeByteOffset.QuadPart )