2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 4. Neither the name of the University nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 static const char copyright[] =
33 "@(#) Copyright (c) 1983, 1993\n\
34 The Regents of the University of California. All rights reserved.\n";
38 static char sccsid[] = "@(#)tunefs.c 8.2 (Berkeley) 4/19/94";
41 #include <sys/cdefs.h>
42 __FBSDID("$FreeBSD$");
45 * tunefs: change layout parameters to an existing file system.
47 #include <sys/param.h>
48 #include <sys/mount.h>
49 #include <sys/disklabel.h>
52 #include <ufs/ufs/ufsmount.h>
53 #include <ufs/ufs/dinode.h>
54 #include <ufs/ffs/fs.h>
55 #include <ufs/ufs/dir.h>
69 /* the optimization warning string template */
70 #define OPTWARN "should optimize for %s with minfree %s %d%%"
73 #define sblock disk.d_fs
77 int journal_alloc(int64_t size);
78 void journal_clear(void);
82 main(int argc, char *argv[])
84 char *avalue, *jvalue, *Jvalue, *Lvalue, *lvalue, *Nvalue, *nvalue;
85 const char *special, *on;
88 int Aflag, aflag, eflag, evalue, fflag, fvalue, jflag, Jflag, Lflag;
89 int lflag, mflag, mvalue, Nflag, nflag, oflag, ovalue, pflag, sflag;
90 int svalue, Sflag, Svalue;
98 Aflag = aflag = eflag = fflag = jflag = Jflag = Lflag = lflag = 0;
99 mflag = Nflag = nflag = oflag = pflag = sflag = 0;
100 avalue = jvalue = Jvalue = Lvalue = lvalue = Nvalue = nvalue = NULL;
101 evalue = fvalue = mvalue = ovalue = svalue = Svalue = 0;
103 found_arg = 0; /* At least one arg is required. */
104 while ((ch = getopt(argc, argv, "Aa:e:f:j:J:L:l:m:N:n:o:ps:S:")) != -1)
114 name = "POSIX.1e ACLs";
116 if (strcmp(avalue, "enable") &&
117 strcmp(avalue, "disable")) {
118 errx(10, "bad %s (options are %s)",
119 name, "`enable' or `disable'");
126 name = "maximum blocks per file in a cylinder group";
127 evalue = atoi(optarg);
129 errx(10, "%s must be >= 1 (was %s)",
136 name = "average file size";
137 fvalue = atoi(optarg);
139 errx(10, "%s must be >= 1 (was %s)",
146 name = "softdep journaled file system";
148 if (strcmp(jvalue, "enable") &&
149 strcmp(jvalue, "disable")) {
150 errx(10, "bad %s (options are %s)",
151 name, "`enable' or `disable'");
158 name = "gjournaled file system";
160 if (strcmp(Jvalue, "enable") &&
161 strcmp(Jvalue, "disable")) {
162 errx(10, "bad %s (options are %s)",
163 name, "`enable' or `disable'");
171 name = "volume label";
174 while (isalnum(Lvalue[++i]));
175 if (Lvalue[i] != '\0') {
177 "bad %s. Valid characters are alphanumerics.",
180 if (strlen(Lvalue) >= MAXVOLLEN) {
181 errx(10, "bad %s. Length is longer than %d.",
182 name, MAXVOLLEN - 1);
189 name = "multilabel MAC file system";
191 if (strcmp(lvalue, "enable") &&
192 strcmp(lvalue, "disable")) {
193 errx(10, "bad %s (options are %s)",
194 name, "`enable' or `disable'");
201 name = "minimum percentage of free space";
202 mvalue = atoi(optarg);
203 if (mvalue < 0 || mvalue > 99)
204 errx(10, "bad %s (%s)", name, optarg);
212 if (strcmp(Nvalue, "enable") &&
213 strcmp(Nvalue, "disable")) {
214 errx(10, "bad %s (options are %s)",
215 name, "`enable' or `disable'");
222 name = "soft updates";
224 if (strcmp(nvalue, "enable") != 0 &&
225 strcmp(nvalue, "disable") != 0) {
226 errx(10, "bad %s (options are %s)",
227 name, "`enable' or `disable'");
234 name = "optimization preference";
235 if (strcmp(optarg, "space") == 0)
236 ovalue = FS_OPTSPACE;
237 else if (strcmp(optarg, "time") == 0)
241 "bad %s (options are `space' or `time')",
253 name = "expected number of files per directory";
254 svalue = atoi(optarg);
256 errx(10, "%s must be >= 1 (was %s)",
263 name = "Softdep Journal Size";
264 Svalue = atoi(optarg);
265 if (Svalue < SUJ_MIN)
266 errx(10, "%s must be >= %d (was %s)",
267 name, SUJ_MIN, optarg);
276 if (found_arg == 0 || argc != 1)
279 on = special = argv[0];
280 if (ufs_disk_fillout(&disk, special) == -1)
282 if (disk.d_name != special) {
283 if (statfs(special, &stfs) != 0)
284 warn("Can't stat %s", special);
285 if (strcmp(special, stfs.f_mntonname) == 0)
294 name = "volume label";
295 strlcpy(sblock.fs_volname, Lvalue, MAXVOLLEN);
298 name = "POSIX.1e ACLs";
299 if (strcmp(avalue, "enable") == 0) {
300 if (sblock.fs_flags & FS_ACLS) {
301 warnx("%s remains unchanged as enabled", name);
302 } else if (sblock.fs_flags & FS_NFS4ACLS) {
303 warnx("%s and NFSv4 ACLs are mutually "
306 sblock.fs_flags |= FS_ACLS;
307 warnx("%s set", name);
309 } else if (strcmp(avalue, "disable") == 0) {
310 if ((~sblock.fs_flags & FS_ACLS) ==
312 warnx("%s remains unchanged as disabled",
315 sblock.fs_flags &= ~FS_ACLS;
316 warnx("%s cleared", name);
321 name = "maximum blocks per file in a cylinder group";
322 if (sblock.fs_maxbpg == evalue)
323 warnx("%s remains unchanged as %d", name, evalue);
325 warnx("%s changes from %d to %d",
326 name, sblock.fs_maxbpg, evalue);
327 sblock.fs_maxbpg = evalue;
331 name = "average file size";
332 if (sblock.fs_avgfilesize == (unsigned)fvalue) {
333 warnx("%s remains unchanged as %d", name, fvalue);
336 warnx("%s changes from %d to %d",
337 name, sblock.fs_avgfilesize, fvalue);
338 sblock.fs_avgfilesize = fvalue;
342 name = "soft updates journaling";
343 if (strcmp(jvalue, "enable") == 0) {
344 if ((sblock.fs_flags & (FS_DOSOFTDEP | FS_SUJ)) ==
345 (FS_DOSOFTDEP | FS_SUJ)) {
346 warnx("%s remains unchanged as enabled", name);
347 } else if (sblock.fs_clean == 0) {
348 warnx("%s cannot be enabled until fsck is run",
350 } else if (journal_alloc(Svalue) != 0) {
351 warnx("%s can not be enabled", name);
353 sblock.fs_flags |= FS_DOSOFTDEP | FS_SUJ;
354 warnx("%s set", name);
356 } else if (strcmp(jvalue, "disable") == 0) {
357 if ((~sblock.fs_flags & FS_SUJ) == FS_SUJ) {
358 warnx("%s remains unchanged as disabled", name);
361 sblock.fs_flags &= ~FS_SUJ;
362 sblock.fs_sujfree = 0;
363 warnx("%s cleared but soft updates still set.",
366 warnx("remove .sujournal to reclaim space");
372 if (strcmp(Jvalue, "enable") == 0) {
373 if (sblock.fs_flags & FS_GJOURNAL) {
374 warnx("%s remains unchanged as enabled", name);
376 sblock.fs_flags |= FS_GJOURNAL;
377 warnx("%s set", name);
379 } else if (strcmp(Jvalue, "disable") == 0) {
380 if ((~sblock.fs_flags & FS_GJOURNAL) ==
382 warnx("%s remains unchanged as disabled",
385 sblock.fs_flags &= ~FS_GJOURNAL;
386 warnx("%s cleared", name);
392 if (strcmp(lvalue, "enable") == 0) {
393 if (sblock.fs_flags & FS_MULTILABEL) {
394 warnx("%s remains unchanged as enabled", name);
396 sblock.fs_flags |= FS_MULTILABEL;
397 warnx("%s set", name);
399 } else if (strcmp(lvalue, "disable") == 0) {
400 if ((~sblock.fs_flags & FS_MULTILABEL) ==
402 warnx("%s remains unchanged as disabled",
405 sblock.fs_flags &= ~FS_MULTILABEL;
406 warnx("%s cleared", name);
411 name = "minimum percentage of free space";
412 if (sblock.fs_minfree == mvalue)
413 warnx("%s remains unchanged as %d%%", name, mvalue);
415 warnx("%s changes from %d%% to %d%%",
416 name, sblock.fs_minfree, mvalue);
417 sblock.fs_minfree = mvalue;
418 if (mvalue >= MINFREE && sblock.fs_optim == FS_OPTSPACE)
419 warnx(OPTWARN, "time", ">=", MINFREE);
420 if (mvalue < MINFREE && sblock.fs_optim == FS_OPTTIME)
421 warnx(OPTWARN, "space", "<", MINFREE);
426 if (strcmp(Nvalue, "enable") == 0) {
427 if (sblock.fs_flags & FS_NFS4ACLS) {
428 warnx("%s remains unchanged as enabled", name);
429 } else if (sblock.fs_flags & FS_ACLS) {
430 warnx("%s and POSIX.1e ACLs are mutually "
433 sblock.fs_flags |= FS_NFS4ACLS;
434 warnx("%s set", name);
436 } else if (strcmp(Nvalue, "disable") == 0) {
437 if ((~sblock.fs_flags & FS_NFS4ACLS) ==
439 warnx("%s remains unchanged as disabled",
442 sblock.fs_flags &= ~FS_NFS4ACLS;
443 warnx("%s cleared", name);
448 name = "soft updates";
449 if (strcmp(nvalue, "enable") == 0) {
450 if (sblock.fs_flags & FS_DOSOFTDEP)
451 warnx("%s remains unchanged as enabled", name);
452 else if (sblock.fs_clean == 0) {
453 warnx("%s cannot be enabled until fsck is run",
456 sblock.fs_flags |= FS_DOSOFTDEP;
457 warnx("%s set", name);
459 } else if (strcmp(nvalue, "disable") == 0) {
460 if ((~sblock.fs_flags & FS_DOSOFTDEP) == FS_DOSOFTDEP)
461 warnx("%s remains unchanged as disabled", name);
463 sblock.fs_flags &= ~FS_DOSOFTDEP;
464 warnx("%s cleared", name);
469 name = "optimization preference";
470 chg[FS_OPTSPACE] = "space";
471 chg[FS_OPTTIME] = "time";
472 if (sblock.fs_optim == ovalue)
473 warnx("%s remains unchanged as %s", name, chg[ovalue]);
475 warnx("%s changes from %s to %s",
476 name, chg[sblock.fs_optim], chg[ovalue]);
477 sblock.fs_optim = ovalue;
478 if (sblock.fs_minfree >= MINFREE &&
479 ovalue == FS_OPTSPACE)
480 warnx(OPTWARN, "time", ">=", MINFREE);
481 if (sblock.fs_minfree < MINFREE && ovalue == FS_OPTTIME)
482 warnx(OPTWARN, "space", "<", MINFREE);
486 name = "expected number of files per directory";
487 if (sblock.fs_avgfpdir == (unsigned)svalue) {
488 warnx("%s remains unchanged as %d", name, svalue);
491 warnx("%s changes from %d to %d",
492 name, sblock.fs_avgfpdir, svalue);
493 sblock.fs_avgfpdir = svalue;
497 if (sbwrite(&disk, Aflag) == -1)
499 ufs_disk_close(&disk);
501 bzero(&args, sizeof(args));
503 stfs.f_flags | MNT_UPDATE | MNT_RELOAD, &args) < 0)
504 err(9, "%s: reload", special);
505 warnx("file system reloaded");
509 if (disk.d_error != NULL)
510 errx(11, "%s: %s", special, disk.d_error);
512 err(12, "%s", special);
518 disk.d_fs.fs_flags |= FS_UNCLEAN | FS_NEEDSFSCK;
519 disk.d_fs.fs_clean = 0;
523 static char clrbuf[MAXBSIZE];
531 static int contig = 1;
535 blk = cgballoc(&disk);
539 * If we failed to allocate a block from this cg, move to
542 if (cgwrite(&disk) < 0) {
543 warn("Failed to write updated cg");
546 while ((valid = cgread(&disk)) == 1) {
548 * Try to minimize fragmentation by requiring a minimum
549 * number of blocks present.
551 if (cgp->cg_cs.cs_nbfree > 256 * 1024)
553 if (contig == 0 && cgp->cg_cs.cs_nbfree)
559 * Try once through looking only for large contiguous regions
560 * and again taking any space we can find.
565 warnx("Journal file fragmented.");
568 warnx("Failed to find sufficient free blocks for the journal");
571 if (bwrite(&disk, fsbtodb(&sblock, blk), clrbuf,
572 sblock.fs_bsize) <= 0) {
573 warn("Failed to initialize new block");
580 * Search a directory block for the SUJ_FILE.
583 dir_search(ufs2_daddr_t blk, int bytes)
585 char block[MAXBSIZE];
589 if (bread(&disk, fsbtodb(&sblock, blk), block, bytes) <= 0) {
590 warn("Failed to read dir block");
593 for (off = 0; off < bytes; off += dp->d_reclen) {
594 dp = (struct direct *)&block[off];
595 if (dp->d_reclen == 0)
599 if (dp->d_namlen != strlen(SUJ_FILE))
601 if (bcmp(dp->d_name, SUJ_FILE, dp->d_namlen) != 0)
610 * Search in the ROOTINO for the SUJ_FILE. If it exists we can not enable
614 journal_findfile(void)
616 struct ufs1_dinode *dp1;
617 struct ufs2_dinode *dp2;
623 if (getino(&disk, &ip, ROOTINO, &mode) != 0) {
624 warn("Failed to get root inode");
629 if (sblock.fs_magic == FS_UFS1_MAGIC) {
630 if ((off_t)dp1->di_size >= lblktosize(&sblock, NDADDR)) {
631 warnx("ROOTINO extends beyond direct blocks.");
634 for (i = 0; i < NDADDR; i++) {
635 if (dp1->di_db[i] == 0)
637 if ((ino = dir_search(dp1->di_db[i],
638 sblksize(&sblock, (off_t)dp1->di_size, i))) != 0)
642 if ((off_t)dp1->di_size >= lblktosize(&sblock, NDADDR)) {
643 warnx("ROOTINO extends beyond direct blocks.");
646 for (i = 0; i < NDADDR; i++) {
647 if (dp2->di_db[i] == 0)
649 if ((ino = dir_search(dp2->di_db[i],
650 sblksize(&sblock, (off_t)dp2->di_size, i))) != 0)
659 * Insert the journal at inode 'ino' into directory blk 'blk' at the first
660 * free offset of 'off'. DIRBLKSIZ blocks after off are initialized as
664 dir_insert(ufs2_daddr_t blk, off_t off, ino_t ino)
667 char block[MAXBSIZE];
669 if (bread(&disk, fsbtodb(&sblock, blk), block, sblock.fs_bsize) <= 0) {
670 warn("Failed to read dir block");
673 bzero(&block[off], sblock.fs_bsize - off);
674 dp = (struct direct *)&block[off];
676 dp->d_reclen = DIRBLKSIZ;
678 dp->d_namlen = strlen(SUJ_FILE);
679 bcopy(SUJ_FILE, &dp->d_name, strlen(SUJ_FILE));
681 for (; off < sblock.fs_bsize; off += DIRBLKSIZ) {
682 dp = (struct direct *)&block[off];
684 dp->d_reclen = DIRBLKSIZ;
685 dp->d_type = DT_UNKNOWN;
687 if (bwrite(&disk, fsbtodb(&sblock, blk), block, sblock.fs_bsize) <= 0) {
688 warn("Failed to write dir block");
695 * Extend a directory block in 'blk' by copying it to a full size block
696 * and inserting the new journal inode into .sujournal.
699 dir_extend(ufs2_daddr_t blk, ufs2_daddr_t nblk, off_t size, ino_t ino)
701 char block[MAXBSIZE];
703 if (bread(&disk, fsbtodb(&sblock, blk), block, size) <= 0) {
704 warn("Failed to read dir block");
707 if (bwrite(&disk, fsbtodb(&sblock, nblk), block, size) <= 0) {
708 warn("Failed to write dir block");
712 return dir_insert(nblk, size, ino);
716 * Insert the journal file into the ROOTINO directory. We always extend the
720 journal_insertfile(ino_t ino)
722 struct ufs1_dinode *dp1;
723 struct ufs2_dinode *dp2;
732 if (getino(&disk, &ip, ROOTINO, &mode) != 0) {
733 warn("Failed to get root inode");
741 nblk = journal_balloc();
745 * For simplicity sake we aways extend the ROOTINO into a new
746 * directory block rather than searching for space and inserting
747 * into an existing block. However, if the rootino has frags
748 * have to free them and extend the block.
750 if (sblock.fs_magic == FS_UFS1_MAGIC) {
751 lbn = lblkno(&sblock, dp1->di_size);
752 off = blkoff(&sblock, dp1->di_size);
753 blk = dp1->di_db[lbn];
754 size = sblksize(&sblock, (off_t)dp1->di_size, lbn);
756 lbn = lblkno(&sblock, dp2->di_size);
757 off = blkoff(&sblock, dp2->di_size);
758 blk = dp2->di_db[lbn];
759 size = sblksize(&sblock, (off_t)dp2->di_size, lbn);
762 if (dir_extend(blk, nblk, off, ino) == -1)
766 if (dir_insert(nblk, 0, ino) == -1)
769 if (sblock.fs_magic == FS_UFS1_MAGIC) {
770 dp1->di_blocks += (sblock.fs_bsize - size) / DEV_BSIZE;
771 dp1->di_db[lbn] = nblk;
772 dp1->di_size = lblktosize(&sblock, lbn+1);
774 dp2->di_blocks += (sblock.fs_bsize - size) / DEV_BSIZE;
775 dp2->di_db[lbn] = nblk;
776 dp2->di_size = lblktosize(&sblock, lbn+1);
778 if (putino(&disk) < 0) {
779 warn("Failed to write root inode");
782 if (cgwrite(&disk) < 0) {
783 warn("Failed to write updated cg");
788 if (cgbfree(&disk, blk, size) < 0) {
789 warn("Failed to write cg");
798 indir_fill(ufs2_daddr_t blk, int level, int *resid)
800 char indirbuf[MAXBSIZE];
808 bzero(indirbuf, sizeof(indirbuf));
809 bap1 = (ufs1_daddr_t *)indirbuf;
812 for (i = 0; i < NINDIR(&sblock) && *resid != 0; i++) {
813 nblk = journal_balloc();
817 if (sblock.fs_magic == FS_UFS1_MAGIC)
822 ncnt = indir_fill(nblk, level - 1, resid);
829 if (bwrite(&disk, fsbtodb(&sblock, blk), indirbuf,
830 sblock.fs_bsize) <= 0) {
831 warn("Failed to write indirect");
838 * Clear the flag bits so the journal can be removed.
843 struct ufs1_dinode *dp1;
844 struct ufs2_dinode *dp2;
849 ino = journal_findfile();
850 if (ino == (ino_t)-1 || ino == 0) {
851 warnx("Journal file does not exist");
854 printf("Clearing journal flags from inode %d\n", ino);
855 if (getino(&disk, &ip, ino, &mode) != 0) {
856 warn("Failed to get journal inode");
861 if (sblock.fs_magic == FS_UFS1_MAGIC)
865 if (putino(&disk) < 0) {
866 warn("Failed to write journal inode");
872 journal_alloc(int64_t size)
874 struct ufs1_dinode *dp1;
875 struct ufs2_dinode *dp2;
889 * If the journal file exists we can't allocate it.
891 ino = journal_findfile();
892 if (ino == (ino_t)-1)
895 warnx("Journal file %s already exists, please remove.",
900 * If the user didn't supply a size pick one based on the filesystem
901 * size constrained with hardcoded MIN and MAX values. We opt for
902 * 1/1024th of the filesystem up to MAX but not exceeding one CG and
903 * not less than the MIN.
906 size = (sblock.fs_size * sblock.fs_bsize) / 1024;
907 size = MIN(SUJ_MAX, size);
908 if (size / sblock.fs_fsize > sblock.fs_fpg)
909 size = sblock.fs_fpg * sblock.fs_fsize;
910 size = MAX(SUJ_MIN, size);
911 /* fsck does not support fragments in journal files. */
912 size = roundup(size, sblock.fs_bsize);
914 resid = blocks = size / sblock.fs_bsize;
915 if (sblock.fs_cstotal.cs_nbfree < blocks) {
916 warn("Insufficient free space for %jd byte journal", size);
920 * Find a cg with enough blocks to satisfy the journal
921 * size. Presently the journal does not span cgs.
923 while (cgread(&disk) == 1) {
924 if (cgp->cg_cs.cs_nifree == 0)
926 ino = cgialloc(&disk);
929 printf("Using inode %d in cg %d for %jd byte journal\n",
930 ino, cgp->cg_cgx, size);
931 if (getino(&disk, &ip, ino, &mode) != 0) {
932 warn("Failed to get allocated inode");
937 * We leave fields unrelated to the number of allocated
938 * blocks and size uninitialized. This causes legacy
939 * fsck implementations to clear the inode.
943 if (sblock.fs_magic == FS_UFS1_MAGIC) {
944 bzero(dp1, sizeof(*dp1));
946 dp1->di_mode = IFREG | IREAD;
948 dp1->di_flags = SF_IMMUTABLE | SF_NOUNLINK | UF_NODUMP;
950 bzero(dp2, sizeof(*dp2));
952 dp2->di_mode = IFREG | IREAD;
954 dp2->di_flags = SF_IMMUTABLE | SF_NOUNLINK | UF_NODUMP;
956 for (i = 0; i < NDADDR && resid; i++, resid--) {
957 blk = journal_balloc();
960 if (sblock.fs_magic == FS_UFS1_MAGIC) {
968 for (i = 0; i < NIADDR && resid; i++) {
969 blk = journal_balloc();
972 blks = indir_fill(blk, i, &resid) + 1;
977 if (sblock.fs_magic == FS_UFS1_MAGIC) {
979 dp1->di_blocks += blks;
982 dp2->di_blocks += blks;
985 if (sblock.fs_magic == FS_UFS1_MAGIC)
986 dp1->di_blocks *= sblock.fs_bsize / disk.d_bsize;
988 dp2->di_blocks *= sblock.fs_bsize / disk.d_bsize;
989 if (putino(&disk) < 0) {
990 warn("Failed to write inode");
994 if (cgwrite(&disk) < 0) {
995 warn("Failed to write updated cg");
999 if (journal_insertfile(ino) < 0) {
1003 sblock.fs_sujfree = 0;
1006 warnx("Insufficient free space for the journal.");
1014 fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n",
1015 "usage: tunefs [-A] [-a enable | disable] [-e maxbpg] [-f avgfilesize]",
1016 " [-J enable | disable] [-j enable | disable]",
1017 " [-L volname] [-l enable | disable] [-m minfree]",
1018 " [-N enable | disable] [-n enable | disable]",
1019 " [-o space | time] [-p] [-s avgfpdir] special | filesystem");
1026 warnx("POSIX.1e ACLs: (-a) %s",
1027 (sblock.fs_flags & FS_ACLS)? "enabled" : "disabled");
1028 warnx("NFSv4 ACLs: (-N) %s",
1029 (sblock.fs_flags & FS_NFS4ACLS)? "enabled" : "disabled");
1030 warnx("MAC multilabel: (-l) %s",
1031 (sblock.fs_flags & FS_MULTILABEL)? "enabled" : "disabled");
1032 warnx("soft updates: (-n) %s",
1033 (sblock.fs_flags & FS_DOSOFTDEP)? "enabled" : "disabled");
1034 warnx("soft update journaling: (-j) %s",
1035 (sblock.fs_flags & FS_SUJ)? "enabled" : "disabled");
1036 warnx("gjournal: (-J) %s",
1037 (sblock.fs_flags & FS_GJOURNAL)? "enabled" : "disabled");
1038 warnx("maximum blocks per file in a cylinder group: (-e) %d",
1040 warnx("average file size: (-f) %d",
1041 sblock.fs_avgfilesize);
1042 warnx("average number of files in a directory: (-s) %d",
1043 sblock.fs_avgfpdir);
1044 warnx("minimum percentage of free space: (-m) %d%%",
1046 warnx("optimization preference: (-o) %s",
1047 sblock.fs_optim == FS_OPTSPACE ? "space" : "time");
1048 if (sblock.fs_minfree >= MINFREE &&
1049 sblock.fs_optim == FS_OPTSPACE)
1050 warnx(OPTWARN, "time", ">=", MINFREE);
1051 if (sblock.fs_minfree < MINFREE &&
1052 sblock.fs_optim == FS_OPTTIME)
1053 warnx(OPTWARN, "space", "<", MINFREE);
1054 warnx("volume label: (-L) %s",