From: Nathan Scott Date: Thu, 31 Oct 2002 11:24:20 +0000 (+0000) Subject: xfsprogs updates - initial sync up with recent kernel changes (not quite X-Git-Tag: v2.4.0~31 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6bef826c9bad36f490fb17a9dea273f7cae6d0b3;p=thirdparty%2Fxfsprogs-dev.git xfsprogs updates - initial sync up with recent kernel changes (not quite 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. --- diff --git a/VERSION b/VERSION index 5abc55182..419cfb1d6 100644 --- a/VERSION +++ b/VERSION @@ -3,5 +3,5 @@ # PKG_MAJOR=2 PKG_MINOR=3 -PKG_REVISION=5 +PKG_REVISION=6 PKG_BUILD=0 diff --git a/bmap/xfs_bmap.c b/bmap/xfs_bmap.c index aa3fe360b..05c47a959 100644 --- a/bmap/xfs_bmap.c +++ b/bmap/xfs_bmap.c @@ -37,7 +37,6 @@ #include #include #include -#include 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++; diff --git a/db/check.c b/db/check.c index 534d7feaa..d670ee050 100644 --- a/db/check.c +++ b/db/check.c @@ -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); diff --git a/db/convert.c b/db/convert.c index 2e72f7cf7..a9fe2b2a5 100644 --- a/db/convert.c +++ b/db/convert.c @@ -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; } diff --git a/db/mount.c b/db/mount.c index 0b516e2ab..77a8ea03b 100644 --- a/db/mount.c +++ b/db/mount.c @@ -39,39 +39,10 @@ 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; } diff --git a/debian/changelog b/debian/changelog index 0c7c695b5..96e4c7f76 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +xfsprogs (2.3.6-1) unstable; urgency=low + + * New upstream release + + -- Nathan Scott Thu, 31 Oct 2002 17:26:44 +1100 + xfsprogs (2.3.5-1) unstable; urgency=low * New upstream release diff --git a/doc/CHANGES b/doc/CHANGES index dc698635d..6b5360038 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -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 diff --git a/freeze/xfs_freeze.c b/freeze/xfs_freeze.c index 7c3e9a4df..c946e073f 100644 --- a/freeze/xfs_freeze.c +++ b/freeze/xfs_freeze.c @@ -32,7 +32,6 @@ #include #include -#include 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); diff --git a/imap/xfs_imap.c b/imap/xfs_imap.c index 974e75958..e929c211b 100644 --- a/imap/xfs_imap.c +++ b/imap/xfs_imap.c @@ -36,7 +36,6 @@ #include #include -#include 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); 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/platform_defs.h.in b/include/platform_defs.h.in index 44c96644b..c9232491e 100644 --- a/include/platform_defs.h.in +++ b/include/platform_defs.h.in @@ -35,25 +35,31 @@ #define __XFS_PLATFORM_DEFS_H__ #include +#include +#include #include #include -#include #include #include #include #include -#include #include + +#if defined(__linux__) + +#include +#include #include +#include +#include +#include +#include #if defined (__powerpc__) /* ppc fix from: Robert Ramiega (jedi@plukwa.net) */ # define __BYTEORDER_HAS_U64__ #endif #include -#include -#include - #ifndef O_DIRECT # if defined (__powerpc__) # define O_DIRECT 0400000 @@ -68,6 +74,10 @@ # 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 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 7011e001b..e3e58604b 100644 --- a/include/xfs_mount.h +++ b/include/xfs_mount.h @@ -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 */ diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c index d3dc6b8bd..68d3fa39c 100644 --- a/libxfs/rdwr.c +++ b/libxfs/rdwr.c @@ -31,7 +31,6 @@ */ #include -#include #include #include diff --git a/libxfs/xfs.h b/libxfs/xfs.h index c747993de..4794c9121 100644 --- a/libxfs/xfs.h +++ b/libxfs/xfs.h @@ -234,8 +234,9 @@ /* 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 -#define NBPP PAGE_SIZE - static inline int atomicIncWithWrap(int *a, int b) { int r = *a; diff --git a/libxfs/xfs_da_btree.c b/libxfs/xfs_da_btree.c index c44853fd3..c87d964c4 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 54c8312cd..b890a3f1e 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 47f5654e4..b923b30da 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 2d9eabc1b..bfae431b5 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/libxfs/xfs_dir_leaf.c b/libxfs/xfs_dir_leaf.c index ed5290c54..1994f7316 100644 --- a/libxfs/xfs_dir_leaf.c +++ b/libxfs/xfs_dir_leaf.c @@ -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); } diff --git a/libxlog/xfs_log_recover.c b/libxlog/xfs_log_recover.c index d43632134..43eec2401 100644 --- a/libxlog/xfs_log_recover.c +++ b/libxlog/xfs_log_recover.c @@ -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; } diff --git a/mkfile/xfs_mkfile.c b/mkfile/xfs_mkfile.c index 728331d78..0689492a5 100644 --- a/mkfile/xfs_mkfile.c +++ b/mkfile/xfs_mkfile.c @@ -35,10 +35,8 @@ */ #include -#include #include #include -#include #include #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++; diff --git a/repair/dir.c b/repair/dir.c index 2638c803c..bce8ed347 100644 --- a/repair/dir.c +++ b/repair/dir.c @@ -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), diff --git a/repair/dir2.c b/repair/dir2.c index e07b4ed68..fcb8be55e 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,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); diff --git a/repair/incore.c b/repair/incore.c index 3c373f984..1b4382ee3 100644 --- a/repair/incore.c +++ b/repair/incore.c @@ -31,7 +31,6 @@ */ #include -#include #include "avl.h" #include "globals.h" #include "incore.h" diff --git a/repair/incore_ino.c b/repair/incore_ino.c index 0ced8f3f4..825a1d79f 100644 --- a/repair/incore_ino.c +++ b/repair/incore_ino.c @@ -31,7 +31,6 @@ */ #include -#include #include "avl.h" #include "globals.h" #include "incore.h" diff --git a/repair/phase1.c b/repair/phase1.c index bcfa3ed22..f77dff0aa 100644 --- a/repair/phase1.c +++ b/repair/phase1.c @@ -31,7 +31,6 @@ */ #include -#include #include "globals.h" #include "agheader.h" #include "protos.h" diff --git a/repair/sb.c b/repair/sb.c index 54dea3745..aed6042f8 100644 --- a/repair/sb.c +++ b/repair/sb.c @@ -31,7 +31,6 @@ */ #include -#include #include "agheader.h" #include "globals.h" #include "protos.h" diff --git a/rtcp/xfs_rtcp.c b/rtcp/xfs_rtcp.c index a59ffae16..11f1e0fb7 100644 --- a/rtcp/xfs_rtcp.c +++ b/rtcp/xfs_rtcp.c @@ -31,7 +31,6 @@ */ #include -#include #include #include