aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/dir.c
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2008-11-13 17:49:21 -0500
committerMark Fasheh <mfasheh@suse.com>2009-01-05 11:36:55 -0500
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 7e863d40380d..d83cff95759e 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,
231{ 231{
232 int rc = 0; 232 int rc = 0;
233 struct buffer_head *tmp = *bh; 233 struct buffer_head *tmp = *bh;
234 u64 p_blkno;
235 234
236 if (((u64)v_block << inode->i_sb->s_blocksize_bits) >= 235 rc = ocfs2_read_virt_blocks(inode, v_block, 1, &tmp, flags,
237 i_size_read(inode)) { 236 ocfs2_validate_dir_block);
238 BUG_ON(!(flags & OCFS2_BH_READAHEAD)); 237 if (rc)
239 goto out;
240 }
241
242 down_read(&OCFS2_I(inode)->ip_alloc_sem);
243 rc = ocfs2_extent_map_get_blocks(inode, v_block, &p_blkno, NULL,
244 NULL);
245 up_read(&OCFS2_I(inode)->ip_alloc_sem);
246 if (rc) {
247 mlog_errno(rc); 238 mlog_errno(rc);
248 goto out;
249 }
250 239
251 if (!p_blkno) { 240 /* If ocfs2_read_virt_blocks() got us a new bh, pass it up. */
252 rc = -EIO; 241 if (!rc && !*bh)
253 mlog(ML_ERROR,
254 "Directory #%llu contains a hole at offset %llu\n",
255 (unsigned long long)OCFS2_I(inode)->ip_blkno,
256 (unsigned long long)v_block << inode->i_sb->s_blocksize_bits);
257 goto out;
258 }
259
260 rc = ocfs2_read_blocks(inode, p_blkno, 1, &tmp, flags,
261 ocfs2_validate_dir_block);
262 if (rc) {
263 mlog_errno(rc);
264 goto out;
265 }
266
267 /* If ocfs2_read_blocks() got us a new bh, pass it up. */
268 if (!*bh)
269 *bh = tmp; 242 *bh = tmp;
270 243
271out:
272 return rc ? -EIO : 0; 244 return rc ? -EIO : 0;
273} 245}
274 246