/* If 'write' is non-zero, then we wipe out the journal on disk; otherwise we merely suppress recovery.  */
int jbd2_journal_wipe(journal_t *journal, int write)
/* If 'write' is non-zero, then we wipe out the journal on disk; otherwise we merely suppress recovery.  */
int jbd2_journal_wipe(journal_t *journal, int write)
{
	journal_superblock_t *sb;
	int err = 0;
	J_ASSERT (!(journal->j_flags & JBD2_LOADED));
	err = load_superblock(journal);
	if (err)
		return err;
	sb = journal->j_superblock;
	if (!journal->j_tail)
		goto no_recovery;
	printk (KERN_WARNING "JBD: %s recovery information on journal\n",
		write ? "Clearing" : "Ignoring");
	err = jbd2_journal_skip_recovery(journal);
	if (write)
		jbd2_journal_update_superblock(journal, 1);
 no_recovery:
	return err;
}