Skip to contentSkip to conversation

I think I find a bug in ext3/dir.c

DISCUSSION guomingyang 2 participants 2 messages Oct 31, 2006 VFS

lore
Share & tools
lore
#0 lore raw

Hello everyone

I think I find a bug in ext3_readdir

if (err > 0) {
			page_cache_readahead(sb->s_bdev->bd_inode->i_mapping,
				&filp->f_ra,
				filp,
				map_bh.b_blocknr >>
					(PAGE_CACHE_SHIFT - inode->i_blkbits),
				1);
			bh = ext3_bread(NULL, inode, blk, 0, &err);
		}

map_bh.b_blocknr is the physical number of a block, but page_cache_readahead need a file-relative block number, am I right?

#1 lore raw
Quoted 13 lines · guomingyang

Hello everyone

I think I find a bug in ext3_readdir

if (err > 0) {
			page_cache_readahead(sb->s_bdev->bd_inode->i_mapping,
				&filp->f_ra,
				filp,
				map_bh.b_blocknr >>
					(PAGE_CACHE_SHIFT - inode->i_blkbits),
				1);
			bh = ext3_bread(NULL, inode, blk, 0, &err);
		}
Quoted 2 lines

map_bh.b_blocknr is the physical number of a block, but page_cache_readahead need a file-relative block number, am I right?

This is true, but the block-device inode, bd_inode, is trivially mapped such that the physical block and the logical block are the same. So it's not a bug. Directories don't have a logical mapping. They use the block device's address space.

Signature · 2 lines
David Kleikamp
IBM Linux Technology Center