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

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).