View | Details | Raw Unified | Return to bug 255261 | Differences between
and this patch

Collapse All | Expand All

(-)sys/kern/vfs_subr.c (-1 / +39 lines)
Lines 79-84 Link Here
79
#include <sys/stat.h>
79
#include <sys/stat.h>
80
#include <sys/sysctl.h>
80
#include <sys/sysctl.h>
81
#include <sys/syslog.h>
81
#include <sys/syslog.h>
82
#include <sys/time.h>
82
#include <sys/vmmeter.h>
83
#include <sys/vmmeter.h>
83
#include <sys/vnode.h>
84
#include <sys/vnode.h>
84
#include <sys/watchdog.h>
85
#include <sys/watchdog.h>
Lines 4162-4171 Link Here
4162
vfs_unmountall(void)
4163
vfs_unmountall(void)
4163
{
4164
{
4164
	struct mount *mp, *tmp;
4165
	struct mount *mp, *tmp;
4166
	unsigned int n = 0;
4167
	unsigned int n_fs = 0;
4168
	time_t t0, dt, time_last = 0;
4165
4169
4166
	CTR1(KTR_VFS, "%s: unmounting all filesystems", __func__);
4170
	CTR1(KTR_VFS, "%s: unmounting all filesystems", __func__);
4167
4171
4168
	/*
4172
	/*
4173
	 * Count the number of filesystems to unmount
4174
	 */
4175
	TAILQ_FOREACH_REVERSE_SAFE(mp, &mountlist, mntlist, mnt_list, tmp) {
4176
		++n_fs;
4177
	}
4178
	printf("Unmounting %u filesystems:\n", n_fs);
4179
	t0 = time_second;
4180
4181
	/*
4169
	 * Since this only runs when rebooting, it is not interlocked.
4182
	 * Since this only runs when rebooting, it is not interlocked.
4170
	 */
4183
	 */
4171
	TAILQ_FOREACH_REVERSE_SAFE(mp, &mountlist, mntlist, mnt_list, tmp) {
4184
	TAILQ_FOREACH_REVERSE_SAFE(mp, &mountlist, mntlist, mnt_list, tmp) {
Lines 4179-4188 Link Here
4179
			continue;
4192
			continue;
4180
4193
4181
		unmount_or_warn(mp);
4194
		unmount_or_warn(mp);
4195
4196
		/* 
4197
		 * If more than 20 filesystems to unmount, print a running count
4198
		 * every second, else print the filesystem names (with thousands 
4199
		 * of filesystems this becomes too tedious (and slows down the
4200
		 * reboot process even more...)
4201
		 */
4202
		++n;
4203
		if (n_fs > 20) {
4204
			if (time_last != time_second) {
4205
				printf("  %6u of %u (%u%% done)\r",
4206
				       n,
4207
				       n_fs,
4208
				       n*100/n_fs);
4209
				time_last = time_second;
4210
			}
4211
		} else {
4212
			printf("  %2u. %s\n", n, mp->mnt_stat.f_mntonname);
4213
		}
4182
	}
4214
	}
4183
4215
4184
	if (rootdevmp != NULL)
4216
	if (rootdevmp != NULL) {
4185
		unmount_or_warn(rootdevmp);
4217
		unmount_or_warn(rootdevmp);
4218
		++n;
4219
	}
4220
4221
	dt = time_second - t0;
4222
	printf("%u filesystem%s unmounted in %lds.         \n",
4223
	       n, n == 1 ? "" : "s", dt);
4186
}
4224
}
4187
4225
4188
/*
4226
/*

Return to bug 255261