Author: trasz
Date: Thu Dec 12 18:45:31 2019
New Revision: 355660
URL: https://svnweb.freebsd.org/changeset/base/355660

Log:
  Add kern_sync(9), and make kernel code call it instead of going
  via sys_sync(2).  Minor cleanup, no functional changes.
  
  Reviewed by:  kib
  MFC after:    2 weeks
  Sponsored by: The FreeBSD Foundation
  Differential Revision:        https://reviews.freebsd.org/D19366

Modified:
  head/sys/kern/vfs_bio.c
  head/sys/kern/vfs_syscalls.c
  head/sys/sys/syscallsubr.h

Modified: head/sys/kern/vfs_bio.c
==============================================================================
--- head/sys/kern/vfs_bio.c     Thu Dec 12 18:27:54 2019        (r355659)
+++ head/sys/kern/vfs_bio.c     Thu Dec 12 18:45:31 2019        (r355660)
@@ -72,7 +72,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/rwlock.h>
 #include <sys/smp.h>
 #include <sys/sysctl.h>
-#include <sys/sysproto.h>
+#include <sys/syscallsubr.h>
 #include <sys/vmem.h>
 #include <sys/vmmeter.h>
 #include <sys/vnode.h>
@@ -1342,7 +1342,7 @@ bufshutdown(int show_busybufs)
         * Sync filesystems for shutdown
         */
        wdog_kern_pat(WD_LASTVAL);
-       sys_sync(curthread, NULL);
+       kern_sync(curthread);
 
        /*
         * With soft updates, some buffers that are
@@ -1369,7 +1369,7 @@ bufshutdown(int show_busybufs)
                pbusy = nbusy;
 
                wdog_kern_pat(WD_LASTVAL);
-               sys_sync(curthread, NULL);
+               kern_sync(curthread);
 
 #ifdef PREEMPTION
                /*

Modified: head/sys/kern/vfs_syscalls.c
==============================================================================
--- head/sys/kern/vfs_syscalls.c        Thu Dec 12 18:27:54 2019        
(r355659)
+++ head/sys/kern/vfs_syscalls.c        Thu Dec 12 18:45:31 2019        
(r355660)
@@ -114,17 +114,8 @@ static int kern_readlink_vp(struct vnode *vp, char *bu
 static int kern_linkat_vp(struct thread *td, struct vnode *vp, int fd,
     const char *path, enum uio_seg segflag);
 
-/*
- * Sync each mounted filesystem.
- */
-#ifndef _SYS_SYSPROTO_H_
-struct sync_args {
-       int     dummy;
-};
-#endif
-/* ARGSUSED */
 int
-sys_sync(struct thread *td, struct sync_args *uap)
+kern_sync(struct thread *td)
 {
        struct mount *mp, *nmp;
        int save;
@@ -149,6 +140,22 @@ sys_sync(struct thread *td, struct sync_args *uap)
        }
        mtx_unlock(&mountlist_mtx);
        return (0);
+}
+
+/*
+ * Sync each mounted filesystem.
+ */
+#ifndef _SYS_SYSPROTO_H_
+struct sync_args {
+       int     dummy;
+};
+#endif
+/* ARGSUSED */
+int
+sys_sync(struct thread *td, struct sync_args *uap)
+{
+
+       return (kern_sync(td));
 }
 
 /*

Modified: head/sys/sys/syscallsubr.h
==============================================================================
--- head/sys/sys/syscallsubr.h  Thu Dec 12 18:27:54 2019        (r355659)
+++ head/sys/sys/syscallsubr.h  Thu Dec 12 18:45:31 2019        (r355660)
@@ -276,6 +276,7 @@ int kern_statfs(struct thread *td, const char *path, e
            struct statfs *buf);
 int    kern_symlinkat(struct thread *td, const char *path1, int fd,
            const char *path2, enum uio_seg segflg);
+int    kern_sync(struct thread *td);
 int    kern_ktimer_create(struct thread *td, clockid_t clock_id,
            struct sigevent *evp, int *timerid, int preset_id);
 int    kern_ktimer_delete(struct thread *, int);
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to