MCPcopy Create free account
hub / github.com/F-Stack/f-stack / kern_sync

Function kern_sync

freebsd/kern/vfs_syscalls.c:135–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133}
134
135int
136kern_sync(struct thread *td)
137{
138 struct mount *mp, *nmp;
139 int save;
140
141 mtx_lock(&mountlist_mtx);
142 for (mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nmp) {
143 if (vfs_busy(mp, MBF_NOWAIT | MBF_MNTLSTLOCK)) {
144 nmp = TAILQ_NEXT(mp, mnt_list);
145 continue;
146 }
147 if ((mp->mnt_flag & MNT_RDONLY) == 0 &&
148 vn_start_write(NULL, &mp, V_NOWAIT) == 0) {
149 save = curthread_pflags_set(TDP_SYNCIO);
150 vfs_periodic(mp, MNT_NOWAIT);
151 VFS_SYNC(mp, MNT_NOWAIT);
152 curthread_pflags_restore(save);
153 vn_finished_write(mp);
154 }
155 mtx_lock(&mountlist_mtx);
156 nmp = TAILQ_NEXT(mp, mnt_list);
157 vfs_unbusy(mp);
158 }
159 mtx_unlock(&mountlist_mtx);
160 return (0);
161}
162
163/*
164 * Sync each mounted filesystem.

Callers 2

bufshutdownFunction · 0.85
sys_syncFunction · 0.85

Calls 9

vfs_busyFunction · 0.85
vn_start_writeFunction · 0.85
curthread_pflags_setFunction · 0.85
vfs_periodicFunction · 0.85
curthread_pflags_restoreFunction · 0.85
vn_finished_writeFunction · 0.85
vfs_unbusyFunction · 0.85
mtx_lockFunction · 0.70
mtx_unlockFunction · 0.70

Tested by

no test coverage detected