~ubuntu-branches/ubuntu/edgy/xfsprogs/edgy

« back to all changes in this revision

Viewing changes to mkfs/xfs_mkfs.c

  • Committer: Bazaar Package Importer
  • Author(s): Nathan Scott
  • Date: 2005-03-30 10:52:07 UTC
  • Revision ID: james.westby@ubuntu.com-20050330105207-fv1jw5r9d2fgwvew
Tags: 2.6.28-1
* New upstream release.
* Fix compilation with gcc version 4 (closes: #300544)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
 
2
 * Copyright (c) 2000-2005 Silicon Graphics, Inc.  All Rights Reserved.
3
3
 * 
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
82
82
        "sectlog",
83
83
#define D_SECTSIZE      11
84
84
        "sectsize",
 
85
#define D_NOALIGN       12
 
86
        "noalign",
85
87
        NULL
86
88
};
87
89
 
118
120
        "sectlog",
119
121
#define L_SECTSIZE      8
120
122
        "sectsize",
121
 
#ifdef MKFS_SIMULATION
122
123
#define L_FILE          9
123
124
        "file",
124
125
#define L_NAME          10
125
126
        "name",
126
 
#endif
127
127
        NULL
128
128
};
129
129
 
144
144
        "size",
145
145
#define R_DEV           2
146
146
        "rtdev",
147
 
#ifdef MKFS_SIMULATION
148
147
#define R_FILE          3
149
148
        "file",
150
149
#define R_NAME          4
151
150
        "name",
152
 
#endif
 
151
#define R_NOALIGN       5
 
152
        "noalign",
153
153
        NULL
154
154
};
155
155
 
388
388
         * always use the maximum AG size, the points at which we
389
389
         * always use the minimum, and a "small-step" for 16-128Mb.
390
390
         */
391
 
        if (dblocks >= TERABYTES(64, blocklog)) {
 
391
        if (dblocks >= TERABYTES(32, blocklog)) {
392
392
                blocks = XFS_AG_MAX_BLOCKS(blocklog);
393
393
                goto done;
394
394
        } else if (dblocks < MEGABYTES(16, blocklog)) {
571
571
        xfs_extlen_t            nbmblocks;
572
572
        int                     nlflag;
573
573
        int                     nodsflag;
 
574
        int                     norsflag;
574
575
        xfs_alloc_rec_t         *nrec;
575
576
        int                     nsflag;
576
577
        int                     nvflag;
619
620
        iaflag = XFS_IFLAG_ALIGN;
620
621
        dfile = logfile = rtfile = NULL;
621
622
        dsize = logsize = rtsize = rtextsize = protofile = NULL;
622
 
        dsu = dsw = dsunit = dswidth = nodsflag = lalign = lsu = lsunit = 0;
 
623
        dsu = dsw = dsunit = dswidth = lalign = lsu = lsunit = 0;
 
624
        nodsflag = norsflag = 0;
623
625
        extent_flagging = 1;
624
626
        force_overwrite = 0;
625
627
        worst_freelist = 0;
730
732
                                                reqval('d', dopts, D_SUNIT);
731
733
                                        if (dsunit)
732
734
                                                respec('d', dopts, D_SUNIT);
 
735
                                        if (nodsflag)
 
736
                                                conflict('d', dopts, D_NOALIGN,
 
737
                                                         D_SUNIT);
733
738
                                        if (!isdigits(value)) {
734
739
                                                fprintf(stderr,
735
740
        _("%s: Specify data sunit in 512-byte blocks, no unit suffix\n"),
743
748
                                                reqval('d', dopts, D_SWIDTH);
744
749
                                        if (dswidth)
745
750
                                                respec('d', dopts, D_SWIDTH);
 
751
                                        if (nodsflag)
 
752
                                                conflict('d', dopts, D_NOALIGN,
 
753
                                                         D_SWIDTH);
746
754
                                        if (!isdigits(value)) {
747
755
                                                fprintf(stderr,
748
756
        _("%s: Specify data swidth in 512-byte blocks, no unit suffix\n"),
756
764
                                                reqval('d', dopts, D_SU);
757
765
                                        if (dsu)
758
766
                                                respec('d', dopts, D_SU);
 
767
                                        if (nodsflag)
 
768
                                                conflict('d', dopts, D_NOALIGN,
 
769
                                                         D_SU);
759
770
                                        dsu = cvtnum(
760
771
                                                blocksize, sectorsize, value);
761
772
                                        break;
764
775
                                                reqval('d', dopts, D_SW);
765
776
                                        if (dsw)
766
777
                                                respec('d', dopts, D_SW);
 
778
                                        if (nodsflag)
 
779
                                                conflict('d', dopts, D_NOALIGN,
 
780
                                                         D_SW);
767
781
                                        if (!isdigits(value)) {
768
782
                                                fprintf(stderr,
769
783
                _("%s: Specify data sw as multiple of su, no unit suffix\n"),
772
786
                                        }
773
787
                                        dsw = cvtnum(0, 0, value);
774
788
                                        break;
 
789
                                case D_NOALIGN:
 
790
                                        if (dsu)
 
791
                                                conflict('d', dopts, D_SU,
 
792
                                                         D_NOALIGN);
 
793
                                        if (dsunit)
 
794
                                                conflict('d', dopts, D_SUNIT,
 
795
                                                         D_NOALIGN);
 
796
                                        if (dsw)
 
797
                                                conflict('d', dopts, D_SW,
 
798
                                                         D_NOALIGN);
 
799
                                        if (dswidth)
 
800
                                                conflict('d', dopts, D_SWIDTH,
 
801
                                                         D_NOALIGN);
 
802
                                        nodsflag = 1;
 
803
                                        break;
775
804
                                case D_UNWRITTEN:
776
805
                                        if (!value)
777
806
                                                reqval('d', dopts, D_UNWRITTEN);
1162
1191
                                                respec('r', ropts, R_SIZE);
1163
1192
                                        rtsize = value;
1164
1193
                                        break;
1165
 
 
 
1194
                                case R_NOALIGN:
 
1195
                                        norsflag = 1;
 
1196
                                        break;
1166
1197
                                default:
1167
1198
                                        unknown('r', value);
1168
1199
                                }
1411
1442
 
1412
1443
                dummy1 = rswidth = 0;
1413
1444
 
1414
 
                if (!xi.disfile)
 
1445
                if (!norsflag && !xi.risfile)
1415
1446
                        get_subvol_stripe_wrapper(dfile, SVTYPE_RT, &dummy1, 
1416
1447
                                                  &rswidth);
1417
1448
 
1418
1449
                /* check that rswidth is a multiple of fs blocksize */
1419
 
                if (rswidth && !(BBTOB(rswidth) % blocksize)) {
 
1450
                if (!norsflag && rswidth && !(BBTOB(rswidth) % blocksize)) {
1420
1451
                        rswidth = DTOBT(rswidth);
1421
1452
                        rtextbytes = rswidth << blocklog;
1422
1453
                        if (XFS_MIN_RTEXTSIZE <= rtextbytes &&
1657
1688
        validate_ag_geometry(blocklog, dblocks, agsize, agcount);
1658
1689
 
1659
1690
        xlv_dsunit = xlv_dswidth = 0;
1660
 
        if (!xi.disfile)
 
1691
        if (!nodsflag && !xi.disfile)
1661
1692
                get_subvol_stripe_wrapper(dfile, SVTYPE_DATA,
1662
1693
                                                &xlv_dsunit, &xlv_dswidth);
1663
 
        if (dsunit) {
1664
 
 
 
1694
        if (!nodsflag && dsunit) {
1665
1695
                if (xlv_dsunit && xlv_dsunit != dsunit) {
1666
1696
                        fprintf(stderr,
1667
1697
                                _("%s: Specified data stripe unit %d is not "
2385
2415
                return 1024LL * 1024LL * 1024LL * 1024LL * i;
2386
2416
        if (*sp == 'p' && sp[1] == '\0')
2387
2417
                return 1024LL * 1024LL * 1024LL * 1024LL * 1024LL * i;
 
2418
        if (*sp == 'e' && sp[1] == '\0')
 
2419
                return 1024LL * 1024LL * 1024LL * 1024LL * 1024LL * 1024LL * i;
2388
2420
        return -1LL;
2389
2421
}
2390
2422