Commit 511308d9 authored by Joel Becker's avatar Joel Becker Committed by Mark Fasheh

ocfs2: Convert ocfs2_read_dir_block() to ocfs2_read_virt_blocks()

Now that we've centralized the ocfs2_read_virt_blocks() code, let's use
it in ocfs2_read_dir_block().
Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
parent a8549fb5
...@@ -231,44 +231,16 @@ static int ocfs2_read_dir_block(struct inode *inode, u64 v_block, ...@@ -231,44 +231,16 @@ static int ocfs2_read_dir_block(struct inode *inode, u64 v_block,
{ {
int rc = 0; int rc = 0;
struct buffer_head *tmp = *bh; struct buffer_head *tmp = *bh;
u64 p_blkno;
if (((u64)v_block << inode->i_sb->s_blocksize_bits) >= rc = ocfs2_read_virt_blocks(inode, v_block, 1, &tmp, flags,
i_size_read(inode)) { ocfs2_validate_dir_block);
BUG_ON(!(flags & OCFS2_BH_READAHEAD)); if (rc)
goto out;
}
down_read(&OCFS2_I(inode)->ip_alloc_sem);
rc = ocfs2_extent_map_get_blocks(inode, v_block, &p_blkno, NULL,
NULL);
up_read(&OCFS2_I(inode)->ip_alloc_sem);
if (rc) {
mlog_errno(rc); mlog_errno(rc);
goto out;
}
if (!p_blkno) { /* If ocfs2_read_virt_blocks() got us a new bh, pass it up. */
rc = -EIO; if (!rc && !*bh)
mlog(ML_ERROR,
"Directory #%llu contains a hole at offset %llu\n",
(unsigned long long)OCFS2_I(inode)->ip_blkno,
(unsigned long long)v_block << inode->i_sb->s_blocksize_bits);
goto out;
}
rc = ocfs2_read_blocks(inode, p_blkno, 1, &tmp, flags,
ocfs2_validate_dir_block);
if (rc) {
mlog_errno(rc);
goto out;
}
/* If ocfs2_read_blocks() got us a new bh, pass it up. */
if (!*bh)
*bh = tmp; *bh = tmp;
out:
return rc ? -EIO : 0; return rc ? -EIO : 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment