25 #include <linux/time.h>
27 #include <linux/sched.h>
45 static int ext4_sync_parent(
struct inode *
inode)
52 if (!ext4_test_inode_state(inode, EXT4_STATE_NEWENTRY))
55 while (ext4_test_inode_state(inode, EXT4_STATE_NEWENTRY)) {
56 ext4_clear_inode_state(inode, EXT4_STATE_NEWENTRY);
69 memset(&wbc, 0,
sizeof(wbc));
89 static int __sync_inode(
struct inode *inode,
int datasync)
122 struct inode *inode = file->
f_mapping->host;
124 journal_t *journal =
EXT4_SB(inode->
i_sb)->s_journal;
127 bool needs_barrier =
false;
129 J_ASSERT(ext4_journal_current_handle() ==
NULL);
131 trace_ext4_sync_file_enter(file, datasync);
146 ret = __sync_inode(inode, datasync);
147 if (!ret && !hlist_empty(&inode->
i_dentry))
148 ret = ext4_sync_parent(inode);
166 if (ext4_should_journal_data(inode)) {
172 if (journal->j_flags & JBD2_BARRIER &&
174 needs_barrier =
true;
184 trace_ext4_sync_file_exit(inode, ret);