ref: 9668eacad96304fd50a6d5bf8cda00ba915108a0
parent: e70a208249503ae237b035bfc6e9116c2c6fa762
author: ngkaho1234 <ngkaho1234@gmail.com>
date: Sat Nov 28 21:44:49 EST 2015
ext4_journal: simplify the code logic of superblock replaying.
--- a/lwext4/ext4_journal.c
+++ b/lwext4/ext4_journal.c
@@ -374,14 +374,10 @@
uint16_t mount_count, state;
mount_count = ext4_get16(&fs->sb, mount_count);
state = ext4_get16(&fs->sb, state);
- r = ext4_blocks_set_direct(fs->bdev, journal_block.data,
- 0, 1);
- if (r != EOK)
- return;
- r = ext4_sb_read(fs->bdev, &fs->sb);
- if (r != EOK)
- return;
+ memcpy(&fs->sb,
+ journal_block.data + EXT4_SUPERBLOCK_OFFSET,
+ EXT4_SUPERBLOCK_SIZE);
/* Mark system as mounted */
ext4_set16(&fs->sb, state, state);