Skip to contentSkip to conversation

e2fsprogs: Unify the upper limit of reserved blocks count

PATCH Applied Kazuya Mio 2 participants 2 messages Apr 19, 2011 – Jun 1, 2011

lore
Share & tools
lore

Kazuya Mio

author
#0 lore raw

PATCH 1/1 e2fsprogs: Unify the upper limit of reserved blocks count

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.

---
 lib/ext2fs/initialize.c |    2 +-
 misc/tune2fs.c          |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
lib/ext2fs/initialize.c +1 -1
index e1f229b..afefbfd 100644
@@ -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;
 	}
misc/tune2fs.c +1 -1
index bcada11..fad86c0 100644
@@ -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);
Applied
#1 lore raw
Quoted 5 lines · Kazuya Mio

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.

Applied, thanks.

- Ted