linux/fs/f2fs
Gu Zheng e479556bfd f2fs: use rw_sem instead of fs_lock(locks mutex)
The fs_locks is used to block other ops(ex, recovery) when doing checkpoint.
And each other operate routine(besides checkpoint) needs to acquire a fs_lock,
there is a terrible problem here, if these are too many concurrency threads acquiring
fs_lock, so that they will block each other and may lead to some performance problem,
but this is not the phenomenon we want to see.
Though there are some optimization patches introduced to enhance the usage of fs_lock,
but the thorough solution is using a *rw_sem* to replace the fs_lock.
Checkpoint routine takes write_sem, and other ops take read_sem, so that we can block
other ops(ex, recovery) when doing checkpoint, and other ops will not disturb each other,
this can avoid the problem described above completely.
Because of the weakness of rw_sem, the above change may introduce a potential problem
that the checkpoint thread might get starved if other threads are intensively locking
the read semaphore for I/O.(Pointed out by Xu Jin)
In order to avoid this, a wait_list is introduced, the appending read semaphore ops
will be dropped into the wait_list if checkpoint thread is waiting for write semaphore,
and will be waked up when checkpoint thread gives up write semaphore.
Thanks to Kim's previous review and test, and will be very glad to see other guys'
performance tests about this patch.

V2:
  -fix the potential starvation problem.
  -use more suitable func name suggested by Xu Jin.

Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
[Jaegeuk Kim: adjust minor coding standard]
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
2013-10-07 11:33:05 +09:00
..
acl.c f2fs: support xattr security labels 2013-06-11 16:01:03 +09:00
acl.h f2fs: adjust kernel coding style 2012-12-11 13:43:42 +09:00
checkpoint.c f2fs: use rw_sem instead of fs_lock(locks mutex) 2013-10-07 11:33:05 +09:00
data.c f2fs: use rw_sem instead of fs_lock(locks mutex) 2013-10-07 11:33:05 +09:00
debug.c f2fs: use seq_puts()/seq_putc() rather than seq_printf() where possible 2013-07-30 15:17:03 +09:00
dir.c f2fs: fix handling orphan inodes 2013-07-30 15:17:03 +09:00
f2fs.h f2fs: use rw_sem instead of fs_lock(locks mutex) 2013-10-07 11:33:05 +09:00
file.c f2fs: use rw_sem instead of fs_lock(locks mutex) 2013-10-07 11:33:05 +09:00
gc.c f2fs: optimize the victim searching loop slightly 2013-09-24 17:45:48 +09:00
gc.h f2fs: optimize gc for better performance 2013-09-05 13:50:32 +09:00
hash.c f2fs: unify string length declarations and usage 2012-12-28 11:27:53 +09:00
inode.c f2fs: use rw_sem instead of fs_lock(locks mutex) 2013-10-07 11:33:05 +09:00
Kconfig f2fs: support xattr security labels 2013-06-11 16:01:03 +09:00
Makefile f2fs: update Kconfig and Makefile 2012-12-11 13:43:42 +09:00
namei.c f2fs: use rw_sem instead of fs_lock(locks mutex) 2013-10-07 11:33:05 +09:00
node.c f2fs: merge more bios of node block writes 2013-09-05 10:17:19 +09:00
node.h f2fs: fix the use of XATTR_NODE_OFFSET 2013-08-09 14:57:56 +09:00
recovery.c f2fs: use rw_sem instead of fs_lock(locks mutex) 2013-10-07 11:33:05 +09:00
segment.c f2fs: avoid allocating failure in bio_alloc 2013-09-24 17:45:48 +09:00
segment.h f2fs: avoid allocating failure in bio_alloc 2013-09-24 17:45:48 +09:00
super.c f2fs: use rw_sem instead of fs_lock(locks mutex) 2013-10-07 11:33:05 +09:00
xattr.c f2fs: use rw_sem instead of fs_lock(locks mutex) 2013-10-07 11:33:05 +09:00
xattr.h f2fs: support the inline xattrs 2013-08-26 20:15:23 +09:00