On Thu, 2005-10-13 at 10:46 +1300, Charles Manning wrote: > Hi Robert > > This is a well-known (by some :-)) issue, but the x7 difference is > surprising, I would have expected more like x2. > > I could go into the explanation in depth if you need, but for now I will > give a 50,000 ft description: > > What happens is this: > 1) If you overwrite a file, then yaffs cannot use soft deletion, but > must instead mark the old file sectors as being deleted. This costs > extra programming cycles. If (likely) blocks become fully discarded, > then they will be erased. > > The above will happen whether or not you overwrite the file directly or > whether you first truncate it to zero first ie open with O_TRUNC. > > If instead you delete a file and rewrite it from scratch, then YAFFS > uses "soft deletion" to delete the file instead. This does not program > deletion markers and therefore takes far less time. > > I believe some/most other log structured fs have a similar issue. > > > One way around this is to delete files rather than truncate them. Of > course this only works if you can modify the source. Ie: > > Instead of > > h = open(fname, O_CREAT | O_RDWR| O_TRUNC); > > Use > > unlink(fname); > h = open(fname, O_CREAT | O_RDWR); > > The above does not apply to yaffs2 on 2k pages since yaffs2/2k does not > write deletion markers. Can YAFFS detect this situation and effectively "unlink" the file first? > > > -----Original Message----- > > From: yaffs-bounces@stoneboat.aleph1.co.uk > > [mailto:yaffs-bounces@stoneboat.aleph1.co.uk] On Behalf Of > > Roberts Nathan-mcg31137 > > Sent: Thursday, 13 October 2005 4:24 a.m. > > To: yaffs@stoneboat.aleph1.co.uk > > Subject: [Yaffs] Performance of overwrite vs new file > > > > > > I've run into an interesting performance issue that I was > > hoping someone with more knowledge of YAFFS's inner workings > > could explain rather quickly. > > > > Essentially, I am observing that overwriting a file (1MB or > > so) takes about 7 times longer than writing exactly the same > > file under a new name. > > > > This is using YAFFS1 on NAND with 512B pages. > > > > Thanks for any insight. > > > > _______________________________________________ > > yaffs mailing list > > yaffs@stoneboat.aleph1.co.uk > > http://stoneboat.aleph1.co.uk/cgi-bin/mailman/listinfo/yaffs > > > > _______________________________________________ > yaffs mailing list > yaffs@stoneboat.aleph1.co.uk > http://stoneboat.aleph1.co.uk/cgi-bin/mailman/listinfo/yaffs -- Peter Barada