Deleted Added
sdiff udiff text old ( 231075 ) new ( 241896 )
full compact
1/*-
2 * Copyright (c) 2005-2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/geom/journal/g_journal.c 241896 2012-10-22 17:50:54Z kib $");
29
30#include <sys/param.h>
31#include <sys/systm.h>
32#include <sys/kernel.h>
33#include <sys/module.h>
34#include <sys/limits.h>
35#include <sys/lock.h>
36#include <sys/mutex.h>

--- 2828 unchanged lines hidden (view full) ---

2865g_journal_do_switch(struct g_class *classp)
2866{
2867 struct g_journal_softc *sc;
2868 const struct g_journal_desc *desc;
2869 struct g_geom *gp;
2870 struct mount *mp;
2871 struct bintime bt;
2872 char *mountpoint;
2873 int error, save;
2874
2875 DROP_GIANT();
2876 g_topology_lock();
2877 LIST_FOREACH(gp, &classp->geom, geom) {
2878 sc = gp->softc;
2879 if (sc == NULL)
2880 continue;
2881 if (sc->sc_flags & GJF_DEVICE_DESTROY)

--- 35 unchanged lines hidden (view full) ---

2917 sc->sc_flags &= ~GJF_DEVICE_BEFORE_SWITCH;
2918 mtx_unlock(&sc->sc_mtx);
2919 GJ_DEBUG(3, "No need for %s switch.", sc->sc_name);
2920 goto next;
2921 }
2922
2923 mountpoint = mp->mnt_stat.f_mntonname;
2924
2925 error = vn_start_write(NULL, &mp, V_WAIT);
2926 if (error != 0) {
2927 GJ_DEBUG(0, "vn_start_write(%s) failed (error=%d).",
2928 mountpoint, error);
2929 goto next;
2930 }
2931
2932 save = curthread_pflags_set(TDP_SYNCIO);
2933
2934 GJ_TIMER_START(1, &bt);

--- 8 unchanged lines hidden (view full) ---

2943 GJ_DEBUG(0, "Cannot sync file system %s (error=%d).",
2944 mountpoint, error);
2945 }
2946
2947 curthread_pflags_restore(save);
2948
2949 vn_finished_write(mp);
2950
2951 if (error != 0)
2952 goto next;
2953
2954 /*
2955 * Send BIO_FLUSH before freezing the file system, so it can be
2956 * faster after the freeze.
2957 */
2958 GJ_TIMER_START(1, &bt);
2959 g_journal_flush_cache(sc);
2960 GJ_TIMER_STOP(1, &bt, "BIO_FLUSH time of %s", sc->sc_name);
2961
2962 GJ_TIMER_START(1, &bt);
2963 error = vfs_write_suspend(mp);
2964 GJ_TIMER_STOP(1, &bt, "Suspend time of %s", mountpoint);
2965 if (error != 0) {
2966 GJ_DEBUG(0, "Cannot suspend file system %s (error=%d).",
2967 mountpoint, error);
2968 goto next;
2969 }
2970
2971 error = desc->jd_clean(mp);

--- 78 unchanged lines hidden ---