linux-nilfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vyacheslav Dubeyko <slava-yeENwD64cLxBDgjK7y7TUQ@public.gmane.org>
To: linux-nilfs <linux-nilfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: [RFC PATCH 1/1] nilfs-utils: mkfs: improve reserved segments percentage calculation
Date: Fri, 07 Sep 2012 13:54:02 +0400	[thread overview]
Message-ID: <1347011642.2017.6.camel@slavad-ubuntu-11> (raw)

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

                 reply	other threads:[~2012-09-07  9:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1347011642.2017.6.camel@slavad-ubuntu-11 \
    --to=slava-yeenwd64clxbdgjk7y7tuq@public.gmane.org \
    --cc=linux-nilfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).