xfs_mkfs.c   xfs_mkfs.c 
skipping to change at line 399 skipping to change at line 399
return; return;
pr = blkid_new_probe_from_filename(device); pr = blkid_new_probe_from_filename(device);
if (!pr) if (!pr)
return; return;
tp = blkid_probe_get_topology(pr); tp = blkid_probe_get_topology(pr);
if (!tp) if (!tp)
goto out_free_probe; goto out_free_probe;
/*
* Blkid reports the information in terms of bytes, but we want it i
n
* terms of 512 bytes blocks (just to convert it to bytes later..)
*
* If the reported values are just the normal 512 byte block size
* do not bother to report anything. It will just causes warnings
* if people specifier larger stripe units or widths manually.
*/
val = blkid_topology_get_minimum_io_size(tp) >> 9;
if (val > 1)
*sunit = val;
val = blkid_topology_get_optimal_io_size(tp) >> 9;
if (val > 1)
*swidth = val;
val = blkid_topology_get_logical_sector_size(tp); val = blkid_topology_get_logical_sector_size(tp);
*lsectorsize = val; *lsectorsize = val;
val = blkid_topology_get_physical_sector_size(tp); val = blkid_topology_get_physical_sector_size(tp);
*psectorsize = val; *psectorsize = val;
/*
* Blkid reports the information in terms of bytes, but we want it i
n
* terms of 512 bytes blocks (just to convert it to bytes later..)
*
* If the reported values are the same as the physical sector size
* do not bother to report anything. It will just cause warnings
* if people specify larger stripe units or widths manually.
*/
val = blkid_topology_get_minimum_io_size(tp);
if (val > *psectorsize)
*sunit = val >> 9;
val = blkid_topology_get_optimal_io_size(tp);
if (val > *psectorsize)
*swidth = val >> 9;
if (blkid_topology_get_alignment_offset(tp) != 0) { if (blkid_topology_get_alignment_offset(tp) != 0) {
fprintf(stderr, fprintf(stderr,
_("warning: device is not properly aligned %s\n"), _("warning: device is not properly aligned %s\n"),
device); device);
if (!force_overwrite) { if (!force_overwrite) {
fprintf(stderr, fprintf(stderr,
_("Use -f to force usage of a misaligned dev ice\n")); _("Use -f to force usage of a misaligned dev ice\n"));
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
skipping to change at line 1952 skipping to change at line 1952
if (check_overwrite(dfile) || if (check_overwrite(dfile) ||
check_overwrite(logfile) || check_overwrite(logfile) ||
check_overwrite(xi.rtname)) { check_overwrite(xi.rtname)) {
fprintf(stderr, fprintf(stderr,
_("%s: Use the -f option to force overwrite.\n"), _("%s: Use the -f option to force overwrite.\n"),
progname); progname);
exit(1); exit(1);
} }
} }
if (discard) { if (discard && !Nflag) {
discard_blocks(xi.ddev, xi.dsize); discard_blocks(xi.ddev, xi.dsize);
if (xi.rtdev) if (xi.rtdev)
discard_blocks(xi.rtdev, xi.rtsize); discard_blocks(xi.rtdev, xi.rtsize);
if (xi.logdev && xi.logdev != xi.ddev) if (xi.logdev && xi.logdev != xi.ddev)
discard_blocks(xi.logdev, xi.logBBsize); discard_blocks(xi.logdev, xi.logBBsize);
} }
if (!liflag && !ldflag) if (!liflag && !ldflag)
loginternal = xi.logdev == 0; loginternal = xi.logdev == 0;
if (xi.logname) if (xi.logname)
skipping to change at line 2092 skipping to change at line 2092
usage(); usage();
} }
if (xi.rtdev) { if (xi.rtdev) {
rtextents = rtblocks / rtextblocks; rtextents = rtblocks / rtextblocks;
nbmblocks = (xfs_extlen_t)howmany(rtextents, NBBY * blocksiz e); nbmblocks = (xfs_extlen_t)howmany(rtextents, NBBY * blocksiz e);
} else { } else {
rtextents = rtblocks = 0; rtextents = rtblocks = 0;
nbmblocks = 0; nbmblocks = 0;
} }
if (dasize) { /* User-specified AG size */
/*
* Check specified agsize is a multiple of blocksize.
*/
if (agsize % blocksize) {
fprintf(stderr,
_("agsize (%lld) not a multiple of fs blk size (%d)\n"),
(long long)agsize, blocksize);
usage();
}
agsize /= blocksize;
agcount = dblocks / agsize + (dblocks % agsize != 0);
} else if (daflag) /* User-specified AG count */
agsize = dblocks / agcount + (dblocks % agcount != 0);
else
calc_default_ag_geometry(blocklog, dblocks,
ft.dsunit | ft.dswidth, &agsize, &agcount);
if (!nodsflag) { if (!nodsflag) {
if (dsunit) { if (dsunit) {
if (ft.dsunit && ft.dsunit != dsunit) { if (ft.dsunit && ft.dsunit != dsunit) {
fprintf(stderr, fprintf(stderr,
_("%s: Specified data stripe unit %d " _("%s: Specified data stripe unit %d "
"is not the same as the volume strip e " "is not the same as the volume strip e "
"unit %d\n"), "unit %d\n"),
progname, dsunit, ft.dsunit); progname, dsunit, ft.dsunit);
} }
if (ft.dswidth && ft.dswidth != dswidth) { if (ft.dswidth && ft.dswidth != dswidth) {
skipping to change at line 2134 skipping to change at line 2115
"width %d\n"), "width %d\n"),
progname, dswidth, ft.dswidth); progname, dswidth, ft.dswidth);
} }
} else { } else {
dsunit = ft.dsunit; dsunit = ft.dsunit;
dswidth = ft.dswidth; dswidth = ft.dswidth;
nodsflag = 1; nodsflag = 1;
} }
} /* else dsunit & dswidth can't be set if nodsflag is set */ } /* else dsunit & dswidth can't be set if nodsflag is set */
if (dasize) { /* User-specified AG size */
/*
* Check specified agsize is a multiple of blocksize.
*/
if (agsize % blocksize) {
fprintf(stderr,
_("agsize (%lld) not a multiple of fs blk size (%d)\n"),
(long long)agsize, blocksize);
usage();
}
agsize /= blocksize;
agcount = dblocks / agsize + (dblocks % agsize != 0);
} else if (daflag) { /* User-specified AG count */
agsize = dblocks / agcount + (dblocks % agcount != 0);
} else {
calc_default_ag_geometry(blocklog, dblocks,
dsunit | dswidth, &agsize, &agcount);
}
/* /*
* If dsunit is a multiple of fs blocksize, then check that is a * If dsunit is a multiple of fs blocksize, then check that is a
* multiple of the agsize too * multiple of the agsize too
*/ */
if (dsunit && !(BBTOB(dsunit) % blocksize) && if (dsunit && !(BBTOB(dsunit) % blocksize) &&
dswidth && !(BBTOB(dswidth) % blocksize)) { dswidth && !(BBTOB(dswidth) % blocksize)) {
/* convert from 512 byte blocks to fs blocksize */ /* convert from 512 byte blocks to fs blocksize */
dsunit = DTOBT(dsunit); dsunit = DTOBT(dsunit);
dswidth = DTOBT(dswidth); dswidth = DTOBT(dswidth);
skipping to change at line 2593 skipping to change at line 2594
be32_to_cpu(arec->ar_startblock) + be32_to_cpu(arec->ar_startblock) +
be32_to_cpu(arec->ar_blockcount)); be32_to_cpu(arec->ar_blockcount));
arec = nrec; arec = nrec;
be16_add_cpu(&block->bb_numrecs, 1); be16_add_cpu(&block->bb_numrecs, 1);
} }
/* /*
* Change record start to after the internal log * Change record start to after the internal log
*/ */
be32_add_cpu(&arec->ar_startblock, logblocks); be32_add_cpu(&arec->ar_startblock, logblocks);
} }
/*
* Calculate the record block count and check for the case w
here
* the log might have consumed all available space in the AG
. If
* so, reset the record count to 0 to avoid exposure of an i
nvalid
* record start block.
*/
arec->ar_blockcount = cpu_to_be32(agsize - arec->ar_blockcount = cpu_to_be32(agsize -
be32_to_cpu(arec->ar_startblock)); be32_to_cpu(arec->ar_startblock));
if (!arec->ar_blockcount)
block->bb_numrecs = 0;
libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE); libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE);
/* /*
* CNT btree root block * CNT btree root block
*/ */
buf = libxfs_getbuf(mp->m_dev, buf = libxfs_getbuf(mp->m_dev,
XFS_AGB_TO_DADDR(mp, agno, XFS_CNT_BLOCK(mp) ), XFS_AGB_TO_DADDR(mp, agno, XFS_CNT_BLOCK(mp) ),
bsize); bsize);
block = XFS_BUF_TO_BLOCK(buf); block = XFS_BUF_TO_BLOCK(buf);
memset(block, 0, blocksize); memset(block, 0, blocksize);
skipping to change at line 2626 skipping to change at line 2636
be32_to_cpu(arec->ar_startblock)); be32_to_cpu(arec->ar_startblock));
nrec = arec + 1; nrec = arec + 1;
nrec->ar_startblock = cpu_to_be32( nrec->ar_startblock = cpu_to_be32(
be32_to_cpu(arec->ar_startblock) + be32_to_cpu(arec->ar_startblock) +
be32_to_cpu(arec->ar_blockcount)); be32_to_cpu(arec->ar_blockcount));
arec = nrec; arec = nrec;
be16_add_cpu(&block->bb_numrecs, 1); be16_add_cpu(&block->bb_numrecs, 1);
} }
be32_add_cpu(&arec->ar_startblock, logblocks); be32_add_cpu(&arec->ar_startblock, logblocks);
} }
/*
* Calculate the record block count and check for the case w
here
* the log might have consumed all available space in the AG
. If
* so, reset the record count to 0 to avoid exposure of an i
nvalid
* record start block.
*/
arec->ar_blockcount = cpu_to_be32(agsize - arec->ar_blockcount = cpu_to_be32(agsize -
be32_to_cpu(arec->ar_startblock)); be32_to_cpu(arec->ar_startblock));
if (!arec->ar_blockcount)
block->bb_numrecs = 0;
libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE); libxfs_writebuf(buf, LIBXFS_EXIT_ON_FAILURE);
/* /*
* INO btree root block * INO btree root block
*/ */
buf = libxfs_getbuf(mp->m_dev, buf = libxfs_getbuf(mp->m_dev,
XFS_AGB_TO_DADDR(mp, agno, XFS_IBT_BLOCK(mp) ), XFS_AGB_TO_DADDR(mp, agno, XFS_IBT_BLOCK(mp) ),
bsize); bsize);
block = XFS_BUF_TO_BLOCK(buf); block = XFS_BUF_TO_BLOCK(buf);
memset(block, 0, blocksize); memset(block, 0, blocksize);
skipping to change at line 2881 skipping to change at line 2900
} }
static void __attribute__((noreturn)) static void __attribute__((noreturn))
usage( void ) usage( void )
{ {
fprintf(stderr, _("Usage: %s\n\ fprintf(stderr, _("Usage: %s\n\
/* blocksize */ [-b log=n|size=num]\n\ /* blocksize */ [-b log=n|size=num]\n\
/* data subvol */ [-d agcount=n,agsize=n,file,name=xxx,size=num,\n\ /* data subvol */ [-d agcount=n,agsize=n,file,name=xxx,size=num,\n\
(sunit=value,swidth=value|su=num,sw=num),\n\ (sunit=value,swidth=value|su=num,sw=num),\n\
sectlog=n|sectsize=num\n\ sectlog=n|sectsize=num\n\
/* force overwrite */ [-f]\n\
/* inode size */ [-i log=n|perblock=n|size=num,maxpct=n,attr=0|1|2,\n \ /* inode size */ [-i log=n|perblock=n|size=num,maxpct=n,attr=0|1|2,\n \
projid32bit=0|1]\n\ projid32bit=0|1]\n\
/* no discard */ [-K]\n\
/* log subvol */ [-l agnum=n,internal,size=num,logdev=xxx,version=n\n \ /* log subvol */ [-l agnum=n,internal,size=num,logdev=xxx,version=n\n \
sunit=value|su=num,sectlog=n|sectsize=num,\n\ sunit=value|su=num,sectlog=n|sectsize=num,\n\
lazy-count=0|1]\n\ lazy-count=0|1]\n\
/* label */ [-L label (maximum 12 characters)]\n\ /* label */ [-L label (maximum 12 characters)]\n\
/* naming */ [-n log=n|size=num,version=2|ci]\n\ /* naming */ [-n log=n|size=num,version=2|ci]\n\
/* no-op info only */ [-N]\n\
/* prototype file */ [-p fname]\n\ /* prototype file */ [-p fname]\n\
/* quiet */ [-q]\n\ /* quiet */ [-q]\n\
/* realtime subvol */ [-r extsize=num,size=num,rtdev=xxx]\n\ /* realtime subvol */ [-r extsize=num,size=num,rtdev=xxx]\n\
/* sectorsize */ [-s log=n|size=num]\n\ /* sectorsize */ [-s log=n|size=num]\n\
/* version */ [-V]\n\ /* version */ [-V]\n\
devicename\n\ devicename\n\
<devicename> is required unless -d name=xxx is given.\n\ <devicename> is required unless -d name=xxx is given.\n\
<num> is xxx (bytes), xxxs (sectors), xxxb (fs blocks), xxxk (xxx KiB),\n\ <num> is xxx (bytes), xxxs (sectors), xxxb (fs blocks), xxxk (xxx KiB),\n\
xxxm (xxx MiB), xxxg (xxx GiB), xxxt (xxx TiB) or xxxp (xxx PiB).\n\ xxxm (xxx MiB), xxxg (xxx GiB), xxxt (xxx TiB) or xxxp (xxx PiB).\n\
<value> is xxx (512 byte blocks).\n"), <value> is xxx (512 byte blocks).\n"),
 End of changes. 12 change blocks. 
36 lines changed or deleted 64 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/