#include <linux/crc32.h>
#include <linux/magic.h>
#include <linux/kobject.h>
-#include <linux/wait.h>
-#include <linux/sched.h>
/*
* For mount options
struct inode *meta_inode; /* cache meta blocks */
struct mutex cp_mutex; /* checkpoint procedure lock */
struct rw_semaphore cp_rwsem; /* blocking FS operations */
- wait_queue_head_t cp_wait; /* checkpoint wait queue */
struct mutex node_write; /* locking node writes */
struct mutex writepages; /* mutex for writepages() */
int por_doing; /* recovery is doing or not */
static inline void f2fs_lock_op(struct f2fs_sb_info *sbi)
{
- /*
- * If the checkpoint thread is waiting for cp_rwsem, add cuurent task
- * into wait list to avoid the checkpoint thread starvation
- */
- while (!list_empty(&sbi->cp_rwsem.wait_list))
- wait_event_interruptible(sbi->cp_wait,
- list_empty(&sbi->cp_rwsem.wait_list));
down_read(&sbi->cp_rwsem);
}
static inline void f2fs_unlock_all(struct f2fs_sb_info *sbi)
{
up_write(&sbi->cp_rwsem);
-
- /* wake up all tasks blocked by checkpoint */
- wake_up_all(&sbi->cp_wait);
}
/*
spin_lock_init(&sbi->stat_lock);
init_rwsem(&sbi->bio_sem);
init_rwsem(&sbi->cp_rwsem);
- init_waitqueue_head(&sbi->cp_wait);
init_sb_info(sbi);
/* get an inode for meta space */