Re: [Yaffs] BG GC with FreeRtos

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
Delete this message
Reply to this message
Author: Charles Manning
Date:  
To: markus.bargehr
CC: yaffs
Subject: Re: [Yaffs] BG GC with FreeRtos
On Mon, Oct 29, 2018 at 9:51 PM Markus Bargehr <
> 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 <>
> *Gesendet:* Donnerstag, 25. Oktober 2018 22:21
> *An:* Markus Bargehr <>
> *Cc:* yaffs <>
> *Betreff:* Re: [Yaffs] BG GC with FreeRtos
>
>
>
>
>
> On Fri, Oct 26, 2018 at 12:46 AM Markus Bargehr <
> > 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.
>
>
> http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=blob;f=yaffs_vfs_multi.c;h=de3dd75988ef7de715fd80ec28ff6b96e501a903;hb=HEAD#l2137
>
>
>
> 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
>
> http://stoneboat.aleph1.co.uk/cgi-bin/mailman/listinfo/yaffs
>
>