Nicholas Krause | 31 Jan 20:11 2015

[PATCH] jffs2:Remove no longer needed fix me comment for the function, jffs2_do_readpage_nolock

This fix me comment is no longer needed due to kmap not being able to fail and always
returning a address mapped in high memory as required for this function. There for
this fix me can now be removed as kmap always succeeds and there is no reason to
check if it fails.

Signed-off-by: Nicholas Krause <xerofoify <at>>
 fs/jffs2/file.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c
index 64989ca..84a2f7b 100644
--- a/fs/jffs2/file.c
+++ b/fs/jffs2/file.c
 <at>  <at>  -94,7 +94,6  <at>  <at>  static int jffs2_do_readpage_nolock (struct inode *inode, struct page *pg)

 	pg_buf = kmap(pg);
-	/* FIXME: Can kmap fail? */

 	ret = jffs2_read_inode_range(c, f, pg_buf, pg->index << PAGE_CACHE_SHIFT, PAGE_CACHE_SIZE);



Linux MTD discussion mailing list

(Continue reading)

hujianyang | 31 Jan 04:43 2015

[PATCH resend] UBIFS: return -EINVAL if first log leb is empty

CS node is recognized as a sign in UBIFS log replay mechanism.
Log relaying during mount should find the CS node in first log
leb at beginning and then replay the following uncommitted

Here is a bug in log replay path: If first log leb, which is
indicated by  <at> log_lnum in mst_node, is empty, current UBIFS
replay nothing and directly mount the partition without any
warning. This action will put filesystem in an abnormal state,
e.g. space management in LPT area is incorrect to the real
space usage in main area.

We reproduced this bug by fault injection: turn first log leb
into all 0xFF. UBIFS driver mount the polluted partition
normally. But errors occur while running fs_stress on this

[89068.055183] UBI error: ubi_io_read: error -74 (ECC error) while reading 59 bytes from PEB 711:33088,
read 59 bytes
[89068.179877] UBIFS error (pid 10517): ubifs_check_node: bad magic 0x101031, expected 0x6101831
[89068.179882] UBIFS error (pid 10517): ubifs_check_node: bad node at LEB 591:28992
[89068.179891] Not a node, first 24 bytes:
[89068.179892] 00000000: 31 10 10 00 37 84 64 04 10 04 00 00 00 00 00 00 20 00 00 00 02 01 00 00                          1...7.d......... .......
[89068.180282] UBIFS error (pid 10517): ubifs_read_node: expected node type 2

This patch fix the problem by checking c->cs_sqnum to
guarantee the empty leb is not first log leb and return an
error if the first log leb is incorrectly empty. After this,
we could catch *first log empty* error in place.

(Continue reading)

Nam Nguyen | 30 Jan 01:58 2015

UBI on top of a smaller portion of a bigger MTD device

Hello list,

I am wondering if there is interest to make ubi utils work with a
partial range on the MTD device, like other mtd utils. I would
contribute code to make that happen.

Use case:

We have one big NAND device on which we store kernel (a blob), rootfs
(ext4) and other ubifs. The partition info of that device is stored in
a NOR device. Upon boot, the firmware reads from NOR device, passes
partition values to the kernel via device tree, and the kernel will
set up MTD partitions. The MTD module is compiled in because rootfs is
on it.

In recovery mode, however, the firmware does not read anything from
the (writable) NOR flash for fear of grabbing garbage values and
bricking the device. Hence the kernel has no info about any MTD
partition. Yet the recovery USB stick does have such information on
its rootfs. So we were thinking maybe we could augment ubi-utils with
where the partition starts, where it ends, to work with the raw NAND

I talked to derRichard in #mtd channel. Perhaps this email could
explain it better on why we can't set up MTD partitions.

If there is any other way to achieve the same goal, I'd love to hear
about it too.

(Continue reading)

hujianyang | 29 Jan 07:13 2015

Re: [PATCH] Add myself as UBI co-maintainer

On 2015/1/29 13:59, Artem Bityutskiy wrote:
> The master branch is a superset of next. Master may have stuff not ready for next. Patches go first to
master, then to next. Simple ones go to both. Next is pulled to linux-next tree, master is not.
> Master may be rebased, next never gets rebaised.
> Sent from my Android phone.
> Best Regards,
> Artem BItyutskiy

Got it!


Linux MTD discussion mailing list

Ben Leinweber | 29 Jan 05:30 2015

OOB buffers with syndrome calculating controller

My company is currently trying to integrate a NAND flash chip into our product, and we have acquired in NAND
flash controller IP core. I am responsible for writing the driver for this IP core.

The IP core automatically calculates the ECC on write and computes the syndromes on read. I am writing to
this list because I am somewhat confused by how the default syndrome read/write functions handle the
error codes in the internal NAND layer OOB buffers and am looking for a little help.

The way that the IP core writes data to the flash chip is as follows:
  |-------Data Column-------/~/------Data Column------|----Spare Column-----|
  Data-0 ECC-0 Data-1 ECC-1 /~/ Data-14 ECC-14 Data-15 USR-OOB Data-15 ECC-15
   512B   16B   512B   16B       512B    16B    272B    192B    240B    16B

This is for an 8kB page with 448 bytes in the spare column.

So the final chunk of data is split into two pieces and the final ECC data physically resides at the end of the
spare column. When doing a normal non-raw read/write, all of this is handled by the controller and the
driver only need concern itself with the data and the user OOB data. When performing a read, the controller
automatically calculates the syndrome data and provides it to the driver through some registers.

Now to my questions.

1. The nand_read_page_raw_syndrome() reads each ECC chunk and stores them first in chip->oob_poi
buffer, storing the user OOB data after. nand_write_page_raw_syndrome() also assumes that the ECC data
is at the front of the chip->oob_poi and user OOB data is after.

Isn't this reverse from just about all of the defined nand_ecclayout structures? Almost all of them store
the ECC data at the end of the OOB so as to never risk overwriting the bad block marker. Is there a reason that
the data is stored in this order? Is there actually a consumer of the ECC data outside of the Flash driver?

2. nand_page_read_syndrome() appears to assume that the controller will return the ECC bytes when
(Continue reading)

Richard Weinberger | 28 Jan 12:28 2015

[PATCH] Add myself as UBI co-maintainer

...and set the state to "Supported" as UBI is part
of my day job.

Signed-off-by: Richard Weinberger <richard <at>>
 MAINTAINERS | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

index 2ebb056..6417fed 100644
 <at>  <at>  -9891,20 +9891,15  <at>  <at>  F:	drivers/scsi/ufs/
 M:	Artem Bityutskiy <dedekind1 <at>>
+M:	Richard Weinberger <richard <at>>
 L:	linux-mtd <at>
 T:	git git://
-S:	Maintained
+S:	Supported
 F:	drivers/mtd/ubi/
 F:	include/linux/mtd/ubi.h
 F:	include/uapi/mtd/ubi-user.h

-M:	Richard Weinberger <richard <at>>
-L:	linux-mtd <at>
-S:	Maintained
(Continue reading)

david.oberhollenzer | 28 Jan 11:13 2015

[PATCH] UBI: power cut emulation for testing

From: David Oberhollenzer <david.oberhollenzer <at>>

Emulate random power cuts by switching device to ro after a number of
writes to allow simple power cut testing with nand-sim.

Maximum and minimum number of successful writes before power cut and
what kind of writes (EC header, VID header or none) to interrupt
configurable via debugfs.

Signed-off-by: David Oberhollenzer <david.oberhollenzer <at>>
 drivers/mtd/ubi/debug.c | 93 +++++++++++++++++++++++++++++++++++++++++++++++--
 drivers/mtd/ubi/debug.h |  2 ++
 drivers/mtd/ubi/io.c    |  6 ++++
 drivers/mtd/ubi/ubi.h   | 25 +++++++++++++
 4 files changed, 124 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/ubi/debug.c b/drivers/mtd/ubi/debug.c
index 7335c9f..ad164cc 100644
--- a/drivers/mtd/ubi/debug.c
+++ b/drivers/mtd/ubi/debug.c
 <at>  <at>  -263,7 +263,7  <at>  <at>  static ssize_t dfs_file_read(struct file *file, char __user *user_buf,
 	struct dentry *dent = file->f_path.dentry;
 	struct ubi_device *ubi;
 	struct ubi_debug_info *d;
-	char buf[3];
+	char buf[8];
 	int val;

 	ubi = ubi_get_device(ubi_num);
(Continue reading)

Fabio Estevam | 23 Jan 01:43 2015

[PATCH 1/3] mtd: fsl-quadspi: Fix the error paths

From: Fabio Estevam <fabio.estevam <at>>

Jumping to 'map_failed' label is not correct at these points, as it misses to
disable the clocks that were previously enabled.

Jump to 'irq_failed' label instead that will correctly disable the clocks.

Signed-off-by: Fabio Estevam <fabio.estevam <at>>
 drivers/mtd/spi-nor/fsl-quadspi.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c
index a46bea3..a733bd2 100644
--- a/drivers/mtd/spi-nor/fsl-quadspi.c
+++ b/drivers/mtd/spi-nor/fsl-quadspi.c
 <at>  <at>  -890,24 +890,24  <at>  <at>  static int fsl_qspi_probe(struct platform_device *pdev)

 		ret = of_modalias_node(np, modalias, sizeof(modalias));
 		if (ret < 0)
-			goto map_failed;
+			goto irq_failed;

 		ret = of_property_read_u32(np, "spi-max-frequency",
 		if (ret < 0)
-			goto map_failed;
+			goto irq_failed;

 		/* set the chip address for READID */
(Continue reading)

Baruch Siach | 22 Jan 14:23 2015

[PATCH] mtd: nand: remove redundant local variable

Signed-off-by: Baruch Siach <baruch <at>>
 drivers/mtd/nand/nand_base.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 7bfa519588a4..31e252a5ce9c 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
 <at>  <at>  -1750,11 +1750,10  <at>  <at>  static int nand_read_oob_std(struct mtd_info *mtd, struct nand_chip *chip,
 static int nand_read_oob_syndrome(struct mtd_info *mtd, struct nand_chip *chip,
 				  int page)
-	uint8_t *buf = chip->oob_poi;
 	int length = mtd->oobsize;
 	int chunk = chip->ecc.bytes + chip->ecc.prepad + chip->ecc.postpad;
 	int eccsize = chip->ecc.size;
-	uint8_t *bufpoi = buf;
+	uint8_t *bufpoi = chip->oob_poi;
 	int i, toread, sndrnd = 0, pos;

 	chip->cmdfunc(mtd, NAND_CMD_READ0, chip->ecc.size, page);


Linux MTD discussion mailing list

(Continue reading)

Artem Bityutskiy | 22 Jan 10:26 2015

new UBI co-maintainer


I'd like to give Richard Weinberger UBI tree push rights, so that he
could help us improving the QoS.

If no one objects, lets make it effective.


Best Regards,
Artem Bityutskiy

Linux MTD discussion mailing list

koloskov | 21 Jan 12:17 2015

jffs2: Do not rewrite posix_acl_equiv_mode() result in jffs2_set_acl()

Linux MTD discussion mailing list