@@ -71,6 +71,26 @@ static int ocfs2_truncate_for_delete(struct ocfs2_super *osb,
71
71
struct inode * inode ,
72
72
struct buffer_head * fe_bh );
73
73
74
+ void ocfs2_set_inode_flags (struct inode * inode )
75
+ {
76
+ unsigned int flags = OCFS2_I (inode )-> ip_attr ;
77
+
78
+ inode -> i_flags &= ~(S_IMMUTABLE |
79
+ S_SYNC | S_APPEND | S_NOATIME | S_DIRSYNC );
80
+
81
+ if (flags & OCFS2_IMMUTABLE_FL )
82
+ inode -> i_flags |= S_IMMUTABLE ;
83
+
84
+ if (flags & OCFS2_SYNC_FL )
85
+ inode -> i_flags |= S_SYNC ;
86
+ if (flags & OCFS2_APPEND_FL )
87
+ inode -> i_flags |= S_APPEND ;
88
+ if (flags & OCFS2_NOATIME_FL )
89
+ inode -> i_flags |= S_NOATIME ;
90
+ if (flags & OCFS2_DIRSYNC_FL )
91
+ inode -> i_flags |= S_DIRSYNC ;
92
+ }
93
+
74
94
struct inode * ocfs2_ilookup_for_vote (struct ocfs2_super * osb ,
75
95
u64 blkno ,
76
96
int delete_vote )
@@ -260,7 +280,6 @@ int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe,
260
280
inode -> i_blocks =
261
281
ocfs2_align_bytes_to_sectors (le64_to_cpu (fe -> i_size ));
262
282
inode -> i_mapping -> a_ops = & ocfs2_aops ;
263
- inode -> i_flags |= S_NOATIME ;
264
283
inode -> i_atime .tv_sec = le64_to_cpu (fe -> i_atime );
265
284
inode -> i_atime .tv_nsec = le32_to_cpu (fe -> i_atime_nsec );
266
285
inode -> i_mtime .tv_sec = le64_to_cpu (fe -> i_mtime );
@@ -276,6 +295,7 @@ int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe,
276
295
277
296
OCFS2_I (inode )-> ip_clusters = le32_to_cpu (fe -> i_clusters );
278
297
OCFS2_I (inode )-> ip_orphaned_slot = OCFS2_INVALID_SLOT ;
298
+ OCFS2_I (inode )-> ip_attr = le32_to_cpu (fe -> i_attr );
279
299
280
300
if (create_ino )
281
301
inode -> i_ino = ino_from_blkno (inode -> i_sb ,
@@ -330,6 +350,9 @@ int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe,
330
350
ocfs2_inode_lock_res_init (& OCFS2_I (inode )-> ip_data_lockres ,
331
351
OCFS2_LOCK_TYPE_DATA , inode );
332
352
353
+ ocfs2_set_inode_flags (inode );
354
+ inode -> i_flags |= S_NOATIME ;
355
+
333
356
status = 0 ;
334
357
bail :
335
358
mlog_exit (status );
@@ -1131,6 +1154,7 @@ int ocfs2_mark_inode_dirty(struct ocfs2_journal_handle *handle,
1131
1154
1132
1155
spin_lock (& OCFS2_I (inode )-> ip_lock );
1133
1156
fe -> i_clusters = cpu_to_le32 (OCFS2_I (inode )-> ip_clusters );
1157
+ fe -> i_attr = cpu_to_le32 (OCFS2_I (inode )-> ip_attr );
1134
1158
spin_unlock (& OCFS2_I (inode )-> ip_lock );
1135
1159
1136
1160
fe -> i_size = cpu_to_le64 (i_size_read (inode ));
@@ -1169,6 +1193,8 @@ void ocfs2_refresh_inode(struct inode *inode,
1169
1193
spin_lock (& OCFS2_I (inode )-> ip_lock );
1170
1194
1171
1195
OCFS2_I (inode )-> ip_clusters = le32_to_cpu (fe -> i_clusters );
1196
+ OCFS2_I (inode )-> ip_attr = le32_to_cpu (fe -> i_attr );
1197
+ ocfs2_set_inode_flags (inode );
1172
1198
i_size_write (inode , le64_to_cpu (fe -> i_size ));
1173
1199
inode -> i_nlink = le16_to_cpu (fe -> i_links_count );
1174
1200
inode -> i_uid = le32_to_cpu (fe -> i_uid );
0 commit comments