[RFC] mtd: ubi: skip programming unused bits in ubi headers
Richard Weinberger
richard at nod.at
Mon Aug 11 23:57:08 PDT 2025
----- Ursprüngliche Mail -----
> Von: "Cheng Ming Lin" <linchengming884 at gmail.com>
> An: "richard" <richard at nod.at>, "chengzhihao1" <chengzhihao1 at huawei.com>, "Miquel Raynal" <miquel.raynal at bootlin.com>,
> "Vignesh Raghavendra" <vigneshr at ti.com>, "linux-mtd" <linux-mtd at lists.infradead.org>, "linux-kernel"
> <linux-kernel at vger.kernel.org>
> CC: "Alvin Zhou" <alvinzhou at mxic.com.tw>, leoyu at mxic.com.tw, "Cheng Ming Lin" <chengminglin at mxic.com.tw>
> Gesendet: Dienstag, 12. August 2025 07:19:49
> Betreff: [RFC] mtd: ubi: skip programming unused bits in ubi headers
> From: Cheng Ming Lin <chengminglin at mxic.com.tw>
>
> This patch prevents unnecessary programming of bits in ec_hdr and
> vid_hdr that are not used or read during normal UBI operation. These
> unused bits are typically already set to 1 in erased flash and do not
> need to be explicitly programmed to 0 if they are not used.
>
> Programming such unused areas offers no functional benefit and may
> result in unnecessary flash wear, reducing the overall lifetime of the
> device. By skipping these writes, we preserve the flash state as much
> as possible and minimize wear caused by redundant operations.
We talk about programming a single (sub)page, right?
> This change ensures that only necessary fields are written when
> preparing UBI headers, improving flash efficiency without affecting
> functionality.
I have been told that writing 0xFF bytes to NAND should be avoided.
This is also why UBI initializes them to 0x00.
Do you have data which proves the opposite?
Thanks,
//richard
More information about the linux-mtd
mailing list