summaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/inode.h
diff options
context:
space:
mode:
authorMark Fasheh2007-03-23 00:53:23 +0100
committerMark Fasheh2007-04-27 00:07:40 +0200
commit8110b073a9135acf0a71bccfc20c0d1023f179c6 (patch)
treeb668738e25648f3fcfd7b1063ab8d4948cebc668 /fs/ocfs2/inode.h
parentocfs2: Fix extent lookup to return true size of holes (diff)
downloadkernel-qcow2-linux-8110b073a9135acf0a71bccfc20c0d1023f179c6.tar.gz
kernel-qcow2-linux-8110b073a9135acf0a71bccfc20c0d1023f179c6.tar.xz
kernel-qcow2-linux-8110b073a9135acf0a71bccfc20c0d1023f179c6.zip
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.h')
-rw-r--r--fs/ocfs2/inode.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/ocfs2/inode.h b/fs/ocfs2/inode.h
index a9ced009cb9c..aa84353d0d19 100644
--- a/fs/ocfs2/inode.h
+++ b/fs/ocfs2/inode.h
@@ -138,4 +138,11 @@ int ocfs2_aio_write(struct file *file, struct kiocb *req, struct iocb *iocb);
void ocfs2_set_inode_flags(struct inode *inode);
+static inline blkcnt_t ocfs2_inode_sector_count(struct inode *inode)
+{
+ int c_to_s_bits = OCFS2_SB(inode->i_sb)->s_clustersize_bits - 9;
+
+ return (blkcnt_t)(OCFS2_I(inode)->ip_clusters << c_to_s_bits);
+}
+
#endif /* OCFS2_INODE_H */