On Mon, Oct 29, 2018 at 9:51 PM Markus Bargehr <markus.bargehr@gantnersolutions.com> wrote:

Hello Charles,

 

thank you for your reply!

 

I have not found the function yaffs_bg_gc_urgency() within the latest yaffs code.

Is this a special function only used on the Linux device?


Yes, look at:
http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=blob;f=yaffs_vfs_multi.c#l2108

 

I have found another code for a possible bg threat.

Do you think this could be ok for me as a bg thread using freertos?

 

void bg_gc_func ( void const * argument )

{

       struct yaffs_dev *dev;

       int urgent = 0;

       int result;

       int next_urgent;

 

       while ( 1 )

       {

             /* Iterate through devices, do bg gc updating ungency */

             yaffs_dev_rewind ( );

             next_urgent = 0;

 

             while ( ( dev = yaffs_next_dev ( ) ) != NULL )

             {

                    result = yaffs_do_background_gc_reldev ( dev, urgent );

                    if ( result > 0 )

                           next_urgent = 1;

             }

 

             urgent = next_urgent;

 

             if ( next_urgent )

             {

                    osDelay ( 1000 );

             }

             else

             {

                    osDelay ( 5000 );

             }

       }

       /* Don't ever return. */

}

 


 Yes, something like that should work.


Regards

Markus

 

Von: Charles Manning <cdhmanning@gmail.com>
Gesendet: Donnerstag, 25. Oktober 2018 22:21
An: Markus Bargehr <markus.bargehr@gantnersolutions.com>
Cc: yaffs <yaffs@stoneboat.aleph1.co.uk>
Betreff: Re: [Yaffs] BG GC with FreeRtos

 

 

On Fri, Oct 26, 2018 at 12:46 AM Markus Bargehr <markus.bargehr@gantnersolutions.com> wrote:

Hello,

 

i’m new on Yaffs and now I ahve implemented Yaffs2 on an embedded System with FreeRTOS as OS.

It looks like that Yaffs work’s good. In some documentations I have read that it would be good to have a BG GC which should run every 2-5 seconds.

Is there someone which could show me an example code how such a BG GC Taks in FreeRTOS could kook like?

 

Regards

Markus

 

 

Hello Markus

 

Have a look in the Yaffs VFS code to see how it is done in Linux.

 

Pretty straight forward: Just set up a thread with the proper locking that occasionally calls

 

urgency = yaffs_bg_gc_urgency(dev);
gc_result = yaffs_bg_gc(dev, urgency);

 

Regards

 

Charles

 

 

_______________________________________________
yaffs mailing list
yaffs@stoneboat.aleph1.co.uk
http://stoneboat.aleph1.co.uk/cgi-bin/mailman/listinfo/yaffs