linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: tytso@mit.edu
Cc: linux-ext4@vger.kernel.org, Jan Kara <jack@suse.cz>
Subject: [PATCH] resize2fs: Calculate s_first_data_block into minimum filesystem size
Date: Thu,  8 Dec 2011 15:09:09 +0100	[thread overview]
Message-ID: <1323353349-9675-1-git-send-email-jack@suse.cz> (raw)

calculate_minimum_resize_size() forgot to account s_first_data_block
into minimum filesystem size. Thus in case the size of filesystem was
such that the last group had the minimal size (50 blocks + metadata
overhead), the code in adjust_fs_info() decided the group is unneeded,
removed it, and in some cases the resizing then failed with ENOSPC.

Fix the issue by properly accounting for s_first_data_block in
calculate_minimum_resize_size().

Signed-off-by: Jan Kara <jack@suse.cz>
---
 resize/resize2fs.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/resize/resize2fs.c b/resize/resize2fs.c
index 06ce73e..dc2805d 100644
--- a/resize/resize2fs.c
+++ b/resize/resize2fs.c
@@ -2033,6 +2033,7 @@ blk64_t calculate_minimum_resize_size(ext2_filsys fs)
 
 	if (ext2fs_bg_has_super(fs, groups-1))
 		overhead += SUPER_OVERHEAD(fs);
+	overhead += fs->super->s_first_data_block;
 
 	/*
 	 * since our last group doesn't have to be BLOCKS_PER_GROUP large, we
-- 
1.7.1


             reply	other threads:[~2011-12-08 14:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-08 14:09 Jan Kara [this message]
2012-02-15 23:41 ` [PATCH] resize2fs: Calculate s_first_data_block into minimum filesystem size Ted Ts'o

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=1323353349-9675-1-git-send-email-jack@suse.cz \
    --to=jack@suse.cz \
    --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).