From: Jan Tulak <jtulak@redhat.com>
To: linux-xfs@vger.kernel.org
Cc: Jan Tulak <jtulak@redhat.com>
Subject: [PATCH 11/12] mkfs: replace variables with opts table: -n options
Date: Sun, 23 Apr 2017 20:55:02 +0200 [thread overview]
Message-ID: <20170423185503.31415-12-jtulak@redhat.com> (raw)
In-Reply-To: <20170423185503.31415-1-jtulak@redhat.com>
Remove variables that can be replaced with a direct access to the opts table,
so we have it all in a single place, acessible from anywhere.
Signed-off-by: Jan Tulak <jtulak@redhat.com>
---
mkfs/xfs_mkfs.c | 40 +++++++++++++++++++---------------------
1 file changed, 19 insertions(+), 21 deletions(-)
diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index 7d85471..52591b9 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -1496,8 +1496,6 @@ main(
uint64_t dasize;
xfs_rfsblock_t dblocks;
char *dfile;
- uint64_t dirblocklog;
- uint64_t dirblocksize;
bool force_overwrite;
struct fsxattr fsx;
bool ilflag;
@@ -1577,7 +1575,6 @@ main(
liflag = laflag = lsflag = lsuflag = lsunitflag = ldflag = lvflag = false;
logblocks = rtblocks = rtextblocks = 0;
Nflag = nlflag = nsflag = nvflag = false;
- dirblocklog = dirblocksize = 0;
qflag = false;
dfile = logfile = rtfile = NULL;
protofile = NULL;
@@ -1943,26 +1940,23 @@ main(
char **subopts =
(char **)opts[OPT_N].subopts;
char *value;
+ uint64_t tmp;
switch (getsubopt(&p, subopts, &value)) {
case N_LOG:
- dirblocklog = parse_conf_val(OPT_N,
+ tmp = parse_conf_val(OPT_N,
N_LOG,
value);
- dirblocksize = 1 << dirblocklog;
+ set_conf_val(OPT_N, N_SIZE, 1 << tmp);
nlflag = 1;
- set_conf_val(OPT_N, N_SIZE,
- dirblocksize);
break;
case N_SIZE:
- dirblocksize = parse_conf_val(OPT_N,
+ tmp = parse_conf_val(OPT_N,
N_SIZE,
value);
- dirblocklog =
- libxfs_highbit32(dirblocksize);
- nsflag = 1;
set_conf_val(OPT_N, N_LOG,
- dirblocklog);
+ libxfs_highbit32(tmp));
+ nsflag = 1;
break;
case N_VERSION:
value = getstr(value, &opts[OPT_N],
@@ -2360,18 +2354,19 @@ _("rmapbt not supported with realtime devices\n"));
}
if (nsflag || nlflag) {
- if (dirblocksize < get_conf_val(OPT_B, B_SIZE) ||
- dirblocksize > XFS_MAX_BLOCKSIZE) {
+ if (get_conf_val(OPT_N, N_SIZE) <
+ get_conf_val(OPT_B, B_SIZE) ||
+ get_conf_val(OPT_N, N_SIZE) > XFS_MAX_BLOCKSIZE) {
fprintf(stderr, _("illegal directory block size %"PRIu64"\n"),
- dirblocksize);
+ get_conf_val(OPT_N, N_SIZE));
usage();
}
} else {
if (get_conf_val(OPT_B, B_SIZE) < (1 << XFS_MIN_REC_DIRSIZE))
- dirblocklog = XFS_MIN_REC_DIRSIZE;
+ set_conf_val(OPT_N, N_LOG, XFS_MIN_REC_DIRSIZE);
else
- dirblocklog = get_conf_val(OPT_B, B_LOG);
- dirblocksize = 1 << dirblocklog;
+ set_conf_val(OPT_N, N_LOG, get_conf_val(OPT_B, B_LOG));
+ set_conf_val(OPT_N, N_SIZE, 1 << get_conf_val(OPT_N, N_LOG));
}
@@ -2949,7 +2944,8 @@ an AG size that is one stripe unit smaller, for example %"PRIu64".\n"),
sb_feat.crcs_enabled, sb_feat.dir_version,
get_conf_val(OPT_D, D_SECTLOG),
get_conf_val(OPT_B, B_LOG),
- get_conf_val(OPT_I, I_LOG), dirblocklog,
+ get_conf_val(OPT_I, I_LOG),
+ get_conf_val(OPT_N, N_LOG),
sb_feat.log_version,
get_conf_val(OPT_L, L_SUNIT),
sb_feat.finobt,
@@ -3139,7 +3135,8 @@ _("size %s specified for log subvolume is too large, maximum is %"PRIu64" blocks
get_conf_val(OPT_I, I_MAXPCT),
"", get_conf_val(OPT_D, D_SUNIT),
get_conf_val(OPT_D, D_SWIDTH),
- sb_feat.dir_version, dirblocksize, sb_feat.nci,
+ sb_feat.dir_version,
+ get_conf_val(OPT_N, N_SIZE), sb_feat.nci,
sb_feat.dirftype,
logfile, 1 << get_conf_val(OPT_B, B_LOG), logblocks,
sb_feat.log_version, "",
@@ -3191,7 +3188,8 @@ _("size %s specified for log subvolume is too large, maximum is %"PRIu64" blocks
sbp->sb_qflags = 0;
sbp->sb_unit = get_conf_val(OPT_D, D_SUNIT);
sbp->sb_width = get_conf_val(OPT_D, D_SWIDTH);
- sbp->sb_dirblklog = dirblocklog - get_conf_val(OPT_B, B_LOG);
+ sbp->sb_dirblklog = get_conf_val(OPT_N, N_LOG) -
+ get_conf_val(OPT_B, B_LOG);
if (sb_feat.log_version == 2) { /* This is stored in bytes */
set_conf_val(OPT_L, L_SUNIT,
(get_conf_val(OPT_L, L_SUNIT) == 0) ?
--
2.1.4
next prev parent reply other threads:[~2017-04-23 18:55 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-23 18:54 [PATCH 00/12] mkfs: save user input into opts table Jan Tulak
2017-04-23 18:54 ` [PATCH 01/12] mkfs: Save raw user input field to the opts struct Jan Tulak
2017-04-25 17:38 ` Eric Sandeen
2017-04-23 18:54 ` [PATCH 02/12] mkfs: rename defaultval to flagval in opts Jan Tulak
2017-04-25 16:52 ` Eric Sandeen
2017-04-26 7:30 ` Jan Tulak
2017-04-26 13:02 ` Eric Sandeen
2017-04-26 13:20 ` Jan Tulak
2017-04-23 18:54 ` [PATCH 03/12] mkfs: remove intermediate getstr followed by getnum Jan Tulak
2017-04-25 17:37 ` Eric Sandeen
2017-04-26 7:40 ` Jan Tulak
2017-04-26 13:13 ` Eric Sandeen
2017-04-23 18:54 ` [PATCH 04/12] mkfs: merge tables for opts parsing into one table Jan Tulak
2017-04-25 3:04 ` Luis R. Rodriguez
2017-04-25 7:45 ` Jan Tulak
2017-04-25 13:28 ` Eric Sandeen
2017-04-26 1:38 ` Luis R. Rodriguez
2017-04-26 1:45 ` Luis R. Rodriguez
2017-04-26 2:00 ` Eric Sandeen
2017-04-26 8:01 ` Luis R. Rodriguez
2017-04-26 8:24 ` Jan Tulak
2017-04-26 8:21 ` Luis R. Rodriguez
2017-04-26 8:38 ` Jan Tulak
2017-04-25 21:45 ` Eric Sandeen
2017-04-26 4:09 ` Eric Sandeen
2017-04-26 8:14 ` Jan Tulak
2017-04-23 18:54 ` [PATCH 05/12] mkfs: extend opt_params with a value field Jan Tulak
2017-04-25 3:13 ` Luis R. Rodriguez
2017-04-25 8:04 ` Jan Tulak
2017-04-25 9:39 ` Jan Tulak
2017-04-26 1:04 ` Luis R. Rodriguez
2017-04-26 8:51 ` Jan Tulak
2017-04-26 1:10 ` Luis R. Rodriguez
2017-04-26 2:50 ` Eric Sandeen
2017-04-26 8:52 ` Jan Tulak
2017-04-23 18:54 ` [PATCH 06/12] mkfs: create get/set functions for opts table Jan Tulak
2017-04-25 3:40 ` Luis R. Rodriguez
2017-04-25 8:11 ` Jan Tulak
2017-04-26 1:43 ` Luis R. Rodriguez
2017-04-23 18:54 ` [PATCH 07/12] mkfs: save user input values into opts Jan Tulak
2017-04-25 5:19 ` Luis R. Rodriguez
2017-04-25 8:16 ` Jan Tulak
2017-04-26 1:47 ` Luis R. Rodriguez
2017-04-23 18:54 ` [PATCH 08/12] mkfs: replace variables with opts table: -b,d,s options Jan Tulak
2017-04-25 5:27 ` Luis R. Rodriguez
2017-04-25 5:30 ` Luis R. Rodriguez
2017-04-25 8:37 ` Jan Tulak
2017-04-26 0:45 ` Luis R. Rodriguez
2017-04-26 9:09 ` Jan Tulak
2017-04-23 18:55 ` [PATCH 09/12] mkfs: replace variables with opts table: -i options Jan Tulak
2017-04-23 18:55 ` [PATCH 10/12] mkfs: replace variables with opts table: -l options Jan Tulak
2017-04-23 18:55 ` Jan Tulak [this message]
2017-04-23 18:55 ` [PATCH 12/12] mkfs: replace variables with opts table: -r options Jan Tulak
2017-04-25 2:52 ` [PATCH 00/12] mkfs: save user input into opts table Luis R. Rodriguez
2017-04-25 16:20 ` Eric Sandeen
2017-04-26 2:02 ` Luis R. Rodriguez
2017-04-26 2:17 ` Eric Sandeen
2017-06-28 16:18 ` Luis R. Rodriguez
2017-06-29 7:56 ` Jan Tulak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170423185503.31415-12-jtulak@redhat.com \
--to=jtulak@redhat.com \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox