aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ocfs2/inode.c')
-rw-r--r--fs/ocfs2/inode.c35
1 files changed, 29 insertions, 6 deletions
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index 21a605079c62..bc844bfe607c 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -89,6 +89,25 @@ void ocfs2_set_inode_flags(struct inode *inode)
89 inode->i_flags |= S_DIRSYNC; 89 inode->i_flags |= S_DIRSYNC;
90} 90}
91 91
92/* Propagate flags from i_flags to OCFS2_I(inode)->ip_attr */
93void ocfs2_get_inode_flags(struct ocfs2_inode_info *oi)
94{
95 unsigned int flags = oi->vfs_inode.i_flags;
96
97 oi->ip_attr &= ~(OCFS2_SYNC_FL|OCFS2_APPEND_FL|
98 OCFS2_IMMUTABLE_FL|OCFS2_NOATIME_FL|OCFS2_DIRSYNC_FL);
99 if (flags & S_SYNC)
100 oi->ip_attr |= OCFS2_SYNC_FL;
101 if (flags & S_APPEND)
102 oi->ip_attr |= OCFS2_APPEND_FL;
103 if (flags & S_IMMUTABLE)
104 oi->ip_attr |= OCFS2_IMMUTABLE_FL;
105 if (flags & S_NOATIME)
106 oi->ip_attr |= OCFS2_NOATIME_FL;
107 if (flags & S_DIRSYNC)
108 oi->ip_attr |= OCFS2_DIRSYNC_FL;
109}
110
92struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 blkno, int flags) 111struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 blkno, int flags)
93{ 112{
94 struct inode *inode = NULL; 113 struct inode *inode = NULL;
@@ -196,7 +215,7 @@ int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe,
196 int status = -EINVAL; 215 int status = -EINVAL;
197 216
198 mlog_entry("(0x%p, size:%llu)\n", inode, 217 mlog_entry("(0x%p, size:%llu)\n", inode,
199 (unsigned long long)fe->i_size); 218 (unsigned long long)le64_to_cpu(fe->i_size));
200 219
201 sb = inode->i_sb; 220 sb = inode->i_sb;
202 osb = OCFS2_SB(sb); 221 osb = OCFS2_SB(sb);
@@ -248,7 +267,7 @@ int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe,
248 mlog(ML_ERROR, 267 mlog(ML_ERROR,
249 "ip_blkno %llu != i_blkno %llu!\n", 268 "ip_blkno %llu != i_blkno %llu!\n",
250 (unsigned long long)OCFS2_I(inode)->ip_blkno, 269 (unsigned long long)OCFS2_I(inode)->ip_blkno,
251 (unsigned long long)fe->i_blkno); 270 (unsigned long long)le64_to_cpu(fe->i_blkno));
252 271
253 inode->i_nlink = le16_to_cpu(fe->i_links_count); 272 inode->i_nlink = le16_to_cpu(fe->i_links_count);
254 273
@@ -301,7 +320,7 @@ int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe,
301 * the generation argument to 320 * the generation argument to
302 * ocfs2_inode_lock_res_init() will have to change. 321 * ocfs2_inode_lock_res_init() will have to change.
303 */ 322 */
304 BUG_ON(fe->i_flags & cpu_to_le32(OCFS2_SYSTEM_FL)); 323 BUG_ON(le32_to_cpu(fe->i_flags) & OCFS2_SYSTEM_FL);
305 324
306 ocfs2_inode_lock_res_init(&OCFS2_I(inode)->ip_meta_lockres, 325 ocfs2_inode_lock_res_init(&OCFS2_I(inode)->ip_meta_lockres,
307 OCFS2_LOCK_TYPE_META, 0, inode); 326 OCFS2_LOCK_TYPE_META, 0, inode);
@@ -437,7 +456,8 @@ static int ocfs2_read_locked_inode(struct inode *inode,
437 fe = (struct ocfs2_dinode *) bh->b_data; 456 fe = (struct ocfs2_dinode *) bh->b_data;
438 if (!OCFS2_IS_VALID_DINODE(fe)) { 457 if (!OCFS2_IS_VALID_DINODE(fe)) {
439 mlog(ML_ERROR, "Invalid dinode #%llu: signature = %.*s\n", 458 mlog(ML_ERROR, "Invalid dinode #%llu: signature = %.*s\n",
440 (unsigned long long)fe->i_blkno, 7, fe->i_signature); 459 (unsigned long long)le64_to_cpu(fe->i_blkno), 7,
460 fe->i_signature);
441 goto bail; 461 goto bail;
442 } 462 }
443 463
@@ -812,8 +832,8 @@ static int ocfs2_query_inode_wipe(struct inode *inode,
812 "Inode %llu (on-disk %llu) not orphaned! " 832 "Inode %llu (on-disk %llu) not orphaned! "
813 "Disk flags 0x%x, inode flags 0x%x\n", 833 "Disk flags 0x%x, inode flags 0x%x\n",
814 (unsigned long long)oi->ip_blkno, 834 (unsigned long long)oi->ip_blkno,
815 (unsigned long long)di->i_blkno, di->i_flags, 835 (unsigned long long)le64_to_cpu(di->i_blkno),
816 oi->ip_flags); 836 le32_to_cpu(di->i_flags), oi->ip_flags);
817 goto bail; 837 goto bail;
818 } 838 }
819 839
@@ -1106,8 +1126,10 @@ struct buffer_head *ocfs2_bread(struct inode *inode,
1106 return NULL; 1126 return NULL;
1107 } 1127 }
1108 1128
1129 down_read(&OCFS2_I(inode)->ip_alloc_sem);
1109 tmperr = ocfs2_extent_map_get_blocks(inode, block, &p_blkno, NULL, 1130 tmperr = ocfs2_extent_map_get_blocks(inode, block, &p_blkno, NULL,
1110 NULL); 1131 NULL);
1132 up_read(&OCFS2_I(inode)->ip_alloc_sem);
1111 if (tmperr < 0) { 1133 if (tmperr < 0) {
1112 mlog_errno(tmperr); 1134 mlog_errno(tmperr);
1113 goto fail; 1135 goto fail;
@@ -1197,6 +1219,7 @@ int ocfs2_mark_inode_dirty(handle_t *handle,
1197 1219
1198 spin_lock(&OCFS2_I(inode)->ip_lock); 1220 spin_lock(&OCFS2_I(inode)->ip_lock);
1199 fe->i_clusters = cpu_to_le32(OCFS2_I(inode)->ip_clusters); 1221 fe->i_clusters = cpu_to_le32(OCFS2_I(inode)->ip_clusters);
1222 ocfs2_get_inode_flags(OCFS2_I(inode));
1200 fe->i_attr = cpu_to_le32(OCFS2_I(inode)->ip_attr); 1223 fe->i_attr = cpu_to_le32(OCFS2_I(inode)->ip_attr);
1201 spin_unlock(&OCFS2_I(inode)->ip_lock); 1224 spin_unlock(&OCFS2_I(inode)->ip_lock);
1202 1225