FreeBSD Bugzilla – Attachment 224295 Details for
Bug 255261
Slow unmount of (ZFS) filesystem at reboot time
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to add a progress indicator for filesystem unmounting at reboot/shutdown
vfs_subr-unmount-progress.patch (text/plain), 1.73 KB, created by
Peter Eriksson
on 2021-04-20 13:49:52 UTC
(
hide
)
Description:
Patch to add a progress indicator for filesystem unmounting at reboot/shutdown
Filename:
MIME Type:
Creator:
Peter Eriksson
Created:
2021-04-20 13:49:52 UTC
Size:
1.73 KB
patch
obsolete
>Index: sys/kern/vfs_subr.c >=================================================================== >--- sys/kern/vfs_subr.c (revision 369637) >+++ sys/kern/vfs_subr.c (working copy) >@@ -79,6 +79,7 @@ > #include <sys/stat.h> > #include <sys/sysctl.h> > #include <sys/syslog.h> >+#include <sys/time.h> > #include <sys/vmmeter.h> > #include <sys/vnode.h> > #include <sys/watchdog.h> >@@ -4162,10 +4163,22 @@ > vfs_unmountall(void) > { > struct mount *mp, *tmp; >+ unsigned int n = 0; >+ unsigned int n_fs = 0; >+ time_t t0, dt, time_last = 0; > > CTR1(KTR_VFS, "%s: unmounting all filesystems", __func__); > > /* >+ * Count the number of filesystems to unmount >+ */ >+ TAILQ_FOREACH_REVERSE_SAFE(mp, &mountlist, mntlist, mnt_list, tmp) { >+ ++n_fs; >+ } >+ printf("Unmounting %u filesystems:\n", n_fs); >+ t0 = time_second; >+ >+ /* > * Since this only runs when rebooting, it is not interlocked. > */ > TAILQ_FOREACH_REVERSE_SAFE(mp, &mountlist, mntlist, mnt_list, tmp) { >@@ -4179,10 +4192,35 @@ > continue; > > unmount_or_warn(mp); >+ >+ /* >+ * If more than 20 filesystems to unmount, print a running count >+ * every second, else print the filesystem names (with thousands >+ * of filesystems this becomes too tedious (and slows down the >+ * reboot process even more...) >+ */ >+ ++n; >+ if (n_fs > 20) { >+ if (time_last != time_second) { >+ printf(" %6u of %u (%u%% done)\r", >+ n, >+ n_fs, >+ n*100/n_fs); >+ time_last = time_second; >+ } >+ } else { >+ printf(" %2u. %s\n", n, mp->mnt_stat.f_mntonname); >+ } > } > >- if (rootdevmp != NULL) >+ if (rootdevmp != NULL) { > unmount_or_warn(rootdevmp); >+ ++n; >+ } >+ >+ dt = time_second - t0; >+ printf("%u filesystem%s unmounted in %lds. \n", >+ n, n == 1 ? "" : "s", dt); > } > > /*
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 255261
:
224295
|
224325
|
224326
|
224327
|
224366
|
224367