forked from Imagelibrary/rtems
cpukit/jffs2: Implement JFFS2 spinlocks
This provides a non-noop implementation of spinlocks for JFFS2 in terms of RTEMS mutexes. POSIX spinlocks are not appropriate for the types of actions that occur during a held JFFS2 spinlock and can cause bad dispatch level conditions.
This commit is contained in:
committed by
Joel Sherrill
parent
c5476e2b8c
commit
d7aa1ab86f
@@ -1,34 +1,16 @@
|
||||
#ifndef __LINUX_SPINLOCK_H__
|
||||
#define __LINUX_SPINLOCK_H__
|
||||
|
||||
#include <rtems/thread.h>
|
||||
|
||||
typedef struct { } spinlock_t;
|
||||
#define SPIN_LOCK_UNLOCKED (spinlock_t) { }
|
||||
#define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED
|
||||
typedef struct { rtems_mutex r_m; } spinlock_t;
|
||||
|
||||
#define spin_lock_init(lock) \
|
||||
CYG_MACRO_START; \
|
||||
CYG_UNUSED_PARAM(spinlock_t *, lock); \
|
||||
CYG_MACRO_END
|
||||
#define DEFINE_SPINLOCK(x) spinlock_t x
|
||||
|
||||
#define spin_lock(lock) \
|
||||
CYG_MACRO_START; \
|
||||
CYG_UNUSED_PARAM(spinlock_t *, lock); \
|
||||
CYG_MACRO_END
|
||||
#define spin_lock_init(x) rtems_mutex_init(&(x)->r_m, "JFFS2 Spinlock");
|
||||
|
||||
#define spin_unlock(lock) \
|
||||
CYG_MACRO_START; \
|
||||
CYG_UNUSED_PARAM(spinlock_t *, lock); \
|
||||
CYG_MACRO_END
|
||||
#define spin_lock(x) rtems_mutex_lock(&(x)->r_m);
|
||||
|
||||
#define spin_lock_bh(lock) \
|
||||
CYG_MACRO_START; \
|
||||
CYG_UNUSED_PARAM(spinlock_t *, lock); \
|
||||
CYG_MACRO_END
|
||||
|
||||
#define spin_unlock_bh(lock) \
|
||||
CYG_MACRO_START; \
|
||||
CYG_UNUSED_PARAM(spinlock_t *, lock); \
|
||||
CYG_MACRO_END
|
||||
#define spin_unlock(x) rtems_mutex_unlock(&(x)->r_m);
|
||||
|
||||
#endif /* __LINUX_SPINLOCK_H__ */
|
||||
|
||||
@@ -1384,6 +1384,8 @@ int rtems_jffs2_initialize(
|
||||
#ifdef CONFIG_JFFS2_FS_WRITEBUFFER
|
||||
add_delayed_work_to_chain(&c->wbuf_dwork);
|
||||
#endif
|
||||
spin_lock_init(&c->erase_completion_lock);
|
||||
spin_lock_init(&c->inocache_lock);
|
||||
c->mtd = NULL;
|
||||
rtems_recursive_mutex_init(&sb->s_mutex, RTEMS_FILESYSTEM_TYPE_JFFS2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user