Exemple #1
0
static int nilfs_clean_do_run(struct nilfs_cleaner *cleaner)
{
	struct nilfs_cleaner_args args;
	int ret;

	args.npasses = 1;
	args.nsegments_per_clean = nsegments_per_clean;
	args.cleaning_interval = cleaning_interval.tv_sec;
	args.cleaning_interval_nsec = cleaning_interval.tv_nsec;
	args.valid = (NILFS_CLEANER_ARG_NPASSES |
		      NILFS_CLEANER_ARG_CLEANING_INTERVAL |
		      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;
	}

	ret = nilfs_cleaner_run(cleaner, &args, NULL);
	if (unlikely(ret < 0)) {
		myprintf(_("Error: cannot run cleaner: %s\n"),
			 strerror(errno));
		return -1;
	}
	return 0;
}
Exemple #2
0
static int nilfs_clean_do_run(struct nilfs_cleaner *cleaner)
{
	struct nilfs_cleaner_args args;

	args.npasses = 1;
	args.nsegments_per_clean = nsegments_per_clean;
	args.cleaning_interval = cleaning_interval.tv_sec;
	args.cleaning_interval_nsec = cleaning_interval.tv_nsec;
	args.valid = (NILFS_CLEANER_ARG_NPASSES |
		      NILFS_CLEANER_ARG_CLEANING_INTERVAL |
		      NILFS_CLEANER_ARG_NSEGMENTS_PER_CLEAN);

	if (protection_period != ULONG_MAX) {
		args.protection_period = protection_period;
		args.valid |= NILFS_CLEANER_ARG_PROTECTION_PERIOD;
	}

	if (nilfs_cleaner_run(cleaner, &args, NULL) < 0) {
		myprintf(_("Error: cannot run cleaner: %s\n"),
			 strerror(errno));
		return -1;
	}
	return 0;
}