Skip to content

Commit

Permalink
Add loader for internal journal (we need to update mkfs to support this)
Browse files Browse the repository at this point in the history
For internal journal we need enhance mkfs to use ext2fs lib, that will
allow us to create journal (with proper header).
  • Loading branch information
azat committed Oct 1, 2014
1 parent bd11888 commit fd1dc7a
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,24 @@ static int simplefs_load_journal(struct super_block *sb, int devnum)

return 0;
}
static int simplefs_sb_load_journal(struct super_block *sb)
{
struct journal_s *journal;
struct simplefs_super_block *sfs_sb = SIMPLEFS_SB(sb);
struct inode *journal_inode;

journal_inode = simplefs_iget(sb, SIMPLEFS_JOURNAL_INODE_NUMBER);
journal = jbd2_journal_init_inode(journal_inode);
if (!journal) {
printk(KERN_ERR "Can't load journal\n");
return 1;
}
journal->j_private = sb;

sfs_sb->journal = journal;

return 0;
}

#define SIMPLEFS_OPT_JOURNAL_DEV 1
static const match_table_t tokens = {
Expand Down Expand Up @@ -797,6 +815,8 @@ int simplefs_fill_super(struct super_block *sb, void *data, int silent)
"simplefs seem to be formatted using a non-standard block size.");
goto release;
}
/** XXX: Avoid this hack, by adding one more sb wrapper, but non-disk */
sb_disk->journal = NULL;

printk(KERN_INFO
"simplefs filesystem of version [%llu] formatted with a block size of [%llu] detected in the device.\n",
Expand Down Expand Up @@ -840,6 +860,10 @@ int simplefs_fill_super(struct super_block *sb, void *data, int silent)
if ((ret = simplefs_parse_options(sb, data)))
goto release;

if (!sb_disk->journal && (ret = simplefs_sb_load_journal(sb))) {
goto release;
}

ret = 0;
release:
brelse(bh);
Expand Down

0 comments on commit fd1dc7a

Please sign in to comment.