OSDN Git Service

f2fs: guarantee journalled quota data by checkpoint
[uclinux-h8/linux.git] / fs / f2fs / data.c
index 00b37a1..106f116 100644 (file)
@@ -46,7 +46,7 @@ static bool __is_cp_guaranteed(struct page *page)
                        inode->i_ino ==  F2FS_NODE_INO(sbi) ||
                        S_ISDIR(inode->i_mode) ||
                        (S_ISREG(inode->i_mode) &&
-                       is_inode_flag_set(inode, FI_ATOMIC_FILE)) ||
+                       (f2fs_is_atomic_file(inode) || IS_NOQUOTA(inode))) ||
                        is_cold_data(page))
                return true;
        return false;
@@ -1766,6 +1766,8 @@ bool f2fs_should_update_outplace(struct inode *inode, struct f2fs_io_info *fio)
                return true;
        if (S_ISDIR(inode->i_mode))
                return true;
+       if (IS_NOQUOTA(inode))
+               return true;
        if (f2fs_is_atomic_file(inode))
                return true;
        if (fio) {
@@ -2016,7 +2018,7 @@ out:
        }
 
        unlock_page(page);
-       if (!S_ISDIR(inode->i_mode))
+       if (!S_ISDIR(inode->i_mode) && !IS_NOQUOTA(inode))
                f2fs_balance_fs(sbi, need_balance_fs);
 
        if (unlikely(f2fs_cp_error(sbi))) {
@@ -2207,6 +2209,8 @@ static inline bool __should_serialize_io(struct inode *inode,
 {
        if (!S_ISREG(inode->i_mode))
                return false;
+       if (IS_NOQUOTA(inode))
+               return false;
        if (wbc->sync_mode != WB_SYNC_ALL)
                return true;
        if (get_dirty_pages(inode) >= SM_I(F2FS_I_SB(inode))->min_seq_blocks)
@@ -2236,7 +2240,8 @@ static int __f2fs_write_data_pages(struct address_space *mapping,
        if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING)))
                goto skip_write;
 
-       if (S_ISDIR(inode->i_mode) && wbc->sync_mode == WB_SYNC_NONE &&
+       if ((S_ISDIR(inode->i_mode) || IS_NOQUOTA(inode)) &&
+                       wbc->sync_mode == WB_SYNC_NONE &&
                        get_dirty_pages(inode) < nr_pages_to_skip(sbi, DATA) &&
                        f2fs_available_free_memory(sbi, DIRTY_DENTS))
                goto skip_write;
@@ -2301,7 +2306,7 @@ static void f2fs_write_failed(struct address_space *mapping, loff_t to)
                down_write(&F2FS_I(inode)->i_mmap_sem);
 
                truncate_pagecache(inode, i_size);
-               f2fs_truncate_blocks(inode, i_size, true);
+               f2fs_truncate_blocks(inode, i_size, true, true);
 
                up_write(&F2FS_I(inode)->i_mmap_sem);
                up_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
@@ -2440,7 +2445,8 @@ repeat:
        if (err)
                goto fail;
 
-       if (need_balance && has_not_enough_free_secs(sbi, 0, 0)) {
+       if (need_balance && !IS_NOQUOTA(inode) &&
+                       has_not_enough_free_secs(sbi, 0, 0)) {
                unlock_page(page);
                f2fs_balance_fs(sbi, true);
                lock_page(page);