mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
jbd2: enable journal clients to enable v2 checksumming
Add in the necessary code so that journal clients can enable the new journal checksumming features. Signed-off-by: Darrick J. Wong <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]>
This commit is contained in:
parent
8f888ef846
commit
25ed6e8a54
2 changed files with 92 additions and 13 deletions
|
|
@ -3013,6 +3013,44 @@ static void ext4_destroy_lazyinit_thread(void)
|
|||
kthread_stop(ext4_lazyinit_task);
|
||||
}
|
||||
|
||||
static int set_journal_csum_feature_set(struct super_block *sb)
|
||||
{
|
||||
int ret = 1;
|
||||
int compat, incompat;
|
||||
struct ext4_sb_info *sbi = EXT4_SB(sb);
|
||||
|
||||
if (EXT4_HAS_RO_COMPAT_FEATURE(sb,
|
||||
EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) {
|
||||
/* journal checksum v2 */
|
||||
compat = 0;
|
||||
incompat = JBD2_FEATURE_INCOMPAT_CSUM_V2;
|
||||
} else {
|
||||
/* journal checksum v1 */
|
||||
compat = JBD2_FEATURE_COMPAT_CHECKSUM;
|
||||
incompat = 0;
|
||||
}
|
||||
|
||||
if (test_opt(sb, JOURNAL_ASYNC_COMMIT)) {
|
||||
ret = jbd2_journal_set_features(sbi->s_journal,
|
||||
compat, 0,
|
||||
JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT |
|
||||
incompat);
|
||||
} else if (test_opt(sb, JOURNAL_CHECKSUM)) {
|
||||
ret = jbd2_journal_set_features(sbi->s_journal,
|
||||
compat, 0,
|
||||
incompat);
|
||||
jbd2_journal_clear_features(sbi->s_journal, 0, 0,
|
||||
JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT);
|
||||
} else {
|
||||
jbd2_journal_clear_features(sbi->s_journal,
|
||||
JBD2_FEATURE_COMPAT_CHECKSUM, 0,
|
||||
JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT |
|
||||
JBD2_FEATURE_INCOMPAT_CSUM_V2);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ext4_fill_super(struct super_block *sb, void *data, int silent)
|
||||
{
|
||||
char *orig_data = kstrdup(data, GFP_KERNEL);
|
||||
|
|
@ -3610,19 +3648,10 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
|
|||
goto failed_mount_wq;
|
||||
}
|
||||
|
||||
if (test_opt(sb, JOURNAL_ASYNC_COMMIT)) {
|
||||
jbd2_journal_set_features(sbi->s_journal,
|
||||
JBD2_FEATURE_COMPAT_CHECKSUM, 0,
|
||||
JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT);
|
||||
} else if (test_opt(sb, JOURNAL_CHECKSUM)) {
|
||||
jbd2_journal_set_features(sbi->s_journal,
|
||||
JBD2_FEATURE_COMPAT_CHECKSUM, 0, 0);
|
||||
jbd2_journal_clear_features(sbi->s_journal, 0, 0,
|
||||
JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT);
|
||||
} else {
|
||||
jbd2_journal_clear_features(sbi->s_journal,
|
||||
JBD2_FEATURE_COMPAT_CHECKSUM, 0,
|
||||
JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT);
|
||||
if (!set_journal_csum_feature_set(sb)) {
|
||||
ext4_msg(sb, KERN_ERR, "Failed to set journal checksum "
|
||||
"feature set");
|
||||
goto failed_mount_wq;
|
||||
}
|
||||
|
||||
/* We have now updated the journal if required, so we can
|
||||
|
|
|
|||
Loading…
Reference in a new issue