aboutsummaryrefslogtreecommitdiff
path: root/fs/ocfs2/dir.c
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2008-11-13 14:49:21 -0800
committerMark Fasheh <mfasheh@suse.com>2009-01-05 08:36:55 -0800
commit511308d90b53479b194cd067715f44dc99d39b08 (patch)
tree7f8597ce83fe6543871fab3df4c4a21b11875ea4 /fs/ocfs2/dir.c
parenta8549fb5abb2b372e46d5de0d23ff8b24f4a61af (diff)
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: Joel Becker <joel.becker@oracle.com> Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2/dir.c')
-rw-r--r--fs/ocfs2/dir.c38
1 files changed, 5 insertions, 33 deletions
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c
index 7e863d40380..d83cff95759 100644
--- a/fs/ocfs2/dir.c
+++ b/fs/ocfs2/dir.c
@@ -231,44 +231,16 @@ static int ocfs2_read_dir_block(struct inode *inode, u64 v_block,
{
int rc = 0;
struct buffer_head *tmp = *bh;
- u64 p_blkno;
- if (((u64)v_block << inode->i_sb->s_blocksize_bits) >=
- i_size_read(inode)) {
- BUG_ON(!(flags & OCFS2_BH_READAHEAD));
- 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) {
+ rc = ocfs2_read_virt_blocks(inode, v_block, 1, &tmp, flags,
+ ocfs2_validate_dir_block);
+ if (rc)
mlog_errno(rc);
- goto out;
- }
- if (!p_blkno) {
- rc = -EIO;
- 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)
+ /* If ocfs2_read_virt_blocks() got us a new bh, pass it up. */
+ if (!rc && !*bh)
*bh = tmp;
-out:
return rc ? -EIO : 0;
}