* [RFC PATCH 1/1] nilfs-utils: mkfs: improve reserved segments percentage calculation
@ 2012-09-07 9:54 Vyacheslav Dubeyko
0 siblings, 0 replies; only message in thread
From: Vyacheslav Dubeyko @ 2012-09-07 9:54 UTC (permalink / raw)
To: linux-nilfs
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 <slava-yeENwD64cLxBDgjK7y7TUQ@public.gmane.org>From
74623a59a4b6513f9bdc606abdf0e483aa5db646 Mon Sep 17 00:00:00 2001
From: Vyacheslav Dubeyko <slava-yeENwD64cLxBDgjK7y7TUQ@public.gmane.org>
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 <slava-yeENwD64cLxBDgjK7y7TUQ@public.gmane.org>
---
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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2012-09-07 9:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-07 9:54 [RFC PATCH 1/1] nilfs-utils: mkfs: improve reserved segments percentage calculation Vyacheslav Dubeyko
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).