From: Nathan Scott Date: Fri, 20 Sep 2002 06:12:16 +0000 (+0000) Subject: Sync up userspace with some recent kernel changes, no functional change. X-Git-Tag: v2.4.0~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=53870cdb0c1c0db7a3a22491bf68bf7f2d9b1aec;p=thirdparty%2Fxfsprogs-dev.git Sync up userspace with some recent kernel changes, no functional change. --- diff --git a/include/libxfs.h b/include/libxfs.h index 0e00579f6..f08d542b8 100644 --- a/include/libxfs.h +++ b/include/libxfs.h @@ -163,7 +163,8 @@ typedef struct xfs_mount { uint m_flags; /* global mount flags */ uint m_qflags; /* quota status flags */ uint m_attroffset; /* inode attribute offset */ - int m_da_node_ents; /* how many entries in danode */ + uint m_dir_node_ents; /* #entries in a dir danode */ + uint m_attr_node_ents; /* #entries in attr danode */ int m_ialloc_inos; /* inodes in inode allocation */ int m_ialloc_blks; /* blocks in inode allocation */ int m_litino; /* size of inode union area */ diff --git a/include/xfs_da_btree.h b/include/xfs_da_btree.h index 88bfbf9e1..7328bd26c 100644 --- a/include/xfs_da_btree.h +++ b/include/xfs_da_btree.h @@ -90,15 +90,6 @@ typedef struct xfs_da_intnode { typedef struct xfs_da_node_hdr xfs_da_node_hdr_t; typedef struct xfs_da_node_entry xfs_da_node_entry_t; -#define XFS_DA_NODE_ENTSIZE_BYNAME /* space a name uses */ \ - (sizeof(xfs_da_node_entry_t)) -#if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_DA_NODE_ENTRIES) -int xfs_da_node_entries(struct xfs_mount *mp); -#define XFS_DA_NODE_ENTRIES(mp) xfs_da_node_entries(mp) -#else -#define XFS_DA_NODE_ENTRIES(mp) ((mp)->m_da_node_ents) -#endif - #define XFS_DA_MAXHASH ((xfs_dahash_t)-1) /* largest valid hash value */ /* @@ -243,7 +234,7 @@ extern xfs_dabuf_t *xfs_dabuf_global_list; typedef struct xfs_da_state_blk { xfs_dabuf_t *bp; /* buffer containing block */ xfs_dablk_t blkno; /* filesystem blkno of buffer */ - xfs_daddr_t disk_blkno; /* on-disk blkno (in BBs) of buffer */ + xfs_daddr_t disk_blkno; /* on-disk blkno (in BBs) of buffer */ int index; /* relevant index into block */ xfs_dahash_t hashval; /* last hash value in block */ int magic; /* blk's magic number, ie: blk type */ @@ -257,12 +248,13 @@ typedef struct xfs_da_state_path { typedef struct xfs_da_state { xfs_da_args_t *args; /* filename arguments */ struct xfs_mount *mp; /* filesystem mount point */ - int blocksize; /* logical block size */ - int inleaf; /* insert into 1->lf, 0->splf */ + unsigned int blocksize; /* logical block size */ + unsigned int node_ents; /* how many entries in danode */ xfs_da_state_path_t path; /* search/split paths */ xfs_da_state_path_t altpath; /* alternate path for join */ - int extravalid; /* T/F: extrablk is in use */ - int extraafter; /* T/F: extrablk is after new */ + unsigned int inleaf : 1; /* insert into 1->lf, 0->splf */ + unsigned int extravalid : 1; /* T/F: extrablk is in use */ + unsigned int extraafter : 1; /* T/F: extrablk is after new */ xfs_da_state_blk_t extrablk; /* for double-splits on leafs */ /* for dirv2 extrablk is data */ } xfs_da_state_t; diff --git a/include/xfs_mount.h b/include/xfs_mount.h index 51c86fea2..a04f8372b 100644 --- a/include/xfs_mount.h +++ b/include/xfs_mount.h @@ -216,7 +216,8 @@ typedef struct xfs_mount { uint m_dmevmask; /* DMI events for this FS */ uint m_flags; /* global mount flags */ uint m_attroffset; /* inode attribute offset */ - int m_da_node_ents; /* how many entries in danode */ + uint m_dir_node_ents; /* #entries in a dir danode */ + uint m_attr_node_ents; /* #entries in attr danode */ int m_ialloc_inos; /* inodes in inode allocation */ int m_ialloc_blks; /* blocks in inode allocation */ int m_litino; /* size of inode union area */ diff --git a/libxfs/xfs_da_btree.c b/libxfs/xfs_da_btree.c index 6537559a1..ccc6ad695 100644 --- a/libxfs/xfs_da_btree.c +++ b/libxfs/xfs_da_btree.c @@ -331,12 +331,16 @@ xfs_da_root_split(xfs_da_state_t *state, xfs_da_state_blk_t *blk1, INT_SET(node->btree[1].hashval, ARCH_CONVERT, blk2->hashval); INT_SET(node->btree[1].before, ARCH_CONVERT, blk2->blkno); INT_SET(node->hdr.count, ARCH_CONVERT, 2); - if (XFS_DIR_IS_V2(mp)) { + +#ifdef DEBUG + if (INT_GET(oldroot->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAFN_MAGIC) { ASSERT(blk1->blkno >= mp->m_dirleafblk && blk1->blkno < mp->m_dirfreeblk); ASSERT(blk2->blkno >= mp->m_dirleafblk && blk2->blkno < mp->m_dirfreeblk); } +#endif + /* Header is already logged by xfs_da_node_create */ xfs_da_log_buf(tp, bp, XFS_DA_LOGRANGE(node, node->btree, @@ -371,7 +375,7 @@ xfs_da_node_split(xfs_da_state_t *state, xfs_da_state_blk_t *oldblk, /* * Do we have to split the node? */ - if ((INT_GET(node->hdr.count, ARCH_CONVERT) + newcount) > XFS_DA_NODE_ENTRIES(state->mp)) { + if ((INT_GET(node->hdr.count, ARCH_CONVERT) + newcount) > state->node_ents) { /* * Allocate a new node, add to the doubly linked chain of * nodes, then move some of our excess entries into it. @@ -775,7 +779,7 @@ xfs_da_node_toosmall(xfs_da_state_t *state, int *action) ASSERT(INT_GET(info->magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC); node = (xfs_da_intnode_t *)info; count = INT_GET(node->hdr.count, ARCH_CONVERT); - if (count > (XFS_DA_NODE_ENTRIES(state->mp) >> 1)) { + if (count > (state->node_ents >> 1)) { *action = 0; /* blk over 50%, dont try to join */ return(0); /* blk over 50%, dont try to join */ } @@ -829,8 +833,8 @@ xfs_da_node_toosmall(xfs_da_state_t *state, int *action) ASSERT(bp != NULL); node = (xfs_da_intnode_t *)info; - count = XFS_DA_NODE_ENTRIES(state->mp); - count -= XFS_DA_NODE_ENTRIES(state->mp) >> 2; + count = state->node_ents; + count -= state->node_ents >> 2; count -= INT_GET(node->hdr.count, ARCH_CONVERT); node = bp->data; ASSERT(INT_GET(node->hdr.info.magic, ARCH_CONVERT) == XFS_DA_NODE_MAGIC); diff --git a/libxfs/xfs_dir.c b/libxfs/xfs_dir.c index 654822de8..f75a8ce4b 100644 --- a/libxfs/xfs_dir.c +++ b/libxfs/xfs_dir.c @@ -68,7 +68,7 @@ xfs_dir_mount(xfs_mount_t *mp) count = shortcount > leafcount ? shortcount : leafcount; mp->m_dircook_elog = xfs_da_log2_roundup(count + 1); ASSERT(mp->m_dircook_elog <= mp->m_sb.sb_blocklog); - mp->m_da_node_ents = + mp->m_dir_node_ents = mp->m_attr_node_ents = (XFS_LBSIZE(mp) - (uint)sizeof(xfs_da_node_hdr_t)) / (uint)sizeof(xfs_da_node_entry_t); mp->m_dir_magicpct = (XFS_LBSIZE(mp) * 37) / 100; @@ -439,6 +439,7 @@ xfs_dir_node_addname(xfs_da_args_t *args) state->args = args; state->mp = args->dp->i_mount; state->blocksize = state->mp->m_sb.sb_blocksize; + state->node_ents = state->mp->m_dir_node_ents; /* * Search to see if name already exists, and get back a pointer @@ -492,6 +493,7 @@ xfs_dir_node_removename(xfs_da_args_t *args) state->args = args; state->mp = args->dp->i_mount; state->blocksize = state->mp->m_sb.sb_blocksize; + state->node_ents = state->mp->m_dir_node_ents; /* * Search to see if name exists, and get back a pointer to it. @@ -540,6 +542,7 @@ xfs_dir_node_lookup(xfs_da_args_t *args) state->args = args; state->mp = args->dp->i_mount; state->blocksize = state->mp->m_sb.sb_blocksize; + state->node_ents = state->mp->m_dir_node_ents; /* * Search to see if name exists, @@ -582,6 +585,7 @@ xfs_dir_node_replace(xfs_da_args_t *args) state->args = args; state->mp = args->dp->i_mount; state->blocksize = state->mp->m_sb.sb_blocksize; + state->node_ents = state->mp->m_dir_node_ents; inum = args->inumber; /* diff --git a/libxfs/xfs_dir2.c b/libxfs/xfs_dir2.c index e3f0e37a0..73dcdd41f 100644 --- a/libxfs/xfs_dir2.c +++ b/libxfs/xfs_dir2.c @@ -53,7 +53,10 @@ xfs_dir2_mount( mp->m_dirdatablk = XFS_DIR2_DB_TO_DA(mp, XFS_DIR2_DATA_FIRSTDB(mp)); mp->m_dirleafblk = XFS_DIR2_DB_TO_DA(mp, XFS_DIR2_LEAF_FIRSTDB(mp)); mp->m_dirfreeblk = XFS_DIR2_DB_TO_DA(mp, XFS_DIR2_FREE_FIRSTDB(mp)); - mp->m_da_node_ents = + mp->m_attr_node_ents = + (mp->m_sb.sb_blocksize - (uint)sizeof(xfs_da_node_hdr_t)) / + (uint)sizeof(xfs_da_node_entry_t); + mp->m_dir_node_ents = (mp->m_dirblksize - (uint)sizeof(xfs_da_node_hdr_t)) / (uint)sizeof(xfs_da_node_entry_t); mp->m_dir_magicpct = (mp->m_dirblksize * 37) / 100; diff --git a/libxfs/xfs_dir2_node.c b/libxfs/xfs_dir2_node.c index 918e852d9..999304f10 100644 --- a/libxfs/xfs_dir2_node.c +++ b/libxfs/xfs_dir2_node.c @@ -1252,6 +1252,7 @@ xfs_dir2_node_addname( state->args = args; state->mp = args->dp->i_mount; state->blocksize = state->mp->m_dirblksize; + state->node_ents = state->mp->m_dir_node_ents; /* * Look up the name. We're not supposed to find it, but * this gives us the insertion point. @@ -1726,6 +1727,7 @@ xfs_dir2_node_lookup( state->args = args; state->mp = args->dp->i_mount; state->blocksize = state->mp->m_dirblksize; + state->node_ents = state->mp->m_dir_node_ents; /* * Fill in the path to the entry in the cursor. */ @@ -1770,6 +1772,7 @@ xfs_dir2_node_removename( state->args = args; state->mp = args->dp->i_mount; state->blocksize = state->mp->m_dirblksize; + state->node_ents = state->mp->m_dir_node_ents; /* * Look up the entry we're deleting, set up the cursor. */ @@ -1840,6 +1843,7 @@ xfs_dir2_node_replace( state->args = args; state->mp = args->dp->i_mount; state->blocksize = state->mp->m_dirblksize; + state->node_ents = state->mp->m_dir_node_ents; inum = args->inumber; /* * Lookup the entry to change in the btree. diff --git a/repair/dir.c b/repair/dir.c index 2638c803c..e5e243606 100644 --- a/repair/dir.c +++ b/repair/dir.c @@ -835,10 +835,10 @@ traverse_int_dablock(xfs_mount_t *mp, libxfs_putbuf(bp); goto error_out; } - if (INT_GET(node->hdr.count, ARCH_CONVERT) > XFS_DA_NODE_ENTRIES(mp)) { + if (INT_GET(node->hdr.count, ARCH_CONVERT) > mp->m_dir_node_ents) { do_warn("bad record count in inode %llu, count = %d, max = %d\n", da_cursor->ino, INT_GET(node->hdr.count, ARCH_CONVERT), - XFS_DA_NODE_ENTRIES(mp)); + mp->m_dir_node_ents); libxfs_putbuf(bp); goto error_out; } @@ -1282,7 +1282,7 @@ verify_da_path(xfs_mount_t *mp, bad++; } if (INT_GET(newnode->hdr.count, ARCH_CONVERT) > - XFS_DA_NODE_ENTRIES(mp)) { + mp->m_dir_node_ents) { do_warn("entry count %d too large in block %u (%llu) for " "directory inode %llu\n", INT_GET(newnode->hdr.count, ARCH_CONVERT), diff --git a/repair/dir2.c b/repair/dir2.c index e07b4ed68..76a1a8bec 100644 --- a/repair/dir2.c +++ b/repair/dir2.c @@ -319,12 +319,12 @@ traverse_int_dir2block(xfs_mount_t *mp, goto error_out; } if (INT_GET(node->hdr.count, ARCH_CONVERT) > - XFS_DA_NODE_ENTRIES(mp)) { + mp->m_dir_node_ents) { da_brelse(bp); do_warn("bad record count in inode %llu, count = %d, " "max = %d\n", da_cursor->ino, INT_GET(node->hdr.count, ARCH_CONVERT), - XFS_DA_NODE_ENTRIES(mp)); + mp->m_dir_node_ents); goto error_out; } @@ -662,7 +662,7 @@ verify_dir2_path(xfs_mount_t *mp, dabno, cursor->ino); bad++; } - if (INT_GET(newnode->hdr.count, ARCH_CONVERT) > XFS_DA_NODE_ENTRIES(mp)) { + if (INT_GET(newnode->hdr.count, ARCH_CONVERT) > mp->m_dir_node_ents) { do_warn("entry count %d too large in block %u for " "directory inode %llu\n", INT_GET(newnode->hdr.count, ARCH_CONVERT), dabno, cursor->ino);