diff options
Diffstat (limited to 'fs/ocfs2/inode.c')
-rw-r--r-- | fs/ocfs2/inode.c | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index 327a5b7b86ed..7bcf69154592 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c | |||
@@ -71,6 +71,26 @@ static int ocfs2_truncate_for_delete(struct ocfs2_super *osb, | |||
71 | struct inode *inode, | 71 | struct inode *inode, |
72 | struct buffer_head *fe_bh); | 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 | struct inode *ocfs2_ilookup_for_vote(struct ocfs2_super *osb, | 94 | struct inode *ocfs2_ilookup_for_vote(struct ocfs2_super *osb, |
75 | u64 blkno, | 95 | u64 blkno, |
76 | int delete_vote) | 96 | int delete_vote) |
@@ -260,7 +280,6 @@ int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe, | |||
260 | inode->i_blocks = | 280 | inode->i_blocks = |
261 | ocfs2_align_bytes_to_sectors(le64_to_cpu(fe->i_size)); | 281 | ocfs2_align_bytes_to_sectors(le64_to_cpu(fe->i_size)); |
262 | inode->i_mapping->a_ops = &ocfs2_aops; | 282 | inode->i_mapping->a_ops = &ocfs2_aops; |
263 | inode->i_flags |= S_NOATIME; | ||
264 | inode->i_atime.tv_sec = le64_to_cpu(fe->i_atime); | 283 | inode->i_atime.tv_sec = le64_to_cpu(fe->i_atime); |
265 | inode->i_atime.tv_nsec = le32_to_cpu(fe->i_atime_nsec); | 284 | inode->i_atime.tv_nsec = le32_to_cpu(fe->i_atime_nsec); |
266 | inode->i_mtime.tv_sec = le64_to_cpu(fe->i_mtime); | 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 | OCFS2_I(inode)->ip_clusters = le32_to_cpu(fe->i_clusters); | 296 | OCFS2_I(inode)->ip_clusters = le32_to_cpu(fe->i_clusters); |
278 | OCFS2_I(inode)->ip_orphaned_slot = OCFS2_INVALID_SLOT; | 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 | if (create_ino) | 300 | if (create_ino) |
281 | inode->i_ino = ino_from_blkno(inode->i_sb, | 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 | ocfs2_inode_lock_res_init(&OCFS2_I(inode)->ip_data_lockres, | 350 | ocfs2_inode_lock_res_init(&OCFS2_I(inode)->ip_data_lockres, |
331 | OCFS2_LOCK_TYPE_DATA, inode); | 351 | OCFS2_LOCK_TYPE_DATA, inode); |
332 | 352 | ||
353 | ocfs2_set_inode_flags(inode); | ||
354 | inode->i_flags |= S_NOATIME; | ||
355 | |||
333 | status = 0; | 356 | status = 0; |
334 | bail: | 357 | bail: |
335 | mlog_exit(status); | 358 | mlog_exit(status); |
@@ -1027,12 +1050,8 @@ struct buffer_head *ocfs2_bread(struct inode *inode, | |||
1027 | u64 p_blkno; | 1050 | u64 p_blkno; |
1028 | int readflags = OCFS2_BH_CACHED; | 1051 | int readflags = OCFS2_BH_CACHED; |
1029 | 1052 | ||
1030 | #if 0 | ||
1031 | /* only turn this on if we know we can deal with read_block | ||
1032 | * returning nothing */ | ||
1033 | if (reada) | 1053 | if (reada) |
1034 | readflags |= OCFS2_BH_READAHEAD; | 1054 | readflags |= OCFS2_BH_READAHEAD; |
1035 | #endif | ||
1036 | 1055 | ||
1037 | if (((u64)block << inode->i_sb->s_blocksize_bits) >= | 1056 | if (((u64)block << inode->i_sb->s_blocksize_bits) >= |
1038 | i_size_read(inode)) { | 1057 | i_size_read(inode)) { |
@@ -1131,6 +1150,7 @@ int ocfs2_mark_inode_dirty(struct ocfs2_journal_handle *handle, | |||
1131 | 1150 | ||
1132 | spin_lock(&OCFS2_I(inode)->ip_lock); | 1151 | spin_lock(&OCFS2_I(inode)->ip_lock); |
1133 | fe->i_clusters = cpu_to_le32(OCFS2_I(inode)->ip_clusters); | 1152 | fe->i_clusters = cpu_to_le32(OCFS2_I(inode)->ip_clusters); |
1153 | fe->i_attr = cpu_to_le32(OCFS2_I(inode)->ip_attr); | ||
1134 | spin_unlock(&OCFS2_I(inode)->ip_lock); | 1154 | spin_unlock(&OCFS2_I(inode)->ip_lock); |
1135 | 1155 | ||
1136 | fe->i_size = cpu_to_le64(i_size_read(inode)); | 1156 | fe->i_size = cpu_to_le64(i_size_read(inode)); |
@@ -1169,6 +1189,8 @@ void ocfs2_refresh_inode(struct inode *inode, | |||
1169 | spin_lock(&OCFS2_I(inode)->ip_lock); | 1189 | spin_lock(&OCFS2_I(inode)->ip_lock); |
1170 | 1190 | ||
1171 | OCFS2_I(inode)->ip_clusters = le32_to_cpu(fe->i_clusters); | 1191 | OCFS2_I(inode)->ip_clusters = le32_to_cpu(fe->i_clusters); |
1192 | OCFS2_I(inode)->ip_attr = le32_to_cpu(fe->i_attr); | ||
1193 | ocfs2_set_inode_flags(inode); | ||
1172 | i_size_write(inode, le64_to_cpu(fe->i_size)); | 1194 | i_size_write(inode, le64_to_cpu(fe->i_size)); |
1173 | inode->i_nlink = le16_to_cpu(fe->i_links_count); | 1195 | inode->i_nlink = le16_to_cpu(fe->i_links_count); |
1174 | inode->i_uid = le32_to_cpu(fe->i_uid); | 1196 | inode->i_uid = le32_to_cpu(fe->i_uid); |