linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] resize2fs: Calculate s_first_data_block into minimum filesystem size
@ 2011-12-08 14:09 Jan Kara
  2012-02-15 23:41 ` Ted Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Kara @ 2011-12-08 14:09 UTC (permalink / raw)
  To: tytso; +Cc: linux-ext4, Jan Kara

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] resize2fs: Calculate s_first_data_block into minimum filesystem size
  2011-12-08 14:09 [PATCH] resize2fs: Calculate s_first_data_block into minimum filesystem size Jan Kara
@ 2012-02-15 23:41 ` Ted Ts'o
  0 siblings, 0 replies; 2+ messages in thread
From: Ted Ts'o @ 2012-02-15 23:41 UTC (permalink / raw)
  To: Jan Kara; +Cc: linux-ext4

On Thu, Dec 08, 2011 at 03:09:09PM +0100, Jan Kara wrote:
> 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>

Thanks, applied.

						- Ted

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-02-15 23:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-08 14:09 [PATCH] resize2fs: Calculate s_first_data_block into minimum filesystem size Jan Kara
2012-02-15 23:41 ` Ted Ts'o

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).