aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/inode.c
diff options
context:
space:
mode:
authorMark Fasheh <mark.fasheh@oracle.com>2007-03-22 19:53:23 -0400
committerMark Fasheh <mark.fasheh@oracle.com>2007-04-26 18:07:40 -0400
commit8110b073a9135acf0a71bccfc20c0d1023f179c6 (patch)
treeb668738e25648f3fcfd7b1063ab8d4948cebc668 /fs/ocfs2/inode.c
parent4f902c37727bbedbc0508a1477874c58ddcc9af8 (diff)
ocfs2: Fix up i_blocks calculation to know about holes
Older file systems which didn't support holes did a dumb calculation of i_blocks based on i_size. This is no longer accurate, so fix things up to take actual allocation into account. Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2/inode.c')
-rw-r--r--fs/ocfs2/inode.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index 310049bf7f6b..4bfc98c70137 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -221,6 +221,9 @@ int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe,
221 goto bail; 221 goto bail;
222 } 222 }
223 223
224 OCFS2_I(inode)->ip_clusters = le32_to_cpu(fe->i_clusters);
225 OCFS2_I(inode)->ip_attr = le32_to_cpu(fe->i_attr);
226
224 inode->i_version = 1; 227 inode->i_version = 1;
225 inode->i_generation = le32_to_cpu(fe->i_generation); 228 inode->i_generation = le32_to_cpu(fe->i_generation);
226 inode->i_rdev = huge_decode_dev(le64_to_cpu(fe->id1.dev1.i_rdev)); 229 inode->i_rdev = huge_decode_dev(le64_to_cpu(fe->id1.dev1.i_rdev));
@@ -232,8 +235,7 @@ int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe,
232 if (S_ISLNK(inode->i_mode) && !fe->i_clusters) 235 if (S_ISLNK(inode->i_mode) && !fe->i_clusters)
233 inode->i_blocks = 0; 236 inode->i_blocks = 0;
234 else 237 else
235 inode->i_blocks = 238 inode->i_blocks = ocfs2_inode_sector_count(inode);
236 ocfs2_align_bytes_to_sectors(le64_to_cpu(fe->i_size));
237 inode->i_mapping->a_ops = &ocfs2_aops; 239 inode->i_mapping->a_ops = &ocfs2_aops;
238 inode->i_atime.tv_sec = le64_to_cpu(fe->i_atime); 240 inode->i_atime.tv_sec = le64_to_cpu(fe->i_atime);
239 inode->i_atime.tv_nsec = le32_to_cpu(fe->i_atime_nsec); 241 inode->i_atime.tv_nsec = le32_to_cpu(fe->i_atime_nsec);
@@ -248,9 +250,6 @@ int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe,
248 (unsigned long long)OCFS2_I(inode)->ip_blkno, 250 (unsigned long long)OCFS2_I(inode)->ip_blkno,
249 (unsigned long long)fe->i_blkno); 251 (unsigned long long)fe->i_blkno);
250 252
251 OCFS2_I(inode)->ip_clusters = le32_to_cpu(fe->i_clusters);
252 OCFS2_I(inode)->ip_attr = le32_to_cpu(fe->i_attr);
253
254 inode->i_nlink = le16_to_cpu(fe->i_links_count); 253 inode->i_nlink = le16_to_cpu(fe->i_links_count);
255 254
256 if (fe->i_flags & cpu_to_le32(OCFS2_SYSTEM_FL)) 255 if (fe->i_flags & cpu_to_le32(OCFS2_SYSTEM_FL))
@@ -1243,7 +1242,7 @@ void ocfs2_refresh_inode(struct inode *inode,
1243 if (S_ISLNK(inode->i_mode) && le32_to_cpu(fe->i_clusters) == 0) 1242 if (S_ISLNK(inode->i_mode) && le32_to_cpu(fe->i_clusters) == 0)
1244 inode->i_blocks = 0; 1243 inode->i_blocks = 0;
1245 else 1244 else
1246 inode->i_blocks = ocfs2_align_bytes_to_sectors(i_size_read(inode)); 1245 inode->i_blocks = ocfs2_inode_sector_count(inode);
1247 inode->i_atime.tv_sec = le64_to_cpu(fe->i_atime); 1246 inode->i_atime.tv_sec = le64_to_cpu(fe->i_atime);
1248 inode->i_atime.tv_nsec = le32_to_cpu(fe->i_atime_nsec); 1247 inode->i_atime.tv_nsec = le32_to_cpu(fe->i_atime_nsec);
1249 inode->i_mtime.tv_sec = le64_to_cpu(fe->i_mtime); 1248 inode->i_mtime.tv_sec = le64_to_cpu(fe->i_mtime);