linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Theodore Ts'o <tytso@mit.edu>
Cc: linux-ext4 <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH] mke2fs: warn about missing y2038 support when formatting fresh ext4 fs
Date: Thu, 12 Aug 2021 08:05:32 -0700	[thread overview]
Message-ID: <20210812150532.GD3601392@magnolia> (raw)
In-Reply-To: <YRR4fmg2eQMWf2iO@mit.edu>

On Wed, Aug 11, 2021 at 09:25:18PM -0400, Theodore Ts'o wrote:
> On Wed, Aug 11, 2021 at 04:32:53PM -0700, Darrick J. Wong wrote:
> > +/*
> > + * Returns true if the user is forcing an old format (e.g. ext2, ext3).
> > + *
> > + * If there is no fs_types list, the user invoked us with no explicit type and
> > + * gets the default (ext4) format.  If we find the latest format (ext4) in the
> > + * type list, some combination of program name and -T argument put us in ext4
> > + * mode.  Anything else (ext2, ext3, hurd) and we return false.
> > + */
> 
> So that's not actually quite right.  Even if the user has no explicit
> type, mke2fs will assign a default type --- and it's not necessarily
> ext4.  You can see what the contents of the fs_types list using the -v
> option:

Ok, fair, I'll fix the message.  "If the user invoked us with no
explicit type, mke2fs adds some variant of ext* to the type list by
default."

> % /bin/rm /tmp/foo.img ; mke2fs -vq /tmp/foo.img 8m
> fs_types for mke2fs.conf resolution: 'ext2', 'small'
> % /bin/rm /tmp/foo.img ; mke2fs -vq -T news /tmp/foo.img 8m
> fs_types for mke2fs.conf resolution: 'ext2', 'news'
> % /bin/rm /tmp/foo.img ; mkfs.ext4 -vq /tmp/foo.img 8m
> fs_types for mke2fs.conf resolution: 'ext4', 'small'
> % /bin/rm /tmp/foo.img ; mkfs.ext4 -T huge -vq /tmp/foo.img 8m
> fs_types for mke2fs.conf resolution: 'ext4', 'huge'
> % /bin/rm /tmp/foo.img ; mkfs.ext4 -o hurd -vq /tmp/foo.img 8m
> fs_types for mke2fs.conf resolution: 'ext2', 'small', 'hurd'
> 
> Also note that the ext2/ext3/ext4 fs_type will always be in
> fs_types[0], so it's not necessary to search the entire list, as the
> patch is currently doing:

But that's not quite right either:

# mke2fs -t small -T ext4 -vqn a.img
fs_types for mke2fs.conf resolution: 'small', 'ext4'

So to find the 'ext4' here, you /do/ have to iterate the whole list.

--D

> 
> > +	for (i = 0; fs_types[i]; i++)
> > +		if (!strcmp(fs_types[i], "ext4"))
> > +			found_ext4 = 1;
> 
> 
> Cheers,
> 
> 						- Ted
> 
> P.S.  Although I'm not aware of anyone actually doing this, if there
> mke2fs is installed as mke3fs or mke4fs, that's the equivalent of
> mkfs.ext3 and mkfs.ext4.  (See the logic in the parse_fs_type
> function.)  Although perhaps there is some obscure distro somewhere
> out there that I don't know about....

      reply	other threads:[~2021-08-12 15:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-11 23:32 [PATCH] mke2fs: warn about missing y2038 support when formatting fresh ext4 fs Darrick J. Wong
2021-08-12  0:48 ` Andreas Dilger
2021-08-12  1:25 ` Theodore Ts'o
2021-08-12 15:05   ` Darrick J. Wong [this message]

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=20210812150532.GD3601392@magnolia \
    --to=djwong@kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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;
as well as URLs for NNTP newsgroup(s).