Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 21051
b: refs/heads/master
c: 2d7f2ea
h: refs/heads/master
i:
  21049: aa55f78
  21047: b4bb489
v: v3
  • Loading branch information
Al Viro authored and Linus Torvalds committed Mar 16, 2006
1 parent fbb5df2 commit 9197db8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 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: f13b83580acef03a36c785dccc534ccdd7e43084
refs/heads/master: 2d7f2ea9c989853310c7f6e8be52cc090cc8e66b
28 changes: 12 additions & 16 deletions trunk/fs/ext2/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,10 @@ ext2_readdir (struct file * filp, void * dirent, filldir_t filldir)
unsigned long npages = dir_pages(inode);
unsigned chunk_mask = ~(ext2_chunk_size(inode)-1);
unsigned char *types = NULL;
int need_revalidate = (filp->f_version != inode->i_version);
int ret;
int need_revalidate = filp->f_version != inode->i_version;

if (pos > inode->i_size - EXT2_DIR_REC_LEN(1))
goto success;
return 0;

if (EXT2_HAS_INCOMPAT_FEATURE(sb, EXT2_FEATURE_INCOMPAT_FILETYPE))
types = ext2_filetype_table;
Expand All @@ -275,12 +274,15 @@ ext2_readdir (struct file * filp, void * dirent, filldir_t filldir)
"bad page in #%lu",
inode->i_ino);
filp->f_pos += PAGE_CACHE_SIZE - offset;
ret = -EIO;
goto done;
return -EIO;
}
kaddr = page_address(page);
if (need_revalidate) {
offset = ext2_validate_entry(kaddr, offset, chunk_mask);
if (unlikely(need_revalidate)) {
if (offset) {
offset = ext2_validate_entry(kaddr, offset, chunk_mask);
filp->f_pos = (n<<PAGE_CACHE_SHIFT) + offset;
}
filp->f_version = inode->i_version;
need_revalidate = 0;
}
de = (ext2_dirent *)(kaddr+offset);
Expand All @@ -289,9 +291,8 @@ ext2_readdir (struct file * filp, void * dirent, filldir_t filldir)
if (de->rec_len == 0) {
ext2_error(sb, __FUNCTION__,
"zero-length directory entry");
ret = -EIO;
ext2_put_page(page);
goto done;
return -EIO;
}
if (de->inode) {
int over;
Expand All @@ -306,19 +307,14 @@ ext2_readdir (struct file * filp, void * dirent, filldir_t filldir)
le32_to_cpu(de->inode), d_type);
if (over) {
ext2_put_page(page);
goto success;
return 0;
}
}
filp->f_pos += le16_to_cpu(de->rec_len);
}
ext2_put_page(page);
}

success:
ret = 0;
done:
filp->f_version = inode->i_version;
return ret;
return 0;
}

/*
Expand Down

0 comments on commit 9197db8

Please sign in to comment.