Patchwork e2fsprogs: Unify the upper limit of reserved blocks count

login
register
mail settings
Submitter Kazuya Mio
Date April 19, 2011, 6:11 a.m.
Message ID <4DAD2796.5010409@sx.jp.nec.com>
Download mbox | patch
Permalink /patch/91922/
State Accepted
Headers show

Comments

Kazuya Mio - April 19, 2011, 6:11 a.m.
In e2fsprogs, the upper limit of reserved blocks count is a half of
filesystem's blocks count. This patch fixes the incorrect checks of
reserved blocks count.

Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
---
 lib/ext2fs/initialize.c |    2 +-
 misc/tune2fs.c          |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Theodore Ts'o - June 1, 2011, 12:11 a.m.
On Tue, Apr 19, 2011 at 03:11:34PM +0900, Kazuya Mio wrote:
> In e2fsprogs, the upper limit of reserved blocks count is a half of
> filesystem's blocks count. This patch fixes the incorrect checks of
> reserved blocks count.
> 
> Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>

Applied, thanks.

						- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/lib/ext2fs/initialize.c b/lib/ext2fs/initialize.c
index e1f229b..afefbfd 100644
--- a/lib/ext2fs/initialize.c
+++ b/lib/ext2fs/initialize.c
@@ -192,7 +192,7 @@  errcode_t ext2fs_initialize(const char *name, int flags,
 
 	ext2fs_blocks_count_set(super, ext2fs_blocks_count(param));
 	ext2fs_r_blocks_count_set(super, ext2fs_r_blocks_count(param));
-	if (ext2fs_r_blocks_count(super) >= ext2fs_blocks_count(param)) {
+	if (ext2fs_r_blocks_count(super) > ext2fs_blocks_count(param) / 2) {
 		retval = EXT2_ET_INVALID_ARGUMENT;
 		goto cleanup;
 	}
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index bcada11..fad86c0 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -1718,7 +1718,7 @@  retry_open:
 			reserved_ratio, ext2fs_r_blocks_count(sb));
 	}
 	if (r_flag) {
-		if (reserved_blocks >= ext2fs_blocks_count(sb)/2) {
+		if (reserved_blocks > ext2fs_blocks_count(sb) / 2) {
 			com_err(program_name, 0,
 				_("reserved blocks count is too big (%llu)"),
 				reserved_blocks);