diff --git a/Ext4Fsd/DIRS b/Ext4Fsd/DIRS
index 8405b8b..c9e0cbd 100644
--- a/Ext4Fsd/DIRS
+++ b/Ext4Fsd/DIRS
@@ -1 +1 @@
-DIRS = nls ext3 ext4 jbd jbd2 sys
+DIRS = nls ext3 ext4 jbd2 sys
diff --git a/Ext4Fsd/Ext4Fsd.vcxproj b/Ext4Fsd/Ext4Fsd.vcxproj
index f7b1a48..99af665 100644
--- a/Ext4Fsd/Ext4Fsd.vcxproj
+++ b/Ext4Fsd/Ext4Fsd.vcxproj
@@ -218,9 +218,10 @@
-
-
-
+
+
+
+
diff --git a/Ext4Fsd/Ext4Fsd.vcxproj.filters b/Ext4Fsd/Ext4Fsd.vcxproj.filters
index bbee764..1593aa3 100644
--- a/Ext4Fsd/Ext4Fsd.vcxproj.filters
+++ b/Ext4Fsd/Ext4Fsd.vcxproj.filters
@@ -23,12 +23,12 @@
{9ab142d9-f11c-4d93-b92a-0df6595d2e24}
-
- {3e51e838-e180-44c1-ae2d-53cf5297396b}
-
{94a9d102-6815-4f19-9b62-763fe5d482ca}
+
+ {05b648dd-bb69-40ed-abff-2df7db3c7f92}
+
@@ -142,15 +142,6 @@
Source Files\ext4
-
- Source Files\jbd
-
-
- Source Files\jbd
-
-
- Source Files\jbd
-
Source Files\nls
@@ -277,6 +268,18 @@
Source Files\ext4
+
+ Source Files\jbd2
+
+
+ Source Files\jbd2
+
+
+ Source Files\jbd2
+
+
+ Source Files\jbd2
+
diff --git a/Ext4Fsd/ext3/recover.c b/Ext4Fsd/ext3/recover.c
index e30a80c..025ef97 100644
--- a/Ext4Fsd/ext3/recover.c
+++ b/Ext4Fsd/ext3/recover.c
@@ -1,174 +1,186 @@
-/*
- * COPYRIGHT: See COPYRIGHT.TXT
- * PROJECT: Ext2 File System Driver for WinNT/2K/XP
- * FILE: recover.c
- * PROGRAMMER: Matt Wu
- * HOMEPAGE: http://www.ext2fsd.com
- * UPDATE HISTORY:
- */
-
-/* INCLUDES *****************************************************************/
-
-#include
-#include
-
-/* GLOBALS ***************************************************************/
-
-extern PEXT2_GLOBAL Ext2Global;
-
-/* DEFINITIONS *************************************************************/
-
-#ifdef ALLOC_PRAGMA
-#pragma alloc_text(PAGE, Ext2LoadInternalJournal)
-#pragma alloc_text(PAGE, Ext2CheckJournal)
-#pragma alloc_text(PAGE, Ext2RecoverJournal)
-#endif
-
-PEXT2_MCB
-Ext2LoadInternalJournal(
- PEXT2_VCB Vcb,
- ULONG jNo
-)
-{
- PEXT2_MCB Jcb = NULL;
-
- Jcb = Ext2AllocateMcb(Vcb, NULL, NULL, 0);
- if (!Jcb) {
- goto errorout;
- }
-
- Jcb->Inode.i_ino = jNo;
- Jcb->Inode.i_sb = &Vcb->sb;
- if (!Ext2LoadInode(Vcb, &Jcb->Inode)) {
- DbgBreak();
- Ext2FreeMcb(Vcb, Jcb);
- goto errorout;
- }
-
-errorout:
-
- return Jcb;
-}
-
-INT
-Ext2CheckJournal(
- PEXT2_VCB Vcb,
- PULONG jNo
-)
-{
- struct ext3_super_block* esb = NULL;
-
- /* check ext3 super block */
- esb = (struct ext3_super_block *)Vcb->SuperBlock;
- if (IsFlagOn(esb->s_feature_incompat,
- EXT3_FEATURE_INCOMPAT_RECOVER)) {
- SetLongFlag(Vcb->Flags, VCB_JOURNAL_RECOVER);
- }
-
- /* must stop here if volume is read-only */
- if (IsVcbReadOnly(Vcb)) {
- goto errorout;
- }
-
- /* journal is external ? */
- if (esb->s_journal_inum == 0) {
- goto errorout;
- }
-
- /* oops: volume is corrupted */
- if (esb->s_journal_dev) {
- goto errorout;
- }
-
- /* return the journal inode number */
- *jNo = esb->s_journal_inum;
-
- return TRUE;
-
-errorout:
-
- return FALSE;
-}
-
-INT
-Ext2RecoverJournal(
- PEXT2_IRP_CONTEXT IrpContext,
- PEXT2_VCB Vcb
-)
-{
- INT rc = 0;
- ULONG jNo = 0;
- PEXT2_MCB jcb = NULL;
- struct block_device * bd = &Vcb->bd;
- struct super_block * sb = &Vcb->sb;
- struct inode * ji = NULL;
- journal_t * journal = NULL;
- struct ext3_super_block *esb;
-
- ExAcquireResourceExclusiveLite(&Vcb->MainResource, TRUE);
-
- /* check journal inode number */
- if (!Ext2CheckJournal(Vcb, &jNo)) {
- rc = -1;
- goto errorout;
- }
-
- /* allocate journal Mcb */
- jcb = Ext2LoadInternalJournal(Vcb, jNo);
- if (!jcb) {
- rc = -6;
- goto errorout;
- }
-
- /* allocate journal inode */
- ji = &jcb->Inode;
-
- /* initialize journal file from inode */
- journal = journal_init_inode(ji);
-
- /* initialzation succeeds ? */
- if (!journal) {
- iput(ji);
- rc = -8;
- goto errorout;
- }
-
- /* start journal recovery */
- rc = journal_load(journal);
- if (0 != rc) {
- rc = -9;
- DbgPrint("Ext2Fsd: recover_journal: failed "
- "to recover journal data.\n");
- }
-
- /* reload super_block and group_description */
- Ext2RefreshSuper(IrpContext, Vcb);
- Ext2RefreshGroup(IrpContext, Vcb);
-
- /* wipe journal data and clear recover flag in sb */
- if (rc == 0) {
- journal_wipe_recovery(journal);
- ClearLongFlag(
- Vcb->SuperBlock->s_feature_incompat,
- EXT3_FEATURE_INCOMPAT_RECOVER );
- Ext2SaveSuper(IrpContext, Vcb);
- sync_blockdev(bd);
- ClearLongFlag(Vcb->Flags, VCB_JOURNAL_RECOVER);
- }
-
-errorout:
-
- /* destroy journal structure */
- if (journal) {
- journal_destroy(journal);
- }
-
- /* destory journal Mcb */
- if (jcb) {
- Ext2FreeMcb(Vcb, jcb);
- }
-
- ExReleaseResourceLite(&Vcb->MainResource);
-
- return rc;
-}
+/*
+ * COPYRIGHT: See COPYRIGHT.TXT
+ * PROJECT: Ext2 File System Driver for WinNT/2K/XP
+ * FILE: recover.c
+ * PROGRAMMER: Matt Wu
+ * HOMEPAGE: http://www.ext2fsd.com
+ * UPDATE HISTORY:
+ */
+
+/* INCLUDES *****************************************************************/
+
+#include
+#include
+
+/* GLOBALS ***************************************************************/
+
+extern PEXT2_GLOBAL Ext2Global;
+
+/* DEFINITIONS *************************************************************/
+
+#ifdef ALLOC_PRAGMA
+#pragma alloc_text(PAGE, Ext2LoadInternalJournal)
+#pragma alloc_text(PAGE, Ext2CheckJournal)
+#pragma alloc_text(PAGE, Ext2RecoverJournal)
+#endif
+
+PEXT2_MCB
+Ext2LoadInternalJournal(
+ PEXT2_VCB Vcb,
+ ULONG jNo
+)
+{
+ PEXT2_MCB Jcb = NULL;
+
+ Jcb = Ext2AllocateMcb(Vcb, NULL, NULL, 0);
+ if (!Jcb) {
+ goto errorout;
+ }
+
+ Jcb->Inode.i_ino = jNo;
+ Jcb->Inode.i_sb = &Vcb->sb;
+ if (!Ext2LoadInode(Vcb, &Jcb->Inode)) {
+ DbgBreak();
+ Ext2FreeMcb(Vcb, Jcb);
+ goto errorout;
+ }
+
+errorout:
+
+ return Jcb;
+}
+
+INT
+Ext2CheckJournal(
+ PEXT2_VCB Vcb,
+ PULONG jNo
+)
+{
+ struct ext3_super_block* esb = NULL;
+
+ /* check ext3 super block */
+ esb = (struct ext3_super_block *)Vcb->SuperBlock;
+ if (IsFlagOn(esb->s_feature_incompat,
+ EXT3_FEATURE_INCOMPAT_RECOVER)) {
+ SetLongFlag(Vcb->Flags, VCB_JOURNAL_RECOVER);
+ }
+
+ /* must stop here if volume is read-only */
+ if (IsVcbReadOnly(Vcb)) {
+ goto errorout;
+ }
+
+ /* journal is external ? */
+ if (esb->s_journal_inum == 0) {
+ goto errorout;
+ }
+
+ /* oops: volume is corrupted */
+ if (esb->s_journal_dev) {
+ goto errorout;
+ }
+
+ /* return the journal inode number */
+ *jNo = esb->s_journal_inum;
+
+ return TRUE;
+
+errorout:
+
+ return FALSE;
+}
+
+INT
+Ext2RecoverJournal(
+ PEXT2_IRP_CONTEXT IrpContext,
+ PEXT2_VCB Vcb
+)
+{
+ INT rc = 0;
+ ULONG jNo = 0;
+ PEXT2_MCB jcb = NULL;
+ struct block_device * bd = &Vcb->bd;
+ struct super_block * sb = &Vcb->sb;
+ struct inode * ji = NULL;
+ journal_t * journal = NULL;
+ struct ext3_super_block *esb;
+
+ DbgPrint("Ext2RecoverJournal begin\n");
+
+ ExAcquireResourceExclusiveLite(&Vcb->MainResource, TRUE);
+
+ /* check journal inode number */
+ if (!Ext2CheckJournal(Vcb, &jNo)) {
+ rc = -1;
+ goto errorout;
+ }
+
+ /* allocate journal Mcb */
+ jcb = Ext2LoadInternalJournal(Vcb, jNo);
+ if (!jcb) {
+ rc = -6;
+ goto errorout;
+ }
+
+ /* allocate journal inode */
+ ji = &jcb->Inode;
+
+ /* initialize journal file from inode */
+ journal = jbd2_journal_init_inode(ji);
+
+ /* initialzation succeeds ? */
+ if (!journal) {
+ DbgPrint("jbd2_journal_init_inode failed\n");
+ iput(ji);
+ rc = -8;
+ goto errorout;
+ }
+
+ if (ext4_has_feature_journal_needs_recovery(sb)) {
+ /* loading the journal will do a recover */
+ rc = jbd2_journal_load(journal);
+
+ if (0 != rc) {
+ DbgPrint("Ext2Fsd: recover_journal: failed "
+ "to recover journal data. rc=%d\n", rc);
+ rc = -9;
+ //goto errorout;
+ }
+
+ /* reload super_block and group_description */
+ Ext2RefreshSuper(IrpContext, Vcb);
+ Ext2RefreshGroup(IrpContext, Vcb);
+
+ /* clear recover flag in sb */
+ if (rc == 0) {
+ ClearLongFlag(
+ Vcb->SuperBlock->s_feature_incompat,
+ EXT3_FEATURE_INCOMPAT_RECOVER);
+ Ext2SaveSuper(IrpContext, Vcb);
+ sync_blockdev(bd);
+ ClearLongFlag(Vcb->Flags, VCB_JOURNAL_RECOVER);
+ }
+ }
+ else {
+ /* if the journal is clean wipe it */
+ rc = jbd2_journal_wipe(journal, !IsVcbReadOnly(Vcb));
+ }
+
+errorout:
+
+ /* destroy journal structure */
+ if (journal) {
+ jbd2_journal_destroy(journal);
+ }
+
+ /* destory journal Mcb */
+ if (jcb) {
+ Ext2FreeMcb(Vcb, jcb);
+ }
+
+ ExReleaseResourceLite(&Vcb->MainResource);
+
+ DbgPrint("Ext2RecoverJournal end\n");
+
+ return rc;
+}
diff --git a/Ext4Fsd/ext4/ext4_jbd2.c b/Ext4Fsd/ext4/ext4_jbd2.c
index 5421355..e5d3e80 100644
--- a/Ext4Fsd/ext4/ext4_jbd2.c
+++ b/Ext4Fsd/ext4/ext4_jbd2.c
@@ -1,6 +1,5 @@
#include "ext2fs.h"
#include "linux\ext4.h"
-#include "linux\jbd.h"
static handle_t no_journal;
diff --git a/Ext4Fsd/include/linux/ext4.h b/Ext4Fsd/include/linux/ext4.h
index 3af12de..0de4f58 100644
--- a/Ext4Fsd/include/linux/ext4.h
+++ b/Ext4Fsd/include/linux/ext4.h
@@ -25,7 +25,7 @@
#include
//#include
#include
-//#include
+#include
//#include
//#include
#include
@@ -44,7 +44,7 @@
#ifdef __KERNEL__
//#include
#endif
-typedef struct handle_s handle_t;
+//typedef struct handle_s handle_t;
typedef unsigned long long ext4_fsblk_t;
#include
typedef unsigned __int16 uint16_t;
diff --git a/Ext4Fsd/memory.c b/Ext4Fsd/memory.c
index 4aa64dd..5a820d8 100644
--- a/Ext4Fsd/memory.c
+++ b/Ext4Fsd/memory.c
@@ -2631,12 +2631,13 @@ Ext2InitializeVcb( IN PEXT2_IRP_CONTEXT IrpContext,
/*
* Mount ext4 with 64-bit block numbers read-only while testing.
*/
+#if 0
if (EXT3_HAS_INCOMPAT_FEATURE(&Vcb->sb, EXT4_FEATURE_INCOMPAT_64BIT)) {
printk(KERN_ERR "EXT3-fs: %s: Mounting ext4 with 64-bit block numbers read-only.\n",
Vcb->sb.s_id);
SetLongFlag(Vcb->Flags, VCB_READ_ONLY);
}
-
+#endif
has_huge_files = EXT3_HAS_RO_COMPAT_FEATURE(&Vcb->sb, EXT4_FEATURE_RO_COMPAT_HUGE_FILE);
Vcb->sb.s_maxbytes = ext3_max_size(BLOCK_BITS, has_huge_files);
diff --git a/Ext4Fsd/sys/SOURCES b/Ext4Fsd/sys/SOURCES
index 62f998c..783a217 100644
--- a/Ext4Fsd/sys/SOURCES
+++ b/Ext4Fsd/sys/SOURCES
@@ -22,7 +22,7 @@ USER_C_FLAGS = $(USER_C_FLAGS) /D__KERNEL__
INCLUDES=..\include;
TARGETLIBS= $(TARGETPATH)\*\nlssup.lib \
- $(TARGETPATH)\*\jbd.lib \
+ $(TARGETPATH)\*\jbd2.lib \
$(TARGETPATH)\*\ext3.lib \
$(TARGETPATH)\*\ext4.lib