[U-Boot] Why would ubi attach take 5 hours to complete sometimes?

Hi U-boot hackers,
I have an embedded device which has one ubi partition on a NAND chip, and for about a year now since it's been in use, I've never had any problems happen during boot or generally in u-boot.
But recently, I've noticed that booting takes variable amounts of time, ranging all the way from 15 minutes to 5 hours. Here's the log of when it happens:
ubi0: attaching mtd1 ubi0: scanning is finished << the LONG pause happens here >> ubi0: attached mtd1 (name "mtd=2", size 992 MiB) ubi0: PEB size: 262144 bytes (256 KiB), LEB size: 253952 bytes ubi0: min./max. I/O unit sizes: 4096/4096, sub-page size 4096
Since I don't have debug flags enabled in this u-boot, I have no idea what it doing during that time. Looking at the source code, it could either be doing something inside ubi_wl_init() or ubi_eba_init(), but neither of those really explain why it could take as long as 5 hours.
It's also worth noting that I just recently crossed 8000 erase cycles (the max_ec count) on the nand chip, and my WL_THRESHOLD is set to 4096.
So my question is, is it a valid assumption that u-boot is indeed spending bulk of the time during the long pause wear leveling, or could it be doing something else?
Thanks for reading!
Ram
participants (1)
-
Ram Subramanian