[PATCH 1/3] nilfs-clean: do not override min_reclaimable_blocks if -m option is not used

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The current implementation of nilfs-clean always overrides
min_reclaimable_blocks parameter and nilfs_cleanerd cannot use that
value defined in /etc/nilfs_cleanerd.conf for manual-mode gc
operation.

This resolves the issue by avoiding to override the
min_reclaimable_blocks parameter when -m option is not specified.

Cc: Andreas Rohner <andreas.rohner@xxxxxxx>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@xxxxxxxxxxxxx>
---
 man/nilfs-clean.8              |    1 -
 sbin/nilfs-clean/nilfs-clean.c |   16 +++++++++-------
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/man/nilfs-clean.8 b/man/nilfs-clean.8
index af39b6b..4bca51d 100644
--- a/man/nilfs-clean.8
+++ b/man/nilfs-clean.8
@@ -48,7 +48,6 @@ Specify the minimum number of reclaimable blocks in a segment before
 it can be cleaned. If the argument is followed by a percent sign, it
 represents the ratio of blocks in a segment. This argument will only have
 an effect if the use_set_suinfo flag is set in the configuration file.
-The default value is one percent.
 .TP
 \fB\-p\fR, \fB\-\-protection-period=\fIinterval\fR
 Set protection period for a cleaner run.  The \fIinterval\fR parameter
diff --git a/sbin/nilfs-clean/nilfs-clean.c b/sbin/nilfs-clean/nilfs-clean.c
index 1f4c8f0..62130c4 100644
--- a/sbin/nilfs-clean/nilfs-clean.c
+++ b/sbin/nilfs-clean/nilfs-clean.c
@@ -130,9 +130,8 @@ static const char *conffile;
 static unsigned long protection_period = ULONG_MAX;
 static int nsegments_per_clean = 2;
 static struct timespec cleaning_interval = { 0, 100000000 };   /* 100 msec */
-static unsigned long min_reclaimable_blocks = 1;
-static unsigned char min_reclaimable_blocks_unit =
-		NILFS_CLEANER_ARG_UNIT_PERCENT;
+static unsigned long min_reclaimable_blocks = ULONG_MAX;
+static unsigned char min_reclaimable_blocks_unit = NILFS_CLEANER_ARG_UNIT_NONE;
 
 static sigjmp_buf nilfs_clean_env;
 static struct nilfs_cleaner *nilfs_cleaner;
@@ -173,18 +172,21 @@ static int nilfs_clean_do_run(struct nilfs_cleaner *cleaner)
 	args.nsegments_per_clean = nsegments_per_clean;
 	args.cleaning_interval = cleaning_interval.tv_sec;
 	args.cleaning_interval_nsec = cleaning_interval.tv_nsec;
-	args.min_reclaimable_blocks = min_reclaimable_blocks;
-	args.min_reclaimable_blocks_unit = min_reclaimable_blocks_unit;
 	args.valid = (NILFS_CLEANER_ARG_NPASSES |
 		      NILFS_CLEANER_ARG_CLEANING_INTERVAL |
-		      NILFS_CLEANER_ARG_NSEGMENTS_PER_CLEAN |
-		      NILFS_CLEANER_ARG_MIN_RECLAIMABLE_BLOCKS);
+		      NILFS_CLEANER_ARG_NSEGMENTS_PER_CLEAN);
 
 	if (protection_period != ULONG_MAX) {
 		args.protection_period = protection_period;
 		args.valid |= NILFS_CLEANER_ARG_PROTECTION_PERIOD;
 	}
 
+	if (min_reclaimable_blocks != ULONG_MAX) {
+		args.min_reclaimable_blocks = min_reclaimable_blocks;
+		args.min_reclaimable_blocks_unit = min_reclaimable_blocks_unit;
+		args.valid |= NILFS_CLEANER_ARG_MIN_RECLAIMABLE_BLOCKS;
+	}
+
 	if (nilfs_cleaner_run(cleaner, &args, NULL) < 0) {
 		myprintf(_("Error: cannot run cleaner: %s\n"),
 			 strerror(errno));
-- 
1.7.9.4

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




[Index of Archives]     [Linux Filesystem Development]     [Linux BTRFS]     [Linux CIFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux