aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/inode.c
diff options
context:
space:
mode:
authorHerbert Poetzl <herbert@13thfloor.at>2006-07-03 20:27:12 -0400
committerMark Fasheh <mark.fasheh@oracle.com>2006-09-20 18:48:39 -0400
commitca4d147e62df370c334898464023aa7f9126abe1 (patch)
treeaff39cd19c5b0a95a1fd85caf439c4aa69c5830e /fs/ocfs2/inode.c
parentb4c98f625fffee3a6f633082e9e4be3e952ca2ab (diff)
ocfs2: add ext2 attributes
Support immutable, and other attributes. Some renaming and other minor fixes done by myself. Signed-off-by: Herbert Poetzl <herbert@13thfloor.at> Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2/inode.c')
-rw-r--r--fs/ocfs2/inode.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index 327a5b7b86ed..3f496c41fea8 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
74void 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
74struct inode *ocfs2_ilookup_for_vote(struct ocfs2_super *osb, 94struct 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;
334bail: 357bail:
335 mlog_exit(status); 358 mlog_exit(status);
@@ -1131,6 +1154,7 @@ int ocfs2_mark_inode_dirty(struct ocfs2_journal_handle *handle,
1131 1154
1132 spin_lock(&OCFS2_I(inode)->ip_lock); 1155 spin_lock(&OCFS2_I(inode)->ip_lock);
1133 fe->i_clusters = cpu_to_le32(OCFS2_I(inode)->ip_clusters); 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 spin_unlock(&OCFS2_I(inode)->ip_lock); 1158 spin_unlock(&OCFS2_I(inode)->ip_lock);
1135 1159
1136 fe->i_size = cpu_to_le64(i_size_read(inode)); 1160 fe->i_size = cpu_to_le64(i_size_read(inode));
@@ -1169,6 +1193,8 @@ void ocfs2_refresh_inode(struct inode *inode,
1169 spin_lock(&OCFS2_I(inode)->ip_lock); 1193 spin_lock(&OCFS2_I(inode)->ip_lock);
1170 1194
1171 OCFS2_I(inode)->ip_clusters = le32_to_cpu(fe->i_clusters); 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 i_size_write(inode, le64_to_cpu(fe->i_size)); 1198 i_size_write(inode, le64_to_cpu(fe->i_size));
1173 inode->i_nlink = le16_to_cpu(fe->i_links_count); 1199 inode->i_nlink = le16_to_cpu(fe->i_links_count);
1174 inode->i_uid = le32_to_cpu(fe->i_uid); 1200 inode->i_uid = le32_to_cpu(fe->i_uid);