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
This commit is contained in:
Edward Tomasz Napierala 2019-12-12 18:45:31 +00:00
parent 65565c9784
commit d6fee74a0c
3 changed files with 21 additions and 13 deletions

View File

@ -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
/*

View File

@ -114,17 +114,8 @@ static int kern_readlink_vp(struct vnode *vp, char *buf, enum uio_seg bufseg,
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;
@ -151,6 +142,22 @@ sys_sync(struct thread *td, struct sync_args *uap)
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));
}
/*
* Change filesystem quotas.
*/

View File

@ -276,6 +276,7 @@ int kern_statfs(struct thread *td, const char *path, enum uio_seg pathseg,
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);