Re: [PATCH] UBI: add debugfs file for tracking PEB state

From: Richard Weinberger
Date: Mon Sep 19 2016 - 15:04:24 EST


Zach,

On 19.09.2016 20:47, Zach Brown wrote:
> + } else {
> + struct ubi_ec_hdr erase_count_header;
> +
> + err = ubi_io_read_ec_hdr(ubi, *block_number,
> + &erase_count_header, 0);
> + if (err && err != UBI_IO_BITFLIPS)
> + r_sts = READ_STATUS_ERR_READING_ERASE_COUNT;
> + else {
> + erase_count = be64_to_cpu(erase_count_header.ec);
> + if (erase_count > UBI_MAX_ERASECOUNTER)
> + b_sts = BLOCK_STATUS_ERASE_COUNT_BEYOND_MAX;

Hmm, why don't you use ubi->lookuptbl[] to get a ubi_wl_entry object, it knows
the erase counter. That way you don't have to read from the flash. If you read
you have to deal with all kind of read errors, including bitflips.

Thanks,
//richard