From: Davidlohr Bueso <dave@gnu.org>
To: Karel Zak <kzak@redhat.com>
Cc: util-linux <util-linux@vger.kernel.org>
Subject: [PATCH 1/2] mkfs.minix: standardize superblock attribute settings
Date: Thu, 09 Jun 2011 12:48:35 -0400 [thread overview]
Message-ID: <1307638115.2155.2.camel@offworld> (raw)
From: Davidlohr Bueso <dave@gnu.org>
Date: Thu, 9 Jun 2011 12:01:09 -0400
Because of the dependence of fs_version, some superblock attributes will vary, so simplify the logic of assigning values to maxsize and the amount of zones related to each filesystem, thus making setup_tables() more readable.
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
---
disk-utils/mkfs.minix.c | 32 +++++++++++++++++++++++++++-----
1 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/disk-utils/mkfs.minix.c b/disk-utils/mkfs.minix.c
index d2d800f..1cebcda 100644
--- a/disk-utils/mkfs.minix.c
+++ b/disk-utils/mkfs.minix.c
@@ -370,6 +370,29 @@ static void make_root_inode(void)
return make_root_inode_v2();
}
+static void super_set_nzones(void)
+{
+ switch (fs_version) {
+ case 2:
+ Super.s_zones = BLOCKS;
+ break;
+ default: /* v1 */
+ Super.s_nzones = BLOCKS;
+ break;
+ }
+}
+
+static void super_init_maxsize(void)
+{
+ switch (fs_version) {
+ case 2:
+ Super.s_max_size = 0x7fffffff;
+ default: /* v1 */
+ Super.s_max_size = (7+512+512*512)*1024;
+ break;
+ }
+}
+
static void setup_tables(void) {
int i;
unsigned long inodes, zmaps, imaps, zones;
@@ -382,12 +405,11 @@ static void setup_tables(void) {
memset(boot_block_buffer,0,512);
Super.s_magic = magic;
Super.s_log_zone_size = 0;
- Super.s_max_size = version2 ? 0x7fffffff : (7+512+512*512)*1024;
- if (fs_version == 2)
- zones = Super.s_zones = BLOCKS;
- else
- zones = Super.s_nzones = BLOCKS;
+ super_init_maxsize();
+ super_set_nzones();
+ zones = get_nzones();
+
/* some magic nrs: 1 inode / 3 blocks */
if ( req_nr_inodes == 0 )
inodes = BLOCKS/3;
--
1.7.4.1
next reply other threads:[~2011-06-09 16:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-09 16:48 Davidlohr Bueso [this message]
2011-06-14 14:58 ` [PATCH 1/2] mkfs.minix: standardize superblock attribute settings Karel Zak
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=1307638115.2155.2.camel@offworld \
--to=dave@gnu.org \
--cc=kzak@redhat.com \
--cc=util-linux@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