From: Nathan Scott Date: Fri, 20 Sep 2002 08:28:52 +0000 (+0000) Subject: Undoes mod: xfs-cmds:slinx:127952a X-Git-Tag: v2.4.0~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=26643a09a58f24b64233a0d00004f5a473064b88;p=thirdparty%2Fxfsprogs-dev.git Undoes mod: xfs-cmds:slinx:127952a Undo extended attribute/directory block splitting change. --- diff --git a/include/libxfs.h b/include/libxfs.h index f08d542b8..0e00579f6 100644 --- a/include/libxfs.h +++ b/include/libxfs.h @@ -163,8 +163,7 @@ typedef struct xfs_mount { uint m_flags; /* global mount flags */ uint m_qflags; /* quota status flags */ uint m_attroffset; /* inode attribute offset */ - uint m_dir_node_ents; /* #entries in a dir danode */ - uint m_attr_node_ents; /* #entries in attr danode */ + int m_da_node_ents; /* how many entries in 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 7328bd26c..88bfbf9e1 100644 --- a/include/xfs_da_btree.h +++ b/include/xfs_da_btree.h @@ -90,6 +90,15 @@ 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 */ /* @@ -234,7 +243,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 */ @@ -248,13 +257,12 @@ 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 */ - unsigned int blocksize; /* logical block size */ - unsigned int node_ents; /* how many entries in danode */ + int blocksize; /* logical block size */ + int inleaf; /* insert into 1->lf, 0->splf */ xfs_da_state_path_t path; /* search/split paths */ xfs_da_state_path_t altpath; /* alternate path for join */ - 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 */ + int extravalid; /* T/F: extrablk is in use */ + int extraafter; /* 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 a04f8372b..51c86fea2 100644 --- a/include/xfs_mount.h +++ b/include/xfs_mount.h @@ -216,8 +216,7 @@ typedef struct xfs_mount { uint m_dmevmask; /* DMI events for this FS */ uint m_flags; /* global mount flags */ uint m_attroffset; /* inode attribute offset */ - uint m_dir_node_ents; /* #entries in a dir danode */ - uint m_attr_node_ents; /* #entries in attr danode */ + int m_da_node_ents; /* how many entries in 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 ccc6ad695..6537559a1 100644 --- a/libxfs/xfs_da_btree.c +++ b/libxfs/xfs_da_btree.c @@ -331,16 +331,12 @@ 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); - -#ifdef DEBUG - if (INT_GET(oldroot->hdr.info.magic, ARCH_CONVERT) == XFS_DIR2_LEAFN_MAGIC) { + if (XFS_DIR_IS_V2(mp)) { 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, @@ -375,7 +371,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) > state->node_ents) { + if ((INT_GET(node->hdr.count, ARCH_CONVERT) + newcount) > XFS_DA_NODE_ENTRIES(state->mp)) { /* * Allocate a new node, add to the doubly linked chain of * nodes, then move some of our excess entries into it. @@ -779,7 +775,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 > (state->node_ents >> 1)) { + if (count > (XFS_DA_NODE_ENTRIES(state->mp) >> 1)) { *action = 0; /* blk over 50%, dont try to join */ return(0); /* blk over 50%, dont try to join */ } @@ -833,8 +829,8 @@ xfs_da_node_toosmall(xfs_da_state_t *state, int *action) ASSERT(bp != NULL); node = (xfs_da_intnode_t *)info; - count = state->node_ents; - count -= state->node_ents >> 2; + count = XFS_DA_NODE_ENTRIES(state->mp); + count -= XFS_DA_NODE_ENTRIES(state->mp) >> 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 f75a8ce4b..654822de8 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_dir_node_ents = mp->m_attr_node_ents = + mp->m_da_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,7 +439,6 @@ 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 @@ -493,7 +492,6 @@ 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. @@ -542,7 +540,6 @@ 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, @@ -585,7 +582,6 @@ 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 73dcdd41f..e3f0e37a0 100644 --- a/libxfs/xfs_dir2.c +++ b/libxfs/xfs_dir2.c @@ -53,10 +53,7 @@ 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_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_da_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 999304f10..918e852d9 100644 --- a/libxfs/xfs_dir2_node.c +++ b/libxfs/xfs_dir2_node.c @@ -1252,7 +1252,6 @@ 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. @@ -1727,7 +1726,6 @@ 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. */ @@ -1772,7 +1770,6 @@ 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. */ @@ -1843,7 +1840,6 @@ 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 e5e243606..2638c803c 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) > mp->m_dir_node_ents) { + if (INT_GET(node->hdr.count, ARCH_CONVERT) > XFS_DA_NODE_ENTRIES(mp)) { do_warn("bad record count in inode %llu, count = %d, max = %d\n", da_cursor->ino, INT_GET(node->hdr.count, ARCH_CONVERT), - mp->m_dir_node_ents); + XFS_DA_NODE_ENTRIES(mp)); 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) > - mp->m_dir_node_ents) { + XFS_DA_NODE_ENTRIES(mp)) { 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 76a1a8bec..e07b4ed68 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) > - mp->m_dir_node_ents) { + XFS_DA_NODE_ENTRIES(mp)) { 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), - mp->m_dir_node_ents); + XFS_DA_NODE_ENTRIES(mp)); 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) > mp->m_dir_node_ents) { + if (INT_GET(newnode->hdr.count, ARCH_CONVERT) > XFS_DA_NODE_ENTRIES(mp)) { 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);