/* This function stores the modified meta data in RAM metadata_buffer  */
int ext4fs_put_metadata(char *metadata_buffer, uint32_t blknr)
/* This function stores the modified meta data in RAM metadata_buffer  */
int ext4fs_put_metadata(char *metadata_buffer, uint32_t blknr)
{
	struct ext_filesystem *fs = get_fs();
	if (!metadata_buffer) {
		printf("Invalid input arguments %s\n", __func__);
		return -EINVAL;
	}
	if (dirty_block_ptr[gd_index]->buf)
		assert(dirty_block_ptr[gd_index]->blknr == blknr);
	else
		dirty_block_ptr[gd_index]->buf = zalloc(fs->blksz);
	if (!dirty_block_ptr[gd_index]->buf)
		return -ENOMEM;
	memcpy(dirty_block_ptr[gd_index]->buf, metadata_buffer, fs->blksz);
	dirty_block_ptr[gd_index++]->blknr = blknr;
	return 0;
}