FTL诊断:checkpoint扫描增加BBT坏块标记查询+ECC检查顺序对齐dhara读取路径
This commit is contained in:
@@ -496,6 +496,9 @@ static void ftl_scan_checks_raw(void)
|
||||
uint32_t run_ecc_fail = 0;
|
||||
uint32_t run_ecc_first = 0;
|
||||
uint32_t run_ecc_last = 0;
|
||||
uint32_t run_bbt_bad = 0;
|
||||
uint32_t run_bbt_first = 0;
|
||||
uint32_t run_bbt_last = 0;
|
||||
uint8_t run_epoch = 0;
|
||||
uint8_t run_open = 0;
|
||||
|
||||
@@ -506,13 +509,14 @@ static void ftl_scan_checks_raw(void)
|
||||
if (gd5f_page_read(pg) != GD5F_OK) {
|
||||
continue;
|
||||
}
|
||||
/* ECC 状态在 0Bh 之前检查(与 dhara_nand_read 的读取顺序一致,
|
||||
* 排除 read-from-cache 对状态的干扰) */
|
||||
int ecc = gd5f_check_ecc();
|
||||
gd5f_read_from_cache(0, buf, sizeof(buf));
|
||||
if (buf[0] == 'D' && buf[1] == 'h' && buf[2] == 'a') {
|
||||
const uint8_t ep = buf[3];
|
||||
int ecc = 0;
|
||||
|
||||
total++;
|
||||
ecc = gd5f_check_ecc();
|
||||
if (ecc != GD5F_OK) {
|
||||
run_ecc_fail++;
|
||||
if (!run_ecc_fail) {
|
||||
@@ -520,6 +524,13 @@ static void ftl_scan_checks_raw(void)
|
||||
}
|
||||
run_ecc_last = i;
|
||||
}
|
||||
if (gd5f2gq5ue_is_block_bad(ftl_phy_block(i))) {
|
||||
run_bbt_bad++;
|
||||
if (!run_bbt_bad) {
|
||||
run_bbt_first = i;
|
||||
}
|
||||
run_bbt_last = i;
|
||||
}
|
||||
if (!run_open || (i != run_prev + 1) || (ep != run_epoch)) {
|
||||
if (run_open) {
|
||||
DBG_INFO("check run: blk %lu..%lu epoch=%u (%lu blocks)",
|
||||
@@ -531,12 +542,19 @@ static void ftl_scan_checks_raw(void)
|
||||
(unsigned long)run_ecc_first,
|
||||
(unsigned long)run_ecc_last);
|
||||
}
|
||||
if (run_bbt_bad) {
|
||||
DBG_INFO(" run bbt-bad: %lu blocks (blk %lu..%lu)",
|
||||
(unsigned long)run_bbt_bad,
|
||||
(unsigned long)run_bbt_first,
|
||||
(unsigned long)run_bbt_last);
|
||||
}
|
||||
ftl_dump_checkheader(run_start);
|
||||
}
|
||||
run_start = i;
|
||||
run_epoch = ep;
|
||||
run_len = 0;
|
||||
run_ecc_fail = 0;
|
||||
run_bbt_bad = 0;
|
||||
run_open = 1;
|
||||
}
|
||||
run_prev = i;
|
||||
@@ -553,6 +571,12 @@ static void ftl_scan_checks_raw(void)
|
||||
(unsigned long)run_ecc_first,
|
||||
(unsigned long)run_ecc_last);
|
||||
}
|
||||
if (run_bbt_bad) {
|
||||
DBG_INFO(" run bbt-bad: %lu blocks (blk %lu..%lu)",
|
||||
(unsigned long)run_bbt_bad,
|
||||
(unsigned long)run_bbt_first,
|
||||
(unsigned long)run_bbt_last);
|
||||
}
|
||||
ftl_dump_checkheader(run_start);
|
||||
}
|
||||
DBG_INFO("check scan done: %lu checkpoint blocks", (unsigned long)total);
|
||||
|
||||
Reference in New Issue
Block a user