/* Given an initialised but unloaded journal struct, poke about in the on-disk structure to update it to the most recent supported version.  */
int journal_update_format(journal_t *journal)
/* Given an initialised but unloaded journal struct, poke about in the on-disk structure to update it to the most recent supported version.  */
int journal_update_format(journal_t *journal)
{
	journal_superblock_t *sb;
	int err;
	err = journal_get_superblock(journal);
	if (err)
		return err;
	sb = journal->j_superblock;
	switch (be32_to_cpu(sb->s_header.h_blocktype)) {
	case JFS_SUPERBLOCK_V2:
		return 0;
	case JFS_SUPERBLOCK_V1:
		return journal_convert_superblock_v1(journal, sb);
	default:
		break;
	}
	return -EINVAL;
}