Hi, regarding the optimizations you wrote, how about if we optimize them
further? (or at least, to me, it looks like an optimization). I am by no
means a flash expert, or an mtd one at that, so pardon me if i do
something wrong. Correct me and i will listen. :)
Have a look at my humble optimizations, if you dont mind.. (basically an
"if"-statement optimization that shouldnt touch the logic that you coded
in)
On Sat, 23 Nov 2002 10:00:44 +0100, "Thomas Gleixner"
<
tglx@linutronix.de> said:
> Charles,
>
> [---- snip ------]
>
> I made following changes to yaffs_mtdif.c and improved the performance,
> due to
> the fact, that data and oob area are read and written in one go, without
> (de)selecting the chip again.
>
> RCS file: /home/aleph1/cvs/yaffs/yaffs_mtdif.c,v
> retrieving revision 1.2
> diff -u -r1.2 yaffs_mtdif.c
> --- yaffs_mtdif.c 27 Aug 2002 03:31:38 -0000 1.2
> +++ yaffs_mtdif.c 23 Nov 2002 07:54:21 -0000
> @@ -32,11 +32,12 @@
>
> __u8 *spareAsBytes = (__u8 *)spare;
>
> - if(data)
> + if(data && !spare)
> mtd->write(mtd,addr,YAFFS_BYTES_PER_CHUNK,&dummy,data);
> - if(spare)
> + if(!data && spare)
> mtd->write_oob(mtd,addr,YAFFS_BYTES_PER_SPARE,&dummy,spareAsBytes);
> -
> + if(data && spare)
> +
> mtd->write_ecc(mtd,addr,YAFFS_BYTES_PER_CHUNK,&dummy,data,spareAsBytes,NAND_OOB_NONE);
> return YAFFS_OK;
> }
i was just thinking - how about the one below (pardon me for not using a
diff - i dont have ready access to a unix box right now; please check the
logic below and see if it works)
------ code --------
"@@ -32 @@"
__u8 *spareAsBytes = (__u8 *)spare;
if(data) {
if(spare)
mtd->write_ecc(mtd,addr,YAFFS_BYTES_PER_CHUNK,&dummy,data,spareAsBytes,NAND_OOB_NONE);
else
mtd->write(mtd,addr,YAFFS_BYTES_PER_CHUNK,&dummy,data);
}
else if(spare)
mtd->write_oob(mtd,addr,YAFFS_BYTES_PER_SPARE,&dummy,spareAsBytes);
return YAFFS_OK;
}
------ code --------
>
> @@ -50,10 +51,12 @@
>
> __u8 *spareAsBytes = (__u8 *)spare;
>
> - if(data)
> + if(data && !spare)
> mtd->read(mtd,addr,YAFFS_BYTES_PER_CHUNK,&dummy,data);
> - if(spare)
> + if(!data && spare)
> mtd->read_oob(mtd,addr,YAFFS_BYTES_PER_SPARE,&dummy,spareAsBytes);
> + if(data && spare)
> +
> mtd->read_ecc(mtd,addr,YAFFS_BYTES_PER_CHUNK,&dummy,data,spareAsBytes,NAND_OOB_NONE);
>
> return YAFFS_OK;
> }
>
------ code --------
"@@ -50 @@"
__u8 *spareAsBytes = (__u8 *)spare;
if(data) {
if(spare)
mtd->read_ecc(mtd,addr,YAFFS_BYTES_PER_CHUNK,&dummy,data,spareAsBytes,NAND_OOB_NONE);
else
mtd->read(mtd,addr,YAFFS_BYTES_PER_CHUNK,&dummy,data);
}
else if(spare)
mtd->read_oob(mtd,addr,YAFFS_BYTES_PER_SPARE,&dummy,spareAsBytes);
return YAFFS_OK;
}
------ code --------
thanks and regards
-jf
--
"It's an extraordinary world!" - jfsworld <at> fastmail.fm
---------------------------------------------------------------------------------------
This mailing list is hosted by Toby Churchill open software (
www.toby-churchill.org).
If mailing list membership is no longer wanted you can remove yourself from the list by
sending an email to
yaffs-request@toby-churchill.org with the text "unsubscribe"
(without the quotes) as the subject.