2
* Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
2
* Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
4
4
* This program is free software; you can redistribute it and/or modify it
5
5
* under the terms of version 2 of the GNU General Public License as
6
6
* published by the Free Software Foundation.
8
8
* This program is distributed in the hope that it would be useful, but
9
9
* WITHOUT ANY WARRANTY; without even the implied warranty of
10
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
12
* Further, this software is distributed without any warranty that it is
13
13
* free of the rightful claim of any third person regarding infringement
14
14
* or the like. Any license provided herein, whether implied or
15
15
* otherwise, applies only to this software file. Patent licenses, if
16
16
* any, provided herein do not apply to combinations of this program with
17
17
* other software, or any other product whatsoever.
19
19
* You should have received a copy of the GNU General Public License along
20
20
* with this program; if not, write the Free Software Foundation, Inc., 59
21
21
* Temple Place - Suite 330, Boston MA 02111-1307, USA.
23
23
* Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24
24
* Mountain View, CA 94043, or:
28
* For further information regarding this notice, see:
28
* For further information regarding this notice, see:
30
30
* http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
165
165
* junk the entry, mark lino as NULL since it's bad
167
do_warn("invalid inode number %llu in directory %llu\n",
168
_("invalid inode number %llu in directory %llu\n"), lino, ino);
169
169
lino = NULLFSINO;
171
171
} else if (lino == mp->m_sb.sb_rbmino) {
173
"entry in shorform dir %llu references realtime bitmap inode %llu\n",
173
_("entry in shortform dir %llu references rt bitmap inode %llu\n"),
176
176
} else if (lino == mp->m_sb.sb_rsumino) {
178
"entry in shorform dir %llu references realtime summary inode %llu\n",
178
_("entry in shortform dir %llu references rt summary inode %llu\n"),
181
181
} else if (lino == mp->m_sb.sb_uquotino) {
183
"entry in shorform dir %llu references user quota inode %llu\n",
183
_("entry in shortform dir %llu references user quota inode %llu\n"),
186
186
} else if (lino == mp->m_sb.sb_gquotino) {
188
"entry in shorform dir %llu references group quota inode %llu\n",
188
_("entry in shortform dir %llu references group quota inode %llu\n"),
191
191
} else if ((irec_p = find_inode_rec(XFS_INO_TO_AGNO(mp, lino),
249
249
if (!no_modify) {
251
"zero length entry in shortform dir %llu, resetting to %d\n",
251
_("zero length entry in shortform dir %llu, resetting to %d\n"),
253
253
sf_entry->namelen = namelen;
256
"zero length entry in shortform dir %llu, would set to %d\n",
256
_("zero length entry in shortform dir %llu, would set to %d\n"),
261
"zero length entry in shortform dir %llu",
261
_("zero length entry in shortform dir %llu, "),
264
do_warn(", junking %d entries\n",
264
do_warn(_("junking %d entries\n"),
265
265
num_entries - i);
267
do_warn(", would junk %d entries\n",
267
do_warn(_("would junk %d entries\n"),
268
268
num_entries - i);
270
270
* don't process the rest of the directory,
282
282
((__psint_t) &sf_entry->name[0] -
285
"size of last entry overflows space left in in shortform dir %llu, ",
285
_("size of last entry overflows space left in in shortform dir %llu, "),
287
287
if (!no_modify) {
288
do_warn("resetting to %d\n",
288
do_warn(_("resetting to %d\n"),
290
290
sf_entry->namelen = namelen;
293
do_warn("would reset to %d\n",
293
do_warn(_("would reset to %d\n"),
298
"size of entry #%d overflows space left in in shortform dir %llu\n",
298
_("size of entry #%d overflows space left in in shortform dir %llu\n"),
300
300
if (!no_modify) {
301
301
if (i == num_entries - 1)
302
do_warn("junking entry #%d\n",
303
_("junking entry #%d\n"),
306
"junking %d entries\n",
307
_("junking %d entries\n"),
307
308
num_entries - i);
309
310
if (i == num_entries - 1)
311
"would junk entry #%d\n",
312
_("would junk entry #%d\n"),
315
"would junk %d entries\n",
316
_("would junk %d entries\n"),
316
317
num_entries - i);
415
417
if (INT_GET(sf->hdr.count, ARCH_CONVERT) != i) {
417
do_warn("would have corrected entry count in directory %llu from %d to %d\n",
420
_("would have corrected entry count in directory %llu from %d to %d\n"),
418
421
ino, INT_GET(sf->hdr.count, ARCH_CONVERT), i);
420
do_warn("corrected entry count in directory %llu, was %d, now %d\n",
424
_("corrected entry count in directory %llu, was %d, now %d\n"),
421
425
ino, INT_GET(sf->hdr.count, ARCH_CONVERT), i);
422
426
INT_SET(sf->hdr.count, ARCH_CONVERT, i);
428
432
if ((__psint_t) next_sfe - (__psint_t) sf != ino_dir_size) {
431
"would have corrected directory %llu size from %lld to %lld\n",
435
_("would have corrected directory %llu size from %lld to %lld\n"),
432
436
ino, (__int64_t) ino_dir_size,
433
437
(__int64_t)((__psint_t) next_sfe - (__psint_t) sf));
436
"corrected directory %llu size, was %lld, now %lld\n",
440
_("corrected directory %llu size, was %lld, now %lld\n"),
437
441
ino, (__int64_t) ino_dir_size,
438
442
(__int64_t)((__psint_t) next_sfe - (__psint_t) sf));
440
INT_SET(dip->di_core.di_size, ARCH_CONVERT, (xfs_fsize_t)
441
((__psint_t) next_sfe - (__psint_t) sf));
444
INT_SET(dip->di_core.di_size,
445
ARCH_CONVERT, (xfs_fsize_t)
446
((__psint_t) next_sfe - (__psint_t) sf));
455
460
*parent = NULLFSINO;
458
"bogus .. inode number (%llu) in directory inode %llu,",
463
_("bogus .. inode number (%llu) in directory inode %llu, "),
460
465
if (!no_modify) {
461
do_warn("clearing inode number\n");
466
do_warn(_("clearing inode number\n"));
463
XFS_DIR_SF_PUT_DIRINO_ARCH(parent, &sf->hdr.parent, ARCH_CONVERT);
468
XFS_DIR_SF_PUT_DIRINO_ARCH(parent,
469
&sf->hdr.parent, ARCH_CONVERT);
467
do_warn("would clear inode number\n");
473
do_warn(_("would clear inode number\n"));
469
475
} else if (ino == mp->m_sb.sb_rootino && ino != *parent) {
473
479
if (!no_modify) {
475
"corrected root directory %llu .. entry, was %llu, now %llu\n",
481
_("corrected root directory %llu .. entry, was %llu, now %llu\n"),
476
482
ino, *parent, ino);
478
XFS_DIR_SF_PUT_DIRINO_ARCH(parent, &sf->hdr.parent, ARCH_CONVERT);
484
XFS_DIR_SF_PUT_DIRINO_ARCH(parent,
485
&sf->hdr.parent, ARCH_CONVERT);
483
"would have corrected root directory %llu .. entry from %llu to %llu\n",
490
_("would have corrected root directory %llu .. entry from %llu to %llu\n"),
484
491
ino, *parent, ino);
486
493
} else if (ino == *parent && ino != mp->m_sb.sb_rootino) {
491
498
*parent = NULLFSINO;
492
do_warn("bad .. entry in dir ino %llu, points to self,",
499
do_warn(_("bad .. entry in dir ino %llu, points to self, "),
494
501
if (!no_modify) {
495
do_warn(" clearing inode number\n");
502
do_warn(_("clearing inode number\n"));
497
XFS_DIR_SF_PUT_DIRINO_ARCH(parent, &sf->hdr.parent, ARCH_CONVERT);
504
XFS_DIR_SF_PUT_DIRINO_ARCH(parent,
505
&sf->hdr.parent, ARCH_CONVERT);
501
do_warn(" would clear inode number\n");
509
do_warn(_("would clear inode number\n"));
553
561
* allow == relation since [x, x) claims 1 byte
555
do_warn("bad range claimed [%d, %d) in da block\n",
563
do_warn(_("bad range claimed [%d, %d) in da block\n"),
560
568
if (stop > mp->m_sb.sb_blocksize) {
562
"byte range end [%d %d) in da block larger than blocksize %d\n",
570
_("byte range end [%d %d) in da block larger than blocksize %d\n"),
563
571
start, stop, mp->m_sb.sb_blocksize);
567
575
for (i = start; i < stop; i ++) {
568
576
if (map[i / NBBY] & (mask << i % NBBY)) {
569
do_warn("multiply claimed byte %d in da block\n", i);
577
do_warn(_("multiply claimed byte %d in da block\n"), i);
572
580
map[i / NBBY] |= (mask << i % NBBY);
589
597
for (i = 0; i < XFS_DIR_LEAF_MAPSIZE; i++) {
590
598
if (holes->hentries[i].size == 0)
593
601
start = holes->hentries[i].base;
594
602
len = holes->hentries[i].size;
596
604
if (start >= mp->m_sb.sb_blocksize ||
597
605
start + len > mp->m_sb.sb_blocksize) {
599
"hole (start %d, len %d) out of range, block %d, dir ino %llu\n",
607
_("hole (start %d, len %d) out of range, block %d, dir ino %llu\n"),
600
608
start, len, da_bno, ino);
817
825
XFS_FSB_TO_BB(mp, 1), 0);
819
827
if (whichfork == XFS_DATA_FORK)
820
do_warn("can't read block %u (fsbno %llu) for "
821
"directory inode %llu\n",
828
do_warn(_("can't read block %u (fsbno %llu) "
829
"for directory inode %llu\n"),
822
830
bno, fsbno, da_cursor->ino);
824
do_warn("can't read block %u (fsbno %llu) for "
825
"attrbute fork of inode %llu\n",
832
do_warn(_("can't read block %u (fsbno %llu) "
833
"for attrbute fork of inode %llu\n"),
826
834
bno, fsbno, da_cursor->ino);
830
838
node = (xfs_da_intnode_t *)XFS_BUF_PTR(bp);
832
840
if (INT_GET(node->hdr.info.magic, ARCH_CONVERT) != XFS_DA_NODE_MAGIC) {
833
do_warn("bad dir/attr magic number in inode %llu, file "
834
"bno = %u, fsbno = %llu\n", da_cursor->ino, bno, fsbno);
841
do_warn(_("bad dir/attr magic number in inode %llu, "
842
"file bno = %u, fsbno = %llu\n"),
843
da_cursor->ino, bno, fsbno);
835
844
libxfs_putbuf(bp);
838
if (INT_GET(node->hdr.count, ARCH_CONVERT) > XFS_DA_NODE_ENTRIES(mp)) {
839
do_warn("bad record count in inode %llu, count = %d, max = %d\n",
840
da_cursor->ino, INT_GET(node->hdr.count, ARCH_CONVERT),
841
XFS_DA_NODE_ENTRIES(mp));
847
if (INT_GET(node->hdr.count, ARCH_CONVERT) >
848
mp->m_dir_node_ents) {
849
do_warn(_("bad record count in inode %llu, "
850
"count = %d, max = %d\n"),
852
INT_GET(node->hdr.count, ARCH_CONVERT),
853
mp->m_dir_node_ents);
842
854
libxfs_putbuf(bp);
982
997
* walk down left side of btree, release buffers as you
983
998
* go. if the root block is a leaf (single-level btree),
984
999
* just return it.
988
1003
bp = libxfs_readbuf(mp->m_dev, XFS_FSB_TO_DADDR(mp, fsbno),
989
1004
XFS_FSB_TO_BB(mp, 1), 0);
991
do_warn("can't read block %u (fsbno %llu) for directory "
992
"inode %llu\n", bno, fsbno, ino);
1006
do_warn(_("can't read block %u (fsbno %llu) "
1007
"for directory inode %llu\n"),
993
1009
return(NULLDFSBNO);
996
1012
node = (xfs_da_intnode_t *)XFS_BUF_PTR(bp);
998
if (INT_GET(node->hdr.info.magic, ARCH_CONVERT) != XFS_DA_NODE_MAGIC) {
999
do_warn("bad dir/attr magic number in inode %llu, file "
1000
"bno = %u, fsbno = %llu\n", ino, bno, fsbno);
1014
if (XFS_DA_NODE_MAGIC !=
1015
INT_GET(node->hdr.info.magic, ARCH_CONVERT)) {
1016
do_warn(_("bad dir/attr magic number in inode %llu, "
1017
"file bno = %u, fsbno = %llu\n"),
1001
1019
libxfs_putbuf(bp);
1002
1020
return(NULLDFSBNO);
1063
1084
* hash values monotonically increasing ???
1065
1086
if (cursor->level[this_level].hashval >=
1066
INT_GET(node->btree[entry].hashval, ARCH_CONVERT)) {
1067
do_warn("directory/attribute block hashvalue inconsistency, "
1068
"expected > %u / saw %u\n", cursor->level[this_level].hashval,
1087
INT_GET(node->btree[entry].hashval, ARCH_CONVERT)) {
1088
do_warn(_("directory/attribute block hashvalue inconsistency, "
1089
"expected > %u / saw %u\n"),
1090
cursor->level[this_level].hashval,
1069
1091
INT_GET(node->btree[entry].hashval, ARCH_CONVERT));
1072
1094
if (INT_GET(node->hdr.info.forw, ARCH_CONVERT) != 0) {
1073
do_warn("bad directory/attribute forward block pointer, expected 0, "
1074
"saw %u\n", INT_GET(node->hdr.info.forw, ARCH_CONVERT));
1095
do_warn(_("bad directory/attribute forward block pointer, "
1096
"expected 0, saw %u\n"),
1097
INT_GET(node->hdr.info.forw, ARCH_CONVERT));
1078
do_warn("bad directory block in dir ino %llu\n", cursor->ino);
1101
do_warn(_("bad directory block in dir ino %llu\n"),
1089
1113
* ok, now check descendant block number against this level
1091
1115
if (cursor->level[p_level].bno !=
1092
INT_GET(node->btree[entry].before, ARCH_CONVERT)) {
1116
INT_GET(node->btree[entry].before, ARCH_CONVERT)) {
1093
1117
#ifdef XR_DIR_TRACE
1094
fprintf(stderr, "bad directory btree pointer, child bno should be %d, "
1095
"block bno is %d, hashval is %u\n",
1118
fprintf(stderr, "bad directory btree pointer, child bno should "
1119
"be %d, block bno is %d, hashval is %u\n",
1096
1120
INT_GET(node->btree[entry].before, ARCH_CONVERT),
1097
1121
cursor->level[p_level].bno,
1098
1122
cursor->level[p_level].hashval);
1104
1128
if (cursor->level[p_level].hashval !=
1105
INT_GET(node->btree[entry].hashval, ARCH_CONVERT)) {
1129
INT_GET(node->btree[entry].hashval, ARCH_CONVERT)) {
1106
1130
if (!no_modify) {
1107
do_warn("correcting bad hashval in non-leaf dir/attr block\n");
1108
do_warn("\tin (level %d) in inode %llu.\n",
1131
do_warn(_("correcting bad hashval in non-leaf "
1132
"dir/attr block\n\tin (level %d) in "
1109
1134
this_level, cursor->ino);
1110
1135
INT_SET(node->btree[entry].hashval, ARCH_CONVERT,
1111
1136
cursor->level[p_level].hashval);
1112
1137
cursor->level[this_level].dirty++;
1114
do_warn("would correct bad hashval in non-leaf dir/attr "
1115
"block\n\tin (level %d) in inode %llu.\n",
1139
do_warn(_("would correct bad hashval in non-leaf "
1140
"dir/attr block\n\tin (level %d) in "
1116
1142
this_level, cursor->ino);
1147
* Note: squirrel hashval away _before_ releasing the
1148
* buffer, preventing a use-after-free problem.
1150
hashval = INT_GET(node->btree[entry].hashval, ARCH_CONVERT);
1121
1153
* release/write buffer
1123
1155
ASSERT(cursor->level[this_level].dirty == 0 ||
1243
1274
fsbno = blkmap_get(cursor->blkmap, dabno);
1245
1276
if (fsbno == NULLDFSBNO) {
1246
do_warn("can't get map info for block %u of directory "
1247
"inode %llu\n", dabno, cursor->ino);
1277
do_warn(_("can't get map info for block %u "
1278
"of directory inode %llu\n"),
1279
dabno, cursor->ino);
1251
1283
bp = libxfs_readbuf(mp->m_dev, XFS_FSB_TO_DADDR(mp, fsbno),
1252
1284
XFS_FSB_TO_BB(mp, 1), 0);
1254
do_warn("can't read block %u (%llu) for directory inode %llu\n",
1286
do_warn(_("can't read block %u (%llu) "
1287
"for directory inode %llu\n"),
1255
1288
dabno, fsbno, cursor->ino);
1262
1295
* entry count, verify level
1265
if (INT_GET(newnode->hdr.info.magic, ARCH_CONVERT) != XFS_DA_NODE_MAGIC) {
1266
do_warn("bad magic number %x in block %u (%llu) for directory "
1298
if (XFS_DA_NODE_MAGIC !=
1299
INT_GET(newnode->hdr.info.magic, ARCH_CONVERT)) {
1300
do_warn(_("bad magic number %x in block %u (%llu) "
1301
"for directory inode %llu\n"),
1268
1302
INT_GET(newnode->hdr.info.magic, ARCH_CONVERT),
1269
1303
dabno, fsbno, cursor->ino);
1272
1306
if (INT_GET(newnode->hdr.info.back, ARCH_CONVERT) !=
1273
cursor->level[this_level].bno) {
1274
do_warn("bad back pointer in block %u (%llu) for directory "
1275
"inode %llu\n", dabno, fsbno, cursor->ino);
1307
cursor->level[this_level].bno) {
1308
do_warn(_("bad back pointer in block %u (%llu) "
1309
"for directory inode %llu\n"),
1310
dabno, fsbno, cursor->ino);
1278
1313
if (INT_GET(newnode->hdr.count, ARCH_CONVERT) >
1279
XFS_DA_NODE_ENTRIES(mp)) {
1280
do_warn("entry count %d too large in block %u (%llu) for "
1281
"directory inode %llu\n",
1314
mp->m_dir_node_ents) {
1315
do_warn(_("entry count %d too large in block %u (%llu) "
1316
"for directory inode %llu\n"),
1282
1317
INT_GET(newnode->hdr.count, ARCH_CONVERT),
1283
1318
dabno, fsbno, cursor->ino);
1286
1321
if (INT_GET(newnode->hdr.level, ARCH_CONVERT) != this_level) {
1287
do_warn("bad level %d in block %u (%llu) for directory inode "
1288
"%llu\n", INT_GET(newnode->hdr.level, ARCH_CONVERT),
1322
do_warn(_("bad level %d in block %u (%llu) "
1323
"for directory inode %llu\n"),
1324
INT_GET(newnode->hdr.level, ARCH_CONVERT),
1289
1325
dabno, fsbno, cursor->ino);
1325
1361
if (cursor->level[p_level].bno !=
1326
1362
INT_GET(node->btree[entry].before, ARCH_CONVERT)) {
1327
1363
#ifdef XR_DIR_TRACE
1328
fprintf(stderr, "bad directory btree pointer, child bno should be %d, "
1329
"block bno is %d, hashval is %u\n",
1364
fprintf(stderr, "bad directory btree pointer, child bno "
1365
"should be %d, block bno is %d, hashval is %u\n",
1330
1366
INT_GET(node->btree[entry].before, ARCH_CONVERT),
1331
1367
cursor->level[p_level].bno,
1332
1368
cursor->level[p_level].hashval);
1341
1377
if (cursor->level[p_level].hashval !=
1342
1378
INT_GET(node->btree[entry].hashval, ARCH_CONVERT)) {
1343
1379
if (!no_modify) {
1344
do_warn("correcting bad hashval in interior dir/attr block\n");
1345
do_warn("\tin (level %d) in inode %llu.\n",
1380
do_warn(_("correcting bad hashval in interior "
1381
"dir/attr block\n\tin (level %d) in "
1346
1383
this_level, cursor->ino);
1347
1384
INT_SET(node->btree[entry].hashval, ARCH_CONVERT,
1348
1385
cursor->level[p_level].hashval);
1349
1386
cursor->level[this_level].dirty++;
1351
do_warn("would correct bad hashval in interior dir/attr "
1352
"block\n\tin (level %d) in inode %llu.\n",
1388
do_warn(_("would correct bad hashval in interior "
1389
"dir/attr block\n\tin (level %d) in "
1353
1391
this_level, cursor->ino);
1776
1814
* if it is, delete the entry since we can't
1777
1815
* grab the inode #.
1779
if (INT_GET(entry->nameidx, ARCH_CONVERT) >= mp->m_sb.sb_blocksize) {
1817
if (INT_GET(entry->nameidx, ARCH_CONVERT) >=
1818
mp->m_sb.sb_blocksize) {
1780
1819
if (!no_modify) {
1781
1820
*buf_dirty = 1;
1783
1822
if (INT_GET(leaf->hdr.count, ARCH_CONVERT) > 1) {
1785
"nameidx %d for entry #%d, bno %d, ino %llu > fs blocksize, deleting entry\n",
1786
INT_GET(entry->nameidx, ARCH_CONVERT), i, da_bno, ino);
1787
ASSERT(INT_GET(leaf->hdr.count, ARCH_CONVERT) > i);
1824
_("nameidx %d for entry #%d, bno %d, ino %llu > fs blocksize, deleting entry\n"),
1825
INT_GET(entry->nameidx,
1828
ASSERT(INT_GET(leaf->hdr.count,
1789
bytes = (INT_GET(leaf->hdr.count, ARCH_CONVERT) - i) *
1831
bytes = (INT_GET(leaf->hdr.count,
1832
ARCH_CONVERT) - i) *
1790
1833
sizeof(xfs_dir_leaf_entry_t);
1821
"nameidx %d, entry #%d, bno %d, ino %llu > fs blocksize, marking entry bad\n",
1822
INT_GET(entry->nameidx, ARCH_CONVERT), i, da_bno, ino);
1823
INT_SET(entry->nameidx, ARCH_CONVERT, mp->m_sb.sb_blocksize -
1864
_("nameidx %d, entry #%d, bno %d, ino %llu > fs blocksize, marking entry bad\n"),
1865
INT_GET(entry->nameidx,
1868
INT_SET(entry->nameidx, ARCH_CONVERT,
1869
mp->m_sb.sb_blocksize -
1824
1870
sizeof(xfs_dir_leaf_name_t));
1825
1871
namest = XFS_DIR_LEAF_NAMESTRUCT(leaf,
1826
INT_GET(entry->nameidx, ARCH_CONVERT));
1872
INT_GET(entry->nameidx,
1827
1874
lino = NULLFSINO;
1828
1875
XFS_DIR_SF_PUT_DIRINO_ARCH(&lino,
1829
&namest->inumber, ARCH_CONVERT);
1876
&namest->inumber, ARCH_CONVERT);
1830
1877
namest->name[0] = '/';
1834
"nameidx %d, entry #%d, bno %d, ino %llu > fs blocksize, would delete entry\n",
1835
INT_GET(entry->nameidx, ARCH_CONVERT), i, da_bno, ino);
1881
_("nameidx %d, entry #%d, bno %d, ino %llu > fs blocksize, would delete entry\n"),
1882
INT_GET(entry->nameidx, ARCH_CONVERT),
1866
1915
* since it's still structurally intact.
1869
"invalid ino number %llu in dir ino %llu, entry #%d, bno %d\n",
1918
_("invalid ino number %llu in dir ino %llu, entry #%d, bno %d\n"),
1870
1919
lino, ino, i, da_bno);
1871
1920
if (!no_modify) {
1873
"\tclearing ino number in entry %d...\n", i);
1922
_("\tclearing ino number in entry %d...\n"),
1875
1924
lino = NULLFSINO;
1876
XFS_DIR_SF_PUT_DIRINO_ARCH(&lino, &namest->inumber, ARCH_CONVERT);
1925
XFS_DIR_SF_PUT_DIRINO_ARCH(&lino,
1926
&namest->inumber, ARCH_CONVERT);
1877
1927
*buf_dirty = 1;
1880
"\twould clear ino number in entry %d...\n", i);
1930
_("\twould clear ino number in entry %d...\n"),
1882
1933
} else if (lino == mp->m_sb.sb_rbmino) {
1884
"entry #%d, bno %d in directory %llu references realtime bitmap inode %llu\n",
1935
_("entry #%d, bno %d in directory %llu references realtime bitmap inode %llu\n"),
1885
1936
i, da_bno, ino, lino);
1886
1937
if (!no_modify) {
1888
"\tclearing ino number in entry %d...\n", i);
1939
_("\tclearing ino number in entry %d...\n"),
1890
1942
lino = NULLFSINO;
1891
XFS_DIR_SF_PUT_DIRINO_ARCH(&lino, &namest->inumber, ARCH_CONVERT);
1943
XFS_DIR_SF_PUT_DIRINO_ARCH(&lino,
1944
&namest->inumber, ARCH_CONVERT);
1892
1945
*buf_dirty = 1;
1895
"\twould clear ino number in entry %d...\n", i);
1948
_("\twould clear ino number in entry %d...\n"),
1897
1951
} else if (lino == mp->m_sb.sb_rsumino) {
1899
"entry #%d, bno %d in directory %llu references realtime summary inode %llu\n",
1953
_("entry #%d, bno %d in directory %llu references realtime summary inode %llu\n"),
1900
1954
i, da_bno, ino, lino);
1901
1955
if (!no_modify) {
1903
"\tclearing ino number in entry %d...\n", i);
1957
_("\tclearing ino number in entry %d...\n"), i);
1905
1959
lino = NULLFSINO;
1906
XFS_DIR_SF_PUT_DIRINO_ARCH(&lino, &namest->inumber, ARCH_CONVERT);
1960
XFS_DIR_SF_PUT_DIRINO_ARCH(&lino,
1961
&namest->inumber, ARCH_CONVERT);
1907
1962
*buf_dirty = 1;
1910
"\twould clear ino number in entry %d...\n", i);
1965
_("\twould clear ino number in entry %d...\n"),
1912
1968
} else if (lino == mp->m_sb.sb_uquotino) {
1914
"entry #%d, bno %d in directory %llu references user quota inode %llu\n",
1970
_("entry #%d, bno %d in directory %llu references user quota inode %llu\n"),
1915
1971
i, da_bno, ino, lino);
1916
1972
if (!no_modify) {
1918
"\tclearing ino number in entry %d...\n", i);
1974
_("\tclearing ino number in entry %d...\n"),
1920
1977
lino = NULLFSINO;
1921
XFS_DIR_SF_PUT_DIRINO_ARCH(&lino, &namest->inumber, ARCH_CONVERT);
1978
XFS_DIR_SF_PUT_DIRINO_ARCH(&lino,
1979
&namest->inumber, ARCH_CONVERT);
1922
1980
*buf_dirty = 1;
1925
"\twould clear ino number in entry %d...\n", i);
1983
_("\twould clear ino number in entry %d...\n"),
1927
1986
} else if (lino == mp->m_sb.sb_gquotino) {
1929
"entry #%d, bno %d in directory %llu references group quota inode %llu\n",
1988
_("entry #%d, bno %d in directory %llu references group quota inode %llu\n"),
1930
1989
i, da_bno, ino, lino);
1931
1990
if (!no_modify) {
1933
"\tclearing ino number in entry %d...\n", i);
1992
_("\tclearing ino number in entry %d...\n"),
1935
1995
lino = NULLFSINO;
1936
XFS_DIR_SF_PUT_DIRINO_ARCH(&lino, &namest->inumber, ARCH_CONVERT);
1996
XFS_DIR_SF_PUT_DIRINO_ARCH(&lino,
1997
&namest->inumber, ARCH_CONVERT);
1937
1998
*buf_dirty = 1;
1940
"\twould clear ino number in entry %d...\n", i);
2001
_("\twould clear ino number in entry %d...\n"),
1942
2004
} else if (lino == old_orphanage_ino) {
1967
2029
if (!ino_discovery && is_inode_free(irec_p, ino_off)) {
1968
2030
if (!no_modify) {
1970
"entry references free inode %llu in directory %llu, will clear entry\n",
2032
_("entry references free inode %llu in directory %llu, will clear entry\n"),
1972
2034
lino = NULLFSINO;
1973
2035
XFS_DIR_SF_PUT_DIRINO_ARCH(&lino,
1974
&namest->inumber, ARCH_CONVERT);
2036
&namest->inumber, ARCH_CONVERT);
1975
2037
*buf_dirty = 1;
1978
"entry references free inode %llu in directory %llu, would clear entry\n",
2040
_("entry references free inode %llu in directory %llu, would clear entry\n"),
1983
2045
add_inode_uncertain(mp, lino, 0);
1986
"bad ino number %llu in dir ino %llu, entry #%d, bno %d\n",
2048
_("bad ino number %llu in dir ino %llu, entry #%d, bno %d\n"),
1987
2049
lino, ino, i, da_bno);
1988
2050
if (!no_modify) {
1989
do_warn("clearing inode number...\n");
2051
do_warn(_("clearing inode number...\n"));
1990
2052
lino = NULLFSINO;
1991
XFS_DIR_SF_PUT_DIRINO_ARCH(&lino, &namest->inumber, ARCH_CONVERT);
2053
XFS_DIR_SF_PUT_DIRINO_ARCH(&lino,
2054
&namest->inumber, ARCH_CONVERT);
1992
2055
*buf_dirty = 1;
1994
do_warn("would clear inode number...\n");
2057
do_warn(_("would clear inode number...\n"));
2050
2113
* inode number for now
2053
"entry #%d, dir inode %llu, has zero-len name, marking entry bad\n",
2116
_("entry #%d, dir inode %llu, has zero-len name, marking entry bad\n"),
2055
INT_SET(entry->nameidx, ARCH_CONVERT, mp->m_sb.sb_blocksize -
2118
INT_SET(entry->nameidx, ARCH_CONVERT,
2119
mp->m_sb.sb_blocksize -
2056
2120
sizeof(xfs_dir_leaf_name_t));
2057
2121
namest = XFS_DIR_LEAF_NAMESTRUCT(leaf,
2058
INT_GET(entry->nameidx, ARCH_CONVERT));
2059
XFS_DIR_SF_PUT_DIRINO_ARCH(&lino, &namest->inumber, ARCH_CONVERT);
2122
INT_GET(entry->nameidx,
2124
XFS_DIR_SF_PUT_DIRINO_ARCH(&lino,
2125
&namest->inumber, ARCH_CONVERT);
2060
2126
namest->name[0] = '/';
2062
} else if (INT_GET(entry->nameidx, ARCH_CONVERT) + entry->namelen > XFS_LBSIZE(mp)) {
2128
} else if (INT_GET(entry->nameidx, ARCH_CONVERT) +
2129
entry->namelen > XFS_LBSIZE(mp)) {
2064
"bad size, entry #%d in dir inode %llu, block %u -- entry overflows block\n",
2131
_("bad size, entry #%d in dir inode %llu, block %u -- entry overflows block\n"),
2112
2179
if (!no_modify) {
2114
"illegal name \"%s\" in directory inode %llu, entry will be cleared\n",
2181
_("illegal name \"%s\" in directory inode %llu, entry will be cleared\n"),
2116
2183
namest->name[0] = '/';
2117
2184
*buf_dirty = 1;
2120
"illegal name \"%s\" in directory inode %llu, entry would be cleared\n",
2187
_("illegal name \"%s\" in directory inode %llu, entry would be cleared\n"),
2123
} else if (!nm_illegal && INT_GET(entry->hashval, ARCH_CONVERT) != hashval) {
2190
} else if (!nm_illegal &&
2191
INT_GET(entry->hashval, ARCH_CONVERT) != hashval) {
2125
2193
* try resetting the hashvalue to the correct
2126
2194
* value for the string, if the string has been
2127
2195
* corrupted, too, that will get picked up next
2129
do_warn("\tmismatched hash value for entry \"%s\"\n",
2197
do_warn(_("\tmismatched hash value for entry \"%s\"\n"),
2131
2199
if (!no_modify) {
2133
"\t\tin directory inode %llu. resetting hash value.\n",
2201
_("\t\tin directory inode %llu. resetting hash value.\n"),
2135
2203
INT_SET(entry->hashval, ARCH_CONVERT, hashval);
2136
2204
*buf_dirty = 1;
2139
"\t\tin directory inode %llu. would reset hash value.\n",
2207
_("\t\tin directory inode %llu. would reset hash value.\n"),
2145
2213
* now we can mark entries with NULLFSINO's bad
2166
2234
* inode number in the entry so we can attach
2167
2235
* the inode to the orphanage later.
2169
do_warn("\tbad hash ordering for entry \"%s\"\n",
2237
do_warn(_("\tbad hash ordering for entry \"%s\"\n"),
2171
2239
if (!no_modify) {
2173
"\t\tin directory inode %llu. will clear entry\n",
2241
_("\t\tin directory inode %llu. will clear entry\n"),
2175
INT_SET(entry->hashval, ARCH_CONVERT, last_hashval);
2243
INT_SET(entry->hashval, ARCH_CONVERT,
2176
2245
namest->name[0] = '/';
2177
2246
*buf_dirty = 1;
2180
"\t\tin directory inode %llu. would clear entry\n",
2249
_("\t\tin directory inode %llu. would clear entry\n"),
2188
2257
* if heap data conflicts with something,
2189
2258
* blow it out and skip the rest of the loop
2191
if (set_da_freemap(mp, dir_freemap, INT_GET(entry->nameidx, ARCH_CONVERT),
2192
INT_GET(entry->nameidx, ARCH_CONVERT) + sizeof(xfs_dir_leaf_name_t) +
2193
entry->namelen - 1)) {
2260
if (set_da_freemap(mp, dir_freemap,
2261
INT_GET(entry->nameidx, ARCH_CONVERT),
2262
INT_GET(entry->nameidx, ARCH_CONVERT)
2263
+ sizeof(xfs_dir_leaf_name_t)
2264
+ entry->namelen - 1)) {
2195
"name \"%s\" (block %u, slot %d) conflicts with used space in dir inode %llu\n",
2266
_("name \"%s\" (block %u, slot %d) conflicts with used space in dir inode %llu\n"),
2196
2267
fname, da_bno, i, ino);
2197
2268
if (!no_modify) {
2198
2269
entry->namelen = 0;
2199
2270
*buf_dirty = 1;
2202
"will clear entry \"%s\" (#%d) in directory inode %llu\n",
2273
_("will clear entry \"%s\" (#%d) in directory inode %llu\n"),
2203
2274
fname, i, ino);
2206
"would clear entry \"%s\" (#%d)in directory inode %llu\n",
2277
_("would clear entry \"%s\" (#%d)in directory inode %llu\n"),
2207
2278
fname, i, ino);
2301
2373
if (lino != ino) {
2302
2374
if (!no_modify) {
2304
". in directory inode %llu has wrong value (%llu), fixing entry...\n",
2376
_(". in directory inode %llu has wrong value (%llu), fixing entry...\n"),
2306
2378
XFS_DIR_SF_PUT_DIRINO_ARCH(&ino,
2307
&namest->inumber, ARCH_CONVERT);
2308
2381
*buf_dirty = 1;
2311
". in directory inode %llu has wrong value (%llu)\n",
2384
_(". in directory inode %llu has wrong value (%llu)\n"),
2317
"multiple . entries in directory inode %llu\n",
2390
_("multiple . entries in directory inode %llu\n"),
2320
2393
* mark entry as to be junked.
2322
2395
if (!no_modify) {
2324
"will clear one . entry in directory inode %llu\n",
2397
_("will clear one . entry in directory inode %llu\n"),
2326
2399
namest->name[0] = '/';
2327
2400
*buf_dirty = 1;
2330
"would clear one . entry in directory inode %llu\n",
2403
_("would clear one . entry in directory inode %llu\n"),
2356
2429
* pointing to used bytes. we're being conservative here
2357
2430
* since the block will get compacted anyhow by the kernel.
2359
if ((leaf->hdr.holes == 0 && first_used != INT_GET(leaf->hdr.firstused, ARCH_CONVERT)) ||
2360
INT_GET(leaf->hdr.firstused, ARCH_CONVERT) > first_used) {
2432
if ((leaf->hdr.holes == 0 &&
2433
first_used != INT_GET(leaf->hdr.firstused, ARCH_CONVERT)) ||
2434
INT_GET(leaf->hdr.firstused, ARCH_CONVERT) > first_used) {
2361
2435
if (!no_modify) {
2364
"- resetting first used heap value from %d to %d in block %u of dir ino %llu\n",
2365
(int) INT_GET(leaf->hdr.firstused, ARCH_CONVERT), first_used,
2438
_("- resetting first used heap value from %d to %d in block %u of dir ino %llu\n"),
2439
(int) INT_GET(leaf->hdr.firstused,
2441
first_used, da_bno, ino);
2367
2442
INT_SET(leaf->hdr.firstused, ARCH_CONVERT, first_used);
2368
2443
*buf_dirty = 1;
2372
"- would reset first used value from %d to %d in block %u of dir ino %llu\n",
2373
(int) INT_GET(leaf->hdr.firstused, ARCH_CONVERT), first_used,
2447
_("- would reset first used value from %d to %d in block %u of dir ino %llu\n"),
2448
(int) INT_GET(leaf->hdr.firstused,
2450
first_used, da_bno, ino);
2379
2455
if (!no_modify) {
2382
"- resetting namebytes cnt from %d to %d in block %u of dir inode %llu\n",
2383
(int) INT_GET(leaf->hdr.namebytes, ARCH_CONVERT), bytes_used,
2458
_("- resetting namebytes cnt from %d to %d in block %u of dir inode %llu\n"),
2459
(int) INT_GET(leaf->hdr.namebytes,
2461
bytes_used, da_bno, ino);
2385
2462
INT_SET(leaf->hdr.namebytes, ARCH_CONVERT, bytes_used);
2386
2463
*buf_dirty = 1;
2390
"- would reset namebytes cnt from %d to %d in block %u of dir inode %llu\n",
2391
(int) INT_GET(leaf->hdr.namebytes, ARCH_CONVERT), bytes_used,
2467
_("- would reset namebytes cnt from %d to %d in block %u of dir inode %llu\n"),
2468
(int) INT_GET(leaf->hdr.namebytes,
2470
bytes_used, da_bno, ino);
2451
"- existing hole info for block %d, dir inode %llu (base, size) - \n",
2529
_("- existing hole info for block %d, dir inode %llu (base, size) - \n"),
2453
2531
do_warn("- \t");
2454
2532
for (i = 0; i < XFS_DIR_LEAF_MAPSIZE; i++) {
2456
2534
"- (%d, %d) ", bholemap.hentries[i].base,
2457
bholemap.hentries[i].size);
2535
bholemap.hentries[i].size);
2459
do_warn("- holes flag = %d\n", bholemap.lost_holes);
2537
do_warn(_("- holes flag = %d\n"), bholemap.lost_holes);
2462
2540
if (!no_modify) {
2465
"- compacting block %u in dir inode %llu\n",
2543
_("- compacting block %u in dir inode %llu\n"),
2468
2546
new_leaf = (xfs_dir_leafblock_t *) &dirbuf[0];
2831
2915
if (INT_GET(dip->di_core.di_size, ARCH_CONVERT) <
2832
2916
(da_cursor.greatest_bno + 1) * mp->m_sb.sb_blocksize) {
2833
2917
if ((xfs_fsize_t) (da_cursor.greatest_bno
2834
* mp->m_sb.sb_blocksize) > UINT_MAX) {
2918
* mp->m_sb.sb_blocksize) > UINT_MAX) {
2836
"out of range internal directory block numbers (inode %llu)\n",
2920
_("out of range internal directory block numbers (inode %llu)\n"),
2842
"setting directory inode (%llu) size to %llu bytes, was %lld bytes\n",
2926
_("setting directory inode (%llu) size to %llu bytes, was %lld bytes\n"),
2844
2928
(xfs_dfiloff_t) (da_cursor.greatest_bno + 1)
2845
2929
* mp->m_sb.sb_blocksize,
2934
3020
* check sibling pointers in leaf block (above doesn't do it)
2936
3022
if (INT_GET(leaf->hdr.info.forw, ARCH_CONVERT) != 0 ||
2937
INT_GET(leaf->hdr.info.back, ARCH_CONVERT) != 0) {
3023
INT_GET(leaf->hdr.info.back, ARCH_CONVERT) != 0) {
2938
3024
if (!no_modify) {
2939
do_warn("clearing forw/back pointers for directory inode "
3025
do_warn(_("clearing forw/back pointers for "
3026
"directory inode %llu\n"), ino);
2942
3028
INT_ZERO(leaf->hdr.info.forw, ARCH_CONVERT);
2943
3029
INT_ZERO(leaf->hdr.info.back, ARCH_CONVERT);
2945
do_warn("would clear forw/back pointers for directory inode "
3031
do_warn(_("would clear forw/back pointers for "
3032
"directory inode %llu\n"), ino);
2986
3072
* is only called ONCE so all the subordinate routines will
2987
3073
* fix '.' and junk '..' if they're bogus.
2989
if (INT_GET(dip->di_core.di_size, ARCH_CONVERT) <= XFS_DFORK_DSIZE_ARCH(dip, mp, ARCH_CONVERT)) {
3075
if (INT_GET(dip->di_core.di_size, ARCH_CONVERT) <=
3076
XFS_DFORK_DSIZE_ARCH(dip, mp, ARCH_CONVERT)) {
2992
3079
if (process_shortform_dir(mp, ino, dip, ino_discovery,
2993
3080
dino_dirty, parent, dirname, &repair)) {
2996
} else if (INT_GET(dip->di_core.di_size, ARCH_CONVERT) <= XFS_LBSIZE(mp)) {
3083
} else if (INT_GET(dip->di_core.di_size, ARCH_CONVERT) <=
2997
3085
if (process_leaf_dir(mp, ino, dip, ino_discovery,
2998
3086
dino_dirty, blkmap, &dot, &dotdot,
2999
3087
parent, dirname, &repair)) {