* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <xfs/libxfs.h>
+#include "xfs/libxfs.h"
#include <math.h>
#include <sys/time.h>
#include "bmap.h"
#include "output.h"
#include "init.h"
#include "malloc.h"
+#include "dir2.h"
typedef enum {
IS_USER_QUOTA, IS_PROJECT_QUOTA, IS_GROUP_QUOTA,
dbm_t type,
xfs_fsblock_t bno,
inodata_t *id,
- xfs_drfsbno_t *totd,
- xfs_drfsbno_t *toti,
+ xfs_rfsblock_t *totd,
+ xfs_rfsblock_t *toti,
xfs_extnum_t *nex,
blkmap_t **blkmapp,
int isroot,
static void check_linkcounts(xfs_agnumber_t agno);
static int check_range(xfs_agnumber_t agno, xfs_agblock_t agbno,
xfs_extlen_t len);
-static void check_rdbmap(xfs_drfsbno_t bno, xfs_extlen_t len,
+static void check_rdbmap(xfs_rfsblock_t bno, xfs_extlen_t len,
dbm_t type);
-static int check_rinomap(xfs_drfsbno_t bno, xfs_extlen_t len,
+static int check_rinomap(xfs_rfsblock_t bno, xfs_extlen_t len,
xfs_ino_t c_ino);
static void check_rootdir(void);
-static int check_rrange(xfs_drfsbno_t bno, xfs_extlen_t len);
+static int check_rrange(xfs_rfsblock_t bno, xfs_extlen_t len);
static void check_set_dbmap(xfs_agnumber_t agno,
xfs_agblock_t agbno, xfs_extlen_t len,
dbm_t type1, dbm_t type2,
xfs_agnumber_t c_agno,
xfs_agblock_t c_agbno);
-static void check_set_rdbmap(xfs_drfsbno_t bno, xfs_extlen_t len,
+static void check_set_rdbmap(xfs_rfsblock_t bno, xfs_extlen_t len,
dbm_t type1, dbm_t type2);
static void check_summary(void);
static void checknot_dbmap(xfs_agnumber_t agno, xfs_agblock_t agbno,
xfs_extlen_t len, int typemask);
-static void checknot_rdbmap(xfs_drfsbno_t bno, xfs_extlen_t len,
+static void checknot_rdbmap(xfs_rfsblock_t bno, xfs_extlen_t len,
int typemask);
static void dir_hash_add(xfs_dahash_t hash,
xfs_dir2_dataptr_t addr);
static char *prepend_path(char *oldpath, char *parent);
static xfs_ino_t process_block_dir_v2(blkmap_t *blkmap, int *dot,
int *dotdot, inodata_t *id);
-static void process_bmbt_reclist(xfs_bmbt_rec_32_t *rp, int numrecs,
+static void process_bmbt_reclist(xfs_bmbt_rec_t *rp, int numrecs,
dbm_t type, inodata_t *id,
- xfs_drfsbno_t *tot,
+ xfs_rfsblock_t *tot,
blkmap_t **blkmapp);
static void process_btinode(inodata_t *id, xfs_dinode_t *dip,
- dbm_t type, xfs_drfsbno_t *totd,
- xfs_drfsbno_t *toti, xfs_extnum_t *nex,
+ dbm_t type, xfs_rfsblock_t *totd,
+ xfs_rfsblock_t *toti, xfs_extnum_t *nex,
blkmap_t **blkmapp, int whichfork);
static xfs_ino_t process_data_dir_v2(int *dot, int *dotdot,
inodata_t *id, int v,
xfs_dablk_t dabno,
freetab_t **freetabp);
-static xfs_dir2_data_free_t
- *process_data_dir_v2_freefind(xfs_dir2_data_t *data,
- xfs_dir2_data_unused_t *dup);
+static xfs_dir2_data_free_t *process_data_dir_v2_freefind(
+ struct xfs_dir2_data_hdr *data,
+ struct xfs_dir2_data_unused *dup);
static void process_dir(xfs_dinode_t *dip, blkmap_t *blkmap,
inodata_t *id);
-static int process_dir_v1(xfs_dinode_t *dip, blkmap_t *blkmap,
- int *dot, int *dotdot, inodata_t *id,
- xfs_ino_t *parent);
static int process_dir_v2(xfs_dinode_t *dip, blkmap_t *blkmap,
int *dot, int *dotdot, inodata_t *id,
xfs_ino_t *parent);
static void process_exinode(inodata_t *id, xfs_dinode_t *dip,
- dbm_t type, xfs_drfsbno_t *totd,
- xfs_drfsbno_t *toti, xfs_extnum_t *nex,
+ dbm_t type, xfs_rfsblock_t *totd,
+ xfs_rfsblock_t *toti, xfs_extnum_t *nex,
blkmap_t **blkmapp, int whichfork);
static void process_inode(xfs_agf_t *agf, xfs_agino_t agino,
xfs_dinode_t *dip, int isfree);
static void process_lclinode(inodata_t *id, xfs_dinode_t *dip,
- dbm_t type, xfs_drfsbno_t *totd,
- xfs_drfsbno_t *toti, xfs_extnum_t *nex,
+ dbm_t type, xfs_rfsblock_t *totd,
+ xfs_rfsblock_t *toti, xfs_extnum_t *nex,
blkmap_t **blkmapp, int whichfork);
-static xfs_ino_t process_leaf_dir_v1(blkmap_t *blkmap, int *dot,
- int *dotdot, inodata_t *id);
-static xfs_ino_t process_leaf_dir_v1_int(int *dot, int *dotdot,
- inodata_t *id);
static xfs_ino_t process_leaf_node_dir_v2(blkmap_t *blkmap, int *dot,
int *dotdot, inodata_t *id,
xfs_fsize_t dirsize);
static void process_leaf_node_dir_v2_int(inodata_t *id, int v,
xfs_dablk_t dbno,
freetab_t *freetab);
-static xfs_ino_t process_node_dir_v1(blkmap_t *blkmap, int *dot,
- int *dotdot, inodata_t *id);
static void process_quota(qtype_t qtype, inodata_t *id,
blkmap_t *blkmap);
static void process_rtbitmap(blkmap_t *blkmap);
static void process_rtsummary(blkmap_t *blkmap);
static xfs_ino_t process_sf_dir_v2(xfs_dinode_t *dip, int *dot,
int *dotdot, inodata_t *id);
-static xfs_ino_t process_shortform_dir_v1(xfs_dinode_t *dip, int *dot,
- int *dotdot, inodata_t *id);
static void quota_add(xfs_dqid_t *p, xfs_dqid_t *g, xfs_dqid_t *u,
int dq, xfs_qcnt_t bc, xfs_qcnt_t ic,
xfs_qcnt_t rc);
static void scan_freelist(xfs_agf_t *agf);
static void scan_lbtree(xfs_fsblock_t root, int nlevels,
scan_lbtree_f_t func, dbm_t type,
- inodata_t *id, xfs_drfsbno_t *totd,
- xfs_drfsbno_t *toti, xfs_extnum_t *nex,
+ inodata_t *id, xfs_rfsblock_t *totd,
+ xfs_rfsblock_t *toti, xfs_extnum_t *nex,
blkmap_t **blkmapp, int isroot,
typnm_t btype);
static void scan_sbtree(xfs_agf_t *agf, xfs_agblock_t root,
scan_sbtree_f_t func, typnm_t btype);
static void scanfunc_bmap(struct xfs_btree_block *block,
int level, dbm_t type, xfs_fsblock_t bno,
- inodata_t *id, xfs_drfsbno_t *totd,
- xfs_drfsbno_t *toti, xfs_extnum_t *nex,
+ inodata_t *id, xfs_rfsblock_t *totd,
+ xfs_rfsblock_t *toti, xfs_extnum_t *nex,
blkmap_t **blkmapp, int isroot,
typnm_t btype);
static void scanfunc_bno(struct xfs_btree_block *block, int level,
xfs_agnumber_t c_agno, xfs_agblock_t c_agbno);
static void set_inomap(xfs_agnumber_t agno, xfs_agblock_t agbno,
xfs_extlen_t len, inodata_t *id);
-static void set_rdbmap(xfs_drfsbno_t bno, xfs_extlen_t len,
+static void set_rdbmap(xfs_rfsblock_t bno, xfs_extlen_t len,
dbm_t type);
-static void set_rinomap(xfs_drfsbno_t bno, xfs_extlen_t len,
+static void set_rinomap(xfs_rfsblock_t bno, xfs_extlen_t len,
inodata_t *id);
static void setlink_inode(inodata_t *id, nlink_t nlink, int isdir,
int security);
static const cmdinfo_t blockfree_cmd =
{ "blockfree", NULL, blockfree_f, 0, 0, 0,
- NULL, "free block usage information", NULL };
+ NULL, N_("free block usage information"), NULL };
static const cmdinfo_t blockget_cmd =
{ "blockget", "check", blockget_f, 0, -1, 0,
- "[-s|-v] [-n] [-t] [-b bno]... [-i ino] ...",
- "get block usage and check consistency", NULL };
+ N_("[-s|-v] [-n] [-t] [-b bno]... [-i ino] ..."),
+ N_("get block usage and check consistency"), NULL };
static const cmdinfo_t blocktrash_cmd =
{ "blocktrash", NULL, blocktrash_f, 0, -1, 0,
- "[-n count] [-x minlen] [-y maxlen] [-s seed] [-0123] [-t type] ...",
- "trash randomly selected block(s)", NULL };
+ N_("[-n count] [-x minlen] [-y maxlen] [-s seed] [-0123] [-t type] ..."),
+ N_("trash randomly selected block(s)"), NULL };
static const cmdinfo_t blockuse_cmd =
{ "blockuse", NULL, blockuse_f, 0, 3, 0,
- "[-n] [-c blockcount]",
- "print usage for current block(s)", NULL };
+ N_("[-n] [-c blockcount]"),
+ N_("print usage for current block(s)"), NULL };
static const cmdinfo_t ncheck_cmd =
{ "ncheck", NULL, ncheck_f, 0, -1, 0,
- "[-s] [-i ino] ...",
- "print inode-name pairs", NULL };
+ N_("[-s] [-i ino] ..."),
+ N_("print inode-name pairs"), NULL };
static void
id = find_inode(ino, 1);
if (id == NULL) {
- dbprintf("-i %lld bad inode number\n", ino);
+ dbprintf(_("-i %lld bad inode number\n"), ino);
return;
}
id->ilist = 1;
{
id->link_add++;
if (verbose || id->ilist)
- dbprintf("inode %lld add link, now %u\n", id->ino,
+ dbprintf(_("inode %lld add link, now %u\n"), id->ino,
id->link_add);
}
pid = find_inode(parent, 1);
id->parent = pid;
if (verbose || id->ilist || (pid && pid->ilist))
- dbprintf("inode %lld parent %lld\n", id->ino, parent);
+ dbprintf(_("inode %lld parent %lld\n"), id->ino, parent);
}
static void
int rt;
if (!dbmap) {
- dbprintf("block usage information not allocated\n");
+ dbprintf(_("block usage information not allocated\n"));
return 0;
}
rt = mp->m_sb.sb_rextents != 0;
int sbyell;
if (dbmap) {
- dbprintf("already have block usage information\n");
+ dbprintf(_("already have block usage information\n"));
return 0;
}
- if (!init(argc, argv))
+
+ /*
+ * XXX: check does not support CRC enabled filesystems. Return
+ * immediately, silently, with success but without doing anything here
+ * initially so that xfstests can run without modification on metadata
+ * enabled filesystems.
+ *
+ * XXX: ultimately we need to dump an error message here that xfstests
+ * filters out, or we need to actually do the work to make check support
+ * crc enabled filesystems.
+ */
+ if (xfs_sb_version_hascrc(&mp->m_sb))
+ return 0;
+
+ if (!init(argc, argv)) {
+ if (serious_error)
+ exitcode = 3;
+ else
+ exitcode = 1;
return 0;
+ }
oldprefix = dbprefix;
dbprefix |= pflag;
for (agno = 0, sbyell = 0; agno < mp->m_sb.sb_agcount; agno++) {
scan_ag(agno);
if (sbver_err > 4 && !sbyell && sbver_err >= agno) {
sbyell = 1;
- dbprintf("WARNING: this may be a newer XFS "
- "filesystem.\n");
+ dbprintf(_("WARNING: this may be a newer XFS "
+ "filesystem.\n"));
}
}
if (blist_size) {
}
if (mp->m_sb.sb_icount != icount) {
if (!sflag)
- dbprintf("sb_icount %lld, counted %lld\n",
+ dbprintf(_("sb_icount %lld, counted %lld\n"),
mp->m_sb.sb_icount, icount);
error++;
}
if (mp->m_sb.sb_ifree != ifree) {
if (!sflag)
- dbprintf("sb_ifree %lld, counted %lld\n",
+ dbprintf(_("sb_ifree %lld, counted %lld\n"),
mp->m_sb.sb_ifree, ifree);
error++;
}
if (mp->m_sb.sb_fdblocks != fdblocks) {
if (!sflag)
- dbprintf("sb_fdblocks %lld, counted %lld\n",
+ dbprintf(_("sb_fdblocks %lld, counted %lld\n"),
mp->m_sb.sb_fdblocks, fdblocks);
error++;
}
if (lazycount && mp->m_sb.sb_fdblocks != agf_aggr_freeblks) {
if (!sflag)
- dbprintf("sb_fdblocks %lld, aggregate AGF count %lld\n",
+ dbprintf(_("sb_fdblocks %lld, aggregate AGF count %lld\n"),
mp->m_sb.sb_fdblocks, agf_aggr_freeblks);
error++;
}
if (mp->m_sb.sb_frextents != frextents) {
if (!sflag)
- dbprintf("sb_frextents %lld, counted %lld\n",
+ dbprintf(_("sb_frextents %lld, counted %lld\n"),
mp->m_sb.sb_frextents, frextents);
error++;
}
if (mp->m_sb.sb_bad_features2 != 0 &&
mp->m_sb.sb_bad_features2 != mp->m_sb.sb_features2) {
if (!sflag)
- dbprintf("sb_features2 (0x%x) not same as "
- "sb_bad_features2 (0x%x)\n",
+ dbprintf(_("sb_features2 (0x%x) not same as "
+ "sb_bad_features2 (0x%x)\n"),
mp->m_sb.sb_features2,
mp->m_sb.sb_bad_features2);
error++;
if ((sbversion & XFS_SB_VERSION_ATTRBIT) &&
!xfs_sb_version_hasattr(&mp->m_sb)) {
if (!sflag)
- dbprintf("sb versionnum missing attr bit %x\n",
+ dbprintf(_("sb versionnum missing attr bit %x\n"),
XFS_SB_VERSION_ATTRBIT);
error++;
}
- if ((sbversion & XFS_SB_VERSION_NLINKBIT) &&
- !xfs_sb_version_hasnlink(&mp->m_sb)) {
- if (!sflag)
- dbprintf("sb versionnum missing nlink bit %x\n",
- XFS_SB_VERSION_NLINKBIT);
- error++;
- }
if ((sbversion & XFS_SB_VERSION_QUOTABIT) &&
!xfs_sb_version_hasquota(&mp->m_sb)) {
if (!sflag)
- dbprintf("sb versionnum missing quota bit %x\n",
+ dbprintf(_("sb versionnum missing quota bit %x\n"),
XFS_SB_VERSION_QUOTABIT);
error++;
}
if (!(sbversion & XFS_SB_VERSION_ALIGNBIT) &&
xfs_sb_version_hasalign(&mp->m_sb)) {
if (!sflag)
- dbprintf("sb versionnum extra align bit %x\n",
+ dbprintf(_("sb versionnum extra align bit %x\n"),
XFS_SB_VERSION_ALIGNBIT);
error++;
}
if (qgdo)
quota_check("group", qgdata);
if (sbver_err > mp->m_sb.sb_agcount / 2)
- dbprintf("WARNING: this may be a newer XFS filesystem.\n");
+ dbprintf(_("WARNING: this may be a newer XFS filesystem.\n"));
if (error)
exitcode = 3;
dbprefix = oldprefix;
int newbit;
int offset;
static char *modestr[] = {
- "zeroed", "set", "flipped", "randomized"
+ N_("zeroed"), N_("set"), N_("flipped"), N_("randomized")
};
len = (int)((random() % (ltabp->max - ltabp->min + 1)) + ltabp->min);
set_cur(&typtab[DBM_UNKNOWN],
XFS_AGB_TO_DADDR(mp, agno, agbno), blkbb, DB_RING_IGN, NULL);
if ((buf = iocur_top->data) == NULL) {
- dbprintf("can't read block %u/%u for trashing\n", agno, agbno);
+ dbprintf(_("can't read block %u/%u for trashing\n"), agno, agbno);
pop_cur();
return;
}
}
write_cur();
pop_cur();
- printf("blocktrash: %u/%u %s block %d bit%s starting %d:%d %s\n",
+ printf(_("blocktrash: %u/%u %s block %d bit%s starting %d:%d %s\n"),
agno, agbno, typename[type], len, len == 1 ? "" : "s",
offset / NBBY, offset % NBBY, modestr[mode]);
}
{
xfs_agblock_t agbno;
xfs_agnumber_t agno;
- xfs_drfsbno_t bi;
- xfs_drfsbno_t blocks;
+ xfs_rfsblock_t bi;
+ xfs_rfsblock_t blocks;
int c;
int count;
int done;
int mode;
struct timeval now;
char *p;
- xfs_drfsbno_t randb;
+ xfs_rfsblock_t randb;
uint seed;
int sopt;
int tmask;
if (!dbmap) {
- dbprintf("must run blockget first\n");
+ dbprintf(_("must run blockget first\n"));
return 0;
}
optind = 0;
case 'n':
count = (int)strtol(optarg, &p, 0);
if (*p != '\0' || count <= 0) {
- dbprintf("bad blocktrash count %s\n", optarg);
+ dbprintf(_("bad blocktrash count %s\n"), optarg);
return 0;
}
break;
break;
}
if (!typename[i] || (((1 << i) & goodmask) == 0)) {
- dbprintf("bad blocktrash type %s\n", optarg);
+ dbprintf(_("bad blocktrash type %s\n"), optarg);
return 0;
}
tmask |= 1 << i;
min = (int)strtol(optarg, &p, 0);
if (*p != '\0' || min <= 0 ||
min > mp->m_sb.sb_blocksize * NBBY) {
- dbprintf("bad blocktrash min %s\n", optarg);
+ dbprintf(_("bad blocktrash min %s\n"), optarg);
return 0;
}
break;
max = (int)strtol(optarg, &p, 0);
if (*p != '\0' || max <= 0 ||
max > mp->m_sb.sb_blocksize * NBBY) {
- dbprintf("bad blocktrash max %s\n", optarg);
+ dbprintf(_("bad blocktrash max %s\n"), optarg);
return 0;
}
break;
default:
- dbprintf("bad option for blocktrash command\n");
+ dbprintf(_("bad option for blocktrash command\n"));
return 0;
}
}
if (min > max) {
- dbprintf("bad min/max for blocktrash command\n");
+ dbprintf(_("bad min/max for blocktrash command\n"));
return 0;
}
if (tmask == 0)
}
}
if (blocks == 0) {
- dbprintf("blocktrash: no matching blocks\n");
- return 0;
+ dbprintf(_("blocktrash: no matching blocks\n"));
+ goto out;
}
if (!sopt)
- dbprintf("blocktrash: seed %u\n", seed);
+ dbprintf(_("blocktrash: seed %u\n"), seed);
srandom(seed);
for (i = 0; i < count; i++) {
- randb = (xfs_drfsbno_t)((((__int64_t)random() << 32) |
+ randb = (xfs_rfsblock_t)((((__int64_t)random() << 32) |
random()) % blocks);
for (bi = 0, agno = 0, done = 0;
!done && agno < mp->m_sb.sb_agcount;
}
}
}
+out:
xfree(lentab);
return 0;
}
int shownames;
if (!dbmap) {
- dbprintf("must run blockget first\n");
+ dbprintf(_("must run blockget first\n"));
return 0;
}
optind = 0;
- count = 1;
shownames = 0;
fsb = XFS_DADDR_TO_FSB(mp, iocur_top->off >> BBSHIFT);
agno = XFS_FSB_TO_AGNO(mp, fsb);
end = agbno + count - 1;
if (*p != '\0' || count <= 0 ||
end >= mp->m_sb.sb_agblocks) {
- dbprintf("bad blockuse count %s\n", optarg);
+ dbprintf(_("bad blockuse count %s\n"), optarg);
return 0;
}
break;
case 'n':
if (!nflag) {
- dbprintf("must run blockget -n first\n");
+ dbprintf(_("must run blockget -n first\n"));
return 0;
}
shownames = 1;
break;
default:
- dbprintf("bad option for blockuse command\n");
+ dbprintf(_("bad option for blockuse command\n"));
return 0;
}
}
while (agbno <= end) {
p = &dbmap[agno][agbno];
i = inomap[agno][agbno];
- dbprintf("block %llu (%u/%u) type %s",
- (xfs_dfsbno_t)XFS_AGB_TO_FSB(mp, agno, agbno),
+ dbprintf(_("block %llu (%u/%u) type %s"),
+ (xfs_fsblock_t)XFS_AGB_TO_FSB(mp, agno, agbno),
agno, agbno, typename[(dbm_t)*p]);
if (i) {
- dbprintf(" inode %lld", i->ino);
+ dbprintf(_(" inode %lld"), i->ino);
if (shownames && (p = inode_name(i->ino, NULL))) {
dbprintf(" %s", p);
xfree(p);
for (i = 0, p = &dbmap[agno][agbno]; i < len; i++, p++) {
if ((dbm_t)*p != type) {
if (!sflag || CHECK_BLISTA(agno, agbno + i))
- dbprintf("block %u/%u expected type %s got "
- "%s\n",
+ dbprintf(_("block %u/%u expected type %s got "
+ "%s\n"),
agno, agbno + i, typename[type],
typename[(dbm_t)*p]);
error++;
int rval;
if (!check_range(agno, agbno, len)) {
- dbprintf("blocks %u/%u..%u claimed by inode %lld\n",
+ dbprintf(_("blocks %u/%u..%u claimed by inode %lld\n"),
agno, agbno, agbno + len - 1, c_ino);
return 0;
}
if (*idp) {
if (!sflag || (*idp)->ilist ||
CHECK_BLISTA(agno, agbno + i))
- dbprintf("block %u/%u claimed by inode %lld, "
- "previous inum %lld\n",
+ dbprintf(_("block %u/%u claimed by inode %lld, "
+ "previous inum %lld\n"),
agno, agbno + i, c_ino, (*idp)->ino);
error++;
rval = 0;
path = xstrdup("?");
if (!sflag || ep->ilist) {
if (ep->link_add)
- dbprintf("link count mismatch "
+ dbprintf(_("link count mismatch "
"for inode %lld (name "
"%s), nlink %d, "
- "counted %d\n",
+ "counted %d\n"),
ep->ino, path,
ep->link_set,
ep->link_add);
else if (ep->link_set)
- dbprintf("disconnected inode "
- "%lld, nlink %d\n",
+ dbprintf(_("disconnected inode "
+ "%lld, nlink %d\n"),
ep->ino, ep->link_set);
else
- dbprintf("allocated inode %lld "
- "has 0 link count\n",
+ dbprintf(_("allocated inode %lld "
+ "has 0 link count\n"),
ep->ino);
}
if (path)
} else if (verbose || ep->ilist) {
path = inode_name(ep->ino, NULL);
if (path) {
- dbprintf("inode %lld name %s\n",
+ dbprintf(_("inode %lld name %s\n"),
ep->ino, path);
xfree(path);
}
/* Do nothing */
} else if (cur == 0 && prev == 1) {
if (low == high) {
- dbprintf("block %u/%u out of range\n",
+ dbprintf(_("block %u/%u out of range\n"),
agno, low);
} else {
- dbprintf("blocks %u/%u..%u "
- "out of range\n",
+ dbprintf(_("blocks %u/%u..%u "
+ "out of range\n"),
agno, low, high);
}
valid_range = 0;
}
if (valid_range) {
if (low == high) {
- dbprintf("block %u/%u out of range\n",
+ dbprintf(_("block %u/%u out of range\n"),
agno, low);
} else {
- dbprintf("blocks %u/%u..%u "
- "out of range\n",
+ dbprintf(_("blocks %u/%u..%u "
+ "out of range\n"),
agno, low, high);
}
}
static void
check_rdbmap(
- xfs_drfsbno_t bno,
+ xfs_rfsblock_t bno,
xfs_extlen_t len,
dbm_t type)
{
for (i = 0, p = &dbmap[mp->m_sb.sb_agcount][bno]; i < len; i++, p++) {
if ((dbm_t)*p != type) {
if (!sflag || CHECK_BLIST(bno + i))
- dbprintf("rtblock %llu expected type %s got "
- "%s\n",
+ dbprintf(_("rtblock %llu expected type %s got "
+ "%s\n"),
bno + i, typename[type],
typename[(dbm_t)*p]);
error++;
static int
check_rinomap(
- xfs_drfsbno_t bno,
+ xfs_rfsblock_t bno,
xfs_extlen_t len,
xfs_ino_t c_ino)
{
int rval;
if (!check_rrange(bno, len)) {
- dbprintf("rtblocks %llu..%llu claimed by inode %lld\n",
+ dbprintf(_("rtblocks %llu..%llu claimed by inode %lld\n"),
bno, bno + len - 1, c_ino);
return 0;
}
i++, idp++) {
if (*idp) {
if (!sflag || (*idp)->ilist || CHECK_BLIST(bno + i))
- dbprintf("rtblock %llu claimed by inode %lld, "
- "previous inum %lld\n",
+ dbprintf(_("rtblock %llu claimed by inode %lld, "
+ "previous inum %lld\n"),
bno + i, c_ino, (*idp)->ino);
error++;
rval = 0;
id = find_inode(mp->m_sb.sb_rootino, 0);
if (id == NULL) {
if (!sflag)
- dbprintf("root inode %lld is missing\n",
+ dbprintf(_("root inode %lld is missing\n"),
mp->m_sb.sb_rootino);
error++;
} else if (!id->isdir) {
if (!sflag || id->ilist)
- dbprintf("root inode %lld is not a directory\n",
+ dbprintf(_("root inode %lld is not a directory\n"),
mp->m_sb.sb_rootino);
error++;
}
static int
check_rrange(
- xfs_drfsbno_t bno,
+ xfs_rfsblock_t bno,
xfs_extlen_t len)
{
xfs_extlen_t i;
if (bno + len - 1 >= mp->m_sb.sb_rblocks) {
for (i = 0; i < len; i++) {
if (!sflag || CHECK_BLIST(bno + i))
- dbprintf("rtblock %llu out of range\n",
+ dbprintf(_("rtblock %llu out of range\n"),
bno + i);
}
error++;
char *p;
if (!check_range(agno, agbno, len)) {
- dbprintf("blocks %u/%u..%u claimed by block %u/%u\n", agno,
+ dbprintf(_("blocks %u/%u..%u claimed by block %u/%u\n"), agno,
agbno, agbno + len - 1, c_agno, c_agbno);
return;
}
for (i = 0, p = &dbmap[agno][agbno]; i < len; i++, p++) {
*p = (char)type2;
if (mayprint && (verbose || CHECK_BLISTA(agno, agbno + i)))
- dbprintf("setting block %u/%u to %s\n", agno, agbno + i,
+ dbprintf(_("setting block %u/%u to %s\n"), agno, agbno + i,
typename[type2]);
}
}
static void
check_set_rdbmap(
- xfs_drfsbno_t bno,
+ xfs_rfsblock_t bno,
xfs_extlen_t len,
dbm_t type1,
dbm_t type2)
for (i = 0, p = &dbmap[mp->m_sb.sb_agcount][bno]; i < len; i++, p++) {
*p = (char)type2;
if (mayprint && (verbose || CHECK_BLIST(bno + i)))
- dbprintf("setting rtblock %llu to %s\n",
+ dbprintf(_("setting rtblock %llu to %s\n"),
bno + i, typename[type2]);
}
}
static void
check_summary(void)
{
- xfs_drfsbno_t bno;
+ xfs_rfsblock_t bno;
xfs_suminfo_t *csp;
xfs_suminfo_t *fsp;
int log;
bno++, csp++, fsp++) {
if (*csp != *fsp) {
if (!sflag)
- dbprintf("rt summary mismatch, size %d "
+ dbprintf(_("rt summary mismatch, size %d "
"block %llu, file: %d, "
- "computed: %d\n",
+ "computed: %d\n"),
log, bno, *fsp, *csp);
error++;
}
for (i = 0, p = &dbmap[agno][agbno]; i < len; i++, p++) {
if ((1 << *p) & typemask) {
if (!sflag || CHECK_BLISTA(agno, agbno + i))
- dbprintf("block %u/%u type %s not expected\n",
+ dbprintf(_("block %u/%u type %s not expected\n"),
agno, agbno + i, typename[(dbm_t)*p]);
error++;
}
static void
checknot_rdbmap(
- xfs_drfsbno_t bno,
+ xfs_rfsblock_t bno,
xfs_extlen_t len,
int typemask)
{
for (i = 0, p = &dbmap[mp->m_sb.sb_agcount][bno]; i < len; i++, p++) {
if ((1 << *p) & typemask) {
if (!sflag || CHECK_BLIST(bno + i))
- dbprintf("rtblock %llu type %s not expected\n",
+ dbprintf(_("rtblock %llu type %s not expected\n"),
bno + i, typename[(dbm_t)*p]);
error++;
}
if (p->seen)
continue;
if (!sflag || id->ilist || v)
- dbprintf("dir ino %lld missing leaf entry for "
- "%x/%x\n",
+ dbprintf(_("dir ino %lld missing leaf entry for "
+ "%x/%x\n"),
id->ino, p->hashval, p->address);
error++;
}
xfs_ino_t ino;
int rt;
+ serious_error = 0;
if (mp->m_sb.sb_magicnum != XFS_SB_MAGIC) {
- dbprintf("bad superblock magic number %x, giving up\n",
+ dbprintf(_("bad superblock magic number %x, giving up\n"),
mp->m_sb.sb_magicnum);
+ serious_error = 1;
return 0;
}
if (!sb_logcheck())
verbose = 1;
break;
default:
- dbprintf("bad option for blockget command\n");
+ dbprintf(_("bad option for blockget command\n"));
return 0;
}
}
error = sbver_err = serious_error = 0;
fdblocks = frextents = icount = ifree = 0;
sbversion = XFS_SB_VERSION_4;
- if (mp->m_sb.sb_inoalignmt)
+ /*
+ * Note that inoalignmt == 0 is valid when fsb size is large enough for
+ * at least one full inode record per block. Check this case explicitly.
+ */
+ if (mp->m_sb.sb_inoalignmt ||
+ (xfs_sb_version_hasalign(&mp->m_sb) &&
+ mp->m_sb.sb_inopblock >= XFS_INODES_PER_CHUNK))
sbversion |= XFS_SB_VERSION_ALIGNBIT;
if ((mp->m_sb.sb_uquotino && mp->m_sb.sb_uquotino != NULLFSINO) ||
- (mp->m_sb.sb_gquotino && mp->m_sb.sb_gquotino != NULLFSINO))
+ (mp->m_sb.sb_gquotino && mp->m_sb.sb_gquotino != NULLFSINO) ||
+ (mp->m_sb.sb_pquotino && mp->m_sb.sb_pquotino != NULLFSINO))
sbversion |= XFS_SB_VERSION_QUOTABIT;
quota_init();
return 1;
int security;
if (!inodata || !nflag) {
- dbprintf("must run blockget -n first\n");
+ dbprintf(_("must run blockget -n first\n"));
return 0;
}
security = optind = ilist_size = 0;
security = 1;
break;
default:
- dbprintf("bad option -%c for ncheck command\n", c);
+ dbprintf(_("bad option -%c for ncheck command\n"), c);
+ xfree(ilist);
return 0;
}
}
int v;
int x;
- nex = blkmap_getn(blkmap, 0, mp->m_dirblkfsbs, &bmp);
+ nex = blkmap_getn(blkmap, 0, mp->m_dir_geo->fsbcount, &bmp);
v = id->ilist || verbose;
if (nex == 0) {
if (!sflag || v)
- dbprintf("block 0 for directory inode %lld is "
- "missing\n",
+ dbprintf(_("block 0 for directory inode %lld is "
+ "missing\n"),
id->ino);
error++;
return 0;
push_cur();
if (nex > 1)
make_bbmap(&bbmap, nex, bmp);
- set_cur(&typtab[TYP_DIR], XFS_FSB_TO_DADDR(mp, bmp->startblock),
- mp->m_dirblkfsbs * blkbb, DB_RING_IGN, nex > 1 ? &bbmap : NULL);
+ set_cur(&typtab[TYP_DIR2], XFS_FSB_TO_DADDR(mp, bmp->startblock),
+ mp->m_dir_geo->fsbcount * blkbb, DB_RING_IGN, nex > 1 ? &bbmap : NULL);
for (x = 0; !v && x < nex; x++) {
for (b = bmp[x].startblock;
!v && b < bmp[x].startblock + bmp[x].blockcount;
free(bmp);
if (iocur_top->data == NULL) {
if (!sflag || id->ilist || v)
- dbprintf("can't read block 0 for directory inode "
- "%lld\n",
+ dbprintf(_("can't read block 0 for directory inode "
+ "%lld\n"),
id->ino);
error++;
pop_cur();
return 0;
}
dir_hash_init();
- parent = process_data_dir_v2(dot, dotdot, id, v, mp->m_dirdatablk,
+ parent = process_data_dir_v2(dot, dotdot, id, v, mp->m_dir_geo->datablk,
NULL);
dir_hash_check(id, v);
dir_hash_done();
static void
process_bmbt_reclist(
- xfs_bmbt_rec_32_t *rp,
+ xfs_bmbt_rec_t *rp,
int numrecs,
dbm_t type,
inodata_t *id,
- xfs_drfsbno_t *tot,
+ xfs_rfsblock_t *tot,
blkmap_t **blkmapp)
{
xfs_agblock_t agbno;
xfs_agnumber_t agno;
xfs_fsblock_t b;
- xfs_dfilblks_t c;
- xfs_dfilblks_t cp;
+ xfs_filblks_t c;
+ xfs_filblks_t cp;
int f;
int i;
xfs_agblock_t iagbno;
xfs_agnumber_t iagno;
- xfs_dfiloff_t o;
- xfs_dfiloff_t op;
- xfs_dfsbno_t s;
+ xfs_fileoff_t o;
+ xfs_fileoff_t op;
+ xfs_fsblock_t s;
int v;
cp = op = 0;
iagno = XFS_INO_TO_AGNO(mp, id->ino);
iagbno = XFS_INO_TO_AGBNO(mp, id->ino);
for (i = 0; i < numrecs; i++, rp++) {
- convert_extent((xfs_bmbt_rec_64_t *)rp, &o, &s, &c, &f);
+ convert_extent(rp, &o, &s, &c, &f);
if (v)
- dbprintf("inode %lld extent [%lld,%lld,%lld,%d]\n",
+ dbprintf(_("inode %lld extent [%lld,%lld,%lld,%d]\n"),
id->ino, o, s, c, f);
if (!sflag && i > 0 && op + cp > o)
- dbprintf("bmap rec out of order, inode %lld entry %d\n",
+ dbprintf(_("bmap rec out of order, inode %lld entry %d\n"),
id->ino, i);
op = o;
cp = c;
if (type == DBM_RTDATA) {
if (!sflag && s >= mp->m_sb.sb_rblocks) {
- dbprintf("inode %lld bad rt block number %lld, "
- "offset %lld\n",
+ dbprintf(_("inode %lld bad rt block number %lld, "
+ "offset %lld\n"),
id->ino, s, o);
continue;
}
agbno = XFS_FSB_TO_AGBNO(mp, s);
if (agno >= mp->m_sb.sb_agcount ||
agbno >= mp->m_sb.sb_agblocks) {
- dbprintf("inode %lld bad block number %lld "
- "[%d,%d], offset %lld\n",
+ dbprintf(_("inode %lld bad block number %lld "
+ "[%d,%d], offset %lld\n"),
id->ino, s, agno, agbno, o);
continue;
}
if (agbno + c - 1 >= mp->m_sb.sb_agblocks) {
- dbprintf("inode %lld bad block number %lld "
- "[%d,%d], offset %lld\n",
+ dbprintf(_("inode %lld bad block number %lld "
+ "[%d,%d], offset %lld\n"),
id->ino, s + c - 1, agno,
agbno + (xfs_agblock_t)c - 1, o);
continue;
blist_size && b < s + c;
b++, o++) {
if (CHECK_BLIST(b))
- dbprintf("inode %lld block %lld at "
- "offset %lld\n",
- id->ino, (xfs_dfsbno_t)b, o);
+ dbprintf(_("inode %lld block %lld at "
+ "offset %lld\n"),
+ id->ino, (xfs_fsblock_t)b, o);
}
} else {
agno = XFS_FSB_TO_AGNO(mp, (xfs_fsblock_t)s);
blist_size && b < s + c;
b++, o++, agbno++) {
if (CHECK_BLIST(b))
- dbprintf("inode %lld block %lld at "
- "offset %lld\n",
- id->ino, (xfs_dfsbno_t)b, o);
+ dbprintf(_("inode %lld block %lld at "
+ "offset %lld\n"),
+ id->ino, (xfs_fsblock_t)b, o);
}
}
*tot += c;
inodata_t *id,
xfs_dinode_t *dip,
dbm_t type,
- xfs_drfsbno_t *totd,
- xfs_drfsbno_t *toti,
+ xfs_rfsblock_t *totd,
+ xfs_rfsblock_t *toti,
xfs_extnum_t *nex,
blkmap_t **blkmapp,
int whichfork)
xfs_bmdr_block_t *dib;
int i;
xfs_bmbt_ptr_t *pp;
- xfs_bmbt_rec_32_t *rp;
dib = (xfs_bmdr_block_t *)XFS_DFORK_PTR(dip, whichfork);
if (be16_to_cpu(dib->bb_level) >= XFS_BM_MAXLEVELS(mp, whichfork)) {
if (!sflag || id->ilist)
- dbprintf("level for ino %lld %s fork bmap root too "
- "large (%u)\n",
+ dbprintf(_("level for ino %lld %s fork bmap root too "
+ "large (%u)\n"),
id->ino,
- whichfork == XFS_DATA_FORK ? "data" : "attr",
+ whichfork == XFS_DATA_FORK ? _("data") : _("attr"),
be16_to_cpu(dib->bb_level));
error++;
return;
}
if (be16_to_cpu(dib->bb_numrecs) >
- xfs_bmdr_maxrecs(mp, XFS_DFORK_SIZE(dip, mp, whichfork),
+ xfs_bmdr_maxrecs(XFS_DFORK_SIZE(dip, mp, whichfork),
be16_to_cpu(dib->bb_level) == 0)) {
if (!sflag || id->ilist)
- dbprintf("numrecs for ino %lld %s fork bmap root too "
- "large (%u)\n",
+ dbprintf(_("numrecs for ino %lld %s fork bmap root too "
+ "large (%u)\n"),
id->ino,
- whichfork == XFS_DATA_FORK ? "data" : "attr",
+ whichfork == XFS_DATA_FORK ? _("data") : _("attr"),
be16_to_cpu(dib->bb_numrecs));
error++;
return;
}
if (be16_to_cpu(dib->bb_level) == 0) {
- rp = (xfs_bmbt_rec_32_t *)XFS_BMDR_REC_ADDR(dib, 1);
+ xfs_bmbt_rec_t *rp = XFS_BMDR_REC_ADDR(dib, 1);
process_bmbt_reclist(rp, be16_to_cpu(dib->bb_numrecs), type,
id, totd, blkmapp);
*nex += be16_to_cpu(dib->bb_numrecs);
return;
} else {
- pp = XFS_BMDR_PTR_ADDR(dib, 1, xfs_bmdr_maxrecs(mp,
+ pp = XFS_BMDR_PTR_ADDR(dib, 1, xfs_bmdr_maxrecs(
XFS_DFORK_SIZE(dip, mp, whichfork), 0));
for (i = 0; i < be16_to_cpu(dib->bb_numrecs); i++)
scan_lbtree(be64_to_cpu(pp[i]),
}
if (*nex <= XFS_DFORK_SIZE(dip, mp, whichfork) / sizeof(xfs_bmbt_rec_t)) {
if (!sflag || id->ilist)
- dbprintf("extent count for ino %lld %s fork too low "
- "(%d) for file format\n",
+ dbprintf(_("extent count for ino %lld %s fork too low "
+ "(%d) for file format\n"),
id->ino,
- whichfork == XFS_DATA_FORK ? "data" : "attr",
+ whichfork == XFS_DATA_FORK ? _("data") : _("attr"),
*nex);
error++;
}
xfs_dir2_dataptr_t addr;
xfs_dir2_data_free_t *bf;
int bf_err;
- xfs_dir2_block_t *block;
+ struct xfs_dir2_data_hdr *block;
xfs_dir2_block_tail_t *btp = NULL;
inodata_t *cid;
int count;
- xfs_dir2_data_t *data;
+ struct xfs_dir2_data_hdr *data;
xfs_dir2_db_t db;
xfs_dir2_data_entry_t *dep;
xfs_dir2_data_free_t *dfp;
data = iocur_top->data;
block = iocur_top->data;
- if (be32_to_cpu(block->hdr.magic) != XFS_DIR2_BLOCK_MAGIC &&
- be32_to_cpu(data->hdr.magic) != XFS_DIR2_DATA_MAGIC) {
+ if (be32_to_cpu(block->magic) != XFS_DIR2_BLOCK_MAGIC &&
+ be32_to_cpu(data->magic) != XFS_DIR2_DATA_MAGIC) {
if (!sflag || v)
- dbprintf("bad directory data magic # %#x for dir ino "
- "%lld block %d\n",
- be32_to_cpu(data->hdr.magic), id->ino, dabno);
+ dbprintf(_("bad directory data magic # %#x for dir ino "
+ "%lld block %d\n"),
+ be32_to_cpu(data->magic), id->ino, dabno);
error++;
return NULLFSINO;
}
- db = xfs_dir2_da_to_db(mp, dabno);
- bf = data->hdr.bestfree;
- ptr = (char *)data->u;
- if (be32_to_cpu(block->hdr.magic) == XFS_DIR2_BLOCK_MAGIC) {
- btp = xfs_dir2_block_tail_p(mp, block);
+ db = xfs_dir2_da_to_db(mp->m_dir_geo, dabno);
+ bf = M_DIROPS(mp)->data_bestfree_p(data);
+ ptr = (char *)M_DIROPS(mp)->data_unused_p(data);
+ if (be32_to_cpu(block->magic) == XFS_DIR2_BLOCK_MAGIC) {
+ btp = xfs_dir2_block_tail_p(mp->m_dir_geo, block);
lep = xfs_dir2_block_leaf_p(btp);
endptr = (char *)lep;
if (endptr <= ptr || endptr > (char *)btp) {
- endptr = (char *)data + mp->m_dirblksize;
+ endptr = (char *)data + mp->m_dir_geo->blksize;
lep = NULL;
if (!sflag || v)
- dbprintf("bad block directory tail for dir ino "
- "%lld\n",
+ dbprintf(_("bad block directory tail for dir ino "
+ "%lld\n"),
id->ino);
error++;
}
} else
- endptr = (char *)data + mp->m_dirblksize;
+ endptr = (char *)data + mp->m_dir_geo->blksize;
bf_err = lastfree_err = tag_err = 0;
count = lastfree = freeseen = 0;
if (be16_to_cpu(bf[0].length) == 0) {
be16_to_cpu(dup->length) == 0 ||
(char *)tagp >= endptr) {
if (!sflag || v)
- dbprintf("dir %lld block %d bad free "
- "entry at %d\n",
+ dbprintf(_("dir %lld block %d bad free "
+ "entry at %d\n"),
id->ino, dabno,
(int)((char *)dup -
(char *)data));
dep = (xfs_dir2_data_entry_t *)dup;
if (dep->namelen == 0) {
if (!sflag || v)
- dbprintf("dir %lld block %d zero length entry "
- "at %d\n",
+ dbprintf(_("dir %lld block %d zero length entry "
+ "at %d\n"),
id->ino, dabno,
(int)((char *)dep - (char *)data));
error++;
}
- tagp = xfs_dir2_data_entry_tag_p(dep);
+ tagp = M_DIROPS(mp)->data_entry_tag_p(dep);
if ((char *)tagp >= endptr) {
if (!sflag || v)
- dbprintf("dir %lld block %d bad entry at %d\n",
+ dbprintf(_("dir %lld block %d bad entry at %d\n"),
id->ino, dabno,
(int)((char *)dep - (char *)data));
error++;
break;
}
tag_err += be16_to_cpu(*tagp) != (char *)dep - (char *)data;
- addr = xfs_dir2_db_off_to_dataptr(mp, db,
+ addr = xfs_dir2_db_off_to_dataptr(mp->m_dir_geo, db,
(char *)dep - (char *)data);
- xname.name = (char *)dep->name;
+ xname.name = dep->name;
xname.len = dep->namelen;
dir_hash_add(mp->m_dirnameops->hashname(&xname), addr);
- ptr += xfs_dir2_data_entsize(dep->namelen);
+ ptr += M_DIROPS(mp)->data_entsize(dep->namelen);
count++;
lastfree = 0;
lino = be64_to_cpu(dep->inumber);
cid = find_inode(lino, 1);
if (v)
- dbprintf("dir %lld block %d entry %*.*s %lld\n",
+ dbprintf(_("dir %lld block %d entry %*.*s %lld\n"),
id->ino, dabno, dep->namelen, dep->namelen,
dep->name, lino);
if (cid)
addlink_inode(cid);
else {
if (!sflag || v)
- dbprintf("dir %lld block %d entry %*.*s bad "
- "inode number %lld\n",
+ dbprintf(_("dir %lld block %d entry %*.*s bad "
+ "inode number %lld\n"),
id->ino, dabno, dep->namelen,
dep->namelen, dep->name, lino);
error++;
dep->name[1] == '.') {
if (parent) {
if (!sflag || v)
- dbprintf("multiple .. entries in dir "
- "%lld (%lld, %lld)\n",
+ dbprintf(_("multiple .. entries in dir "
+ "%lld (%lld, %lld)\n"),
id->ino, parent, lino);
error++;
} else
} else {
if (lino != id->ino) {
if (!sflag || v)
- dbprintf("dir %lld entry . inode "
- "number mismatch (%lld)\n",
+ dbprintf(_("dir %lld entry . inode "
+ "number mismatch (%lld)\n"),
id->ino, lino);
error++;
}
(*dot)++;
}
}
- if (be32_to_cpu(data->hdr.magic) == XFS_DIR2_BLOCK_MAGIC) {
- endptr = (char *)data + mp->m_dirblksize;
+ if (be32_to_cpu(data->magic) == XFS_DIR2_BLOCK_MAGIC) {
+ endptr = (char *)data + mp->m_dir_geo->blksize;
for (i = stale = 0; lep && i < be32_to_cpu(btp->count); i++) {
if ((char *)&lep[i] >= endptr) {
if (!sflag || v)
- dbprintf("dir %lld block %d bad count "
- "%u\n", id->ino, dabno,
+ dbprintf(_("dir %lld block %d bad count "
+ "%u\n"), id->ino, dabno,
be32_to_cpu(btp->count));
error++;
break;
else if (dir_hash_see(be32_to_cpu(lep[i].hashval),
be32_to_cpu(lep[i].address))) {
if (!sflag || v)
- dbprintf("dir %lld block %d extra leaf "
- "entry %x %x\n",
+ dbprintf(_("dir %lld block %d extra leaf "
+ "entry %x %x\n"),
id->ino, dabno,
be32_to_cpu(lep[i].hashval),
be32_to_cpu(lep[i].address));
bf_err += freeseen != 7;
if (bf_err) {
if (!sflag || v)
- dbprintf("dir %lld block %d bad bestfree data\n",
+ dbprintf(_("dir %lld block %d bad bestfree data\n"),
id->ino, dabno);
error++;
}
- if (be32_to_cpu(data->hdr.magic) == XFS_DIR2_BLOCK_MAGIC &&
- count != be32_to_cpu(btp->count) -
- be32_to_cpu(btp->stale)) {
+ if (be32_to_cpu(data->magic) == XFS_DIR2_BLOCK_MAGIC &&
+ count != be32_to_cpu(btp->count) - be32_to_cpu(btp->stale)) {
if (!sflag || v)
- dbprintf("dir %lld block %d bad block tail count %d "
- "(stale %d)\n",
+ dbprintf(_("dir %lld block %d bad block tail count %d "
+ "(stale %d)\n"),
id->ino, dabno, be32_to_cpu(btp->count),
be32_to_cpu(btp->stale));
error++;
}
- if (be32_to_cpu(data->hdr.magic) == XFS_DIR2_BLOCK_MAGIC &&
+ if (be32_to_cpu(data->magic) == XFS_DIR2_BLOCK_MAGIC &&
stale != be32_to_cpu(btp->stale)) {
if (!sflag || v)
- dbprintf("dir %lld block %d bad stale tail count %d\n",
+ dbprintf(_("dir %lld block %d bad stale tail count %d\n"),
id->ino, dabno, be32_to_cpu(btp->stale));
error++;
}
if (lastfree_err) {
if (!sflag || v)
- dbprintf("dir %lld block %d consecutive free entries\n",
+ dbprintf(_("dir %lld block %d consecutive free entries\n"),
id->ino, dabno);
error++;
}
if (tag_err) {
if (!sflag || v)
- dbprintf("dir %lld block %d entry/unused tag "
- "mismatch\n",
+ dbprintf(_("dir %lld block %d entry/unused tag "
+ "mismatch\n"),
id->ino, dabno);
error++;
}
static xfs_dir2_data_free_t *
process_data_dir_v2_freefind(
- xfs_dir2_data_t *data,
+ struct xfs_dir2_data_hdr *data,
xfs_dir2_data_unused_t *dup)
{
- xfs_dir2_data_free_t *dfp;
+ struct xfs_dir2_data_free *bf;
+ struct xfs_dir2_data_free *dfp;
xfs_dir2_data_aoff_t off;
off = (xfs_dir2_data_aoff_t)((char *)dup - (char *)data);
- if (be16_to_cpu(dup->length) < be16_to_cpu(data->hdr.
- bestfree[XFS_DIR2_DATA_FD_COUNT - 1].length))
+ bf = M_DIROPS(mp)->data_bestfree_p(data);
+ if (be16_to_cpu(dup->length) <
+ be16_to_cpu(bf[XFS_DIR2_DATA_FD_COUNT - 1].length))
return NULL;
- for (dfp = &data->hdr.bestfree[0]; dfp < &data->hdr.
- bestfree[XFS_DIR2_DATA_FD_COUNT]; dfp++) {
+ for (dfp = bf; dfp < &bf[XFS_DIR2_DATA_FD_COUNT]; dfp++) {
if (be16_to_cpu(dfp->offset) == 0)
return NULL;
if (be16_to_cpu(dfp->offset) == off)
xfs_ino_t parent;
dot = dotdot = 0;
- if (xfs_sb_version_hasdirv2(&mp->m_sb)) {
- if (process_dir_v2(dip, blkmap, &dot, &dotdot, id, &parent))
- return;
- } else
- {
- if (process_dir_v1(dip, blkmap, &dot, &dotdot, id, &parent))
- return;
- }
+ if (process_dir_v2(dip, blkmap, &dot, &dotdot, id, &parent))
+ return;
+
bno = XFS_INO_TO_FSB(mp, id->ino);
if (dot == 0) {
if (!sflag || id->ilist || CHECK_BLIST(bno))
- dbprintf("no . entry for directory %lld\n", id->ino);
+ dbprintf(_("no . entry for directory %lld\n"), id->ino);
error++;
}
if (dotdot == 0) {
if (!sflag || id->ilist || CHECK_BLIST(bno))
- dbprintf("no .. entry for directory %lld\n", id->ino);
+ dbprintf(_("no .. entry for directory %lld\n"), id->ino);
error++;
} else if (parent == id->ino && id->ino != mp->m_sb.sb_rootino) {
if (!sflag || id->ilist || CHECK_BLIST(bno))
- dbprintf(". and .. same for non-root directory %lld\n",
+ dbprintf(_(". and .. same for non-root directory %lld\n"),
id->ino);
error++;
} else if (id->ino == mp->m_sb.sb_rootino && id->ino != parent) {
if (!sflag || id->ilist || CHECK_BLIST(bno))
- dbprintf("root directory %lld has .. %lld\n", id->ino,
+ dbprintf(_("root directory %lld has .. %lld\n"), id->ino,
parent);
error++;
} else if (parent != NULLFSINO && id->ino != parent)
addparent_inode(id, parent);
}
-static int
-process_dir_v1(
- xfs_dinode_t *dip,
- blkmap_t *blkmap,
- int *dot,
- int *dotdot,
- inodata_t *id,
- xfs_ino_t *parent)
-{
- xfs_fsize_t size = be64_to_cpu(dip->di_core.di_size);
-
- if (size <= XFS_DFORK_DSIZE(dip, mp) &&
- dip->di_core.di_format == XFS_DINODE_FMT_LOCAL)
- *parent = process_shortform_dir_v1(dip, dot, dotdot, id);
- else if (size == XFS_LBSIZE(mp) &&
- (dip->di_core.di_format == XFS_DINODE_FMT_EXTENTS ||
- dip->di_core.di_format == XFS_DINODE_FMT_BTREE))
- *parent = process_leaf_dir_v1(blkmap, dot, dotdot, id);
- else if (size >= XFS_LBSIZE(mp) &&
- (dip->di_core.di_format == XFS_DINODE_FMT_EXTENTS ||
- dip->di_core.di_format == XFS_DINODE_FMT_BTREE))
- *parent = process_node_dir_v1(blkmap, dot, dotdot, id);
- else {
- dbprintf("bad size (%lld) or format (%d) for directory inode "
- "%lld\n",
- size, dip->di_core.di_format, id->ino);
- error++;
- return 1;
- }
- return 0;
-}
-
static int
process_dir_v2(
xfs_dinode_t *dip,
xfs_ino_t *parent)
{
xfs_fileoff_t last = 0;
- xfs_fsize_t size = be64_to_cpu(dip->di_core.di_size);
+ xfs_fsize_t size = be64_to_cpu(dip->di_size);
if (blkmap)
last = blkmap_last_off(blkmap);
if (size <= XFS_DFORK_DSIZE(dip, mp) &&
- dip->di_core.di_format == XFS_DINODE_FMT_LOCAL)
+ dip->di_format == XFS_DINODE_FMT_LOCAL)
*parent = process_sf_dir_v2(dip, dot, dotdot, id);
- else if (last == mp->m_dirblkfsbs &&
- (dip->di_core.di_format == XFS_DINODE_FMT_EXTENTS ||
- dip->di_core.di_format == XFS_DINODE_FMT_BTREE))
+ else if (last == mp->m_dir_geo->fsbcount &&
+ (dip->di_format == XFS_DINODE_FMT_EXTENTS ||
+ dip->di_format == XFS_DINODE_FMT_BTREE))
*parent = process_block_dir_v2(blkmap, dot, dotdot, id);
- else if (last >= mp->m_dirleafblk + mp->m_dirblkfsbs &&
- (dip->di_core.di_format == XFS_DINODE_FMT_EXTENTS ||
- dip->di_core.di_format == XFS_DINODE_FMT_BTREE))
+ else if (last >= mp->m_dir_geo->leafblk + mp->m_dir_geo->fsbcount &&
+ (dip->di_format == XFS_DINODE_FMT_EXTENTS ||
+ dip->di_format == XFS_DINODE_FMT_BTREE))
*parent = process_leaf_node_dir_v2(blkmap, dot, dotdot, id, size);
else {
- dbprintf("bad size (%lld) or format (%d) for directory inode "
- "%lld\n",
- size, dip->di_core.di_format, id->ino);
+ dbprintf(_("bad size (%lld) or format (%d) for directory inode "
+ "%lld\n"),
+ size, dip->di_format, id->ino);
error++;
return 1;
}
inodata_t *id,
xfs_dinode_t *dip,
dbm_t type,
- xfs_drfsbno_t *totd,
- xfs_drfsbno_t *toti,
+ xfs_rfsblock_t *totd,
+ xfs_rfsblock_t *toti,
xfs_extnum_t *nex,
blkmap_t **blkmapp,
int whichfork)
{
- xfs_bmbt_rec_32_t *rp;
+ xfs_bmbt_rec_t *rp;
- rp = (xfs_bmbt_rec_32_t *)XFS_DFORK_PTR(dip, whichfork);
+ rp = (xfs_bmbt_rec_t *)XFS_DFORK_PTR(dip, whichfork);
*nex = XFS_DFORK_NEXTENTS(dip, whichfork);
if (*nex < 0 || *nex > XFS_DFORK_SIZE(dip, mp, whichfork) /
- sizeof(xfs_bmbt_rec_32_t)) {
+ sizeof(xfs_bmbt_rec_t)) {
if (!sflag || id->ilist)
- dbprintf("bad number of extents %d for inode %lld\n",
+ dbprintf(_("bad number of extents %d for inode %lld\n"),
*nex, id->ino);
error++;
return;
xfs_extnum_t nextents = 0;
int nlink;
int security;
- xfs_drfsbno_t totblocks;
- xfs_drfsbno_t totdblocks = 0;
- xfs_drfsbno_t totiblocks = 0;
+ xfs_rfsblock_t totblocks;
+ xfs_rfsblock_t totdblocks = 0;
+ xfs_rfsblock_t totiblocks = 0;
dbm_t type;
xfs_extnum_t anextents = 0;
- xfs_drfsbno_t atotdblocks = 0;
- xfs_drfsbno_t atotiblocks = 0;
+ xfs_rfsblock_t atotdblocks = 0;
+ xfs_rfsblock_t atotiblocks = 0;
xfs_qcnt_t bc = 0;
xfs_qcnt_t ic = 0;
xfs_qcnt_t rc = 0;
xfs_dqid_t dqprid;
+ int v = 0;
static char okfmts[] = {
0, /* type 0 unused */
1 << XFS_DINODE_FMT_DEV, /* FIFO */
"dev", "local", "extents", "btree", "uuid"
};
- libxfs_dinode_from_disk(&idic, &dip->di_core);
+ libxfs_dinode_from_disk(&idic, dip);
ino = XFS_AGINO_TO_INO(mp, be32_to_cpu(agf->agf_seqno), agino);
if (!isfree) {
bno = XFS_INO_TO_FSB(mp, ino);
blkmap = NULL;
}
+ v = (!sflag || (id && id->ilist) || CHECK_BLIST(bno));
if (idic.di_magic != XFS_DINODE_MAGIC) {
- if (!sflag || isfree || id->ilist || CHECK_BLIST(bno))
- dbprintf("bad magic number %#x for inode %lld\n",
+ if (isfree || v)
+ dbprintf(_("bad magic number %#x for inode %lld\n"),
idic.di_magic, ino);
error++;
return;
}
if (!XFS_DINODE_GOOD_VERSION(idic.di_version)) {
- if (!sflag || isfree || id->ilist || CHECK_BLIST(bno))
- dbprintf("bad version number %#x for inode %lld\n",
+ if (isfree || v)
+ dbprintf(_("bad version number %#x for inode %lld\n"),
idic.di_version, ino);
error++;
return;
}
if (isfree) {
if (idic.di_nblocks != 0) {
- if (!sflag || id->ilist || CHECK_BLIST(bno))
- dbprintf("bad nblocks %lld for free inode "
- "%lld\n",
+ if (v)
+ dbprintf(_("bad nblocks %lld for free inode "
+ "%lld\n"),
idic.di_nblocks, ino);
error++;
}
- if (idic.di_version == XFS_DINODE_VERSION_1)
+ if (idic.di_version == 1)
nlink = idic.di_onlink;
else
nlink = idic.di_nlink;
if (nlink != 0) {
- if (!sflag || id->ilist || CHECK_BLIST(bno))
- dbprintf("bad nlink %d for free inode %lld\n",
+ if (v)
+ dbprintf(_("bad nlink %d for free inode %lld\n"),
nlink, ino);
error++;
}
if (idic.di_mode != 0) {
- if (!sflag || id->ilist || CHECK_BLIST(bno))
- dbprintf("bad mode %#o for free inode %lld\n",
+ if (v)
+ dbprintf(_("bad mode %#o for free inode %lld\n"),
idic.di_mode, ino);
error++;
}
return;
}
+
if (be32_to_cpu(dip->di_next_unlinked) != NULLAGINO) {
- if (!sflag || isfree || id->ilist || CHECK_BLIST(bno))
- dbprintf("bad next unlinked %#x for inode %lld\n",
+ if (v)
+ dbprintf(_("bad next unlinked %#x for inode %lld\n"),
be32_to_cpu(dip->di_next_unlinked), ino);
error++;
}
*/
if ((((idic.di_mode & S_IFMT) >> 12) > 15) ||
(!(okfmts[(idic.di_mode & S_IFMT) >> 12] & (1 << idic.di_format)))) {
- if (!sflag || id->ilist || CHECK_BLIST(bno))
- dbprintf("bad format %d for inode %lld type %#o\n",
+ if (v)
+ dbprintf(_("bad format %d for inode %lld type %#o\n"),
idic.di_format, id->ino, idic.di_mode & S_IFMT);
error++;
return;
}
- if ((unsigned int)XFS_DFORK_ASIZE(dip, mp) >= XFS_LITINO(mp)) {
- if (!sflag || id->ilist)
- dbprintf("bad fork offset %d for inode %lld\n",
+ if ((unsigned int)XFS_DFORK_ASIZE(dip, mp) >=
+ XFS_LITINO(mp, idic.di_version)) {
+ if (v)
+ dbprintf(_("bad fork offset %d for inode %lld\n"),
idic.di_forkoff, id->ino);
error++;
return;
}
if ((unsigned int)idic.di_aformat > XFS_DINODE_FMT_BTREE) {
- if (!sflag || id->ilist)
- dbprintf("bad attribute format %d for inode %lld\n",
+ if (v)
+ dbprintf(_("bad attribute format %d for inode %lld\n"),
idic.di_aformat, id->ino);
error++;
return;
}
- if (verbose || id->ilist || CHECK_BLIST(bno))
- dbprintf("inode %lld mode %#o fmt %s "
+ if (verbose || (id && id->ilist) || CHECK_BLIST(bno))
+ dbprintf(_("inode %lld mode %#o fmt %s "
"afmt %s "
- "nex %d anex %d nblk %lld sz %lld%s%s%s%s%s%s%s\n",
+ "nex %d anex %d nblk %lld sz %lld%s%s%s%s%s%s%s\n"),
id->ino, idic.di_mode, fmtnames[(int)idic.di_format],
fmtnames[(int)idic.di_aformat],
idic.di_nextents,
addlink_inode(id);
}
else if (id->ino == mp->m_sb.sb_uquotino ||
- id->ino == mp->m_sb.sb_gquotino) {
+ id->ino == mp->m_sb.sb_gquotino ||
+ id->ino == mp->m_sb.sb_pquotino) {
type = DBM_QUOTA;
blkmap = blkmap_alloc(idic.di_nextents);
addlink_inode(id);
type = DBM_UNKNOWN;
break;
}
- if (idic.di_version == XFS_DINODE_VERSION_1)
+ if (idic.di_version == 1)
setlink_inode(id, idic.di_onlink, type == DBM_DIR, security);
else {
sbversion |= XFS_SB_VERSION_NLINKBIT;
break;
}
if (ic) {
- dqprid = idic.di_projid; /* dquot ID is u32 */
+ dqprid = xfs_get_projid(&idic); /* dquot ID is u32 */
quota_add(&dqprid, &idic.di_gid, &idic.di_uid,
0, bc, ic, rc);
}
}
totblocks = totdblocks + totiblocks + atotdblocks + atotiblocks;
if (totblocks != idic.di_nblocks) {
- if (!sflag || id->ilist || CHECK_BLIST(bno))
- dbprintf("bad nblocks %lld for inode %lld, counted "
- "%lld\n",
+ if (v)
+ dbprintf(_("bad nblocks %lld for inode %lld, counted "
+ "%lld\n"),
idic.di_nblocks, id->ino, totblocks);
error++;
}
if (nextents != idic.di_nextents) {
- if (!sflag || id->ilist || CHECK_BLIST(bno))
- dbprintf("bad nextents %d for inode %lld, counted %d\n",
+ if (v)
+ dbprintf(_("bad nextents %d for inode %lld, counted %d\n"),
idic.di_nextents, id->ino, nextents);
error++;
}
if (anextents != idic.di_anextents) {
- if (!sflag || id->ilist || CHECK_BLIST(bno))
- dbprintf("bad anextents %d for inode %lld, counted "
- "%d\n",
+ if (v)
+ dbprintf(_("bad anextents %d for inode %lld, counted "
+ "%d\n"),
idic.di_anextents, id->ino, anextents);
error++;
}
process_quota(IS_USER_QUOTA, id, blkmap);
else if (id->ino == mp->m_sb.sb_gquotino &&
(mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT) &&
- (mp->m_sb.sb_qflags & XFS_OQUOTA_CHKD))
+ (mp->m_sb.sb_qflags & XFS_GQUOTA_CHKD))
process_quota(IS_GROUP_QUOTA, id, blkmap);
- else if (id->ino == mp->m_sb.sb_gquotino &&
+ else if (id->ino == mp->m_sb.sb_pquotino &&
(mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT) &&
- (mp->m_sb.sb_qflags & XFS_OQUOTA_CHKD))
+ (mp->m_sb.sb_qflags & XFS_PQUOTA_CHKD))
process_quota(IS_PROJECT_QUOTA, id, blkmap);
}
if (blkmap)
inodata_t *id,
xfs_dinode_t *dip,
dbm_t type,
- xfs_drfsbno_t *totd,
- xfs_drfsbno_t *toti,
+ xfs_rfsblock_t *totd,
+ xfs_rfsblock_t *toti,
xfs_extnum_t *nex,
blkmap_t **blkmapp,
int whichfork)
xfs_fsblock_t bno;
bno = XFS_INO_TO_FSB(mp, id->ino);
- if (whichfork == XFS_DATA_FORK && be64_to_cpu(dip->di_core.di_size) >
+ if (whichfork == XFS_DATA_FORK && be64_to_cpu(dip->di_size) >
XFS_DFORK_DSIZE(dip, mp)) {
if (!sflag || id->ilist || CHECK_BLIST(bno))
- dbprintf("local inode %lld data is too large (size "
- "%lld)\n",
- id->ino, be64_to_cpu(dip->di_core.di_size));
+ dbprintf(_("local inode %lld data is too large (size "
+ "%lld)\n"),
+ id->ino, be64_to_cpu(dip->di_size));
error++;
}
else if (whichfork == XFS_ATTR_FORK) {
asf = (xfs_attr_shortform_t *)XFS_DFORK_APTR(dip);
if (be16_to_cpu(asf->hdr.totsize) > XFS_DFORK_ASIZE(dip, mp)) {
if (!sflag || id->ilist || CHECK_BLIST(bno))
- dbprintf("local inode %lld attr is too large "
- "(size %d)\n",
+ dbprintf(_("local inode %lld attr is too large "
+ "(size %d)\n"),
id->ino, be16_to_cpu(asf->hdr.totsize));
error++;
}
}
}
-static xfs_ino_t
-process_leaf_dir_v1(
- blkmap_t *blkmap,
- int *dot,
- int *dotdot,
- inodata_t *id)
-{
- xfs_fsblock_t bno;
- xfs_ino_t parent;
-
- bno = blkmap_get(blkmap, 0);
- if (bno == NULLFSBLOCK) {
- if (!sflag || id->ilist)
- dbprintf("block 0 for directory inode %lld is "
- "missing\n",
- id->ino);
- error++;
- return 0;
- }
- push_cur();
- set_cur(&typtab[TYP_DIR], XFS_FSB_TO_DADDR(mp, bno), blkbb, DB_RING_IGN,
- NULL);
- if (iocur_top->data == NULL) {
- if (!sflag || id->ilist || CHECK_BLIST(bno))
- dbprintf("can't read block 0 for directory inode "
- "%lld\n",
- id->ino);
- error++;
- pop_cur();
- return 0;
- }
- parent = process_leaf_dir_v1_int(dot, dotdot, id);
- pop_cur();
- return parent;
-}
-
-static xfs_ino_t
-process_leaf_dir_v1_int(
- int *dot,
- int *dotdot,
- inodata_t *id)
-{
- xfs_fsblock_t bno;
- inodata_t *cid;
- xfs_dir_leaf_entry_t *entry;
- int i;
- xfs_dir_leafblock_t *leaf;
- xfs_ino_t lino;
- xfs_dir_leaf_name_t *namest;
- xfs_ino_t parent = 0;
- int v;
-
- bno = XFS_DADDR_TO_FSB(mp, iocur_top->bb);
- v = verbose || id->ilist || CHECK_BLIST(bno);
- leaf = iocur_top->data;
- if (be16_to_cpu(leaf->hdr.info.magic) != XFS_DIR_LEAF_MAGIC) {
- if (!sflag || id->ilist || CHECK_BLIST(bno))
- dbprintf("bad directory leaf magic # %#x for dir ino "
- "%lld\n",
- be16_to_cpu(leaf->hdr.info.magic), id->ino);
- error++;
- return NULLFSINO;
- }
- entry = &leaf->entries[0];
- for (i = 0; i < be16_to_cpu(leaf->hdr.count); entry++, i++) {
- namest = xfs_dir_leaf_namestruct(leaf,
- be16_to_cpu(entry->nameidx));
- lino = XFS_GET_DIR_INO8(namest->inumber);
- cid = find_inode(lino, 1);
- if (v)
- dbprintf("dir %lld entry %*.*s %lld\n", id->ino,
- entry->namelen, entry->namelen, namest->name,
- lino);
- if (cid)
- addlink_inode(cid);
- else {
- if (!sflag)
- dbprintf("dir %lld entry %*.*s bad inode "
- "number %lld\n",
- id->ino, entry->namelen, entry->namelen,
- namest->name, lino);
- error++;
- }
- if (entry->namelen == 2 && namest->name[0] == '.' &&
- namest->name[1] == '.') {
- if (parent) {
- if (!sflag || id->ilist || CHECK_BLIST(bno))
- dbprintf("multiple .. entries in dir "
- "%lld (%lld, %lld)\n",
- id->ino, parent, lino);
- error++;
- } else
- parent = cid ? lino : NULLFSINO;
- (*dotdot)++;
- } else if (entry->namelen != 1 || namest->name[0] != '.') {
- if (cid != NULL) {
- if (!cid->parent)
- cid->parent = id;
- addname_inode(cid, (char *)namest->name,
- entry->namelen);
- }
- } else {
- if (lino != id->ino) {
- if (!sflag)
- dbprintf("dir %lld entry . inode "
- "number mismatch (%lld)\n",
- id->ino, lino);
- error++;
- }
- (*dot)++;
- }
- }
- return parent;
-}
-
static xfs_ino_t
process_leaf_node_dir_v2(
blkmap_t *blkmap,
xfs_ino_t lino;
int nex;
xfs_ino_t parent;
- int t;
+ int t = 0;
int v;
int v2;
int x;
v2 = verbose || id->ilist;
v = parent = 0;
dbno = NULLFILEOFF;
- freetab = malloc(FREETAB_SIZE(dirsize / mp->m_dirblksize));
- freetab->naents = (int)(dirsize / mp->m_dirblksize);
+ freetab = malloc(FREETAB_SIZE(dirsize / mp->m_dir_geo->blksize));
+ freetab->naents = (int)(dirsize / mp->m_dir_geo->blksize);
freetab->nents = 0;
for (i = 0; i < freetab->naents; i++)
freetab->ents[i] = NULLDATAOFF;
dir_hash_init();
while ((dbno = blkmap_next_off(blkmap, dbno, &t)) != NULLFILEOFF) {
- nex = blkmap_getn(blkmap, dbno, mp->m_dirblkfsbs, &bmp);
+ nex = blkmap_getn(blkmap, dbno, mp->m_dir_geo->fsbcount, &bmp);
ASSERT(nex > 0);
for (v = v2, x = 0; !v && x < nex; x++) {
for (b = bmp[x].startblock;
v = CHECK_BLIST(b);
}
if (v)
- dbprintf("dir inode %lld block %u=%llu\n", id->ino,
+ dbprintf(_("dir inode %lld block %u=%llu\n"), id->ino,
(__uint32_t)dbno,
- (xfs_dfsbno_t)bmp->startblock);
+ (xfs_fsblock_t)bmp->startblock);
push_cur();
if (nex > 1)
make_bbmap(&bbmap, nex, bmp);
- set_cur(&typtab[TYP_DIR], XFS_FSB_TO_DADDR(mp, bmp->startblock),
- mp->m_dirblkfsbs * blkbb, DB_RING_IGN,
+ set_cur(&typtab[TYP_DIR2], XFS_FSB_TO_DADDR(mp, bmp->startblock),
+ mp->m_dir_geo->fsbcount * blkbb, DB_RING_IGN,
nex > 1 ? &bbmap : NULL);
free(bmp);
if (iocur_top->data == NULL) {
if (!sflag || v)
- dbprintf("can't read block %u for directory "
- "inode %lld\n",
+ dbprintf(_("can't read block %u for directory "
+ "inode %lld\n"),
(__uint32_t)dbno, id->ino);
error++;
pop_cur();
- dbno += mp->m_dirblkfsbs - 1;
+ dbno += mp->m_dir_geo->fsbcount - 1;
continue;
}
- if (dbno < mp->m_dirleafblk) {
+ if (dbno < mp->m_dir_geo->leafblk) {
lino = process_data_dir_v2(dot, dotdot, id, v,
(xfs_dablk_t)dbno, &freetab);
if (lino) {
if (parent) {
if (!sflag || v)
- dbprintf("multiple .. entries "
- "in dir %lld\n",
+ dbprintf(_("multiple .. entries "
+ "in dir %lld\n"),
id->ino);
error++;
} else
parent = lino;
}
- } else if (dbno < mp->m_dirfreeblk) {
+ } else if (dbno < mp->m_dir_geo->freeblk) {
process_leaf_node_dir_v2_int(id, v, (xfs_dablk_t)dbno,
freetab);
} else {
freetab);
}
pop_cur();
- dbno += mp->m_dirblkfsbs - 1;
+ dbno += mp->m_dir_geo->fsbcount - 1;
}
dir_hash_check(id, v);
dir_hash_done();
for (i = 0; i < freetab->nents; i++) {
if (freetab->ents[i] != NULLDATAOFF) {
if (!sflag || v)
- dbprintf("missing free index for data block %d "
- "in dir ino %lld\n",
- xfs_dir2_db_to_da(mp, i), id->ino);
+ dbprintf(_("missing free index for data block %d "
+ "in dir ino %lld\n"),
+ xfs_dir2_db_to_da(mp->m_dir_geo, i), id->ino);
error++;
}
}
free = iocur_top->data;
if (be32_to_cpu(free->hdr.magic) != XFS_DIR2_FREE_MAGIC) {
if (!sflag || v)
- dbprintf("bad free block magic # %#x for dir ino %lld "
- "block %d\n",
+ dbprintf(_("bad free block magic # %#x for dir ino %lld "
+ "block %d\n"),
be32_to_cpu(free->hdr.magic), id->ino, dabno);
error++;
return;
}
- maxent = XFS_DIR2_MAX_FREE_BESTS(mp);
- if (be32_to_cpu(free->hdr.firstdb) != xfs_dir2_da_to_db(mp,
- dabno - mp->m_dirfreeblk) * maxent) {
+ maxent = M_DIROPS(mp)->free_max_bests(mp->m_dir_geo);
+ if (be32_to_cpu(free->hdr.firstdb) != xfs_dir2_da_to_db(mp->m_dir_geo,
+ dabno - mp->m_dir_geo->freeblk) * maxent) {
if (!sflag || v)
- dbprintf("bad free block firstdb %d for dir ino %lld "
- "block %d\n",
+ dbprintf(_("bad free block firstdb %d for dir ino %lld "
+ "block %d\n"),
be32_to_cpu(free->hdr.firstdb), id->ino, dabno);
error++;
return;
be32_to_cpu(free->hdr.nused) >
be32_to_cpu(free->hdr.nvalid)) {
if (!sflag || v)
- dbprintf("bad free block nvalid/nused %d/%d for dir "
- "ino %lld block %d\n",
+ dbprintf(_("bad free block nvalid/nused %d/%d for dir "
+ "ino %lld block %d\n"),
be32_to_cpu(free->hdr.nvalid),
be32_to_cpu(free->hdr.nused), id->ino, dabno);
error++;
ent = freetab->ents[be32_to_cpu(free->hdr.firstdb) + i];
if (ent != be16_to_cpu(free->bests[i])) {
if (!sflag || v)
- dbprintf("bad free block ent %d is %d should "
- "be %d for dir ino %lld block %d\n",
+ dbprintf(_("bad free block ent %d is %d should "
+ "be %d for dir ino %lld block %d\n"),
i, be16_to_cpu(free->bests[i]), ent,
id->ino, dabno);
error++;
}
if (used != be32_to_cpu(free->hdr.nused)) {
if (!sflag || v)
- dbprintf("bad free block nused %d should be %d for dir "
- "ino %lld block %d\n",
+ dbprintf(_("bad free block nused %d should be %d for dir "
+ "ino %lld block %d\n"),
be32_to_cpu(free->hdr.nused), used, id->ino,
dabno);
error++;
xfs_dir2_leaf_tail_t *ltp;
xfs_da_intnode_t *node;
int stale;
+ struct xfs_da3_icnode_hdr nodehdr;
leaf = iocur_top->data;
switch (be16_to_cpu(leaf->hdr.info.magic)) {
if (be32_to_cpu(leaf->hdr.info.forw) ||
be32_to_cpu(leaf->hdr.info.back)) {
if (!sflag || v)
- dbprintf("bad leaf block forw/back pointers "
- "%d/%d for dir ino %lld block %d\n",
+ dbprintf(_("bad leaf block forw/back pointers "
+ "%d/%d for dir ino %lld block %d\n"),
be32_to_cpu(leaf->hdr.info.forw),
be32_to_cpu(leaf->hdr.info.back),
id->ino, dabno);
error++;
}
- if (dabno != mp->m_dirleafblk) {
+ if (dabno != mp->m_dir_geo->leafblk) {
if (!sflag || v)
- dbprintf("single leaf block for dir ino %lld "
- "block %d should be at block %d\n",
+ dbprintf(_("single leaf block for dir ino %lld "
+ "block %d should be at block %d\n"),
id->ino, dabno,
- (xfs_dablk_t)mp->m_dirleafblk);
+ (xfs_dablk_t)mp->m_dir_geo->leafblk);
error++;
}
- ltp = xfs_dir2_leaf_tail_p(mp, leaf);
+ ltp = xfs_dir2_leaf_tail_p(mp->m_dir_geo, leaf);
lbp = xfs_dir2_leaf_bests_p(ltp);
for (i = 0; i < be32_to_cpu(ltp->bestcount); i++) {
if (freetab->nents <= i || freetab->ents[i] !=
be16_to_cpu(lbp[i])) {
if (!sflag || v)
- dbprintf("bestfree %d for dir ino %lld "
+ dbprintf(_("bestfree %d for dir ino %lld "
"block %d doesn't match table "
- "value %d\n",
+ "value %d\n"),
freetab->nents <= i ?
NULLDATAOFF :
freetab->ents[i],
id->ino,
- xfs_dir2_db_to_da(mp, i),
+ xfs_dir2_db_to_da(mp->m_dir_geo, i),
be16_to_cpu(lbp[i]));
}
if (freetab->nents > i)
break;
case XFS_DA_NODE_MAGIC:
node = iocur_top->data;
- if (be16_to_cpu(node->hdr.level) < 1 ||
- be16_to_cpu(node->hdr.level) >
- XFS_DA_NODE_MAXDEPTH) {
+ M_DIROPS(mp)->node_hdr_from_disk(&nodehdr, node);
+ if (nodehdr.level < 1 || nodehdr.level > XFS_DA_NODE_MAXDEPTH) {
if (!sflag || v)
- dbprintf("bad node block level %d for dir ino "
- "%lld block %d\n",
- be16_to_cpu(node->hdr.level), id->ino,
+ dbprintf(_("bad node block level %d for dir ino "
+ "%lld block %d\n"),
+ nodehdr.level, id->ino,
dabno);
error++;
}
return;
default:
if (!sflag || v)
- dbprintf("bad directory data magic # %#x for dir ino "
- "%lld block %d\n",
+ dbprintf(_("bad directory data magic # %#x for dir ino "
+ "%lld block %d\n"),
be16_to_cpu(leaf->hdr.info.magic), id->ino,
dabno);
error++;
return;
}
- lep = leaf->ents;
+ lep = M_DIROPS(mp)->leaf_ents_p(leaf);
for (i = stale = 0; i < be16_to_cpu(leaf->hdr.count); i++) {
if (be32_to_cpu(lep[i].address) == XFS_DIR2_NULL_DATAPTR)
stale++;
else if (dir_hash_see(be32_to_cpu(lep[i].hashval),
be32_to_cpu(lep[i].address))) {
if (!sflag || v)
- dbprintf("dir %lld block %d extra leaf entry "
- "%x %x\n", id->ino, dabno,
+ dbprintf(_("dir %lld block %d extra leaf entry "
+ "%x %x\n"), id->ino, dabno,
be32_to_cpu(lep[i].hashval),
be32_to_cpu(lep[i].address));
error++;
}
if (stale != be16_to_cpu(leaf->hdr.stale)) {
if (!sflag || v)
- dbprintf("dir %lld block %d stale mismatch "
- "%d/%d\n",
+ dbprintf(_("dir %lld block %d stale mismatch "
+ "%d/%d\n"),
id->ino, dabno, stale,
be16_to_cpu(leaf->hdr.stale));
error++;
}
}
-static xfs_ino_t
-process_node_dir_v1(
- blkmap_t *blkmap,
- int *dot,
- int *dotdot,
- inodata_t *id)
-{
- xfs_fsblock_t bno;
- xfs_fileoff_t dbno;
- xfs_ino_t lino;
- xfs_ino_t parent;
- int t;
- int v;
- int v2;
-
- v = verbose || id->ilist;
- parent = 0;
- dbno = NULLFILEOFF;
- push_cur();
- while ((dbno = blkmap_next_off(blkmap, dbno, &t)) != NULLFILEOFF) {
- bno = blkmap_get(blkmap, dbno);
- v2 = bno != NULLFSBLOCK && CHECK_BLIST(bno);
- if (bno == NULLFSBLOCK && dbno == 0) {
- if (!sflag || v)
- dbprintf("can't read root block for directory "
- "inode %lld\n",
- id->ino);
- error++;
- }
- if (v || v2)
- dbprintf("dir inode %lld block %u=%llu\n", id->ino,
- (__uint32_t)dbno, (xfs_dfsbno_t)bno);
- if (bno == NULLFSBLOCK)
- continue;
- pop_cur();
- push_cur();
- set_cur(&typtab[TYP_DIR], XFS_FSB_TO_DADDR(mp, bno), blkbb,
- DB_RING_IGN, NULL);
- if (iocur_top->data == NULL) {
- if (!sflag || v || v2)
- dbprintf("can't read block %u for directory "
- "inode %lld\n",
- (__uint32_t)dbno, id->ino);
- error++;
- continue;
- }
- if (be16_to_cpu(((xfs_da_intnode_t *)iocur_top->data)->
- hdr.info.magic) == XFS_DA_NODE_MAGIC)
- continue;
- lino = process_leaf_dir_v1_int(dot, dotdot, id);
- if (lino) {
- if (parent) {
- if (!sflag || v || v2)
- dbprintf("multiple .. entries in dir "
- "%lld\n",
- id->ino);
- error++;
- } else
- parent = lino;
- }
- }
- pop_cur();
- return parent;
-}
-
static void
process_quota(
qtype_t qtype,
xfs_fileoff_t qbno;
char *s = NULL;
int scicb;
- int t;
+ int t = 0;
switch (qtype) {
case IS_USER_QUOTA:
DB_RING_IGN, NULL);
if ((dqb = iocur_top->data) == NULL) {
if (scicb)
- dbprintf("can't read block %lld for %s quota "
- "inode (fsblock %lld)\n",
- (xfs_dfiloff_t)qbno, s,
- (xfs_dfsbno_t)bno);
+ dbprintf(_("can't read block %lld for %s quota "
+ "inode (fsblock %lld)\n"),
+ (xfs_fileoff_t)qbno, s,
+ (xfs_fsblock_t)bno);
error++;
pop_cur();
continue;
}
for (i = 0; i < perblock; i++, dqid++, dqb++) {
if (verbose || id->ilist || cb)
- dbprintf("%s dqblk %lld entry %d id %u bc "
- "%lld ic %lld rc %lld\n",
- s, (xfs_dfiloff_t)qbno, i, dqid,
+ dbprintf(_("%s dqblk %lld entry %d id %u bc "
+ "%lld ic %lld rc %lld\n"),
+ s, (xfs_fileoff_t)qbno, i, dqid,
be64_to_cpu(dqb->dd_diskdq.d_bcount),
be64_to_cpu(dqb->dd_diskdq.d_icount),
be64_to_cpu(dqb->dd_diskdq.d_rtbcount));
if (be16_to_cpu(dqb->dd_diskdq.d_magic) != XFS_DQUOT_MAGIC) {
if (scicb)
- dbprintf("bad magic number %#x for %s "
- "dqblk %lld entry %d id %u\n",
+ dbprintf(_("bad magic number %#x for %s "
+ "dqblk %lld entry %d id %u\n"),
be16_to_cpu(dqb->dd_diskdq.d_magic), s,
- (xfs_dfiloff_t)qbno, i, dqid);
+ (xfs_fileoff_t)qbno, i, dqid);
error++;
continue;
}
if (dqb->dd_diskdq.d_version != XFS_DQUOT_VERSION) {
if (scicb)
- dbprintf("bad version number %#x for "
+ dbprintf(_("bad version number %#x for "
"%s dqblk %lld entry %d id "
- "%u\n",
+ "%u\n"),
dqb->dd_diskdq.d_version, s,
- (xfs_dfiloff_t)qbno, i, dqid);
+ (xfs_fileoff_t)qbno, i, dqid);
error++;
continue;
}
if (dqb->dd_diskdq.d_flags != exp_flags) {
if (scicb)
- dbprintf("bad flags %#x for %s dqblk "
- "%lld entry %d id %u\n",
+ dbprintf(_("bad flags %#x for %s dqblk "
+ "%lld entry %d id %u\n"),
dqb->dd_diskdq.d_flags, s,
- (xfs_dfiloff_t)qbno, i, dqid);
+ (xfs_fileoff_t)qbno, i, dqid);
error++;
continue;
}
if (be32_to_cpu(dqb->dd_diskdq.d_id) != dqid) {
if (scicb)
- dbprintf("bad id %u for %s dqblk %lld "
- "entry %d id %u\n",
+ dbprintf(_("bad id %u for %s dqblk %lld "
+ "entry %d id %u\n"),
be32_to_cpu(dqb->dd_diskdq.d_id), s,
- (xfs_dfiloff_t)qbno, i, dqid);
+ (xfs_fileoff_t)qbno, i, dqid);
error++;
continue;
}
int bitsperblock;
xfs_fileoff_t bmbno;
xfs_fsblock_t bno;
- xfs_drtbno_t extno;
+ xfs_rtblock_t extno;
int len;
int log;
int offs;
int prevbit;
- xfs_drfsbno_t rtbno;
+ xfs_rfsblock_t rtbno;
int start_bmbno;
int start_bit;
int t;
bno = blkmap_get(blkmap, bmbno);
if (bno == NULLFSBLOCK) {
if (!sflag)
- dbprintf("block %lld for rtbitmap inode is "
- "missing\n",
- (xfs_dfiloff_t)bmbno);
+ dbprintf(_("block %lld for rtbitmap inode is "
+ "missing\n"),
+ (xfs_fileoff_t)bmbno);
error++;
continue;
}
DB_RING_IGN, NULL);
if ((words = iocur_top->data) == NULL) {
if (!sflag)
- dbprintf("can't read block %lld for rtbitmap "
- "inode\n",
- (xfs_dfiloff_t)bmbno);
+ dbprintf(_("can't read block %lld for rtbitmap "
+ "inode\n"),
+ (xfs_fileoff_t)bmbno);
error++;
pop_cur();
continue;
bno = blkmap_get(blkmap, sumbno);
if (bno == NULLFSBLOCK) {
if (!sflag)
- dbprintf("block %lld for rtsummary inode is "
- "missing\n",
- (xfs_dfiloff_t)sumbno);
+ dbprintf(_("block %lld for rtsummary inode is "
+ "missing\n"),
+ (xfs_fileoff_t)sumbno);
error++;
continue;
}
blkbb, DB_RING_IGN, NULL);
if ((bytes = iocur_top->data) == NULL) {
if (!sflag)
- dbprintf("can't read block %lld for rtsummary "
- "inode\n",
- (xfs_dfiloff_t)sumbno);
+ dbprintf(_("can't read block %lld for rtsummary "
+ "inode\n"),
+ (xfs_fileoff_t)sumbno);
error++;
pop_cur();
continue;
int i8;
xfs_ino_t lino;
int offset;
- xfs_dir2_sf_t *sf;
+ struct xfs_dir2_sf_hdr *sf;
xfs_dir2_sf_entry_t *sfe;
int v;
- sf = (xfs_dir2_sf_t *)XFS_DFORK_DPTR(dip);
+ sf = (struct xfs_dir2_sf_hdr *)XFS_DFORK_DPTR(dip);
addlink_inode(id);
v = verbose || id->ilist;
if (v)
- dbprintf("dir %lld entry . %lld\n", id->ino, id->ino);
+ dbprintf(_("dir %lld entry . %lld\n"), id->ino, id->ino);
(*dot)++;
sfe = xfs_dir2_sf_firstentry(sf);
- offset = XFS_DIR2_DATA_FIRST_OFFSET;
- for (i = sf->hdr.count - 1, i8 = 0; i >= 0; i--) {
- if ((__psint_t)sfe + xfs_dir2_sf_entsize_byentry(sf, sfe) -
- (__psint_t)sf > be64_to_cpu(dip->di_core.di_size)) {
+ offset = M_DIROPS(mp)->data_first_offset;
+ for (i = sf->count - 1, i8 = 0; i >= 0; i--) {
+ if ((__psint_t)sfe + M_DIROPS(mp)->sf_entsize(sf, sfe->namelen) -
+ (__psint_t)sf > be64_to_cpu(dip->di_size)) {
if (!sflag)
- dbprintf("dir %llu bad size in entry at %d\n",
+ dbprintf(_("dir %llu bad size in entry at %d\n"),
id->ino,
(int)((char *)sfe - (char *)sf));
error++;
break;
}
- lino = xfs_dir2_sf_get_inumber(sf, xfs_dir2_sf_inumberp(sfe));
+ lino = M_DIROPS(mp)->sf_get_ino(sf, sfe);
if (lino > XFS_DIR2_MAX_SHORT_INUM)
i8++;
cid = find_inode(lino, 1);
if (cid == NULL) {
if (!sflag)
- dbprintf("dir %lld entry %*.*s bad inode "
- "number %lld\n",
+ dbprintf(_("dir %lld entry %*.*s bad inode "
+ "number %lld\n"),
id->ino, sfe->namelen, sfe->namelen,
sfe->name, lino);
error++;
addname_inode(cid, (char *)sfe->name, sfe->namelen);
}
if (v)
- dbprintf("dir %lld entry %*.*s offset %d %lld\n",
+ dbprintf(_("dir %lld entry %*.*s offset %d %lld\n"),
id->ino, sfe->namelen, sfe->namelen, sfe->name,
xfs_dir2_sf_get_offset(sfe), lino);
if (xfs_dir2_sf_get_offset(sfe) < offset) {
if (!sflag)
- dbprintf("dir %lld entry %*.*s bad offset %d\n",
+ dbprintf(_("dir %lld entry %*.*s bad offset %d\n"),
id->ino, sfe->namelen, sfe->namelen,
sfe->name, xfs_dir2_sf_get_offset(sfe));
error++;
}
offset =
xfs_dir2_sf_get_offset(sfe) +
- xfs_dir2_data_entsize(sfe->namelen);
- sfe = xfs_dir2_sf_nextentry(sf, sfe);
+ M_DIROPS(mp)->sf_entsize(sf, sfe->namelen);
+ sfe = M_DIROPS(mp)->sf_nextentry(sf, sfe);
}
if (i < 0 && (__psint_t)sfe - (__psint_t)sf !=
- be64_to_cpu(dip->di_core.di_size)) {
+ be64_to_cpu(dip->di_size)) {
if (!sflag)
- dbprintf("dir %llu size is %lld, should be %u\n",
- id->ino, be64_to_cpu(dip->di_core.di_size),
+ dbprintf(_("dir %llu size is %lld, should be %u\n"),
+ id->ino, be64_to_cpu(dip->di_size),
(uint)((char *)sfe - (char *)sf));
error++;
}
- if (offset + (sf->hdr.count + 2) * sizeof(xfs_dir2_leaf_entry_t) +
- sizeof(xfs_dir2_block_tail_t) > mp->m_dirblksize) {
+ if (offset + (sf->count + 2) * sizeof(xfs_dir2_leaf_entry_t) +
+ sizeof(xfs_dir2_block_tail_t) > mp->m_dir_geo->blksize) {
if (!sflag)
- dbprintf("dir %llu offsets too high\n", id->ino);
+ dbprintf(_("dir %llu offsets too high\n"), id->ino);
error++;
}
- lino = xfs_dir2_sf_get_inumber(sf, &sf->hdr.parent);
+ lino = M_DIROPS(mp)->sf_get_parent_ino(sf);
if (lino > XFS_DIR2_MAX_SHORT_INUM)
i8++;
cid = find_inode(lino, 1);
addlink_inode(cid);
else {
if (!sflag)
- dbprintf("dir %lld entry .. bad inode number %lld\n",
+ dbprintf(_("dir %lld entry .. bad inode number %lld\n"),
id->ino, lino);
error++;
}
if (v)
- dbprintf("dir %lld entry .. %lld\n", id->ino, lino);
- if (i8 != sf->hdr.i8count) {
+ dbprintf(_("dir %lld entry .. %lld\n"), id->ino, lino);
+ if (i8 != sf->i8count) {
if (!sflag)
- dbprintf("dir %lld i8count mismatch is %d should be "
- "%d\n",
- id->ino, sf->hdr.i8count, i8);
+ dbprintf(_("dir %lld i8count mismatch is %d should be "
+ "%d\n"),
+ id->ino, sf->i8count, i8);
error++;
}
(*dotdot)++;
return cid ? lino : NULLFSINO;
}
-static xfs_ino_t
-process_shortform_dir_v1(
- xfs_dinode_t *dip,
- int *dot,
- int *dotdot,
- inodata_t *id)
-{
- inodata_t *cid;
- int i;
- xfs_ino_t lino;
- xfs_dir_shortform_t *sf;
- xfs_dir_sf_entry_t *sfe;
- int v;
-
- sf = (xfs_dir_shortform_t *)XFS_DFORK_DPTR(dip);
- addlink_inode(id);
- v = verbose || id->ilist;
- if (v)
- dbprintf("dir %lld entry . %lld\n", id->ino, id->ino);
- (*dot)++;
- sfe = &sf->list[0];
- for (i = sf->hdr.count - 1; i >= 0; i--) {
- lino = XFS_GET_DIR_INO8(sfe->inumber);
- cid = find_inode(lino, 1);
- if (cid == NULL) {
- if (!sflag)
- dbprintf("dir %lld entry %*.*s bad inode "
- "number %lld\n",
- id->ino, sfe->namelen, sfe->namelen,
- sfe->name, lino);
- error++;
- } else {
- addlink_inode(cid);
- if (!cid->parent)
- cid->parent = id;
- addname_inode(cid, (char *)sfe->name, sfe->namelen);
- }
- if (v)
- dbprintf("dir %lld entry %*.*s %lld\n", id->ino,
- sfe->namelen, sfe->namelen, sfe->name, lino);
- sfe = xfs_dir_sf_nextentry(sfe);
- }
- if ((__psint_t)sfe - (__psint_t)sf != be64_to_cpu(dip->di_core.di_size))
- dbprintf("dir %llu size is %lld, should be %d\n",
- id->ino, be64_to_cpu(dip->di_core.di_size),
- (int)((char *)sfe - (char *)sf));
- lino = XFS_GET_DIR_INO8(sf->hdr.parent);
- cid = find_inode(lino, 1);
- if (cid)
- addlink_inode(cid);
- else {
- if (!sflag)
- dbprintf("dir %lld entry .. bad inode number %lld\n",
- id->ino, lino);
- error++;
- }
- if (v)
- dbprintf("dir %lld entry .. %lld\n", id->ino, lino);
- (*dotdot)++;
- return cid ? lino : NULLFSINO;
-}
static void
quota_add(
qp->count.ic != qp->dq.ic ||
qp->count.rc != qp->dq.rc) {
if (!sflag) {
- dbprintf("%s quota id %u, have/exp",
+ dbprintf(_("%s quota id %u, have/exp"),
s, qp->id);
if (qp->count.bc != qp->dq.bc)
- dbprintf(" bc %lld/%lld",
+ dbprintf(_(" bc %lld/%lld"),
qp->dq.bc,
qp->count.bc);
if (qp->count.ic != qp->dq.ic)
- dbprintf(" ic %lld/%lld",
+ dbprintf(_(" ic %lld/%lld"),
qp->dq.ic,
qp->count.ic);
if (qp->count.rc != qp->dq.rc)
- dbprintf(" rc %lld/%lld",
+ dbprintf(_(" rc %lld/%lld"),
qp->dq.rc,
qp->count.rc);
dbprintf("\n");
qgdo = mp->m_sb.sb_gquotino != 0 &&
mp->m_sb.sb_gquotino != NULLFSINO &&
(mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT) &&
- (mp->m_sb.sb_qflags & XFS_OQUOTA_CHKD);
- qpdo = mp->m_sb.sb_gquotino != 0 &&
- mp->m_sb.sb_gquotino != NULLFSINO &&
+ (mp->m_sb.sb_qflags & XFS_GQUOTA_CHKD);
+ qpdo = mp->m_sb.sb_pquotino != 0 &&
+ mp->m_sb.sb_pquotino != NULLFSINO &&
(mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT) &&
- (mp->m_sb.sb_qflags & XFS_OQUOTA_CHKD);
+ (mp->m_sb.sb_qflags & XFS_PQUOTA_CHKD);
if (qudo)
qudata = xcalloc(QDATA_HASH_SIZE, sizeof(qdata_t *));
if (qgdo)
XFS_FSS_TO_BB(mp, 1), DB_RING_IGN, NULL);
if (!iocur_top->data) {
- dbprintf("can't read superblock for ag %u\n", agno);
+ dbprintf(_("can't read superblock for ag %u\n"), agno);
serious_error++;
goto pop1_out;
}
if (sb->sb_magicnum != XFS_SB_MAGIC) {
if (!sflag)
- dbprintf("bad sb magic # %#x in ag %u\n",
+ dbprintf(_("bad sb magic # %#x in ag %u\n"),
sb->sb_magicnum, agno);
error++;
}
if (!xfs_sb_good_version(sb)) {
if (!sflag)
- dbprintf("bad sb version # %#x in ag %u\n",
+ dbprintf(_("bad sb version # %#x in ag %u\n"),
sb->sb_versionnum, agno);
error++;
sbver_err++;
}
if (agno == 0 && sb->sb_inprogress != 0) {
if (!sflag)
- dbprintf("mkfs not completed successfully\n");
+ dbprintf(_("mkfs not completed successfully\n"));
error++;
}
set_dbmap(agno, XFS_SB_BLOCK(mp), 1, DBM_SB, agno, XFS_SB_BLOCK(mp));
XFS_AG_DADDR(mp, agno, XFS_AGF_DADDR(mp)),
XFS_FSS_TO_BB(mp, 1), DB_RING_IGN, NULL);
if ((agf = iocur_top->data) == NULL) {
- dbprintf("can't read agf block for ag %u\n", agno);
+ dbprintf(_("can't read agf block for ag %u\n"), agno);
serious_error++;
goto pop2_out;
}
if (be32_to_cpu(agf->agf_magicnum) != XFS_AGF_MAGIC) {
if (!sflag)
- dbprintf("bad agf magic # %#x in ag %u\n",
+ dbprintf(_("bad agf magic # %#x in ag %u\n"),
be32_to_cpu(agf->agf_magicnum), agno);
error++;
}
if (!XFS_AGF_GOOD_VERSION(be32_to_cpu(agf->agf_versionnum))) {
if (!sflag)
- dbprintf("bad agf version # %#x in ag %u\n",
+ dbprintf(_("bad agf version # %#x in ag %u\n"),
be32_to_cpu(agf->agf_versionnum), agno);
error++;
}
XFS_AG_DADDR(mp, agno, XFS_AGI_DADDR(mp)),
XFS_FSS_TO_BB(mp, 1), DB_RING_IGN, NULL);
if ((agi = iocur_top->data) == NULL) {
- dbprintf("can't read agi block for ag %u\n", agno);
+ dbprintf(_("can't read agi block for ag %u\n"), agno);
serious_error++;
goto pop3_out;
}
if (be32_to_cpu(agi->agi_magicnum) != XFS_AGI_MAGIC) {
if (!sflag)
- dbprintf("bad agi magic # %#x in ag %u\n",
+ dbprintf(_("bad agi magic # %#x in ag %u\n"),
be32_to_cpu(agi->agi_magicnum), agno);
error++;
}
if (!XFS_AGI_GOOD_VERSION(be32_to_cpu(agi->agi_versionnum))) {
if (!sflag)
- dbprintf("bad agi version # %#x in ag %u\n",
+ dbprintf(_("bad agi version # %#x in ag %u\n"),
be32_to_cpu(agi->agi_versionnum), agno);
error++;
}
1, scanfunc_ino, TYP_INOBT);
if (be32_to_cpu(agf->agf_freeblks) != agffreeblks) {
if (!sflag)
- dbprintf("agf_freeblks %u, counted %u in ag %u\n",
+ dbprintf(_("agf_freeblks %u, counted %u in ag %u\n"),
be32_to_cpu(agf->agf_freeblks),
agffreeblks, agno);
error++;
}
if (be32_to_cpu(agf->agf_longest) != agflongest) {
if (!sflag)
- dbprintf("agf_longest %u, counted %u in ag %u\n",
+ dbprintf(_("agf_longest %u, counted %u in ag %u\n"),
be32_to_cpu(agf->agf_longest),
agflongest, agno);
error++;
if (lazycount &&
be32_to_cpu(agf->agf_btreeblks) != agfbtreeblks) {
if (!sflag)
- dbprintf("agf_btreeblks %u, counted %u in ag %u\n",
+ dbprintf(_("agf_btreeblks %u, counted %u in ag %u\n"),
be32_to_cpu(agf->agf_btreeblks),
agfbtreeblks, agno);
error++;
agf_aggr_freeblks += agffreeblks + agfbtreeblks;
if (be32_to_cpu(agi->agi_count) != agicount) {
if (!sflag)
- dbprintf("agi_count %u, counted %u in ag %u\n",
+ dbprintf(_("agi_count %u, counted %u in ag %u\n"),
be32_to_cpu(agi->agi_count),
agicount, agno);
error++;
}
if (be32_to_cpu(agi->agi_freecount) != agifreecount) {
if (!sflag)
- dbprintf("agi_freecount %u, counted %u in ag %u\n",
+ dbprintf(_("agi_freecount %u, counted %u in ag %u\n"),
be32_to_cpu(agi->agi_freecount),
agifreecount, agno);
error++;
if (be32_to_cpu(agi->agi_unlinked[i]) != NULLAGINO) {
if (!sflag) {
xfs_agino_t agino=be32_to_cpu(agi->agi_unlinked[i]);
- dbprintf("agi unlinked bucket %d is %u in ag "
- "%u (inode=%lld)\n", i, agino, agno,
+ dbprintf(_("agi unlinked bucket %d is %u in ag "
+ "%u (inode=%lld)\n"), i, agino, agno,
XFS_AGINO_TO_INO(mp, agno, agino));
}
error++;
xfs_agblock_t bno;
uint count;
int i;
+ __be32 *freelist;
if (XFS_SB_BLOCK(mp) != XFS_AGFL_BLOCK(mp) &&
XFS_AGF_BLOCK(mp) != XFS_AGFL_BLOCK(mp) &&
XFS_AG_DADDR(mp, seqno, XFS_AGFL_DADDR(mp)),
XFS_FSS_TO_BB(mp, 1), DB_RING_IGN, NULL);
if ((agfl = iocur_top->data) == NULL) {
- dbprintf("can't read agfl block for ag %u\n", seqno);
+ dbprintf(_("can't read agfl block for ag %u\n"), seqno);
serious_error++;
pop_cur();
return;
}
i = be32_to_cpu(agf->agf_flfirst);
+
+ /* verify agf values before proceeding */
+ if (be32_to_cpu(agf->agf_flfirst) >= XFS_AGFL_SIZE(mp) ||
+ be32_to_cpu(agf->agf_fllast) >= XFS_AGFL_SIZE(mp)) {
+ dbprintf(_("agf %d freelist blocks bad, skipping "
+ "freelist scan\n"), i);
+ pop_cur();
+ return;
+ }
+
+ /* open coded XFS_BUF_TO_AGFL_BNO */
+ freelist = xfs_sb_version_hascrc(&((mp)->m_sb)) ? &agfl->agfl_bno[0]
+ : (__be32 *)agfl;
count = 0;
for (;;) {
- bno = be32_to_cpu(agfl->agfl_bno[i]);
+ bno = be32_to_cpu(freelist[i]);
set_dbmap(seqno, bno, 1, DBM_FREELIST, seqno,
XFS_AGFL_BLOCK(mp));
count++;
}
if (count != be32_to_cpu(agf->agf_flcount)) {
if (!sflag)
- dbprintf("freeblk count %u != flcount %u in ag %u\n",
+ dbprintf(_("freeblk count %u != flcount %u in ag %u\n"),
count, be32_to_cpu(agf->agf_flcount),
seqno);
error++;
scan_lbtree_f_t func,
dbm_t type,
inodata_t *id,
- xfs_drfsbno_t *totd,
- xfs_drfsbno_t *toti,
+ xfs_rfsblock_t *totd,
+ xfs_rfsblock_t *toti,
xfs_extnum_t *nex,
blkmap_t **blkmapp,
int isroot,
NULL);
if (iocur_top->data == NULL) {
if (!sflag)
- dbprintf("can't read btree block %u/%u\n",
+ dbprintf(_("can't read btree block %u/%u\n"),
XFS_FSB_TO_AGNO(mp, root),
XFS_FSB_TO_AGBNO(mp, root));
error++;
XFS_AGB_TO_DADDR(mp, seqno, root), blkbb, DB_RING_IGN, NULL);
if (iocur_top->data == NULL) {
if (!sflag)
- dbprintf("can't read btree block %u/%u\n", seqno, root);
+ dbprintf(_("can't read btree block %u/%u\n"), seqno, root);
error++;
pop_cur();
return;
dbm_t type,
xfs_fsblock_t bno,
inodata_t *id,
- xfs_drfsbno_t *totd,
- xfs_drfsbno_t *toti,
+ xfs_rfsblock_t *totd,
+ xfs_rfsblock_t *toti,
xfs_extnum_t *nex,
blkmap_t **blkmapp,
int isroot,
xfs_agnumber_t agno;
int i;
xfs_bmbt_ptr_t *pp;
- xfs_bmbt_rec_32_t *rp;
+ xfs_bmbt_rec_t *rp;
agno = XFS_FSB_TO_AGNO(mp, bno);
agbno = XFS_FSB_TO_AGBNO(mp, bno);
if (be32_to_cpu(block->bb_magic) != XFS_BMAP_MAGIC) {
if (!sflag || id->ilist || CHECK_BLIST(bno))
- dbprintf("bad magic # %#x in inode %lld bmbt block "
- "%u/%u\n",
+ dbprintf(_("bad magic # %#x in inode %lld bmbt block "
+ "%u/%u\n"),
be32_to_cpu(block->bb_magic), id->ino, agno, agbno);
error++;
}
if (be16_to_cpu(block->bb_level) != level) {
if (!sflag || id->ilist || CHECK_BLIST(bno))
- dbprintf("expected level %d got %d in inode %lld bmbt "
- "block %u/%u\n",
+ dbprintf(_("expected level %d got %d in inode %lld bmbt "
+ "block %u/%u\n"),
level, be16_to_cpu(block->bb_level), id->ino, agno, agbno);
error++;
}
if (be16_to_cpu(block->bb_numrecs) > mp->m_bmap_dmxr[0] ||
(isroot == 0 && be16_to_cpu(block->bb_numrecs) < mp->m_bmap_dmnr[0])) {
if (!sflag || id->ilist || CHECK_BLIST(bno))
- dbprintf("bad btree nrecs (%u, min=%u, max=%u) "
- "in inode %lld bmap block %lld\n",
+ dbprintf(_("bad btree nrecs (%u, min=%u, max=%u) "
+ "in inode %lld bmap block %lld\n"),
be16_to_cpu(block->bb_numrecs), mp->m_bmap_dmnr[0],
mp->m_bmap_dmxr[0], id->ino,
- (xfs_dfsbno_t)bno);
+ (xfs_fsblock_t)bno);
error++;
return;
}
- rp = (xfs_bmbt_rec_32_t *)XFS_BMBT_REC_ADDR(mp, block, 1);
+ rp = XFS_BMBT_REC_ADDR(mp, block, 1);
*nex += be16_to_cpu(block->bb_numrecs);
process_bmbt_reclist(rp, be16_to_cpu(block->bb_numrecs), type, id, totd,
blkmapp);
if (be16_to_cpu(block->bb_numrecs) > mp->m_bmap_dmxr[1] ||
(isroot == 0 && be16_to_cpu(block->bb_numrecs) < mp->m_bmap_dmnr[1])) {
if (!sflag || id->ilist || CHECK_BLIST(bno))
- dbprintf("bad btree nrecs (%u, min=%u, max=%u) in "
- "inode %lld bmap block %lld\n",
+ dbprintf(_("bad btree nrecs (%u, min=%u, max=%u) in "
+ "inode %lld bmap block %lld\n"),
be16_to_cpu(block->bb_numrecs), mp->m_bmap_dmnr[1],
- mp->m_bmap_dmxr[1], id->ino, (xfs_dfsbno_t)bno);
+ mp->m_bmap_dmxr[1], id->ino, (xfs_fsblock_t)bno);
error++;
return;
}
xfs_agblock_t lastblock;
if (be32_to_cpu(block->bb_magic) != XFS_ABTB_MAGIC) {
- dbprintf("bad magic # %#x in btbno block %u/%u\n",
+ dbprintf(_("bad magic # %#x in btbno block %u/%u\n"),
be32_to_cpu(block->bb_magic), seqno, bno);
serious_error++;
return;
agfbtreeblks++;
if (be16_to_cpu(block->bb_level) != level) {
if (!sflag)
- dbprintf("expected level %d got %d in btbno block "
- "%u/%u\n",
+ dbprintf(_("expected level %d got %d in btbno block "
+ "%u/%u\n"),
level, be16_to_cpu(block->bb_level), seqno, bno);
error++;
}
if (level == 0) {
if (be16_to_cpu(block->bb_numrecs) > mp->m_alloc_mxr[0] ||
(isroot == 0 && be16_to_cpu(block->bb_numrecs) < mp->m_alloc_mnr[0])) {
- dbprintf("bad btree nrecs (%u, min=%u, max=%u) in "
- "btbno block %u/%u\n",
+ dbprintf(_("bad btree nrecs (%u, min=%u, max=%u) in "
+ "btbno block %u/%u\n"),
be16_to_cpu(block->bb_numrecs), mp->m_alloc_mnr[0],
mp->m_alloc_mxr[0], seqno, bno);
serious_error++;
be32_to_cpu(rp[i].ar_blockcount), DBM_FREE1,
seqno, bno);
if (be32_to_cpu(rp[i].ar_startblock) <= lastblock) {
- dbprintf(
- "out-of-order bno btree record %d (%u %u) block %u/%u\n",
+ dbprintf(_(
+ "out-of-order bno btree record %d (%u %u) block %u/%u\n"),
i, be32_to_cpu(rp[i].ar_startblock),
be32_to_cpu(rp[i].ar_blockcount),
be32_to_cpu(agf->agf_seqno), bno);
}
if (be16_to_cpu(block->bb_numrecs) > mp->m_alloc_mxr[1] ||
(isroot == 0 && be16_to_cpu(block->bb_numrecs) < mp->m_alloc_mnr[1])) {
- dbprintf("bad btree nrecs (%u, min=%u, max=%u) in btbno block "
- "%u/%u\n",
+ dbprintf(_("bad btree nrecs (%u, min=%u, max=%u) in btbno block "
+ "%u/%u\n"),
be16_to_cpu(block->bb_numrecs), mp->m_alloc_mnr[1],
mp->m_alloc_mxr[1], seqno, bno);
serious_error++;
xfs_extlen_t lastcount;
if (be32_to_cpu(block->bb_magic) != XFS_ABTC_MAGIC) {
- dbprintf("bad magic # %#x in btcnt block %u/%u\n",
+ dbprintf(_("bad magic # %#x in btcnt block %u/%u\n"),
be32_to_cpu(block->bb_magic), seqno, bno);
serious_error++;
return;
agfbtreeblks++;
if (be16_to_cpu(block->bb_level) != level) {
if (!sflag)
- dbprintf("expected level %d got %d in btcnt block "
- "%u/%u\n",
+ dbprintf(_("expected level %d got %d in btcnt block "
+ "%u/%u\n"),
level, be16_to_cpu(block->bb_level), seqno, bno);
error++;
}
if (level == 0) {
if (be16_to_cpu(block->bb_numrecs) > mp->m_alloc_mxr[0] ||
(isroot == 0 && be16_to_cpu(block->bb_numrecs) < mp->m_alloc_mnr[0])) {
- dbprintf("bad btree nrecs (%u, min=%u, max=%u) in "
- "btbno block %u/%u\n",
+ dbprintf(_("bad btree nrecs (%u, min=%u, max=%u) in "
+ "btbno block %u/%u\n"),
be16_to_cpu(block->bb_numrecs), mp->m_alloc_mnr[0],
mp->m_alloc_mxr[0], seqno, bno);
serious_error++;
if (be32_to_cpu(rp[i].ar_blockcount) > agflongest)
agflongest = be32_to_cpu(rp[i].ar_blockcount);
if (be32_to_cpu(rp[i].ar_blockcount) < lastcount) {
- dbprintf(
- "out-of-order cnt btree record %d (%u %u) block %u/%u\n",
+ dbprintf(_(
+ "out-of-order cnt btree record %d (%u %u) block %u/%u\n"),
i, be32_to_cpu(rp[i].ar_startblock),
be32_to_cpu(rp[i].ar_blockcount),
be32_to_cpu(agf->agf_seqno), bno);
}
if (be16_to_cpu(block->bb_numrecs) > mp->m_alloc_mxr[1] ||
(isroot == 0 && be16_to_cpu(block->bb_numrecs) < mp->m_alloc_mnr[1])) {
- dbprintf("bad btree nrecs (%u, min=%u, max=%u) in btbno block "
- "%u/%u\n",
+ dbprintf(_("bad btree nrecs (%u, min=%u, max=%u) in btbno block "
+ "%u/%u\n"),
be16_to_cpu(block->bb_numrecs), mp->m_alloc_mnr[1],
mp->m_alloc_mxr[1], seqno, bno);
serious_error++;
xfs_inobt_rec_t *rp;
if (be32_to_cpu(block->bb_magic) != XFS_IBT_MAGIC) {
- dbprintf("bad magic # %#x in inobt block %u/%u\n",
+ dbprintf(_("bad magic # %#x in inobt block %u/%u\n"),
be32_to_cpu(block->bb_magic), seqno, bno);
serious_error++;
return;
}
if (be16_to_cpu(block->bb_level) != level) {
if (!sflag)
- dbprintf("expected level %d got %d in inobt block "
- "%u/%u\n",
+ dbprintf(_("expected level %d got %d in inobt block "
+ "%u/%u\n"),
level, be16_to_cpu(block->bb_level), seqno, bno);
error++;
}
if (level == 0) {
if (be16_to_cpu(block->bb_numrecs) > mp->m_inobt_mxr[0] ||
(isroot == 0 && be16_to_cpu(block->bb_numrecs) < mp->m_inobt_mnr[0])) {
- dbprintf("bad btree nrecs (%u, min=%u, max=%u) in "
- "inobt block %u/%u\n",
+ dbprintf(_("bad btree nrecs (%u, min=%u, max=%u) in "
+ "inobt block %u/%u\n"),
be16_to_cpu(block->bb_numrecs), mp->m_inobt_mnr[0],
mp->m_inobt_mxr[0], seqno, bno);
serious_error++;
set_cur(&typtab[TYP_INODE],
XFS_AGB_TO_DADDR(mp, seqno,
XFS_AGINO_TO_AGBNO(mp, agino)),
- (int)XFS_FSB_TO_BB(mp, XFS_IALLOC_BLOCKS(mp)),
+ (int)XFS_FSB_TO_BB(mp, mp->m_ialloc_blks),
DB_RING_IGN, NULL);
if (iocur_top->data == NULL) {
if (!sflag)
- dbprintf("can't read inode block "
- "%u/%u\n",
+ dbprintf(_("can't read inode block "
+ "%u/%u\n"),
seqno,
XFS_AGINO_TO_AGBNO(mp, agino));
error++;
}
if (nfree != be32_to_cpu(rp[i].ir_freecount)) {
if (!sflag)
- dbprintf("ir_freecount/free mismatch, "
+ dbprintf(_("ir_freecount/free mismatch, "
"inode chunk %u/%u, freecount "
- "%d nfree %d\n",
+ "%d nfree %d\n"),
seqno, agino,
be32_to_cpu(rp[i].ir_freecount), nfree);
error++;
}
if (be16_to_cpu(block->bb_numrecs) > mp->m_inobt_mxr[1] ||
(isroot == 0 && be16_to_cpu(block->bb_numrecs) < mp->m_inobt_mnr[1])) {
- dbprintf("bad btree nrecs (%u, min=%u, max=%u) in inobt block "
- "%u/%u\n",
+ dbprintf(_("bad btree nrecs (%u, min=%u, max=%u) in inobt block "
+ "%u/%u\n"),
be16_to_cpu(block->bb_numrecs), mp->m_inobt_mnr[1],
mp->m_inobt_mxr[1], seqno, bno);
serious_error++;
*idp = id;
if (mayprint &&
(verbose || id->ilist || CHECK_BLISTA(agno, agbno + i)))
- dbprintf("setting inode to %lld for block %u/%u\n",
+ dbprintf(_("setting inode to %lld for block %u/%u\n"),
id->ino, agno, agbno + i);
}
}
static void
set_rdbmap(
- xfs_drfsbno_t bno,
+ xfs_rfsblock_t bno,
xfs_extlen_t len,
dbm_t type)
{
static void
set_rinomap(
- xfs_drfsbno_t bno,
+ xfs_rfsblock_t bno,
xfs_extlen_t len,
inodata_t *id)
{
i++, idp++) {
*idp = id;
if (mayprint && (verbose || id->ilist || CHECK_BLIST(bno + i)))
- dbprintf("setting inode to %lld for rtblock %llu\n",
+ dbprintf(_("setting inode to %lld for rtblock %llu\n"),
id->ino, bno + i);
}
}
id->isdir = isdir;
id->security = security;
if (verbose || id->ilist)
- dbprintf("inode %lld nlink %u %s dir\n", id->ino, nlink,
+ dbprintf(_("inode %lld nlink %u %s dir\n"), id->ino, nlink,
isdir ? "is" : "not");
}