From: James Hilliard <james.hilliard1@gmail.com>
To: Kyungmin Park <kyungmin.park@samsung.com>,
Miquel Raynal <miquel.raynal@bootlin.com>,
Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>
Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
James Hilliard <james.hilliard1@gmail.com>
Subject: [PATCH] mtd: onenand: report OOB write progress after programming
Date: Sat, 05 Dec 2026 00:16:37 -0700 [thread overview]
Message-ID: <20261205-submit-onenand-oob-write-progress-v1-v1-1-dca24721ddf6@gmail.com> (raw)
When a page program fails, a combined data and OOB write can report
spare bytes as written even though they were only staged in BufferRAM.
With pipelined writes the count can include the next page, for which
no program command was issued.
Advance the OOB count at the same point as the data count. In the
pipelined path, use the count saved before staging the next page.
Fixes: 9ce969082e49 ("[MTD] [OneNAND] Add write-while-program support")
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
drivers/mtd/nand/onenand/onenand_base.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/nand/onenand/onenand_base.c b/drivers/mtd/nand/onenand/onenand_base.c
index bca5a3bebd41..c79e2351bdfc 100644
--- a/drivers/mtd/nand/onenand/onenand_base.c
+++ b/drivers/mtd/nand/onenand/onenand_base.c
@@ -1832,6 +1832,9 @@ static int onenand_write_ops_nolock(struct mtd_info *mtd, loff_t to,
/* Loop until all data write */
while (1) {
+ /* Staging the next page advances oobwritten before we wait. */
+ size_t prev_oobwritten = oobwritten;
+
if (written < len) {
u_char *wbuf = (u_char *) buf;
@@ -1890,6 +1893,7 @@ static int onenand_write_ops_nolock(struct mtd_info *mtd, loff_t to,
__func__, ret);
break;
}
+ ops->oobretlen = prev_oobwritten;
if (written == len) {
/* Only check verify write turn on */
@@ -1940,6 +1944,7 @@ static int onenand_write_ops_nolock(struct mtd_info *mtd, loff_t to,
}
written += thislen;
+ ops->oobretlen = oobwritten;
if (written == len)
break;
@@ -1961,7 +1966,6 @@ static int onenand_write_ops_nolock(struct mtd_info *mtd, loff_t to,
onenand_invalidate_bufferram(mtd, 0, -1);
ops->retlen = written;
- ops->oobretlen = oobwritten;
return ret;
}
---
base-commit: 4e5457fcbc14d21e7c004c3159e78fc63838029e
base-tree: git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next
change-id: 20261204-submit-onenand-oob-write-progress-v1-29061fc01525
Best regards,
--
James Hilliard <james.hilliard1@gmail.com>
reply other threads:[~2026-12-05 7:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261205-submit-onenand-oob-write-progress-v1-v1-1-dca24721ddf6@gmail.com \
--to=james.hilliard1@gmail.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
--cc=vigneshr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®