patch-2.4.6 linux/fs/freevxfs/vxfs_lookup.c

Next file: linux/fs/freevxfs/vxfs_super.c
Previous file: linux/fs/freevxfs/vxfs_inode.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.5/linux/fs/freevxfs/vxfs_lookup.c linux/fs/freevxfs/vxfs_lookup.c
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 
-#ident "$Id: vxfs_lookup.c,v 1.17 2001/05/21 15:23:53 hch Exp hch $"
+#ident "$Id: vxfs_lookup.c,v 1.19 2001/05/30 19:50:20 hch Exp hch $"
 
 /*
  * Veritas filesystem driver - lookup and other directory related code.
@@ -240,9 +240,8 @@
 	struct inode		*ip = fp->f_dentry->d_inode;
 	struct super_block	*sbp = ip->i_sb;
 	u_long			bsize = sbp->s_blocksize;
-	u_long			page, npages, block, nblocks, offset;
+	u_long			page, npages, block, pblocks, nblocks, offset;
 	loff_t			pos;
-	int			pblocks;
 
 	switch ((long)fp->f_pos) {
 	case 0:
@@ -262,14 +261,14 @@
 	if (pos > VXFS_DIRROUND(ip->i_size))
 		return 0;
 
-	page = pos >> PAGE_CACHE_SHIFT;
-	offset = pos & ~PAGE_CACHE_MASK;
-	block = pos >> sbp->s_blocksize_bits;
-
 	npages = dir_pages(ip);
 	nblocks = dir_blocks(ip);
 	pblocks = VXFS_BLOCK_PER_PAGE(sbp);
 
+	page = pos >> PAGE_CACHE_SHIFT;
+	offset = pos & ~PAGE_CACHE_MASK;
+	block = (u_long)(pos >> sbp->s_blocksize_bits) % pblocks;
+
 	for (; page < npages; page++, block = 0) {
 		caddr_t			kaddr;
 		struct page		*pp;
@@ -310,6 +309,7 @@
 					goto done;
 				}
 			}
+			offset = 0;
 		}
 		vxfs_put_page(pp);
 		offset = 0;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)