jffs2 garbage collect thread

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

jffs2 garbage collect thread

Stanislav Meduna
Hi,

anyone knows whether it is now safe to enable the JFFS2 garbage
collect thread?

The CDL comment says:

  Enable background garbage collection thread, for making
  free space ahead of time. Leave this off till it's been
  implemented. And don't implement it till icache locking has
  been made thread-safe.

The icache locking probably is not thread-safe per-se, but
the fs-ecos.c says

  FSTAB_ENTRY(jffs2_fste, "jffs2", 0,
            CYG_SYNCMODE_FILE_FILESYSTEM | CYG_SYNCMODE_IO_FILESYSTEM,

and the thread itself does cyg_fs_lock around the garbage
collect pass

  cyg_fs_lock(mte, mte->fs->syncmode);

  if (jffs2_garbage_collect_pass(c) == -ENOSPC) {
    printf("No space for garbage collection. "
           "Aborting JFFS2 GC thread\n");
    break;
  }
  cyg_fs_unlock(mte, mte->fs->syncmode);

To me it looks safe - am I overlooking something?


The reason I need to control garbage collect explicitely is that
I need to make sure a filesystem has some amount of free space
before starting an operation. So I want to trigger a garbage collect
explicitely and then decide according to the superblock information.
Can I use this model or are there any hidden dangers?

Thanks
--
                                  Stano