]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
Sync up userspace with some recent kernel changes, no functional change.
authorNathan Scott <nathans@sgi.com>
Fri, 20 Sep 2002 06:12:16 +0000 (06:12 +0000)
committerNathan Scott <nathans@sgi.com>
Fri, 20 Sep 2002 06:12:16 +0000 (06:12 +0000)
include/libxfs.h
include/xfs_da_btree.h
include/xfs_mount.h
libxfs/xfs_da_btree.c
libxfs/xfs_dir.c
libxfs/xfs_dir2.c
libxfs/xfs_dir2_node.c
repair/dir.c
repair/dir2.c

index 0e00579f64b5909d792f4adaad6bf0318dc382cf..f08d542b8250b45da6185c188d9a9d7b41525d15 100644 (file)
@@ -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 */
index 88bfbf9e1dc4d07f2d25881f4be70d78d1ea089d..7328bd26cf62da28324fde842d5baecf78c0f892 100644 (file)
@@ -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;
index 51c86fea20c47777702245296ace886edf108d65..a04f8372b6fe195c5341deba056ee70ebd0b8917 100644 (file)
@@ -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 */
index 6537559a1ea5450d01e951a2c84f2741ba835884..ccc6ad695c72dad1168f9155374763152d718790 100644 (file)
@@ -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);
index 654822de82bc19b9880e8a02fdbbe85de6b4d743..f75a8ce4b172f2e06c0ff626dc3632336a4b9e97 100644 (file)
@@ -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;
 
        /*
index e3f0e37a088ffa5fbeb5885d04bc7d544dd75e00..73dcdd41f7d0d9413a56b6379e2ec90988260941 100644 (file)
@@ -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;
index 918e852d991259484c69c9adea3881507579b905..999304f1014a5a325a969af89e32376224345bfd 100644 (file)
@@ -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.
index 2638c803c5805e5e278a53730f8135e2f03733f5..e5e24360679e5f4ceb139fb657128e0ca7e0a1d2 100644 (file)
@@ -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),
index e07b4ed681957c4f214e8bdca0ff9a7bbc968fc3..76a1a8bec3c884590cfac946fd6041bf1b0d585b 100644 (file)
@@ -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);