This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE : Is JFFS2 thread-safe?


Davis,

> -----Message d'origine-----
> De?: David Woodhouse [mailto:dwmw2@infradead.org]
> Envoyé?: jeudi 27 novembre 2003 01:27
> À?: Vincent Catros
> Cc?: ecos-discuss@sources.redhat.com
> Objet?: Re: [ECOS] Is JFFS2 thread-safe?
> 
[...]
> In fact, I suspect that is actually OK because we set the
> CYG_SYNCMODE_FILE_FILESYSTEM flag and hence the fileio layer ensures
> that only one file system method is invoked at a time. It would be
> better to do our own locking and drop that flag though, since it makes
> coordinating the locking with gcthread.c a little nicer.
> 
> Your underlying flash drivers may also need to be thread-safe, if
you're
> allowing concurrent calls into JFFS2 -- which I think we are; open and
> close are serialised but read() and write() on two separate files can
> happen simultaneously AFAICT.
[...]

Effectively, before any call to a file system function, the macro
LOCK_FS is called. This macro is an alias to cyg_fs_lock.
Accordig to the flag passed to that function (ie :
CYG_SYNCMODE_FILE_FILESYSTEM) file system functions are serialized that
way.

But it seems that read() and write() lead to a cyg_file_lock which call
cyg_fs_lock (see fd.cxx).

So, read() and write() are probably serialized to.

Am I wrong?

Regards.

Vincent


--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]