Commit a514c6ff authored by Stephen Lord's avatar Stephen Lord

Merge ssh://lord@kernel.bkbits.net/xfs-2.6

into jen.americas.sgi.com:/src/lord/bitkeeper/xfs-2.6
parents 5f65098e 919b8be6
...@@ -2307,7 +2307,7 @@ S: Maintained ...@@ -2307,7 +2307,7 @@ S: Maintained
XFS FILESYSTEM XFS FILESYSTEM
P: Silicon Graphics Inc P: Silicon Graphics Inc
M: owner-xfs@oss.sgi.com M: owner-xfs@oss.sgi.com
M: lord@sgi.com M: nathans@sgi.com
L: linux-xfs@oss.sgi.com L: linux-xfs@oss.sgi.com
W: http://oss.sgi.com/projects/xfs W: http://oss.sgi.com/projects/xfs
S: Supported S: Supported
......
...@@ -226,8 +226,8 @@ xfs_vget_fsop_handlereq( ...@@ -226,8 +226,8 @@ xfs_vget_fsop_handlereq(
xfs_inode_t *ip; xfs_inode_t *ip;
struct inode *inodep; struct inode *inodep;
vnode_t *vpp; vnode_t *vpp;
xfs_ino_t ino;
__u32 igen; __u32 igen;
ino_t ino;
int error; int error;
if (!capable(cap)) if (!capable(cap))
......
...@@ -40,11 +40,7 @@ ...@@ -40,11 +40,7 @@
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software * 3. Neither the name of the University nor the names of its contributors
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software * may be used to endorse or promote products derived from this software
* without specific prior written permission. * without specific prior written permission.
* *
......
...@@ -40,11 +40,7 @@ ...@@ -40,11 +40,7 @@
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution. * documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software * 3. Neither the name of the University nor the names of its contributors
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software * may be used to endorse or promote products derived from this software
* without specific prior written permission. * without specific prior written permission.
* *
...@@ -73,11 +69,11 @@ enum uio_seg { ...@@ -73,11 +69,11 @@ enum uio_seg {
}; };
struct uio { struct uio {
struct iovec *uio_iov; struct iovec *uio_iov; /* pointer to array of iovecs */
int uio_iovcnt; int uio_iovcnt; /* number of iovecs in array */
xfs_off_t uio_offset; xfs_off_t uio_offset; /* offset in file this uio corresponds to */
int uio_resid; int uio_resid; /* residual i/o count */
enum uio_seg uio_segflg; enum uio_seg uio_segflg; /* see above */
}; };
typedef struct uio uio_t; typedef struct uio uio_t;
......
...@@ -1371,9 +1371,6 @@ xfs_dir2_node_addname_int( ...@@ -1371,9 +1371,6 @@ xfs_dir2_node_addname_int(
xfs_dir2_db_t fbno; /* freespace block number */ xfs_dir2_db_t fbno; /* freespace block number */
xfs_dabuf_t *fbp; /* freespace buffer */ xfs_dabuf_t *fbp; /* freespace buffer */
int findex; /* freespace entry index */ int findex; /* freespace entry index */
xfs_dir2_db_t foundbno=0; /* found freespace block no */
int foundindex=0; /* found freespace entry idx */
int foundhole; /* found hole in freespace */
xfs_dir2_free_t *free=NULL; /* freespace block structure */ xfs_dir2_free_t *free=NULL; /* freespace block structure */
xfs_dir2_db_t ifbno; /* initial freespace block no */ xfs_dir2_db_t ifbno; /* initial freespace block no */
xfs_dir2_db_t lastfbno=0; /* highest freespace block no */ xfs_dir2_db_t lastfbno=0; /* highest freespace block no */
...@@ -1382,7 +1379,6 @@ xfs_dir2_node_addname_int( ...@@ -1382,7 +1379,6 @@ xfs_dir2_node_addname_int(
xfs_mount_t *mp; /* filesystem mount point */ xfs_mount_t *mp; /* filesystem mount point */
int needlog; /* need to log data header */ int needlog; /* need to log data header */
int needscan; /* need to rescan data frees */ int needscan; /* need to rescan data frees */
int needfreesp; /* need to allocate freesp blk */
xfs_dir2_data_off_t *tagp; /* data entry tag pointer */ xfs_dir2_data_off_t *tagp; /* data entry tag pointer */
xfs_trans_t *tp; /* transaction pointer */ xfs_trans_t *tp; /* transaction pointer */
...@@ -1390,7 +1386,6 @@ xfs_dir2_node_addname_int( ...@@ -1390,7 +1386,6 @@ xfs_dir2_node_addname_int(
mp = dp->i_mount; mp = dp->i_mount;
tp = args->trans; tp = args->trans;
length = XFS_DIR2_DATA_ENTSIZE(args->namelen); length = XFS_DIR2_DATA_ENTSIZE(args->namelen);
foundhole = 0;
/* /*
* If we came in with a freespace block that means that lookup * If we came in with a freespace block that means that lookup
* found an entry with our hash value. This is the freespace * found an entry with our hash value. This is the freespace
...@@ -1445,7 +1440,6 @@ xfs_dir2_node_addname_int( ...@@ -1445,7 +1440,6 @@ xfs_dir2_node_addname_int(
return error; return error;
lastfbno = XFS_DIR2_DA_TO_DB(mp, (xfs_dablk_t)fo); lastfbno = XFS_DIR2_DA_TO_DB(mp, (xfs_dablk_t)fo);
fbno = ifbno; fbno = ifbno;
foundindex = -1;
} }
/* /*
* While we haven't identified a data block, search the freeblock * While we haven't identified a data block, search the freeblock
...@@ -1485,7 +1479,6 @@ xfs_dir2_node_addname_int( ...@@ -1485,7 +1479,6 @@ xfs_dir2_node_addname_int(
return error; return error;
} }
if (unlikely(fbp == NULL)) { if (unlikely(fbp == NULL)) {
foundhole = 1;
continue; continue;
} }
free = fbp->data; free = fbp->data;
...@@ -1499,30 +1492,10 @@ xfs_dir2_node_addname_int( ...@@ -1499,30 +1492,10 @@ xfs_dir2_node_addname_int(
INT_GET(free->bests[findex], ARCH_CONVERT) >= length) INT_GET(free->bests[findex], ARCH_CONVERT) >= length)
dbno = INT_GET(free->hdr.firstdb, ARCH_CONVERT) + findex; dbno = INT_GET(free->hdr.firstdb, ARCH_CONVERT) + findex;
else { else {
/*
* If we haven't found an empty entry yet, and this
* one is empty, remember this slot.
*/
if (foundindex == -1 &&
INT_GET(free->bests[findex], ARCH_CONVERT) == NULLDATAOFF && !foundhole) {
foundindex = findex;
foundbno = fbno;
}
/* /*
* Are we done with the freeblock? * Are we done with the freeblock?
*/ */
if (++findex == INT_GET(free->hdr.nvalid, ARCH_CONVERT)) { if (++findex == INT_GET(free->hdr.nvalid, ARCH_CONVERT)) {
/*
* If there is space left in this freeblock,
* and we don't have an empty entry yet,
* remember this slot.
*/
if (foundindex == -1 &&
findex < XFS_DIR2_MAX_FREE_BESTS(mp) &&
!foundhole) {
foundindex = findex;
foundbno = fbno;
}
/* /*
* Drop the block. * Drop the block.
*/ */
...@@ -1553,9 +1526,10 @@ xfs_dir2_node_addname_int( ...@@ -1553,9 +1526,10 @@ xfs_dir2_node_addname_int(
/* /*
* Allocate and initialize the new data block. * Allocate and initialize the new data block.
*/ */
if ((error = xfs_dir2_grow_inode(args, XFS_DIR2_DATA_SPACE, if (unlikely((error = xfs_dir2_grow_inode(args,
XFS_DIR2_DATA_SPACE,
&dbno)) || &dbno)) ||
(error = xfs_dir2_data_init(args, dbno, &dbp))) { (error = xfs_dir2_data_init(args, dbno, &dbp)))) {
/* /*
* Drop the freespace buffer unless it came from our * Drop the freespace buffer unless it came from our
* caller. * caller.
...@@ -1565,55 +1539,55 @@ xfs_dir2_node_addname_int( ...@@ -1565,55 +1539,55 @@ xfs_dir2_node_addname_int(
return error; return error;
} }
/* /*
* If the freespace entry for this data block is not in the * If (somehow) we have a freespace block, get rid of it.
* freespace block we have in hand, drop the one we have
* and get the right one.
*/ */
needfreesp = 0;
if (XFS_DIR2_DB_TO_FDB(mp, dbno) != fbno || fbp == NULL) {
if (fbp) if (fbp)
xfs_da_brelse(tp, fbp); xfs_da_brelse(tp, fbp);
if (fblk && fblk->bp) if (fblk && fblk->bp)
fblk->bp = NULL; fblk->bp = NULL;
/*
* Get the freespace block corresponding to the data block
* that was just allocated.
*/
fbno = XFS_DIR2_DB_TO_FDB(mp, dbno); fbno = XFS_DIR2_DB_TO_FDB(mp, dbno);
if ((error = xfs_da_read_buf(tp, dp, if (unlikely(error = xfs_da_read_buf(tp, dp,
XFS_DIR2_DB_TO_DA(mp, fbno), -2, &fbp, XFS_DIR2_DB_TO_DA(mp, fbno), -2, &fbp,
XFS_DATA_FORK))) { XFS_DATA_FORK))) {
xfs_da_buf_done(dbp); xfs_da_buf_done(dbp);
return error; return error;
} }
/* /*
* If there wasn't a freespace block, the read will * If there wasn't a freespace block, the read will
* return a NULL fbp. Allocate one later. * return a NULL fbp. Allocate and initialize a new one.
*/
if(unlikely( fbp == NULL )) {
needfreesp = 1;
} else {
free = fbp->data;
ASSERT(INT_GET(free->hdr.magic, ARCH_CONVERT) == XFS_DIR2_FREE_MAGIC);
}
}
/*
* If we don't have a data block, and there's no free slot in a
* freeblock, we need to add a new freeblock.
*/
if (unlikely(needfreesp || foundindex == -1)) {
/*
* Add the new freeblock.
*/ */
if( fbp == NULL ) {
if ((error = xfs_dir2_grow_inode(args, XFS_DIR2_FREE_SPACE, if ((error = xfs_dir2_grow_inode(args, XFS_DIR2_FREE_SPACE,
&fbno))) { &fbno))) {
return error; return error;
} }
if (XFS_DIR2_DB_TO_FDB(mp, dbno) != fbno) { if (unlikely(XFS_DIR2_DB_TO_FDB(mp, dbno) != fbno)) {
cmn_err(CE_ALERT, cmn_err(CE_ALERT,
"xfs_dir2_node_addname_int: needed block %lld, got %lld\n", "xfs_dir2_node_addname_int: dir ino "
(long long)XFS_DIR2_DB_TO_FDB(mp, dbno), "%llu needed freesp block %lld for\n"
(long long)fbno); " data block %lld, got %lld\n"
" ifbno %llu lastfbno %d\n",
dp->i_ino,
XFS_DIR2_DB_TO_FDB(mp, dbno),
dbno, fbno,
ifbno, lastfbno);
if (fblk) {
cmn_err(CE_ALERT,
" fblk 0x%llu blkno %llu "
"index %d magic 0x%x\n",
fblk, fblk->blkno,
fblk->index,
fblk->magic);
} else {
cmn_err(CE_ALERT,
" ... fblk is NULL\n");
}
XFS_ERROR_REPORT("xfs_dir2_node_addname_int", XFS_ERROR_REPORT("xfs_dir2_node_addname_int",
XFS_ERRLEVEL_LOW, mp); XFS_ERRLEVEL_LOW, mp);
return XFS_ERROR(EFSCORRUPTED); return XFS_ERROR(EFSCORRUPTED);
...@@ -1640,8 +1614,9 @@ xfs_dir2_node_addname_int( ...@@ -1640,8 +1614,9 @@ xfs_dir2_node_addname_int(
XFS_DIR2_MAX_FREE_BESTS(mp)); XFS_DIR2_MAX_FREE_BESTS(mp));
INT_ZERO(free->hdr.nvalid, ARCH_CONVERT); INT_ZERO(free->hdr.nvalid, ARCH_CONVERT);
INT_ZERO(free->hdr.nused, ARCH_CONVERT); INT_ZERO(free->hdr.nused, ARCH_CONVERT);
foundindex = 0; } else {
foundbno = fbno; free = fbp->data;
ASSERT(INT_GET(free->hdr.magic, ARCH_CONVERT) == XFS_DIR2_FREE_MAGIC);
} }
/* /*
......
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