Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 23027
b: refs/heads/master
c: d8733c2
h: refs/heads/master
i:
  23025: cafc995
  23023: a946e18
v: v3
  • Loading branch information
Andrew Morton authored and Linus Torvalds committed Mar 23, 2006
1 parent 03191b0 commit 8cc4153
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b8e31edc10d160a8bf2159541d9d12f2079a0887
refs/heads/master: d8733c2956968a01394a4d2a9e97a8b431a78776
52 changes: 24 additions & 28 deletions trunk/fs/ext3/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,10 @@ static int ext3_readdir(struct file * filp,
void * dirent, filldir_t filldir)
{
int error = 0;
unsigned long offset, blk;
int i, num, stored;
struct buffer_head * bh, * tmp, * bha[16];
struct ext3_dir_entry_2 * de;
struct super_block * sb;
unsigned long offset;
int i, stored;
struct ext3_dir_entry_2 *de;
struct super_block *sb;
int err;
struct inode *inode = filp->f_dentry->d_inode;
int ret = 0;
Expand All @@ -124,12 +123,29 @@ static int ext3_readdir(struct file * filp,
}
#endif
stored = 0;
bh = NULL;
offset = filp->f_pos & (sb->s_blocksize - 1);

while (!error && !stored && filp->f_pos < inode->i_size) {
blk = (filp->f_pos) >> EXT3_BLOCK_SIZE_BITS(sb);
bh = ext3_bread(NULL, inode, blk, 0, &err);
unsigned long blk = filp->f_pos >> EXT3_BLOCK_SIZE_BITS(sb);
struct buffer_head map_bh;
struct buffer_head *bh = NULL;

map_bh.b_state = 0;
err = ext3_get_block_handle(NULL, inode, blk, &map_bh, 0, 0);
if (!err) {
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);
}

/*
* We ignore I/O errors on directories so users have a chance
* of recovering data when there's a bad sector
*/
if (!bh) {
ext3_error (sb, "ext3_readdir",
"directory #%lu contains a hole at offset %lu",
Expand All @@ -138,26 +154,6 @@ static int ext3_readdir(struct file * filp,
continue;
}

/*
* Do the readahead
*/
if (!offset) {
for (i = 16 >> (EXT3_BLOCK_SIZE_BITS(sb) - 9), num = 0;
i > 0; i--) {
tmp = ext3_getblk (NULL, inode, ++blk, 0, &err);
if (tmp && !buffer_uptodate(tmp) &&
!buffer_locked(tmp))
bha[num++] = tmp;
else
brelse (tmp);
}
if (num) {
ll_rw_block (READA, num, bha);
for (i = 0; i < num; i++)
brelse (bha[i]);
}
}

revalidate:
/* If the dir block has changed since the last call to
* readdir(2), then we might be pointing to an invalid
Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/ext3/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ static int ext3_splice_branch(handle_t *handle, struct inode *inode, long block,
* The BKL may not be held on entry here. Be sure to take it early.
*/

static int
int
ext3_get_block_handle(handle_t *handle, struct inode *inode, sector_t iblock,
struct buffer_head *bh_result, int create, int extend_disksize)
{
Expand Down
9 changes: 6 additions & 3 deletions trunk/include/linux/ext3_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -772,9 +772,12 @@ extern unsigned long ext3_count_free (struct buffer_head *, unsigned);


/* inode.c */
extern int ext3_forget(handle_t *, int, struct inode *, struct buffer_head *, int);
extern struct buffer_head * ext3_getblk (handle_t *, struct inode *, long, int, int *);
extern struct buffer_head * ext3_bread (handle_t *, struct inode *, int, int, int *);
int ext3_forget(handle_t *, int, struct inode *, struct buffer_head *, int);
struct buffer_head * ext3_getblk (handle_t *, struct inode *, long, int, int *);
struct buffer_head * ext3_bread (handle_t *, struct inode *, int, int, int *);
int ext3_get_block_handle(handle_t *handle, struct inode *inode,
sector_t iblock, struct buffer_head *bh_result, int create,
int extend_disksize);

extern void ext3_read_inode (struct inode *);
extern int ext3_write_inode (struct inode *, int);
Expand Down
1 change: 1 addition & 0 deletions trunk/mm/readahead.c
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ page_cache_readahead(struct address_space *mapping, struct file_ra_state *ra,
out:
return ra->prev_page + 1;
}
EXPORT_SYMBOL_GPL(page_cache_readahead);

/*
* handle_ra_miss() is called when it is known that a page which should have
Expand Down

0 comments on commit 8cc4153

Please sign in to comment.