linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: "Theodore Ts'o" <tytso@mit.edu>,
	Ext4 Developers List <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH 3/7] mke2fs: don't complain if the regular file is too small
Date: Mon, 28 Apr 2014 10:26:12 -0500	[thread overview]
Message-ID: <535E7314.8010205@redhat.com> (raw)
In-Reply-To: <1398556834-31913-3-git-send-email-tytso@mit.edu>

On 4/26/14, 7:00 PM, Theodore Ts'o wrote:
> Don't ask the user if it's OK that a regular file is smaller than the
> requested size.  This test only makes sense if we are creating the
> file system on a block device.  This allow users to not need to
> manually answer the "proceed?" question when creating a file system
> backed by a simple file.

I wonder if it'd be better to just attempt to write the last
block before we start marching through the block groups - then
we can just fail outright if the mkfs won't work, rather than
asking questions based on things we could find out programatically...?

-Eric

> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
> ---
>  misc/mke2fs.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/misc/mke2fs.c b/misc/mke2fs.c
> index 3c62ede..fa61e7b 100644
> --- a/misc/mke2fs.c
> +++ b/misc/mke2fs.c
> @@ -1383,7 +1383,7 @@ static void PRS(int argc, char *argv[])
>  	unsigned long	flex_bg_size = 0;
>  	double		reserved_ratio = -1.0;
>  	int		lsector_size = 0, psector_size = 0;
> -	int		show_version_only = 0;
> +	int		show_version_only = 0, is_device = 0;
>  	unsigned long long num_inodes = 0; /* unsigned long long to catch too-large input */
>  	errcode_t	retval;
>  	char *		oldpath = getenv("PATH");
> @@ -1749,7 +1749,7 @@ profile_error:
>  	if (optind < argc)
>  		usage();
>  
> -	if (!check_plausibility(device_name, 0, NULL) && !force)
> +	if (!check_plausibility(device_name, 0, &is_device) && !force)
>  		proceed_question();
>  
>  	check_mount(device_name, force, _("filesystem"));
> @@ -1793,7 +1793,7 @@ profile_error:
>  				fs_blocks_count &= ~((blk64_t) ((sys_page_size /
>  					     EXT2_BLOCK_SIZE(&fs_param))-1));
>  		}
> -	} else if (!force && (fs_blocks_count > dev_size)) {
> +	} else if (!force && is_device && (fs_blocks_count > dev_size)) {
>  		com_err(program_name, 0, "%s",
>  			_("Filesystem larger than apparent device size."));
>  		proceed_question();
> 


  reply	other threads:[~2014-04-28 15:26 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-27  0:00 [PATCH 1/7] mke2fs: don't ask the proceed question using a regular file Theodore Ts'o
2014-04-27  0:00 ` [PATCH 2/7] mke2fs, tune2fs: call proceed_question() from check_plausibility()'s caller Theodore Ts'o
2014-04-27  0:00 ` [PATCH 3/7] mke2fs: don't complain if the regular file is too small Theodore Ts'o
2014-04-28 15:26   ` Eric Sandeen [this message]
2014-04-27  0:00 ` [PATCH 4/7] mke2fs: create a regular file if necessary Theodore Ts'o
2014-04-30 12:21   ` Lukáš Czerner
2014-04-30 14:06     ` Theodore Ts'o
2014-04-30 14:14       ` Lukáš Czerner
2014-04-30 14:18         ` Theodore Ts'o
2014-04-30 14:35           ` Lukáš Czerner
2014-04-30 15:26             ` Theodore Ts'o
2014-05-05 15:17   ` Eric Sandeen
2014-04-27  0:00 ` [PATCH 5/7] mke2fs: proceed if the user doesn't type anything after 5 seconds Theodore Ts'o
2014-04-28 15:33   ` Eric Sandeen
2014-04-28 15:36     ` Eric Sandeen
2014-04-28 23:26     ` Theodore Ts'o
2014-04-29  0:32       ` Eric Sandeen
2014-04-30  6:53         ` Lukáš Czerner
2014-04-27  0:00 ` [PATCH 6/7] mke2fs: check for pre-existing file system Theodore Ts'o
2014-04-30 11:50   ` Lukáš Czerner
2014-04-30 13:44     ` Lukáš Czerner
2014-04-30 14:10     ` Theodore Ts'o
2014-04-27  0:00 ` [PATCH 7/7] mke2fs: only print the low-level file system stats in verbose mode Theodore Ts'o
2014-04-30 11:22   ` Lukáš Czerner
2014-04-30 14:01     ` Theodore Ts'o
2014-04-30 14:25       ` Lukáš Czerner
2014-04-28 15:24 ` [PATCH 1/7] mke2fs: don't ask the proceed question using a regular file Eric Sandeen

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=535E7314.8010205@redhat.com \
    --to=sandeen@redhat.com \
    --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).