Hi,

It is used 5% as default value of reserved segments percentage during
volume creation. But it exists NILFS_MIN_NRSVSEGS (equals by 8)
declaration that defines minimum number of reserved segments. Thereby,
in the case of small volumes (for example, 1 GB) default value of
reserved segment percentage doesn't reserve required 8 segments. This
patch corrects calculation of reserved segment percentage for the case
of small volumes.

With the best regards,
Vyacheslav Dubeyko.
--
From: Vyacheslav Dubeyko <[email protected]>From
74623a59a4b6513f9bdc606abdf0e483aa5db646 Mon Sep 17 00:00:00 2001
From: Vyacheslav Dubeyko <[email protected]>
Date: Fri, 7 Sep 2012 13:27:38 +0400
Subject: [PATCH 1/1] nilfs-utils: mkfs: improve reserved segments
percentage calculation

It is used 5% as default value of reserved segments percentage during
volume creation. But it exists NILFS_MIN_NRSVSEGS (equals by 8)
declaration that defines minimum number of reserved segments. Thereby,
in the case of small volumes (for example, 1 GB) default value of
reserved segment percentage doesn't reserve required 8 segments. This
patch corrects calculation of reserved segment percentage for the case
of small volumes.

Signed-off-by: Vyacheslav Dubeyko <[email protected]>
---
 sbin/mkfs/mkfs.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/sbin/mkfs/mkfs.c b/sbin/mkfs/mkfs.c
index fde1c76..eb1aa9b 100644
--- a/sbin/mkfs/mkfs.c
+++ b/sbin/mkfs/mkfs.c
@@ -1632,6 +1632,13 @@ static void prepare_super_block(struct
nilfs_disk_info *di)
        raw_sb->s_dev_size = cpu_to_le64(di->dev_size);
        raw_sb->s_first_data_block = cpu_to_le64(di->first_segment_block);
        raw_sb->s_blocks_per_segment = cpu_to_le32(di->blocks_per_segment);
+
+       if (((di->nsegments * r_segments_percentage + 99) / 100) <
+                       NILFS_MIN_NRSVSEGS) {
+               r_segments_percentage =
+                       (NILFS_MIN_NRSVSEGS * 100 + 99) / di->nsegments;
+               check_reserved_segments_percentage(r_segments_percentage);
+       }
        raw_sb->s_r_segments_percentage = cpu_to_le32(r_segments_percentage);
 
        raw_sb->s_ctime = cpu_to_le64(di->ctime);
-- 
1.7.1


--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to