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

Collapse All | Expand All

(-)sys/kern/vfs_subr.c (-1 / +45 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-4173 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, ns, n_fs;
4167
	time_t t0, t1, dt, ts;
4165
4168
4166
	CTR1(KTR_VFS, "%s: unmounting all filesystems", __func__);
4169
	CTR1(KTR_VFS, "%s: unmounting all filesystems", __func__);
4167
4170
4168
	/*
4171
	/*
4172
	 * Count the number of filesystems to unmount
4173
	 */
4174
	n_fs = 0;
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 = ts = 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
	 */
4184
	ns = n = 0;
4171
	TAILQ_FOREACH_REVERSE_SAFE(mp, &mountlist, mntlist, mnt_list, tmp) {
4185
	TAILQ_FOREACH_REVERSE_SAFE(mp, &mountlist, mntlist, mnt_list, tmp) {
4172
		vfs_ref(mp);
4186
		vfs_ref(mp);
4173
4187
Lines 4179-4188 Link Here
4179
			continue;
4193
			continue;
4180
4194
4181
		unmount_or_warn(mp);
4195
		unmount_or_warn(mp);
4196
4197
		/* 
4198
		 * If more than 20 filesystems to unmount, print a running count
4199
		 * every second, else print the filesystem names (with thousands 
4200
		 * of filesystems this becomes too tedious (and slows down the
4201
		 * reboot process even more...)
4202
		 */
4203
		++n;
4204
		if (n_fs > 20) {
4205
			t1 = time_second;
4206
			if (t1 != ts) {
4207
				dt = t1 - t0;
4208
				printf("  %6u of %u [%u%% done, %d fs/s (cur), %ld fs/s (avg)]    \r",
4209
				       n, n_fs, n*100/n_fs, n-ns, n/dt);
4210
				ts = t1;
4211
				ns = n;
4212
			}
4213
		} else {
4214
			printf("  %2u. %s\n", n, mp->mnt_stat.f_mntonname);
4215
		}
4182
	}
4216
	}
4183
4217
4184
	if (rootdevmp != NULL)
4218
	if (rootdevmp != NULL) {
4185
		unmount_or_warn(rootdevmp);
4219
		unmount_or_warn(rootdevmp);
4220
		++n;
4221
	}
4222
4223
	dt = time_second - t0;
4224
	if (dt != 0)
4225
		printf("%u filesystem%s unmounted in %lds (%ld fs/s).                 \n",
4226
		       n, n == 1 ? "" : "s", dt, n/dt);
4227
	else
4228
		printf("%u filesystem%s unmounted.\n",
4229
		       n, n == 1 ? "" : "s");
4186
}
4230
}
4187
4231
4188
/*
4232
/*

Return to bug 255261