Commit 8e3724ac authored by Stephen Lord's avatar Stephen Lord

[XFS] get version 1 directories back into action

SGI Modid: 2.5.x-xfs:slinx:155149a
parent 450fa027
...@@ -262,7 +262,11 @@ linvfs_readdir( ...@@ -262,7 +262,11 @@ linvfs_readdir(
uio.uio_iov = &iov; uio.uio_iov = &iov;
uio.uio_fmode = filp->f_mode; uio.uio_fmode = filp->f_mode;
uio.uio_segflg = UIO_SYSSPACE; uio.uio_segflg = UIO_SYSSPACE;
curr_offset = uio.uio_offset = filp->f_pos; curr_offset = filp->f_pos;
if (filp->f_pos != 0x7fffffff)
uio.uio_offset = filp->f_pos;
else
uio.uio_offset = 0xffffffff;
while (!eof) { while (!eof) {
uio.uio_resid = iov.iov_len = rlen; uio.uio_resid = iov.iov_len = rlen;
...@@ -283,13 +287,13 @@ linvfs_readdir( ...@@ -283,13 +287,13 @@ linvfs_readdir(
namelen = strlen(dbp->d_name); namelen = strlen(dbp->d_name);
if (filldir(dirent, dbp->d_name, namelen, if (filldir(dirent, dbp->d_name, namelen,
(loff_t) curr_offset, (loff_t) curr_offset & 0x7fffffff,
(ino_t) dbp->d_ino, (ino_t) dbp->d_ino,
DT_UNKNOWN)) { DT_UNKNOWN)) {
goto done; goto done;
} }
size -= dbp->d_reclen; size -= dbp->d_reclen;
curr_offset = (loff_t)dbp->d_off & 0x7fffffff; curr_offset = (loff_t)dbp->d_off /* & 0x7fffffff */;
dbp = nextdp(dbp); dbp = nextdp(dbp);
} }
} }
......
...@@ -64,7 +64,7 @@ struct xfs_trans; ...@@ -64,7 +64,7 @@ struct xfs_trans;
* Offset in data space of a data entry. * Offset in data space of a data entry.
*/ */
typedef __uint32_t xfs_dir2_dataptr_t; typedef __uint32_t xfs_dir2_dataptr_t;
#define XFS_DIR2_MAX_DATAPTR ((xfs_dir2_dataptr_t)0x7fffffff) #define XFS_DIR2_MAX_DATAPTR ((xfs_dir2_dataptr_t)0xffffffff)
#define XFS_DIR2_NULL_DATAPTR ((xfs_dir2_dataptr_t)0) #define XFS_DIR2_NULL_DATAPTR ((xfs_dir2_dataptr_t)0)
/* /*
......
...@@ -560,14 +560,7 @@ xfs_dir_shortform_getdents(xfs_inode_t *dp, uio_t *uio, int *eofp, ...@@ -560,14 +560,7 @@ xfs_dir_shortform_getdents(xfs_inode_t *dp, uio_t *uio, int *eofp,
*/ */
if (sbp->seqno == 0 || sbp == sbuf) if (sbp->seqno == 0 || sbp == sbuf)
lastresid = uio->uio_resid; lastresid = uio->uio_resid;
/* XFS_PUT_COOKIE(p.cook, mp, 0, sbp[1].seqno, sbp[1].hash);
* NOTE! Linux "filldir" semantics require that the
* offset "cookie" be for this entry, not the
* next; all the actual shuffling to make it
* "look right" to the user is done in filldir.
*/
XFS_PUT_COOKIE(p.cook, mp, 0, sbp->seqno, sbp->hash);
#if XFS_BIG_FILESYSTEMS #if XFS_BIG_FILESYSTEMS
p.ino = sbp->ino + mp->m_inoadd; p.ino = sbp->ino + mp->m_inoadd;
#else #else
...@@ -575,9 +568,7 @@ xfs_dir_shortform_getdents(xfs_inode_t *dp, uio_t *uio, int *eofp, ...@@ -575,9 +568,7 @@ xfs_dir_shortform_getdents(xfs_inode_t *dp, uio_t *uio, int *eofp,
#endif #endif
p.name = sbp->name; p.name = sbp->name;
p.namelen = sbp->namelen; p.namelen = sbp->namelen;
retval = p.put(&p); retval = p.put(&p);
if (!p.done) { if (!p.done) {
uio->uio_offset = uio->uio_offset =
XFS_DA_MAKE_COOKIE(mp, 0, 0, sbp->hash); XFS_DA_MAKE_COOKIE(mp, 0, 0, sbp->hash);
...@@ -586,20 +577,12 @@ xfs_dir_shortform_getdents(xfs_inode_t *dp, uio_t *uio, int *eofp, ...@@ -586,20 +577,12 @@ xfs_dir_shortform_getdents(xfs_inode_t *dp, uio_t *uio, int *eofp,
xfs_dir_trace_g_du("sf: E-O-B", dp, uio); xfs_dir_trace_g_du("sf: E-O-B", dp, uio);
return retval; return retval;
} }
sbp++; sbp++;
} }
kmem_free(sbuf, sbsize); kmem_free(sbuf, sbsize);
XFS_PUT_COOKIE(p.cook, mp, 0, 0, XFS_DA_MAXHASH);
uio->uio_offset = p.cook.o; uio->uio_offset = p.cook.o;
*eofp = 1; *eofp = 1;
xfs_dir_trace_g_du("sf: E-O-F", dp, uio); xfs_dir_trace_g_du("sf: E-O-F", dp, uio);
return 0; return 0;
} }
...@@ -2070,16 +2053,6 @@ xfs_dir_leaf_getdents_int( ...@@ -2070,16 +2053,6 @@ xfs_dir_leaf_getdents_int(
return XFS_ERROR(EFSCORRUPTED); return XFS_ERROR(EFSCORRUPTED);
} }
thishash = INT_GET(entry->hashval, ARCH_CONVERT);
/*
* NOTE! Linux "filldir" semantics require that the
* offset "cookie" be for this entry, not the
* next; all the actual shuffling to make it
* "look right" to the user is done in filldir.
*/
XFS_PUT_COOKIE(p.cook, mp, bno, entno, thishash);
xfs_dir_trace_g_duc("leaf: middle cookie ", xfs_dir_trace_g_duc("leaf: middle cookie ",
dp, uio, p.cook.o); dp, uio, p.cook.o);
...@@ -2090,17 +2063,19 @@ xfs_dir_leaf_getdents_int( ...@@ -2090,17 +2063,19 @@ xfs_dir_leaf_getdents_int(
nextentno = entno + 1; nextentno = entno + 1;
else else
nextentno = 0; nextentno = 0;
XFS_PUT_COOKIE(p.cook, mp, bno, nextentno, nexthash);
xfs_dir_trace_g_duc("leaf: middle cookie ",
dp, uio, p.cook.o);
} else if (INT_GET(leaf->hdr.info.forw, ARCH_CONVERT)) { } else if ((thishash = INT_GET(leaf->hdr.info.forw,
ARCH_CONVERT))) {
xfs_dabuf_t *bp2; xfs_dabuf_t *bp2;
xfs_dir_leafblock_t *leaf2; xfs_dir_leafblock_t *leaf2;
ASSERT(nextda != -1); ASSERT(nextda != -1);
retval = xfs_da_read_buf(dp->i_transp, dp, retval = xfs_da_read_buf(dp->i_transp, dp, thishash,
INT_GET(leaf->hdr.info.forw, nextda, &bp2, XFS_DATA_FORK);
ARCH_CONVERT), nextda,
&bp2, XFS_DATA_FORK);
if (retval) if (retval)
return(retval); return(retval);
...@@ -2124,13 +2099,13 @@ xfs_dir_leaf_getdents_int( ...@@ -2124,13 +2099,13 @@ xfs_dir_leaf_getdents_int(
nexthash = INT_GET(leaf2->entries[0].hashval, nexthash = INT_GET(leaf2->entries[0].hashval,
ARCH_CONVERT); ARCH_CONVERT);
nextentno = -1; nextentno = -1;
XFS_PUT_COOKIE(p.cook, mp, thishash, 0, nexthash);
xfs_da_brelse(dp->i_transp, bp2); xfs_da_brelse(dp->i_transp, bp2);
xfs_dir_trace_g_duc("leaf: next blk cookie", xfs_dir_trace_g_duc("leaf: next blk cookie",
dp, uio, p.cook.o); dp, uio, p.cook.o);
} else { } else {
nextentno = -1; nextentno = -1;
nexthash = XFS_DA_MAXHASH; XFS_PUT_COOKIE(p.cook, mp, 0, 0, XFS_DA_MAXHASH);
} }
/* /*
...@@ -2147,7 +2122,8 @@ xfs_dir_leaf_getdents_int( ...@@ -2147,7 +2122,8 @@ xfs_dir_leaf_getdents_int(
* provided is big enough to handle it (see pv763517). * provided is big enough to handle it (see pv763517).
*/ */
#if (BITS_PER_LONG == 32) #if (BITS_PER_LONG == 32)
if (INT_GET(entry->hashval, ARCH_CONVERT) != lasthash) { if ((thishash = INT_GET(entry->hashval, ARCH_CONVERT))
!= lasthash) {
XFS_PUT_COOKIE(lastoffset, mp, bno, entno, thishash); XFS_PUT_COOKIE(lastoffset, mp, bno, entno, thishash);
lastresid = uio->uio_resid; lastresid = uio->uio_resid;
lasthash = thishash; lasthash = thishash;
...@@ -2156,6 +2132,7 @@ xfs_dir_leaf_getdents_int( ...@@ -2156,6 +2132,7 @@ xfs_dir_leaf_getdents_int(
dp, uio, p.cook.o); dp, uio, p.cook.o);
} }
#else #else
lasthash = thishash = INT_GET(entry->hashval, ARCH_CONVERT);
XFS_PUT_COOKIE(lastoffset, mp, bno, entno, thishash); XFS_PUT_COOKIE(lastoffset, mp, bno, entno, thishash);
lastresid = uio->uio_resid; lastresid = uio->uio_resid;
#endif /* BITS_PER_LONG == 32 */ #endif /* BITS_PER_LONG == 32 */
...@@ -2187,8 +2164,6 @@ xfs_dir_leaf_getdents_int( ...@@ -2187,8 +2164,6 @@ xfs_dir_leaf_getdents_int(
} }
} }
XFS_PUT_COOKIE(p.cook, mp, 0, 0, nexthash);
uio->uio_offset = p.cook.o; uio->uio_offset = p.cook.o;
*eobp = 0; *eobp = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment