linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [MTD] include/linux/mtd/blktrans.h: fix wrong #blocks value reported by /proc/partitions
@ 2010-07-22  9:34 Dong, Chuanxiao
  2010-07-26  4:40 ` Artem Bityutskiy
  0 siblings, 1 reply; 3+ messages in thread
From: Dong, Chuanxiao @ 2010-07-22  9:34 UTC (permalink / raw)
  To: dwmw2@infradead.org, linux-mtd@lists.infradead.org,
	Woodhouse, David
  Cc: Gao, Yunpeng, Yuan, Hang

Hi
I found /proc/partitions file will report a wrong block numbers when I use a 8G
NAND which has a larger than 4G partition. So here is a patch to fix this problem.
Details are in below comments.
Please review it.
Thanks all.

>From 270149e67728f26553a22b0381963bc43147b468 Mon Sep 17 00:00:00 2001
From: Chuanxiao Dong <chuanxiao.dong@intel.com>
Date: Thu, 22 Jul 2010 17:24:41 +0800
Subject: [PATCH] include/linux/mtd/blktrans.h fix wrong #blocks value reported by /proc/partitions

type of "size" in mtd_blktrans_dev structure is changed
from unsigned long to uint64_t

When nand has a partition whose size is larger than 0x100000000,
mtd_blkdev will lose the capcity when calling

	"348    set_capcity(gd, (new->size * tr->blksize) >> 9)"

in "add_mtd_blktrans_dev" function.

The result of "(new->size * tr->blksize)" will be limited to be a 32bits value
if the nand partition size is larger than 0x100000000.
So change the type of "size" to be uint64_t to support large nand.

Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
---
 include/linux/mtd/blktrans.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/mtd/blktrans.h b/include/linux/mtd/blktrans.h
index b481ccd..bdae196 100644
--- a/include/linux/mtd/blktrans.h
+++ b/include/linux/mtd/blktrans.h
@@ -24,7 +24,7 @@ struct mtd_blktrans_dev {
 	struct mtd_info *mtd;
 	struct mutex lock;
 	int devnum;
-	unsigned long size;
+	uint64_t size;
 	int readonly;
 	int open;
 	struct kref ref;
-- 
1.6.6.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] [MTD] include/linux/mtd/blktrans.h: fix wrong #blocks value reported by /proc/partitions
  2010-07-22  9:34 [PATCH] [MTD] include/linux/mtd/blktrans.h: fix wrong #blocks value reported by /proc/partitions Dong, Chuanxiao
@ 2010-07-26  4:40 ` Artem Bityutskiy
  2010-07-26  4:45   ` Artem Bityutskiy
  0 siblings, 1 reply; 3+ messages in thread
From: Artem Bityutskiy @ 2010-07-26  4:40 UTC (permalink / raw)
  To: Dong, Chuanxiao
  Cc: linux-mtd@lists.infradead.org, Yuan, Hang, dwmw2@infradead.org,
	Woodhouse, David, Gao, Yunpeng

On Thu, 2010-07-22 at 17:34 +0800, Dong, Chuanxiao wrote:
> Hi
> I found /proc/partitions file will report a wrong block numbers when I use a 8G
> NAND which has a larger than 4G partition. So here is a patch to fix this problem.
> Details are in below comments.
> Please review it.
> Thanks all.

Pushed to l2-mtd-2.6.git / master, thanks.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] [MTD] include/linux/mtd/blktrans.h: fix wrong #blocks value reported by /proc/partitions
  2010-07-26  4:40 ` Artem Bityutskiy
@ 2010-07-26  4:45   ` Artem Bityutskiy
  0 siblings, 0 replies; 3+ messages in thread
From: Artem Bityutskiy @ 2010-07-26  4:45 UTC (permalink / raw)
  To: Dong, Chuanxiao
  Cc: linux-mtd@lists.infradead.org, Yuan, Hang, dwmw2@infradead.org,
	Woodhouse, David, Gao, Yunpeng

On Mon, 2010-07-26 at 07:40 +0300, Artem Bityutskiy wrote:
> On Thu, 2010-07-22 at 17:34 +0800, Dong, Chuanxiao wrote:
> > Hi
> > I found /proc/partitions file will report a wrong block numbers when I use a 8G
> > NAND which has a larger than 4G partition. So here is a patch to fix this problem.
> > Details are in below comments.
> > Please review it.
> > Thanks all.
> 
> Pushed to l2-mtd-2.6.git / master, thanks.

Umm, no, kicked out. It introduces warnings:

drivers/mtd/inftlcore.c: In function ‘inftl_add_mtd’:
drivers/mtd/inftlcore.c:112: warning: format ‘%lx’ expects type ‘long unsigned int’, but argument 2 has type ‘uint64_t’
  CC [M]  drivers/mtd/nftlcore.o
  CC [M]  drivers/mtd/nftlmount.o
drivers/mtd/nftlcore.c: In function ‘nftl_add_mtd’:
drivers/mtd/nftlcore.c:101: warning: format ‘%lx’ expects type ‘long unsigned int’, but argument 2 has type ‘uint64_t’

Please, use 'unsigned long long' and %llx modifiers in the prints.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-07-26  4:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-22  9:34 [PATCH] [MTD] include/linux/mtd/blktrans.h: fix wrong #blocks value reported by /proc/partitions Dong, Chuanxiao
2010-07-26  4:40 ` Artem Bityutskiy
2010-07-26  4:45   ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).