Re: [Yaffs] Any way to *suppress* metadata updates?

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Charles Manning
Date:  
To: yaffs
Subject: Re: [Yaffs] Any way to *suppress* metadata updates?
On Monday 21 September 2009 17:09:08 James Kehl wrote:
> > -----Original Message-----
> > From: [mailto:yaffs-
> > ] On Behalf Of
> > Sent: Tuesday, 15 September 2009 10:13 PM
> > Cc:
> > Subject: Re: [Yaffs] Time stamp not updated upon sync
> >
> > It's a very good point about avoiding unnecessary writes
> > [...]
>
> Speaking of avoiding unnecessary writes, is there any way to *suppress*
> metadata updates?
>
> I'm working on an embedded app that, every so often, opens a log file,
> appends data to it, and closes it. Most of these updates will be very
> small: 32 bytes or so.
>
> The file mtime isn't important (and I'd be logging the time inside the
> file, if it were) - in fact, my yaffsfs_CurrentTime implementation
> returns a constant. The file size should be calculable from the
> byteCount tags on each data page (I have no holes and the file isn't
> shrinking).
>
> Despite all this, yaffs_FlushFile will rewrite the object header, every
> time; it might be small bikkies to everyone else, but I'd like to be
> able to elide this extra write.
>
> This looks like it would be easy to do for Yaffs1. Can anyone give me
> pointers on Yaffs2?



Hi James

This is not a supported function and a bit of hackery would be required.

For a bit of a quick hack, try

In yaffs_guts.c:yaffs_FlushFile()
int yaffs_FlushFile(yaffs_Object *in, int updateTime)
{
     int retVal;
    if (in->dirty) {
        yaffs_FlushFilesChunkCache(in);


+        in->dirty = 0;
+             return YAFFS_OK; /* Skip update of metadata after a flush */


                if (updateTime) {


See how that works.

-- Charles