/* This function stores the backup copy of meta data in RAM journal_buffer  */
int ext4fs_log_journal(char *journal_buffer, uint32_t blknr)
/* This function stores the backup copy of meta data in RAM journal_buffer  */
int ext4fs_log_journal(char *journal_buffer, uint32_t blknr)
{
	struct ext_filesystem *fs = get_fs();
	short i;
	if (!journal_buffer) {
		printf("Invalid input arguments %s\n", __func__);
		return -EINVAL;
	}
	for (i = 0; i < MAX_JOURNAL_ENTRIES; i++) {
		if (journal_ptr[i]->blknr == -1)
			break;
		if (journal_ptr[i]->blknr == blknr)
			return 0;
	}
	journal_ptr[gindex]->buf = zalloc(fs->blksz);
	if (!journal_ptr[gindex]->buf)
		return -ENOMEM;
	memcpy(journal_ptr[gindex]->buf, journal_buffer, fs->blksz);
	journal_ptr[gindex++]->blknr = blknr;
	return 0;
}