f2fs: avoid unnecessary updating inode during fsync
[deliverable/linux.git] / fs / f2fs / file.c
index c5606b1e1a890df1fd417ca558462e5a36696aab..23decf050236dbbb46e250872ab285565da47e97 100644 (file)
@@ -173,12 +173,8 @@ static void try_to_fix_pino(struct inode *inode)
                        get_parent_ino(inode, &pino)) {
                f2fs_i_pino_write(inode, pino);
                file_got_pino(inode);
-               up_write(&fi->i_sem);
-
-               f2fs_write_inode(inode, NULL);
-       } else {
-               up_write(&fi->i_sem);
        }
+       up_write(&fi->i_sem);
 }
 
 static int f2fs_do_sync_file(struct file *file, loff_t start, loff_t end,
@@ -212,7 +208,7 @@ static int f2fs_do_sync_file(struct file *file, loff_t start, loff_t end,
        }
 
        /* if the inode is dirty, let's recover all the time */
-       if (!datasync) {
+       if (!datasync && !f2fs_skip_inode_update(inode)) {
                f2fs_write_inode(inode, NULL);
                goto go_write;
        }
@@ -255,7 +251,7 @@ go_write:
                goto out;
        }
 sync_nodes:
-       ret = fsync_node_pages(sbi, ino, &wbc, atomic);
+       ret = fsync_node_pages(sbi, inode, &wbc, atomic);
        if (ret)
                goto out;
 
@@ -499,7 +495,6 @@ int truncate_data_blocks_range(struct dnode_of_data *dn, int count)
                                                        dn->inode) + ofs;
                f2fs_update_extent_cache_range(dn, fofs, 0, len);
                dec_valid_block_count(sbi, dn->inode, nr_free);
-               sync_inode_page(dn);
        }
        dn->ofs_in_node = ofs;
 
@@ -1123,10 +1118,8 @@ static int f2fs_zero_range(struct inode *inode, loff_t offset, loff_t len,
        }
 
 out:
-       if (!(mode & FALLOC_FL_KEEP_SIZE) && i_size_read(inode) < new_size) {
+       if (!(mode & FALLOC_FL_KEEP_SIZE) && i_size_read(inode) < new_size)
                f2fs_i_size_write(inode, new_size);
-               update_inode_page(inode);
-       }
 
        return ret;
 }
@@ -1232,10 +1225,8 @@ static int expand_inode_data(struct inode *inode, loff_t offset,
                new_size = ((loff_t)pg_end << PAGE_SHIFT) + off_end;
        }
 
-       if (!(mode & FALLOC_FL_KEEP_SIZE) && i_size_read(inode) < new_size) {
+       if (!(mode & FALLOC_FL_KEEP_SIZE) && i_size_read(inode) < new_size)
                f2fs_i_size_write(inode, new_size);
-               update_inode_page(inode);
-       }
 
        return ret;
 }
This page took 0.027933 seconds and 5 git commands to generate.