Exemplo n.º 1
0
int yaffs_rd_chunk_tags_nand(struct yaffs_dev *dev, int nand_chunk,
			     u8 * buffer, struct yaffs_ext_tags *tags)
{
	int result;
	struct yaffs_ext_tags local_tags;

	int realigned_chunk = nand_chunk - dev->chunk_offset;

	dev->n_page_reads++;

	/* If there are no tags provided, use local tags to get prioritised gc working */
	if (!tags)
		tags = &local_tags;

	if (dev->param.read_chunk_tags_fn)
		result =
		    dev->param.read_chunk_tags_fn(dev, realigned_chunk, buffer,
						  tags);
	else
		result = yaffs_tags_compat_rd(dev,
					      realigned_chunk, buffer, tags);
	if (tags && tags->ecc_result > YAFFS_ECC_RESULT_NO_ERROR) {

		struct yaffs_block_info *bi;
		bi = yaffs_get_block_info(dev,
					  nand_chunk /
					  dev->param.chunks_per_block);
		yaffs_handle_chunk_error(dev, bi);
	}

	return result;
}
Exemplo n.º 2
0
int yaffs_rd_chunk_tags_nand(struct yaffs_dev* dev, int nand_chunk, u8* buffer, struct yaffs_ext_tags* tags)
{
    int result;
    struct yaffs_ext_tags local_tags;
    int flash_chunk = apply_chunk_offset(dev, nand_chunk);

    dev->n_page_reads++;

    /* If there are no tags provided use local tags. */
    if (!tags)
        tags = &local_tags;

    result = dev->tagger.read_chunk_tags_fn(dev, flash_chunk, buffer, tags);
    if (tags && tags->ecc_result > YAFFS_ECC_RESULT_NO_ERROR)
    {
        struct yaffs_block_info* bi;
        bi = yaffs_get_block_info(dev, nand_chunk / dev->param.chunks_per_block);
        yaffs_handle_chunk_error(dev, bi);
    }
    return result;
}