[Devel] [PATCH 08/10] e4defrag2: Allow to tune ief relocation cluster size
Dmitry Monakhov
dmonakhov at openvz.org
Thu Feb 25 02:54:31 PST 2016
Signed-off-by: Dmitry Monakhov <dmonakhov at openvz.org>
---
misc/e4defrag2.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/misc/e4defrag2.c b/misc/e4defrag2.c
index 8714f47..dab4dbe 100644
--- a/misc/e4defrag2.c
+++ b/misc/e4defrag2.c
@@ -2409,6 +2409,7 @@ int main(int argc, char *argv[])
char *end;
struct file_handle *fhp = NULL;
int cluster_size = 1 << 20;
+ int reloc_cluster_size = 0;
int scale = 2;
int quality = 700;
dgrp_t nr_grp;
@@ -2419,7 +2420,7 @@ int main(int argc, char *argv[])
gettimeofday(&time_start, 0);
older_than = time_start.tv_sec - 864000; /* older than 10 days */
- while ((c = getopt(argc, argv, "a:c:d:fF:hlmnt:s:T:vq:")) != EOF) {
+ while ((c = getopt(argc, argv, "a:C:c:d:fF:hlmnt:s:T:vq:")) != EOF) {
switch (c) {
case 'a':
min_frag_size = strtoul(optarg, &end, 0);
@@ -2432,7 +2433,13 @@ int main(int argc, char *argv[])
usage();
}
break;
-
+ case 'C':
+ reloc_cluster_size = strtoul(optarg, &end, 0);
+ if (!reloc_cluster_size || (reloc_cluster_size & (reloc_cluster_size - 1))) {
+ fprintf(stderr, "Relocation cluster size must be power of 2");
+ usage();
+ }
+ break;
case 'd':
debug_flag = strtoul(optarg, &end, 0);
break;
@@ -2524,6 +2531,7 @@ int main(int argc, char *argv[])
/* Finaly init of defrag context */
dfx.root_fhp = fhp;
dfx.cluster_size = cluster_size >> dfx.blocksize_bits;
+ dfx.ief_reloc_cluster = reloc_cluster_size >> dfx.blocksize_bits;
dfx.iaf_cluster_size = 16;
if (min_frag_size >= dfx.root_st.st_blksize)
dfx.iaf_cluster_size = min_frag_size >> dfx.blocksize_bits;
--
1.8.3.1
More information about the Devel
mailing list