Re: Lots of fastmap writes

Richard Weinberger
2024-06-04T06:47:21Z

----- Ursprüngliche Mail -----
> Von: "chengzhihao1" <chengzhihao1@huawei.com>
> An: "Rickard x Andersson" <rickaran@axis.com>, "richard" <richard@nod.at>, "linux-mtd" <linux-mtd@lists.infradead.org>
> CC: "rickard314 andersson" <rickard314.andersson@gmail.com>
> Gesendet: Dienstag, 4. Juni 2024 03:41:21
> Betreff: Re: Lots of fastmap writes

> 在 2024/6/3 16:55, Rickard x Andersson 写道:
>> Hi,
>>
>> I have a system running Linux 5.10 which logs quite a lot to a database.
>> The system has been running OK since before Christmas but now it usually
>> fails after a few hours with errors like these:
>>
>> May  6 22:29:58 172.26.203.90   warning ubi2 warning: ubi_io_read: error
>> -74 (ECC error) while reading 58 bytes from PEB 1:230872, read only 58
>> bytes, retry
>> May  7 00:11:08 172.26.203.90   warning ubi2 warning: ubi_io_read: error
>> -74 (ECC error) while reading 58 bytes from PEB 40:239752, read only 58
>> bytes, retry
>> May  7 00:11:08 172.26.203.90   err     ubi2 error: ubi_io_read: error
>> -74 (ECC error) while reading 58 bytes from PEB 40:239752, read 58 bytes
>>
>> Fastmap is used on this system. The ECC errors are usually in the
>> fastmap area, erase blocks 0- 63.
>>
>> When looking more closely at the erase counters they look something like
>> this:
>>
>> 0 - 63: 29600
>> 64 - 2043: 2200

Are all of the first 64 LEBs worn out that badly or just one?

> Try this series of patches
> https://lore.kernel.org/linux-mtd/20230812080005.3162125-2-chengzhihao1@huawei.com/T/
>>
>> It seems like 30 % of the writes are writes to the fastmap area. Any
>> ideas of what can cause this many writes to the fastmap area? Heavy load?
>>
>> Any ideas are welcome.
>>
>> nand: device found, Manufacturer ID: 0x98, Chip ID: 0xdc
>> nand: Toshiba TC58NVG2S0H 4G 3.3V 8-bit
>> nand: 512 MiB, SLC, erase size: 256 KiB, page size: 4096, OOB size: 256
>> nand: 2 chips detected
>>
>> UBIFS (ubi2:0): Mounting in authenticated mode
>> UBIFS (ubi2:0): background thread "ubifs_bgt2_0" started, PID 187
>> UBIFS (ubi2:0): UBIFS: mounted UBI device 2, volume 0, name "data_volume"
>> UBIFS (ubi2:0): LEB size: 253952 bytes (248 KiB), min./max. I/O unit
>> sizes: 4096 bytes/4096 bytes
>> UBIFS (ubi2:0): FS size: 505110528 bytes (481 MiB, 1989 LEBs), journal
>> size 25395200 bytes (24 MiB, 100 LEBs)
>> UBIFS (ubi2:0): reserved for root: 4676575 bytes (4566 KiB)
>> UBIFS (ubi2:0): media format: w5/r0 (latest is w5/r0), UUID
>> 990A460D-A55E-4B58-ACAD-01FEBC7AF839, small LPT model
>>
>> ubi2: default fastmap pool size: 100
>> ubi2: default fastmap WL pool size: 50
>> ubi2: attaching mtd5
>> ubi2: attached by fastmap
>> ubi2: fastmap pool size: 100
>> ubi2: fastmap WL pool size: 50

As Zhihao Cheng said, his patch series might help.
Making the fastmap pools larger is also an option.
With larger pools, fastmap needs write less often, but scan
more at attach time.

Thanks,
//richard