a question about CONFIG_FLUSH_BUF_AFTER_WRITE

70 views
Skip to first unread message

flame

unread,
Feb 23, 2012, 9:46:45 PM2/23/12
to UFFS
Hi all,

I have configured CONFIG_FLUSH_BUF_AFTER_WRITE,some program about it
in uffs_WriteObject(uffs-1.3.3) :

#ifdef CONFIG_FLUSH_BUF_AFTER_WRITE
uffs_BufFlushGroup(dev, fnode->u.file.serial, fdn);
#endif

I did not found it worked.In function uffs_BufFindGroupSlot(dev,
parent, serial) it did not found any slot(slot = -1).I found the
positions of params parent and serial were reverse.

Should it be modified like this ? :
uffs_BufFlushGroup(dev, fdn,fnode->u.file.serial) or
uffs_BufFlushGroup(dev, fnode->u.file.parent,fnode-
>u.file.serial)


Best regards,
flame

flame

unread,
Mar 1, 2012, 12:35:36 AM3/1/12
to UFFS
Could no one meet this problem?

Frédéric SERGENT

unread,
Mar 1, 2012, 5:52:46 AM3/1/12
to uf...@googlegroups.com

Could no one meet this problem?

Hi Flame,

I just gave it a quick try (by default, I do not enable  CONFIG_FLUSH_BUF_AFTER_WRITE); it seems to work here.

I don't think the parameters serial and parent are reversed:

  - it seems to me that the parent of the written block is the serial number of the object (i.e., th serial number of the file you are writing to)

  - the serial number fdn is computed according to the offset which you are writing to. I suppose it allows to reorder the blocks when analysing the partition at startup

  - in the case you create a new block, just above ("// Flush immediately, so that the new data node will be  // created and put in the tree"), uffs_BufFlushGroup is called in the exact same way. Does it work for you?

Good luck,
Fred



caocheng0705

unread,
Mar 5, 2012, 3:06:31 AM3/5/12
to uf...@googlegroups.com
Hi Frédéric SERGENT,
I have test it again,but it did not yet wrok .
This is my example:
void main()
{
    int fd,i;
    char test[]="hello world";
    my_init_filesystem();
    fd = uffs_open("/hello",UO_CREATE | UO_RDWR | UO_APPEND );
    if(fd<0)
    {
        printf("fd=%d,open error\n",fd);
    }
    else
        printf("fd=%d\n",fd);
    i =    uffs_write(fd,test,sizeof(test));
    if(i==strlen(test))
    {
         printf("i=%d,write ok\n",i);
    }
    uffs_close(fd);
    uffs_ReleaseMountTable();
}

when it is here:

fnode->u.file.serial is 1;fdn is 0;
The uffs_BufFlushGroup : uffs_BufFlushGroup(dev,1,0).Then it does not find the buf group slot(slot is -1),
so _BufFlush(dev,U_FALSE,slot) does not work. 

Best regards,
flame
--
You received this message because you are subscribed to the Google Groups "UFFS" group.
To view this discussion on the web visit https://groups.google.com/d/msg/uffs/-/qJXQkok1o5sJ.
To post to this group, send email to uf...@googlegroups.com.
To unsubscribe from this group, send email to uffs+unsub...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/uffs?hl=en.


Frédéric SERGENT

unread,
Mar 8, 2012, 5:45:50 AM3/8/12
to uf...@googlegroups.com
Hi Flame,

I tried it here, with and without CONFIG_FLUSH_BUF_AFTER_WRITE: both time worked. It's a very basic use case anyway.

Does it work with CONFIG_FLUSH_BUF_AFTER_WRITE _not_ being defined?

By the way, is it the only test you did? Did something else work on your platform?

Regards,
Fred
在 2012-03-01 18:52:46,"Frédéric SERGENT" <fred.ser...@gmail.com> 写道:

Could no one meet this problem?

Hi Flame,

I just gave it a quick try (by default, I do not enable  CONFIG_FLUSH_BUF_AFTER_WRITE); it seems to work here.

I don't think the parameters serial and parent are reversed:

  - it seems to me that the parent of the written block is the serial number of the object (i.e., th serial number of the file you are writing to)

  - the serial number fdn is computed according to the offset which you are writing to. I suppose it allows to reorder the blocks when analysing the partition at startup

  - in the case you create a new block, just above ("// Flush immediately, so that the new data node will be  // created and put in the tree"), uffs_BufFlushGroup is called in the exact same way. Does it work for you?

Good luck,
Fred



--
You received this message because you are subscribed to the Google Groups "UFFS" group.
To view this discussion on the web visit https://groups.google.com/d/msg/uffs/-/qJXQkok1o5sJ.
To post to this group, send email to uf...@googlegroups.com.
To unsubscribe from this group, send email to uffs+unsubscribe@googlegroups.com.

Ricky Zheng

unread,
Mar 15, 2012, 7:02:47 AM3/15/12
to uf...@googlegroups.com
Hi Flame,

Any updates on this ?

- Ricky

To view this discussion on the web visit https://groups.google.com/d/msg/uffs/-/NPgaKke1owwJ.

To post to this group, send email to uf...@googlegroups.com.
To unsubscribe from this group, send email to uffs+uns...@googlegroups.com.

caocheng0705

unread,
Mar 16, 2012, 4:32:46 AM3/16/12
to uf...@googlegroups.com
Hi Ricky. Welcome back!
I tested it again and it did not work!(My platform is Twr-MCF54418)
So I modified it :

   uffs_BufFlushGroup(dev, fnode->u.file.parent,fnode-

>u.file.serial)
but I don`t kown whether it could affect anything else or not.
Now I use this function like this:
uffs_open();
uffs_write();
uffs_flush();
uffs_close();

Our tailorism often powers off in use.So I want to use CONFIG_FLUSH_BUF_AFTER_WRITE
to reduce data losses as far as possible.
Is there any mechanism to do this?

Regards,
flame
To unsubscribe from this group, send email to uffs+unsub...@googlegroups.com.

Ricky Zheng

unread,
Mar 16, 2012, 6:24:35 AM3/16/12
to uf...@googlegroups.com
Right ... there IS a bug ! When fdn == 0 (first block), we should pass file block's 'parent/serial'.

It's now been fixed in commit fe8694, please pull master branch.

Thanks,
Ricky.
Reply all
Reply to author
Forward
0 new messages