diff options
author | Mark Fasheh <mark.fasheh@oracle.com> | 2007-03-22 16:53:23 -0700 |
---|---|---|
committer | Mark Fasheh <mark.fasheh@oracle.com> | 2007-04-26 15:07:40 -0700 |
commit | 8110b073a9135acf0a71bccfc20c0d1023f179c6 (patch) | |
tree | b668738e25648f3fcfd7b1063ab8d4948cebc668 /fs/ocfs2/journal.c | |
parent | 4f902c37727bbedbc0508a1477874c58ddcc9af8 (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/journal.c')
-rw-r--r-- | fs/ocfs2/journal.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index 12d2340eee2..5a8a90d1c78 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c @@ -650,25 +650,17 @@ static int ocfs2_force_read_journal(struct inode *inode) { int status = 0; int i; - u64 v_blkno, p_blkno, p_blocks; + u64 v_blkno, p_blkno, p_blocks, num_blocks; #define CONCURRENT_JOURNAL_FILL 32ULL struct buffer_head *bhs[CONCURRENT_JOURNAL_FILL]; mlog_entry_void(); - BUG_ON(inode->i_blocks != - ocfs2_align_bytes_to_sectors(i_size_read(inode))); - memset(bhs, 0, sizeof(struct buffer_head *) * CONCURRENT_JOURNAL_FILL); - mlog(0, "Force reading %llu blocks\n", - (unsigned long long)(inode->i_blocks >> - (inode->i_sb->s_blocksize_bits - 9))); - + num_blocks = ocfs2_blocks_for_bytes(inode->i_sb, inode->i_size); v_blkno = 0; - while (v_blkno < - (inode->i_blocks >> (inode->i_sb->s_blocksize_bits - 9))) { - + while (v_blkno < num_blocks) { status = ocfs2_extent_map_get_blocks(inode, v_blkno, &p_blkno, &p_blocks, NULL); if (status < 0) { |