148
* max transaction reservation values
150
* first dimension log(blocksize) (base XFS_MIN_BLOCKSIZE_LOG)
151
* second dimension log(inodesize) (base XFS_DINODE_MIN_LOG)
153
* first dimension log(blocksize) (base XFS_MIN_BLOCKSIZE_LOG)
154
* second dimension log(inodesize) (base XFS_DINODE_MIN_LOG)
155
* third dimension log(dirblocksize) (base XFS_MIN_BLOCKSIZE_LOG)
157
#define DFL_B (XFS_MAX_BLOCKSIZE_LOG + 1 - XFS_MIN_BLOCKSIZE_LOG)
158
#define DFL_I (XFS_DINODE_MAX_LOG + 1 - XFS_DINODE_MIN_LOG)
159
#define DFL_D (XFS_MAX_BLOCKSIZE_LOG + 1 - XFS_MIN_BLOCKSIZE_LOG)
161
static const int max_trres_v1[DFL_B][DFL_I] = {
162
{ MAXTRRES_B9_I8_D9_V1, 0, 0, 0 },
163
{ MAXTRRES_B10_I8_D10_V1, MAXTRRES_B10_I9_D10_V1, 0, 0 },
164
{ MAXTRRES_B11_I8_D11_V1, MAXTRRES_B11_I9_D11_V1,
165
MAXTRRES_B11_I10_D11_V1, 0 },
166
{ MAXTRRES_B12_I8_D12_V1, MAXTRRES_B12_I9_D12_V1,
167
MAXTRRES_B12_I10_D12_V1, MAXTRRES_B12_I11_D12_V1 },
168
{ MAXTRRES_B13_I8_D13_V1, MAXTRRES_B13_I9_D13_V1,
169
MAXTRRES_B13_I10_D13_V1, MAXTRRES_B13_I11_D13_V1 },
170
{ MAXTRRES_B14_I8_D14_V1, MAXTRRES_B14_I9_D14_V1,
171
MAXTRRES_B14_I10_D14_V1, MAXTRRES_B14_I11_D14_V1 },
172
{ MAXTRRES_B15_I8_D15_V1, MAXTRRES_B15_I9_D15_V1,
173
MAXTRRES_B15_I10_D15_V1, MAXTRRES_B15_I11_D15_V1 },
174
{ MAXTRRES_B16_I8_D16_V1, MAXTRRES_B16_I9_D16_V1,
175
MAXTRRES_B16_I10_D16_V1, MAXTRRES_B16_I11_D16_V1 },
178
static const int max_trres_v2[DFL_B][DFL_I][DFL_D] = {
179
{ { MAXTRRES_B9_I8_D9_V2, MAXTRRES_B9_I8_D10_V2, MAXTRRES_B9_I8_D11_V2,
180
MAXTRRES_B9_I8_D12_V2, MAXTRRES_B9_I8_D13_V2, MAXTRRES_B9_I8_D14_V2,
181
MAXTRRES_B9_I8_D15_V2, MAXTRRES_B9_I8_D16_V2 },
182
{ 0, 0, 0, 0, 0, 0, 0, 0 },
183
{ 0, 0, 0, 0, 0, 0, 0, 0 },
184
{ 0, 0, 0, 0, 0, 0, 0, 0 } },
185
{ { 0, MAXTRRES_B10_I8_D10_V2, MAXTRRES_B10_I8_D11_V2,
186
MAXTRRES_B10_I8_D12_V2, MAXTRRES_B10_I8_D13_V2,
187
MAXTRRES_B10_I8_D14_V2, MAXTRRES_B10_I8_D15_V2,
188
MAXTRRES_B10_I8_D16_V2 },
189
{ 0, MAXTRRES_B10_I9_D10_V2, MAXTRRES_B10_I9_D11_V2,
190
MAXTRRES_B10_I9_D12_V2, MAXTRRES_B10_I9_D13_V2,
191
MAXTRRES_B10_I9_D14_V2, MAXTRRES_B10_I9_D15_V2,
192
MAXTRRES_B10_I9_D16_V2 },
193
{ 0, 0, 0, 0, 0, 0, 0, 0 },
194
{ 0, 0, 0, 0, 0, 0, 0, 0 } },
195
{ { 0, 0, MAXTRRES_B11_I8_D11_V2, MAXTRRES_B11_I8_D12_V2,
196
MAXTRRES_B11_I8_D13_V2, MAXTRRES_B11_I8_D14_V2,
197
MAXTRRES_B11_I8_D15_V2, MAXTRRES_B11_I8_D16_V2 },
198
{ 0, 0, MAXTRRES_B11_I9_D11_V2, MAXTRRES_B11_I9_D12_V2,
199
MAXTRRES_B11_I9_D13_V2, MAXTRRES_B11_I9_D14_V2,
200
MAXTRRES_B11_I9_D15_V2, MAXTRRES_B11_I9_D16_V2 },
201
{ 0, 0, MAXTRRES_B11_I10_D11_V2, MAXTRRES_B11_I10_D12_V2,
202
MAXTRRES_B11_I10_D13_V2, MAXTRRES_B11_I10_D14_V2,
203
MAXTRRES_B11_I10_D15_V2, MAXTRRES_B11_I10_D16_V2 },
204
{ 0, 0, 0, 0, 0, 0, 0, 0 } },
205
{ { 0, 0, 0, MAXTRRES_B12_I8_D12_V2, MAXTRRES_B12_I8_D13_V2,
206
MAXTRRES_B12_I8_D14_V2, MAXTRRES_B12_I8_D15_V2,
207
MAXTRRES_B12_I8_D16_V2 },
208
{ 0, 0, 0, MAXTRRES_B12_I9_D12_V2, MAXTRRES_B12_I9_D13_V2,
209
MAXTRRES_B12_I9_D14_V2, MAXTRRES_B12_I9_D15_V2,
210
MAXTRRES_B12_I9_D16_V2 },
211
{ 0, 0, 0, MAXTRRES_B12_I10_D12_V2, MAXTRRES_B12_I10_D13_V2,
212
MAXTRRES_B12_I10_D14_V2, MAXTRRES_B12_I10_D15_V2,
213
MAXTRRES_B12_I10_D16_V2 },
214
{ 0, 0, 0, MAXTRRES_B12_I11_D12_V2, MAXTRRES_B12_I11_D13_V2,
215
MAXTRRES_B12_I11_D14_V2, MAXTRRES_B12_I11_D15_V2,
216
MAXTRRES_B12_I11_D16_V2 } },
217
{ { 0, 0, 0, 0, MAXTRRES_B13_I8_D13_V2, MAXTRRES_B13_I8_D14_V2,
218
MAXTRRES_B13_I8_D15_V2, MAXTRRES_B13_I8_D16_V2 },
219
{ 0, 0, 0, 0, MAXTRRES_B13_I9_D13_V2, MAXTRRES_B13_I9_D14_V2,
220
MAXTRRES_B13_I9_D15_V2, MAXTRRES_B13_I9_D16_V2 },
221
{ 0, 0, 0, 0, MAXTRRES_B13_I10_D13_V2, MAXTRRES_B13_I10_D14_V2,
222
MAXTRRES_B13_I10_D15_V2, MAXTRRES_B13_I10_D16_V2 },
223
{ 0, 0, 0, 0, MAXTRRES_B13_I11_D13_V2, MAXTRRES_B13_I11_D14_V2,
224
MAXTRRES_B13_I11_D15_V2, MAXTRRES_B13_I11_D16_V2 } },
225
{ { 0, 0, 0, 0, 0, MAXTRRES_B14_I8_D14_V2, MAXTRRES_B14_I8_D15_V2,
226
MAXTRRES_B14_I8_D16_V2 },
227
{ 0, 0, 0, 0, 0, MAXTRRES_B14_I9_D14_V2, MAXTRRES_B14_I9_D15_V2,
228
MAXTRRES_B14_I9_D16_V2 },
229
{ 0, 0, 0, 0, 0, MAXTRRES_B14_I10_D14_V2, MAXTRRES_B14_I10_D15_V2,
230
MAXTRRES_B14_I10_D16_V2 },
231
{ 0, 0, 0, 0, 0, MAXTRRES_B14_I11_D14_V2, MAXTRRES_B14_I11_D15_V2,
232
MAXTRRES_B14_I11_D16_V2 } },
233
{ { 0, 0, 0, 0, 0, 0, MAXTRRES_B15_I8_D15_V2, MAXTRRES_B15_I8_D16_V2 },
234
{ 0, 0, 0, 0, 0, 0, MAXTRRES_B15_I9_D15_V2, MAXTRRES_B15_I9_D16_V2 },
235
{ 0, 0, 0, 0, 0, 0, MAXTRRES_B15_I10_D15_V2,
236
MAXTRRES_B15_I10_D16_V2 },
237
{ 0, 0, 0, 0, 0, 0, MAXTRRES_B15_I11_D15_V2,
238
MAXTRRES_B15_I11_D16_V2 } },
239
{ { 0, 0, 0, 0, 0, 0, 0, MAXTRRES_B16_I8_D16_V2 },
240
{ 0, 0, 0, 0, 0, 0, 0, MAXTRRES_B16_I9_D16_V2 },
241
{ 0, 0, 0, 0, 0, 0, 0, MAXTRRES_B16_I10_D16_V2 },
242
{ 0, 0, 0, 0, 0, 0, 0, MAXTRRES_B16_I11_D16_V2, } },
246
* Use this before we have a superblock, else would use XFS_DTOBT
168
#define TERABYTES(count, blog) ((__uint64_t)(count) << (40 - (blog)))
169
#define GIGABYTES(count, blog) ((__uint64_t)(count) << (30 - (blog)))
170
#define MEGABYTES(count, blog) ((__uint64_t)(count) << (20 - (blog)))
173
* Use this macro before we have superblock and mount structure
248
175
#define DTOBT(d) ((xfs_drfsbno_t)((d) >> (blocklog - BBSHIFT)))
300
246
if (*dsunit && (*dswidth % *dsunit != 0)) {
302
"stripe width (%d) has to be a multiple of the stripe unit (%d)\n",
248
_("data stripe width (%d) must be a multiple of the "
249
"data stripe unit (%d)\n"), *dswidth, *dsunit);
309
get_default_blocksize(void)
311
size_t pagesize = getpagesize();
314
/* default is between 4K and 16K */
315
for (i = 12; i <= 16; i++)
316
if ((1 << i) == pagesize)
318
return (1 << XFS_DFL_BLOCKSIZE_LOG);
322
check_overwrite(char *device)
253
/* Handle log sunit options */
258
_("log su should not be used in "
259
"conjunction with log sunit\n"));
267
_("log sunit should not be used in "
268
"conjunction with log su\n"));
271
*lsunit = (int)BTOBBT(lsu);
326
281
if (device && *device) {
327
282
if ((type = fstype(device)) != NULL) {
329
"%s: %s appears to contain an existing filesystem (%s).\n",
330
progname, device, type);
284
_("%s: %s appears to contain an existing "
285
"filesystem (%s).\n"), progname, device, type);
333
288
if ((type = pttype(device)) != NULL) {
335
"%s: %s appears to contain a partition table (%s).\n",
336
progname, device, type);
290
_("%s: %s appears to contain a partition "
291
"table (%s).\n"), progname, device, type);
302
xfs_dfsbno_t logstart,
305
xfs_drfsbno_t *logblocks,
309
__uint64_t tmp_logblocks;
311
if ((logstart % sunit) != 0) {
312
logstart = ((logstart + (sunit - 1))/sunit) * sunit;
317
* Make sure that the log size is a multiple of the
320
if ((*logblocks % sunit) != 0) {
322
tmp_logblocks = ((*logblocks + (sunit - 1))
325
* If the log is too large, round down
326
* instead of round up
328
if ((tmp_logblocks > XFS_MAX_LOG_BLOCKS) ||
329
((tmp_logblocks << blocklog) > XFS_MAX_LOG_BYTES)) {
330
tmp_logblocks = (*logblocks / sunit) * sunit;
332
*logblocks = tmp_logblocks;
335
_("internal log size %lld is not a multiple "
336
"of the log stripe unit %d\n"),
337
(long long) *logblocks, sunit);
342
if (*logblocks > agsize - XFS_FSB_TO_AGBNO(mp, logstart)) {
344
_("Due to stripe alignment, the internal log size "
345
"(%lld) is too large.\n"), (long long) *logblocks);
346
fprintf(stderr, _("Must fit within an allocation group.\n"));
353
validate_log_size(__uint64_t logblocks, int blocklog, int min_logblocks)
355
if (logblocks < min_logblocks) {
357
_("log size %lld blocks too small, minimum size is %d blocks\n"),
358
(long long)logblocks, min_logblocks);
361
if (logblocks > XFS_MAX_LOG_BLOCKS) {
363
_("log size %lld blocks too large, maximum size is %d blocks\n"),
364
(long long)logblocks, XFS_MAX_LOG_BLOCKS);
367
if ((logblocks << blocklog) > XFS_MAX_LOG_BYTES) {
369
_("log size %lld bytes too large, maximum size is %d bytes\n"),
370
(long long)(logblocks << blocklog), XFS_MAX_LOG_BYTES);
376
calc_default_ag_geometry(
383
__uint64_t count = 0;
387
* First handle the extremes - the points at which we will
388
* always use the maximum AG size, the points at which we
389
* always use the minimum, and a "small-step" for 16-128Mb.
391
if (dblocks >= TERABYTES(64, blocklog)) {
392
blocks = XFS_AG_MAX_BLOCKS(blocklog);
394
} else if (dblocks < MEGABYTES(16, blocklog)) {
398
} else if (dblocks < MEGABYTES(128, blocklog)) {
399
blocks = MEGABYTES(16, blocklog);
404
* For the remainder we choose an AG size based on the
405
* number of data blocks available, trying to keep the
406
* number of AGs relatively small (especially compared
407
* to the original algorithm). AG count is calculated
408
* based on the prefered AG size, not vice-versa - the
409
* count can be increased by growfs, so prefer to use
410
* smaller counts at mkfs time.
412
* This scales us up smoothly between min/max AG sizes.
414
if (dblocks > GIGABYTES(512, blocklog))
416
else if (dblocks > GIGABYTES(8, blocklog))
418
else if (dblocks >= MEGABYTES(128, blocklog))
422
blocks = dblocks >> shift;
426
count = dblocks / blocks + (dblocks % blocks != 0);
432
validate_ag_geometry(
438
if (agsize < XFS_AG_MIN_BLOCKS(blocklog)) {
440
_("agsize (%lldb) too small, need at least %lld blocks\n"),
442
(long long)XFS_AG_MIN_BLOCKS(blocklog));
446
if (agsize > XFS_AG_MAX_BLOCKS(blocklog)) {
448
_("agsize (%lldb) too big, maximum is %lld blocks\n"),
450
(long long)XFS_AG_MAX_BLOCKS(blocklog));
454
if (agsize > dblocks) {
456
_("agsize (%lldb) too big, data area is %lld blocks\n"),
457
(long long)agsize, (long long)dblocks);
461
if (agsize < XFS_AG_MIN_BLOCKS(blocklog)) {
463
_("too many allocation groups for size = %lld\n"),
465
fprintf(stderr, _("need at most %lld allocation groups\n"),
466
(long long)(dblocks / XFS_AG_MIN_BLOCKS(blocklog) +
467
(dblocks % XFS_AG_MIN_BLOCKS(blocklog) != 0)));
471
if (agsize > XFS_AG_MAX_BLOCKS(blocklog)) {
473
_("too few allocation groups for size = %lld\n"), (long long)agsize);
475
_("need at least %lld allocation groups\n"),
476
(long long)(dblocks / XFS_AG_MAX_BLOCKS(blocklog) +
477
(dblocks % XFS_AG_MAX_BLOCKS(blocklog) != 0)));
482
* If the last AG is too small, reduce the filesystem size
483
* and drop the blocks.
485
if ( dblocks % agsize != 0 &&
486
(dblocks % agsize < XFS_AG_MIN_BLOCKS(blocklog))) {
488
_("last AG size %lld blocks too small, minimum size is %lld blocks\n"),
489
(long long)(dblocks % agsize),
490
(long long)XFS_AG_MIN_BLOCKS(blocklog));
495
* If agcount is too large, make it smaller.
497
if (agcount > XFS_MAX_AGNUMBER + 1) {
499
_("%lld allocation groups is too many, maximum is %lld\n"),
500
(long long)agcount, (long long)XFS_MAX_AGNUMBER + 1);
345
main(int argc, char **argv)
347
510
__uint64_t agcount;
558
730
reqval('d', dopts, D_SUNIT);
560
732
respec('d', dopts, D_SUNIT);
561
if (blflag || bsflag)
562
dsunit = cvtnum(blocksize,
565
dsunit = cvtnum(0, value);
733
if (!isdigits(value)) {
735
_("%s: Specify data sunit in 512-byte blocks, no unit suffix\n"),
739
dsunit = cvtnum(0, 0, value);
569
743
reqval('d', dopts, D_SWIDTH);
571
745
respec('d', dopts, D_SWIDTH);
572
if (blflag || bsflag)
573
dswidth = cvtnum(blocksize,
576
dswidth = cvtnum(0, value);
746
if (!isdigits(value)) {
748
_("%s: Specify data swidth in 512-byte blocks, no unit suffix\n"),
752
dswidth = cvtnum(0, 0, value);
580
756
reqval('d', dopts, D_SU);
582
758
respec('d', dopts, D_SU);
583
dsu = cvtnum(0, value);
760
blocksize, sectorsize, value);
587
764
reqval('d', dopts, D_SW);
589
766
respec('d', dopts, D_SW);
590
dsw = cvtnum(0, value);
767
if (!isdigits(value)) {
769
_("%s: Specify data sw as multiple of su, no unit suffix\n"),
773
dsw = cvtnum(0, 0, value);
592
775
case D_UNWRITTEN:
594
reqval('d', dopts, D_UNWRITTEN);
597
illegal(value, "d unwritten");
777
reqval('d', dopts, D_UNWRITTEN);
780
illegal(value, "d unwritten");
785
reqval('d', dopts, D_SECTLOG);
787
respec('d', dopts, D_SECTLOG);
789
conflict('d', dopts, D_SECTSIZE,
791
sectorlog = atoi(value);
793
illegal(value, "d sectlog");
794
sectorsize = 1 << sectorlog;
799
reqval('d', dopts, D_SECTSIZE);
801
respec('d', dopts, D_SECTSIZE);
803
conflict('d', dopts, D_SECTLOG,
806
blocksize, sectorsize, value);
807
if (sectorsize <= 0 ||
809
illegal(value, "d sectsize");
811
libxfs_highbit32(sectorsize);
601
815
unknown('d', value);
1173
while (*p != '\0') {
1176
switch (getsubopt(&p, (constpp)sopts, &value)) {
1180
reqval('s', sopts, S_SECTLOG);
1181
if (slflag || lslflag)
1182
respec('s', sopts, S_SECTLOG);
1183
if (ssflag || lssflag)
1184
conflict('s', sopts, S_SECTSIZE,
1186
sectorlog = atoi(value);
1188
illegal(value, "s sectlog");
1189
lsectorlog = sectorlog;
1190
sectorsize = 1 << sectorlog;
1191
lsectorsize = sectorsize;
1192
lslflag = slflag = 1;
1197
reqval('s', sopts, S_SECTSIZE);
1198
if (ssflag || lssflag)
1199
respec('s', sopts, S_SECTSIZE);
1200
if (slflag || lslflag)
1201
conflict('s', sopts, S_SECTLOG,
1203
sectorsize = cvtnum(
1204
blocksize, sectorsize, value);
1205
if (sectorsize <= 0 ||
1206
!ispow2(sectorsize))
1207
illegal(value, "s sectsize");
1208
lsectorsize = sectorsize;
1210
libxfs_highbit32(sectorsize);
1211
lsectorlog = sectorlog;
1212
lssflag = ssflag = 1;
1215
unknown('s', value);
892
printf("%s version %s\n", progname, VERSION);
1220
printf(_("%s version %s\n"), progname, VERSION);
895
1223
unknown(optopt, "");
898
1226
if (argc - optind > 1) {
899
fprintf(stderr, "extra arguments\n");
1227
fprintf(stderr, _("extra arguments\n"));
901
1229
} else if (argc - optind == 1) {
902
1230
dfile = xi.volname = argv[optind];
905
"cannot specify both %s and -d name=%s\n",
1233
_("cannot specify both %s and -d name=%s\n"),
906
1234
xi.volname, xi.dname);
910
1238
dfile = xi.dname;
911
/* option post-processing */
1241
* Blocksize and sectorsize first, other things depend on them
1243
if (!blflag && !bsflag) {
1244
blocklog = XFS_DFL_BLOCKSIZE_LOG;
1245
blocksize = 1 << XFS_DFL_BLOCKSIZE_LOG;
912
1247
if (blocksize < XFS_MIN_BLOCKSIZE || blocksize > XFS_MAX_BLOCKSIZE) {
913
fprintf(stderr, "illegal block size %d\n", blocksize);
1248
fprintf(stderr, _("illegal block size %d\n"), blocksize);
1251
if (sectorsize < XFS_MIN_SECTORSIZE ||
1252
sectorsize > XFS_MAX_SECTORSIZE || sectorsize > blocksize) {
1253
fprintf(stderr, _("illegal sector size %d\n"), sectorsize);
1256
if (lsectorsize < XFS_MIN_SECTORSIZE ||
1257
lsectorsize > XFS_MAX_SECTORSIZE || lsectorsize > blocksize) {
1258
fprintf(stderr, _("illegal log sector size %d\n"), lsectorsize);
1260
} else if (lsectorsize > XFS_MIN_SECTORSIZE && !lsu && !lsunit) {
917
1266
dirversion = (nsflag || nlflag) ? 2 : XFS_DFL_DIR_VERSION;
918
1267
switch (dirversion) {
920
1269
if ((nsflag || nlflag) && dirblocklog != blocklog) {
921
fprintf(stderr, "illegal directory block size %d\n",
1270
fprintf(stderr, _("illegal directory block size %d\n"),
983
1329
#ifdef HAVE_VOLUME_MANAGER
984
1330
if (xi.lisfile && (!logsize || !xi.logname)) {
986
"if -l file then -l name and -l size are required\n");
1332
_("if -l file then -l name and -l size are required\n"));
991
1337
__uint64_t logbytes;
993
logbytes = cvtnum(blocksize, logsize);
1339
logbytes = cvtnum(blocksize, sectorsize, logsize);
994
1340
if (logbytes % XFS_MIN_BLOCKSIZE) {
996
"illegal log length %lld, not a multiple of %d\n",
1342
_("illegal log length %lld, not a multiple of %d\n"),
997
1343
(long long)logbytes, XFS_MIN_BLOCKSIZE);
1000
1346
logblocks = (xfs_drfsbno_t)(logbytes >> blocklog);
1001
1347
if (logbytes % blocksize)
1002
1348
fprintf(stderr,
1003
"warning: log length %lld not a multiple of %d, truncated to %lld\n",
1349
_("warning: log length %lld not a multiple of %d, truncated to %lld\n"),
1004
1350
(long long)logbytes, blocksize,
1005
1351
(long long)(logblocks << blocklog));
1007
1353
#ifdef HAVE_VOLUME_MANAGER
1008
1354
if (xi.risfile && (!rtsize || !xi.rtname)) {
1009
1355
fprintf(stderr,
1010
"if -r file then -r name and -r size are required\n");
1356
_("if -r file then -r name and -r size are required\n"));
1015
1361
__uint64_t rtbytes;
1017
rtbytes = cvtnum(blocksize, rtsize);
1363
rtbytes = cvtnum(blocksize, sectorsize, rtsize);
1018
1364
if (rtbytes % XFS_MIN_BLOCKSIZE) {
1019
1365
fprintf(stderr,
1020
"illegal rt length %lld, not a multiple of %d\n",
1366
_("illegal rt length %lld, not a multiple of %d\n"),
1021
1367
(long long)rtbytes, XFS_MIN_BLOCKSIZE);
1024
1370
rtblocks = (xfs_drfsbno_t)(rtbytes >> blocklog);
1025
1371
if (rtbytes % blocksize)
1026
1372
fprintf(stderr,
1027
"warning: rt length %lld not a multiple of %d, truncated to %lld\n",
1373
_("warning: rt length %lld not a multiple of %d, truncated to %lld\n"),
1028
1374
(long long)rtbytes, blocksize,
1029
1375
(long long)(rtblocks << blocklog));
1134
1486
if (check_overwrite(dfile) ||
1135
1487
check_overwrite(logfile) ||
1136
1488
check_overwrite(xi.rtname)) {
1137
fprintf(stderr, "%s: "
1138
"Use the -f option to force overwrite.\n",
1490
_("%s: Use the -f option to force overwrite.\n"),
1144
if (!xi.disfile && do_overlap_checks) {
1146
* do partition overlap check
1147
* If this is a straight file we assume that it's been created
1148
* before the call to mnt_check_init()
1151
if (mnt_check_init(&mnt_check_state) == -1) {
1153
"unable to initialize mount checking "
1154
"routines, bypassing protection checks.\n");
1156
mnt_partition_count = mnt_find_mount_conflicts(
1157
mnt_check_state, dfile);
1160
* ignore -1 return codes, since 3rd party devices
1161
* may not be part of hinv.
1163
if (mnt_partition_count > 0) {
1164
if (mnt_causes_test(mnt_check_state, MNT_CAUSE_MOUNTED)) {
1165
fprintf(stderr, "%s: "
1166
"%s is already in use.\n",
1168
} else if (mnt_causes_test(mnt_check_state, MNT_CAUSE_OVERLAP)) {
1169
fprintf(stderr, "%s: "
1170
"%s overlaps partition(s) "
1171
"already in use.\n",
1174
mnt_causes_show(mnt_check_state, stderr, progname);
1176
fprintf(stderr, "\n");
1178
mnt_plist_show(mnt_check_state, stderr, progname);
1179
fprintf(stderr, "\n");
1181
mnt_check_end(mnt_check_state);
1182
if (mnt_partition_count > 0) {
1188
1496
if (!liflag && !ldflag)
1189
1497
loginternal = xi.logdev == 0;
1190
1498
if (xi.logname)
1191
1499
logfile = xi.logname;
1192
1500
else if (loginternal)
1193
logfile = "internal log";
1501
logfile = _("internal log");
1194
1502
else if (xi.volname && xi.logdev)
1195
logfile = "volume log";
1503
logfile = _("volume log");
1196
1504
else if (!ldflag) {
1197
fprintf(stderr, "no log subvolume or internal log\n");
1505
fprintf(stderr, _("no log subvolume or internal log\n"));
1201
1509
rtfile = xi.rtname;
1203
1511
if (xi.volname && xi.rtdev)
1204
rtfile = "volume rt";
1512
rtfile = _("volume rt");
1205
1513
else if (!xi.rtdev)
1207
1515
if (dsize && xi.dsize > 0 && dblocks > DTOBT(xi.dsize)) {
1208
1516
fprintf(stderr,
1209
"size %s specified for data subvolume is too large, maximum is %lld blocks\n",
1517
_("size %s specified for data subvolume is too large, "
1518
"maximum is %lld blocks\n"),
1210
1519
dsize, (long long)DTOBT(xi.dsize));
1212
1521
} else if (!dsize && xi.dsize > 0)
1213
1522
dblocks = DTOBT(xi.dsize);
1214
1523
else if (!dsize) {
1215
fprintf(stderr, "can't get size of data subvolume\n");
1524
fprintf(stderr, _("can't get size of data subvolume\n"));
1218
1527
if (dblocks < XFS_MIN_DATA_BLOCKS) {
1219
1528
fprintf(stderr,
1220
"size %lld of data subvolume is too small, minimum %d blocks\n",
1529
_("size %lld of data subvolume is too small, minimum %d blocks\n"),
1221
1530
(long long)dblocks, XFS_MIN_DATA_BLOCKS);
1224
if (xi.logdev && loginternal) {
1225
fprintf(stderr, "can't have both external and internal logs\n");
1228
if (dirversion == 1)
1229
i = max_trres_v1[blocklog - XFS_MIN_BLOCKSIZE_LOG]
1230
[inodelog - XFS_DINODE_MIN_LOG];
1232
i = max_trres_v2[blocklog - XFS_MIN_BLOCKSIZE_LOG]
1233
[inodelog - XFS_DINODE_MIN_LOG]
1234
[dirblocklog - XFS_MIN_BLOCKSIZE_LOG];
1235
min_logblocks = MAX(XFS_MIN_LOG_BLOCKS, i * XFS_MIN_LOG_FACTOR);
1534
if (loginternal && xi.logdev) {
1536
_("can't have both external and internal logs\n"));
1538
} else if (loginternal && sectorsize != lsectorsize) {
1540
_("data and log sector sizes must be equal for internal logs\n"));
1544
if (xi.dbsize > sectorsize) {
1546
"Warning: the data subvolume sector size %u is less than the sector size \n\
1547
reported by the device (%u).\n"),
1548
sectorsize, xi.dbsize);
1550
if (!loginternal && xi.lbsize > lsectorsize) {
1552
"Warning: the log subvolume sector size %u is less than the sector size\n\
1553
reported by the device (%u).\n"),
1554
lsectorsize, xi.lbsize);
1556
if (rtsize && xi.rtsize > 0 && xi.rtbsize > sectorsize) {
1558
"Warning: the realtime subvolume sector size %u is less than the sector size\n\
1559
reported by the device (%u).\n"),
1560
sectorsize, xi.rtbsize);
1563
max_tr_res = max_trans_res(dirversion,
1564
sectorlog, blocklog, inodelog, dirblocklog);
1566
min_logblocks = max_tr_res * XFS_MIN_LOG_FACTOR;
1567
min_logblocks = MAX(XFS_MIN_LOG_BLOCKS, min_logblocks);
1568
if (!logsize && dblocks >= (1024*1024*1024) >> blocklog)
1569
min_logblocks = MAX(min_logblocks, (10*1024*1024)>>blocklog);
1236
1570
if (logsize && xi.logBBsize > 0 && logblocks > DTOBT(xi.logBBsize)) {
1237
1571
fprintf(stderr,
1238
"size %s specified for log subvolume is too large, maximum is %lld blocks\n",
1572
_("size %s specified for log subvolume is too large, maximum is %lld blocks\n"),
1239
1573
logsize, (long long)DTOBT(xi.logBBsize));
1241
} else if (!logsize && xi.logBBsize > 0)
1575
} else if (!logsize && xi.logBBsize > 0) {
1242
1576
logblocks = DTOBT(xi.logBBsize);
1243
else if (logsize && !xi.logdev && !loginternal) {
1577
} else if (logsize && !xi.logdev && !loginternal) {
1244
1578
fprintf(stderr,
1245
"size specified for non-existent log subvolume\n");
1579
_("size specified for non-existent log subvolume\n"));
1247
1581
} else if (loginternal && logsize && logblocks >= dblocks) {
1248
fprintf(stderr, "size %lld too large for internal log\n",
1582
fprintf(stderr, _("size %lld too large for internal log\n"),
1249
1583
(long long)logblocks);
1251
} else if (!loginternal && !xi.logdev)
1585
} else if (!loginternal && !xi.logdev) {
1253
else if (loginternal && !logsize) {
1587
} else if (loginternal && !logsize) {
1255
1589
* logblocks grows from min_logblocks to XFS_MAX_LOG_BLOCKS
1258
* 8192 = 1TB / MAX_LOG_BYTES
1592
* 2048 = 128GB / MAX_LOG_BYTES
1260
logblocks = (dblocks << blocklog) / 8192;
1594
logblocks = (dblocks << blocklog) / 2048;
1261
1595
logblocks = logblocks >> blocklog;
1262
1596
logblocks = MAX(min_logblocks, logblocks);
1263
logblocks = MAX(logblocks,
1264
MAX(XFS_DFL_LOG_SIZE, i * XFS_DFL_LOG_FACTOR));
1265
logblocks = MIN(logblocks, XFS_MAX_LOG_BLOCKS);
1597
logblocks = MAX(logblocks,
1598
MAX(XFS_DFL_LOG_SIZE,
1599
max_tr_res * XFS_DFL_LOG_FACTOR));
1600
logblocks = MIN(logblocks, XFS_MAX_LOG_BLOCKS);
1266
1601
if ((logblocks << blocklog) > XFS_MAX_LOG_BYTES) {
1267
1602
logblocks = XFS_MAX_LOG_BYTES >> blocklog;
1270
if (logblocks < min_logblocks) {
1272
"log size %lld blocks too small, minimum size is %d blocks\n",
1273
(long long)logblocks, min_logblocks);
1276
if (logblocks > XFS_MAX_LOG_BLOCKS) {
1278
"log size %lld blocks too large, maximum size is %d blocks\n",
1279
(long long)logblocks, XFS_MAX_LOG_BLOCKS);
1282
if ((logblocks << blocklog) > XFS_MAX_LOG_BYTES) {
1284
"log size %lld bytes too large, maximum size is %d bytes\n",
1285
(long long)(logblocks << blocklog), XFS_MAX_LOG_BYTES);
1605
validate_log_size(logblocks, blocklog, min_logblocks);
1288
1607
if (rtsize && xi.rtsize > 0 && rtblocks > DTOBT(xi.rtsize)) {
1289
1608
fprintf(stderr,
1290
"size %s specified for rt subvolume is too large, maximum is %lld blocks\n",
1609
_("size %s specified for rt subvolume is too large, "
1610
"maximum is %lld blocks\n"),
1291
1611
rtsize, (long long)DTOBT(xi.rtsize));
1293
1613
} else if (!rtsize && xi.rtsize > 0)
1294
1614
rtblocks = DTOBT(xi.rtsize);
1295
1615
else if (rtsize && !xi.rtdev) {
1296
1616
fprintf(stderr,
1297
"size specified for non-existent rt subvolume\n");
1617
_("size specified for non-existent rt subvolume\n"));
1300
1620
if (xi.rtdev) {
1628
if (dasize) { /* User-specified AG size */
1310
* If the specified agsize isn't a multiple of fs blks,
1630
* Check specified agsize is a multiple of blocksize.
1313
1632
if (agsize % blocksize) {
1314
1633
fprintf(stderr,
1315
"agsize (%lld) not a multiple of fs blk size (%d)\n",
1634
_("agsize (%lld) not a multiple of fs blk size (%d)\n"),
1316
1635
(long long)agsize, blocksize);
1320
1638
agsize /= blocksize;
1323
* If the specified agsize is too small, or too large,
1326
if (agsize < XFS_AG_MIN_BLOCKS(blocklog)) {
1328
"agsize (%lldb) too small, need at least %lld blocks\n",
1330
(long long)XFS_AG_MIN_BLOCKS(blocklog));
1334
if (agsize > XFS_AG_MAX_BLOCKS(blocklog)) {
1336
"agsize (%lldb) too big, maximum is %lld blocks\n",
1338
(long long)XFS_AG_MAX_BLOCKS(blocklog));
1342
if (agsize > dblocks) {
1344
"agsize (%lldb) too big, data area is %lld blocks\n",
1345
(long long)agsize, (long long)dblocks);
1349
agcount = dblocks / agsize + (dblocks % agsize != 0);
1351
agsize = dblocks / agcount + (dblocks % agcount != 0);
1355
* If the ag size is too small, complain if agcount/agsize was
1356
* specified, and fix it otherwise.
1358
if (agsize < XFS_AG_MIN_BLOCKS(blocklog)) {
1359
if (daflag || dasize) {
1361
"too many allocation groups for size = %lld\n",
1363
fprintf(stderr, "need at most %lld allocation groups\n",
1365
(dblocks / XFS_AG_MIN_BLOCKS(blocklog) +
1366
(dblocks % XFS_AG_MIN_BLOCKS(blocklog) != 0)));
1369
agsize = XFS_AG_MIN_BLOCKS(blocklog);
1370
if (dblocks < agsize)
1373
agcount = dblocks / agsize;
1375
agsize = dblocks / agcount + (dblocks % agcount != 0);
1379
* If the ag size is too large, complain if agcount/agsize was
1380
* specified, and fix it otherwise.
1382
else if (agsize > XFS_AG_MAX_BLOCKS(blocklog)) {
1383
if (daflag || dasize) {
1384
fprintf(stderr, "too few allocation groups for size = %lld\n",
1387
"need at least %lld allocation groups\n",
1389
(dblocks / XFS_AG_MAX_BLOCKS(blocklog) +
1390
(dblocks % XFS_AG_MAX_BLOCKS(blocklog) != 0)));
1393
agsize = XFS_AG_MAX_BLOCKS(blocklog);
1394
agcount = dblocks / agsize + (dblocks % agsize != 0);
1398
* if user set the AG size, and if the last AG is too small,
1399
* reduce the filesystem size and drop the blocks.
1402
(dblocks % agsize < XFS_AG_MIN_BLOCKS(blocklog))) {
1403
dblocks -= dblocks % agsize;
1407
* If agcount was not specified, and agsize is larger than
1408
* we'd like, make it the size we want.
1410
if (!daflag && !dasize &&
1411
(agsize > XFS_AG_BEST_BLOCKS(blocklog,dblocks))) {
1412
agsize = XFS_AG_BEST_BLOCKS(blocklog,dblocks);
1414
* If the last AG is too small, reduce the filesystem size
1415
* and drop the blocks.
1417
if (dblocks % agsize < XFS_AG_MIN_BLOCKS(blocklog)) {
1418
dblocks -= dblocks % agsize;
1420
agcount = dblocks / agsize + (dblocks % agsize != 0);
1424
* If agcount is too large, make it smaller.
1426
if (agcount > XFS_MAX_AGNUMBER + 1) {
1427
agcount = XFS_MAX_AGNUMBER + 1;
1428
agsize = dblocks / agcount + (dblocks % agcount != 0);
1430
if (dasize || daflag)
1432
"agsize set to %lld, agcount %lld > max (%lld)\n",
1433
(long long)agsize, (long long)agcount,
1434
(long long)XFS_MAX_AGNUMBER+1);
1436
if (agsize > XFS_AG_MAX_BLOCKS(blocklog)) {
1440
fprintf(stderr, "%s: can't compute agsize/agcount\n",
1639
agcount = dblocks / agsize + (dblocks % agsize != 0);
1641
} else if (daflag) /* User-specified AG size */
1642
agsize = dblocks / agcount + (dblocks % agcount != 0);
1644
calc_default_ag_geometry(blocklog, dblocks, &agsize, &agcount);
1647
* If the last AG is too small, reduce the filesystem size
1648
* and drop the blocks.
1650
if ( dblocks % agsize != 0 &&
1651
(dblocks % agsize < XFS_AG_MIN_BLOCKS(blocklog))) {
1652
dblocks = (xfs_drfsbno_t)((agcount - 1) * agsize);
1654
ASSERT(agcount != 0);
1657
validate_ag_geometry(blocklog, dblocks, agsize, agcount);
1446
1659
xlv_dsunit = xlv_dswidth = 0;
1448
get_subvol_stripe_wrapper(dfile, SVTYPE_DATA, &xlv_dsunit,
1661
get_subvol_stripe_wrapper(dfile, SVTYPE_DATA,
1662
&xlv_dsunit, &xlv_dswidth);
1452
1665
if (xlv_dsunit && xlv_dsunit != dsunit) {
1453
fprintf(stderr, "%s: "
1454
"Specified data stripe unit %d is not the same as the xlv stripe unit %d\n",
1667
_("%s: Specified data stripe unit %d is not "
1668
"the same as the volume stripe unit %d\n"),
1455
1669
progname, dsunit, xlv_dsunit);
1458
1671
if (xlv_dswidth && xlv_dswidth != dswidth) {
1459
fprintf(stderr, "%s: "
1460
"Specified data stripe width (%d) is not the same as the xlv stripe width (%d)\n",
1673
_("%s: Specified data stripe width %d is not "
1674
"the same as the volume stripe width %d\n"),
1461
1675
progname, dswidth, xlv_dswidth);
1465
1678
dsunit = xlv_dsunit;
1502
1715
(dblocks % agsize != 0);
1503
1716
if (dasize || daflag)
1504
1717
fprintf(stderr,
1505
"agsize rounded to %lld, swidth = %d\n",
1718
_("agsize rounded to %lld, swidth = %d\n"),
1506
1719
(long long)agsize, dswidth);
1508
1721
if (nodsflag) {
1509
1722
dsunit = dswidth = 0;
1511
1724
fprintf(stderr,
1512
"Allocation group size %lld is not a multiple of the stripe unit %d\n",
1725
_("Allocation group size (%lld) is not a multiple of the stripe unit (%d)\n"),
1513
1726
(long long)agsize, dsunit);
1731
if (dswidth && ((agsize % dswidth) == 0) && (agcount > 1)) {
1732
/* This is a non-optimal configuration because all AGs
1733
* start on the same disk in the stripe. Changing
1734
* the AG size by one sunit will guarantee that this
1737
tmp_agsize = agsize - dsunit;
1738
if (tmp_agsize < XFS_AG_MIN_BLOCKS(blocklog)) {
1739
tmp_agsize = agsize + dsunit;
1740
if (dblocks < agsize) {
1741
/* oh well, nothing to do */
1742
tmp_agsize = agsize;
1745
if (daflag || dasize) {
1747
"Warning: AG size is a multiple of stripe width. This can cause performance\n\
1748
problems by aligning all AGs on the same disk. To avoid this, run mkfs with\n\
1749
an AG size that is one stripe unit smaller, for example %llu.\n"),
1750
(unsigned long long)tmp_agsize);
1752
agsize = tmp_agsize;
1753
agcount = dblocks/agsize + (dblocks % agsize != 0);
1755
* If the last AG is too small, reduce the
1756
* filesystem size and drop the blocks.
1758
if ( dblocks % agsize != 0 &&
1760
XFS_AG_MIN_BLOCKS(blocklog))) {
1761
dblocks = (xfs_drfsbno_t)((agcount - 1) * agsize);
1763
ASSERT(agcount != 0);
1520
1769
dsunit = dswidth = 0;
1522
fprintf(stderr, "%s: "
1523
"Stripe unit(%d) or stripe width(%d) is not a multiple of the block size(%d)\n",
1524
progname, dsunit, dswidth, blocksize);
1772
_("%s: Stripe unit(%d) or stripe width(%d) is "
1773
"not a multiple of the block size(%d)\n"),
1774
progname, BBTOB(dsunit), BBTOB(dswidth),
1781
* check that log sunit is modulo fsblksize or default it to dsunit.
1785
if ((BBTOB(lsunit) % blocksize != 0)) {
1787
_("log stripe unit (%d) must be a multiple of the block size (%d)\n"),
1788
BBTOB(lsunit), blocksize);
1791
/* convert from 512 byte blocks to fs blocks */
1792
lsunit = DTOBT(lsunit);
1793
} else if (logversion == 2 && loginternal && dsunit) {
1794
/* lsunit and dsunit now in fs blocks */
1798
if (logversion == 2 && (lsunit * blocksize) > 256 * 1024) {
1800
_("log stripe unit (%d bytes) is too large (maximum is 256KiB)\n"),
1801
(lsunit * blocksize));
1802
lsunit = (32 * 1024) >> blocklog;
1803
fprintf(stderr, _("log stripe unit adjusted to 32KiB\n"));
1529
1806
protostring = setup_proto(protofile);
1556
1844
* Align the logstart at stripe unit boundary.
1558
if (dsunit && ((logstart % dsunit) != 0)) {
1559
logstart = ((logstart + (dsunit - 1))/dsunit) * dsunit;
1561
* Make sure that the log size is a multiple of the
1564
if ((logblocks % dsunit) != 0) {
1566
tmp_logblocks = ((logblocks + (dsunit - 1))
1569
* If the log is too large, round down
1570
* instead of round up
1572
if ((tmp_logblocks > XFS_MAX_LOG_BLOCKS) ||
1573
((tmp_logblocks << blocklog) > XFS_MAX_LOG_BYTES)) {
1574
tmp_logblocks = (logblocks / dsunit) * dsunit;
1576
logblocks = tmp_logblocks;
1579
"internal log size %lld is not a multiple of the stripe unit %d\n",
1580
(long long)logblocks, dsunit);
1585
if (logblocks > agsize-XFS_FSB_TO_AGBNO(mp,logstart)) {
1587
"Due to stripe alignment, the internal log size %lld is too large.\n"
1588
"Must fit in allocation group\n",
1589
(long long)logblocks);
1847
logstart = fixup_log_stripe(mp, lsflag, logstart,
1848
agsize, lsunit, &logblocks, blocklog,
1850
} else if (dsunit) {
1851
logstart = fixup_log_stripe(mp, lsflag, logstart,
1852
agsize, dsunit, &logblocks, blocklog,
1855
min_logblocks = max_tr_res * XFS_MIN_LOG_FACTOR;
1856
min_logblocks = MAX(min_logblocks, XFS_MIN_LOG_BLOCKS);
1857
validate_log_size(logblocks, blocklog, min_logblocks);
1861
if (!qflag || Nflag) {
1863
"meta-data=%-22s isize=%-6d agcount=%lld, agsize=%lld blks\n"
1864
" =%-22s sectsz=%-5u\n"
1865
"data =%-22s bsize=%-6u blocks=%llu, imaxpct=%u\n"
1866
" =%-22s sunit=%-6u swidth=%u blks, unwritten=%u\n"
1867
"naming =version %-14u bsize=%-6u\n"
1868
"log =%-22s bsize=%-6d blocks=%lld, version=%d\n"
1869
" =%-22s sectsz=%-5u sunit=%d blks\n"
1870
"realtime =%-22s extsz=%-6d blocks=%lld, rtextents=%lld\n"),
1871
dfile, isize, (long long)agcount, (long long)agsize,
1873
"", blocksize, (long long)dblocks,
1874
imflag ? imaxpct : XFS_DFL_IMAXIMUM_PCT,
1875
"", dsunit, dswidth, extent_flagging,
1876
dirversion, dirversion == 1 ? blocksize : dirblocksize,
1877
logfile, 1 << blocklog, (long long)logblocks,
1878
logversion, "", lsectorsize, lsunit,
1879
rtfile, rtextblocks << blocklog,
1880
(long long)rtblocks, (long long)rtextents);
1598
1886
strncpy(sbp->sb_fname, label, sizeof(sbp->sb_fname));
1599
1887
sbp->sb_magicnum = XFS_SB_MAGIC;
1632
1920
sbp->sb_width = dswidth;
1633
1921
if (dirversion == 2)
1634
1922
sbp->sb_dirblklog = dirblocklog - blocklog;
1923
if (logversion == 2) { /* This is stored in bytes */
1924
lsunit = (lsunit == 0) ? 1 : XFS_FSB_TO_B(mp, lsunit);
1925
sbp->sb_logsunit = lsunit;
1927
sbp->sb_logsunit = 0;
1636
1929
sbp->sb_inoalignmt = XFS_INODE_BIG_CLUSTER_SIZE >> blocklog;
1637
1930
iaflag = sbp->sb_inoalignmt != 0;
1639
1932
sbp->sb_inoalignmt = 0;
1933
if (lsectorsize != BBSIZE || sectorsize != BBSIZE) {
1934
sbp->sb_logsectlog = (__uint8_t)lsectorlog;
1935
sbp->sb_logsectsize = (__uint16_t)lsectorsize;
1937
sbp->sb_logsectlog = 0;
1938
sbp->sb_logsectsize = 0;
1640
1940
sbp->sb_versionnum =
1641
1941
XFS_SB_VERSION_MKFS(iaflag, dsunit != 0, extent_flagging,
1942
dirversion == 2, logversion == 2,
1943
(sectorsize != BBSIZE || lsectorsize != BBSIZE), 0);
1944
sbp->sb_features2 = XFS_SB_VERSION2_MKFS(0);
1645
* Zero out the first 68k in on the device, to obliterate any old
1946
* Zero out the beginning of the device, to obliterate any old
1646
1947
* filesystem signatures out there. This should take care of
1647
1948
* swap (somewhere around the page size), jfs (32k),
1648
* ext[2,3] and reiser (64k) - and hopefully all else.
1949
* ext[2,3] and reiserfs (64k) - and hopefully all else.
1651
buf = libxfs_getbuf(xi.ddev, 0, 136);
1652
bzero(XFS_BUF_PTR(buf), 136*BBSIZE);
1653
libxfs_writebuf(buf, 1);
1951
buf = libxfs_getbuf(xi.ddev, 0, BTOBB(WHACK_SIZE));
1952
bzero(XFS_BUF_PTR(buf), WHACK_SIZE);
1953
libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE);
1655
1955
/* OK, now write the superblock */
1656
buf = libxfs_getbuf(xi.ddev, XFS_SB_DADDR, 1);
1657
bzero(XFS_BUF_PTR(buf), BBSIZE);
1956
buf = libxfs_getbuf(xi.ddev, XFS_SB_DADDR, XFS_FSS_TO_BB(mp, 1));
1957
bzero(XFS_BUF_PTR(buf), sectorsize);
1658
1958
libxfs_xlate_sb(XFS_BUF_PTR(buf), sbp, -1, ARCH_CONVERT,
1659
1959
XFS_SB_ALL_BITS);
1660
libxfs_writebuf(buf, 1);
1960
libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE);
1664
"meta-data=%-22s isize=%-6d agcount=%lld, agsize=%lld blks\n"
1665
"data =%-22s bsize=%-6d blocks=%lld, imaxpct=%d\n"
1666
" =%-22s sunit=%-6d swidth=%d blks, unwritten=%d\n"
1667
"naming =version %-14d bsize=%-6d\n"
1668
"log =%-22s bsize=%-6d blocks=%lld\n"
1669
"realtime =%-22s extsz=%-6d blocks=%lld, rtextents=%lld\n",
1670
dfile, isize, (long long)agcount, (long long)agsize,
1671
"", blocksize, (long long)dblocks, sbp->sb_imax_pct,
1672
"", dsunit, dswidth, extent_flagging,
1673
dirversion, dirversion == 1 ? blocksize : dirblocksize,
1674
logfile, 1 << blocklog, (long long)logblocks,
1675
rtfile, rtextblocks << blocklog,
1676
(long long)rtblocks, (long long)rtextents);
1678
1963
* If the data area is a file, then grow it out to its final size
1679
1964
* so that the reads for the end of the device in the mount code
1680
1965
* will succeed.
1682
1967
if (xi.disfile && ftruncate64(xi.dfd, dblocks * blocksize) < 0) {
1683
fprintf(stderr, "%s: Growing the data section file failed\n",
1968
fprintf(stderr, _("%s: Growing the data section failed\n"),
1689
* Zero out the last 64k on the device, to obliterate any
1974
* Zero out the end of the device, to obliterate any
1690
1975
* old MD RAID (or other) metadata at the end of the device.
1976
* (MD sb is ~64k from the end, take out a wider swath to be sure)
1692
1978
if (!xi.disfile) {
1693
buf = libxfs_getbuf(xi.ddev, (xi.dsize - BTOBB(65536)),
1695
bzero(XFS_BUF_PTR(buf), 65536);
1696
libxfs_writebuf(buf, 1);
1979
buf = libxfs_getbuf(xi.ddev, (xi.dsize - BTOBB(WHACK_SIZE)),
1981
bzero(XFS_BUF_PTR(buf), WHACK_SIZE);
1982
libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE);
2077
2367
if (*sp == 'b' && sp[1] == '\0') {
2079
2369
return i * blocksize;
2081
fprintf(stderr, "blocksize not available yet.\n");
2370
fprintf(stderr, _("blocksize not available yet.\n"));
2373
if (*sp == 's' && sp[1] == '\0') {
2375
return i * sectorsize;
2085
2378
if (*sp == 'k' && sp[1] == '\0')
2086
2379
return 1024LL * i;
2087
2380
if (*sp == 'm' && sp[1] == '\0')
2088
2381
return 1024LL * 1024LL * i;
2089
2382
if (*sp == 'g' && sp[1] == '\0')
2090
2383
return 1024LL * 1024LL * 1024LL * i;
2384
if (*sp == 't' && sp[1] == '\0')
2385
return 1024LL * 1024LL * 1024LL * 1024LL * i;
2386
if (*sp == 'p' && sp[1] == '\0')
2387
return 1024LL * 1024LL * 1024LL * 1024LL * 1024LL * i;
2097
fprintf(stderr, "Usage: %s\n\
2394
fprintf(stderr, _("Usage: %s\n\
2098
2395
/* blocksize */ [-b log=n|size=num]\n\
2099
2396
/* data subvol */ [-d agcount=n,agsize=n,file,name=xxx,size=num,\n\
2100
sunit=value,swidth=value,unwritten=0|1,\n\
2101
su=value,sw=value]\n\
2397
(sunit=value,swidth=value|su=num,sw=num),\n\
2398
sectlog=n|sectsize=num,unwritten=0|1]\n\
2102
2399
/* inode size */ [-i log=n|perblock=n|size=num,maxpct=n]\n\
2103
/* log subvol */ [-l agnum=n,internal,size=num,logdev=xxx]\n\
2104
/* naming */ [-n log=n|size=num|version=n]\n\
2400
/* log subvol */ [-l agnum=n,internal,size=num,logdev=xxx,version=n\n\
2401
sunit=value|su=num,sectlog=n|sectsize=num]\n\
2105
2402
/* label */ [-L label (maximum 12 characters)]\n\
2403
/* naming */ [-n log=n|size=num,version=n]\n\
2106
2404
/* prototype file */ [-p fname]\n\
2107
2405
/* quiet */ [-q]\n\
2406
/* realtime subvol */ [-r extsize=num,size=num,rtdev=xxx]\n\
2407
/* sectorsize */ [-s log=n|size=num]\n\
2108
2408
/* version */ [-V]\n\
2109
/* realtime subvol */ [-r extsize=num,size=num,rtdev=xxx]\n\
2111
2410
<devicename> is required unless -d name=xxx is given.\n\
2112
Internal log by default, size is scaled from 1,000 blocks to 32,768 blocks\n\
2113
based on the filesystem size. Default log reaches its largest size at 1TB.\n\
2114
This can be overridden with the -l options or using a volume manager with a\n\
2116
<num> is xxx (bytes), or xxxb (blocks), or xxxk (xxx KB), or xxxm (xxx MB)\n\
2117
<value> is xxx (512 blocks).\n",
2411
<num> is xxx (bytes), xxxs (sectors), xxxb (fs blocks), xxxk (xxx KiB),\n\
2412
xxxm (xxx MiB), xxxg (xxx GiB), xxxt (xxx TiB) or xxxp (xxx PiB).\n\
2413
<value> is xxx (512 byte blocks).\n"),