Otherwise, if a large amount of direct IO writes were done, the
segment allocation may be failed because no enough segments are gced.

Signed-off-by: Huang, Ying <ying.hu...@intel.com>
---
 fs/f2fs/data.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -1038,6 +1038,7 @@ static ssize_t f2fs_direct_IO(int rw, st
 {
        struct file *file = iocb->ki_filp;
        struct inode *inode = file->f_mapping->host;
+       struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
 
        /* Let buffer I/O handle the inline data case. */
        if (f2fs_has_inline_data(inode))
@@ -1046,8 +1047,11 @@ static ssize_t f2fs_direct_IO(int rw, st
        if (check_direct_IO(inode, rw, iter, offset))
                return 0;
 
+       if (rw == WRITE)
+               f2fs_balance_fs(sbi);
+
        /* clear fsync mark to recover these blocks */
-       fsync_mark_clear(F2FS_SB(inode->i_sb), inode->i_ino);
+       fsync_mark_clear(sbi, inode->i_ino);
 
        return blockdev_direct_IO(rw, iocb, inode, iter, offset,
                                  get_data_block);

------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to