[PATCH] OneNAND: Use address instead block, page in bufferram

Kyungmin Park kyungmin.park at samsung.com
Wed Jan 10 21:20:29 EST 2007


Ah, yes, you're right.

I forgot the JFFS2 behavior. and first implementation scheme.
Sometimes JFFS2 requests small chunks sequencially in the same page. so we have to check block & page scheme.

Sorry, please ignore it.

Thank you,
Kyungmin Park


------- Original Message -------
Sender : ext-adrian.hunter at nokia.com<ext-adrian.hunter at nokia.com> 
Date   : Jan 10, 2007 21:34
Title  : RE: [PATCH] OneNAND: Use address instead block, page in bufferram

It seems to me that this patch would cause un-necessary loads.  For example:

first read at address 0x00000000
then read at address 0x00000010

The second read would load to bufferRAM because the address is different,
even though the page is already there because of the first read.

I am not sure this patch is needed.

Regards
Adrian


-----Original Message-----
From: linux-mtd-bounces at lists.infradead.org on behalf of ext Kyungmin Park
Sent: Tue 1/9/2007 4:10 AM
To: linux-mtd at lists.infradead.org
Subject: [PATCH] OneNAND: Use address instead block, page in bufferram
 
[PATCH] OneNAND: Use address instead of block, page in bufferram

we use the address itself instead of block, page in bufferam.

Signed-off-by: Kyungmin Park <kyungmin.park at samsung.com>
--


@@ -587,19 +601,18 @@ static int onenand_write_bufferram(struct mtd_info *mtd, int area,
 static int onenand_check_bufferram(struct mtd_info *mtd, loff_t addr)
 {
 	struct onenand_chip *this = mtd->priv;
-	int block, page;
 	int i;
+#ifdef DEBUG_BUFFERRAM
+	int block, page;
 
 	block = (int) (addr >> this->erase_shift);
-	page = (int) (addr >> this->page_shift);
-	page &= this->page_mask;
+	page = (int) (addr >> this->page_shift) & this->page_mask;
+#endif
 
 	i = ONENAND_CURRENT_BUFFERRAM(this);
 
 	/* Is there valid data? */
-	if (this->bufferram[i].block == block &&
-	    this->bufferram[i].page == page &&
-	    this->bufferram[i].valid)
+	if (this->bufferram[i].addr == addr && this->bufferram[i].valid)
 		return 1;
 
 	return 0;
@@ -617,24 +630,25 @@ static int onenand_update_bufferram(struct mtd_info *mtd, loff_t addr,
 		int valid)
 {
 	struct onenand_chip *this = mtd->priv;
-	int block, page;
 	int i;
+#ifdef DEBUG_BUFFERRAM
+	int block, page;
 
 	block = (int) (addr >> this->erase_shift);
-	page = (int) (addr >> this->page_shift);
-	page &= this->page_mask;
+	page = (int) (addr >> this->page_shift) & this->page_mask;
+#endif
 
 	/* Invalidate BufferRAM */
 	for (i = 0; i < MAX_BUFFERRAM; i++) {
-		if (this->bufferram[i].block == block &&
-		    this->bufferram[i].page == page)
+		if (this->bufferram[i].addr == addr) {
 			this->bufferram[i].valid = 0;
+			break;
+		}
 	}
 
 	/* Update BufferRAM */
 	i = ONENAND_CURRENT_BUFFERRAM(this);
-	this->bufferram[i].block = block;
-	this->bufferram[i].page = page;
+	this->bufferram[i].addr = addr;
 	this->bufferram[i].valid = valid;
 
 	return 0;
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index f775a7a..46e052f 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -47,9 +47,8 @@ typedef enum {
  * @valid:		valid flag
  */
 struct onenand_bufferram {
-	int block;
-	int page;
-	int valid;
+	loff_t		addr;
+	int		valid;
 };
 
 /**

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/



More information about the linux-mtd mailing list