]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfsprogs updates - initial sync up with recent kernel changes (not quite
authorNathan Scott <nathans@sgi.com>
Thu, 31 Oct 2002 11:24:20 +0000 (11:24 +0000)
committerNathan Scott <nathans@sgi.com>
Thu, 31 Oct 2002 11:24:20 +0000 (11:24 +0000)
complete yet); bump version; move some common headers to a common place;
fix several compiler warnings with recent gcc versions (3.2+).
bump version, document changes.

29 files changed:
VERSION
bmap/xfs_bmap.c
db/check.c
db/convert.c
db/mount.c
debian/changelog
doc/CHANGES
freeze/xfs_freeze.c
imap/xfs_imap.c
include/libxfs.h
include/platform_defs.h.in
include/xfs_da_btree.h
include/xfs_mount.h
libxfs/rdwr.c
libxfs/xfs.h
libxfs/xfs_da_btree.c
libxfs/xfs_dir.c
libxfs/xfs_dir2.c
libxfs/xfs_dir2_node.c
libxfs/xfs_dir_leaf.c
libxlog/xfs_log_recover.c
mkfile/xfs_mkfile.c
repair/dir.c
repair/dir2.c
repair/incore.c
repair/incore_ino.c
repair/phase1.c
repair/sb.c
rtcp/xfs_rtcp.c

diff --git a/VERSION b/VERSION
index 5abc551822246c028d37a093e7bfae4529b52546..419cfb1d6c265ebd62cbea65b453e64f41334135 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -3,5 +3,5 @@
 #
 PKG_MAJOR=2
 PKG_MINOR=3
-PKG_REVISION=5
+PKG_REVISION=6
 PKG_BUILD=0
index aa3fe360ba355fa2aeb247cbe2570e1b843f5909..05c47a95908ea13f1aa7f0066550df179c5f58de 100644 (file)
@@ -37,7 +37,6 @@
 #include <libxfs.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>
-#include <sys/vfs.h>
 
 int aflag = 0; /* Attribute fork. */
 int lflag = 0; /* list number of blocks with each extent */
@@ -47,8 +46,8 @@ int bmv_iflags = 0;   /* Input flags for XFS_IOC_GETBMAPX */
 char *progname;
 
 int dofile(char *);
-__off64_t file_size(int fd, char * fname);
-int numlen(__off64_t);
+off64_t file_size(int fd, char * fname);
+int numlen(off64_t);
 
 int
 main(int argc, char **argv)
@@ -100,7 +99,7 @@ main(int argc, char **argv)
        return(i ? 1 : 0);
 }
 
-__off64_t
+off64_t
 file_size(int  fd, char *fname)
 {
        struct  stat64  st;
@@ -138,7 +137,7 @@ dofile(char *fname)
                return 1;
        }
        fstatfs(fd, &buf);
-       if (buf.f_type != XFS_SUPER_MAGIC) {
+       if (statfstype(&buf) != XFS_SUPER_MAGIC) {
                fprintf(stderr, "%s: "
                        "specified file [\"%s\"] is not on an XFS filesystem\n",
                        progname, fname);
@@ -319,14 +318,14 @@ dofile(char *fname)
 #define MINTOT_WIDTH   5
 #define        max(a,b)        (a > b ? a : b)
                int       agno;
-               __off64_t agoff, bbperag;
+               off64_t   agoff, bbperag;
                int       foff_w, boff_w, aoff_w, tot_w, agno_w;
                char      rbuf[32], bbuf[32], abuf[32];
 
                foff_w = boff_w = aoff_w = MINRANGE_WIDTH;
                tot_w = MINTOT_WIDTH;
-               bbperag = (__off64_t)fsgeo.agblocks * 
-                         (__off64_t)fsgeo.blocksize / BBSIZE;
+               bbperag = (off64_t)fsgeo.agblocks * 
+                         (off64_t)fsgeo.blocksize / BBSIZE;
 
                /* 
                 * Go through the extents and figure out the width
@@ -404,9 +403,9 @@ dofile(char *fname)
 }
 
 int
-numlen( __off64_t val)
+numlen(off64_t val)
 {
-       __off64_t tmp;
+       off64_t tmp;
        int len;
 
        for (len=0, tmp=val; tmp > 0; tmp=tmp/10) len++;
index 534d7feaa75c9763bd2c604c48f2f132440519bf..d670ee0507651d6804018ef92c4e0cdb37af41ed 100644 (file)
@@ -1748,11 +1748,11 @@ init(
        while ((c = getopt(argc, argv, "b:i:npsv")) != EOF) {
                switch (c) {
                case 'b':
-                       bno = atoll(optarg);
+                       bno = strtoll(optarg, NULL, 10);
                        add_blist(bno);
                        break;
                case 'i':
-                       ino = atoll(optarg);
+                       ino = strtoll(optarg, NULL, 10);
                        add_ilist(ino);
                        break;
                case 'n':
@@ -1839,7 +1839,7 @@ ncheck_f(
        while ((c = getopt(argc, argv, "i:s")) != EOF) {
                switch (c) {
                case 'i':
-                       ino = atoll(optarg);
+                       ino = strtoll(optarg, NULL, 10);
                        ilist = xrealloc(ilist, (ilist_size + 1) *
                                sizeof(*ilist));
                        ilist[ilist_size++] = ino;
@@ -2778,6 +2778,7 @@ process_inode(
                        ic = 1;
                        break;
                default:
+                       break;
                }
                if (ic)
                        quota_add(dic->di_gid, dic->di_uid, 0, bc, ic, rc);
index 2e72f7cf768abe6b03cca08dda429e1f2c236bb3..a9fe2b2a51575c2e5cd17fb490598faa9bea03a5 100644 (file)
@@ -161,6 +161,7 @@ bytevalue(ctype_t ctype, cval_t *val)
                return (__uint64_t)val->inooff;
        case CT_NONE:
        case NCTS:
+               break;
        }
        /* NOTREACHED */
        return 0;
@@ -261,6 +262,7 @@ convert_f(int argc, char **argv)
        case CT_NONE:
        case NCTS:
                /* NOTREACHED */
+               break;
        }
        dbprintf("0x%llx (%llu)\n", v, v);
        return 0;
@@ -320,6 +322,7 @@ getvalue(char *s, ctype_t ctype, cval_t *val)
        case CT_NONE:
        case NCTS:
                /* NOTREACHED */
+               break;
        }
        return 1;
 }
index 0b516e2ab5cb542acbee638ba9c58a07560b66cd..77a8ea03b07e1c6dffd2446d7976298229fcc24c 100644 (file)
 
 xfs_mount_t    *mp;
 
-static void
-compute_maxlevels(
-       xfs_mount_t     *mp,
-       int             whichfork)
-{
-       int             level;
-       uint            maxblocks;
-       uint            maxleafents;
-       int             maxrootrecs;
-       int             minleafrecs;
-       int             minnoderecs;
-       int             sz;
-
-       maxleafents = (whichfork == XFS_DATA_FORK) ? MAXEXTNUM : MAXAEXTNUM;
-       minleafrecs = mp->m_bmap_dmnr[0];
-       minnoderecs = mp->m_bmap_dmnr[1];
-       sz = mp->m_sb.sb_inodesize;
-       maxrootrecs = (int)XFS_BTREE_BLOCK_MAXRECS(sz, xfs_bmdr, 0);
-       maxblocks = (maxleafents + minleafrecs - 1) / minleafrecs;
-       for (level = 1; maxblocks > 1; level++) {
-               if (maxblocks <= maxrootrecs)
-                       maxblocks = 1;
-               else
-                       maxblocks = (maxblocks + minnoderecs - 1) / minnoderecs;
-       }
-       mp->m_bm_maxlevels[whichfork] = level;
-}
-
 xfs_mount_t *
 dbmount(void)
 {
        void            *bufp;
-       int             i;
        xfs_mount_t     *mp;
        xfs_sb_t        *sbp;
 
@@ -84,46 +55,16 @@ dbmount(void)
         libxfs_xlate_sb(bufp, &mp->m_sb, 1, ARCH_CONVERT, XFS_SB_ALL_BITS);
        xfree(bufp);
        sbp = &mp->m_sb;
         if (sbp->sb_magicnum != XFS_SB_MAGIC) {
             fprintf(stderr,"%s: unexpected XFS SB magic number 0x%08x\n",
                     progname, sbp->sb_magicnum);
         }
-       mp->m_blkbit_log = sbp->sb_blocklog + XFS_NBBYLOG;
-       mp->m_blkbb_log = sbp->sb_blocklog - BBSHIFT;
-       mp->m_agno_log = libxfs_highbit32(sbp->sb_agcount - 1) + 1;
-       mp->m_agino_log = sbp->sb_inopblog + sbp->sb_agblklog;
-       mp->m_litino =
-               (int)(sbp->sb_inodesize -
-                     (sizeof(xfs_dinode_core_t) + sizeof(xfs_agino_t)));
-       mp->m_blockmask = sbp->sb_blocksize - 1;
-       mp->m_blockwsize = sbp->sb_blocksize >> XFS_WORDLOG;
-       mp->m_blockwmask = mp->m_blockwsize - 1;
-       for (i = 0; i < 2; i++) {
-               mp->m_alloc_mxr[i] =
-                       (uint)XFS_BTREE_BLOCK_MAXRECS(sbp->sb_blocksize,
-                               xfs_alloc, i == 0);
-               mp->m_alloc_mnr[i] =
-                       (uint)XFS_BTREE_BLOCK_MINRECS(sbp->sb_blocksize,
-                               xfs_alloc, i == 0);
-               mp->m_bmap_dmxr[i] =
-                       (uint)XFS_BTREE_BLOCK_MAXRECS(sbp->sb_blocksize,
-                               xfs_bmbt, i == 0);
-               mp->m_bmap_dmnr[i] =
-                       (uint)XFS_BTREE_BLOCK_MINRECS(sbp->sb_blocksize,
-                               xfs_bmbt, i == 0);
-               mp->m_inobt_mxr[i] =
-                       (uint)XFS_BTREE_BLOCK_MAXRECS(sbp->sb_blocksize,
-                               xfs_inobt, i == 0);
-               mp->m_inobt_mnr[i] =
-                       (uint)XFS_BTREE_BLOCK_MINRECS(sbp->sb_blocksize,
-                               xfs_inobt, i == 0);
-       }
-       compute_maxlevels(mp, XFS_DATA_FORK);
-       compute_maxlevels(mp, XFS_ATTR_FORK);
-       mp->m_bsize = XFS_FSB_TO_BB(mp, 1);
-       mp->m_ialloc_inos = (int)MAX(XFS_INODES_PER_CHUNK, sbp->sb_inopblock);
-       mp->m_ialloc_blks = mp->m_ialloc_inos >> sbp->sb_inopblog;
+
+       libxfs_mount_common(mp, sbp);
+       libxfs_bmap_compute_maxlevels(mp, XFS_DATA_FORK);
+       libxfs_bmap_compute_maxlevels(mp, XFS_ATTR_FORK);
+       libxfs_ialloc_compute_maxlevels(mp);
+
        if (sbp->sb_rblocks) {
                mp->m_rsumlevels = sbp->sb_rextslog + 1;
                mp->m_rsumsize =
@@ -133,21 +74,11 @@ dbmount(void)
                        mp->m_rsumsize =
                                roundup(mp->m_rsumsize, sbp->sb_blocksize);
        }
+
        if (XFS_SB_VERSION_HASDIRV2(sbp)) {
-               mp->m_dirversion = 2;
-               mp->m_dirblksize =
-                       1 << (sbp->sb_dirblklog + sbp->sb_blocklog);
-               mp->m_dirblkfsbs = 1 << sbp->sb_dirblklog;
-               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));
+               libxfs_dir2_mount(mp);
        } else {
-               mp->m_dirversion = 1;
-               mp->m_dirblksize = sbp->sb_blocksize;
-               mp->m_dirblkfsbs = 1;
+               libxfs_dir_mount(mp);
        }
        return mp;
 }
index 0c7c695b5e0772b657143f7a01b29632a591ceb0..96e4c7f769ab6096b6170a59a149a376d5c7d640 100644 (file)
@@ -1,3 +1,9 @@
+xfsprogs (2.3.6-1) unstable; urgency=low
+
+  * New upstream release
+
+ -- Nathan Scott <nathans@debian.org>  Thu, 31 Oct 2002 17:26:44 +1100
+
 xfsprogs (2.3.5-1) unstable; urgency=low
 
   * New upstream release
index dc698635d83ce992976bbf3c7dee29d1ffeed115..6b5360038e31ffbfd788f5ee11dfdf1559349440 100644 (file)
@@ -1,3 +1,8 @@
+xfsprogs-2.3.6 (31 October 2002)
+       - Sync up user/kernel source in lib{xfs,xlog} and headers.
+       - Fix several warnings from newer (3.2) versions of gcc.
+       - Minor header file shuffling.
+
 xfsprogs-2.3.5 (10 October 2002)
        - Sync up user/kernel source in lib{xfs,xlog} and headers.
        - Fix mkfs (libxfs) bug when using BLKFLSBUF ioctl - we passed
index 7c3e9a4df706cbbd67cc253e8e4180d77a2b4b5f..c946e073f7167c566737a9a24c12acf33ad217b4 100644 (file)
@@ -32,7 +32,6 @@
 
 #include <libxfs.h>
 #include <sys/ioctl.h>
-#include <sys/vfs.h>
 
 char   *progname;
 
@@ -83,7 +82,7 @@ main(int argc, char **argv)
                return 1;
        }
        fstatfs(ffd, &buf);
-       if (buf.f_type != XFS_SUPER_MAGIC) {
+       if (statfstype(&buf) != XFS_SUPER_MAGIC) {
                fprintf(stderr,
                        "%s: specified file is not on an XFS filesystem\n",
                        progname);
index 974e75958b6b8bac8b635d881aeab092593a63ab..e929c211bf49ed99279fcdb62e148be3c3503fdc 100644 (file)
@@ -36,7 +36,6 @@
 
 #include <libxfs.h>
 #include <sys/ioctl.h>
-#include <sys/vfs.h>
 
 int main(int argc, char **argv)
 {
@@ -63,7 +62,7 @@ int main(int argc, char **argv)
                return 1;
        }
        fstatfs(fd, &buf);
-       if (buf.f_type != XFS_SUPER_MAGIC) {
+       if (statfstype(&buf) != XFS_SUPER_MAGIC) {
                fprintf(stderr, "%s: "
                        "specified file [\"%s\"] is not on an XFS filesystem\n",
                        progname, name);
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 44c96644bf75832faa22b581a70376609a5775f6..c9232491e32901c361c6123bb8f1544163235cf4 100644 (file)
 #define __XFS_PLATFORM_DEFS_H__
 
 #include <stdio.h>
+#include <errno.h>
+#include <fcntl.h>
 #include <stdarg.h>
 #include <assert.h>
-#include <endian.h>
 #include <stddef.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <sys/param.h>
 #include <sys/types.h>
+
+#if defined(__linux__)
+
+#include <sys/vfs.h>
+#include <sys/param.h>
 #include <uuid/uuid.h>
+#include <linux/types.h>
+#include <malloc.h>
+#include <getopt.h>
 
+#include <endian.h>
 #if defined (__powerpc__) /* ppc fix from: Robert Ramiega (jedi@plukwa.net) */
 # define __BYTEORDER_HAS_U64__
 #endif
 #include <asm/byteorder.h>
 
-#include <errno.h>
-#include <fcntl.h>
-
 #ifndef O_DIRECT
 # if defined (__powerpc__)
 #  define O_DIRECT     0400000
 # define constpp       char * const *
 #endif
 
+#define ENOATTR                ENODATA /* Attribute not found */
+#define EFSCORRUPTED   990     /* Filesystem is corrupted */
+#define statfstype(bp) ((bp)->f_type)  /* statfs(2) fstyp */
+
 typedef loff_t         xfs_off_t;
 typedef __uint64_t     xfs_ino_t;
 typedef __uint32_t     xfs_dev_t;
@@ -75,6 +85,10 @@ typedef __int64_t    xfs_daddr_t;
 typedef char*          xfs_caddr_t;
 
 typedef unsigned char  uchar_t;
+typedef enum { B_FALSE,B_TRUE }        boolean_t;
+
+#endif
+
 
 /* long and pointer must be either 32 bit or 64 bit */
 #undef HAVE_32BIT_LONG
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 7011e001b6c3e302f707dd09f2df82f03b68ecda..e3e58604b2eaa4bb0a6445ef83b0eab660c7bd52 100644 (file)
@@ -209,7 +209,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 d3dc6b8bdf1919dabe30235de7c22334e410f672..68d3fa39c8ad13fe5e3beb2126c91cf4e0c64d58 100644 (file)
@@ -31,7 +31,6 @@
  */
 
 #include <libxfs.h>
-#include <malloc.h>
 #include <xfs_log.h>
 #include <xfs_log_priv.h>
 
index c747993de3c1dcdbdfd67cdd90955c16f7a7b6a7..4794c912150b0a5b895e17d2b4953f79c03ef609 100644 (file)
 /* anything else */
 typedef __uint32_t uint_t;
 typedef __uint32_t inst_t;     /* an instruction */
-typedef enum { B_FALSE, B_TRUE } boolean_t;
 typedef struct { dev_t dev; } xfs_buftarg_t;
+#undef MASK
+#define NBPP           getpagesize()
 #define STATIC
 #define ATTR_ROOT      0x0002  /* use attrs in root namespace */
 #define ENOATTR                ENODATA /* Attribute not found */
@@ -283,9 +284,6 @@ typedef struct { dev_t dev; } xfs_buftarg_t;
        n = ((unsigned long) n) / (unsigned) base; \
        __res; })
 
-#include <asm/page.h>
-#define NBPP           PAGE_SIZE
-
 static inline int atomicIncWithWrap(int *a, int b)
 {
        int r = *a;
index c44853fd3dd8196bfc713386edd3401a12f0f7a9..c87d964c4a29f6b58244149bf43b02ee6e3f0cd4 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 54c8312cd1bff69f0ea6673e51909949a5bb4c29..b890a3f1e3e3a3411542973f6f99c1abfa082545 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 47f5654e448e736efb01a95301e5375258981743..b923b30da02d7b8c87ac0b61c7e79c35ff410ea7 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 2d9eabc1b7c4109afcfc0ebdfa3ad96afb850469..bfae431b54ab7efba57052a2a49a5eee0188fed8 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 ed5290c5449e4e5068d382cfc7fa243b817b2230..1994f7316c939cb7765ffd8ea592f54602001904 100644 (file)
@@ -62,7 +62,7 @@ xfs_dir_ino_validate(xfs_mount_t *mp, xfs_ino_t ino)
                XFS_AGINO_TO_INO(mp, agno, agino) == ino;
        if (XFS_TEST_ERROR(!ino_ok, mp, XFS_ERRTAG_DIR_INO_VALIDATE,
                        XFS_RANDOM_DIR_INO_VALIDATE)) {
-               xfs_fs_cmn_err(CE_WARN, mp, "Invalid inode number 0x%Lx\n",
+               xfs_fs_cmn_err(CE_WARN, mp, "Invalid inode number 0x%Lx",
                                (unsigned long long) ino);
                return XFS_ERROR(EFSCORRUPTED);
        }
index d43632134789f67274817bf3c5c81facad60b63b..43eec24010315236b6784ccd455eba3ffe25e729 100644 (file)
@@ -273,7 +273,7 @@ xlog_find_head(xlog_t  *log,
             * mkfs etc write a dummy unmount record to a fresh
             * log so we can store the uuid in there
             */
-           xlog_warn("XFS: totally zeroed log\n");
+           xlog_warn("XFS: totally zeroed log");
        }
 
        return 0;
@@ -851,7 +851,7 @@ xlog_unpack_data(xlog_rec_header_t *rhead,
 "XFS: Disregard message if filesystem was created with non-DEBUG kernel");
                    if (XFS_SB_VERSION_HASLOGV2(&log->l_mp->m_sb)) {
                            cmn_err(CE_DEBUG,
-                               "XFS: LogR this is a LogV2 filesystem\n");
+                               "XFS: LogR this is a LogV2 filesystem");
                    }
                    log->l_flags |= XLOG_CHKSUM_MISMATCH;
            }
index 728331d786c6a865a0fdef5b7a471f81be031490..0689492a58c80d69ecf8e4e30fda7ed95ebc71b9 100644 (file)
  */
 
 #include <libxfs.h>
-#include <malloc.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>
-#include <sys/vfs.h>
 #include <ctype.h>
 
 #define        MAXBUFFERSIZE   (256 * 1024)
@@ -65,7 +63,7 @@ openfd(char *name, int oflags)
        }
 
        fstatfs(fd, &buf);
-       if (buf.f_type != XFS_SUPER_MAGIC) {
+       if (statfstype(&buf) != XFS_SUPER_MAGIC) {
                fprintf(stderr, "%s: "
                        "file [\"%s\"] is not on an XFS filesystem\n",
                        progname, name);
@@ -154,7 +152,7 @@ main(int argc, char **argv)
                argv[optind][len-1] = '\0';
        }
 
-       size = atoll(argv[optind]) * mult;
+       size = strtoll(argv[optind], NULL, 10) * mult;
 
        optind++;
 
index 2638c803c5805e5e278a53730f8135e2f03733f5..bce8ed347d6911a4339ac704b9095f61387e3b40 100644 (file)
@@ -835,10 +835,11 @@ 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 +1283,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..fcb8be55e0dad84ddded18b1576910836c97050d 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,8 @@ 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);
index 3c373f9845ebe87957287ca2e41a4a628f3d8590..1b4382ee3e73d4d5b29a059900e9f1b9a5c9e0d1 100644 (file)
@@ -31,7 +31,6 @@
  */
 
 #include <libxfs.h>
-#include <malloc.h>
 #include "avl.h"
 #include "globals.h"
 #include "incore.h"
index 0ced8f3f4d0419939cef82583f6a64e9394e4723..825a1d79fa18d023fd2a0dcdc8cf135acc6d059a 100644 (file)
@@ -31,7 +31,6 @@
  */
 
 #include <libxfs.h>
-#include <malloc.h>
 #include "avl.h"
 #include "globals.h"
 #include "incore.h"
index bcfa3ed223199e3fedc698931d378ab706a66799..f77dff0aaa3ee7e027ea76d02c22ea58a05236f8 100644 (file)
@@ -31,7 +31,6 @@
  */
 
 #include <libxfs.h>
-#include <malloc.h>
 #include "globals.h"
 #include "agheader.h"
 #include "protos.h"
index 54dea3745ce7b4535665770f833f93b684501bc7..aed6042f8d2b113373a7f111065a2308158e5e5b 100644 (file)
@@ -31,7 +31,6 @@
  */
 
 #include <libxfs.h>
-#include <malloc.h>
 #include "agheader.h"
 #include "globals.h"
 #include "protos.h"
index a59ffae1623a82b8df7ae7833f4f5da68b98e98a..11f1e0fb7f7b0ea99fdeeae3cd9dd3651d6e90f9 100644 (file)
@@ -31,7 +31,6 @@
  */
 
 #include <libxfs.h>
-#include <malloc.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>