Lines Matching +full:nand +full:- +full:controller

30  * University Copyright- Copyright (c) 1982, 1986, 1988
34 * University Acknowledgment- Portions of this document are derived from
53 * make file system for cylinder-group style file systems
57 * mkfs [-F FSType] [-V] [-G [-P]] [-M dirname] [-m] [options]
58 * [-o specific_options] special size
65 * N - no create
66 * nsect - The number of sectors per track
67 * ntrack - The number of tracks per cylinder
68 * bsize - block size
69 * fragsize - fragment size
70 * cgsize - The number of disk cylinders per cylinder group.
71 * free - minimum free space
72 * rps - rotational speed (rev/sec).
73 * nbpi - number of data bytes per allocated inode
74 * opt - optimization (space, time)
75 * apc - number of alternates
76 * gap - gap size
77 * nrpos - number of rotational positions
78 * maxcontig - maximum number of logical blocks that will be
80 * mtb - if "y", set up file system for eventual growth to over a
82 * -P Do not grow the file system, but print on stdout the maximal
86 * Note that -P is a project-private interface and together with -G intended
89 * The -P option is covered by PSARC case 2003/422.
109 * non-efi disks that are larger than the CHS addressing limit. The
118 * use 16 cylinders per group. This is effectively tradition - it was
166 #define MTB_NBPI (MB) /* Number Bytes Per Inode for multi-terabyte */
191 * For the -N option, when calculating the backup superblocks, do not print
213 #define UFS_HOLE -1
278 /* blktot size */ (fs)->fs_cpg * sizeof (long) + \
279 /* blks size */ (fs)->fs_cpg * (fs)->fs_nrpos * sizeof (short) + \
280 /* inode map */ howmany((fs)->fs_ipg, NBBY) + \
281 /* block map */ howmany((fs)->fs_cpg * (fs)->fs_spc / NSPF(fs), NBBY))
290 #define MAXIpG(fs) roundup((fs)->fs_bsize * NBBY / 3, INOPB(fs))
303 #define POWEROF2(num) (((num) & ((num) - 1)) == 0)
311 #define IRANDOMIZE(icp) (icp)->ic_gen = lrand48();
437 * controller. If the address is not aligned at 8 byte boundary, mkfs on
438 * disks attached to XMIT 2.X controller exhibts un-predictable behaviour.
469 int fsi = -1;
470 int fso = -1;
486 * using a different logic. This is applicable for non-EFI disks only.
496 /* semi-constants */
506 long rotdelay = -1; /* rotational delay between blocks */
529 char mtb = 'n'; /* multi-terabyte format, 'y' or 'n' */
542 int rflag; /* report the superblock in an easily-parsed form */
643 long tmpmaxcontig = -1; in main()
700 number(-1, "maxcontig", 0); in main()
751 (void) fprintf(stdout, gettext("mkfs -F ufs ")); in main()
803 if (optind >= (argc - 1)) { in main()
804 if (optind > (argc - 1)) { in main()
814 argc -= optind; in main()
834 * an under-constrained problem, it's not always obvious what the in main()
845 * - set the file system block size (fs_bsize). Although in main()
851 * - re-adjust the maximum file system size based on the in main()
857 * - now that the real maximum file system is known, set the in main()
860 * - now validate, and if necessary, adjust the following in main()
872 * - calculate maxcpg (the maximum value of the cylinders-per- in main()
873 * cylinder-group configuration parameters). There are two in main()
886 * multi-terabyte UFS are NOT being automatically applied in main()
889 * until the ramifications of the changes are well-understood in main()
891 * - check the current values of the configuration parameters in main()
917 * per cylinder, spc (sectors-per-cylinder), and many others. in main()
928 switch (argc - 1) { in main()
937 tmpmaxcontig = number(-1, "maxcontig", 0); in main()
1017 if ((maxcontig_flag == RC_DEFAULT) || (tmpmaxcontig == -1) || in main()
1018 (maxcontig == -1)) { in main()
1027 if (rotdelay == -1) { /* default by newfs and mkfs */ in main()
1037 * Now that we have the semi-sane args, either positional, via -o, in main()
1038 * or by defaulting, handle inter-dependencies and range checks. in main()
1086 " system running a 32-bit kernel. This file system will not be\n" in main()
1087 " accessible until the system is rebooted with a 64-bit kernel.\n")); in main()
1098 * for non-EFI disks that are larger than the CHS addressing limit in main()
1100 * these drives. This is what is currently done for multi-terrabyte in main()
1116 if (mtb != 'y' && (ntrack == -1 || GROW_WITH_DEFAULT_TRAK || in main()
1119 * "-1" indicates that we were called from newfs and ntracks in main()
1125 * superblock locations for the -N option, there is a need for in main()
1142 ntrack -= (ntrack % 16); in main()
1172 * For the newfs -N case, even if the disksize is > CHSLIMIT, do not in main()
1208 dbgprintf(("DeBuG checksblock() failed - error : %d" in main()
1263 range_check(&apc, "apc", 0, nsect - 1, 0, apc_flag); in main()
1307 * as 4MB tends to cause problems (using otherwise-default in main()
1310 * configured for multi-terabyte access, nbpi must be at least 1MB. in main()
1315 "nbpi: must be at least 1048576 for multi-terabyte," in main()
1327 * maxcpg is another variably-limited parameter. Calculate in main()
1336 * For old-style, non-MTB format file systems, use the old in main()
1340 * the default layout for non-MTB file systems at this time. in main()
1349 maxcpg = (bsize - sizeof (struct cg) - in main()
1361 * with -T option or if mkfs wants to create a mtb file system in main()
1364 if (cpg == -1 || (mtb == 'y' && cpg_flag == RC_DEFAULT)) in main()
1370 * do a sane lower-end limit check at this point. in main()
1375 * get the controller info in main()
1476 * For the -N case, a file descriptor is needed for the llseek() in main()
1479 * Get a file descriptor that's read-only so that this code in main()
1494 if (ioctl(fso, DKIOCGMEDIAINFO, &dkminfo) != -1) { in main()
1530 * below with in-line calls to read() or write(). This allows better in main()
1533 rdfs(fssize_db - 1, (int)sectorsize, (char *)&sblock); in main()
1539 sblock.fs_magic = -1; in main()
1541 sblock.fs_state = FSOKAY - sblock.fs_time; in main()
1560 sblock.fs_spc -= apc; in main()
1593 sblock.fs_bmask = ~(sblock.fs_bsize - 1); in main()
1594 sblock.fs_fmask = ~(sblock.fs_fsize - 1); in main()
1631 * Compute the super-block, cylinder group, and inode blocks. in main()
1646 for (sblock.fs_cgmask = -1, i = sblock.fs_ntrak; i > 1; i >>= 1) in main()
1716 sblock.fs_fragshift -= 1; in main()
1725 nbytes64 = (uint64_t)mincpg * bpcg - used; in main()
1733 nbytes64 = (uint64_t)mincpg * bpcg - used; in main()
1740 sblock.fs_fragshift -= 1; in main()
1748 nbytes64 = (uint64_t)mincpg * bpcg - used; in main()
1755 nbytes64 = (uint64_t)mincpg * bpcg - used; in main()
1798 "Please re-run mkfs with corrected parameters\n")); in main()
1818 nbytes64 = (uint64_t)sblock.fs_cpg * bpcg - used; in main()
1826 sblock.fs_cpg -= mincpc; in main()
1827 nbytes64 = (uint64_t)sblock.fs_cpg * bpcg - used; in main()
1838 sblock.fs_cpg -= mincpc; in main()
1839 nbytes64 = (uint64_t)sblock.fs_cpg * bpcg - used; in main()
1851 "With the given parameters, cgsize must be at least %ld; please re-run mkfs\n"), in main()
1887 * available for tables is calculated as (fs_bsize - sizeof (struct in main()
1908 sblock.fs_postbloff = (char *)(&sblock.fs_opostbl[0][0]) - in main()
1910 sblock.fs_rotbloff = &sblock.fs_space[0] - in main()
1914 sblock.fs_postbloff = &sblock.fs_space[0] - in main()
1924 "and nrpos %d.\nOmitting tables - file system " in main()
1944 fs_postbl(&sblock, cylno)[rpos] = -1; in main()
1945 for (i = (rotblsize - 1) * sblock.fs_frag; in main()
1946 i >= 0; i -= sblock.fs_frag) { in main()
1950 if (fs_postbl(&sblock, cylno)[rpos] == -1) in main()
1954 fs_postbl(&sblock, cylno)[rpos] - blk; in main()
1969 i = MIN(~sblock.fs_cgmask, sblock.fs_ncg - 1); in main()
1970 ibpcl = cgdmin(&sblock, i) - cgbase(&sblock, i); in main()
1974 cgdmin(&sblock, i) - cgbase(&sblock, i) / sblock.fs_frag, in main()
1989 j = sblock.fs_ncg - 1; in main()
1990 if ((i = fssize_frag - j * sblock.fs_fpg) < sblock.fs_fpg && in main()
1991 cgdmin(&sblock, j) - cgbase(&sblock, j) > i) { in main()
1996 (cgdmin(&sblock, j) - cgbase(&sblock, j)) / sblock.fs_frag, in main()
2004 sblock.fs_ncg--; in main()
2014 sblock.fs_spc - (uint32_t)(fssize_frag * NSPF(&sblock) - in main()
2015 (uint64_t)(sblock.fs_ncyl - 1) * sblock.fs_spc)); in main()
2029 sblock.fs_csmask = ~(i - 1); in main()
2064 sblock.fs_state = FSOKAY - sblock.fs_time; in main()
2106 "super-block backups (for fsck -F ufs -o b=#) at:\n")); in main()
2126 dbgprintf(("DeBuG checksblock() failed - error" in main()
2160 if ((width + plen) > (WIDTH - 1)) { in main()
2173 remaining_cg = sblock.fs_ncg - cylno; in main()
2192 * groups, cylno is already less than fs_ncg - 10, so this loop in main()
2197 for (; cylno < sblock.fs_ncg - 10; cylno++) { in main()
2203 if (i == WIDTH - 1) { in main()
2217 "\nsuper-block backups for last 10 cylinder groups at:\n")); in main()
2230 dbgprintf(("DeBuG checksblock() failed - error" in main()
2263 if (cylno == sblock.fs_ncg-1) in main()
2268 if ((width + plen) > (WIDTH - 1)) { in main()
2293 * then write out the super-block. in main()
2306 extendcg(grow_fs_ncg-1); in main()
2321 * cylinder groups. In the case of multi-terabyte file in main()
2331 cylno = sblock.fs_ncg - 10; in main()
2353 sblock.fs_state = FSOKAY - sblock.fs_time; in main()
2357 if (fsync(fso) == -1) { in main()
2364 if (close(fsi) == -1) { in main()
2371 if (close(fso) == -1) { in main()
2378 fsi = fso = -1; in main()
2392 if ((ioctl(fd, DKIOCGMEDIAINFO, (caddr_t)&disk_info)) == -1) in get_device_size()
2445 slicesize = efi_vtoc->efi_parts[index].p_size; in get_max_size()
2449 * In the vtoc struct, p_size is a 32-bit signed quantity. in get_max_size()
2451 * is an unsigned 64-bit quantity. By casting the vtoc's in get_max_size()
2452 * psize to an unsigned 32-bit quantity, it will be copied in get_max_size()
2453 * to 'slicesize' (an unsigned 64-bit diskaddr_t) without in get_max_size()
2477 long track_size = -1; in get_max_track_size()
2537 #define icg (icgun->cg) in initcg()
2550 dlower = cgsblock(&sblock, cylno) - cbase; in initcg()
2551 dupper = cgdmin(&sblock, cylno) - cbase; in initcg()
2559 if (cylno == sblock.fs_ncg - 1) in initcg()
2560 icg.cg_ncyl = sblock.fs_ncyl - (sblock.fs_cpg * cylno); in initcg()
2564 icg.cg_ndblk = dmax - cbase; in initcg()
2572 icg.cg_btotoff = &icg.cg_space[0] - (uchar_t *)(&icg.cg_link); in initcg()
2582 bzero((caddr_t)cg_inosused(&icg), icg.cg_freeoff - icg.cg_iusedoff); in initcg()
2587 icg.cg_cs.cs_nifree--; in initcg()
2607 bzero((caddr_t)cg_blktot(&icg), icg.cg_boff - icg.cg_btotoff); in initcg()
2609 icg.cg_iusedoff - icg.cg_boff); in initcg()
2610 bzero((caddr_t)cg_blksfree(&icg), icg.cg_nextfreeoff - icg.cg_freeoff); in initcg()
2622 sblock.fs_dsize += icg.cg_ndblk - dupper; in initcg()
2624 icg.cg_frsum[sblock.fs_frag - i]++; in initcg()
2625 for (d = dupper + sblock.fs_frag - i; dupper < d; dupper++) { in initcg()
2660 * intermediate -= z in initcg()
2702 for (d = dupper; d + sblock.fs_frag <= dmax - cbase; ) { in initcg()
2728 cbcylno_sect -= sblock.fs_spc; in initcg()
2744 trackoff -= sblock.fs_nsect; in initcg()
2748 rpos -= sblock.fs_nrpos; in initcg()
2752 if (d < dmax - cbase) { in initcg()
2753 icg.cg_frsum[dmax - cbase - d]++; in initcg()
2754 for (; d < dmax - cbase; d++) { in initcg()
2853 for (cp = buf, i = 0; i < entries - 1; i++) { in makedir()
2857 spcleft -= protodir[i].d_reclen; in makedir()
2892 acg.cg_cs.cs_nbfree--; in alloc()
2893 sblock.fs_cstotal.cs_nbfree--; in alloc()
2894 fscs[0].cs_nbfree--; in alloc()
2900 cg_blktot(&acg)[cbtocylno(&sblock, d)]--; in alloc()
2901 cg_blks(&sblock, &acg, cbtocylno(&sblock, d))[cbtorpos(&sblock, d)]--; in alloc()
2904 fscs[0].cs_nffree += sblock.fs_frag - frag; in alloc()
2905 sblock.fs_cstotal.cs_nffree += sblock.fs_frag - frag; in alloc()
2906 acg.cg_cs.cs_nffree += sblock.fs_frag - frag; in alloc()
2907 acg.cg_frsum[sblock.fs_frag - frag]++; in alloc()
2931 acg.cg_cs.cs_nifree--; in iput()
2932 setbit(cg_inosused(&acg), ip->i_number); in iput()
2935 sblock.fs_cstotal.cs_nifree--; in iput()
2936 fscs[0].cs_nifree--; in iput()
2937 if ((int)ip->i_number >= sblock.fs_ipg * sblock.fs_ncg) { in iput()
2940 ip->i_number); in iput()
2943 d = fsbtodb(&sblock, (uint64_t)itod(&sblock, (int)ip->i_number)); in iput()
2945 buf[itoo(&sblock, (int)ip->i_number)].di_ic = ip->i_ic; in iput()
2950 * getbuf() -- Get a buffer for use in an AIO operation. Buffer
2971 if (bufhead->head == NULL) { in getbuf()
2999 bufhead->head = bufhead; in getbuf()
3002 pbuf->head = bufhead; in getbuf()
3003 prev->next = pbuf; in getbuf()
3013 while (bufhead->next == NULL) in getbuf()
3019 pbuf = bufhead->next; in getbuf()
3020 bufhead->next = pbuf->next; in getbuf()
3021 pbuf->next = NULL; in getbuf()
3030 * freebuf() -- Free a buffer gotten previously through getbuf.
3045 pbuf = (bufhdr *)(buf - bufhdrsize); in freebuf()
3050 bufhead = pbuf->head; in freebuf()
3051 pbuf->next = bufhead->next; in freebuf()
3052 bufhead->next = pbuf; in freebuf()
3056 * freetrans() -- Free a transaction gotten previously through getaiop.
3068 if (transp->release == RELEASE) in freetrans()
3069 freebuf(transp->buffer); in freetrans()
3074 transp->next = results.trans; in freetrans()
3079 * wait_for_write() -- Wait for an aio write to complete. Return
3102 (resultp == (aio_result_t *)-1 && errno == EINVAL)) { in wait_for_write()
3107 results.outstanding--; in wait_for_write()
3110 if (resultp->aio_return != transp->size) { in wait_for_write()
3111 if (resultp->aio_return == -1) { in wait_for_write()
3120 wtfs_breakup(transp->bno, transp->size, transp->buffer); in wait_for_write()
3124 resultp->aio_return, transp->size, in wait_for_write()
3125 transp->bno); in wait_for_write()
3135 resultp->aio_return = 0; in wait_for_write()
3142 * flush_writes() -- flush all the outstanding aio writes.
3152 * get_aiop() -- find and return an aio_trans structure on which a new
3189 prev->next = &(results.trans[i]); in get_aiop()
3190 prev = prev->next; in get_aiop()
3198 results.trans = results.trans->next; in get_aiop()
3200 transp->next = 0; in get_aiop()
3201 transp->resultbuf.aio_return = AIO_INPROGRESS; in get_aiop()
3234 if (n == -1) in rdfs()
3254 if (fso == -1) in wtfs()
3274 if (n == -1) in wtfs()
3287 * write a block to the file system -- buffered with aio
3296 if (fso == -1) in awtfs()
3310 transp->bno = bno; in awtfs()
3311 transp->buffer = bf; in awtfs()
3312 transp->size = size; in awtfs()
3313 transp->release = release; in awtfs()
3316 SEEK_SET, &transp->resultbuf); in awtfs()
3327 wtfs_breakup(transp->bno, transp->size, transp->buffer); in awtfs()
3377 if (n == -1) { in wtfs_breakup()
3394 size -= wsize; in wtfs_breakup()
3409 switch (fs->fs_frag) { in isblock()
3422 (void) fprintf(stderr, "isblock bad fs_frag %d\n", fs->fs_frag); in isblock()
3433 switch ((fs)->fs_frag) { in clrblock()
3448 gettext("clrblock: bad fs_frag value %d\n"), fs->fs_frag); in clrblock()
3459 switch (fs->fs_frag) { in setblock()
3474 gettext("setblock: bad fs_frag value %d\n"), fs->fs_frag); in setblock()
3483 gettext("ufs usage: mkfs [-F FSType] [-V] [-m] [-o options] " in usage()
3502 gettext(" -m : dump fs cmd line used to make this partition\n" in usage()
3503 " -V :print this command line and return\n" in usage()
3504 " -o :ufs options: :nsect=%d,ntrack=%d,bsize=%d,fragsize=%d\n" in usage()
3505 " -o :ufs options: :cgsize=%d,free=%d,rps=%d,nbpi=%d,opt=%c\n" in usage()
3506 " -o :ufs options: :apc=%d,gap=%d,nrpos=%d,maxcontig=%d\n" in usage()
3507 " -o :ufs options: :mtb=%c,calcsb,calcbinsb\n" in usage()
3508 "NOTE that all -o suboptions: must be separated only by commas so as to\n" in usage()
3511 nbpi, opt, apc, (rotdelay == -1) ? 0 : rotdelay, in usage()
3536 "[not currently a valid file system - bad superblock]\n")); in dump_fscmd()
3561 * fs_ipg value is set for the last time. The INOPB(...) - 1 in dump_fscmd()
3577 nbytes64 = (uint64_t)sblock.fs_cpg * bpcg - used; in dump_fscmd()
3586 (void) fprintf(stdout, gettext("mkfs -F ufs -o "), fsys); in dump_fscmd()
3593 (sblock.fs_ntrak * sblock.fs_nsect) - sblock.fs_spc, in dump_fscmd()
3608 /* Args: d_value - default value, if have parse error */
3609 /* param - the name of the argument, for error messages */
3610 /* flags - parser state and what's allowed in the arg */
3611 /* Global arg: string - pointer to command arg */
3628 if (*cs == '-') { in number()
3637 n = n*10 + *cs++ - '0'; in number()
3640 n = -n; in number()
3660 cs = string + 1; /* adjust for -- below */ in number()
3667 cs--; in number()
3736 /* Arg: s - pointer to string to match with a command arg */
3737 /* Global arg: string - pointer to command arg */
3761 cs--; in match()
3798 * if logging was enabled, then re-enable it in lockexit()
3803 "failed to re-enable logging\n")); in lockexit()
3837 "read-only and write-locked. ")); in lockexit()
3844 "Unlock the filesystem\nand ")); in lockexit()
3848 "re-enable writing with\nthe following " in lockexit()
3849 "command:\n\n\tlockfs -u %s\n\n"), directory); in lockexit()
3867 IRANDOMIZE(&dp->di_ic); in randomgeneration()
3901 cg0frags = dmax - dmin; in checksummarysize()
3949 * - One is to sanity test the superblock and is used when newfs(8)
3950 * is invoked with the "-N" option. If any discrepancy was found,
3952 * - the other use of it is in places where you expect the superblock
3981 (sb.fs_ncg - 1) * sb.fs_cpg >= sb.fs_ncyl) { in checksblock()
4059 if (ebp->type != LUFS_EXTENTS) { in logsetup()
4066 rdfs((diskaddr_t)logbtodb(&sblock, ebp->extents[0].pbno), in logsetup()
4070 ul->un_ondisk = *ud; in logsetup()
4073 if ((ul->un_chksum == ul->un_head_ident + ul->un_tail_ident) && in logsetup()
4074 (ul->un_version == LUFS_VERSION_LATEST) && in logsetup()
4075 (ul->un_badlog == 0)) in logsetup()
4118 "File system was not set up with the multi-terabyte format.\n")); in growinit()
4123 "Cannot convert file system to multi-terabyte format.\n")); in growinit()
4161 * refresh dynamic superblock state - disabling logging will have in growinit()
4169 rdfs((diskaddr_t)fssize_db - 1, DEV_BSIZE, buf); in growinit()
4170 wtfs((diskaddr_t)fssize_db - 1, DEV_BSIZE, buf); in growinit()
4194 sblock.fs_state = FSOKAY - sblock.fs_time; in growinit()
4232 if (strcmp(bdevname, mntp->mnt_special) == 0) { in checkmount()
4233 if (stat64(mntp->mnt_mountp, &statdir) == -1) { in checkmount()
4235 mntp->mnt_mountp); in checkmount()
4238 if (stat64(mntp->mnt_special, &statdev) == -1) { in checkmount()
4240 mntp->mnt_special); in checkmount()
4246 mntp->mnt_special, mntp->mnt_mountp); in checkmount()
4251 if (strcmp(mntp->mnt_mountp, directory) != 0) { in checkmount()
4254 bdevname, mntp->mnt_mountp, directory); in checkmount()
4261 bdevname, mntp->mnt_mountp); in checkmount()
4305 long fixed; /* Boolean - Already fixed? */
4328 for (cfp = *cfap; cfp; cfp = cfp->next) in findcsfrag()
4329 if (cfp->ofrag == frag) in findcsfrag()
4351 checkindirect(ino, fragsp, fsb[i], level-1); in checkindirect()
4372 for (cfp = *cfap; cfp; cfp = cfp->next) { in addcsfrag()
4373 if (ino != cfp->ino) in addcsfrag()
4375 if (frag != cfp->ofrag + cfp->frags) in addcsfrag()
4377 cfp->frags++; in addcsfrag()
4378 cfp->size += sblock.fs_fsize; in addcsfrag()
4386 cfp->ino = ino; in addcsfrag()
4387 cfp->ofrag = frag; in addcsfrag()
4388 cfp->frags = 1; in addcsfrag()
4389 cfp->size = sblock.fs_fsize; in addcsfrag()
4391 prev = curr, curr = curr->next) { in addcsfrag()
4392 if (frag < curr->ofrag) { in addcsfrag()
4393 cfp->next = curr; in addcsfrag()
4395 prev->next = cfp; /* middle element */ in addcsfrag()
4400 if (curr->next == NULL) { in addcsfrag()
4401 curr->next = cfp; /* last element */ in addcsfrag()
4418 for (cfpp = cfap; *cfpp; cfpp = &(*cfpp)->next) { in delcsfrag()
4419 if (frag == (*cfpp)->ofrag) { in delcsfrag()
4421 *cfpp = (*cfpp)->next; in delcsfrag()
4431 * summary. If so, remove those frags from the "as-yet-unclassified" list
4432 * (csfrag) and add them to the "owned-by-inode" list (csfragino).
4457 --(*fragsp); in checkdirect()
4474 * generic csfrag list onto the `owned-by-inode' list csfragino. in findcsfragino()
4478 switch (dp->di_mode & IFMT) { in findcsfragino()
4486 frags = dbtofsb(&sblock, dp->di_blocks); in findcsfragino()
4488 checkdirect((ino_t)i, &frags, &dp->di_db[0], NDADDR+NIADDR); in findcsfragino()
4491 if (dp->di_ib[j] < 0 && dp->di_ib[j] != UFS_HOLE) in findcsfragino()
4493 -(dp->di_ib[j]), j); in findcsfragino()
4496 dp->di_ib[j], j); in findcsfragino()
4518 fixindirect(fsb[i], level-1); in fixindirect()
4532 *db = cfp->nfrag; in fixdirect()
4533 cfp->fixed = 1; in fixdirect()
4546 for (cfp = csfragino; cfp; cfp = cfp->next) { in fixcsfragino()
4547 if (cfp->fixed) in fixcsfragino()
4549 dp = gdinode((ino_t)cfp->ino); in fixcsfragino()
4550 fixdirect((caddr_t)dibuf, difrag, dp->di_db, NDADDR+NIADDR); in fixcsfragino()
4552 fixindirect(dp->di_ib[i], i); in fixcsfragino()
4568 if ((csp = malloc((size_t)fsp->fs_cssize)) == NULL) { in read_summaryinfo()
4574 for (i = 0; i < fsp->fs_cssize; i += fsp->fs_bsize) { in read_summaryinfo()
4576 (uint64_t)(fsp->fs_csaddr + numfrags(fsp, i))), in read_summaryinfo()
4577 (int)(fsp->fs_cssize - i < fsp->fs_bsize ? in read_summaryinfo()
4578 fsp->fs_cssize - i : fsp->fs_bsize), ((caddr_t)csp) + i); in read_summaryinfo()
4598 for (cfp = csfragfree; cfp != NULL && frag >= cfp->ofrag; in checkfragallocated()
4599 cfp = cfp->next) { in checkfragallocated()
4600 if (frag == cfp->ofrag) in checkfragallocated()
4603 for (cfp = csfragino; cfp != NULL && frag >= cfp->ofrag; in checkfragallocated()
4604 cfp = cfp->next) { in checkfragallocated()
4605 if (frag == cfp->ofrag && cfp->nfrag != 0) in checkfragallocated()
4606 return (cfp->frags); in checkfragallocated()
4616 * - Try to extend the cg summary block to the required size.
4617 * - Find free blocks in last cg.
4618 * - Find free space in the last already allocated fragment of the summary info
4720 rdcg(sblock.fs_ncg - 1); in probe_summaryinfo()
4721 growth_fs_frags += sblock.fs_fpg - acg.cg_ndblk; in probe_summaryinfo()
4728 spare_csum = howmany(sblock.fs_cssize, sizeof (struct csum)) - in probe_summaryinfo()
4756 * if no-write (-N), don't bother in extendsummaryinfo()
4764 * summary info did not change size -- do nothing unless in test mode in extendsummaryinfo()
4786 sblock.fs_dsize -= (newfrag - oldfrag); in extendsummaryinfo()
4855 setbit(cg_blksfree(&acg), i-cgbase(&sblock, 0)); in extendsummaryinfo()
4874 for (cfp = csfragino; cfp; cfp = cfp->next) in notenoughspace()
4875 if (cfp->nfrag == 0) in notenoughspace()
4886 if (cfp->nfrag) in unalloccsfragino()
4887 freefrags(cfp->nfrag, cfp->frags, cfp->cylno); in unalloccsfragino()
4888 delcsfrag(cfp->ofrag, &csfragino); in unalloccsfragino()
4898 freefrags(cfp->ofrag, cfp->frags, cfp->cylno); in unalloccsfragfree()
4899 delcsfrag(cfp->ofrag, &csfragfree); in unalloccsfragfree()
4904 * For each frag in the "as-yet-unclassified" list (csfrag), see if
4906 * move it from the "as-yet-unclassified" list to the csfragfree list.
4915 * move free frags onto the free-frag list in findcsfragfree()
4919 cfpnext = cfp->next; in findcsfragfree()
4920 if (isset(cg_blksfree(&acg), cfp->ofrag - cgbase(&sblock, 0))) { in findcsfragfree()
4921 addcsfrag(cfp->ino, cfp->ofrag, &csfragfree); in findcsfragfree()
4922 delcsfrag(cfp->ofrag, &csfrag); in findcsfragfree()
4936 for (cfp = csfragino; cfp; cfp = cfp->next) { in copycsfragino()
4937 rdfs(fsbtodb(&sblock, (uint64_t)cfp->ofrag), (int)cfp->size, in copycsfragino()
4939 wtfs(fsbtodb(&sblock, (uint64_t)cfp->nfrag), (int)cfp->size, in copycsfragino()
4944 long curcylno = -1;
4972 curcylno = -1; in flcg()
4993 * Allocate a free-frag range in an old cylinder group in allocfrags()
4996 if (((fscs+i)->cs_nffree < frags) && ((fscs+i)->cs_nbfree == 0)) in allocfrags()
5032 for (cfp = csfragino; cfp; cfp = cfp->next) { in alloccsfragino()
5033 allocfrags(cfp->frags, &cfp->nfrag, &cfp->cylno); in alloccsfragino()
5034 if (cfp->nfrag == 0) in alloccsfragino()
5049 for (cfp = csfragfree; cfp; cfp = cfp->next) in alloccsfragfree()
5050 clrbit(cg_blksfree(&acg), cfp->ofrag - cgbase(&sblock, 0)); in alloccsfragfree()
5065 setbit(cg_blksfree(&acg), (frag+i) - cgbase(&sblock, cylno)); in freefrags()
5107 sblock.fs_cstotal.cs_nffree -= acg.cg_cs.cs_nffree; in resetallocinfo()
5108 sblock.fs_cstotal.cs_nbfree -= acg.cg_cs.cs_nbfree; in resetallocinfo()
5114 bzero((caddr_t)cg_blktot(&acg), (int)(acg.cg_iusedoff-acg.cg_btotoff)); in resetallocinfo()
5152 if (cylno == sblock.fs_ncg - 1) in extendcg()
5153 acg.cg_ncyl = sblock.fs_ncyl - (sblock.fs_cpg * cylno); in extendcg()
5160 acg.cg_ndblk = dmax - cbase; in extendcg()
5165 sblock.fs_dsize += (acg.cg_ndblk - dupper); in extendcg()
5190 if (ioctl(lockfd, _FIOLFSS, &lockfs) == -1) { in ulockfs()
5209 if (ioctl(lockfd, _FIOLFS, &lockfs) == -1) { in ulockfs()
5220 * if no-write (-N), don't bother in wlockfs()
5227 if ((lockfd = open64(directory, O_RDONLY)) == -1) { in wlockfs()
5235 if (ioctl(lockfd, _FIOLFSS, &lockfs) == -1) { in wlockfs()
5245 if (ioctl(lockfd, _FIOLFS, &lockfs) == -1) { in wlockfs()
5262 ct[strlen(ct)-1] = '\0'; in clockfs()
5264 (void) sprintf(lockfscomment, "%s -- mkfs pid %d", ct, getpid()); in clockfs()
5283 (int)(sblock.fs_cssize - i < sblock.fs_bsize ? in wtsb()
5284 sblock.fs_cssize - i : sblock.fs_bsize), in wtsb()
5311 case 1: /* single-character indicator */ in checkopt()
5321 default: /* multi-character indicator */ in checkopt()
5351 case 1: /* single-character indicator */ in checkmtb()
5361 default: /* multi-character indicator */ in checkmtb()
5485 if (fso > -1) { in recover_from_sigint()
5520 lastloc = &p[maxlen-1]; in getaline()
5528 return (p - loc); in getaline()
5532 * Calculate the maximum value of cylinders-per-group for a file
5535 * bsize - file system block size
5536 * fragsize - frag size
5537 * nbpi - number of bytes of disk space per inode
5538 * nrpos - number of rotational positions
5539 * spc - sectors per cylinder
5543 * function in order to maximize cylinders-per-group is the proportion
5545 * inode map cannot occupy more than one-third of the cylinder group
5546 * overhead block, but it's OK for it to occupy less than one-third
5555 * in one-third (or whatever proportion is assumed) of a file system
5566 * maximum value of cylinders-per-group (determined by nbpi)
5571 * = (inodes-per-cg * nbpi)/(spc * DEV_BSIZE)
5584 * (available space in the overhead block) / (size of per-cylinder data)
5587 * bsize - sizeof (struct cg) - space_used_for_inode_bitmaps
5589 * The size of the per-cylinder data is:
5592 * + frags-per-cylinder/NBBY # number of bytes to represent this
5595 * The two calculated maximum values of cylinder-per-group will typically
5643 (bsize - (sizeof (struct cg)) - (bsize / inode_divisor)) / in compute_maxcpg()
5693 char *cmd = "/usr/bin/isainfo -b"; in in_64bit_mode()
5721 if ((llseek(fd, (offset_t)((size - 1) * DEV_BSIZE), SEEK_SET) == -1) || in validate_size()
5749 pending -= written; in dump_sblock()