\hypertarget{g__journal_8c_source}{}\doxysection{g\+\_\+journal.\+c}
\label{g__journal_8c_source}\index{geom/journal/g\_journal.c@{geom/journal/g\_journal.c}}
\mbox{\hyperlink{g__journal_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00001}00001 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00002}00002 \textcolor{comment}{ * SPDX-\/License-\/Identifier: BSD-\/2-\/Clause-\/FreeBSD}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00003}00003 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00004}00004 \textcolor{comment}{ * Copyright (c) 2005-\/2006 Pawel Jakub Dawidek <pjd@FreeBSD.org>}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00005}00005 \textcolor{comment}{ * All rights reserved.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00006}00006 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00007}00007 \textcolor{comment}{ * Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00008}00008 \textcolor{comment}{ * modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00009}00009 \textcolor{comment}{ * are met:}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00010}00010 \textcolor{comment}{ * 1. Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00011}00011 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00012}00012 \textcolor{comment}{ * 2. Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00013}00013 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer in the}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00014}00014 \textcolor{comment}{ *    documentation and/or other materials provided with the distribution.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00015}00015 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00016}00016 \textcolor{comment}{ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00017}00017 \textcolor{comment}{ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00018}00018 \textcolor{comment}{ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00019}00019 \textcolor{comment}{ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00020}00020 \textcolor{comment}{ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00021}00021 \textcolor{comment}{ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00022}00022 \textcolor{comment}{ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00023}00023 \textcolor{comment}{ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00024}00024 \textcolor{comment}{ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00025}00025 \textcolor{comment}{ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00026}00026 \textcolor{comment}{ * SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00027}00027 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00028}00028 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00029}00029 \textcolor{preprocessor}{\#include <sys/cdefs.h>}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00030}\mbox{\hyperlink{g__journal_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{00030}} \mbox{\hyperlink{g__journal_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{\_\_FBSDID}}(\textcolor{stringliteral}{"{}\$FreeBSD\$"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00031}00031 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00032}00032 \textcolor{preprocessor}{\#include <sys/param.h>}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00033}00033 \textcolor{preprocessor}{\#include <sys/systm.h>}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00034}00034 \textcolor{preprocessor}{\#include <sys/kernel.h>}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00035}00035 \textcolor{preprocessor}{\#include <sys/module.h>}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00036}00036 \textcolor{preprocessor}{\#include <sys/limits.h>}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00037}00037 \textcolor{preprocessor}{\#include <sys/lock.h>}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00038}00038 \textcolor{preprocessor}{\#include <sys/mutex.h>}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00039}00039 \textcolor{preprocessor}{\#include <sys/bio.h>}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00040}00040 \textcolor{preprocessor}{\#include <sys/sysctl.h>}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00041}00041 \textcolor{preprocessor}{\#include <sys/malloc.h>}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00042}00042 \textcolor{preprocessor}{\#include <sys/mount.h>}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00043}00043 \textcolor{preprocessor}{\#include <sys/eventhandler.h>}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00044}00044 \textcolor{preprocessor}{\#include <sys/proc.h>}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00045}00045 \textcolor{preprocessor}{\#include <sys/kthread.h>}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00046}00046 \textcolor{preprocessor}{\#include <sys/sched.h>}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00047}00047 \textcolor{preprocessor}{\#include <sys/taskqueue.h>}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00048}00048 \textcolor{preprocessor}{\#include <sys/vnode.h>}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00049}00049 \textcolor{preprocessor}{\#include <sys/sbuf.h>}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00050}00050 \textcolor{preprocessor}{\#ifdef GJ\_MEMDEBUG}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00051}00051 \textcolor{preprocessor}{\#include <sys/stack.h>}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00052}00052 \textcolor{preprocessor}{\#include <sys/kdb.h>}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00053}00053 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00054}00054 \textcolor{preprocessor}{\#include <vm/vm.h>}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00055}00055 \textcolor{preprocessor}{\#include <vm/vm\_kern.h>}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00056}00056 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{geom_8h}{geom/geom.h}}>}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00057}00057 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{geom__dbg_8h}{geom/geom\_dbg.h}}>}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00058}00058 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00059}00059 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{g__journal_8h}{geom/journal/g\_journal.h}}>}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00060}00060 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00061}\mbox{\hyperlink{g__journal_8c_a55a6ea13f5d5b6c28662d809bead0b19}{00061}} \mbox{\hyperlink{g__journal_8c_a55a6ea13f5d5b6c28662d809bead0b19}{FEATURE}}(geom\_journal, \textcolor{stringliteral}{"{}GEOM journaling support"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00062}00062 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00063}00063 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00064}00064 \textcolor{comment}{ * On-\/disk journal format:}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00065}00065 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00066}00066 \textcolor{comment}{ * JH -\/ Journal header}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00067}00067 \textcolor{comment}{ * RH -\/ Record header}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00068}00068 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00069}00069 \textcolor{comment}{ * \%\%\%\%\%\% ****** +-\/-\/-\/-\/-\/-\/+ +-\/-\/-\/-\/-\/-\/+     ****** +-\/-\/-\/-\/-\/-\/+     \%\%\%\%\%\%}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00070}00070 \textcolor{comment}{ * \% JH \% * RH * | Data | | Data | ... * RH * | Data | ... \% JH \% ...}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00071}00071 \textcolor{comment}{ * \%\%\%\%\%\% ****** +-\/-\/-\/-\/-\/-\/+ +-\/-\/-\/-\/-\/-\/+     ****** +-\/-\/-\/-\/-\/-\/+     \%\%\%\%\%\%}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00072}00072 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00073}00073 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00074}00074 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00075}\mbox{\hyperlink{g__journal_8c_a94909e9401ff48f08ccda8ba31516ab6}{00075}} \mbox{\hyperlink{g__journal_8c_a94909e9401ff48f08ccda8ba31516ab6}{CTASSERT}}(\textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__journal__header}{g\_journal\_header}}) <= 512);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00076}\mbox{\hyperlink{g__journal_8c_a16a6d6ffe3e12b0e6db32577a0499184}{00076}} \mbox{\hyperlink{g__journal_8c_a94909e9401ff48f08ccda8ba31516ab6}{CTASSERT}}(\textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__journal__record__header}{g\_journal\_record\_header}}) <= 512);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00077}00077 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00078}\mbox{\hyperlink{g__journal_8c_aa7697c6a622021fa708db7e36bae2427}{00078}} \textcolor{keyword}{static} \mbox{\hyperlink{g__journal_8c_aa7697c6a622021fa708db7e36bae2427}{MALLOC\_DEFINE}}(M\_JOURNAL, \textcolor{stringliteral}{"{}journal\_data"{}}, \textcolor{stringliteral}{"{}GEOM\_JOURNAL Data"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00079}\mbox{\hyperlink{g__journal_8c_aa8f071ef77cd0e62f3ae5d479b2d77cb}{00079}} \textcolor{keyword}{static} \textcolor{keyword}{struct }mtx \mbox{\hyperlink{g__journal_8c_aa8f071ef77cd0e62f3ae5d479b2d77cb}{g\_journal\_cache\_mtx}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00080}\mbox{\hyperlink{g__journal_8c_a3168574a633239188c91646d8243d1d4}{00080}} \mbox{\hyperlink{g__journal_8c_a3168574a633239188c91646d8243d1d4}{MTX\_SYSINIT}}(g\_journal\_cache, \&\mbox{\hyperlink{g__journal_8c_aa8f071ef77cd0e62f3ae5d479b2d77cb}{g\_journal\_cache\_mtx}}, \textcolor{stringliteral}{"{}cache usage"{}}, MTX\_DEF);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00081}00081 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00082}\mbox{\hyperlink{g__journal_8c_a23cd1b925a6a1a38d5c117818669f55e}{00082}} \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structg__journal__desc}{g\_journal\_desc}} *\mbox{\hyperlink{g__journal_8c_a23cd1b925a6a1a38d5c117818669f55e}{g\_journal\_filesystems}}[] = \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00083}00083         \&\mbox{\hyperlink{g__journal_8h_a2d59c4e42cc7ba87c58953b286698728}{g\_journal\_ufs}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00084}00084         NULL}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00085}00085 \};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00086}00086 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00087}\mbox{\hyperlink{g__journal_8c_a1e69eaa2ef6048550eaeebcf775a3d0f}{00087}} \mbox{\hyperlink{g__journal_8c_a1e69eaa2ef6048550eaeebcf775a3d0f}{SYSCTL\_DECL}}(\_kern\_geom);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00088}00088 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00089}\mbox{\hyperlink{g__journal_8c_a46680090bf15392d6c4741f1ee1566ba}{00089}} \textcolor{keywordtype}{int} \mbox{\hyperlink{g__journal_8c_a46680090bf15392d6c4741f1ee1566ba}{g\_journal\_debug}} = 0;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00090}\mbox{\hyperlink{g__journal_8c_afdcd73703cb2bae47e8c0f5925dc338e}{00090}} \textcolor{keyword}{static} u\_int \mbox{\hyperlink{g__journal_8c_afdcd73703cb2bae47e8c0f5925dc338e}{g\_journal\_switch\_time}} = 10;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00091}\mbox{\hyperlink{g__journal_8c_adc9d20c11d4818b8206659feb8c120e4}{00091}} \textcolor{keyword}{static} u\_int \mbox{\hyperlink{g__journal_8c_adc9d20c11d4818b8206659feb8c120e4}{g\_journal\_force\_switch}} = 70;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00092}\mbox{\hyperlink{g__journal_8c_ad454dc48b27db6e060ce7aefc0b0ce1a}{00092}} \textcolor{keyword}{static} u\_int \mbox{\hyperlink{g__journal_8c_ad454dc48b27db6e060ce7aefc0b0ce1a}{g\_journal\_parallel\_flushes}} = 16;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00093}\mbox{\hyperlink{g__journal_8c_a51726aca8da4cf075e48fd256a881504}{00093}} \textcolor{keyword}{static} u\_int \mbox{\hyperlink{g__journal_8c_a51726aca8da4cf075e48fd256a881504}{g\_journal\_parallel\_copies}} = 16;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00094}\mbox{\hyperlink{g__journal_8c_a1d818f3b07fa826d8cd59da328d3d4cb}{00094}} \textcolor{keyword}{static} u\_int \mbox{\hyperlink{g__journal_8c_a1d818f3b07fa826d8cd59da328d3d4cb}{g\_journal\_accept\_immediately}} = 64;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00095}\mbox{\hyperlink{g__journal_8c_a55482bd8bb834da000324b68eea4d963}{00095}} \textcolor{keyword}{static} u\_int \mbox{\hyperlink{g__journal_8c_a55482bd8bb834da000324b68eea4d963}{g\_journal\_record\_entries}} = \mbox{\hyperlink{g__journal_8h_ad7a5b5819fadfea6e4495162f67eb60e}{GJ\_RECORD\_HEADER\_NENTRIES}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00096}\mbox{\hyperlink{g__journal_8c_a40a04508c45251032c2447d17e5bff66}{00096}} \textcolor{keyword}{static} u\_int \mbox{\hyperlink{g__journal_8c_a40a04508c45251032c2447d17e5bff66}{g\_journal\_do\_optimize}} = 1;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00097}00097 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00098}\mbox{\hyperlink{g__journal_8c_ad90270fc502096e39f677122227c95b6}{00098}} \textcolor{keyword}{static} \mbox{\hyperlink{g__journal_8c_ad90270fc502096e39f677122227c95b6}{SYSCTL\_NODE}}(\_kern\_geom, OID\_AUTO, journal,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00099}00099     CTLFLAG\_RW | CTLFLAG\_MPSAFE, 0,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00100}00100     \textcolor{stringliteral}{"{}GEOM\_JOURNAL stuff"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00101}\mbox{\hyperlink{g__journal_8c_a2a4ebddce2eb7fe68adeeb51a75aaed4}{00101}} \mbox{\hyperlink{g__journal_8c_a2a4ebddce2eb7fe68adeeb51a75aaed4}{SYSCTL\_INT}}(\_kern\_geom\_journal, OID\_AUTO, debug, CTLFLAG\_RWTUN, \&\mbox{\hyperlink{g__journal_8c_a46680090bf15392d6c4741f1ee1566ba}{g\_journal\_debug}}, 0,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00102}00102     \textcolor{stringliteral}{"{}Debug level"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00103}\mbox{\hyperlink{g__journal_8c_a13e5082e7b85d55cac921b86c485b835}{00103}} \mbox{\hyperlink{g__journal_8c_a13e5082e7b85d55cac921b86c485b835}{SYSCTL\_UINT}}(\_kern\_geom\_journal, OID\_AUTO, switch\_time, CTLFLAG\_RW,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00104}00104     \&\mbox{\hyperlink{g__journal_8c_afdcd73703cb2bae47e8c0f5925dc338e}{g\_journal\_switch\_time}}, 0, \textcolor{stringliteral}{"{}Switch journals every N seconds"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00105}\mbox{\hyperlink{g__journal_8c_aa7884af03c0355f18759597527979ad2}{00105}} \mbox{\hyperlink{g__journal_8c_a13e5082e7b85d55cac921b86c485b835}{SYSCTL\_UINT}}(\_kern\_geom\_journal, OID\_AUTO, force\_switch, CTLFLAG\_RW,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00106}00106     \&\mbox{\hyperlink{g__journal_8c_adc9d20c11d4818b8206659feb8c120e4}{g\_journal\_force\_switch}}, 0, \textcolor{stringliteral}{"{}Force switch when journal is N\% full"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00107}\mbox{\hyperlink{g__journal_8c_a55565e03d9d7e52be1373c485265a828}{00107}} \mbox{\hyperlink{g__journal_8c_a13e5082e7b85d55cac921b86c485b835}{SYSCTL\_UINT}}(\_kern\_geom\_journal, OID\_AUTO, parallel\_flushes, CTLFLAG\_RW,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00108}00108     \&\mbox{\hyperlink{g__journal_8c_ad454dc48b27db6e060ce7aefc0b0ce1a}{g\_journal\_parallel\_flushes}}, 0,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00109}00109     \textcolor{stringliteral}{"{}Number of flush I/O requests to send in parallel"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00110}\mbox{\hyperlink{g__journal_8c_a532a82041be12a3f33b5cb948249d70d}{00110}} \mbox{\hyperlink{g__journal_8c_a13e5082e7b85d55cac921b86c485b835}{SYSCTL\_UINT}}(\_kern\_geom\_journal, OID\_AUTO, accept\_immediately, CTLFLAG\_RW,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00111}00111     \&\mbox{\hyperlink{g__journal_8c_a1d818f3b07fa826d8cd59da328d3d4cb}{g\_journal\_accept\_immediately}}, 0,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00112}00112     \textcolor{stringliteral}{"{}Number of I/O requests accepted immediately"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00113}\mbox{\hyperlink{g__journal_8c_ae46de0968ec226ea7ab15acccd68e84e}{00113}} \mbox{\hyperlink{g__journal_8c_a13e5082e7b85d55cac921b86c485b835}{SYSCTL\_UINT}}(\_kern\_geom\_journal, OID\_AUTO, parallel\_copies, CTLFLAG\_RW,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00114}00114     \&\mbox{\hyperlink{g__journal_8c_a51726aca8da4cf075e48fd256a881504}{g\_journal\_parallel\_copies}}, 0,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00115}00115     \textcolor{stringliteral}{"{}Number of copy I/O requests to send in parallel"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00116}00116 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00117}\mbox{\hyperlink{g__journal_8c_a935e3f25c761a7dcae5a6ef77da0c483}{00117}} \mbox{\hyperlink{g__journal_8c_a935e3f25c761a7dcae5a6ef77da0c483}{g\_journal\_record\_entries\_sysctl}}(SYSCTL\_HANDLER\_ARGS)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00118}00118 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00119}00119         u\_int entries;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00120}00120         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00121}00121 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00122}00122         entries = \mbox{\hyperlink{g__journal_8c_a55482bd8bb834da000324b68eea4d963}{g\_journal\_record\_entries}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00123}00123         error = sysctl\_handle\_int(oidp, \&entries, 0, \mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00124}00124         \textcolor{keywordflow}{if} (error != 0 || \mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}-\/>newptr == NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00125}00125                 \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00126}00126         \textcolor{keywordflow}{if} (entries < 1 || entries > \mbox{\hyperlink{g__journal_8h_ad7a5b5819fadfea6e4495162f67eb60e}{GJ\_RECORD\_HEADER\_NENTRIES}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00127}00127                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00128}00128         \mbox{\hyperlink{g__journal_8c_a55482bd8bb834da000324b68eea4d963}{g\_journal\_record\_entries}} = entries;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00129}00129         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00130}00130 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00131}\mbox{\hyperlink{g__journal_8c_afd2751fa62eb017fb48540ad2382276f}{00131}} \mbox{\hyperlink{g__journal_8c_afd2751fa62eb017fb48540ad2382276f}{SYSCTL\_PROC}}(\_kern\_geom\_journal, OID\_AUTO, record\_entries,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00132}00132     CTLTYPE\_UINT | CTLFLAG\_RW | CTLFLAG\_MPSAFE, NULL, 0,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00133}00133     \mbox{\hyperlink{g__journal_8c_a935e3f25c761a7dcae5a6ef77da0c483}{g\_journal\_record\_entries\_sysctl}}, \textcolor{stringliteral}{"{}I"{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00134}00134     \textcolor{stringliteral}{"{}Maximum number of entires in one journal record"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00135}\mbox{\hyperlink{g__journal_8c_a6f10c41a85d065e9efa7250e16f847d3}{00135}} \mbox{\hyperlink{g__journal_8c_a13e5082e7b85d55cac921b86c485b835}{SYSCTL\_UINT}}(\_kern\_geom\_journal, OID\_AUTO, optimize, CTLFLAG\_RW,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00136}00136     \&\mbox{\hyperlink{g__journal_8c_a40a04508c45251032c2447d17e5bff66}{g\_journal\_do\_optimize}}, 0, \textcolor{stringliteral}{"{}Try to combine bios on flush and copy"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00137}00137 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00138}\mbox{\hyperlink{g__journal_8c_ad7c6bd3b76460d8f60e09f51c9f8f9bb}{00138}} \textcolor{keyword}{static} u\_long \mbox{\hyperlink{g__journal_8c_ad7c6bd3b76460d8f60e09f51c9f8f9bb}{g\_journal\_cache\_used}} = 0;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00139}\mbox{\hyperlink{g__journal_8c_a4c9e6c2c63842d88b28737ecd982124c}{00139}} \textcolor{keyword}{static} u\_long \mbox{\hyperlink{g__journal_8c_a4c9e6c2c63842d88b28737ecd982124c}{g\_journal\_cache\_limit}} = 64 * 1024 * 1024;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00140}\mbox{\hyperlink{g__journal_8c_a04e9fe8729a1d236111d14806cb396dd}{00140}} \textcolor{keyword}{static} u\_int \mbox{\hyperlink{g__journal_8c_a04e9fe8729a1d236111d14806cb396dd}{g\_journal\_cache\_divisor}} = 2;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00141}\mbox{\hyperlink{g__journal_8c_a5e2abb952038df01030c62c17ad96363}{00141}} \textcolor{keyword}{static} u\_int \mbox{\hyperlink{g__journal_8c_a5e2abb952038df01030c62c17ad96363}{g\_journal\_cache\_switch}} = 90;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00142}\mbox{\hyperlink{g__journal_8c_ace41ab0e6b1a3d13a7bcb4f10cf3eb6f}{00142}} \textcolor{keyword}{static} u\_int \mbox{\hyperlink{g__journal_8c_ace41ab0e6b1a3d13a7bcb4f10cf3eb6f}{g\_journal\_cache\_misses}} = 0;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00143}\mbox{\hyperlink{g__journal_8c_ae81c4266f5705c7f85fc0c9bdbcae0a5}{00143}} \textcolor{keyword}{static} u\_int \mbox{\hyperlink{g__journal_8c_ae81c4266f5705c7f85fc0c9bdbcae0a5}{g\_journal\_cache\_alloc\_failures}} = 0;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00144}\mbox{\hyperlink{g__journal_8c_a60bf13b7044e9e9fec39ce68b5daf4a6}{00144}} \textcolor{keyword}{static} u\_long \mbox{\hyperlink{g__journal_8c_a60bf13b7044e9e9fec39ce68b5daf4a6}{g\_journal\_cache\_low}} = 0;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00145}00145 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00146}\mbox{\hyperlink{g__journal_8c_a103735c0b60cbc598e187df921740c27}{00146}} \textcolor{keyword}{static} \mbox{\hyperlink{g__journal_8c_ad90270fc502096e39f677122227c95b6}{SYSCTL\_NODE}}(\_kern\_geom\_journal, OID\_AUTO, cache,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00147}00147     CTLFLAG\_RW | CTLFLAG\_MPSAFE, 0,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00148}00148     \textcolor{stringliteral}{"{}GEOM\_JOURNAL cache"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00149}\mbox{\hyperlink{g__journal_8c_a5a520d3540c4ab8ed2e2083aa1fb7923}{00149}} \mbox{\hyperlink{g__journal_8c_a5a520d3540c4ab8ed2e2083aa1fb7923}{SYSCTL\_ULONG}}(\_kern\_geom\_journal\_cache, OID\_AUTO, used, CTLFLAG\_RD,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00150}00150     \&\mbox{\hyperlink{g__journal_8c_ad7c6bd3b76460d8f60e09f51c9f8f9bb}{g\_journal\_cache\_used}}, 0, \textcolor{stringliteral}{"{}Number of allocated bytes"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00151}00151 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00152}\mbox{\hyperlink{g__journal_8c_a16cbf81e1966a313c72ade39691a7b73}{00152}} \mbox{\hyperlink{g__journal_8c_a16cbf81e1966a313c72ade39691a7b73}{g\_journal\_cache\_limit\_sysctl}}(SYSCTL\_HANDLER\_ARGS)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00153}00153 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00154}00154         u\_long limit;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00155}00155         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00156}00156 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00157}00157         limit = \mbox{\hyperlink{g__journal_8c_a4c9e6c2c63842d88b28737ecd982124c}{g\_journal\_cache\_limit}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00158}00158         error = sysctl\_handle\_long(oidp, \&limit, 0, \mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00159}00159         \textcolor{keywordflow}{if} (error != 0 || \mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}-\/>newptr == NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00160}00160                 \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00161}00161         \mbox{\hyperlink{g__journal_8c_a4c9e6c2c63842d88b28737ecd982124c}{g\_journal\_cache\_limit}} = limit;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00162}00162         \mbox{\hyperlink{g__journal_8c_a60bf13b7044e9e9fec39ce68b5daf4a6}{g\_journal\_cache\_low}} = (limit / 100) * \mbox{\hyperlink{g__journal_8c_a5e2abb952038df01030c62c17ad96363}{g\_journal\_cache\_switch}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00163}00163         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00164}00164 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00165}\mbox{\hyperlink{g__journal_8c_af542494d7be018f4bd646e4420d2a2bc}{00165}} \mbox{\hyperlink{g__journal_8c_afd2751fa62eb017fb48540ad2382276f}{SYSCTL\_PROC}}(\_kern\_geom\_journal\_cache, OID\_AUTO, limit,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00166}00166     CTLTYPE\_ULONG | CTLFLAG\_RWTUN | CTLFLAG\_MPSAFE, NULL, 0,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00167}00167     \mbox{\hyperlink{g__journal_8c_a16cbf81e1966a313c72ade39691a7b73}{g\_journal\_cache\_limit\_sysctl}}, \textcolor{stringliteral}{"{}I"{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00168}00168     \textcolor{stringliteral}{"{}Maximum number of allocated bytes"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00169}\mbox{\hyperlink{g__journal_8c_a5ab9a795229eeb6365b285bcdb277228}{00169}} \mbox{\hyperlink{g__journal_8c_a13e5082e7b85d55cac921b86c485b835}{SYSCTL\_UINT}}(\_kern\_geom\_journal\_cache, OID\_AUTO, divisor, CTLFLAG\_RDTUN,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00170}00170     \&\mbox{\hyperlink{g__journal_8c_a04e9fe8729a1d236111d14806cb396dd}{g\_journal\_cache\_divisor}}, 0,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00171}00171     \textcolor{stringliteral}{"{}(kmem\_size / kern.geom.journal.cache.divisor) == cache size"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00172}00172 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00173}\mbox{\hyperlink{g__journal_8c_aceff713f6fc0c01ba9b43555e28d1c14}{00173}} \mbox{\hyperlink{g__journal_8c_aceff713f6fc0c01ba9b43555e28d1c14}{g\_journal\_cache\_switch\_sysctl}}(SYSCTL\_HANDLER\_ARGS)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00174}00174 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00175}00175         u\_int cswitch;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00176}00176         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00177}00177 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00178}00178         cswitch = \mbox{\hyperlink{g__journal_8c_a5e2abb952038df01030c62c17ad96363}{g\_journal\_cache\_switch}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00179}00179         error = sysctl\_handle\_int(oidp, \&cswitch, 0, \mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00180}00180         \textcolor{keywordflow}{if} (error != 0 || \mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}-\/>newptr == NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00181}00181                 \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00182}00182         \textcolor{keywordflow}{if} (cswitch > 100)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00183}00183                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00184}00184         \mbox{\hyperlink{g__journal_8c_a5e2abb952038df01030c62c17ad96363}{g\_journal\_cache\_switch}} = cswitch;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00185}00185         \mbox{\hyperlink{g__journal_8c_a60bf13b7044e9e9fec39ce68b5daf4a6}{g\_journal\_cache\_low}} = (\mbox{\hyperlink{g__journal_8c_a4c9e6c2c63842d88b28737ecd982124c}{g\_journal\_cache\_limit}} / 100) * cswitch;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00186}00186         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00187}00187 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00188}\mbox{\hyperlink{g__journal_8c_af7db281445c7c69250b111e938fd71f2}{00188}} \mbox{\hyperlink{g__journal_8c_afd2751fa62eb017fb48540ad2382276f}{SYSCTL\_PROC}}(\_kern\_geom\_journal\_cache, OID\_AUTO, \textcolor{keywordflow}{switch},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00189}00189     CTLTYPE\_UINT | CTLFLAG\_RW | CTLFLAG\_MPSAFE, NULL, 0,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00190}00190     \mbox{\hyperlink{g__journal_8c_aceff713f6fc0c01ba9b43555e28d1c14}{g\_journal\_cache\_switch\_sysctl}}, \textcolor{stringliteral}{"{}I"{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00191}00191     \textcolor{stringliteral}{"{}Force switch when we hit this percent of cache use"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00192}\mbox{\hyperlink{g__journal_8c_a7a8b32ebc1770d51edfbe25a8f931365}{00192}} \mbox{\hyperlink{g__journal_8c_a13e5082e7b85d55cac921b86c485b835}{SYSCTL\_UINT}}(\_kern\_geom\_journal\_cache, OID\_AUTO, misses, CTLFLAG\_RW,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00193}00193     \&\mbox{\hyperlink{g__journal_8c_ace41ab0e6b1a3d13a7bcb4f10cf3eb6f}{g\_journal\_cache\_misses}}, 0, \textcolor{stringliteral}{"{}Number of cache misses"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00194}\mbox{\hyperlink{g__journal_8c_aa09bc9d7bab08f10af860f3f3585f61c}{00194}} \mbox{\hyperlink{g__journal_8c_a13e5082e7b85d55cac921b86c485b835}{SYSCTL\_UINT}}(\_kern\_geom\_journal\_cache, OID\_AUTO, alloc\_failures, CTLFLAG\_RW,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00195}00195     \&\mbox{\hyperlink{g__journal_8c_ae81c4266f5705c7f85fc0c9bdbcae0a5}{g\_journal\_cache\_alloc\_failures}}, 0, \textcolor{stringliteral}{"{}Memory allocation failures"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00196}00196 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00197}\mbox{\hyperlink{g__journal_8c_ada2907e2c7243a6211a5d7452728fc7b}{00197}} \textcolor{keyword}{static} u\_long \mbox{\hyperlink{g__journal_8c_ada2907e2c7243a6211a5d7452728fc7b}{g\_journal\_stats\_bytes\_skipped}} = 0;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00198}\mbox{\hyperlink{g__journal_8c_a29be1ba35218f7075a0bf54f04e6ce6d}{00198}} \textcolor{keyword}{static} u\_long \mbox{\hyperlink{g__journal_8c_a29be1ba35218f7075a0bf54f04e6ce6d}{g\_journal\_stats\_combined\_ios}} = 0;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00199}\mbox{\hyperlink{g__journal_8c_a44a5ef0d5e2d6149aa7d4ed10566e375}{00199}} \textcolor{keyword}{static} u\_long \mbox{\hyperlink{g__journal_8c_a44a5ef0d5e2d6149aa7d4ed10566e375}{g\_journal\_stats\_switches}} = 0;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00200}\mbox{\hyperlink{g__journal_8c_aef3302cfe07ec834c799b305519d07c0}{00200}} \textcolor{keyword}{static} u\_long \mbox{\hyperlink{g__journal_8c_aef3302cfe07ec834c799b305519d07c0}{g\_journal\_stats\_wait\_for\_copy}} = 0;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00201}\mbox{\hyperlink{g__journal_8c_a19b2a99eab794a4cd79adcee53e036d3}{00201}} \textcolor{keyword}{static} u\_long \mbox{\hyperlink{g__journal_8c_a19b2a99eab794a4cd79adcee53e036d3}{g\_journal\_stats\_journal\_full}} = 0;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00202}\mbox{\hyperlink{g__journal_8c_ac0680b72d63b7ffac2661553bc214354}{00202}} \textcolor{keyword}{static} u\_long \mbox{\hyperlink{g__journal_8c_ac0680b72d63b7ffac2661553bc214354}{g\_journal\_stats\_low\_mem}} = 0;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00203}00203 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00204}\mbox{\hyperlink{g__journal_8c_aa301f4cc5551a1831678ea516726b3e4}{00204}} \textcolor{keyword}{static} \mbox{\hyperlink{g__journal_8c_ad90270fc502096e39f677122227c95b6}{SYSCTL\_NODE}}(\_kern\_geom\_journal, OID\_AUTO, stats,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00205}00205     CTLFLAG\_RW | CTLFLAG\_MPSAFE, 0,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00206}00206     \textcolor{stringliteral}{"{}GEOM\_JOURNAL statistics"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00207}\mbox{\hyperlink{g__journal_8c_af435f748dd2705b94a93809421fcc469}{00207}} \mbox{\hyperlink{g__journal_8c_a5a520d3540c4ab8ed2e2083aa1fb7923}{SYSCTL\_ULONG}}(\_kern\_geom\_journal\_stats, OID\_AUTO, skipped\_bytes, CTLFLAG\_RW,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00208}00208     \&\mbox{\hyperlink{g__journal_8c_ada2907e2c7243a6211a5d7452728fc7b}{g\_journal\_stats\_bytes\_skipped}}, 0, \textcolor{stringliteral}{"{}Number of skipped bytes"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00209}\mbox{\hyperlink{g__journal_8c_a9eb3fc2268ff8da90395058d21d617b8}{00209}} \mbox{\hyperlink{g__journal_8c_a5a520d3540c4ab8ed2e2083aa1fb7923}{SYSCTL\_ULONG}}(\_kern\_geom\_journal\_stats, OID\_AUTO, combined\_ios, CTLFLAG\_RW,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00210}00210     \&\mbox{\hyperlink{g__journal_8c_a29be1ba35218f7075a0bf54f04e6ce6d}{g\_journal\_stats\_combined\_ios}}, 0, \textcolor{stringliteral}{"{}Number of combined I/O requests"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00211}\mbox{\hyperlink{g__journal_8c_a50ad8db2e50822613edd6a5a2388b66c}{00211}} \mbox{\hyperlink{g__journal_8c_a5a520d3540c4ab8ed2e2083aa1fb7923}{SYSCTL\_ULONG}}(\_kern\_geom\_journal\_stats, OID\_AUTO, switches, CTLFLAG\_RW,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00212}00212     \&\mbox{\hyperlink{g__journal_8c_a44a5ef0d5e2d6149aa7d4ed10566e375}{g\_journal\_stats\_switches}}, 0, \textcolor{stringliteral}{"{}Number of journal switches"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00213}\mbox{\hyperlink{g__journal_8c_a36694f67623cc328760a34dfb48aed3a}{00213}} \mbox{\hyperlink{g__journal_8c_a5a520d3540c4ab8ed2e2083aa1fb7923}{SYSCTL\_ULONG}}(\_kern\_geom\_journal\_stats, OID\_AUTO, wait\_for\_copy, CTLFLAG\_RW,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00214}00214     \&\mbox{\hyperlink{g__journal_8c_aef3302cfe07ec834c799b305519d07c0}{g\_journal\_stats\_wait\_for\_copy}}, 0, \textcolor{stringliteral}{"{}Wait for journal copy on switch"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00215}\mbox{\hyperlink{g__journal_8c_a7a7611dfa5f8bd72b9994f4f4023ed2f}{00215}} \mbox{\hyperlink{g__journal_8c_a5a520d3540c4ab8ed2e2083aa1fb7923}{SYSCTL\_ULONG}}(\_kern\_geom\_journal\_stats, OID\_AUTO, journal\_full, CTLFLAG\_RW,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00216}00216     \&\mbox{\hyperlink{g__journal_8c_a19b2a99eab794a4cd79adcee53e036d3}{g\_journal\_stats\_journal\_full}}, 0,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00217}00217     \textcolor{stringliteral}{"{}Number of times journal was almost full."{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00218}\mbox{\hyperlink{g__journal_8c_a5c31469fed3fffea484d275a72f2a0b1}{00218}} \mbox{\hyperlink{g__journal_8c_a5a520d3540c4ab8ed2e2083aa1fb7923}{SYSCTL\_ULONG}}(\_kern\_geom\_journal\_stats, OID\_AUTO, low\_mem, CTLFLAG\_RW,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00219}00219     \&\mbox{\hyperlink{g__journal_8c_ac0680b72d63b7ffac2661553bc214354}{g\_journal\_stats\_low\_mem}}, 0, \textcolor{stringliteral}{"{}Number of times low\_mem hook was called."{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00220}00220 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00221}\mbox{\hyperlink{g__journal_8c_a58b4f02835077851253b94a084862e35}{00221}} \textcolor{keyword}{static} \mbox{\hyperlink{geom_8h_a631656592e7bd0d9b508904254e8e7a7}{g\_taste\_t}} \mbox{\hyperlink{g__journal_8c_a58b4f02835077851253b94a084862e35}{g\_journal\_taste}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00222}\mbox{\hyperlink{g__journal_8c_ae990d3367d54b59c9fee9b262d76d681}{00222}} \textcolor{keyword}{static} \mbox{\hyperlink{geom_8h_a98129532a3f4d0845714f8b272b9da8a}{g\_ctl\_req\_t}} \mbox{\hyperlink{g__journal_8c_ae990d3367d54b59c9fee9b262d76d681}{g\_journal\_config}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00223}\mbox{\hyperlink{g__journal_8c_a30d62d002bc5bda5ca47fea3a587e1aa}{00223}} \textcolor{keyword}{static} \mbox{\hyperlink{geom_8h_afdb390a9279523d96cb700a712939f76}{g\_dumpconf\_t}} \mbox{\hyperlink{g__journal_8c_a30d62d002bc5bda5ca47fea3a587e1aa}{g\_journal\_dumpconf}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00224}\mbox{\hyperlink{g__journal_8c_ab5eea3e43e99bd1a9dadf8ffaa6b70e2}{00224}} \textcolor{keyword}{static} \mbox{\hyperlink{geom_8h_a09dc421fa3e0bcccdf6ba9154976971d}{g\_init\_t}} \mbox{\hyperlink{g__journal_8c_ab5eea3e43e99bd1a9dadf8ffaa6b70e2}{g\_journal\_init}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00225}\mbox{\hyperlink{g__journal_8c_a7a0285e1881caddb3d84356a867cdf6a}{00225}} \textcolor{keyword}{static} \mbox{\hyperlink{geom_8h_a68776dca1cdc8d9d0da8c47635295b51}{g\_fini\_t}} \mbox{\hyperlink{g__journal_8c_a7a0285e1881caddb3d84356a867cdf6a}{g\_journal\_fini}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00226}00226 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00227}\mbox{\hyperlink{g__journal_8c_a2b8ebec7149958e55f7cea21a7a174db}{00227}} \textcolor{keyword}{struct }\mbox{\hyperlink{structg__class}{g\_class}} \mbox{\hyperlink{g__journal_8c_a2b8ebec7149958e55f7cea21a7a174db}{g\_journal\_class}} = \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00228}00228         .\mbox{\hyperlink{structg__class_a66bf8381cf0afbf7ccdebfa6b90a4a96}{name}} = \mbox{\hyperlink{g__journal_8h_a6fe1d782856718979775131157fc90b6}{G\_JOURNAL\_CLASS\_NAME}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00229}00229         .version = \mbox{\hyperlink{geom_8h_a33025dbc893de9dc049ba2f30283bc5a}{G\_VERSION}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00230}00230         .taste = \mbox{\hyperlink{g__journal_8c_a58b4f02835077851253b94a084862e35}{g\_journal\_taste}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00231}00231         .ctlreq = \mbox{\hyperlink{g__journal_8c_ae990d3367d54b59c9fee9b262d76d681}{g\_journal\_config}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00232}00232         .dumpconf = \mbox{\hyperlink{g__journal_8c_a30d62d002bc5bda5ca47fea3a587e1aa}{g\_journal\_dumpconf}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00233}00233         .init = \mbox{\hyperlink{g__journal_8c_ab5eea3e43e99bd1a9dadf8ffaa6b70e2}{g\_journal\_init}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00234}00234         .fini = \mbox{\hyperlink{g__journal_8c_a7a0285e1881caddb3d84356a867cdf6a}{g\_journal\_fini}}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00235}00235 \};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00236}00236 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00237}00237 \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{g__journal_8c_aa4185d491be0d4398d14c324ea2e4e4f}{g\_journal\_destroy}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00238}00238 \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{g__journal_8c_aa252660794ce8d1afa9d82076c594395}{g\_journal\_metadata\_update}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00239}00239 \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{g__journal_8c_a605bac3f6157a873d00e174b53047ebf}{g\_journal\_start\_switcher}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__class}{g\_class}} *\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00240}00240 \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{g__journal_8c_ab7fd0045f922df36ad55f01329cf0569}{g\_journal\_stop\_switcher}}(\textcolor{keywordtype}{void});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00241}00241 \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{g__journal_8c_a38ee47ffa1860553d6d8357d2a180934}{g\_journal\_switch\_wait}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00242}00242 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00243}\mbox{\hyperlink{g__journal_8c_a88781934934467095a5bba6be7b7adf0}{00243}} \textcolor{preprocessor}{\#define GJ\_SWITCHER\_WORKING     0}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00244}\mbox{\hyperlink{g__journal_8c_a239a65c86ffaa6af7539fde2eda58738}{00244}} \textcolor{preprocessor}{\#define GJ\_SWITCHER\_DIE         1}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00245}\mbox{\hyperlink{g__journal_8c_a36b37793e3fefb3274a852c81204c5b7}{00245}} \textcolor{preprocessor}{\#define GJ\_SWITCHER\_DIED        2}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00246}\mbox{\hyperlink{g__journal_8c_a6d8764e06e60b7dbdb9961c44ce6accd}{00246}} \textcolor{keyword}{static} \textcolor{keyword}{struct }proc *\mbox{\hyperlink{g__journal_8c_a6d8764e06e60b7dbdb9961c44ce6accd}{g\_journal\_switcher\_proc}} = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00247}\mbox{\hyperlink{g__journal_8c_a060a89b3e3b1bb106740fc923ea2ce72}{00247}} \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{g__journal_8c_a060a89b3e3b1bb106740fc923ea2ce72}{g\_journal\_switcher\_state}} = \mbox{\hyperlink{g__journal_8c_a88781934934467095a5bba6be7b7adf0}{GJ\_SWITCHER\_WORKING}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00248}\mbox{\hyperlink{g__journal_8c_abf0fc1105288d76e52bd447ed35fdb7e}{00248}} \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{g__journal_8c_abf0fc1105288d76e52bd447ed35fdb7e}{g\_journal\_switcher\_wokenup}} = 0;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00249}\mbox{\hyperlink{g__journal_8c_ad0cc7565ac6110d18f2b094ae9e7306f}{00249}} \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{g__journal_8c_ad0cc7565ac6110d18f2b094ae9e7306f}{g\_journal\_sync\_requested}} = 0;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00250}00250 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00251}00251 \textcolor{preprocessor}{\#ifdef GJ\_MEMDEBUG}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00252}00252 \textcolor{keyword}{struct }meminfo \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00253}00253         \textcolor{keywordtype}{size\_t}          mi\_size;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00254}00254         \textcolor{keyword}{struct }stack    mi\_stack;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00255}00255 \};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00256}00256 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00257}00257 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00258}00258 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00259}00259 \textcolor{comment}{ * We use our own malloc/realloc/free functions, so we can collect statistics}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00260}00260 \textcolor{comment}{ * and force journal switch when we're running out of cache.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00261}00261 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00262}00262 \textcolor{keyword}{static} \textcolor{keywordtype}{void} *}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00263}\mbox{\hyperlink{g__journal_8c_a436fa0646e225c7450514c563fe9d6df}{00263}} \mbox{\hyperlink{g__journal_8c_a436fa0646e225c7450514c563fe9d6df}{gj\_malloc}}(\textcolor{keywordtype}{size\_t} size, \textcolor{keywordtype}{int} flags)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00264}00264 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00265}00265         \textcolor{keywordtype}{void} *p;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00266}00266 \textcolor{preprocessor}{\#ifdef GJ\_MEMDEBUG}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00267}00267         \textcolor{keyword}{struct }meminfo *mi;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00268}00268 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00269}00269 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00270}00270         mtx\_lock(\&\mbox{\hyperlink{g__journal_8c_aa8f071ef77cd0e62f3ae5d479b2d77cb}{g\_journal\_cache\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00271}00271         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__journal_8c_a4c9e6c2c63842d88b28737ecd982124c}{g\_journal\_cache\_limit}} > 0 \&\& !\mbox{\hyperlink{g__journal_8c_abf0fc1105288d76e52bd447ed35fdb7e}{g\_journal\_switcher\_wokenup}} \&\&}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00272}00272             \mbox{\hyperlink{g__journal_8c_ad7c6bd3b76460d8f60e09f51c9f8f9bb}{g\_journal\_cache\_used}} + size > \mbox{\hyperlink{g__journal_8c_a60bf13b7044e9e9fec39ce68b5daf4a6}{g\_journal\_cache\_low}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00273}00273                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(1, \textcolor{stringliteral}{"{}No cache, waking up the switcher."{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00274}00274                 \mbox{\hyperlink{g__journal_8c_abf0fc1105288d76e52bd447ed35fdb7e}{g\_journal\_switcher\_wokenup}} = 1;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00275}00275                 wakeup(\&\mbox{\hyperlink{g__journal_8c_a060a89b3e3b1bb106740fc923ea2ce72}{g\_journal\_switcher\_state}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00276}00276         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00277}00277         \textcolor{keywordflow}{if} ((flags \& M\_NOWAIT) \&\& \mbox{\hyperlink{g__journal_8c_a4c9e6c2c63842d88b28737ecd982124c}{g\_journal\_cache\_limit}} > 0 \&\&}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00278}00278             \mbox{\hyperlink{g__journal_8c_ad7c6bd3b76460d8f60e09f51c9f8f9bb}{g\_journal\_cache\_used}} + size > \mbox{\hyperlink{g__journal_8c_a4c9e6c2c63842d88b28737ecd982124c}{g\_journal\_cache\_limit}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00279}00279                 mtx\_unlock(\&\mbox{\hyperlink{g__journal_8c_aa8f071ef77cd0e62f3ae5d479b2d77cb}{g\_journal\_cache\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00280}00280                 \mbox{\hyperlink{g__journal_8c_ae81c4266f5705c7f85fc0c9bdbcae0a5}{g\_journal\_cache\_alloc\_failures}}++;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00281}00281                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00282}00282         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00283}00283         \mbox{\hyperlink{g__journal_8c_ad7c6bd3b76460d8f60e09f51c9f8f9bb}{g\_journal\_cache\_used}} += size;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00284}00284         mtx\_unlock(\&\mbox{\hyperlink{g__journal_8c_aa8f071ef77cd0e62f3ae5d479b2d77cb}{g\_journal\_cache\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00285}00285         flags \&= \string~M\_NOWAIT;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00286}00286 \textcolor{preprocessor}{\#ifndef GJ\_MEMDEBUG}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00287}00287         p = malloc(size, M\_JOURNAL, flags | M\_WAITOK);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00288}00288 \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00289}00289         mi = malloc(\textcolor{keyword}{sizeof}(*mi) + size, M\_JOURNAL, flags | M\_WAITOK);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00290}00290         p = (u\_char *)mi + \textcolor{keyword}{sizeof}(*mi);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00291}00291         mi-\/>mi\_size = size;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00292}00292         stack\_save(\&mi-\/>mi\_stack);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00293}00293 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00294}00294         \textcolor{keywordflow}{return} (p);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00295}00295 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00296}00296 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00297}00297 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00298}\mbox{\hyperlink{g__journal_8c_af5af205b6121b79aa01357503d8b28bc}{00298}} \mbox{\hyperlink{g__journal_8c_af5af205b6121b79aa01357503d8b28bc}{gj\_free}}(\textcolor{keywordtype}{void} *p, \textcolor{keywordtype}{size\_t} size)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00299}00299 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00300}00300 \textcolor{preprocessor}{\#ifdef GJ\_MEMDEBUG}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00301}00301         \textcolor{keyword}{struct }meminfo *mi;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00302}00302 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00303}00303 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00304}00304         KASSERT(p != NULL, (\textcolor{stringliteral}{"{}p=NULL"{}}));}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00305}00305         KASSERT(size > 0, (\textcolor{stringliteral}{"{}size=0"{}}));}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00306}00306         mtx\_lock(\&\mbox{\hyperlink{g__journal_8c_aa8f071ef77cd0e62f3ae5d479b2d77cb}{g\_journal\_cache\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00307}00307         KASSERT(\mbox{\hyperlink{g__journal_8c_ad7c6bd3b76460d8f60e09f51c9f8f9bb}{g\_journal\_cache\_used}} >= size, (\textcolor{stringliteral}{"{}Freeing too much?"{}}));}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00308}00308         \mbox{\hyperlink{g__journal_8c_ad7c6bd3b76460d8f60e09f51c9f8f9bb}{g\_journal\_cache\_used}} -\/= size;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00309}00309         mtx\_unlock(\&\mbox{\hyperlink{g__journal_8c_aa8f071ef77cd0e62f3ae5d479b2d77cb}{g\_journal\_cache\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00310}00310 \textcolor{preprocessor}{\#ifdef GJ\_MEMDEBUG}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00311}00311         mi = p = (\textcolor{keywordtype}{void} *)((u\_char *)p -\/ \textcolor{keyword}{sizeof}(*mi));}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00312}00312         \textcolor{keywordflow}{if} (mi-\/>mi\_size != size) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00313}00313                 printf(\textcolor{stringliteral}{"{}GJOURNAL: Size mismatch! \%zu != \%zu\(\backslash\)n"{}}, size,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00314}00314                     mi-\/>mi\_size);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00315}00315                 printf(\textcolor{stringliteral}{"{}GJOURNAL: Alloc backtrace:\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00316}00316                 stack\_print(\&mi-\/>mi\_stack);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00317}00317                 printf(\textcolor{stringliteral}{"{}GJOURNAL: Free backtrace:\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00318}00318                 kdb\_backtrace();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00319}00319         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00320}00320 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00321}00321         \mbox{\hyperlink{g__raid__md__if_8m_a4df9edb2717b3f7e4c3c903878577a54}{free}}(p, M\_JOURNAL);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00322}00322 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00323}00323 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00324}00324 \textcolor{keyword}{static} \textcolor{keywordtype}{void} *}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00325}\mbox{\hyperlink{g__journal_8c_a342f910bd4848593b91aa851dcf46e01}{00325}} \mbox{\hyperlink{g__journal_8c_a342f910bd4848593b91aa851dcf46e01}{gj\_realloc}}(\textcolor{keywordtype}{void} *p, \textcolor{keywordtype}{size\_t} size, \textcolor{keywordtype}{size\_t} oldsize)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00326}00326 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00327}00327         \textcolor{keywordtype}{void} *np;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00328}00328 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00329}00329 \textcolor{preprocessor}{\#ifndef GJ\_MEMDEBUG}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00330}00330         mtx\_lock(\&\mbox{\hyperlink{g__journal_8c_aa8f071ef77cd0e62f3ae5d479b2d77cb}{g\_journal\_cache\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00331}00331         \mbox{\hyperlink{g__journal_8c_ad7c6bd3b76460d8f60e09f51c9f8f9bb}{g\_journal\_cache\_used}} -\/= oldsize;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00332}00332         \mbox{\hyperlink{g__journal_8c_ad7c6bd3b76460d8f60e09f51c9f8f9bb}{g\_journal\_cache\_used}} += size;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00333}00333         mtx\_unlock(\&\mbox{\hyperlink{g__journal_8c_aa8f071ef77cd0e62f3ae5d479b2d77cb}{g\_journal\_cache\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00334}00334         np = realloc(p, size, M\_JOURNAL, M\_WAITOK);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00335}00335 \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00336}00336         np = \mbox{\hyperlink{g__journal_8c_a436fa0646e225c7450514c563fe9d6df}{gj\_malloc}}(size, M\_WAITOK);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00337}00337         bcopy(p, np, MIN(oldsize, size));}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00338}00338         \mbox{\hyperlink{g__journal_8c_af5af205b6121b79aa01357503d8b28bc}{gj\_free}}(p, oldsize);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00339}00339 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00340}00340         \textcolor{keywordflow}{return} (np);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00341}00341 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00342}00342 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00343}00343 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00344}\mbox{\hyperlink{g__journal_8c_a84937c4d5addad75d169a2041c97d1b1}{00344}} \mbox{\hyperlink{g__journal_8c_a84937c4d5addad75d169a2041c97d1b1}{g\_journal\_check\_overflow}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00345}00345 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00346}00346         off\_t \mbox{\hyperlink{g__raid__tr__if_8m_ae809d5359ac030c60a30a8f0b2294b82}{length}}, used;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00347}00347 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00348}00348         \textcolor{keywordflow}{if} ((sc-\/>\mbox{\hyperlink{structg__journal__softc_a869b0f971a3b94af08789ac382471913}{sc\_active}}.\mbox{\hyperlink{structg__journal__journal_a5e167f84f14cc6b96032a8808adbf000}{jj\_offset}} < sc-\/>\mbox{\hyperlink{structg__journal__softc_a9ed37f4f4b73662640e4dcbeb0f6083f}{sc\_inactive}}.\mbox{\hyperlink{structg__journal__journal_a5e167f84f14cc6b96032a8808adbf000}{jj\_offset}} \&\&}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00349}00349              sc-\/>\mbox{\hyperlink{structg__journal__softc_aaf90f8a9abf8bb358b209fbc1d2b266d}{sc\_journal\_offset}} >= sc-\/>\mbox{\hyperlink{structg__journal__softc_a9ed37f4f4b73662640e4dcbeb0f6083f}{sc\_inactive}}.\mbox{\hyperlink{structg__journal__journal_a5e167f84f14cc6b96032a8808adbf000}{jj\_offset}}) ||}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00350}00350             (sc-\/>\mbox{\hyperlink{structg__journal__softc_a869b0f971a3b94af08789ac382471913}{sc\_active}}.\mbox{\hyperlink{structg__journal__journal_a5e167f84f14cc6b96032a8808adbf000}{jj\_offset}} > sc-\/>\mbox{\hyperlink{structg__journal__softc_a9ed37f4f4b73662640e4dcbeb0f6083f}{sc\_inactive}}.\mbox{\hyperlink{structg__journal__journal_a5e167f84f14cc6b96032a8808adbf000}{jj\_offset}} \&\&}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00351}00351              sc-\/>\mbox{\hyperlink{structg__journal__softc_aaf90f8a9abf8bb358b209fbc1d2b266d}{sc\_journal\_offset}} >= sc-\/>\mbox{\hyperlink{structg__journal__softc_a9ed37f4f4b73662640e4dcbeb0f6083f}{sc\_inactive}}.\mbox{\hyperlink{structg__journal__journal_a5e167f84f14cc6b96032a8808adbf000}{jj\_offset}} \&\&}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00352}00352              sc-\/>\mbox{\hyperlink{structg__journal__softc_aaf90f8a9abf8bb358b209fbc1d2b266d}{sc\_journal\_offset}} < sc-\/>\mbox{\hyperlink{structg__journal__softc_a869b0f971a3b94af08789ac382471913}{sc\_active}}.\mbox{\hyperlink{structg__journal__journal_a5e167f84f14cc6b96032a8808adbf000}{jj\_offset}})) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00353}00353                 panic(\textcolor{stringliteral}{"{}Journal overflow "{}}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00354}00354                     \textcolor{stringliteral}{"{}(id = \%u joffset=\%jd active=\%jd inactive=\%jd)"{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00355}00355                     (\textcolor{keywordtype}{unsigned})sc-\/>\mbox{\hyperlink{structg__journal__softc_ad4d04ff053d5c7f2bdbb0237afccdb25}{sc\_id}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00356}00356                     (intmax\_t)sc-\/>\mbox{\hyperlink{structg__journal__softc_aaf90f8a9abf8bb358b209fbc1d2b266d}{sc\_journal\_offset}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00357}00357                     (intmax\_t)sc-\/>\mbox{\hyperlink{structg__journal__softc_a869b0f971a3b94af08789ac382471913}{sc\_active}}.\mbox{\hyperlink{structg__journal__journal_a5e167f84f14cc6b96032a8808adbf000}{jj\_offset}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00358}00358                     (intmax\_t)sc-\/>\mbox{\hyperlink{structg__journal__softc_a9ed37f4f4b73662640e4dcbeb0f6083f}{sc\_inactive}}.\mbox{\hyperlink{structg__journal__journal_a5e167f84f14cc6b96032a8808adbf000}{jj\_offset}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00359}00359         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00360}00360         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_a869b0f971a3b94af08789ac382471913}{sc\_active}}.\mbox{\hyperlink{structg__journal__journal_a5e167f84f14cc6b96032a8808adbf000}{jj\_offset}} < sc-\/>\mbox{\hyperlink{structg__journal__softc_a9ed37f4f4b73662640e4dcbeb0f6083f}{sc\_inactive}}.\mbox{\hyperlink{structg__journal__journal_a5e167f84f14cc6b96032a8808adbf000}{jj\_offset}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00361}00361                 \mbox{\hyperlink{g__raid__tr__if_8m_ae809d5359ac030c60a30a8f0b2294b82}{length}} = sc-\/>\mbox{\hyperlink{structg__journal__softc_a9ed37f4f4b73662640e4dcbeb0f6083f}{sc\_inactive}}.\mbox{\hyperlink{structg__journal__journal_a5e167f84f14cc6b96032a8808adbf000}{jj\_offset}} -\/ sc-\/>\mbox{\hyperlink{structg__journal__softc_a869b0f971a3b94af08789ac382471913}{sc\_active}}.\mbox{\hyperlink{structg__journal__journal_a5e167f84f14cc6b96032a8808adbf000}{jj\_offset}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00362}00362                 used = sc-\/>\mbox{\hyperlink{structg__journal__softc_aaf90f8a9abf8bb358b209fbc1d2b266d}{sc\_journal\_offset}} -\/ sc-\/>\mbox{\hyperlink{structg__journal__softc_a869b0f971a3b94af08789ac382471913}{sc\_active}}.\mbox{\hyperlink{structg__journal__journal_a5e167f84f14cc6b96032a8808adbf000}{jj\_offset}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00363}00363         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00364}00364                 \mbox{\hyperlink{g__raid__tr__if_8m_ae809d5359ac030c60a30a8f0b2294b82}{length}} = sc-\/>\mbox{\hyperlink{structg__journal__softc_a4ed217d1be380b3a2282f9bf1a0906bd}{sc\_jend}} -\/ sc-\/>\mbox{\hyperlink{structg__journal__softc_a869b0f971a3b94af08789ac382471913}{sc\_active}}.\mbox{\hyperlink{structg__journal__journal_a5e167f84f14cc6b96032a8808adbf000}{jj\_offset}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00365}00365                 \mbox{\hyperlink{g__raid__tr__if_8m_ae809d5359ac030c60a30a8f0b2294b82}{length}} += sc-\/>\mbox{\hyperlink{structg__journal__softc_a9ed37f4f4b73662640e4dcbeb0f6083f}{sc\_inactive}}.\mbox{\hyperlink{structg__journal__journal_a5e167f84f14cc6b96032a8808adbf000}{jj\_offset}} -\/ sc-\/>\mbox{\hyperlink{structg__journal__softc_a89bc44b8276a4b18afb4ea756b86f76a}{sc\_jstart}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00366}00366                 \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_aaf90f8a9abf8bb358b209fbc1d2b266d}{sc\_journal\_offset}} >= sc-\/>\mbox{\hyperlink{structg__journal__softc_a869b0f971a3b94af08789ac382471913}{sc\_active}}.\mbox{\hyperlink{structg__journal__journal_a5e167f84f14cc6b96032a8808adbf000}{jj\_offset}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00367}00367                         used = sc-\/>\mbox{\hyperlink{structg__journal__softc_aaf90f8a9abf8bb358b209fbc1d2b266d}{sc\_journal\_offset}} -\/ sc-\/>\mbox{\hyperlink{structg__journal__softc_a869b0f971a3b94af08789ac382471913}{sc\_active}}.\mbox{\hyperlink{structg__journal__journal_a5e167f84f14cc6b96032a8808adbf000}{jj\_offset}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00368}00368                 \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00369}00369                         used = sc-\/>\mbox{\hyperlink{structg__journal__softc_a4ed217d1be380b3a2282f9bf1a0906bd}{sc\_jend}} -\/ sc-\/>\mbox{\hyperlink{structg__journal__softc_a869b0f971a3b94af08789ac382471913}{sc\_active}}.\mbox{\hyperlink{structg__journal__journal_a5e167f84f14cc6b96032a8808adbf000}{jj\_offset}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00370}00370                         used += sc-\/>\mbox{\hyperlink{structg__journal__softc_aaf90f8a9abf8bb358b209fbc1d2b266d}{sc\_journal\_offset}} -\/ sc-\/>\mbox{\hyperlink{structg__journal__softc_a89bc44b8276a4b18afb4ea756b86f76a}{sc\_jstart}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00371}00371                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00372}00372         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00373}00373         \textcolor{comment}{/* Already woken up? */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00374}00374         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__journal_8c_abf0fc1105288d76e52bd447ed35fdb7e}{g\_journal\_switcher\_wokenup}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00375}00375                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00376}00376         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00377}00377 \textcolor{comment}{         * If the active journal takes more than g\_journal\_force\_switch precent}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00378}00378 \textcolor{comment}{         * of free journal space, we force journal switch.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00379}00379 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00380}00380         KASSERT(\mbox{\hyperlink{g__raid__tr__if_8m_ae809d5359ac030c60a30a8f0b2294b82}{length}} > 0,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00381}00381             (\textcolor{stringliteral}{"{}length=\%jd used=\%jd active=\%jd inactive=\%jd joffset=\%jd"{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00382}00382             (intmax\_t)\mbox{\hyperlink{g__raid__tr__if_8m_ae809d5359ac030c60a30a8f0b2294b82}{length}}, (intmax\_t)used,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00383}00383             (intmax\_t)sc-\/>\mbox{\hyperlink{structg__journal__softc_a869b0f971a3b94af08789ac382471913}{sc\_active}}.\mbox{\hyperlink{structg__journal__journal_a5e167f84f14cc6b96032a8808adbf000}{jj\_offset}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00384}00384             (intmax\_t)sc-\/>\mbox{\hyperlink{structg__journal__softc_a9ed37f4f4b73662640e4dcbeb0f6083f}{sc\_inactive}}.\mbox{\hyperlink{structg__journal__journal_a5e167f84f14cc6b96032a8808adbf000}{jj\_offset}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00385}00385             (intmax\_t)sc-\/>\mbox{\hyperlink{structg__journal__softc_aaf90f8a9abf8bb358b209fbc1d2b266d}{sc\_journal\_offset}}));}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00386}00386         \textcolor{keywordflow}{if} ((used * 100) / \mbox{\hyperlink{g__raid__tr__if_8m_ae809d5359ac030c60a30a8f0b2294b82}{length}} > \mbox{\hyperlink{g__journal_8c_adc9d20c11d4818b8206659feb8c120e4}{g\_journal\_force\_switch}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00387}00387                 \mbox{\hyperlink{g__journal_8c_a19b2a99eab794a4cd79adcee53e036d3}{g\_journal\_stats\_journal\_full}}++;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00388}00388                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(1, \textcolor{stringliteral}{"{}Journal \%s \%jd\%\% full, forcing journal switch."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00389}00389                     sc-\/>sc\_name, (used * 100) / \mbox{\hyperlink{g__raid__tr__if_8m_ae809d5359ac030c60a30a8f0b2294b82}{length}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00390}00390                 mtx\_lock(\&\mbox{\hyperlink{g__journal_8c_aa8f071ef77cd0e62f3ae5d479b2d77cb}{g\_journal\_cache\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00391}00391                 \mbox{\hyperlink{g__journal_8c_abf0fc1105288d76e52bd447ed35fdb7e}{g\_journal\_switcher\_wokenup}} = 1;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00392}00392                 wakeup(\&\mbox{\hyperlink{g__journal_8c_a060a89b3e3b1bb106740fc923ea2ce72}{g\_journal\_switcher\_state}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00393}00393                 mtx\_unlock(\&\mbox{\hyperlink{g__journal_8c_aa8f071ef77cd0e62f3ae5d479b2d77cb}{g\_journal\_cache\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00394}00394         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00395}00395 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00396}00396 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00397}00397 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00398}\mbox{\hyperlink{g__journal_8c_afe714d45f3038249bb3f76604ccc357b}{00398}} \mbox{\hyperlink{g__journal_8c_afe714d45f3038249bb3f76604ccc357b}{g\_journal\_orphan}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__consumer}{g\_consumer}} *\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00399}00399 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00400}00400         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00401}00401         \textcolor{keywordtype}{char} \mbox{\hyperlink{g__part__if_8m_aff5d3acc33944ecb11914d04ef06bb54}{name}}[256];}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00402}00402         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00403}00403 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00404}00404         \mbox{\hyperlink{geom_8h_a1898dc8c812faa5de231ab840e8562bf}{g\_topology\_assert}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00405}00405         sc = \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a75734fc8cd22ffc4209c36cc0a459cba}{geom}}-\/>\mbox{\hyperlink{structg__geom_aa83c08c83459420f6cbcfe64c6099466}{softc}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00406}00406         strlcpy(\mbox{\hyperlink{g__part__if_8m_aff5d3acc33944ecb11914d04ef06bb54}{name}}, \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}}, \textcolor{keyword}{sizeof}(\mbox{\hyperlink{g__part__if_8m_aff5d3acc33944ecb11914d04ef06bb54}{name}}));}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00407}00407         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(0, \textcolor{stringliteral}{"{}Lost provider \%s."{}}, \mbox{\hyperlink{g__part__if_8m_aff5d3acc33944ecb11914d04ef06bb54}{name}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00408}00408         \textcolor{keywordflow}{if} (sc == NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00409}00409                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00410}00410         error = \mbox{\hyperlink{g__journal_8c_aa4185d491be0d4398d14c324ea2e4e4f}{g\_journal\_destroy}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00411}00411         \textcolor{keywordflow}{if} (error == 0)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00412}00412                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(0, \textcolor{stringliteral}{"{}Journal \%s destroyed."{}}, \mbox{\hyperlink{g__part__if_8m_aff5d3acc33944ecb11914d04ef06bb54}{name}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00413}00413         \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00414}00414                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(0, \textcolor{stringliteral}{"{}Cannot destroy journal \%s (error=\%d). "{}}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00415}00415                     \textcolor{stringliteral}{"{}Destroy it manually after last close."{}}, sc-\/>sc\_name,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00416}00416                     error);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00417}00417         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00418}00418 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00419}00419 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00420}00420 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00421}\mbox{\hyperlink{g__journal_8c_a108b61ccebca01262da2f944431b54e0}{00421}} \mbox{\hyperlink{g__journal_8c_a108b61ccebca01262da2f944431b54e0}{g\_journal\_access}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__provider}{g\_provider}} *\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}, \textcolor{keywordtype}{int} acr, \textcolor{keywordtype}{int} acw, \textcolor{keywordtype}{int} ace)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00422}00422 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00423}00423         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00424}00424         \textcolor{keywordtype}{int} dcw;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00425}00425 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00426}00426         \mbox{\hyperlink{geom_8h_a1898dc8c812faa5de231ab840e8562bf}{g\_topology\_assert}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00427}00427         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(2, \textcolor{stringliteral}{"{}Access request for \%s: r\%dw\%de\%d."{}}, \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00428}00428             acr, acw, ace);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00429}00429 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00430}00430         dcw = \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_abc6824f999ce8b17107d833c908c83e6}{acw}} + acw;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00431}00431 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00432}00432         sc = \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_afe5c92b8a2a9e4cdf1cab6daa96923c1}{geom}}-\/>\mbox{\hyperlink{structg__geom_aa83c08c83459420f6cbcfe64c6099466}{softc}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00433}00433         \textcolor{keywordflow}{if} (sc == NULL || (sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} \& \mbox{\hyperlink{g__journal_8h_a097061ce64a6042ebdcd0e0ed18bf0f0}{GJF\_DEVICE\_DESTROY}})) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00434}00434                 \textcolor{keywordflow}{if} (acr <= 0 \&\& acw <= 0 \&\& ace <= 0)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00435}00435                         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00436}00436                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00437}00437                         \textcolor{keywordflow}{return} (ENXIO);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00438}00438         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00439}00439         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_abc6824f999ce8b17107d833c908c83e6}{acw}} == 0 \&\& dcw > 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00440}00440                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(1, \textcolor{stringliteral}{"{}Marking \%s as dirty."{}}, sc-\/>sc\_name);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00441}00441                 sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} \&= \string~GJF\_DEVICE\_CLEAN;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00442}00442                 \mbox{\hyperlink{geom_8h_a4628d4de49ba84e7a6126cc30d23b83a}{g\_topology\_unlock}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00443}00443                 \mbox{\hyperlink{g__journal_8c_aa252660794ce8d1afa9d82076c594395}{g\_journal\_metadata\_update}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00444}00444                 \mbox{\hyperlink{geom_8h_a232419d2cfa06ff3f4ff7551041aed31}{g\_topology\_lock}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00445}00445         \} \textcolor{comment}{/* else if (pp-\/>acw == 0 \&\& dcw > 0 \&\& JEMPTY(sc)) \{}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00446}00446 \textcolor{comment}{                GJ\_DEBUG(1, "{}Marking \%s as clean."{}, sc-\/>sc\_name);}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00447}00447 \textcolor{comment}{                sc-\/>sc\_flags |= GJF\_DEVICE\_CLEAN;}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00448}00448 \textcolor{comment}{                g\_topology\_unlock();}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00449}00449 \textcolor{comment}{                g\_journal\_metadata\_update(sc);}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00450}00450 \textcolor{comment}{                g\_topology\_lock();}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00451}00451 \textcolor{comment}{        \} */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00452}00452         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00453}00453 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00454}00454 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00455}00455 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00456}\mbox{\hyperlink{g__journal_8c_a9f2f9fa1fa1508c2962efdc116760843}{00456}} \mbox{\hyperlink{g__journal_8c_a9f2f9fa1fa1508c2962efdc116760843}{g\_journal\_header\_encode}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__journal__header}{g\_journal\_header}} *hdr, u\_char *\mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00457}00457 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00458}00458 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00459}00459         bcopy(\mbox{\hyperlink{g__journal_8h_a44da24de636b450ce7d914b44002deb3}{GJ\_HEADER\_MAGIC}}, \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}}, \textcolor{keyword}{sizeof}(\mbox{\hyperlink{g__journal_8h_a44da24de636b450ce7d914b44002deb3}{GJ\_HEADER\_MAGIC}}));}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00460}00460         \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}} += \textcolor{keyword}{sizeof}(\mbox{\hyperlink{g__journal_8h_a44da24de636b450ce7d914b44002deb3}{GJ\_HEADER\_MAGIC}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00461}00461         le32enc(\mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}}, hdr-\/>\mbox{\hyperlink{structg__journal__header_ac72aedf492c623d3e8ee92136f5ef034}{jh\_journal\_id}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00462}00462         \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}} += 4;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00463}00463         le32enc(\mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}}, hdr-\/>\mbox{\hyperlink{structg__journal__header_a22a9f2359e67e385b4858937af127ad9}{jh\_journal\_next\_id}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00464}00464 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00465}00465 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00466}00466 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00467}\mbox{\hyperlink{g__journal_8c_a8a4f7f8f76a1334e42c09837406be22d}{00467}} \mbox{\hyperlink{g__journal_8c_a8a4f7f8f76a1334e42c09837406be22d}{g\_journal\_header\_decode}}(\textcolor{keyword}{const} u\_char *\mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}}, \textcolor{keyword}{struct} \mbox{\hyperlink{structg__journal__header}{g\_journal\_header}} *hdr)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00468}00468 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00469}00469 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00470}00470         bcopy(\mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}}, hdr-\/>\mbox{\hyperlink{structg__journal__header_a06d123d45680ed0f490939994fe8fa93}{jh\_magic}}, \textcolor{keyword}{sizeof}(hdr-\/>\mbox{\hyperlink{structg__journal__header_a06d123d45680ed0f490939994fe8fa93}{jh\_magic}}));}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00471}00471         \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}} += \textcolor{keyword}{sizeof}(hdr-\/>\mbox{\hyperlink{structg__journal__header_a06d123d45680ed0f490939994fe8fa93}{jh\_magic}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00472}00472         \textcolor{keywordflow}{if} (bcmp(hdr-\/>\mbox{\hyperlink{structg__journal__header_a06d123d45680ed0f490939994fe8fa93}{jh\_magic}}, \mbox{\hyperlink{g__journal_8h_a44da24de636b450ce7d914b44002deb3}{GJ\_HEADER\_MAGIC}}, \textcolor{keyword}{sizeof}(\mbox{\hyperlink{g__journal_8h_a44da24de636b450ce7d914b44002deb3}{GJ\_HEADER\_MAGIC}})) != 0)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00473}00473                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00474}00474         hdr-\/>\mbox{\hyperlink{structg__journal__header_ac72aedf492c623d3e8ee92136f5ef034}{jh\_journal\_id}} = le32dec(\mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00475}00475         \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}} += 4;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00476}00476         hdr-\/>\mbox{\hyperlink{structg__journal__header_a22a9f2359e67e385b4858937af127ad9}{jh\_journal\_next\_id}} = le32dec(\mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00477}00477         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00478}00478 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00479}00479 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00480}00480 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00481}\mbox{\hyperlink{g__journal_8c_aa4a40c7e2f00dcb4d04cf8062e8fae88}{00481}} \mbox{\hyperlink{g__journal_8c_aa4a40c7e2f00dcb4d04cf8062e8fae88}{g\_journal\_flush\_cache}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00482}00482 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00483}00483         \textcolor{keyword}{struct }bintime bt;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00484}00484         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00485}00485 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00486}00486         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_a0e26ef6063432e60ca297e64db6fc858}{sc\_bio\_flush}} == 0)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00487}00487                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00488}00488         \mbox{\hyperlink{g__journal_8h_a493a00ede0e6efaefff51a5f984529ba}{GJ\_TIMER\_START}}(1, \&bt);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00489}00489         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_a0e26ef6063432e60ca297e64db6fc858}{sc\_bio\_flush}} \& \mbox{\hyperlink{g__journal_8h_a4206712278068a8bc501dce5a97212f6}{GJ\_FLUSH\_JOURNAL}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00490}00490                 error = \mbox{\hyperlink{geom_8h_ac6fb73d666033fb395f7beaf2d6caa46}{g\_io\_flush}}(sc-\/>\mbox{\hyperlink{structg__journal__softc_a2d40c99cf9409278e8447f5b5e986e1b}{sc\_jconsumer}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00491}00491                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(error == 0 ? 2 : 0, \textcolor{stringliteral}{"{}Flush cache of \%s: error=\%d."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00492}00492                     sc-\/>\mbox{\hyperlink{structg__journal__softc_a2d40c99cf9409278e8447f5b5e986e1b}{sc\_jconsumer}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}}, error);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00493}00493         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00494}00494         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_a0e26ef6063432e60ca297e64db6fc858}{sc\_bio\_flush}} \& \mbox{\hyperlink{g__journal_8h_a306b25ba1d9927e810be3b34e1d51b2d}{GJ\_FLUSH\_DATA}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00495}00495                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00496}00496 \textcolor{comment}{                 * TODO: This could be called in parallel with the}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00497}00497 \textcolor{comment}{                 *       previous call.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00498}00498 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00499}00499                 error = \mbox{\hyperlink{geom_8h_ac6fb73d666033fb395f7beaf2d6caa46}{g\_io\_flush}}(sc-\/>\mbox{\hyperlink{structg__journal__softc_a2c73cf0fe40ed3f96de698010a994b05}{sc\_dconsumer}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00500}00500                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(error == 0 ? 2 : 0, \textcolor{stringliteral}{"{}Flush cache of \%s: error=\%d."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00501}00501                     sc-\/>\mbox{\hyperlink{structg__journal__softc_a2c73cf0fe40ed3f96de698010a994b05}{sc\_dconsumer}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}}, error);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00502}00502         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00503}00503         \mbox{\hyperlink{g__journal_8h_a2a291fca79ca199f3d3f8c0aca0ac909}{GJ\_TIMER\_STOP}}(1, \&bt, \textcolor{stringliteral}{"{}Cache flush time"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00504}00504 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00505}00505 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00506}00506 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00507}\mbox{\hyperlink{g__journal_8c_ae5a1f6fa951644c24c1131c99bc9e74a}{00507}} \mbox{\hyperlink{g__journal_8c_ae5a1f6fa951644c24c1131c99bc9e74a}{g\_journal\_write\_header}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00508}00508 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00509}00509         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__journal__header}{g\_journal\_header}} hdr;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00510}00510         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__consumer}{g\_consumer}} *\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00511}00511         u\_char *\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00512}00512         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00513}00513 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00514}00514         \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}} = sc-\/>\mbox{\hyperlink{structg__journal__softc_a2d40c99cf9409278e8447f5b5e986e1b}{sc\_jconsumer}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00515}00515         \mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}} = \mbox{\hyperlink{g__journal_8c_a436fa0646e225c7450514c563fe9d6df}{gj\_malloc}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}}, M\_WAITOK);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00516}00516 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00517}00517         strlcpy(hdr.\mbox{\hyperlink{structg__journal__header_a06d123d45680ed0f490939994fe8fa93}{jh\_magic}}, \mbox{\hyperlink{g__journal_8h_a44da24de636b450ce7d914b44002deb3}{GJ\_HEADER\_MAGIC}}, \textcolor{keyword}{sizeof}(hdr.\mbox{\hyperlink{structg__journal__header_a06d123d45680ed0f490939994fe8fa93}{jh\_magic}}));}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00518}00518         hdr.\mbox{\hyperlink{structg__journal__header_ac72aedf492c623d3e8ee92136f5ef034}{jh\_journal\_id}} = sc-\/>\mbox{\hyperlink{structg__journal__softc_a23dd6d034b275e5f86277ffc064f4846}{sc\_journal\_id}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00519}00519         hdr.\mbox{\hyperlink{structg__journal__header_a22a9f2359e67e385b4858937af127ad9}{jh\_journal\_next\_id}} = sc-\/>\mbox{\hyperlink{structg__journal__softc_a51f291c6a4540e33d26074d73cdf4917}{sc\_journal\_next\_id}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00520}00520         \mbox{\hyperlink{g__journal_8c_a9f2f9fa1fa1508c2962efdc116760843}{g\_journal\_header\_encode}}(\&hdr, \mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00521}00521         error = \mbox{\hyperlink{geom_8h_a9b87ecbd812c109546b077da483baada}{g\_write\_data}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}, sc-\/>\mbox{\hyperlink{structg__journal__softc_aaf90f8a9abf8bb358b209fbc1d2b266d}{sc\_journal\_offset}}, \mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00522}00522             \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00523}00523         \textcolor{comment}{/* if (error == 0) */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00524}00524         sc-\/>\mbox{\hyperlink{structg__journal__softc_aaf90f8a9abf8bb358b209fbc1d2b266d}{sc\_journal\_offset}} += \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00525}00525 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00526}00526         \mbox{\hyperlink{g__journal_8c_af5af205b6121b79aa01357503d8b28bc}{gj\_free}}(\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}, \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00527}00527         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00528}00528 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00529}00529 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00530}00530 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00531}00531 \textcolor{comment}{ * Every journal record has a header and data following it.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00532}00532 \textcolor{comment}{ * Functions below are used to decode the header before storing it to}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00533}00533 \textcolor{comment}{ * little endian and to encode it after reading to system endianness.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00534}00534 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00535}00535 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00536}\mbox{\hyperlink{g__journal_8c_a41f1adc4e62f280bc70cc12542b20742}{00536}} \mbox{\hyperlink{g__journal_8c_a41f1adc4e62f280bc70cc12542b20742}{g\_journal\_record\_header\_encode}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__journal__record__header}{g\_journal\_record\_header}} *hdr,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00537}00537     u\_char *\mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00538}00538 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00539}00539         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__journal__entry}{g\_journal\_entry}} *ent;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00540}00540         u\_int i;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00541}00541 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00542}00542         bcopy(\mbox{\hyperlink{g__journal_8h_ac2a71320a6e3cfc3b8efa579517b9928}{GJ\_RECORD\_HEADER\_MAGIC}}, \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}}, \textcolor{keyword}{sizeof}(\mbox{\hyperlink{g__journal_8h_ac2a71320a6e3cfc3b8efa579517b9928}{GJ\_RECORD\_HEADER\_MAGIC}}));}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00543}00543         \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}} += \textcolor{keyword}{sizeof}(\mbox{\hyperlink{g__journal_8h_ac2a71320a6e3cfc3b8efa579517b9928}{GJ\_RECORD\_HEADER\_MAGIC}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00544}00544         le32enc(\mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}}, hdr-\/>\mbox{\hyperlink{structg__journal__record__header_abd5e0b3e403d0722292e055e73558766}{jrh\_journal\_id}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00545}00545         \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}} += 8;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00546}00546         le16enc(\mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}}, hdr-\/>\mbox{\hyperlink{structg__journal__record__header_a15a2d3b60e620521b639e6781bd612e9}{jrh\_nentries}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00547}00547         \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}} += 2;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00548}00548         bcopy(hdr-\/>\mbox{\hyperlink{structg__journal__record__header_a8aac75bd342396f36cd40f6f795d2263}{jrh\_sum}}, \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}}, \textcolor{keyword}{sizeof}(hdr-\/>\mbox{\hyperlink{structg__journal__record__header_a8aac75bd342396f36cd40f6f795d2263}{jrh\_sum}}));}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00549}00549         \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}} += 8;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00550}00550         \textcolor{keywordflow}{for} (i = 0; i < hdr-\/>\mbox{\hyperlink{structg__journal__record__header_a15a2d3b60e620521b639e6781bd612e9}{jrh\_nentries}}; i++) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00551}00551                 ent = \&hdr-\/>\mbox{\hyperlink{structg__journal__record__header_a72596a00fa540602551d1e55f2ffee1e}{jrh\_entries}}[i];}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00552}00552                 le64enc(\mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}}, ent-\/>\mbox{\hyperlink{structg__journal__entry_aea349e0feb76d9c84ee5db959d2f2ae5}{je\_joffset}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00553}00553                 \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}} += 8;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00554}00554                 le64enc(\mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}}, ent-\/>\mbox{\hyperlink{structg__journal__entry_aec9a2cc19caf506aa7915c4095b6251f}{je\_offset}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00555}00555                 \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}} += 8;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00556}00556                 le64enc(\mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}}, ent-\/>\mbox{\hyperlink{structg__journal__entry_ab7545202430068601ef8d86451ebc9e7}{je\_length}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00557}00557                 \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}} += 8;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00558}00558         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00559}00559 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00560}00560 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00561}00561 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00562}\mbox{\hyperlink{g__journal_8c_a10aa67ce3660ae8243db3d3f5fd9840d}{00562}} \mbox{\hyperlink{g__journal_8c_a10aa67ce3660ae8243db3d3f5fd9840d}{g\_journal\_record\_header\_decode}}(\textcolor{keyword}{const} u\_char *\mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00563}00563     \textcolor{keyword}{struct} \mbox{\hyperlink{structg__journal__record__header}{g\_journal\_record\_header}} *hdr)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00564}00564 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00565}00565         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__journal__entry}{g\_journal\_entry}} *ent;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00566}00566         u\_int i;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00567}00567 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00568}00568         bcopy(\mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}}, hdr-\/>\mbox{\hyperlink{structg__journal__record__header_ac6cd76a6b6ac75ee017b8e0716eb77ec}{jrh\_magic}}, \textcolor{keyword}{sizeof}(hdr-\/>\mbox{\hyperlink{structg__journal__record__header_ac6cd76a6b6ac75ee017b8e0716eb77ec}{jrh\_magic}}));}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00569}00569         \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}} += \textcolor{keyword}{sizeof}(hdr-\/>\mbox{\hyperlink{structg__journal__record__header_ac6cd76a6b6ac75ee017b8e0716eb77ec}{jrh\_magic}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00570}00570         \textcolor{keywordflow}{if} (strcmp(hdr-\/>\mbox{\hyperlink{structg__journal__record__header_ac6cd76a6b6ac75ee017b8e0716eb77ec}{jrh\_magic}}, \mbox{\hyperlink{g__journal_8h_ac2a71320a6e3cfc3b8efa579517b9928}{GJ\_RECORD\_HEADER\_MAGIC}}) != 0)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00571}00571                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00572}00572         hdr-\/>\mbox{\hyperlink{structg__journal__record__header_abd5e0b3e403d0722292e055e73558766}{jrh\_journal\_id}} = le32dec(\mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00573}00573         \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}} += 8;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00574}00574         hdr-\/>\mbox{\hyperlink{structg__journal__record__header_a15a2d3b60e620521b639e6781bd612e9}{jrh\_nentries}} = le16dec(\mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00575}00575         \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}} += 2;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00576}00576         \textcolor{keywordflow}{if} (hdr-\/>\mbox{\hyperlink{structg__journal__record__header_a15a2d3b60e620521b639e6781bd612e9}{jrh\_nentries}} > \mbox{\hyperlink{g__journal_8h_ad7a5b5819fadfea6e4495162f67eb60e}{GJ\_RECORD\_HEADER\_NENTRIES}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00577}00577                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00578}00578         bcopy(\mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}}, hdr-\/>\mbox{\hyperlink{structg__journal__record__header_a8aac75bd342396f36cd40f6f795d2263}{jrh\_sum}}, \textcolor{keyword}{sizeof}(hdr-\/>\mbox{\hyperlink{structg__journal__record__header_a8aac75bd342396f36cd40f6f795d2263}{jrh\_sum}}));}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00579}00579         \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}} += 8;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00580}00580         \textcolor{keywordflow}{for} (i = 0; i < hdr-\/>\mbox{\hyperlink{structg__journal__record__header_a15a2d3b60e620521b639e6781bd612e9}{jrh\_nentries}}; i++) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00581}00581                 ent = \&hdr-\/>\mbox{\hyperlink{structg__journal__record__header_a72596a00fa540602551d1e55f2ffee1e}{jrh\_entries}}[i];}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00582}00582                 ent-\/>\mbox{\hyperlink{structg__journal__entry_aea349e0feb76d9c84ee5db959d2f2ae5}{je\_joffset}} = le64dec(\mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00583}00583                 \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}} += 8;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00584}00584                 ent-\/>\mbox{\hyperlink{structg__journal__entry_aec9a2cc19caf506aa7915c4095b6251f}{je\_offset}} = le64dec(\mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00585}00585                 \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}} += 8;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00586}00586                 ent-\/>\mbox{\hyperlink{structg__journal__entry_ab7545202430068601ef8d86451ebc9e7}{je\_length}} = le64dec(\mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00587}00587                 \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}} += 8;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00588}00588         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00589}00589         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00590}00590 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00591}00591 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00592}00592 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00593}00593 \textcolor{comment}{ * Function reads metadata from a provider (via the given consumer), decodes}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00594}00594 \textcolor{comment}{ * it to system endianness and verifies its correctness.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00595}00595 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00596}00596 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00597}\mbox{\hyperlink{g__journal_8c_a5819d4cbeadae30c5a863db519c44052}{00597}} \mbox{\hyperlink{g__journal_8c_a5819d4cbeadae30c5a863db519c44052}{g\_journal\_metadata\_read}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__consumer}{g\_consumer}} *\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}, \textcolor{keyword}{struct} \mbox{\hyperlink{structg__journal__metadata}{g\_journal\_metadata}} *md)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00598}00598 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00599}00599         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__provider}{g\_provider}} *\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00600}00600         u\_char *\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00601}00601         \textcolor{keywordtype}{int} \mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00602}00602 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00603}00603         \mbox{\hyperlink{geom_8h_a1898dc8c812faa5de231ab840e8562bf}{g\_topology\_assert}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00604}00604 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00605}00605         \mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}} = \mbox{\hyperlink{geom_8h_a27b7c72cc3bc5a4d07ce5976e1aa1b58}{g\_access}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}, 1, 0, 0);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00606}00606         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}} != 0)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00607}00607                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00608}00608         \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}} = \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00609}00609         \mbox{\hyperlink{geom_8h_a4628d4de49ba84e7a6126cc30d23b83a}{g\_topology\_unlock}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00610}00610         \textcolor{comment}{/* Metadata is stored in last sector. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00611}00611         \mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}} = \mbox{\hyperlink{geom_8h_a550c2071f79908eea3d1ccbf821c4e4f}{g\_read\_data}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}, \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a8f47c464c78aa91fa4ca5143ed3cd15e}{mediasize}} -\/ \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}}, \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00612}00612             \&\mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00613}00613         \mbox{\hyperlink{geom_8h_a232419d2cfa06ff3f4ff7551041aed31}{g\_topology\_lock}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00614}00614         \mbox{\hyperlink{geom_8h_a27b7c72cc3bc5a4d07ce5976e1aa1b58}{g\_access}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}, -\/1, 0, 0);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00615}00615         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00616}00616                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(1, \textcolor{stringliteral}{"{}Cannot read metadata from \%s (error=\%d)."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00617}00617                     \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}}, \mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00618}00618                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00619}00619         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00620}00620 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00621}00621         \textcolor{comment}{/* Decode metadata. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00622}00622         \mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}} = \mbox{\hyperlink{g__journal_8h_a94d7993441c75b16a20c5ad817bba716}{journal\_metadata\_decode}}(\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}, md);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00623}00623         \mbox{\hyperlink{geom_8h_ad9924deb20de7b40cb6cf06e5ae28855}{g\_free}}(\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00624}00624         \textcolor{comment}{/* Is this is gjournal provider at all? */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00625}00625         \textcolor{keywordflow}{if} (strcmp(md-\/>\mbox{\hyperlink{structg__journal__metadata_adb22d822eb8ad0add6c2c0b9d28a4a71}{md\_magic}}, \mbox{\hyperlink{g__journal_8h_a414d48c7f55b43cffc33aeff27da7ac8}{G\_JOURNAL\_MAGIC}}) != 0)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00626}00626                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00627}00627         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00628}00628 \textcolor{comment}{         * Are we able to handle this version of metadata?}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00629}00629 \textcolor{comment}{         * We only maintain backward compatibility.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00630}00630 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00631}00631         \textcolor{keywordflow}{if} (md-\/>\mbox{\hyperlink{structg__journal__metadata_aaba4eb7029fb86e581b0080d0e85e194}{md\_version}} > \mbox{\hyperlink{g__journal_8h_a5b78e7e0a6d670e3b6938786cb9ad209}{G\_JOURNAL\_VERSION}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00632}00632                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(0,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00633}00633                     \textcolor{stringliteral}{"{}Kernel module is too old to handle metadata from \%s."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00634}00634                     \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00635}00635                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00636}00636         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00637}00637         \textcolor{comment}{/* Is checksum correct? */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00638}00638         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}} != 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00639}00639                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(0, \textcolor{stringliteral}{"{}MD5 metadata hash mismatch for provider \%s."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00640}00640                     \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00641}00641                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00642}00642         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00643}00643         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00644}00644 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00645}00645 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00646}00646 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00647}00647 \textcolor{comment}{ * Two functions below are responsible for updating metadata.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00648}00648 \textcolor{comment}{ * Only metadata on the data provider is updated (we need to update}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00649}00649 \textcolor{comment}{ * information about active journal in there).}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00650}00650 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00651}00651 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00652}\mbox{\hyperlink{g__journal_8c_a01189ab037648913242afa23dfd318fe}{00652}} \mbox{\hyperlink{g__journal_8c_a01189ab037648913242afa23dfd318fe}{g\_journal\_metadata\_done}}(\textcolor{keyword}{struct} bio *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00653}00653 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00654}00654 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00655}00655         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00656}00656 \textcolor{comment}{         * There is not much we can do on error except informing about it.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00657}00657 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00658}00658         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_error != 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00659}00659                 \mbox{\hyperlink{g__journal_8h_a697a75aa6d57b466f68361b521621f70}{GJ\_LOGREQ}}(0, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \textcolor{stringliteral}{"{}Cannot update metadata (error=\%d)."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00660}00660                     \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_error);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00661}00661         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00662}00662                 \mbox{\hyperlink{g__journal_8h_a697a75aa6d57b466f68361b521621f70}{GJ\_LOGREQ}}(2, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \textcolor{stringliteral}{"{}Metadata updated."{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00663}00663         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00664}00664         \mbox{\hyperlink{g__journal_8c_af5af205b6121b79aa01357503d8b28bc}{gj\_free}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_data, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_length);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00665}00665         \mbox{\hyperlink{geom_8h_ae3cbea7d4bf48f25bb609df3d3f0bb28}{g\_destroy\_bio}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00666}00666 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00667}00667 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00668}00668 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00669}\mbox{\hyperlink{g__journal_8c_aa252660794ce8d1afa9d82076c594395}{00669}} \mbox{\hyperlink{g__journal_8c_aa252660794ce8d1afa9d82076c594395}{g\_journal\_metadata\_update}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00670}00670 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00671}00671         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__journal__metadata}{g\_journal\_metadata}} md;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00672}00672         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__consumer}{g\_consumer}} *\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00673}00673         \textcolor{keyword}{struct }bio *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00674}00674         u\_char *sector;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00675}00675 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00676}00676         \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}} = sc-\/>\mbox{\hyperlink{structg__journal__softc_a2c73cf0fe40ed3f96de698010a994b05}{sc\_dconsumer}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00677}00677         sector = \mbox{\hyperlink{g__journal_8c_a436fa0646e225c7450514c563fe9d6df}{gj\_malloc}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}}, M\_WAITOK);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00678}00678         strlcpy(md.\mbox{\hyperlink{structg__journal__metadata_adb22d822eb8ad0add6c2c0b9d28a4a71}{md\_magic}}, \mbox{\hyperlink{g__journal_8h_a414d48c7f55b43cffc33aeff27da7ac8}{G\_JOURNAL\_MAGIC}}, \textcolor{keyword}{sizeof}(md.\mbox{\hyperlink{structg__journal__metadata_adb22d822eb8ad0add6c2c0b9d28a4a71}{md\_magic}}));}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00679}00679         md.\mbox{\hyperlink{structg__journal__metadata_aaba4eb7029fb86e581b0080d0e85e194}{md\_version}} = \mbox{\hyperlink{g__journal_8h_a5b78e7e0a6d670e3b6938786cb9ad209}{G\_JOURNAL\_VERSION}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00680}00680         md.\mbox{\hyperlink{structg__journal__metadata_a5dc43a9005dfbe7829d47c73cd0341dc}{md\_id}} = sc-\/>\mbox{\hyperlink{structg__journal__softc_ad4d04ff053d5c7f2bdbb0237afccdb25}{sc\_id}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00681}00681         md.\mbox{\hyperlink{structg__journal__metadata_aa01eecd641f70f2d628efb97da4a1a0b}{md\_type}} = sc-\/>\mbox{\hyperlink{structg__journal__softc_abaaa31cfe24844203f9e6708489dc266}{sc\_orig\_type}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00682}00682         md.\mbox{\hyperlink{structg__journal__metadata_a161b605943d7b1005e9b4310d45242e0}{md\_jstart}} = sc-\/>\mbox{\hyperlink{structg__journal__softc_a89bc44b8276a4b18afb4ea756b86f76a}{sc\_jstart}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00683}00683         md.\mbox{\hyperlink{structg__journal__metadata_a73498a247839e33b3c38546e1b73a03e}{md\_jend}} = sc-\/>\mbox{\hyperlink{structg__journal__softc_a4ed217d1be380b3a2282f9bf1a0906bd}{sc\_jend}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00684}00684         md.\mbox{\hyperlink{structg__journal__metadata_a260898232f5a7624907ab38f5e6347d8}{md\_joffset}} = sc-\/>\mbox{\hyperlink{structg__journal__softc_a9ed37f4f4b73662640e4dcbeb0f6083f}{sc\_inactive}}.\mbox{\hyperlink{structg__journal__journal_a5e167f84f14cc6b96032a8808adbf000}{jj\_offset}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00685}00685         md.\mbox{\hyperlink{structg__journal__metadata_a7a3b45b1fa814639d08f2acc9708a483}{md\_jid}} = sc-\/>\mbox{\hyperlink{structg__journal__softc_a08ac88f8906b7fa09718ce9d3594c946}{sc\_journal\_previous\_id}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00686}00686         md.\mbox{\hyperlink{structg__journal__metadata_ac9e9bcf8605af45a86063ce7e5e87105}{md\_flags}} = 0;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00687}00687         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} \& \mbox{\hyperlink{g__journal_8h_af2320e129d03ae46e724751b00a2af3e}{GJF\_DEVICE\_CLEAN}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00688}00688                 md.\mbox{\hyperlink{structg__journal__metadata_ac9e9bcf8605af45a86063ce7e5e87105}{md\_flags}} |= \mbox{\hyperlink{g__journal_8h_afcb6e4a7105e4952108886c7b8939b82}{GJ\_FLAG\_CLEAN}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00689}00689 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00690}00690         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} \& \mbox{\hyperlink{g__journal_8h_a476f7c0be9c1a241da40846054d7e039}{GJF\_DEVICE\_HARDCODED}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00691}00691                 strlcpy(md.\mbox{\hyperlink{structg__journal__metadata_a06c46f5cc5497d01af06948f12b7689e}{md\_provider}}, sc-\/>sc\_name, \textcolor{keyword}{sizeof}(md.\mbox{\hyperlink{structg__journal__metadata_a06c46f5cc5497d01af06948f12b7689e}{md\_provider}}));}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00692}00692         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00693}00693                 bzero(md.\mbox{\hyperlink{structg__journal__metadata_a06c46f5cc5497d01af06948f12b7689e}{md\_provider}}, \textcolor{keyword}{sizeof}(md.\mbox{\hyperlink{structg__journal__metadata_a06c46f5cc5497d01af06948f12b7689e}{md\_provider}}));}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00694}00694         md.\mbox{\hyperlink{structg__journal__metadata_a078fa8e5d14046f255e8c7e49340532f}{md\_provsize}} = \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_a8f47c464c78aa91fa4ca5143ed3cd15e}{mediasize}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00695}00695         \mbox{\hyperlink{g__journal_8h_a753c6c148ede6b525bfb6b8f207998dd}{journal\_metadata\_encode}}(\&md, sector);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00696}00696 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00697}00697         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00698}00698 \textcolor{comment}{         * Flush the cache, so we know all data are on disk.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00699}00699 \textcolor{comment}{         * We write here informations like "{}journal is consistent"{}, so we need}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00700}00700 \textcolor{comment}{         * to be sure it is. Without BIO\_FLUSH here, we can end up in situation}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00701}00701 \textcolor{comment}{         * where metadata is stored on disk, but not all data.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00702}00702 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00703}00703         \mbox{\hyperlink{g__journal_8c_aa4a40c7e2f00dcb4d04cf8062e8fae88}{g\_journal\_flush\_cache}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00704}00704 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00705}00705         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}} = \mbox{\hyperlink{geom_8h_ae13a6895af777c09cf19545f48517fe4}{g\_alloc\_bio}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00706}00706         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_offset = \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_a8f47c464c78aa91fa4ca5143ed3cd15e}{mediasize}} -\/ \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00707}00707         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_length = \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00708}00708         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_data = sector;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00709}00709         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_cmd = BIO\_WRITE;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00710}00710         \textcolor{keywordflow}{if} (!(sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} \& \mbox{\hyperlink{g__journal_8h_a097061ce64a6042ebdcd0e0ed18bf0f0}{GJF\_DEVICE\_DESTROY}})) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00711}00711                 \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_done = \mbox{\hyperlink{g__journal_8c_a01189ab037648913242afa23dfd318fe}{g\_journal\_metadata\_done}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00712}00712                 \mbox{\hyperlink{geom_8h_aa433c0ba9e8cad7c7da1f9e17b46eb7a}{g\_io\_request}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00713}00713         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00714}00714                 \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_done = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00715}00715                 \mbox{\hyperlink{geom_8h_aa433c0ba9e8cad7c7da1f9e17b46eb7a}{g\_io\_request}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00716}00716                 biowait(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \textcolor{stringliteral}{"{}gjmdu"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00717}00717                 \mbox{\hyperlink{g__journal_8c_a01189ab037648913242afa23dfd318fe}{g\_journal\_metadata\_done}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00718}00718         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00719}00719 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00720}00720         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00721}00721 \textcolor{comment}{         * Be sure metadata reached the disk.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00722}00722 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00723}00723         \mbox{\hyperlink{g__journal_8c_aa4a40c7e2f00dcb4d04cf8062e8fae88}{g\_journal\_flush\_cache}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00724}00724 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00725}00725 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00726}00726 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00727}00727 \textcolor{comment}{ * This is where the I/O request comes from the GEOM.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00728}00728 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00729}00729 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00730}\mbox{\hyperlink{g__journal_8c_a9198b68f1d94893dabcb8e0fb4197d47}{00730}} \mbox{\hyperlink{g__journal_8c_a9198b68f1d94893dabcb8e0fb4197d47}{g\_journal\_start}}(\textcolor{keyword}{struct} bio *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00731}00731 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00732}00732         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00733}00733 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00734}00734         sc = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_to-\/>geom-\/>softc;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00735}00735         \mbox{\hyperlink{g__journal_8h_a697a75aa6d57b466f68361b521621f70}{GJ\_LOGREQ}}(3, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \textcolor{stringliteral}{"{}Request received."{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00736}00736 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00737}00737         \textcolor{keywordflow}{switch} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_cmd) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00738}00738         \textcolor{keywordflow}{case} BIO\_READ:}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00739}00739         \textcolor{keywordflow}{case} BIO\_WRITE:}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00740}00740                 mtx\_lock(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00741}00741                 bioq\_insert\_tail(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_a70a954323378094324a9ac266a67e451}{sc\_regular\_queue}}, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00742}00742                 wakeup(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00743}00743                 mtx\_unlock(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00744}00744                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00745}00745         \textcolor{keywordflow}{case} BIO\_GETATTR:}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00746}00746                 \textcolor{keywordflow}{if} (strcmp(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_attribute, \textcolor{stringliteral}{"{}GJOURNAL::provider"{}}) == 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00747}00747                         strlcpy(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_data, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_to-\/>name, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_length);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00748}00748                         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_completed = strlen(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_to-\/>name) + 1;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00749}00749                         \mbox{\hyperlink{geom_8h_a0975be2dcd40a26a56a1a9bfc80433e1}{g\_io\_deliver}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, 0);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00750}00750                         \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00751}00751                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00752}00752                 \textcolor{comment}{/* FALLTHROUGH */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00753}00753         \textcolor{keywordflow}{case} BIO\_SPEEDUP:}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00754}00754         \textcolor{keywordflow}{case} BIO\_DELETE:}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00755}00755         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00756}00756                 \mbox{\hyperlink{geom_8h_a0975be2dcd40a26a56a1a9bfc80433e1}{g\_io\_deliver}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, EOPNOTSUPP);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00757}00757                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00758}00758         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00759}00759 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00760}00760 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00761}00761 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00762}\mbox{\hyperlink{g__journal_8c_aa26049f931ddb9e92a5fe1318a869f9e}{00762}} \mbox{\hyperlink{g__journal_8c_aa26049f931ddb9e92a5fe1318a869f9e}{g\_journal\_std\_done}}(\textcolor{keyword}{struct} bio *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00763}00763 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00764}00764         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00765}00765 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00766}00766         sc = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_from-\/>geom-\/>softc;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00767}00767         mtx\_lock(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00768}00768         bioq\_insert\_tail(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac33096547f31266b12f553f3a3723b5c}{sc\_back\_queue}}, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00769}00769         wakeup(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00770}00770         mtx\_unlock(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00771}00771 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00772}00772 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00773}00773 \textcolor{keyword}{static} \textcolor{keyword}{struct }bio *}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00774}\mbox{\hyperlink{g__journal_8c_ae62dbb5b2450521708ebb2a241e3baae}{00774}} \mbox{\hyperlink{g__journal_8c_ae62dbb5b2450521708ebb2a241e3baae}{g\_journal\_new\_bio}}(off\_t \mbox{\hyperlink{g__raid__tr__if_8m_a17b9425cc13d593841ed2c2054a14e26}{start}}, off\_t end, off\_t joffset, u\_char *\mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00775}00775     \textcolor{keywordtype}{int} flags)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00776}00776 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00777}00777         \textcolor{keyword}{struct }bio *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00778}00778 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00779}00779         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}} = \mbox{\hyperlink{geom_8h_ae13a6895af777c09cf19545f48517fe4}{g\_alloc\_bio}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00780}00780         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_offset = \mbox{\hyperlink{g__raid__tr__if_8m_a17b9425cc13d593841ed2c2054a14e26}{start}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00781}00781         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_joffset = joffset;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00782}00782         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_length = end -\/ \mbox{\hyperlink{g__raid__tr__if_8m_a17b9425cc13d593841ed2c2054a14e26}{start}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00783}00783         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_cmd = BIO\_WRITE;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00784}00784         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_done = \mbox{\hyperlink{g__journal_8c_aa26049f931ddb9e92a5fe1318a869f9e}{g\_journal\_std\_done}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00785}00785         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}} == NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00786}00786                 \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_data = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00787}00787         \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00788}00788                 \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_data = \mbox{\hyperlink{g__journal_8c_a436fa0646e225c7450514c563fe9d6df}{gj\_malloc}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_length, flags);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00789}00789                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_data != NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00790}00790                         bcopy(\mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}}, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_data, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_length);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00791}00791         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00792}00792         \textcolor{keywordflow}{return} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00793}00793 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00794}00794 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00795}\mbox{\hyperlink{g__journal_8c_a8cfc9ca7ddf51079e8f7f9a9feef4d62}{00795}} \textcolor{preprocessor}{\#define g\_journal\_insert\_bio(head, bp, flags)                           \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00796}00796 \textcolor{preprocessor}{        g\_journal\_insert((head), (bp)-\/>bio\_offset,                      \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00797}00797 \textcolor{preprocessor}{                (bp)-\/>bio\_offset + (bp)-\/>bio\_length, (bp)-\/>bio\_joffset, \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00798}00798 \textcolor{preprocessor}{                (bp)-\/>bio\_data, flags)}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00799}00799 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00800}00800 \textcolor{comment}{ * The function below does a lot more than just inserting bio to the queue.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00801}00801 \textcolor{comment}{ * It keeps the queue sorted by offset and ensures that there are no doubled}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00802}00802 \textcolor{comment}{ * data (it combines bios where ranges overlap).}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00803}00803 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00804}00804 \textcolor{comment}{ * The function returns the number of bios inserted (as bio can be splitted).}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00805}00805 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00806}00806 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00807}\mbox{\hyperlink{g__journal_8c_aeb216be63e4d373e30077b0f02fcb1c2}{00807}} \mbox{\hyperlink{g__journal_8c_aeb216be63e4d373e30077b0f02fcb1c2}{g\_journal\_insert}}(\textcolor{keyword}{struct} bio **head, off\_t nstart, off\_t nend, off\_t joffset,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00808}00808     u\_char *\mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}}, \textcolor{keywordtype}{int} flags)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00809}00809 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00810}00810         \textcolor{keyword}{struct }bio *nbp, *cbp, *pbp;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00811}00811         off\_t cstart, cend;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00812}00812         u\_char *tmpdata;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00813}00813         \textcolor{keywordtype}{int} n;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00814}00814 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00815}00815         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(3, \textcolor{stringliteral}{"{}INSERT(\%p): (\%jd, \%jd, \%jd)"{}}, *head, nstart, nend,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00816}00816             joffset);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00817}00817         n = 0;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00818}00818         pbp = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00819}00819         \mbox{\hyperlink{g__journal_8h_a43e65190c1fd67f20459b54bb1250dd9}{GJQ\_FOREACH}}(*head, cbp) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00820}00820                 cstart = cbp-\/>bio\_offset;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00821}00821                 cend = cbp-\/>bio\_offset + cbp-\/>bio\_length;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00822}00822 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00823}00823                 \textcolor{keywordflow}{if} (nstart >= cend) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00824}00824                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00825}00825 \textcolor{comment}{                         *  +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00826}00826 \textcolor{comment}{                         *  |             |}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00827}00827 \textcolor{comment}{                         *  |   current   |  +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00828}00828 \textcolor{comment}{                         *  |     bio     |  |             |}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00829}00829 \textcolor{comment}{                         *  |             |  |     new     |}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00830}00830 \textcolor{comment}{                         *  +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+  |     bio     |}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00831}00831 \textcolor{comment}{                         *                   |             |}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00832}00832 \textcolor{comment}{                         *                   +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00833}00833 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00834}00834                         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(3, \textcolor{stringliteral}{"{}INSERT(\%p): 1"{}}, *head);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00835}00835                 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (nend <= cstart) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00836}00836                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00837}00837 \textcolor{comment}{                         *                   +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00838}00838 \textcolor{comment}{                         *                   |             |}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00839}00839 \textcolor{comment}{                         *  +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+  |   current   |}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00840}00840 \textcolor{comment}{                         *  |             |  |     bio     |}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00841}00841 \textcolor{comment}{                         *  |     new     |  |             |}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00842}00842 \textcolor{comment}{                         *  |     bio     |  +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00843}00843 \textcolor{comment}{                         *  |             |}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00844}00844 \textcolor{comment}{                         *  +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00845}00845 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00846}00846                         nbp = \mbox{\hyperlink{g__journal_8c_ae62dbb5b2450521708ebb2a241e3baae}{g\_journal\_new\_bio}}(nstart, nend, joffset, \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00847}00847                             flags);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00848}00848                         \textcolor{keywordflow}{if} (pbp == NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00849}00849                                 *head = nbp;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00850}00850                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00851}00851                                 pbp-\/>bio\_next = nbp;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00852}00852                         nbp-\/>bio\_next = cbp;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00853}00853                         n++;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00854}00854                         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(3, \textcolor{stringliteral}{"{}INSERT(\%p): 2 (nbp=\%p pbp=\%p)"{}}, *head, nbp,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00855}00855                             pbp);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00856}00856                         \textcolor{keywordflow}{goto} end;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00857}00857                 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (nstart <= cstart \&\& nend >= cend) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00858}00858                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00859}00859 \textcolor{comment}{                         *      +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+      +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00860}00860 \textcolor{comment}{                         *      | current bio |      | current bio |}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00861}00861 \textcolor{comment}{                         *  +-\/-\/-\/+-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+-\/-\/-\/+  +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+-\/-\/-\/+}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00862}00862 \textcolor{comment}{                         *  |   |             |   |  |             |   |}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00863}00863 \textcolor{comment}{                         *  |   |             |   |  |             |   |}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00864}00864 \textcolor{comment}{                         *  |   +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+   |  +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+   |}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00865}00865 \textcolor{comment}{                         *  |       new bio       |  |     new bio     |}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00866}00866 \textcolor{comment}{                         *  +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+  +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00867}00867 \textcolor{comment}{                         *}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00868}00868 \textcolor{comment}{                         *      +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+  +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00869}00869 \textcolor{comment}{                         *      | current bio |  | current bio |}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00870}00870 \textcolor{comment}{                         *  +-\/-\/-\/+-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+  +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00871}00871 \textcolor{comment}{                         *  |   |             |  |             |}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00872}00872 \textcolor{comment}{                         *  |   |             |  |             |}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00873}00873 \textcolor{comment}{                         *  |   +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+  +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00874}00874 \textcolor{comment}{                         *  |     new bio     |  |   new bio   |}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00875}00875 \textcolor{comment}{                         *  +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+  +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00876}00876 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00877}00877                         \mbox{\hyperlink{g__journal_8c_ada2907e2c7243a6211a5d7452728fc7b}{g\_journal\_stats\_bytes\_skipped}} += cbp-\/>bio\_length;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00878}00878                         cbp-\/>bio\_offset = nstart;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00879}00879                         cbp-\/>bio\_joffset = joffset;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00880}00880                         cbp-\/>bio\_length = cend -\/ nstart;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00881}00881                         \textcolor{keywordflow}{if} (cbp-\/>bio\_data != NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00882}00882                                 \mbox{\hyperlink{g__journal_8c_af5af205b6121b79aa01357503d8b28bc}{gj\_free}}(cbp-\/>bio\_data, cend -\/ cstart);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00883}00883                                 cbp-\/>bio\_data = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00884}00884                         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00885}00885                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}} != NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00886}00886                                 cbp-\/>bio\_data = \mbox{\hyperlink{g__journal_8c_a436fa0646e225c7450514c563fe9d6df}{gj\_malloc}}(cbp-\/>bio\_length,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00887}00887                                     flags);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00888}00888                                 \textcolor{keywordflow}{if} (cbp-\/>bio\_data != NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00889}00889                                         bcopy(\mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}}, cbp-\/>bio\_data,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00890}00890                                             cbp-\/>bio\_length);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00891}00891                                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00892}00892                                 \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}} += cend -\/ nstart;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00893}00893                         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00894}00894                         joffset += cend -\/ nstart;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00895}00895                         nstart = cend;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00896}00896                         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(3, \textcolor{stringliteral}{"{}INSERT(\%p): 3 (cbp=\%p)"{}}, *head, cbp);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00897}00897                 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (nstart > cstart \&\& nend >= cend) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00898}00898                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00899}00899 \textcolor{comment}{                         *  +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+  +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00900}00900 \textcolor{comment}{                         *  |   current bio   |  | current bio |}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00901}00901 \textcolor{comment}{                         *  |   +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+  |   +-\/-\/-\/-\/-\/-\/-\/-\/-\/+-\/-\/-\/+}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00902}00902 \textcolor{comment}{                         *  |   |             |  |   |         |   |}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00903}00903 \textcolor{comment}{                         *  |   |             |  |   |         |   |}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00904}00904 \textcolor{comment}{                         *  +-\/-\/-\/+-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+  +-\/-\/-\/+-\/-\/-\/-\/-\/-\/-\/-\/-\/+   |}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00905}00905 \textcolor{comment}{                         *      |   new bio   |      |   new bio   |}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00906}00906 \textcolor{comment}{                         *      +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+      +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00907}00907 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00908}00908                         \mbox{\hyperlink{g__journal_8c_ada2907e2c7243a6211a5d7452728fc7b}{g\_journal\_stats\_bytes\_skipped}} += cend -\/ nstart;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00909}00909                         nbp = \mbox{\hyperlink{g__journal_8c_ae62dbb5b2450521708ebb2a241e3baae}{g\_journal\_new\_bio}}(nstart, cend, joffset, \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00910}00910                             flags);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00911}00911                         nbp-\/>bio\_next = cbp-\/>bio\_next;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00912}00912                         cbp-\/>bio\_next = nbp;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00913}00913                         cbp-\/>bio\_length = nstart -\/ cstart;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00914}00914                         \textcolor{keywordflow}{if} (cbp-\/>bio\_data != NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00915}00915                                 cbp-\/>bio\_data = \mbox{\hyperlink{g__journal_8c_a342f910bd4848593b91aa851dcf46e01}{gj\_realloc}}(cbp-\/>bio\_data,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00916}00916                                     cbp-\/>bio\_length, cend -\/ cstart);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00917}00917                         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00918}00918                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}} != NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00919}00919                                 \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}} += cend -\/ nstart;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00920}00920                         joffset += cend -\/ nstart;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00921}00921                         nstart = cend;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00922}00922                         n++;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00923}00923                         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(3, \textcolor{stringliteral}{"{}INSERT(\%p): 4 (cbp=\%p)"{}}, *head, cbp);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00924}00924                 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (nstart > cstart \&\& nend < cend) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00925}00925                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00926}00926 \textcolor{comment}{                         *  +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00927}00927 \textcolor{comment}{                         *  |     current bio     |}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00928}00928 \textcolor{comment}{                         *  |   +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+   |}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00929}00929 \textcolor{comment}{                         *  |   |             |   |}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00930}00930 \textcolor{comment}{                         *  |   |             |   |}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00931}00931 \textcolor{comment}{                         *  +-\/-\/-\/+-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+-\/-\/-\/+}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00932}00932 \textcolor{comment}{                         *      |   new bio   |}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00933}00933 \textcolor{comment}{                         *      +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00934}00934 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00935}00935                         \mbox{\hyperlink{g__journal_8c_ada2907e2c7243a6211a5d7452728fc7b}{g\_journal\_stats\_bytes\_skipped}} += nend -\/ nstart;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00936}00936                         nbp = \mbox{\hyperlink{g__journal_8c_ae62dbb5b2450521708ebb2a241e3baae}{g\_journal\_new\_bio}}(nstart, nend, joffset, \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00937}00937                             flags);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00938}00938                         nbp-\/>bio\_next = cbp-\/>bio\_next;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00939}00939                         cbp-\/>bio\_next = nbp;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00940}00940                         \textcolor{keywordflow}{if} (cbp-\/>bio\_data == NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00941}00941                                 tmpdata = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00942}00942                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00943}00943                                 tmpdata = cbp-\/>bio\_data + nend -\/ cstart;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00944}00944                         nbp = \mbox{\hyperlink{g__journal_8c_ae62dbb5b2450521708ebb2a241e3baae}{g\_journal\_new\_bio}}(nend, cend,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00945}00945                             cbp-\/>bio\_joffset + nend -\/ cstart, tmpdata, flags);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00946}00946                         nbp-\/>bio\_next = ((\textcolor{keyword}{struct }bio *)cbp-\/>bio\_next)-\/>bio\_next;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00947}00947                         ((\textcolor{keyword}{struct }bio *)cbp-\/>bio\_next)-\/>bio\_next = nbp;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00948}00948                         cbp-\/>bio\_length = nstart -\/ cstart;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00949}00949                         \textcolor{keywordflow}{if} (cbp-\/>bio\_data != NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00950}00950                                 cbp-\/>bio\_data = \mbox{\hyperlink{g__journal_8c_a342f910bd4848593b91aa851dcf46e01}{gj\_realloc}}(cbp-\/>bio\_data,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00951}00951                                     cbp-\/>bio\_length, cend -\/ cstart);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00952}00952                         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00953}00953                         n += 2;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00954}00954                         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(3, \textcolor{stringliteral}{"{}INSERT(\%p): 5 (cbp=\%p)"{}}, *head, cbp);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00955}00955                         \textcolor{keywordflow}{goto} end;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00956}00956                 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (nstart <= cstart \&\& nend < cend) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00957}00957                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00958}00958 \textcolor{comment}{                         *  +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+      +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00959}00959 \textcolor{comment}{                         *  |   current bio   |      | current bio |}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00960}00960 \textcolor{comment}{                         *  +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+   |  +-\/-\/-\/+-\/-\/-\/-\/-\/-\/-\/-\/-\/+   |}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00961}00961 \textcolor{comment}{                         *  |             |   |  |   |         |   |}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00962}00962 \textcolor{comment}{                         *  |             |   |  |   |         |   |}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00963}00963 \textcolor{comment}{                         *  +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+-\/-\/-\/+  |   +-\/-\/-\/-\/-\/-\/-\/-\/-\/+-\/-\/-\/+}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00964}00964 \textcolor{comment}{                         *  |   new bio   |      |   new bio   |}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00965}00965 \textcolor{comment}{                         *  +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+      +-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/+}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00966}00966 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00967}00967                         \mbox{\hyperlink{g__journal_8c_ada2907e2c7243a6211a5d7452728fc7b}{g\_journal\_stats\_bytes\_skipped}} += nend -\/ nstart;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00968}00968                         nbp = \mbox{\hyperlink{g__journal_8c_ae62dbb5b2450521708ebb2a241e3baae}{g\_journal\_new\_bio}}(nstart, nend, joffset, \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00969}00969                             flags);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00970}00970                         \textcolor{keywordflow}{if} (pbp == NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00971}00971                                 *head = nbp;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00972}00972                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00973}00973                                 pbp-\/>bio\_next = nbp;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00974}00974                         nbp-\/>bio\_next = cbp;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00975}00975                         cbp-\/>bio\_offset = nend;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00976}00976                         cbp-\/>bio\_length = cend -\/ nend;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00977}00977                         cbp-\/>bio\_joffset += nend -\/ cstart;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00978}00978                         tmpdata = cbp-\/>bio\_data;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00979}00979                         \textcolor{keywordflow}{if} (tmpdata != NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00980}00980                                 cbp-\/>bio\_data = \mbox{\hyperlink{g__journal_8c_a436fa0646e225c7450514c563fe9d6df}{gj\_malloc}}(cbp-\/>bio\_length,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00981}00981                                     flags);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00982}00982                                 \textcolor{keywordflow}{if} (cbp-\/>bio\_data != NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00983}00983                                         bcopy(tmpdata + nend -\/ cstart,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00984}00984                                             cbp-\/>bio\_data, cbp-\/>bio\_length);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00985}00985                                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00986}00986                                 \mbox{\hyperlink{g__journal_8c_af5af205b6121b79aa01357503d8b28bc}{gj\_free}}(tmpdata, cend -\/ cstart);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00987}00987                         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00988}00988                         n++;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00989}00989                         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(3, \textcolor{stringliteral}{"{}INSERT(\%p): 6 (cbp=\%p)"{}}, *head, cbp);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00990}00990                         \textcolor{keywordflow}{goto} end;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00991}00991                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00992}00992                 \textcolor{keywordflow}{if} (nstart == nend)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00993}00993                         \textcolor{keywordflow}{goto} end;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00994}00994                 pbp = cbp;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00995}00995         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00996}00996         nbp = \mbox{\hyperlink{g__journal_8c_ae62dbb5b2450521708ebb2a241e3baae}{g\_journal\_new\_bio}}(nstart, nend, joffset, \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}}, flags);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00997}00997         \textcolor{keywordflow}{if} (pbp == NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00998}00998                 *head = nbp;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l00999}00999         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01000}01000                 pbp-\/>bio\_next = nbp;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01001}01001         nbp-\/>bio\_next = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01002}01002         n++;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01003}01003         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(3, \textcolor{stringliteral}{"{}INSERT(\%p): 8 (nbp=\%p pbp=\%p)"{}}, *head, nbp, pbp);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01004}01004 end:}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01005}01005         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__journal_8c_a46680090bf15392d6c4741f1ee1566ba}{g\_journal\_debug}} >= 3) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01006}01006                 \mbox{\hyperlink{g__journal_8h_a43e65190c1fd67f20459b54bb1250dd9}{GJQ\_FOREACH}}(*head, cbp) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01007}01007                         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(3, \textcolor{stringliteral}{"{}ELEMENT: \%p (\%jd, \%jd, \%jd, \%p)"{}}, cbp,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01008}01008                             (intmax\_t)cbp-\/>bio\_offset,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01009}01009                             (intmax\_t)cbp-\/>bio\_length,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01010}01010                             (intmax\_t)cbp-\/>bio\_joffset, cbp-\/>bio\_data);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01011}01011                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01012}01012                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(3, \textcolor{stringliteral}{"{}INSERT(\%p): DONE \%d"{}}, *head, n);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01013}01013         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01014}01014         \textcolor{keywordflow}{return} (n);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01015}01015 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01016}01016 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01017}01017 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01018}01018 \textcolor{comment}{ * The function combines neighbour bios trying to squeeze as much data as}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01019}01019 \textcolor{comment}{ * possible into one bio.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01020}01020 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01021}01021 \textcolor{comment}{ * The function returns the number of bios combined (negative value).}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01022}01022 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01023}01023 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01024}\mbox{\hyperlink{g__journal_8c_a4c8c68b6c4b60267fd2c318f6276ea17}{01024}} \mbox{\hyperlink{g__journal_8c_a4c8c68b6c4b60267fd2c318f6276ea17}{g\_journal\_optimize}}(\textcolor{keyword}{struct} bio *head)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01025}01025 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01026}01026         \textcolor{keyword}{struct }bio *cbp, *pbp;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01027}01027         \textcolor{keywordtype}{int} n;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01028}01028 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01029}01029         n = 0;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01030}01030         pbp = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01031}01031         \mbox{\hyperlink{g__journal_8h_a43e65190c1fd67f20459b54bb1250dd9}{GJQ\_FOREACH}}(head, cbp) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01032}01032                 \textcolor{comment}{/* Skip bios which has to be read first. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01033}01033                 \textcolor{keywordflow}{if} (cbp-\/>bio\_data == NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01034}01034                         pbp = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01035}01035                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01036}01036                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01037}01037                 \textcolor{comment}{/* There is no previous bio yet. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01038}01038                 \textcolor{keywordflow}{if} (pbp == NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01039}01039                         pbp = cbp;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01040}01040                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01041}01041                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01042}01042                 \textcolor{comment}{/* Is this a neighbour bio? */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01043}01043                 \textcolor{keywordflow}{if} (pbp-\/>bio\_offset + pbp-\/>bio\_length != cbp-\/>bio\_offset) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01044}01044                         \textcolor{comment}{/* Be sure that bios queue is sorted. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01045}01045                         KASSERT(pbp-\/>bio\_offset + pbp-\/>bio\_length < cbp-\/>bio\_offset,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01046}01046                             (\textcolor{stringliteral}{"{}poffset=\%jd plength=\%jd coffset=\%jd"{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01047}01047                             (intmax\_t)pbp-\/>bio\_offset,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01048}01048                             (intmax\_t)pbp-\/>bio\_length,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01049}01049                             (intmax\_t)cbp-\/>bio\_offset));}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01050}01050                         pbp = cbp;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01051}01051                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01052}01052                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01053}01053                 \textcolor{comment}{/* Be sure we don't end up with too big bio. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01054}01054                 \textcolor{keywordflow}{if} (pbp-\/>bio\_length + cbp-\/>bio\_length > maxphys) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01055}01055                         pbp = cbp;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01056}01056                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01057}01057                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01058}01058                 \textcolor{comment}{/* Ok, we can join bios. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01059}01059                 \mbox{\hyperlink{g__journal_8h_a697a75aa6d57b466f68361b521621f70}{GJ\_LOGREQ}}(4, pbp, \textcolor{stringliteral}{"{}Join: "{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01060}01060                 \mbox{\hyperlink{g__journal_8h_a697a75aa6d57b466f68361b521621f70}{GJ\_LOGREQ}}(4, cbp, \textcolor{stringliteral}{"{}and: "{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01061}01061                 pbp-\/>bio\_data = \mbox{\hyperlink{g__journal_8c_a342f910bd4848593b91aa851dcf46e01}{gj\_realloc}}(pbp-\/>bio\_data,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01062}01062                     pbp-\/>bio\_length + cbp-\/>bio\_length, pbp-\/>bio\_length);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01063}01063                 bcopy(cbp-\/>bio\_data, pbp-\/>bio\_data + pbp-\/>bio\_length,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01064}01064                     cbp-\/>bio\_length);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01065}01065                 \mbox{\hyperlink{g__journal_8c_af5af205b6121b79aa01357503d8b28bc}{gj\_free}}(cbp-\/>bio\_data, cbp-\/>bio\_length);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01066}01066                 pbp-\/>bio\_length += cbp-\/>bio\_length;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01067}01067                 pbp-\/>bio\_next = cbp-\/>bio\_next;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01068}01068                 \mbox{\hyperlink{geom_8h_ae3cbea7d4bf48f25bb609df3d3f0bb28}{g\_destroy\_bio}}(cbp);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01069}01069                 cbp = pbp;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01070}01070                 \mbox{\hyperlink{g__journal_8c_a29be1ba35218f7075a0bf54f04e6ce6d}{g\_journal\_stats\_combined\_ios}}++;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01071}01071                 n-\/-\/;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01072}01072                 \mbox{\hyperlink{g__journal_8h_a697a75aa6d57b466f68361b521621f70}{GJ\_LOGREQ}}(4, pbp, \textcolor{stringliteral}{"{}Got: "{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01073}01073         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01074}01074         \textcolor{keywordflow}{return} (n);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01075}01075 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01076}01076 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01077}01077 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01078}01078 \textcolor{comment}{ * TODO: Update comment.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01079}01079 \textcolor{comment}{ * These are functions responsible for copying one portion of data from journal}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01080}01080 \textcolor{comment}{ * to the destination provider.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01081}01081 \textcolor{comment}{ * The order goes like this:}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01082}01082 \textcolor{comment}{ * 1. Read the header, which contains informations about data blocks}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01083}01083 \textcolor{comment}{ *    following it.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01084}01084 \textcolor{comment}{ * 2. Read the data blocks from the journal.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01085}01085 \textcolor{comment}{ * 3. Write the data blocks on the data provider.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01086}01086 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01087}01087 \textcolor{comment}{ * g\_journal\_copy\_start()}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01088}01088 \textcolor{comment}{ * g\_journal\_copy\_done() -\/ got finished write request, logs potential errors.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01089}01089 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01090}01090 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01091}01091 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01092}01092 \textcolor{comment}{ * When there is no data in cache, this function is used to read it.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01093}01093 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01094}01094 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01095}\mbox{\hyperlink{g__journal_8c_a5db62d7635242a31c878ea13e836c7b4}{01095}} \mbox{\hyperlink{g__journal_8c_a5db62d7635242a31c878ea13e836c7b4}{g\_journal\_read\_first}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc, \textcolor{keyword}{struct} bio *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01096}01096 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01097}01097         \textcolor{keyword}{struct }bio *cbp;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01098}01098 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01099}01099         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01100}01100 \textcolor{comment}{         * We were short in memory, so data was freed.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01101}01101 \textcolor{comment}{         * In that case we need to read it back from journal.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01102}01102 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01103}01103         cbp = \mbox{\hyperlink{geom_8h_ae13a6895af777c09cf19545f48517fe4}{g\_alloc\_bio}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01104}01104         cbp-\/>bio\_cflags = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_cflags;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01105}01105         cbp-\/>bio\_parent = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01106}01106         cbp-\/>bio\_offset = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_joffset;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01107}01107         cbp-\/>bio\_length = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_length;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01108}01108         cbp-\/>bio\_data = \mbox{\hyperlink{g__journal_8c_a436fa0646e225c7450514c563fe9d6df}{gj\_malloc}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_length, M\_WAITOK);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01109}01109         cbp-\/>bio\_cmd = BIO\_READ;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01110}01110         cbp-\/>bio\_done = \mbox{\hyperlink{g__journal_8c_aa26049f931ddb9e92a5fe1318a869f9e}{g\_journal\_std\_done}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01111}01111         \mbox{\hyperlink{g__journal_8h_a697a75aa6d57b466f68361b521621f70}{GJ\_LOGREQ}}(4, cbp, \textcolor{stringliteral}{"{}READ FIRST"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01112}01112         \mbox{\hyperlink{geom_8h_aa433c0ba9e8cad7c7da1f9e17b46eb7a}{g\_io\_request}}(cbp, sc-\/>\mbox{\hyperlink{structg__journal__softc_a2d40c99cf9409278e8447f5b5e986e1b}{sc\_jconsumer}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01113}01113         \mbox{\hyperlink{g__journal_8c_ace41ab0e6b1a3d13a7bcb4f10cf3eb6f}{g\_journal\_cache\_misses}}++;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01114}01114 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01115}01115 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01116}01116 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01117}\mbox{\hyperlink{g__journal_8c_ae15c00ec3191c866cccd51420e0b5b00}{01117}} \mbox{\hyperlink{g__journal_8c_ae15c00ec3191c866cccd51420e0b5b00}{g\_journal\_copy\_send}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01118}01118 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01119}01119         \textcolor{keyword}{struct }bio *bioq, *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, *lbp;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01120}01120 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01121}01121         bioq = lbp = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01122}01122         mtx\_lock(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01123}01123         \textcolor{keywordflow}{for} (; sc-\/>\mbox{\hyperlink{structg__journal__softc_ace2dfb947e35203d5fbfcb760c048ed3}{sc\_copy\_in\_progress}} < \mbox{\hyperlink{g__journal_8c_a51726aca8da4cf075e48fd256a881504}{g\_journal\_parallel\_copies}};) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01124}01124                 \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}} = \mbox{\hyperlink{g__journal_8h_af749ebdf927e967d2a8e2d160a6efc34}{GJQ\_FIRST}}(sc-\/>\mbox{\hyperlink{structg__journal__softc_a9ed37f4f4b73662640e4dcbeb0f6083f}{sc\_inactive}}.\mbox{\hyperlink{structg__journal__journal_a857814a0d0fd54d26a70d888c5f082d9}{jj\_queue}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01125}01125                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}} == NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01126}01126                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01127}01127                 \mbox{\hyperlink{g__journal_8h_a0c3269cae13d358586fad53a5fbe9b12}{GJQ\_REMOVE}}(sc-\/>\mbox{\hyperlink{structg__journal__softc_a9ed37f4f4b73662640e4dcbeb0f6083f}{sc\_inactive}}.\mbox{\hyperlink{structg__journal__journal_a857814a0d0fd54d26a70d888c5f082d9}{jj\_queue}}, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01128}01128                 sc-\/>\mbox{\hyperlink{structg__journal__softc_ace2dfb947e35203d5fbfcb760c048ed3}{sc\_copy\_in\_progress}}++;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01129}01129                 \mbox{\hyperlink{g__journal_8h_a54cadfdaa9ceef71bbec55a0811ac7fd}{GJQ\_INSERT\_AFTER}}(bioq, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, lbp);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01130}01130                 lbp = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01131}01131         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01132}01132         mtx\_unlock(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01133}01133         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__journal_8c_a40a04508c45251032c2447d17e5bff66}{g\_journal\_do\_optimize}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01134}01134                 sc-\/>\mbox{\hyperlink{structg__journal__softc_ace2dfb947e35203d5fbfcb760c048ed3}{sc\_copy\_in\_progress}} += \mbox{\hyperlink{g__journal_8c_a4c8c68b6c4b60267fd2c318f6276ea17}{g\_journal\_optimize}}(bioq);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01135}01135         \textcolor{keywordflow}{while} ((\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}} = \mbox{\hyperlink{g__journal_8h_af749ebdf927e967d2a8e2d160a6efc34}{GJQ\_FIRST}}(bioq)) != NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01136}01136                 \mbox{\hyperlink{g__journal_8h_a0c3269cae13d358586fad53a5fbe9b12}{GJQ\_REMOVE}}(bioq, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01137}01137                 \mbox{\hyperlink{g__journal_8h_a084d6223be129043d958ac6891e32f79}{GJQ\_INSERT\_HEAD}}(sc-\/>\mbox{\hyperlink{structg__journal__softc_a04ee9c4a46b57eb304adedbdb15681c7}{sc\_copy\_queue}}, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01138}01138                 \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_cflags = \mbox{\hyperlink{g__journal_8h_a9e97c0ca13e04e11ad2275522ab10049}{GJ\_BIO\_COPY}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01139}01139                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_data == NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01140}01140                         \mbox{\hyperlink{g__journal_8c_a5db62d7635242a31c878ea13e836c7b4}{g\_journal\_read\_first}}(sc, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01141}01141                 \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01142}01142                         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_joffset = 0;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01143}01143                         \mbox{\hyperlink{g__journal_8h_a697a75aa6d57b466f68361b521621f70}{GJ\_LOGREQ}}(4, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \textcolor{stringliteral}{"{}SEND"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01144}01144                         \mbox{\hyperlink{geom_8h_aa433c0ba9e8cad7c7da1f9e17b46eb7a}{g\_io\_request}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, sc-\/>\mbox{\hyperlink{structg__journal__softc_a2c73cf0fe40ed3f96de698010a994b05}{sc\_dconsumer}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01145}01145                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01146}01146         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01147}01147 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01148}01148 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01149}01149 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01150}\mbox{\hyperlink{g__journal_8c_ad0bc923c6d5bbf2113dfe5f3880d4068}{01150}} \mbox{\hyperlink{g__journal_8c_ad0bc923c6d5bbf2113dfe5f3880d4068}{g\_journal\_copy\_start}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01151}01151 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01152}01152 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01153}01153         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01154}01154 \textcolor{comment}{         * Remember in metadata that we're starting to copy journaled data}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01155}01155 \textcolor{comment}{         * to the data provider.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01156}01156 \textcolor{comment}{         * In case of power failure, we will copy these data once again on boot.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01157}01157 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01158}01158         \textcolor{keywordflow}{if} (!sc-\/>\mbox{\hyperlink{structg__journal__softc_ac51f404c529e60a3d430f31b1702d470}{sc\_journal\_copying}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01159}01159                 sc-\/>\mbox{\hyperlink{structg__journal__softc_ac51f404c529e60a3d430f31b1702d470}{sc\_journal\_copying}} = 1;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01160}01160                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(1, \textcolor{stringliteral}{"{}Starting copy of journal."{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01161}01161                 \mbox{\hyperlink{g__journal_8c_aa252660794ce8d1afa9d82076c594395}{g\_journal\_metadata\_update}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01162}01162         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01163}01163         \mbox{\hyperlink{g__journal_8c_ae15c00ec3191c866cccd51420e0b5b00}{g\_journal\_copy\_send}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01164}01164 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01165}01165 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01166}01166 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01167}01167 \textcolor{comment}{ * Data block has been read from the journal provider.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01168}01168 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01169}01169 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01170}\mbox{\hyperlink{g__journal_8c_a4cbf5050a604c49eac6f05dee9acdab7}{01170}} \mbox{\hyperlink{g__journal_8c_a4cbf5050a604c49eac6f05dee9acdab7}{g\_journal\_copy\_read\_done}}(\textcolor{keyword}{struct} bio *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01171}01171 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01172}01172         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01173}01173         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__consumer}{g\_consumer}} *\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01174}01174         \textcolor{keyword}{struct }bio *pbp;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01175}01175 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01176}01176         KASSERT(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_cflags == \mbox{\hyperlink{g__journal_8h_a9e97c0ca13e04e11ad2275522ab10049}{GJ\_BIO\_COPY}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01177}01177             (\textcolor{stringliteral}{"{}Invalid bio (\%d != \%d)."{}}, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_cflags, \mbox{\hyperlink{g__journal_8h_a9e97c0ca13e04e11ad2275522ab10049}{GJ\_BIO\_COPY}}));}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01178}01178 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01179}01179         sc = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_from-\/>geom-\/>softc;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01180}01180         pbp = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_parent;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01181}01181 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01182}01182         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_error != 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01183}01183                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(0, \textcolor{stringliteral}{"{}Error while reading data from \%s (error=\%d)."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01184}01184                     \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_to-\/>name, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_error);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01185}01185                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01186}01186 \textcolor{comment}{                 * We will not be able to deliver WRITE request as well.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01187}01187 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01188}01188                 \mbox{\hyperlink{g__journal_8c_af5af205b6121b79aa01357503d8b28bc}{gj\_free}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_data, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_length);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01189}01189                 \mbox{\hyperlink{geom_8h_ae3cbea7d4bf48f25bb609df3d3f0bb28}{g\_destroy\_bio}}(pbp);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01190}01190                 \mbox{\hyperlink{geom_8h_ae3cbea7d4bf48f25bb609df3d3f0bb28}{g\_destroy\_bio}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01191}01191                 sc-\/>\mbox{\hyperlink{structg__journal__softc_ace2dfb947e35203d5fbfcb760c048ed3}{sc\_copy\_in\_progress}}-\/-\/;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01192}01192                 \textcolor{keywordflow}{return} (1);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01193}01193         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01194}01194         pbp-\/>bio\_data = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_data;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01195}01195         \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}} = sc-\/>\mbox{\hyperlink{structg__journal__softc_a2c73cf0fe40ed3f96de698010a994b05}{sc\_dconsumer}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01196}01196         \mbox{\hyperlink{geom_8h_aa433c0ba9e8cad7c7da1f9e17b46eb7a}{g\_io\_request}}(pbp, \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01197}01197         \mbox{\hyperlink{g__journal_8h_a697a75aa6d57b466f68361b521621f70}{GJ\_LOGREQ}}(4, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \textcolor{stringliteral}{"{}READ DONE"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01198}01198         \mbox{\hyperlink{geom_8h_ae3cbea7d4bf48f25bb609df3d3f0bb28}{g\_destroy\_bio}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01199}01199         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01200}01200 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01201}01201 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01202}01202 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01203}01203 \textcolor{comment}{ * Data block has been written to the data provider.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01204}01204 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01205}01205 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01206}\mbox{\hyperlink{g__journal_8c_a92165bcc23bd35b82c8dcefa13583d79}{01206}} \mbox{\hyperlink{g__journal_8c_a92165bcc23bd35b82c8dcefa13583d79}{g\_journal\_copy\_write\_done}}(\textcolor{keyword}{struct} bio *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01207}01207 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01208}01208         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01209}01209 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01210}01210         KASSERT(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_cflags == \mbox{\hyperlink{g__journal_8h_a9e97c0ca13e04e11ad2275522ab10049}{GJ\_BIO\_COPY}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01211}01211             (\textcolor{stringliteral}{"{}Invalid bio (\%d != \%d)."{}}, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_cflags, \mbox{\hyperlink{g__journal_8h_a9e97c0ca13e04e11ad2275522ab10049}{GJ\_BIO\_COPY}}));}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01212}01212 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01213}01213         sc = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_from-\/>geom-\/>softc;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01214}01214         sc-\/>\mbox{\hyperlink{structg__journal__softc_ace2dfb947e35203d5fbfcb760c048ed3}{sc\_copy\_in\_progress}}-\/-\/;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01215}01215 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01216}01216         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_error != 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01217}01217                 \mbox{\hyperlink{g__journal_8h_a697a75aa6d57b466f68361b521621f70}{GJ\_LOGREQ}}(0, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \textcolor{stringliteral}{"{}[copy] Error while writing data (error=\%d)"{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01218}01218                     \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_error);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01219}01219         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01220}01220         \mbox{\hyperlink{g__journal_8h_a0c3269cae13d358586fad53a5fbe9b12}{GJQ\_REMOVE}}(sc-\/>\mbox{\hyperlink{structg__journal__softc_a04ee9c4a46b57eb304adedbdb15681c7}{sc\_copy\_queue}}, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01221}01221         \mbox{\hyperlink{g__journal_8c_af5af205b6121b79aa01357503d8b28bc}{gj\_free}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_data, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_length);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01222}01222         \mbox{\hyperlink{g__journal_8h_a697a75aa6d57b466f68361b521621f70}{GJ\_LOGREQ}}(4, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \textcolor{stringliteral}{"{}DONE"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01223}01223         \mbox{\hyperlink{geom_8h_ae3cbea7d4bf48f25bb609df3d3f0bb28}{g\_destroy\_bio}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01224}01224 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01225}01225         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_ace2dfb947e35203d5fbfcb760c048ed3}{sc\_copy\_in\_progress}} == 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01226}01226                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01227}01227 \textcolor{comment}{                 * This was the last write request for this journal.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01228}01228 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01229}01229                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(1, \textcolor{stringliteral}{"{}Data has been copied."{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01230}01230                 sc-\/>\mbox{\hyperlink{structg__journal__softc_ac51f404c529e60a3d430f31b1702d470}{sc\_journal\_copying}} = 0;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01231}01231         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01232}01232 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01233}01233 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01234}01234 \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{g__journal_8c_a7ef1d2d92b61fedadc1078a7efacaafa}{g\_journal\_flush\_done}}(\textcolor{keyword}{struct} bio *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01235}01235 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01236}01236 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01237}01237 \textcolor{comment}{ * Flush one record onto active journal provider.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01238}01238 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01239}01239 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01240}\mbox{\hyperlink{g__journal_8c_a575f3535ee1e83d60aa0af67a0cffede}{01240}} \mbox{\hyperlink{g__journal_8c_a575f3535ee1e83d60aa0af67a0cffede}{g\_journal\_flush}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01241}01241 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01242}01242         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__journal__record__header}{g\_journal\_record\_header}} hdr;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01243}01243         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__journal__entry}{g\_journal\_entry}} *ent;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01244}01244         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__provider}{g\_provider}} *\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01245}01245         \textcolor{keyword}{struct }bio **bioq;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01246}01246         \textcolor{keyword}{struct }bio *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, *fbp, *pbp;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01247}01247         off\_t joffset;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01248}01248         u\_char *\mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}}, hash[16];}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01249}01249         MD5\_CTX ctx;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01250}01250         u\_int i;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01251}01251 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01252}01252         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_a688ea27b33109df148793597cbebd136}{sc\_current\_count}} == 0)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01253}01253                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01254}01254 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01255}01255         \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}} = sc-\/>sc\_jprovider;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01256}01256         \mbox{\hyperlink{g__journal_8h_a89ee85e0bcb691b4c59a0a2e6bce8023}{GJ\_VALIDATE\_OFFSET}}(sc-\/>\mbox{\hyperlink{structg__journal__softc_aaf90f8a9abf8bb358b209fbc1d2b266d}{sc\_journal\_offset}}, sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01257}01257         joffset = sc-\/>\mbox{\hyperlink{structg__journal__softc_aaf90f8a9abf8bb358b209fbc1d2b266d}{sc\_journal\_offset}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01258}01258 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01259}01259         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(2, \textcolor{stringliteral}{"{}Storing \%d journal entries on \%s at \%jd."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01260}01260             sc-\/>\mbox{\hyperlink{structg__journal__softc_a688ea27b33109df148793597cbebd136}{sc\_current\_count}}, \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}}, (intmax\_t)joffset);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01261}01261 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01262}01262         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01263}01263 \textcolor{comment}{         * Store 'journal id', so we know to which journal this record belongs.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01264}01264 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01265}01265         hdr.\mbox{\hyperlink{structg__journal__record__header_abd5e0b3e403d0722292e055e73558766}{jrh\_journal\_id}} = sc-\/>\mbox{\hyperlink{structg__journal__softc_a23dd6d034b275e5f86277ffc064f4846}{sc\_journal\_id}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01266}01266         \textcolor{comment}{/* Could be less than g\_journal\_record\_entries if called due timeout. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01267}01267         hdr.\mbox{\hyperlink{structg__journal__record__header_a15a2d3b60e620521b639e6781bd612e9}{jrh\_nentries}} = MIN(sc-\/>\mbox{\hyperlink{structg__journal__softc_a688ea27b33109df148793597cbebd136}{sc\_current\_count}}, \mbox{\hyperlink{g__journal_8c_a55482bd8bb834da000324b68eea4d963}{g\_journal\_record\_entries}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01268}01268         strlcpy(hdr.\mbox{\hyperlink{structg__journal__record__header_ac6cd76a6b6ac75ee017b8e0716eb77ec}{jrh\_magic}}, \mbox{\hyperlink{g__journal_8h_ac2a71320a6e3cfc3b8efa579517b9928}{GJ\_RECORD\_HEADER\_MAGIC}}, \textcolor{keyword}{sizeof}(hdr.\mbox{\hyperlink{structg__journal__record__header_ac6cd76a6b6ac75ee017b8e0716eb77ec}{jrh\_magic}}));}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01269}01269 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01270}01270         bioq = \&sc-\/>\mbox{\hyperlink{structg__journal__softc_a869b0f971a3b94af08789ac382471913}{sc\_active}}.\mbox{\hyperlink{structg__journal__journal_a857814a0d0fd54d26a70d888c5f082d9}{jj\_queue}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01271}01271         \mbox{\hyperlink{g__journal_8h_aa77a61f87d7c07fed5f2e478f8c3fdf7}{GJQ\_LAST}}(sc-\/>\mbox{\hyperlink{structg__journal__softc_ab1578f4ceb0796dd74b9bb122da6dfea}{sc\_flush\_queue}}, pbp);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01272}01272 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01273}01273         fbp = \mbox{\hyperlink{geom_8h_ae13a6895af777c09cf19545f48517fe4}{g\_alloc\_bio}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01274}01274         fbp-\/>bio\_parent = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01275}01275         fbp-\/>bio\_cflags = \mbox{\hyperlink{g__journal_8h_a13868d0dc5864846635de9f79066279a}{GJ\_BIO\_JOURNAL}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01276}01276         fbp-\/>bio\_offset = -\/1;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01277}01277         fbp-\/>bio\_joffset = joffset;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01278}01278         fbp-\/>bio\_length = \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01279}01279         fbp-\/>bio\_cmd = BIO\_WRITE;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01280}01280         fbp-\/>bio\_done = \mbox{\hyperlink{g__journal_8c_aa26049f931ddb9e92a5fe1318a869f9e}{g\_journal\_std\_done}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01281}01281         \mbox{\hyperlink{g__journal_8h_a54cadfdaa9ceef71bbec55a0811ac7fd}{GJQ\_INSERT\_AFTER}}(sc-\/>\mbox{\hyperlink{structg__journal__softc_ab1578f4ceb0796dd74b9bb122da6dfea}{sc\_flush\_queue}}, fbp, pbp);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01282}01282         pbp = fbp;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01283}01283         fbp-\/>bio\_to = \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01284}01284         \mbox{\hyperlink{g__journal_8h_a697a75aa6d57b466f68361b521621f70}{GJ\_LOGREQ}}(4, fbp, \textcolor{stringliteral}{"{}FLUSH\_OUT"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01285}01285         joffset += \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01286}01286         sc-\/>\mbox{\hyperlink{structg__journal__softc_a8d2bd7d1d242f1d7b05363588548211d}{sc\_flush\_count}}++;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01287}01287         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} \& \mbox{\hyperlink{g__journal_8h_aea5a82d1ec806f852899df9fc46ad1d1}{GJF\_DEVICE\_CHECKSUM}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01288}01288                 MD5Init(\&ctx);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01289}01289 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01290}01290         \textcolor{keywordflow}{for} (i = 0; i < hdr.\mbox{\hyperlink{structg__journal__record__header_a15a2d3b60e620521b639e6781bd612e9}{jrh\_nentries}}; i++) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01291}01291                 \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}} = sc-\/>\mbox{\hyperlink{structg__journal__softc_a40d0c669492533bf654630781eac500f}{sc\_current\_queue}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01292}01292                 KASSERT(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}} != NULL, (\textcolor{stringliteral}{"{}NULL bp"{}}));}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01293}01293                 \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_to = \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01294}01294                 \mbox{\hyperlink{g__journal_8h_a697a75aa6d57b466f68361b521621f70}{GJ\_LOGREQ}}(4, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \textcolor{stringliteral}{"{}FLUSHED"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01295}01295                 sc-\/>\mbox{\hyperlink{structg__journal__softc_a40d0c669492533bf654630781eac500f}{sc\_current\_queue}} = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_next;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01296}01296                 \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_next = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01297}01297                 sc-\/>\mbox{\hyperlink{structg__journal__softc_a688ea27b33109df148793597cbebd136}{sc\_current\_count}}-\/-\/;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01298}01298 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01299}01299                 \textcolor{comment}{/* Add to the header. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01300}01300                 ent = \&hdr.\mbox{\hyperlink{structg__journal__record__header_a72596a00fa540602551d1e55f2ffee1e}{jrh\_entries}}[i];}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01301}01301                 ent-\/>\mbox{\hyperlink{structg__journal__entry_aec9a2cc19caf506aa7915c4095b6251f}{je\_offset}} = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_offset;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01302}01302                 ent-\/>\mbox{\hyperlink{structg__journal__entry_aea349e0feb76d9c84ee5db959d2f2ae5}{je\_joffset}} = joffset;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01303}01303                 ent-\/>\mbox{\hyperlink{structg__journal__entry_ab7545202430068601ef8d86451ebc9e7}{je\_length}} = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_length;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01304}01304 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01305}01305                 \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}} = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_data;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01306}01306                 \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} \& \mbox{\hyperlink{g__journal_8h_aea5a82d1ec806f852899df9fc46ad1d1}{GJF\_DEVICE\_CHECKSUM}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01307}01307                         MD5Update(\&ctx, \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}}, ent-\/>\mbox{\hyperlink{structg__journal__entry_ab7545202430068601ef8d86451ebc9e7}{je\_length}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01308}01308                 \mbox{\hyperlink{geom_8h_ac7e5011386a1b89e762abf3a1e4fa76b}{g\_reset\_bio}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01309}01309                 \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_cflags = \mbox{\hyperlink{g__journal_8h_a13868d0dc5864846635de9f79066279a}{GJ\_BIO\_JOURNAL}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01310}01310                 \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_offset = ent-\/>\mbox{\hyperlink{structg__journal__entry_aec9a2cc19caf506aa7915c4095b6251f}{je\_offset}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01311}01311                 \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_joffset = ent-\/>\mbox{\hyperlink{structg__journal__entry_aea349e0feb76d9c84ee5db959d2f2ae5}{je\_joffset}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01312}01312                 \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_length = ent-\/>\mbox{\hyperlink{structg__journal__entry_ab7545202430068601ef8d86451ebc9e7}{je\_length}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01313}01313                 \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_data = \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01314}01314                 \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_cmd = BIO\_WRITE;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01315}01315                 \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_done = \mbox{\hyperlink{g__journal_8c_aa26049f931ddb9e92a5fe1318a869f9e}{g\_journal\_std\_done}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01316}01316                 \mbox{\hyperlink{g__journal_8h_a54cadfdaa9ceef71bbec55a0811ac7fd}{GJQ\_INSERT\_AFTER}}(sc-\/>\mbox{\hyperlink{structg__journal__softc_ab1578f4ceb0796dd74b9bb122da6dfea}{sc\_flush\_queue}}, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, pbp);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01317}01317                 pbp = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01318}01318                 \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_to = \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01319}01319                 \mbox{\hyperlink{g__journal_8h_a697a75aa6d57b466f68361b521621f70}{GJ\_LOGREQ}}(4, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \textcolor{stringliteral}{"{}FLUSH\_OUT"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01320}01320                 joffset += \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_length;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01321}01321                 sc-\/>\mbox{\hyperlink{structg__journal__softc_a8d2bd7d1d242f1d7b05363588548211d}{sc\_flush\_count}}++;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01322}01322 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01323}01323                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01324}01324 \textcolor{comment}{                 * Add request to the active sc\_journal\_queue queue.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01325}01325 \textcolor{comment}{                 * This is our cache. After journal switch we don't have to}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01326}01326 \textcolor{comment}{                 * read the data from the inactive journal, because we keep}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01327}01327 \textcolor{comment}{                 * it in memory.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01328}01328 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01329}01329                 \mbox{\hyperlink{g__journal_8c_aeb216be63e4d373e30077b0f02fcb1c2}{g\_journal\_insert}}(bioq, ent-\/>\mbox{\hyperlink{structg__journal__entry_aec9a2cc19caf506aa7915c4095b6251f}{je\_offset}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01330}01330                     ent-\/>\mbox{\hyperlink{structg__journal__entry_aec9a2cc19caf506aa7915c4095b6251f}{je\_offset}} + ent-\/>\mbox{\hyperlink{structg__journal__entry_ab7545202430068601ef8d86451ebc9e7}{je\_length}}, ent-\/>\mbox{\hyperlink{structg__journal__entry_aea349e0feb76d9c84ee5db959d2f2ae5}{je\_joffset}}, \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01331}01331                     M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01332}01332         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01333}01333 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01334}01334         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01335}01335 \textcolor{comment}{         * After all requests, store valid header.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01336}01336 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01337}01337         \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}} = \mbox{\hyperlink{g__journal_8c_a436fa0646e225c7450514c563fe9d6df}{gj\_malloc}}(\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}}, M\_WAITOK);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01338}01338         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} \& \mbox{\hyperlink{g__journal_8h_aea5a82d1ec806f852899df9fc46ad1d1}{GJF\_DEVICE\_CHECKSUM}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01339}01339                 MD5Final(hash, \&ctx);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01340}01340                 bcopy(hash, hdr.\mbox{\hyperlink{structg__journal__record__header_a8aac75bd342396f36cd40f6f795d2263}{jrh\_sum}}, \textcolor{keyword}{sizeof}(hdr.\mbox{\hyperlink{structg__journal__record__header_a8aac75bd342396f36cd40f6f795d2263}{jrh\_sum}}));}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01341}01341         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01342}01342         \mbox{\hyperlink{g__journal_8c_a41f1adc4e62f280bc70cc12542b20742}{g\_journal\_record\_header\_encode}}(\&hdr, \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01343}01343         fbp-\/>bio\_data = \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01344}01344 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01345}01345         sc-\/>\mbox{\hyperlink{structg__journal__softc_aaf90f8a9abf8bb358b209fbc1d2b266d}{sc\_journal\_offset}} = joffset;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01346}01346 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01347}01347         \mbox{\hyperlink{g__journal_8c_a84937c4d5addad75d169a2041c97d1b1}{g\_journal\_check\_overflow}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01348}01348 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01349}01349 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01350}01350 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01351}01351 \textcolor{comment}{ * Flush request finished.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01352}01352 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01353}01353 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01354}\mbox{\hyperlink{g__journal_8c_a7ef1d2d92b61fedadc1078a7efacaafa}{01354}} \mbox{\hyperlink{g__journal_8c_a7ef1d2d92b61fedadc1078a7efacaafa}{g\_journal\_flush\_done}}(\textcolor{keyword}{struct} bio *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01355}01355 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01356}01356         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01357}01357         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__consumer}{g\_consumer}} *\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01358}01358 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01359}01359         KASSERT((\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_cflags \& \mbox{\hyperlink{g__journal_8h_a57fd8f2b545755886d04b4a7a705db25}{GJ\_BIO\_MASK}}) == \mbox{\hyperlink{g__journal_8h_a13868d0dc5864846635de9f79066279a}{GJ\_BIO\_JOURNAL}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01360}01360             (\textcolor{stringliteral}{"{}Invalid bio (\%d != \%d)."{}}, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_cflags, \mbox{\hyperlink{g__journal_8h_a13868d0dc5864846635de9f79066279a}{GJ\_BIO\_JOURNAL}}));}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01361}01361 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01362}01362         \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}} = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_from;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01363}01363         sc = \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a75734fc8cd22ffc4209c36cc0a459cba}{geom}}-\/>\mbox{\hyperlink{structg__geom_aa83c08c83459420f6cbcfe64c6099466}{softc}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01364}01364         sc-\/>\mbox{\hyperlink{structg__journal__softc_aafc53963c19cdb0ceb350770db5fc8e6}{sc\_flush\_in\_progress}}-\/-\/;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01365}01365 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01366}01366         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_error != 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01367}01367                 \mbox{\hyperlink{g__journal_8h_a697a75aa6d57b466f68361b521621f70}{GJ\_LOGREQ}}(0, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \textcolor{stringliteral}{"{}[flush] Error while writing data (error=\%d)"{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01368}01368                     \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_error);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01369}01369         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01370}01370         \mbox{\hyperlink{g__journal_8c_af5af205b6121b79aa01357503d8b28bc}{gj\_free}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_data, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_length);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01371}01371         \mbox{\hyperlink{g__journal_8h_a697a75aa6d57b466f68361b521621f70}{GJ\_LOGREQ}}(4, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \textcolor{stringliteral}{"{}DONE"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01372}01372         \mbox{\hyperlink{geom_8h_ae3cbea7d4bf48f25bb609df3d3f0bb28}{g\_destroy\_bio}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01373}01373 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01374}01374 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01375}01375 \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{g__journal_8c_aa7190559678afa7323d44062f8e905e1}{g\_journal\_release\_delayed}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01376}01376 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01377}01377 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01378}\mbox{\hyperlink{g__journal_8c_a0aeb9ca2d629378464f4d3fb4b27cac9}{01378}} \mbox{\hyperlink{g__journal_8c_a0aeb9ca2d629378464f4d3fb4b27cac9}{g\_journal\_flush\_send}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01379}01379 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01380}01380         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__consumer}{g\_consumer}} *\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01381}01381         \textcolor{keyword}{struct }bio *bioq, *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, *lbp;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01382}01382 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01383}01383         \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}} = sc-\/>\mbox{\hyperlink{structg__journal__softc_a2d40c99cf9409278e8447f5b5e986e1b}{sc\_jconsumer}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01384}01384         bioq = lbp = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01385}01385         \textcolor{keywordflow}{while} (sc-\/>\mbox{\hyperlink{structg__journal__softc_aafc53963c19cdb0ceb350770db5fc8e6}{sc\_flush\_in\_progress}} < \mbox{\hyperlink{g__journal_8c_ad454dc48b27db6e060ce7aefc0b0ce1a}{g\_journal\_parallel\_flushes}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01386}01386                 \textcolor{comment}{/* Send one flush requests to the active journal. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01387}01387                 \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}} = \mbox{\hyperlink{g__journal_8h_af749ebdf927e967d2a8e2d160a6efc34}{GJQ\_FIRST}}(sc-\/>\mbox{\hyperlink{structg__journal__softc_ab1578f4ceb0796dd74b9bb122da6dfea}{sc\_flush\_queue}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01388}01388                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}} != NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01389}01389                         \mbox{\hyperlink{g__journal_8h_a0c3269cae13d358586fad53a5fbe9b12}{GJQ\_REMOVE}}(sc-\/>\mbox{\hyperlink{structg__journal__softc_ab1578f4ceb0796dd74b9bb122da6dfea}{sc\_flush\_queue}}, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01390}01390                         sc-\/>\mbox{\hyperlink{structg__journal__softc_a8d2bd7d1d242f1d7b05363588548211d}{sc\_flush\_count}}-\/-\/;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01391}01391                         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_offset = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_joffset;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01392}01392                         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_joffset = 0;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01393}01393                         sc-\/>\mbox{\hyperlink{structg__journal__softc_aafc53963c19cdb0ceb350770db5fc8e6}{sc\_flush\_in\_progress}}++;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01394}01394                         \mbox{\hyperlink{g__journal_8h_a54cadfdaa9ceef71bbec55a0811ac7fd}{GJQ\_INSERT\_AFTER}}(bioq, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, lbp);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01395}01395                         lbp = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01396}01396                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01397}01397                 \textcolor{comment}{/* Try to release delayed requests. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01398}01398                 \mbox{\hyperlink{g__journal_8c_aa7190559678afa7323d44062f8e905e1}{g\_journal\_release\_delayed}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01399}01399                 \textcolor{comment}{/* If there are no requests to flush, leave. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01400}01400                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__journal_8h_af749ebdf927e967d2a8e2d160a6efc34}{GJQ\_FIRST}}(sc-\/>\mbox{\hyperlink{structg__journal__softc_ab1578f4ceb0796dd74b9bb122da6dfea}{sc\_flush\_queue}}) == NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01401}01401                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01402}01402         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01403}01403         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__journal_8c_a40a04508c45251032c2447d17e5bff66}{g\_journal\_do\_optimize}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01404}01404                 sc-\/>\mbox{\hyperlink{structg__journal__softc_aafc53963c19cdb0ceb350770db5fc8e6}{sc\_flush\_in\_progress}} += \mbox{\hyperlink{g__journal_8c_a4c8c68b6c4b60267fd2c318f6276ea17}{g\_journal\_optimize}}(bioq);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01405}01405         \textcolor{keywordflow}{while} ((\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}} = \mbox{\hyperlink{g__journal_8h_af749ebdf927e967d2a8e2d160a6efc34}{GJQ\_FIRST}}(bioq)) != NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01406}01406                 \mbox{\hyperlink{g__journal_8h_a0c3269cae13d358586fad53a5fbe9b12}{GJQ\_REMOVE}}(bioq, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01407}01407                 \mbox{\hyperlink{g__journal_8h_a697a75aa6d57b466f68361b521621f70}{GJ\_LOGREQ}}(3, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \textcolor{stringliteral}{"{}Flush request send"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01408}01408                 \mbox{\hyperlink{geom_8h_aa433c0ba9e8cad7c7da1f9e17b46eb7a}{g\_io\_request}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01409}01409         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01410}01410 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01411}01411 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01412}01412 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01413}\mbox{\hyperlink{g__journal_8c_a209b5bc42bc5fd793760aff69727a4bd}{01413}} \mbox{\hyperlink{g__journal_8c_a209b5bc42bc5fd793760aff69727a4bd}{g\_journal\_add\_current}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc, \textcolor{keyword}{struct} bio *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01414}01414 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01415}01415         \textcolor{keywordtype}{int} n;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01416}01416 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01417}01417         \mbox{\hyperlink{g__journal_8h_a697a75aa6d57b466f68361b521621f70}{GJ\_LOGREQ}}(4, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \textcolor{stringliteral}{"{}CURRENT \%d"{}}, sc-\/>\mbox{\hyperlink{structg__journal__softc_a688ea27b33109df148793597cbebd136}{sc\_current\_count}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01418}01418         n = \mbox{\hyperlink{g__journal_8c_a8cfc9ca7ddf51079e8f7f9a9feef4d62}{g\_journal\_insert\_bio}}(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_a40d0c669492533bf654630781eac500f}{sc\_current\_queue}}, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, M\_WAITOK);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01419}01419         sc-\/>\mbox{\hyperlink{structg__journal__softc_a688ea27b33109df148793597cbebd136}{sc\_current\_count}} += n;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01420}01420         n = \mbox{\hyperlink{g__journal_8c_a4c8c68b6c4b60267fd2c318f6276ea17}{g\_journal\_optimize}}(sc-\/>\mbox{\hyperlink{structg__journal__softc_a40d0c669492533bf654630781eac500f}{sc\_current\_queue}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01421}01421         sc-\/>\mbox{\hyperlink{structg__journal__softc_a688ea27b33109df148793597cbebd136}{sc\_current\_count}} += n;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01422}01422         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01423}01423 \textcolor{comment}{         * For requests which are added to the current queue we deliver}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01424}01424 \textcolor{comment}{         * response immediately.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01425}01425 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01426}01426         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_completed = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_length;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01427}01427         \mbox{\hyperlink{geom_8h_a0975be2dcd40a26a56a1a9bfc80433e1}{g\_io\_deliver}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, 0);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01428}01428         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_a688ea27b33109df148793597cbebd136}{sc\_current\_count}} >= \mbox{\hyperlink{g__journal_8c_a55482bd8bb834da000324b68eea4d963}{g\_journal\_record\_entries}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01429}01429                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01430}01430 \textcolor{comment}{                 * Let's flush one record onto active journal provider.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01431}01431 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01432}01432                 \mbox{\hyperlink{g__journal_8c_a575f3535ee1e83d60aa0af67a0cffede}{g\_journal\_flush}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01433}01433         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01434}01434 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01435}01435 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01436}01436 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01437}\mbox{\hyperlink{g__journal_8c_aa7190559678afa7323d44062f8e905e1}{01437}} \mbox{\hyperlink{g__journal_8c_aa7190559678afa7323d44062f8e905e1}{g\_journal\_release\_delayed}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01438}01438 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01439}01439         \textcolor{keyword}{struct }bio *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01440}01440 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01441}01441         \textcolor{keywordflow}{for} (;;) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01442}01442                 \textcolor{comment}{/* The flush queue is full, exit. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01443}01443                 \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_a8d2bd7d1d242f1d7b05363588548211d}{sc\_flush\_count}} >= \mbox{\hyperlink{g__journal_8c_a1d818f3b07fa826d8cd59da328d3d4cb}{g\_journal\_accept\_immediately}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01444}01444                         \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01445}01445                 \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}} = bioq\_takefirst(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_aaa9e86a79acba05e05a87d2f6f019444}{sc\_delayed\_queue}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01446}01446                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}} == NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01447}01447                         \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01448}01448                 sc-\/>\mbox{\hyperlink{structg__journal__softc_a209e8528ae353cb8a3b65285e9226075}{sc\_delayed\_count}}-\/-\/;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01449}01449                 \mbox{\hyperlink{g__journal_8c_a209b5bc42bc5fd793760aff69727a4bd}{g\_journal\_add\_current}}(sc, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01450}01450         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01451}01451 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01452}01452 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01453}01453 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01454}01454 \textcolor{comment}{ * Add I/O request to the current queue. If we have enough requests for one}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01455}01455 \textcolor{comment}{ * journal record we flush them onto active journal provider.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01456}01456 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01457}01457 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01458}\mbox{\hyperlink{g__journal_8c_abd31fbfa2473f5b7749b8ac4e7d19a08}{01458}} \mbox{\hyperlink{g__journal_8c_abd31fbfa2473f5b7749b8ac4e7d19a08}{g\_journal\_add\_request}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc, \textcolor{keyword}{struct} bio *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01459}01459 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01460}01460 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01461}01461         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01462}01462 \textcolor{comment}{         * The flush queue is full, we need to delay the request.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01463}01463 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01464}01464         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_a209e8528ae353cb8a3b65285e9226075}{sc\_delayed\_count}} > 0 ||}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01465}01465             sc-\/>\mbox{\hyperlink{structg__journal__softc_a8d2bd7d1d242f1d7b05363588548211d}{sc\_flush\_count}} >= \mbox{\hyperlink{g__journal_8c_a1d818f3b07fa826d8cd59da328d3d4cb}{g\_journal\_accept\_immediately}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01466}01466                 \mbox{\hyperlink{g__journal_8h_a697a75aa6d57b466f68361b521621f70}{GJ\_LOGREQ}}(4, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \textcolor{stringliteral}{"{}DELAYED"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01467}01467                 bioq\_insert\_tail(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_aaa9e86a79acba05e05a87d2f6f019444}{sc\_delayed\_queue}}, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01468}01468                 sc-\/>\mbox{\hyperlink{structg__journal__softc_a209e8528ae353cb8a3b65285e9226075}{sc\_delayed\_count}}++;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01469}01469                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01470}01470         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01471}01471 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01472}01472         KASSERT(TAILQ\_EMPTY(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_aaa9e86a79acba05e05a87d2f6f019444}{sc\_delayed\_queue}}.queue),}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01473}01473             (\textcolor{stringliteral}{"{}DELAYED queue not empty."{}}));}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01474}01474         \mbox{\hyperlink{g__journal_8c_a209b5bc42bc5fd793760aff69727a4bd}{g\_journal\_add\_current}}(sc, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01475}01475 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01476}01476 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01477}01477 \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{g__journal_8c_a8f5d4323cd7f3b88ba09321050e86690}{g\_journal\_read\_done}}(\textcolor{keyword}{struct} bio *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01478}01478 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01479}01479 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01480}01480 \textcolor{comment}{ * Try to find requested data in cache.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01481}01481 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01482}01482 \textcolor{keyword}{static} \textcolor{keyword}{struct }bio *}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01483}\mbox{\hyperlink{g__journal_8c_afbdf47ee8020c426bd7d884cb6de927b}{01483}} \mbox{\hyperlink{g__journal_8c_afbdf47ee8020c426bd7d884cb6de927b}{g\_journal\_read\_find}}(\textcolor{keyword}{struct} bio *head, \textcolor{keywordtype}{int} sorted, \textcolor{keyword}{struct} bio *pbp, off\_t ostart,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01484}01484     off\_t oend)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01485}01485 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01486}01486         off\_t cstart, cend;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01487}01487         \textcolor{keyword}{struct }bio *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01488}01488 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01489}01489         \mbox{\hyperlink{g__journal_8h_a43e65190c1fd67f20459b54bb1250dd9}{GJQ\_FOREACH}}(head, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01490}01490                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_offset == -\/1)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01491}01491                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01492}01492                 cstart = MAX(ostart, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_offset);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01493}01493                 cend = MIN(oend, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_offset + \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_length);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01494}01494                 \textcolor{keywordflow}{if} (cend <= ostart)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01495}01495                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01496}01496                 \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (cstart >= oend) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01497}01497                         \textcolor{keywordflow}{if} (!sorted)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01498}01498                                 \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01499}01499                         \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01500}01500                                 \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}} = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01501}01501                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01502}01502                         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01503}01503                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01504}01504                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_data == NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01505}01505                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01506}01506                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(3, \textcolor{stringliteral}{"{}READ(\%p): (\%jd, \%jd) (bp=\%p)"{}}, head, cstart, cend,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01507}01507                     \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01508}01508                 bcopy(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_data + cstart -\/ \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_offset,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01509}01509                     pbp-\/>bio\_data + cstart -\/ pbp-\/>bio\_offset, cend -\/ cstart);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01510}01510                 pbp-\/>bio\_completed += cend -\/ cstart;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01511}01511                 \textcolor{keywordflow}{if} (pbp-\/>bio\_completed == pbp-\/>bio\_length) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01512}01512                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01513}01513 \textcolor{comment}{                         * Cool, the whole request was in cache, deliver happy}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01514}01514 \textcolor{comment}{                         * message.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01515}01515 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01516}01516                         \mbox{\hyperlink{geom_8h_a0975be2dcd40a26a56a1a9bfc80433e1}{g\_io\_deliver}}(pbp, 0);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01517}01517                         \textcolor{keywordflow}{return} (pbp);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01518}01518                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01519}01519                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01520}01520         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01521}01521         \textcolor{keywordflow}{return} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01522}01522 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01523}01523 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01524}01524 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01525}01525 \textcolor{comment}{ * This function is used for collecting data on read.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01526}01526 \textcolor{comment}{ * The complexity is because parts of the data can be stored in four different}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01527}01527 \textcolor{comment}{ * places:}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01528}01528 \textcolor{comment}{ * -\/ in memory -\/ the data not yet send to the active journal provider}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01529}01529 \textcolor{comment}{ * -\/ in the active journal}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01530}01530 \textcolor{comment}{ * -\/ in the inactive journal}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01531}01531 \textcolor{comment}{ * -\/ in the data provider}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01532}01532 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01533}01533 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01534}\mbox{\hyperlink{g__journal_8c_aa839adcb51dc12a388d6d8e35d560dce}{01534}} \mbox{\hyperlink{g__journal_8c_aa839adcb51dc12a388d6d8e35d560dce}{g\_journal\_read}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc, \textcolor{keyword}{struct} bio *pbp, off\_t ostart,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01535}01535     off\_t oend)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01536}01536 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01537}01537         \textcolor{keyword}{struct }bio *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, *nbp, *head;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01538}01538         off\_t cstart, cend;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01539}01539         u\_int i, sorted = 0;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01540}01540 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01541}01541         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(3, \textcolor{stringliteral}{"{}READ: (\%jd, \%jd)"{}}, ostart, oend);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01542}01542 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01543}01543         cstart = cend = -\/1;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01544}01544         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}} = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01545}01545         head = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01546}01546         \textcolor{keywordflow}{for} (i = 1; i <= 5; i++) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01547}01547                 \textcolor{keywordflow}{switch} (i) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01548}01548                 \textcolor{keywordflow}{case} 1: \textcolor{comment}{/* Not-\/yet-\/send data. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01549}01549                         head = sc-\/>\mbox{\hyperlink{structg__journal__softc_a40d0c669492533bf654630781eac500f}{sc\_current\_queue}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01550}01550                         sorted = 1;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01551}01551                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01552}01552                 \textcolor{keywordflow}{case} 2: \textcolor{comment}{/* Skip flush queue as they are also in active queue */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01553}01553                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01554}01554                 \textcolor{keywordflow}{case} 3: \textcolor{comment}{/* Active journal. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01555}01555                         head = sc-\/>\mbox{\hyperlink{structg__journal__softc_a869b0f971a3b94af08789ac382471913}{sc\_active}}.\mbox{\hyperlink{structg__journal__journal_a857814a0d0fd54d26a70d888c5f082d9}{jj\_queue}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01556}01556                         sorted = 1;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01557}01557                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01558}01558                 \textcolor{keywordflow}{case} 4: \textcolor{comment}{/* Inactive journal. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01559}01559                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01560}01560 \textcolor{comment}{                         * XXX: Here could be a race with g\_journal\_lowmem().}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01561}01561 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01562}01562                         head = sc-\/>\mbox{\hyperlink{structg__journal__softc_a9ed37f4f4b73662640e4dcbeb0f6083f}{sc\_inactive}}.\mbox{\hyperlink{structg__journal__journal_a857814a0d0fd54d26a70d888c5f082d9}{jj\_queue}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01563}01563                         sorted = 1;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01564}01564                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01565}01565                 \textcolor{keywordflow}{case} 5: \textcolor{comment}{/* In-\/flight to the data provider. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01566}01566                         head = sc-\/>\mbox{\hyperlink{structg__journal__softc_a04ee9c4a46b57eb304adedbdb15681c7}{sc\_copy\_queue}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01567}01567                         sorted = 0;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01568}01568                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01569}01569                 \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01570}01570                         panic(\textcolor{stringliteral}{"{}gjournal \%s: i=\%d"{}}, \_\_func\_\_, i);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01571}01571                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01572}01572                 \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}} = \mbox{\hyperlink{g__journal_8c_afbdf47ee8020c426bd7d884cb6de927b}{g\_journal\_read\_find}}(head, sorted, pbp, ostart, oend);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01573}01573                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}} == pbp) \{ \textcolor{comment}{/* Got the whole request. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01574}01574                         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(2, \textcolor{stringliteral}{"{}Got the whole request from \%u."{}}, i);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01575}01575                         \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01576}01576                 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}} != NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01577}01577                         cstart = MAX(ostart, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_offset);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01578}01578                         cend = MIN(oend, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_offset + \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_length);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01579}01579                         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(2, \textcolor{stringliteral}{"{}Got part of the request from \%u (\%jd-\/\%jd)."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01580}01580                             i, (intmax\_t)cstart, (intmax\_t)cend);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01581}01581                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01582}01582                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01583}01583         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01584}01584         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}} != NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01585}01585                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_data == NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01586}01586                         nbp = \mbox{\hyperlink{geom_8h_ac367190962a01b4111cdf2fd2718a432}{g\_duplicate\_bio}}(pbp);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01587}01587                         nbp-\/>bio\_cflags = \mbox{\hyperlink{g__journal_8h_a1f459d8c960d1c1af1db09b614e6dc59}{GJ\_BIO\_READ}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01588}01588                         nbp-\/>bio\_data =}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01589}01589                             pbp-\/>bio\_data + cstart -\/ pbp-\/>bio\_offset;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01590}01590                         nbp-\/>bio\_offset =}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01591}01591                             \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_joffset + cstart -\/ \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_offset;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01592}01592                         nbp-\/>bio\_length = cend -\/ cstart;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01593}01593                         nbp-\/>bio\_done = \mbox{\hyperlink{g__journal_8c_a8f5d4323cd7f3b88ba09321050e86690}{g\_journal\_read\_done}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01594}01594                         \mbox{\hyperlink{geom_8h_aa433c0ba9e8cad7c7da1f9e17b46eb7a}{g\_io\_request}}(nbp, sc-\/>\mbox{\hyperlink{structg__journal__softc_a2d40c99cf9409278e8447f5b5e986e1b}{sc\_jconsumer}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01595}01595                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01596}01596                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01597}01597 \textcolor{comment}{                 * If we don't have the whole request yet, call g\_journal\_read()}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01598}01598 \textcolor{comment}{                 * recursively.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01599}01599 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01600}01600                 \textcolor{keywordflow}{if} (ostart < cstart)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01601}01601                         \mbox{\hyperlink{g__journal_8c_aa839adcb51dc12a388d6d8e35d560dce}{g\_journal\_read}}(sc, pbp, ostart, cstart);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01602}01602                 \textcolor{keywordflow}{if} (oend > cend)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01603}01603                         \mbox{\hyperlink{g__journal_8c_aa839adcb51dc12a388d6d8e35d560dce}{g\_journal\_read}}(sc, pbp, cend, oend);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01604}01604         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01605}01605                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01606}01606 \textcolor{comment}{                 * No data in memory, no data in journal.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01607}01607 \textcolor{comment}{                 * Its time for asking data provider.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01608}01608 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01609}01609                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(3, \textcolor{stringliteral}{"{}READ(data): (\%jd, \%jd)"{}}, ostart, oend);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01610}01610                 nbp = \mbox{\hyperlink{geom_8h_ac367190962a01b4111cdf2fd2718a432}{g\_duplicate\_bio}}(pbp);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01611}01611                 nbp-\/>bio\_cflags = \mbox{\hyperlink{g__journal_8h_a1f459d8c960d1c1af1db09b614e6dc59}{GJ\_BIO\_READ}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01612}01612                 nbp-\/>bio\_data = pbp-\/>bio\_data + ostart -\/ pbp-\/>bio\_offset;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01613}01613                 nbp-\/>bio\_offset = ostart;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01614}01614                 nbp-\/>bio\_length = oend -\/ ostart;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01615}01615                 nbp-\/>bio\_done = \mbox{\hyperlink{g__journal_8c_a8f5d4323cd7f3b88ba09321050e86690}{g\_journal\_read\_done}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01616}01616                 \mbox{\hyperlink{geom_8h_aa433c0ba9e8cad7c7da1f9e17b46eb7a}{g\_io\_request}}(nbp, sc-\/>\mbox{\hyperlink{structg__journal__softc_a2c73cf0fe40ed3f96de698010a994b05}{sc\_dconsumer}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01617}01617                 \textcolor{comment}{/* We have the whole request, return here. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01618}01618                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01619}01619         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01620}01620 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01621}01621 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01622}01622 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01623}01623 \textcolor{comment}{ * Function responsible for handling finished READ requests.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01624}01624 \textcolor{comment}{ * Actually, g\_std\_done() could be used here, the only difference is that we}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01625}01625 \textcolor{comment}{ * log error.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01626}01626 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01627}01627 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01628}\mbox{\hyperlink{g__journal_8c_a8f5d4323cd7f3b88ba09321050e86690}{01628}} \mbox{\hyperlink{g__journal_8c_a8f5d4323cd7f3b88ba09321050e86690}{g\_journal\_read\_done}}(\textcolor{keyword}{struct} bio *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01629}01629 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01630}01630         \textcolor{keyword}{struct }bio *pbp;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01631}01631 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01632}01632         KASSERT(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_cflags == \mbox{\hyperlink{g__journal_8h_a1f459d8c960d1c1af1db09b614e6dc59}{GJ\_BIO\_READ}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01633}01633             (\textcolor{stringliteral}{"{}Invalid bio (\%d != \%d)."{}}, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_cflags, \mbox{\hyperlink{g__journal_8h_a1f459d8c960d1c1af1db09b614e6dc59}{GJ\_BIO\_READ}}));}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01634}01634 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01635}01635         pbp = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_parent;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01636}01636         pbp-\/>bio\_inbed++;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01637}01637         pbp-\/>bio\_completed += \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_length;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01638}01638 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01639}01639         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_error != 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01640}01640                 \textcolor{keywordflow}{if} (pbp-\/>bio\_error == 0)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01641}01641                         pbp-\/>bio\_error = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_error;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01642}01642                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(0, \textcolor{stringliteral}{"{}Error while reading data from \%s (error=\%d)."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01643}01643                     \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_to-\/>name, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_error);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01644}01644         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01645}01645         \mbox{\hyperlink{geom_8h_ae3cbea7d4bf48f25bb609df3d3f0bb28}{g\_destroy\_bio}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01646}01646         \textcolor{keywordflow}{if} (pbp-\/>bio\_children == pbp-\/>bio\_inbed \&\&}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01647}01647             pbp-\/>bio\_completed == pbp-\/>bio\_length) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01648}01648                 \textcolor{comment}{/* We're done. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01649}01649                 \mbox{\hyperlink{geom_8h_a0975be2dcd40a26a56a1a9bfc80433e1}{g\_io\_deliver}}(pbp, 0);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01650}01650         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01651}01651 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01652}01652 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01653}01653 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01654}01654 \textcolor{comment}{ * Deactive current journal and active next one.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01655}01655 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01656}01656 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01657}\mbox{\hyperlink{g__journal_8c_a07429553752a565de68798d6e26b46d0}{01657}} \mbox{\hyperlink{g__journal_8c_a07429553752a565de68798d6e26b46d0}{g\_journal\_switch}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01658}01658 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01659}01659         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__provider}{g\_provider}} *\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01660}01660 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01661}01661         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__journal_8h_ab96214635b590ef9e396243b8e9abed2}{JEMPTY}}(sc)) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01662}01662                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(3, \textcolor{stringliteral}{"{}No need for \%s switch."{}}, sc-\/>sc\_name);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01663}01663                 \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}} = LIST\_FIRST(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_a51a9b0d797af1a185e8b83654fcf5739}{sc\_geom}}-\/>provider);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01664}01664                 \textcolor{keywordflow}{if} (!(sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} \& \mbox{\hyperlink{g__journal_8h_af2320e129d03ae46e724751b00a2af3e}{GJF\_DEVICE\_CLEAN}}) \&\& \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_abc6824f999ce8b17107d833c908c83e6}{acw}} == 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01665}01665                         sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} |= \mbox{\hyperlink{g__journal_8h_af2320e129d03ae46e724751b00a2af3e}{GJF\_DEVICE\_CLEAN}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01666}01666                         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(1, \textcolor{stringliteral}{"{}Marking \%s as clean."{}}, sc-\/>sc\_name);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01667}01667                         \mbox{\hyperlink{g__journal_8c_aa252660794ce8d1afa9d82076c594395}{g\_journal\_metadata\_update}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01668}01668                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01669}01669         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01670}01670                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(3, \textcolor{stringliteral}{"{}Switching journal \%s."{}}, sc-\/>\mbox{\hyperlink{structg__journal__softc_a51a9b0d797af1a185e8b83654fcf5739}{sc\_geom}}-\/>\mbox{\hyperlink{structg__geom_af64450500f1fea18f639b191a5017107}{name}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01671}01671 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01672}01672                 \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}} = sc-\/>sc\_jprovider;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01673}01673 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01674}01674                 sc-\/>\mbox{\hyperlink{structg__journal__softc_a08ac88f8906b7fa09718ce9d3594c946}{sc\_journal\_previous\_id}} = sc-\/>\mbox{\hyperlink{structg__journal__softc_a23dd6d034b275e5f86277ffc064f4846}{sc\_journal\_id}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01675}01675 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01676}01676                 sc-\/>\mbox{\hyperlink{structg__journal__softc_a23dd6d034b275e5f86277ffc064f4846}{sc\_journal\_id}} = sc-\/>\mbox{\hyperlink{structg__journal__softc_a51f291c6a4540e33d26074d73cdf4917}{sc\_journal\_next\_id}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01677}01677                 sc-\/>\mbox{\hyperlink{structg__journal__softc_a51f291c6a4540e33d26074d73cdf4917}{sc\_journal\_next\_id}} = arc4random();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01678}01678 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01679}01679                 \mbox{\hyperlink{g__journal_8h_a89ee85e0bcb691b4c59a0a2e6bce8023}{GJ\_VALIDATE\_OFFSET}}(sc-\/>\mbox{\hyperlink{structg__journal__softc_aaf90f8a9abf8bb358b209fbc1d2b266d}{sc\_journal\_offset}}, sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01680}01680 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01681}01681                 \mbox{\hyperlink{g__journal_8c_ae5a1f6fa951644c24c1131c99bc9e74a}{g\_journal\_write\_header}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01682}01682 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01683}01683                 sc-\/>\mbox{\hyperlink{structg__journal__softc_a9ed37f4f4b73662640e4dcbeb0f6083f}{sc\_inactive}}.\mbox{\hyperlink{structg__journal__journal_a5e167f84f14cc6b96032a8808adbf000}{jj\_offset}} = sc-\/>\mbox{\hyperlink{structg__journal__softc_a869b0f971a3b94af08789ac382471913}{sc\_active}}.\mbox{\hyperlink{structg__journal__journal_a5e167f84f14cc6b96032a8808adbf000}{jj\_offset}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01684}01684                 sc-\/>\mbox{\hyperlink{structg__journal__softc_a9ed37f4f4b73662640e4dcbeb0f6083f}{sc\_inactive}}.\mbox{\hyperlink{structg__journal__journal_a857814a0d0fd54d26a70d888c5f082d9}{jj\_queue}} = sc-\/>\mbox{\hyperlink{structg__journal__softc_a869b0f971a3b94af08789ac382471913}{sc\_active}}.\mbox{\hyperlink{structg__journal__journal_a857814a0d0fd54d26a70d888c5f082d9}{jj\_queue}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01685}01685 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01686}01686                 sc-\/>\mbox{\hyperlink{structg__journal__softc_a869b0f971a3b94af08789ac382471913}{sc\_active}}.\mbox{\hyperlink{structg__journal__journal_a5e167f84f14cc6b96032a8808adbf000}{jj\_offset}} =}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01687}01687                     sc-\/>\mbox{\hyperlink{structg__journal__softc_aaf90f8a9abf8bb358b209fbc1d2b266d}{sc\_journal\_offset}} -\/ \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01688}01688                 sc-\/>\mbox{\hyperlink{structg__journal__softc_a869b0f971a3b94af08789ac382471913}{sc\_active}}.\mbox{\hyperlink{structg__journal__journal_a857814a0d0fd54d26a70d888c5f082d9}{jj\_queue}} = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01689}01689 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01690}01690                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01691}01691 \textcolor{comment}{                 * Switch is done, start copying data from the (now) inactive}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01692}01692 \textcolor{comment}{                 * journal to the data provider.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01693}01693 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01694}01694                 \mbox{\hyperlink{g__journal_8c_ad0bc923c6d5bbf2113dfe5f3880d4068}{g\_journal\_copy\_start}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01695}01695         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01696}01696         mtx\_lock(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01697}01697         sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} \&= \string~GJF\_DEVICE\_SWITCH;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01698}01698         mtx\_unlock(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01699}01699 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01700}01700 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01701}01701 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01702}\mbox{\hyperlink{g__journal_8c_a8c7806bf9fd6bdeb2fd1b4591a2d8641}{01702}} \mbox{\hyperlink{g__journal_8c_a8c7806bf9fd6bdeb2fd1b4591a2d8641}{g\_journal\_initialize}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01703}01703 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01704}01704 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01705}01705         sc-\/>\mbox{\hyperlink{structg__journal__softc_a23dd6d034b275e5f86277ffc064f4846}{sc\_journal\_id}} = arc4random();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01706}01706         sc-\/>\mbox{\hyperlink{structg__journal__softc_a51f291c6a4540e33d26074d73cdf4917}{sc\_journal\_next\_id}} = arc4random();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01707}01707         sc-\/>\mbox{\hyperlink{structg__journal__softc_a08ac88f8906b7fa09718ce9d3594c946}{sc\_journal\_previous\_id}} = sc-\/>\mbox{\hyperlink{structg__journal__softc_a23dd6d034b275e5f86277ffc064f4846}{sc\_journal\_id}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01708}01708         sc-\/>\mbox{\hyperlink{structg__journal__softc_aaf90f8a9abf8bb358b209fbc1d2b266d}{sc\_journal\_offset}} = sc-\/>\mbox{\hyperlink{structg__journal__softc_a89bc44b8276a4b18afb4ea756b86f76a}{sc\_jstart}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01709}01709         sc-\/>\mbox{\hyperlink{structg__journal__softc_a9ed37f4f4b73662640e4dcbeb0f6083f}{sc\_inactive}}.\mbox{\hyperlink{structg__journal__journal_a5e167f84f14cc6b96032a8808adbf000}{jj\_offset}} = sc-\/>\mbox{\hyperlink{structg__journal__softc_a89bc44b8276a4b18afb4ea756b86f76a}{sc\_jstart}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01710}01710         \mbox{\hyperlink{g__journal_8c_ae5a1f6fa951644c24c1131c99bc9e74a}{g\_journal\_write\_header}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01711}01711         sc-\/>\mbox{\hyperlink{structg__journal__softc_a869b0f971a3b94af08789ac382471913}{sc\_active}}.\mbox{\hyperlink{structg__journal__journal_a5e167f84f14cc6b96032a8808adbf000}{jj\_offset}} = sc-\/>\mbox{\hyperlink{structg__journal__softc_a89bc44b8276a4b18afb4ea756b86f76a}{sc\_jstart}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01712}01712 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01713}01713 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01714}01714 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01715}\mbox{\hyperlink{g__journal_8c_a61a76aaf8f3ab5f4f599182efae8bd62}{01715}} \mbox{\hyperlink{g__journal_8c_a61a76aaf8f3ab5f4f599182efae8bd62}{g\_journal\_mark\_as\_dirty}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01716}01716 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01717}01717         \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structg__journal__desc}{g\_journal\_desc}} *desc;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01718}01718         \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01719}01719 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01720}01720         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(1, \textcolor{stringliteral}{"{}Marking file system \%s as dirty."{}}, sc-\/>sc\_name);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01721}01721         \textcolor{keywordflow}{for} (i = 0; (desc = \mbox{\hyperlink{g__journal_8c_a23cd1b925a6a1a38d5c117818669f55e}{g\_journal\_filesystems}}[i]) != NULL; i++)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01722}01722                 desc-\/>\mbox{\hyperlink{structg__journal__desc_a51978ad97b345f0fe94c4df71c895ddf}{jd\_dirty}}(sc-\/>\mbox{\hyperlink{structg__journal__softc_a2c73cf0fe40ed3f96de698010a994b05}{sc\_dconsumer}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01723}01723 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01724}01724 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01725}01725 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01726}01726 \textcolor{comment}{ * Function read record header from the given journal.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01727}01727 \textcolor{comment}{ * It is very simlar to g\_read\_data(9), but it doesn't allocate memory for bio}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01728}01728 \textcolor{comment}{ * and data on every call.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01729}01729 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01730}01730 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01731}\mbox{\hyperlink{g__journal_8c_a8c457f844f1dcb0968a03b1c5d6ebda9}{01731}} \mbox{\hyperlink{g__journal_8c_a8c457f844f1dcb0968a03b1c5d6ebda9}{g\_journal\_sync\_read}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__consumer}{g\_consumer}} *\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}, \textcolor{keyword}{struct} bio *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, off\_t \mbox{\hyperlink{g__raid__tr__if_8m_ad5f0842c40c7e46344fd8df70187fa0f}{offset}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01732}01732     \textcolor{keywordtype}{void} *\mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01733}01733 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01734}01734         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01735}01735 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01736}01736         \mbox{\hyperlink{geom_8h_ac7e5011386a1b89e762abf3a1e4fa76b}{g\_reset\_bio}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01737}01737         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_cmd = BIO\_READ;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01738}01738         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_done = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01739}01739         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_offset = \mbox{\hyperlink{g__raid__tr__if_8m_ad5f0842c40c7e46344fd8df70187fa0f}{offset}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01740}01740         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_length = \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01741}01741         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_data = \mbox{\hyperlink{g__part__if_8m_a735984d41155bc1032e09bece8f8d66d}{data}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01742}01742         \mbox{\hyperlink{geom_8h_aa433c0ba9e8cad7c7da1f9e17b46eb7a}{g\_io\_request}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01743}01743         error = biowait(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \textcolor{stringliteral}{"{}gjs\_read"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01744}01744         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01745}01745 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01746}01746 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01747}01747 \textcolor{preprocessor}{\#if 0}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01748}01748 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01749}01749 \textcolor{comment}{ * Function is called when we start the journal device and we detect that}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01750}01750 \textcolor{comment}{ * one of the journals was not fully copied.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01751}01751 \textcolor{comment}{ * The purpose of this function is to read all records headers from journal}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01752}01752 \textcolor{comment}{ * and placed them in the inactive queue, so we can start journal}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01753}01753 \textcolor{comment}{ * synchronization process and the journal provider itself.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01754}01754 \textcolor{comment}{ * Design decision was taken to not synchronize the whole journal here as it}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01755}01755 \textcolor{comment}{ * can take too much time. Reading headers only and delaying synchronization}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01756}01756 \textcolor{comment}{ * process until after journal provider is started should be the best choice.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01757}01757 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01758}01758 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01759}01759 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01760}01760 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01761}\mbox{\hyperlink{g__journal_8c_a07d59cff225430fd7a093e3dc6418bf4}{01761}} \mbox{\hyperlink{g__journal_8c_a07d59cff225430fd7a093e3dc6418bf4}{g\_journal\_sync}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01762}01762 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01763}01763         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__journal__record__header}{g\_journal\_record\_header}} rhdr;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01764}01764         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__journal__entry}{g\_journal\_entry}} *ent;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01765}01765         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__journal__header}{g\_journal\_header}} jhdr;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01766}01766         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__consumer}{g\_consumer}} *\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01767}01767         \textcolor{keyword}{struct }bio *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, *fbp, *tbp;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01768}01768         off\_t joffset, \mbox{\hyperlink{g__raid__tr__if_8m_ad5f0842c40c7e46344fd8df70187fa0f}{offset}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01769}01769         u\_char *\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}, sum[16];}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01770}01770         uint64\_t id;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01771}01771         MD5\_CTX ctx;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01772}01772         \textcolor{keywordtype}{int} error, found, i;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01773}01773 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01774}01774         found = 0;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01775}01775         fbp = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01776}01776         \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}} = sc-\/>\mbox{\hyperlink{structg__journal__softc_a2d40c99cf9409278e8447f5b5e986e1b}{sc\_jconsumer}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01777}01777         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}} = \mbox{\hyperlink{geom_8h_ae13a6895af777c09cf19545f48517fe4}{g\_alloc\_bio}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01778}01778         \mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}} = \mbox{\hyperlink{g__journal_8c_a436fa0646e225c7450514c563fe9d6df}{gj\_malloc}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}}, M\_WAITOK);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01779}01779         \mbox{\hyperlink{g__raid__tr__if_8m_ad5f0842c40c7e46344fd8df70187fa0f}{offset}} = joffset = sc-\/>\mbox{\hyperlink{structg__journal__softc_a9ed37f4f4b73662640e4dcbeb0f6083f}{sc\_inactive}}.\mbox{\hyperlink{structg__journal__journal_a5e167f84f14cc6b96032a8808adbf000}{jj\_offset}} = sc-\/>\mbox{\hyperlink{structg__journal__softc_aaf90f8a9abf8bb358b209fbc1d2b266d}{sc\_journal\_offset}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01780}01780 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01781}01781         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(2, \textcolor{stringliteral}{"{}Looking for termination at \%jd."{}}, (intmax\_t)joffset);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01782}01782 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01783}01783         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01784}01784 \textcolor{comment}{         * Read and decode first journal header.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01785}01785 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01786}01786         error = \mbox{\hyperlink{g__journal_8c_a8c457f844f1dcb0968a03b1c5d6ebda9}{g\_journal\_sync\_read}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \mbox{\hyperlink{g__raid__tr__if_8m_ad5f0842c40c7e46344fd8df70187fa0f}{offset}}, \mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01787}01787         \textcolor{keywordflow}{if} (error != 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01788}01788                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(0, \textcolor{stringliteral}{"{}Error while reading journal header from \%s."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01789}01789                     \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01790}01790                 \textcolor{keywordflow}{goto} end;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01791}01791         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01792}01792         error = \mbox{\hyperlink{g__journal_8c_a8a4f7f8f76a1334e42c09837406be22d}{g\_journal\_header\_decode}}(\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}, \&jhdr);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01793}01793         \textcolor{keywordflow}{if} (error != 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01794}01794                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(0, \textcolor{stringliteral}{"{}Cannot decode journal header from \%s."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01795}01795                     \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01796}01796                 \textcolor{keywordflow}{goto} end;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01797}01797         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01798}01798         \textcolor{keywordtype}{id} = sc-\/>\mbox{\hyperlink{structg__journal__softc_a23dd6d034b275e5f86277ffc064f4846}{sc\_journal\_id}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01799}01799         \textcolor{keywordflow}{if} (jhdr.\mbox{\hyperlink{structg__journal__header_ac72aedf492c623d3e8ee92136f5ef034}{jh\_journal\_id}} != sc-\/>\mbox{\hyperlink{structg__journal__softc_a23dd6d034b275e5f86277ffc064f4846}{sc\_journal\_id}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01800}01800                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(1, \textcolor{stringliteral}{"{}Journal ID mismatch at \%jd (0x\%08x != 0x\%08x)."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01801}01801                     (intmax\_t)\mbox{\hyperlink{g__raid__tr__if_8m_ad5f0842c40c7e46344fd8df70187fa0f}{offset}}, (u\_int)jhdr.\mbox{\hyperlink{structg__journal__header_ac72aedf492c623d3e8ee92136f5ef034}{jh\_journal\_id}}, (u\_int)\textcolor{keywordtype}{id});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01802}01802                 \textcolor{keywordflow}{goto} end;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01803}01803         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01804}01804         \mbox{\hyperlink{g__raid__tr__if_8m_ad5f0842c40c7e46344fd8df70187fa0f}{offset}} += \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01805}01805         \textcolor{keywordtype}{id} = sc-\/>\mbox{\hyperlink{structg__journal__softc_a51f291c6a4540e33d26074d73cdf4917}{sc\_journal\_next\_id}} = jhdr.\mbox{\hyperlink{structg__journal__header_a22a9f2359e67e385b4858937af127ad9}{jh\_journal\_next\_id}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01806}01806 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01807}01807         \textcolor{keywordflow}{for} (;;) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01808}01808                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01809}01809 \textcolor{comment}{                 * If the biggest record won't fit, look for a record header or}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01810}01810 \textcolor{comment}{                 * journal header from the beginning.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01811}01811 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01812}01812                 \mbox{\hyperlink{g__journal_8h_a89ee85e0bcb691b4c59a0a2e6bce8023}{GJ\_VALIDATE\_OFFSET}}(\mbox{\hyperlink{g__raid__tr__if_8m_ad5f0842c40c7e46344fd8df70187fa0f}{offset}}, sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01813}01813                 error = \mbox{\hyperlink{g__journal_8c_a8c457f844f1dcb0968a03b1c5d6ebda9}{g\_journal\_sync\_read}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \mbox{\hyperlink{g__raid__tr__if_8m_ad5f0842c40c7e46344fd8df70187fa0f}{offset}}, \mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01814}01814                 \textcolor{keywordflow}{if} (error != 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01815}01815                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01816}01816 \textcolor{comment}{                         * Not good. Having an error while reading header}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01817}01817 \textcolor{comment}{                         * means, that we cannot read next headers and in}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01818}01818 \textcolor{comment}{                         * consequence we cannot find termination.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01819}01819 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01820}01820                         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(0,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01821}01821                             \textcolor{stringliteral}{"{}Error while reading record header from \%s."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01822}01822                             \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01823}01823                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01824}01824                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01825}01825 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01826}01826                 error = \mbox{\hyperlink{g__journal_8c_a10aa67ce3660ae8243db3d3f5fd9840d}{g\_journal\_record\_header\_decode}}(\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}, \&rhdr);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01827}01827                 \textcolor{keywordflow}{if} (error != 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01828}01828                         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(2, \textcolor{stringliteral}{"{}Not a record header at \%jd (error=\%d)."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01829}01829                             (intmax\_t)\mbox{\hyperlink{g__raid__tr__if_8m_ad5f0842c40c7e46344fd8df70187fa0f}{offset}}, error);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01830}01830                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01831}01831 \textcolor{comment}{                         * This is not a record header.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01832}01832 \textcolor{comment}{                         * If we are lucky, this is next journal header.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01833}01833 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01834}01834                         error = \mbox{\hyperlink{g__journal_8c_a8a4f7f8f76a1334e42c09837406be22d}{g\_journal\_header\_decode}}(\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}, \&jhdr);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01835}01835                         \textcolor{keywordflow}{if} (error != 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01836}01836                                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(1, \textcolor{stringliteral}{"{}Not a journal header at \%jd (error=\%d)."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01837}01837                                     (intmax\_t)\mbox{\hyperlink{g__raid__tr__if_8m_ad5f0842c40c7e46344fd8df70187fa0f}{offset}}, error);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01838}01838                                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01839}01839 \textcolor{comment}{                                 * Nope, this is not journal header, which}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01840}01840 \textcolor{comment}{                                 * bascially means that journal is not}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01841}01841 \textcolor{comment}{                                 * terminated properly.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01842}01842 \textcolor{comment}{                                 */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01843}01843                                 error = ENOENT;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01844}01844                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01845}01845                         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01846}01846                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01847}01847 \textcolor{comment}{                         * Ok. This is header of \_some\_ journal. Now we need to}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01848}01848 \textcolor{comment}{                         * verify if this is header of the \_next\_ journal.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01849}01849 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01850}01850                         \textcolor{keywordflow}{if} (jhdr.\mbox{\hyperlink{structg__journal__header_ac72aedf492c623d3e8ee92136f5ef034}{jh\_journal\_id}} != \textcolor{keywordtype}{id}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01851}01851                                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(1, \textcolor{stringliteral}{"{}Journal ID mismatch at \%jd "{}}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01852}01852                                     \textcolor{stringliteral}{"{}(0x\%08x != 0x\%08x)."{}}, (intmax\_t)\mbox{\hyperlink{g__raid__tr__if_8m_ad5f0842c40c7e46344fd8df70187fa0f}{offset}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01853}01853                                     (u\_int)jhdr.\mbox{\hyperlink{structg__journal__header_ac72aedf492c623d3e8ee92136f5ef034}{jh\_journal\_id}}, (u\_int)\textcolor{keywordtype}{id});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01854}01854                                 error = ENOENT;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01855}01855                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01856}01856                         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01857}01857 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01858}01858                         \textcolor{comment}{/* Found termination. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01859}01859                         found++;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01860}01860                         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(1, \textcolor{stringliteral}{"{}Found termination at \%jd (id=0x\%08x)."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01861}01861                             (intmax\_t)\mbox{\hyperlink{g__raid__tr__if_8m_ad5f0842c40c7e46344fd8df70187fa0f}{offset}}, (u\_int)\textcolor{keywordtype}{id});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01862}01862                         sc-\/>\mbox{\hyperlink{structg__journal__softc_a869b0f971a3b94af08789ac382471913}{sc\_active}}.\mbox{\hyperlink{structg__journal__journal_a5e167f84f14cc6b96032a8808adbf000}{jj\_offset}} = \mbox{\hyperlink{g__raid__tr__if_8m_ad5f0842c40c7e46344fd8df70187fa0f}{offset}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01863}01863                         sc-\/>\mbox{\hyperlink{structg__journal__softc_aaf90f8a9abf8bb358b209fbc1d2b266d}{sc\_journal\_offset}} =}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01864}01864                             \mbox{\hyperlink{g__raid__tr__if_8m_ad5f0842c40c7e46344fd8df70187fa0f}{offset}} + \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01865}01865                         sc-\/>\mbox{\hyperlink{structg__journal__softc_a23dd6d034b275e5f86277ffc064f4846}{sc\_journal\_id}} = id;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01866}01866                         \textcolor{keywordtype}{id} = sc-\/>\mbox{\hyperlink{structg__journal__softc_a51f291c6a4540e33d26074d73cdf4917}{sc\_journal\_next\_id}} = jhdr.\mbox{\hyperlink{structg__journal__header_a22a9f2359e67e385b4858937af127ad9}{jh\_journal\_next\_id}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01867}01867 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01868}01868                         \textcolor{keywordflow}{while} ((tbp = fbp) != NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01869}01869                                 fbp = tbp-\/>bio\_next;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01870}01870                                 \mbox{\hyperlink{g__journal_8h_a697a75aa6d57b466f68361b521621f70}{GJ\_LOGREQ}}(3, tbp, \textcolor{stringliteral}{"{}Adding request."{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01871}01871                                 \mbox{\hyperlink{g__journal_8c_a8cfc9ca7ddf51079e8f7f9a9feef4d62}{g\_journal\_insert\_bio}}(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_a9ed37f4f4b73662640e4dcbeb0f6083f}{sc\_inactive}}.\mbox{\hyperlink{structg__journal__journal_a857814a0d0fd54d26a70d888c5f082d9}{jj\_queue}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01872}01872                                     tbp, M\_WAITOK);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01873}01873                         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01874}01874 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01875}01875                         \textcolor{comment}{/* Skip journal's header. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01876}01876                         \mbox{\hyperlink{g__raid__tr__if_8m_ad5f0842c40c7e46344fd8df70187fa0f}{offset}} += \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01877}01877                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01878}01878                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01879}01879 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01880}01880                 \textcolor{comment}{/* Skip record's header. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01881}01881                 \mbox{\hyperlink{g__raid__tr__if_8m_ad5f0842c40c7e46344fd8df70187fa0f}{offset}} += \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01882}01882 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01883}01883                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01884}01884 \textcolor{comment}{                 * Add information about every record entry to the inactive}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01885}01885 \textcolor{comment}{                 * queue.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01886}01886 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01887}01887                 \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} \& \mbox{\hyperlink{g__journal_8h_aea5a82d1ec806f852899df9fc46ad1d1}{GJF\_DEVICE\_CHECKSUM}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01888}01888                         MD5Init(\&ctx);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01889}01889                 \textcolor{keywordflow}{for} (i = 0; i < rhdr.\mbox{\hyperlink{structg__journal__record__header_a15a2d3b60e620521b639e6781bd612e9}{jrh\_nentries}}; i++) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01890}01890                         ent = \&rhdr.\mbox{\hyperlink{structg__journal__record__header_a72596a00fa540602551d1e55f2ffee1e}{jrh\_entries}}[i];}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01891}01891                         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(3, \textcolor{stringliteral}{"{}Insert entry: \%jd \%jd."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01892}01892                             (intmax\_t)ent-\/>\mbox{\hyperlink{structg__journal__entry_aec9a2cc19caf506aa7915c4095b6251f}{je\_offset}}, (intmax\_t)ent-\/>\mbox{\hyperlink{structg__journal__entry_ab7545202430068601ef8d86451ebc9e7}{je\_length}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01893}01893                         \mbox{\hyperlink{g__journal_8c_aeb216be63e4d373e30077b0f02fcb1c2}{g\_journal\_insert}}(\&fbp, ent-\/>\mbox{\hyperlink{structg__journal__entry_aec9a2cc19caf506aa7915c4095b6251f}{je\_offset}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01894}01894                             ent-\/>\mbox{\hyperlink{structg__journal__entry_aec9a2cc19caf506aa7915c4095b6251f}{je\_offset}} + ent-\/>\mbox{\hyperlink{structg__journal__entry_ab7545202430068601ef8d86451ebc9e7}{je\_length}}, ent-\/>\mbox{\hyperlink{structg__journal__entry_aea349e0feb76d9c84ee5db959d2f2ae5}{je\_joffset}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01895}01895                             NULL, M\_WAITOK);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01896}01896                         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} \& \mbox{\hyperlink{g__journal_8h_aea5a82d1ec806f852899df9fc46ad1d1}{GJF\_DEVICE\_CHECKSUM}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01897}01897                                 u\_char *buf2;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01898}01898 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01899}01899                                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01900}01900 \textcolor{comment}{                                 * TODO: Should use faster function (like}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01901}01901 \textcolor{comment}{                                 *       g\_journal\_sync\_read()).}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01902}01902 \textcolor{comment}{                                 */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01903}01903                                 buf2 = \mbox{\hyperlink{geom_8h_a550c2071f79908eea3d1ccbf821c4e4f}{g\_read\_data}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}, \mbox{\hyperlink{g__raid__tr__if_8m_ad5f0842c40c7e46344fd8df70187fa0f}{offset}}, ent-\/>\mbox{\hyperlink{structg__journal__entry_ab7545202430068601ef8d86451ebc9e7}{je\_length}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01904}01904                                     NULL);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01905}01905                                 \textcolor{keywordflow}{if} (buf2 == NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01906}01906                                         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(0, \textcolor{stringliteral}{"{}Cannot read data at \%jd."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01907}01907                                             (intmax\_t)\mbox{\hyperlink{g__raid__tr__if_8m_ad5f0842c40c7e46344fd8df70187fa0f}{offset}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01908}01908                                 \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01909}01909                                         MD5Update(\&ctx, buf2, ent-\/>\mbox{\hyperlink{structg__journal__entry_ab7545202430068601ef8d86451ebc9e7}{je\_length}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01910}01910                                         \mbox{\hyperlink{geom_8h_ad9924deb20de7b40cb6cf06e5ae28855}{g\_free}}(buf2);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01911}01911                                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01912}01912                         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01913}01913                         \textcolor{comment}{/* Skip entry's data. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01914}01914                         \mbox{\hyperlink{g__raid__tr__if_8m_ad5f0842c40c7e46344fd8df70187fa0f}{offset}} += ent-\/>\mbox{\hyperlink{structg__journal__entry_ab7545202430068601ef8d86451ebc9e7}{je\_length}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01915}01915                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01916}01916                 \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} \& \mbox{\hyperlink{g__journal_8h_aea5a82d1ec806f852899df9fc46ad1d1}{GJF\_DEVICE\_CHECKSUM}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01917}01917                         MD5Final(sum, \&ctx);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01918}01918                         \textcolor{keywordflow}{if} (bcmp(sum, rhdr.\mbox{\hyperlink{structg__journal__record__header_a8aac75bd342396f36cd40f6f795d2263}{jrh\_sum}}, \textcolor{keyword}{sizeof}(rhdr.\mbox{\hyperlink{structg__journal__record__header_a8aac75bd342396f36cd40f6f795d2263}{jrh\_sum}})) != 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01919}01919                                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(0, \textcolor{stringliteral}{"{}MD5 hash mismatch at \%jd!"{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01920}01920                                     (intmax\_t)\mbox{\hyperlink{g__raid__tr__if_8m_ad5f0842c40c7e46344fd8df70187fa0f}{offset}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01921}01921                         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01922}01922                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01923}01923         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01924}01924 end:}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01925}01925         \mbox{\hyperlink{g__journal_8c_af5af205b6121b79aa01357503d8b28bc}{gj\_free}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_data, \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01926}01926         \mbox{\hyperlink{geom_8h_ae3cbea7d4bf48f25bb609df3d3f0bb28}{g\_destroy\_bio}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01927}01927 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01928}01928         \textcolor{comment}{/* Remove bios from unterminated journal. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01929}01929         \textcolor{keywordflow}{while} ((tbp = fbp) != NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01930}01930                 fbp = tbp-\/>bio\_next;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01931}01931                 \mbox{\hyperlink{geom_8h_ae3cbea7d4bf48f25bb609df3d3f0bb28}{g\_destroy\_bio}}(tbp);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01932}01932         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01933}01933 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01934}01934         \textcolor{keywordflow}{if} (found < 1 \&\& joffset > 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01935}01935                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(0, \textcolor{stringliteral}{"{}Journal on \%s is broken/corrupted. Initializing."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01936}01936                     sc-\/>sc\_name);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01937}01937                 \textcolor{keywordflow}{while} ((tbp = sc-\/>\mbox{\hyperlink{structg__journal__softc_a9ed37f4f4b73662640e4dcbeb0f6083f}{sc\_inactive}}.\mbox{\hyperlink{structg__journal__journal_a857814a0d0fd54d26a70d888c5f082d9}{jj\_queue}}) != NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01938}01938                         sc-\/>\mbox{\hyperlink{structg__journal__softc_a9ed37f4f4b73662640e4dcbeb0f6083f}{sc\_inactive}}.\mbox{\hyperlink{structg__journal__journal_a857814a0d0fd54d26a70d888c5f082d9}{jj\_queue}} = tbp-\/>bio\_next;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01939}01939                         \mbox{\hyperlink{geom_8h_ae3cbea7d4bf48f25bb609df3d3f0bb28}{g\_destroy\_bio}}(tbp);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01940}01940                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01941}01941                 \mbox{\hyperlink{g__journal_8c_a8c7806bf9fd6bdeb2fd1b4591a2d8641}{g\_journal\_initialize}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01942}01942                 \mbox{\hyperlink{g__journal_8c_a61a76aaf8f3ab5f4f599182efae8bd62}{g\_journal\_mark\_as\_dirty}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01943}01943         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01944}01944                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(0, \textcolor{stringliteral}{"{}Journal \%s consistent."{}}, sc-\/>sc\_name);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01945}01945                 \mbox{\hyperlink{g__journal_8c_ad0bc923c6d5bbf2113dfe5f3880d4068}{g\_journal\_copy\_start}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01946}01946         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01947}01947 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01948}01948 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01949}01949 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01950}01950 \textcolor{comment}{ * Wait for requests.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01951}01951 \textcolor{comment}{ * If we have requests in the current queue, flush them after 3 seconds from the}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01952}01952 \textcolor{comment}{ * last flush. In this way we don't wait forever (or for journal switch) with}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01953}01953 \textcolor{comment}{ * storing not full records on journal.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01954}01954 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01955}01955 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01956}\mbox{\hyperlink{g__journal_8c_a8917c504f27f26bc0fbdb9b1c5d9b584}{01956}} \mbox{\hyperlink{g__journal_8c_a8917c504f27f26bc0fbdb9b1c5d9b584}{g\_journal\_wait}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc, time\_t last\_write)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01957}01957 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01958}01958         \textcolor{keywordtype}{int} error, timeout;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01959}01959 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01960}01960         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(3, \textcolor{stringliteral}{"{}\%s: enter"{}}, \_\_func\_\_);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01961}01961         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_a688ea27b33109df148793597cbebd136}{sc\_current\_count}} == 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01962}01962                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__journal_8c_a46680090bf15392d6c4741f1ee1566ba}{g\_journal\_debug}} < 2)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01963}01963                         msleep(sc, \&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}}, PRIBIO | PDROP, \textcolor{stringliteral}{"{}gj:work"{}}, 0);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01964}01964                 \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01965}01965                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01966}01966 \textcolor{comment}{                         * If we have debug turned on, show number of elements}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01967}01967 \textcolor{comment}{                         * in various queues.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01968}01968 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01969}01969                         \textcolor{keywordflow}{for} (;;) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01970}01970                                 error = msleep(sc, \&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}}, PRIBIO,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01971}01971                                     \textcolor{stringliteral}{"{}gj:work"{}}, hz * 3);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01972}01972                                 \textcolor{keywordflow}{if} (error == 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01973}01973                                         mtx\_unlock(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01974}01974                                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01975}01975                                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01976}01976                                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(3, \textcolor{stringliteral}{"{}Report: current count=\%d"{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01977}01977                                     sc-\/>\mbox{\hyperlink{structg__journal__softc_a688ea27b33109df148793597cbebd136}{sc\_current\_count}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01978}01978                                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(3, \textcolor{stringliteral}{"{}Report: flush count=\%d"{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01979}01979                                     sc-\/>\mbox{\hyperlink{structg__journal__softc_a8d2bd7d1d242f1d7b05363588548211d}{sc\_flush\_count}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01980}01980                                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(3, \textcolor{stringliteral}{"{}Report: flush in progress=\%d"{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01981}01981                                     sc-\/>\mbox{\hyperlink{structg__journal__softc_aafc53963c19cdb0ceb350770db5fc8e6}{sc\_flush\_in\_progress}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01982}01982                                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(3, \textcolor{stringliteral}{"{}Report: copy in progress=\%d"{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01983}01983                                     sc-\/>\mbox{\hyperlink{structg__journal__softc_ace2dfb947e35203d5fbfcb760c048ed3}{sc\_copy\_in\_progress}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01984}01984                                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(3, \textcolor{stringliteral}{"{}Report: delayed=\%d"{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01985}01985                                     sc-\/>\mbox{\hyperlink{structg__journal__softc_a209e8528ae353cb8a3b65285e9226075}{sc\_delayed\_count}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01986}01986                         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01987}01987                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01988}01988                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(3, \textcolor{stringliteral}{"{}\%s: exit 1"{}}, \_\_func\_\_);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01989}01989                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01990}01990         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01991}01991 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01992}01992         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01993}01993 \textcolor{comment}{         * Flush even not full records every 3 seconds.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01994}01994 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01995}01995         timeout = (last\_write + 3 -\/ time\_second) * hz;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01996}01996         \textcolor{keywordflow}{if} (timeout <= 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01997}01997                 mtx\_unlock(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01998}01998                 \mbox{\hyperlink{g__journal_8c_a575f3535ee1e83d60aa0af67a0cffede}{g\_journal\_flush}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l01999}01999                 \mbox{\hyperlink{g__journal_8c_a0aeb9ca2d629378464f4d3fb4b27cac9}{g\_journal\_flush\_send}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02000}02000                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(3, \textcolor{stringliteral}{"{}\%s: exit 2"{}}, \_\_func\_\_);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02001}02001                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02002}02002         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02003}02003         error = msleep(sc, \&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}}, PRIBIO | PDROP, \textcolor{stringliteral}{"{}gj:work"{}}, timeout);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02004}02004         \textcolor{keywordflow}{if} (error == EWOULDBLOCK)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02005}02005                 \mbox{\hyperlink{g__journal_8c_a0aeb9ca2d629378464f4d3fb4b27cac9}{g\_journal\_flush\_send}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02006}02006         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(3, \textcolor{stringliteral}{"{}\%s: exit 3"{}}, \_\_func\_\_);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02007}02007 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02008}02008 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02009}02009 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02010}02010 \textcolor{comment}{ * Worker thread.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02011}02011 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02012}02012 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02013}\mbox{\hyperlink{g__journal_8c_abdf9f299aadc66ab101fe91662e4263e}{02013}} \mbox{\hyperlink{g__journal_8c_abdf9f299aadc66ab101fe91662e4263e}{g\_journal\_worker}}(\textcolor{keywordtype}{void} *arg)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02014}02014 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02015}02015         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02016}02016         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__geom}{g\_geom}} *\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02017}02017         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__provider}{g\_provider}} *\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02018}02018         \textcolor{keyword}{struct }bio *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02019}02019         time\_t last\_write;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02020}02020         \textcolor{keywordtype}{int} \mbox{\hyperlink{geom__flashmap_8c_a763fd8db6bba8fbbbc113ca0d61c47c2}{type}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02021}02021 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02022}02022         thread\_lock(curthread);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02023}02023         sched\_prio(curthread, PRIBIO);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02024}02024         thread\_unlock(curthread);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02025}02025 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02026}02026         sc = arg;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02027}02027         \mbox{\hyperlink{geom__flashmap_8c_a763fd8db6bba8fbbbc113ca0d61c47c2}{type}} = 0;   \textcolor{comment}{/* gcc */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02028}02028 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02029}02029         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} \& \mbox{\hyperlink{g__journal_8h_af2320e129d03ae46e724751b00a2af3e}{GJF\_DEVICE\_CLEAN}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02030}02030                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(0, \textcolor{stringliteral}{"{}Journal \%s clean."{}}, sc-\/>sc\_name);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02031}02031                 \mbox{\hyperlink{g__journal_8c_a8c7806bf9fd6bdeb2fd1b4591a2d8641}{g\_journal\_initialize}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02032}02032         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02033}02033                 \mbox{\hyperlink{g__journal_8c_a07d59cff225430fd7a093e3dc6418bf4}{g\_journal\_sync}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02034}02034         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02035}02035         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02036}02036 \textcolor{comment}{         * Check if we can use BIO\_FLUSH.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02037}02037 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02038}02038         sc-\/>\mbox{\hyperlink{structg__journal__softc_a0e26ef6063432e60ca297e64db6fc858}{sc\_bio\_flush}} = 0;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02039}02039         \textcolor{keywordflow}{if} (\mbox{\hyperlink{geom_8h_ac6fb73d666033fb395f7beaf2d6caa46}{g\_io\_flush}}(sc-\/>\mbox{\hyperlink{structg__journal__softc_a2d40c99cf9409278e8447f5b5e986e1b}{sc\_jconsumer}}) == 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02040}02040                 sc-\/>\mbox{\hyperlink{structg__journal__softc_a0e26ef6063432e60ca297e64db6fc858}{sc\_bio\_flush}} |= \mbox{\hyperlink{g__journal_8h_a4206712278068a8bc501dce5a97212f6}{GJ\_FLUSH\_JOURNAL}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02041}02041                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(1, \textcolor{stringliteral}{"{}BIO\_FLUSH supported by \%s."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02042}02042                     sc-\/>\mbox{\hyperlink{structg__journal__softc_a2d40c99cf9409278e8447f5b5e986e1b}{sc\_jconsumer}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02043}02043         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02044}02044                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(0, \textcolor{stringliteral}{"{}BIO\_FLUSH not supported by \%s."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02045}02045                     sc-\/>\mbox{\hyperlink{structg__journal__softc_a2d40c99cf9409278e8447f5b5e986e1b}{sc\_jconsumer}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02046}02046         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02047}02047         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_a2d40c99cf9409278e8447f5b5e986e1b}{sc\_jconsumer}} != sc-\/>\mbox{\hyperlink{structg__journal__softc_a2c73cf0fe40ed3f96de698010a994b05}{sc\_dconsumer}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02048}02048                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{geom_8h_ac6fb73d666033fb395f7beaf2d6caa46}{g\_io\_flush}}(sc-\/>\mbox{\hyperlink{structg__journal__softc_a2c73cf0fe40ed3f96de698010a994b05}{sc\_dconsumer}}) == 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02049}02049                         sc-\/>\mbox{\hyperlink{structg__journal__softc_a0e26ef6063432e60ca297e64db6fc858}{sc\_bio\_flush}} |= \mbox{\hyperlink{g__journal_8h_a306b25ba1d9927e810be3b34e1d51b2d}{GJ\_FLUSH\_DATA}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02050}02050                         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(1, \textcolor{stringliteral}{"{}BIO\_FLUSH supported by \%s."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02051}02051                             sc-\/>\mbox{\hyperlink{structg__journal__softc_a2c73cf0fe40ed3f96de698010a994b05}{sc\_dconsumer}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02052}02052                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02053}02053                         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(0, \textcolor{stringliteral}{"{}BIO\_FLUSH not supported by \%s."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02054}02054                             sc-\/>\mbox{\hyperlink{structg__journal__softc_a2c73cf0fe40ed3f96de698010a994b05}{sc\_dconsumer}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02055}02055                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02056}02056         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02057}02057 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02058}02058         \mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}} = sc-\/>\mbox{\hyperlink{structg__journal__softc_a51a9b0d797af1a185e8b83654fcf5739}{sc\_geom}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02059}02059         \mbox{\hyperlink{geom_8h_a232419d2cfa06ff3f4ff7551041aed31}{g\_topology\_lock}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02060}02060         \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}} = \mbox{\hyperlink{geom_8h_a79a5fe6e79cbc1a257454a3554fa11ef}{g\_new\_providerf}}(\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}, \textcolor{stringliteral}{"{}\%s.journal"{}}, sc-\/>sc\_name);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02061}02061         \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a8f47c464c78aa91fa4ca5143ed3cd15e}{mediasize}} = sc-\/>\mbox{\hyperlink{structg__journal__softc_adab99b42350c6b45efa59db9bcfb941b}{sc\_mediasize}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02062}02062         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02063}02063 \textcolor{comment}{         * There could be a problem when data provider and journal providers}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02064}02064 \textcolor{comment}{         * have different sectorsize, but such scenario is prevented on journal}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02065}02065 \textcolor{comment}{         * creation.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02066}02066 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02067}02067         \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}} = sc-\/>\mbox{\hyperlink{structg__journal__softc_a54239fc2c08c80bd5c1f286e61fb6d34}{sc\_sectorsize}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02068}02068         \mbox{\hyperlink{geom_8h_a7a46b49361266e9bb4b1441aade2c48f}{g\_error\_provider}}(\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}, 0);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02069}02069         \mbox{\hyperlink{geom_8h_a4628d4de49ba84e7a6126cc30d23b83a}{g\_topology\_unlock}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02070}02070         last\_write = time\_second;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02071}02071 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02072}02072         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_ac4035d64a95a9754671ed195eeb25cf5}{sc\_rootmount}} != NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02073}02073                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(1, \textcolor{stringliteral}{"{}root\_mount\_rel \%p"{}}, sc-\/>\mbox{\hyperlink{structg__journal__softc_ac4035d64a95a9754671ed195eeb25cf5}{sc\_rootmount}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02074}02074                 root\_mount\_rel(sc-\/>\mbox{\hyperlink{structg__journal__softc_ac4035d64a95a9754671ed195eeb25cf5}{sc\_rootmount}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02075}02075                 sc-\/>\mbox{\hyperlink{structg__journal__softc_ac4035d64a95a9754671ed195eeb25cf5}{sc\_rootmount}} = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02076}02076         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02077}02077 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02078}02078         \textcolor{keywordflow}{for} (;;) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02079}02079                 \textcolor{comment}{/* Get first request from the queue. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02080}02080                 mtx\_lock(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02081}02081                 \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}} = bioq\_first(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac33096547f31266b12f553f3a3723b5c}{sc\_back\_queue}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02082}02082                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}} != NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02083}02083                         \mbox{\hyperlink{geom__flashmap_8c_a763fd8db6bba8fbbbc113ca0d61c47c2}{type}} = (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_cflags \& \mbox{\hyperlink{g__journal_8h_a57fd8f2b545755886d04b4a7a705db25}{GJ\_BIO\_MASK}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02084}02084                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02085}02085                         \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}} = bioq\_first(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_a70a954323378094324a9ac266a67e451}{sc\_regular\_queue}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02086}02086                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}} != NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02087}02087                                 \mbox{\hyperlink{geom__flashmap_8c_a763fd8db6bba8fbbbc113ca0d61c47c2}{type}} = \mbox{\hyperlink{g__journal_8h_ad07e75619e5860b2092435ea258323ac}{GJ\_BIO\_REGULAR}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02088}02088                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02089}02089                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02090}02090 try\_switch:}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02091}02091                         \textcolor{keywordflow}{if} ((sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} \& \mbox{\hyperlink{g__journal_8h_a284256c54ae71bcb77628f7704b8a69c}{GJF\_DEVICE\_SWITCH}}) ||}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02092}02092                             (sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} \& \mbox{\hyperlink{g__journal_8h_a097061ce64a6042ebdcd0e0ed18bf0f0}{GJF\_DEVICE\_DESTROY}})) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02093}02093                                 \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_a688ea27b33109df148793597cbebd136}{sc\_current\_count}} > 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02094}02094                                         mtx\_unlock(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02095}02095                                         \mbox{\hyperlink{g__journal_8c_a575f3535ee1e83d60aa0af67a0cffede}{g\_journal\_flush}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02096}02096                                         \mbox{\hyperlink{g__journal_8c_a0aeb9ca2d629378464f4d3fb4b27cac9}{g\_journal\_flush\_send}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02097}02097                                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02098}02098                                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02099}02099                                 \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_aafc53963c19cdb0ceb350770db5fc8e6}{sc\_flush\_in\_progress}} > 0)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02100}02100                                         \textcolor{keywordflow}{goto} sleep;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02101}02101                                 \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_ace2dfb947e35203d5fbfcb760c048ed3}{sc\_copy\_in\_progress}} > 0)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02102}02102                                         \textcolor{keywordflow}{goto} sleep;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02103}02103                         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02104}02104                         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} \& \mbox{\hyperlink{g__journal_8h_a284256c54ae71bcb77628f7704b8a69c}{GJF\_DEVICE\_SWITCH}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02105}02105                                 mtx\_unlock(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02106}02106                                 \mbox{\hyperlink{g__journal_8c_a07429553752a565de68798d6e26b46d0}{g\_journal\_switch}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02107}02107                                 wakeup(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac51f404c529e60a3d430f31b1702d470}{sc\_journal\_copying}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02108}02108                                 \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02109}02109                         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02110}02110                         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} \& \mbox{\hyperlink{g__journal_8h_a097061ce64a6042ebdcd0e0ed18bf0f0}{GJF\_DEVICE\_DESTROY}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02111}02111                                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(1, \textcolor{stringliteral}{"{}Shutting down worker "{}}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02112}02112                                     \textcolor{stringliteral}{"{}thread for \%s."{}}, \mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}-\/>\mbox{\hyperlink{structg__geom_af64450500f1fea18f639b191a5017107}{name}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02113}02113                                 sc-\/>\mbox{\hyperlink{structg__journal__softc_adb2f89ec76f1e3fe2f0d4406aad2424f}{sc\_worker}} = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02114}02114                                 wakeup(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_adb2f89ec76f1e3fe2f0d4406aad2424f}{sc\_worker}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02115}02115                                 mtx\_unlock(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02116}02116                                 kproc\_exit(0);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02117}02117                         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02118}02118 sleep:}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02119}02119                         \mbox{\hyperlink{g__journal_8c_a8917c504f27f26bc0fbdb9b1c5d9b584}{g\_journal\_wait}}(sc, last\_write);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02120}02120                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02121}02121                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02122}02122                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02123}02123 \textcolor{comment}{                 * If we're in switch process, we need to delay all new}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02124}02124 \textcolor{comment}{                 * write requests until its done.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02125}02125 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02126}02126                 \textcolor{keywordflow}{if} ((sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} \& \mbox{\hyperlink{g__journal_8h_a284256c54ae71bcb77628f7704b8a69c}{GJF\_DEVICE\_SWITCH}}) \&\&}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02127}02127                     \mbox{\hyperlink{geom__flashmap_8c_a763fd8db6bba8fbbbc113ca0d61c47c2}{type}} == \mbox{\hyperlink{g__journal_8h_ad07e75619e5860b2092435ea258323ac}{GJ\_BIO\_REGULAR}} \&\& \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_cmd == BIO\_WRITE) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02128}02128                         \mbox{\hyperlink{g__journal_8h_a697a75aa6d57b466f68361b521621f70}{GJ\_LOGREQ}}(2, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \textcolor{stringliteral}{"{}WRITE on SWITCH"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02129}02129                         \textcolor{keywordflow}{goto} try\_switch;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02130}02130                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02131}02131                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{geom__flashmap_8c_a763fd8db6bba8fbbbc113ca0d61c47c2}{type}} == \mbox{\hyperlink{g__journal_8h_ad07e75619e5860b2092435ea258323ac}{GJ\_BIO\_REGULAR}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02132}02132                         bioq\_remove(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_a70a954323378094324a9ac266a67e451}{sc\_regular\_queue}}, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02133}02133                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02134}02134                         bioq\_remove(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac33096547f31266b12f553f3a3723b5c}{sc\_back\_queue}}, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02135}02135                 mtx\_unlock(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02136}02136                 \textcolor{keywordflow}{switch} (\mbox{\hyperlink{geom__flashmap_8c_a763fd8db6bba8fbbbc113ca0d61c47c2}{type}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02137}02137                 \textcolor{keywordflow}{case} \mbox{\hyperlink{g__journal_8h_ad07e75619e5860b2092435ea258323ac}{GJ\_BIO\_REGULAR}}:}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02138}02138                         \textcolor{comment}{/* Regular request. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02139}02139                         \textcolor{keywordflow}{switch} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_cmd) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02140}02140                         \textcolor{keywordflow}{case} BIO\_READ:}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02141}02141                                 \mbox{\hyperlink{g__journal_8c_aa839adcb51dc12a388d6d8e35d560dce}{g\_journal\_read}}(sc, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_offset,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02142}02142                                     \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_offset + \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_length);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02143}02143                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02144}02144                         \textcolor{keywordflow}{case} BIO\_WRITE:}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02145}02145                                 last\_write = time\_second;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02146}02146                                 \mbox{\hyperlink{g__journal_8c_abd31fbfa2473f5b7749b8ac4e7d19a08}{g\_journal\_add\_request}}(sc, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02147}02147                                 \mbox{\hyperlink{g__journal_8c_a0aeb9ca2d629378464f4d3fb4b27cac9}{g\_journal\_flush\_send}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02148}02148                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02149}02149                         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02150}02150                                 panic(\textcolor{stringliteral}{"{}Invalid bio\_cmd (\%d)."{}}, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_cmd);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02151}02151                         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02152}02152                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02153}02153                 \textcolor{keywordflow}{case} \mbox{\hyperlink{g__journal_8h_a9e97c0ca13e04e11ad2275522ab10049}{GJ\_BIO\_COPY}}:}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02154}02154                         \textcolor{keywordflow}{switch} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_cmd) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02155}02155                         \textcolor{keywordflow}{case} BIO\_READ:}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02156}02156                                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__journal_8c_a4cbf5050a604c49eac6f05dee9acdab7}{g\_journal\_copy\_read\_done}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}))}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02157}02157                                         \mbox{\hyperlink{g__journal_8c_ae15c00ec3191c866cccd51420e0b5b00}{g\_journal\_copy\_send}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02158}02158                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02159}02159                         \textcolor{keywordflow}{case} BIO\_WRITE:}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02160}02160                                 \mbox{\hyperlink{g__journal_8c_a92165bcc23bd35b82c8dcefa13583d79}{g\_journal\_copy\_write\_done}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02161}02161                                 \mbox{\hyperlink{g__journal_8c_ae15c00ec3191c866cccd51420e0b5b00}{g\_journal\_copy\_send}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02162}02162                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02163}02163                         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02164}02164                                 panic(\textcolor{stringliteral}{"{}Invalid bio\_cmd (\%d)."{}}, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_cmd);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02165}02165                         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02166}02166                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02167}02167                 \textcolor{keywordflow}{case} \mbox{\hyperlink{g__journal_8h_a13868d0dc5864846635de9f79066279a}{GJ\_BIO\_JOURNAL}}:}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02168}02168                         \mbox{\hyperlink{g__journal_8c_a7ef1d2d92b61fedadc1078a7efacaafa}{g\_journal\_flush\_done}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02169}02169                         \mbox{\hyperlink{g__journal_8c_a0aeb9ca2d629378464f4d3fb4b27cac9}{g\_journal\_flush\_send}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02170}02170                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02171}02171                 \textcolor{keywordflow}{case} \mbox{\hyperlink{g__journal_8h_a1f459d8c960d1c1af1db09b614e6dc59}{GJ\_BIO\_READ}}:}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02172}02172                 \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02173}02173                         panic(\textcolor{stringliteral}{"{}Invalid bio (\%d)."{}}, \mbox{\hyperlink{geom__flashmap_8c_a763fd8db6bba8fbbbc113ca0d61c47c2}{type}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02174}02174                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02175}02175         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02176}02176 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02177}02177 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02178}02178 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02179}\mbox{\hyperlink{g__journal_8c_a8a443bab270dba7eac5fd7cbba603a5d}{02179}} \mbox{\hyperlink{g__journal_8c_a8a443bab270dba7eac5fd7cbba603a5d}{g\_journal\_destroy\_event}}(\textcolor{keywordtype}{void} *arg, \textcolor{keywordtype}{int} flags \_\_unused)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02180}02180 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02181}02181         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02182}02182 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02183}02183         \mbox{\hyperlink{geom_8h_a1898dc8c812faa5de231ab840e8562bf}{g\_topology\_assert}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02184}02184         sc = arg;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02185}02185         \mbox{\hyperlink{g__journal_8c_aa4185d491be0d4398d14c324ea2e4e4f}{g\_journal\_destroy}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02186}02186 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02187}02187 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02188}02188 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02189}\mbox{\hyperlink{g__journal_8c_a22160f2dac01cf07e1b7354397e7b111}{02189}} \mbox{\hyperlink{g__journal_8c_a22160f2dac01cf07e1b7354397e7b111}{g\_journal\_timeout}}(\textcolor{keywordtype}{void} *arg)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02190}02190 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02191}02191         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02192}02192 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02193}02193         sc = arg;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02194}02194         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(0, \textcolor{stringliteral}{"{}Timeout. Journal \%s cannot be completed."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02195}02195             sc-\/>\mbox{\hyperlink{structg__journal__softc_a51a9b0d797af1a185e8b83654fcf5739}{sc\_geom}}-\/>\mbox{\hyperlink{structg__geom_af64450500f1fea18f639b191a5017107}{name}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02196}02196         \mbox{\hyperlink{geom_8h_a196998b2923eb556355a617daaef1879}{g\_post\_event}}(\mbox{\hyperlink{g__journal_8c_a8a443bab270dba7eac5fd7cbba603a5d}{g\_journal\_destroy\_event}}, sc, M\_NOWAIT, NULL);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02197}02197 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02198}02198 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02199}02199 \textcolor{keyword}{static} \textcolor{keyword}{struct }\mbox{\hyperlink{structg__geom}{g\_geom}} *}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02200}\mbox{\hyperlink{g__journal_8c_aab6f8d010ea343c7f0bf186df3253c94}{02200}} \mbox{\hyperlink{g__journal_8c_aab6f8d010ea343c7f0bf186df3253c94}{g\_journal\_create}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__class}{g\_class}} *\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}, \textcolor{keyword}{struct} \mbox{\hyperlink{structg__provider}{g\_provider}} *\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02201}02201     \textcolor{keyword}{const} \textcolor{keyword}{struct} \mbox{\hyperlink{structg__journal__metadata}{g\_journal\_metadata}} *md)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02202}02202 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02203}02203         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02204}02204         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__geom}{g\_geom}} *\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02205}02205         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__consumer}{g\_consumer}} *\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02206}02206         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02207}02207 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02208}02208         sc = NULL;      \textcolor{comment}{/* gcc */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02209}02209 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02210}02210         \mbox{\hyperlink{geom_8h_a1898dc8c812faa5de231ab840e8562bf}{g\_topology\_assert}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02211}02211         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02212}02212 \textcolor{comment}{         * There are two possibilities:}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02213}02213 \textcolor{comment}{         * 1. Data and both journals are on the same provider.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02214}02214 \textcolor{comment}{         * 2. Data and journals are all on separated providers.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02215}02215 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02216}02216         \textcolor{comment}{/* Look for journal device with the same ID. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02217}02217         LIST\_FOREACH(\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}, \&\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}-\/>geom, \mbox{\hyperlink{structg__consumer_a75734fc8cd22ffc4209c36cc0a459cba}{geom}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02218}02218                 sc = \mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}-\/>\mbox{\hyperlink{structg__geom_aa83c08c83459420f6cbcfe64c6099466}{softc}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02219}02219                 \textcolor{keywordflow}{if} (sc == NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02220}02220                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02221}02221                 \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_ad4d04ff053d5c7f2bdbb0237afccdb25}{sc\_id}} == md-\/>\mbox{\hyperlink{structg__journal__metadata_a5dc43a9005dfbe7829d47c73cd0341dc}{md\_id}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02222}02222                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02223}02223         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02224}02224         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}} == NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02225}02225                 sc = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02226}02226         \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (sc != NULL \&\& (sc-\/>\mbox{\hyperlink{structg__journal__softc_affbf58ba9d075b00d0dd9011c987ce4b}{sc\_type}} \& md-\/>\mbox{\hyperlink{structg__journal__metadata_aa01eecd641f70f2d628efb97da4a1a0b}{md\_type}}) != 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02227}02227                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(1, \textcolor{stringliteral}{"{}Journal device \%u already configured."{}}, sc-\/>\mbox{\hyperlink{structg__journal__softc_ad4d04ff053d5c7f2bdbb0237afccdb25}{sc\_id}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02228}02228                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02229}02229         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02230}02230         \textcolor{keywordflow}{if} (md-\/>\mbox{\hyperlink{structg__journal__metadata_aa01eecd641f70f2d628efb97da4a1a0b}{md\_type}} == 0 || (md-\/>\mbox{\hyperlink{structg__journal__metadata_aa01eecd641f70f2d628efb97da4a1a0b}{md\_type}} \& \string~\mbox{\hyperlink{g__journal_8h_aa310bc95d7cd624455b948f4488e54e4}{GJ\_TYPE\_COMPLETE}}) != 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02231}02231                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(0, \textcolor{stringliteral}{"{}Invalid type on \%s."{}}, \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02232}02232                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02233}02233         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02234}02234         \textcolor{keywordflow}{if} (md-\/>\mbox{\hyperlink{structg__journal__metadata_aa01eecd641f70f2d628efb97da4a1a0b}{md\_type}} \& \mbox{\hyperlink{g__journal_8h_ae1795c12a8a172387ca98bcb4f16f9a1}{GJ\_TYPE\_DATA}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02235}02235                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(0, \textcolor{stringliteral}{"{}Journal \%u: \%s contains data."{}}, md-\/>\mbox{\hyperlink{structg__journal__metadata_a5dc43a9005dfbe7829d47c73cd0341dc}{md\_id}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02236}02236                     \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02237}02237         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02238}02238         \textcolor{keywordflow}{if} (md-\/>\mbox{\hyperlink{structg__journal__metadata_aa01eecd641f70f2d628efb97da4a1a0b}{md\_type}} \& \mbox{\hyperlink{g__journal_8h_a5bed77e33a8f180e5e8be703e7937781}{GJ\_TYPE\_JOURNAL}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02239}02239                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(0, \textcolor{stringliteral}{"{}Journal \%u: \%s contains journal."{}}, md-\/>\mbox{\hyperlink{structg__journal__metadata_a5dc43a9005dfbe7829d47c73cd0341dc}{md\_id}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02240}02240                     \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02241}02241         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02242}02242 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02243}02243         \textcolor{keywordflow}{if} (sc == NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02244}02244                 \textcolor{comment}{/* Action geom. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02245}02245                 sc = malloc(\textcolor{keyword}{sizeof}(*sc), M\_JOURNAL, M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02246}02246                 sc-\/>\mbox{\hyperlink{structg__journal__softc_ad4d04ff053d5c7f2bdbb0237afccdb25}{sc\_id}} = md-\/>\mbox{\hyperlink{structg__journal__metadata_a5dc43a9005dfbe7829d47c73cd0341dc}{md\_id}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02247}02247                 sc-\/>\mbox{\hyperlink{structg__journal__softc_affbf58ba9d075b00d0dd9011c987ce4b}{sc\_type}} = 0;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02248}02248                 sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} = 0;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02249}02249                 sc-\/>\mbox{\hyperlink{structg__journal__softc_adb2f89ec76f1e3fe2f0d4406aad2424f}{sc\_worker}} = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02250}02250 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02251}02251                 \mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}} = \mbox{\hyperlink{geom_8h_a4000befe2ff4b405b8333ccc5b0fdb41}{g\_new\_geomf}}(\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}, \textcolor{stringliteral}{"{}gjournal \%u"{}}, sc-\/>\mbox{\hyperlink{structg__journal__softc_ad4d04ff053d5c7f2bdbb0237afccdb25}{sc\_id}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02252}02252                 \mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}-\/>\mbox{\hyperlink{structg__geom_a160a0c74f128936d97064e56052dc2ef}{start}} = \mbox{\hyperlink{g__journal_8c_a9198b68f1d94893dabcb8e0fb4197d47}{g\_journal\_start}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02253}02253                 \mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}-\/>\mbox{\hyperlink{structg__geom_a67386b3b9a49233eca9f73d28bc70325}{orphan}} = \mbox{\hyperlink{g__journal_8c_afe714d45f3038249bb3f76604ccc357b}{g\_journal\_orphan}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02254}02254                 \mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}-\/>\mbox{\hyperlink{structg__geom_aea05083928dcabdb4d343c6b9ee71cbd}{access}} = \mbox{\hyperlink{g__journal_8c_a108b61ccebca01262da2f944431b54e0}{g\_journal\_access}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02255}02255                 \mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}-\/>\mbox{\hyperlink{structg__geom_aa83c08c83459420f6cbcfe64c6099466}{softc}} = sc;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02256}02256                 \mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}-\/>\mbox{\hyperlink{structg__geom_afa218bd6b4ead71e6238ecd0577e1cc9}{flags}} |= \mbox{\hyperlink{geom_8h_aef91738a9019f4ab58b8f8f5eafdbcae}{G\_GEOM\_VOLATILE\_BIO}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02257}02257                 sc-\/>\mbox{\hyperlink{structg__journal__softc_a51a9b0d797af1a185e8b83654fcf5739}{sc\_geom}} = \mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02258}02258 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02259}02259                 mtx\_init(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}}, \textcolor{stringliteral}{"{}gjournal"{}}, NULL, MTX\_DEF);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02260}02260 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02261}02261                 bioq\_init(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac33096547f31266b12f553f3a3723b5c}{sc\_back\_queue}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02262}02262                 bioq\_init(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_a70a954323378094324a9ac266a67e451}{sc\_regular\_queue}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02263}02263                 bioq\_init(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_aaa9e86a79acba05e05a87d2f6f019444}{sc\_delayed\_queue}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02264}02264                 sc-\/>\mbox{\hyperlink{structg__journal__softc_a209e8528ae353cb8a3b65285e9226075}{sc\_delayed\_count}} = 0;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02265}02265                 sc-\/>\mbox{\hyperlink{structg__journal__softc_a40d0c669492533bf654630781eac500f}{sc\_current\_queue}} = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02266}02266                 sc-\/>\mbox{\hyperlink{structg__journal__softc_a688ea27b33109df148793597cbebd136}{sc\_current\_count}} = 0;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02267}02267                 sc-\/>\mbox{\hyperlink{structg__journal__softc_ab1578f4ceb0796dd74b9bb122da6dfea}{sc\_flush\_queue}} = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02268}02268                 sc-\/>\mbox{\hyperlink{structg__journal__softc_a8d2bd7d1d242f1d7b05363588548211d}{sc\_flush\_count}} = 0;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02269}02269                 sc-\/>\mbox{\hyperlink{structg__journal__softc_aafc53963c19cdb0ceb350770db5fc8e6}{sc\_flush\_in\_progress}} = 0;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02270}02270                 sc-\/>\mbox{\hyperlink{structg__journal__softc_a04ee9c4a46b57eb304adedbdb15681c7}{sc\_copy\_queue}} = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02271}02271                 sc-\/>\mbox{\hyperlink{structg__journal__softc_ace2dfb947e35203d5fbfcb760c048ed3}{sc\_copy\_in\_progress}} = 0;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02272}02272                 sc-\/>\mbox{\hyperlink{structg__journal__softc_a9ed37f4f4b73662640e4dcbeb0f6083f}{sc\_inactive}}.\mbox{\hyperlink{structg__journal__journal_a857814a0d0fd54d26a70d888c5f082d9}{jj\_queue}} = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02273}02273                 sc-\/>\mbox{\hyperlink{structg__journal__softc_a869b0f971a3b94af08789ac382471913}{sc\_active}}.\mbox{\hyperlink{structg__journal__journal_a857814a0d0fd54d26a70d888c5f082d9}{jj\_queue}} = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02274}02274 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02275}02275                 sc-\/>\mbox{\hyperlink{structg__journal__softc_ac4035d64a95a9754671ed195eeb25cf5}{sc\_rootmount}} = root\_mount\_hold(\textcolor{stringliteral}{"{}GJOURNAL"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02276}02276                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(1, \textcolor{stringliteral}{"{}root\_mount\_hold \%p"{}}, sc-\/>\mbox{\hyperlink{structg__journal__softc_ac4035d64a95a9754671ed195eeb25cf5}{sc\_rootmount}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02277}02277 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02278}02278                 callout\_init(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_a5b8a07252cdedc8c46d26af20f42a9e3}{sc\_callout}}, 1);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02279}02279                 \textcolor{keywordflow}{if} (md-\/>\mbox{\hyperlink{structg__journal__metadata_aa01eecd641f70f2d628efb97da4a1a0b}{md\_type}} != \mbox{\hyperlink{g__journal_8h_aa310bc95d7cd624455b948f4488e54e4}{GJ\_TYPE\_COMPLETE}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02280}02280                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02281}02281 \textcolor{comment}{                         * Journal and data are on separate providers.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02282}02282 \textcolor{comment}{                         * At this point we have only one of them.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02283}02283 \textcolor{comment}{                         * We setup a timeout in case the other part will not}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02284}02284 \textcolor{comment}{                         * appear, so we won't wait forever.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02285}02285 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02286}02286                         callout\_reset(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_a5b8a07252cdedc8c46d26af20f42a9e3}{sc\_callout}}, 5 * hz,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02287}02287                             \mbox{\hyperlink{g__journal_8c_a22160f2dac01cf07e1b7354397e7b111}{g\_journal\_timeout}}, sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02288}02288                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02289}02289         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02290}02290 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02291}02291         \textcolor{comment}{/* Remember type of the data provider. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02292}02292         \textcolor{keywordflow}{if} (md-\/>\mbox{\hyperlink{structg__journal__metadata_aa01eecd641f70f2d628efb97da4a1a0b}{md\_type}} \& \mbox{\hyperlink{g__journal_8h_ae1795c12a8a172387ca98bcb4f16f9a1}{GJ\_TYPE\_DATA}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02293}02293                 sc-\/>\mbox{\hyperlink{structg__journal__softc_abaaa31cfe24844203f9e6708489dc266}{sc\_orig\_type}} = md-\/>\mbox{\hyperlink{structg__journal__metadata_aa01eecd641f70f2d628efb97da4a1a0b}{md\_type}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02294}02294         sc-\/>\mbox{\hyperlink{structg__journal__softc_affbf58ba9d075b00d0dd9011c987ce4b}{sc\_type}} |= md-\/>\mbox{\hyperlink{structg__journal__metadata_aa01eecd641f70f2d628efb97da4a1a0b}{md\_type}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02295}02295         \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}} = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02296}02296 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02297}02297         \textcolor{keywordflow}{if} (md-\/>\mbox{\hyperlink{structg__journal__metadata_aa01eecd641f70f2d628efb97da4a1a0b}{md\_type}} \& \mbox{\hyperlink{g__journal_8h_ae1795c12a8a172387ca98bcb4f16f9a1}{GJ\_TYPE\_DATA}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02298}02298                 \textcolor{keywordflow}{if} (md-\/>\mbox{\hyperlink{structg__journal__metadata_ac9e9bcf8605af45a86063ce7e5e87105}{md\_flags}} \& \mbox{\hyperlink{g__journal_8h_afcb6e4a7105e4952108886c7b8939b82}{GJ\_FLAG\_CLEAN}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02299}02299                         sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} |= \mbox{\hyperlink{g__journal_8h_af2320e129d03ae46e724751b00a2af3e}{GJF\_DEVICE\_CLEAN}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02300}02300                 \textcolor{keywordflow}{if} (md-\/>\mbox{\hyperlink{structg__journal__metadata_ac9e9bcf8605af45a86063ce7e5e87105}{md\_flags}} \& \mbox{\hyperlink{g__journal_8h_a236461e001fcea8843278ffef4d03efa}{GJ\_FLAG\_CHECKSUM}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02301}02301                         sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} |= \mbox{\hyperlink{g__journal_8h_aea5a82d1ec806f852899df9fc46ad1d1}{GJF\_DEVICE\_CHECKSUM}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02302}02302                 \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}} = \mbox{\hyperlink{geom_8h_aef9ca3f0eecc1b245c3c9cd0bac1cdc4}{g\_new\_consumer}}(\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02303}02303                 error = \mbox{\hyperlink{geom_8h_a7f6ee69db47bae6ff5284f6a9cfceb91}{g\_attach}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}, \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02304}02304                 KASSERT(error == 0, (\textcolor{stringliteral}{"{}Cannot attach to \%s (error=\%d)."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02305}02305                     \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}}, error));}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02306}02306                 error = \mbox{\hyperlink{geom_8h_a27b7c72cc3bc5a4d07ce5976e1aa1b58}{g\_access}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}, 1, 1, 1);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02307}02307                 \textcolor{keywordflow}{if} (error != 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02308}02308                         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(0, \textcolor{stringliteral}{"{}Cannot access \%s (error=\%d)."{}}, \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02309}02309                             error);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02310}02310                         \mbox{\hyperlink{g__journal_8c_aa4185d491be0d4398d14c324ea2e4e4f}{g\_journal\_destroy}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02311}02311                         \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02312}02312                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02313}02313                 sc-\/>\mbox{\hyperlink{structg__journal__softc_a2c73cf0fe40ed3f96de698010a994b05}{sc\_dconsumer}} = \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02314}02314                 sc-\/>\mbox{\hyperlink{structg__journal__softc_adab99b42350c6b45efa59db9bcfb941b}{sc\_mediasize}} = \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a8f47c464c78aa91fa4ca5143ed3cd15e}{mediasize}} -\/ \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02315}02315                 sc-\/>\mbox{\hyperlink{structg__journal__softc_a54239fc2c08c80bd5c1f286e61fb6d34}{sc\_sectorsize}} = \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02316}02316                 sc-\/>\mbox{\hyperlink{structg__journal__softc_a89bc44b8276a4b18afb4ea756b86f76a}{sc\_jstart}} = md-\/>\mbox{\hyperlink{structg__journal__metadata_a161b605943d7b1005e9b4310d45242e0}{md\_jstart}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02317}02317                 sc-\/>\mbox{\hyperlink{structg__journal__softc_a4ed217d1be380b3a2282f9bf1a0906bd}{sc\_jend}} = md-\/>\mbox{\hyperlink{structg__journal__metadata_a73498a247839e33b3c38546e1b73a03e}{md\_jend}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02318}02318                 \textcolor{keywordflow}{if} (md-\/>\mbox{\hyperlink{structg__journal__metadata_a06c46f5cc5497d01af06948f12b7689e}{md\_provider}}[0] != \textcolor{charliteral}{'\(\backslash\)0'})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02319}02319                         sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} |= \mbox{\hyperlink{g__journal_8h_a476f7c0be9c1a241da40846054d7e039}{GJF\_DEVICE\_HARDCODED}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02320}02320                 sc-\/>\mbox{\hyperlink{structg__journal__softc_aaf90f8a9abf8bb358b209fbc1d2b266d}{sc\_journal\_offset}} = md-\/>\mbox{\hyperlink{structg__journal__metadata_a260898232f5a7624907ab38f5e6347d8}{md\_joffset}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02321}02321                 sc-\/>\mbox{\hyperlink{structg__journal__softc_a23dd6d034b275e5f86277ffc064f4846}{sc\_journal\_id}} = md-\/>\mbox{\hyperlink{structg__journal__metadata_a7a3b45b1fa814639d08f2acc9708a483}{md\_jid}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02322}02322                 sc-\/>\mbox{\hyperlink{structg__journal__softc_a08ac88f8906b7fa09718ce9d3594c946}{sc\_journal\_previous\_id}} = md-\/>\mbox{\hyperlink{structg__journal__metadata_a7a3b45b1fa814639d08f2acc9708a483}{md\_jid}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02323}02323         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02324}02324         \textcolor{keywordflow}{if} (md-\/>\mbox{\hyperlink{structg__journal__metadata_aa01eecd641f70f2d628efb97da4a1a0b}{md\_type}} \& \mbox{\hyperlink{g__journal_8h_a5bed77e33a8f180e5e8be703e7937781}{GJ\_TYPE\_JOURNAL}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02325}02325                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02326}02326                         \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}} = \mbox{\hyperlink{geom_8h_aef9ca3f0eecc1b245c3c9cd0bac1cdc4}{g\_new\_consumer}}(\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02327}02327                         error = \mbox{\hyperlink{geom_8h_a7f6ee69db47bae6ff5284f6a9cfceb91}{g\_attach}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}, \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02328}02328                         KASSERT(error == 0, (\textcolor{stringliteral}{"{}Cannot attach to \%s (error=\%d)."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02329}02329                             \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}}, error));}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02330}02330                         error = \mbox{\hyperlink{geom_8h_a27b7c72cc3bc5a4d07ce5976e1aa1b58}{g\_access}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}, 1, 1, 1);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02331}02331                         \textcolor{keywordflow}{if} (error != 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02332}02332                                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(0, \textcolor{stringliteral}{"{}Cannot access \%s (error=\%d)."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02333}02333                                     \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}}, error);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02334}02334                                 \mbox{\hyperlink{g__journal_8c_aa4185d491be0d4398d14c324ea2e4e4f}{g\_journal\_destroy}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02335}02335                                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02336}02336                         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02337}02337                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02338}02338                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02339}02339 \textcolor{comment}{                         * Journal is on the same provider as data, which means}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02340}02340 \textcolor{comment}{                         * that data provider ends where journal starts.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02341}02341 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02342}02342                         sc-\/>\mbox{\hyperlink{structg__journal__softc_adab99b42350c6b45efa59db9bcfb941b}{sc\_mediasize}} = md-\/>\mbox{\hyperlink{structg__journal__metadata_a161b605943d7b1005e9b4310d45242e0}{md\_jstart}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02343}02343                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02344}02344                 sc-\/>\mbox{\hyperlink{structg__journal__softc_a2d40c99cf9409278e8447f5b5e986e1b}{sc\_jconsumer}} = \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02345}02345         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02346}02346 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02347}02347         \textcolor{comment}{/* Start switcher kproc if needed. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02348}02348         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__journal_8c_a6d8764e06e60b7dbdb9961c44ce6accd}{g\_journal\_switcher\_proc}} == NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02349}02349                 \mbox{\hyperlink{g__journal_8c_a605bac3f6157a873d00e174b53047ebf}{g\_journal\_start\_switcher}}(\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02350}02350 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02351}02351         \textcolor{keywordflow}{if} ((sc-\/>\mbox{\hyperlink{structg__journal__softc_affbf58ba9d075b00d0dd9011c987ce4b}{sc\_type}} \& \mbox{\hyperlink{g__journal_8h_aa310bc95d7cd624455b948f4488e54e4}{GJ\_TYPE\_COMPLETE}}) != \mbox{\hyperlink{g__journal_8h_aa310bc95d7cd624455b948f4488e54e4}{GJ\_TYPE\_COMPLETE}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02352}02352                 \textcolor{comment}{/* Journal is not complete yet. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02353}02353                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02354}02354         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02355}02355                 \textcolor{comment}{/* Journal complete, cancel timeout. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02356}02356                 callout\_drain(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_a5b8a07252cdedc8c46d26af20f42a9e3}{sc\_callout}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02357}02357         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02358}02358 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02359}02359         error = kproc\_create(\mbox{\hyperlink{g__journal_8c_abdf9f299aadc66ab101fe91662e4263e}{g\_journal\_worker}}, sc, \&sc-\/>\mbox{\hyperlink{structg__journal__softc_adb2f89ec76f1e3fe2f0d4406aad2424f}{sc\_worker}}, 0, 0,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02360}02360             \textcolor{stringliteral}{"{}g\_journal \%s"{}}, sc-\/>sc\_name);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02361}02361         \textcolor{keywordflow}{if} (error != 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02362}02362                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(0, \textcolor{stringliteral}{"{}Cannot create worker thread for \%s.journal."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02363}02363                     sc-\/>sc\_name);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02364}02364                 \mbox{\hyperlink{g__journal_8c_aa4185d491be0d4398d14c324ea2e4e4f}{g\_journal\_destroy}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02365}02365                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02366}02366         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02367}02367 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02368}02368         \textcolor{keywordflow}{return} (\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02369}02369 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02370}02370 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02371}02371 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02372}\mbox{\hyperlink{g__journal_8c_ab3fa2f87d25ab571c9ab3c02afbc0e57}{02372}} \mbox{\hyperlink{g__journal_8c_ab3fa2f87d25ab571c9ab3c02afbc0e57}{g\_journal\_destroy\_consumer}}(\textcolor{keywordtype}{void} *arg, \textcolor{keywordtype}{int} \mbox{\hyperlink{structg__consumer_acf792357913c0445233b71f8259764d9}{flags}} \_\_unused)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02373}02373 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02374}02374         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__consumer}{g\_consumer}} *\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02375}02375 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02376}02376         \mbox{\hyperlink{geom_8h_a1898dc8c812faa5de231ab840e8562bf}{g\_topology\_assert}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02377}02377         \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}} = arg;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02378}02378         \mbox{\hyperlink{geom_8h_a037802c2ec5d43fcf1222215f9f8a735}{g\_detach}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02379}02379         \mbox{\hyperlink{geom_8h_a9f53f6118c5e44ca2bcbd7ae548597b9}{g\_destroy\_consumer}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02380}02380 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02381}02381 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02382}02382 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02383}\mbox{\hyperlink{g__journal_8c_aa4185d491be0d4398d14c324ea2e4e4f}{02383}} \mbox{\hyperlink{g__journal_8c_aa4185d491be0d4398d14c324ea2e4e4f}{g\_journal\_destroy}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02384}02384 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02385}02385         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__geom}{g\_geom}} *\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02386}02386         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__provider}{g\_provider}} *\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02387}02387         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__consumer}{g\_consumer}} *\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02388}02388 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02389}02389         \mbox{\hyperlink{geom_8h_a1898dc8c812faa5de231ab840e8562bf}{g\_topology\_assert}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02390}02390 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02391}02391         \textcolor{keywordflow}{if} (sc == NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02392}02392                 \textcolor{keywordflow}{return} (ENXIO);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02393}02393 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02394}02394         \mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}} = sc-\/>\mbox{\hyperlink{structg__journal__softc_a51a9b0d797af1a185e8b83654fcf5739}{sc\_geom}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02395}02395         \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}} = LIST\_FIRST(\&\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}-\/>provider);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02396}02396         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}} != NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02397}02397                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a62d7db6055318331bae725b44d58c140}{acr}} != 0 || \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_abc6824f999ce8b17107d833c908c83e6}{acw}} != 0 || \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_ae46b0f6e935dcb33a2a06556dbcbeb4c}{ace}} != 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02398}02398                         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(1, \textcolor{stringliteral}{"{}Device \%s is still open (r\%dw\%de\%d)."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02399}02399                             \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}}, \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a62d7db6055318331bae725b44d58c140}{acr}}, \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_abc6824f999ce8b17107d833c908c83e6}{acw}}, \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_ae46b0f6e935dcb33a2a06556dbcbeb4c}{ace}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02400}02400                         \textcolor{keywordflow}{return} (EBUSY);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02401}02401                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02402}02402                 \mbox{\hyperlink{geom_8h_a7a46b49361266e9bb4b1441aade2c48f}{g\_error\_provider}}(\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}, ENXIO);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02403}02403 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02404}02404                 \mbox{\hyperlink{g__journal_8c_a575f3535ee1e83d60aa0af67a0cffede}{g\_journal\_flush}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02405}02405                 \mbox{\hyperlink{g__journal_8c_a0aeb9ca2d629378464f4d3fb4b27cac9}{g\_journal\_flush\_send}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02406}02406                 \mbox{\hyperlink{g__journal_8c_a07429553752a565de68798d6e26b46d0}{g\_journal\_switch}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02407}02407         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02408}02408 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02409}02409         sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} |= (\mbox{\hyperlink{g__journal_8h_a097061ce64a6042ebdcd0e0ed18bf0f0}{GJF\_DEVICE\_DESTROY}} | \mbox{\hyperlink{g__journal_8h_af2320e129d03ae46e724751b00a2af3e}{GJF\_DEVICE\_CLEAN}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02410}02410 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02411}02411         \mbox{\hyperlink{geom_8h_a4628d4de49ba84e7a6126cc30d23b83a}{g\_topology\_unlock}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02412}02412 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02413}02413         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_ac4035d64a95a9754671ed195eeb25cf5}{sc\_rootmount}} != NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02414}02414                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(1, \textcolor{stringliteral}{"{}root\_mount\_rel \%p"{}}, sc-\/>\mbox{\hyperlink{structg__journal__softc_ac4035d64a95a9754671ed195eeb25cf5}{sc\_rootmount}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02415}02415                 root\_mount\_rel(sc-\/>\mbox{\hyperlink{structg__journal__softc_ac4035d64a95a9754671ed195eeb25cf5}{sc\_rootmount}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02416}02416                 sc-\/>\mbox{\hyperlink{structg__journal__softc_ac4035d64a95a9754671ed195eeb25cf5}{sc\_rootmount}} = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02417}02417         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02418}02418 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02419}02419         callout\_drain(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_a5b8a07252cdedc8c46d26af20f42a9e3}{sc\_callout}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02420}02420         mtx\_lock(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02421}02421         wakeup(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02422}02422         \textcolor{keywordflow}{while} (sc-\/>\mbox{\hyperlink{structg__journal__softc_adb2f89ec76f1e3fe2f0d4406aad2424f}{sc\_worker}} != NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02423}02423                 msleep(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_adb2f89ec76f1e3fe2f0d4406aad2424f}{sc\_worker}}, \&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}}, PRIBIO, \textcolor{stringliteral}{"{}gj:destroy"{}}, 0);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02424}02424         mtx\_unlock(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02425}02425 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02426}02426         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}} != NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02427}02427                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(1, \textcolor{stringliteral}{"{}Marking \%s as clean."{}}, sc-\/>sc\_name);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02428}02428                 \mbox{\hyperlink{g__journal_8c_aa252660794ce8d1afa9d82076c594395}{g\_journal\_metadata\_update}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02429}02429                 \mbox{\hyperlink{geom_8h_a232419d2cfa06ff3f4ff7551041aed31}{g\_topology\_lock}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02430}02430                 \mbox{\hyperlink{geom_8h_a164882713025c4e0cc58b1ac8501bcf0}{g\_wither\_provider}}(\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}, ENXIO);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02431}02431         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02432}02432                 \mbox{\hyperlink{geom_8h_a232419d2cfa06ff3f4ff7551041aed31}{g\_topology\_lock}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02433}02433         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02434}02434         mtx\_destroy(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02435}02435 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02436}02436         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_a688ea27b33109df148793597cbebd136}{sc\_current\_count}} != 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02437}02437                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(0, \textcolor{stringliteral}{"{}Warning! Number of current requests \%d."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02438}02438                     sc-\/>\mbox{\hyperlink{structg__journal__softc_a688ea27b33109df148793597cbebd136}{sc\_current\_count}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02439}02439         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02440}02440 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02441}02441         \mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}-\/>\mbox{\hyperlink{structg__geom_aa83c08c83459420f6cbcfe64c6099466}{softc}} = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02442}02442         LIST\_FOREACH(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}, \&\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}-\/>consumer, consumer) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02443}02443                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a40c3b377327dc07731eaf19340004033}{acr}} + \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a28f563df0299e7e1ab9a1121b6e483eb}{acw}} + \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_ace7a7f6859bd4cf00ff910bda08bb05a}{ace}} > 0)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02444}02444                         \mbox{\hyperlink{geom_8h_a27b7c72cc3bc5a4d07ce5976e1aa1b58}{g\_access}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}, -\/1, -\/1, -\/1);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02445}02445                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02446}02446 \textcolor{comment}{                 * We keep all consumers open for writing, so if I'll detach}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02447}02447 \textcolor{comment}{                 * and destroy consumer here, I'll get providers for taste, so}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02448}02448 \textcolor{comment}{                 * journal will be started again.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02449}02449 \textcolor{comment}{                 * Sending an event here, prevents this from happening.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02450}02450 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02451}02451                 \mbox{\hyperlink{geom_8h_a196998b2923eb556355a617daaef1879}{g\_post\_event}}(\mbox{\hyperlink{g__journal_8c_ab3fa2f87d25ab571c9ab3c02afbc0e57}{g\_journal\_destroy\_consumer}}, \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}, M\_WAITOK, NULL);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02452}02452         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02453}02453         \mbox{\hyperlink{geom_8h_a87a0eb5de79ed5e49fcfec012f213c9b}{g\_wither\_geom}}(\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}, ENXIO);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02454}02454         \mbox{\hyperlink{g__raid__md__if_8m_a4df9edb2717b3f7e4c3c903878577a54}{free}}(sc, M\_JOURNAL);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02455}02455         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02456}02456 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02457}02457 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02458}02458 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02459}\mbox{\hyperlink{g__journal_8c_ada9ac559f6c27163ddaa8702bf123930}{02459}} \mbox{\hyperlink{g__journal_8c_ada9ac559f6c27163ddaa8702bf123930}{g\_journal\_taste\_orphan}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__consumer}{g\_consumer}} *\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02460}02460 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02461}02461 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02462}02462         KASSERT(1 == 0, (\textcolor{stringliteral}{"{}\%s called while tasting \%s."{}}, \_\_func\_\_,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02463}02463             \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}}));}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02464}02464 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02465}02465 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02466}02466 \textcolor{keyword}{static} \textcolor{keyword}{struct }\mbox{\hyperlink{structg__geom}{g\_geom}} *}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02467}\mbox{\hyperlink{g__journal_8c_ac7cdc142dbfb62ed25a8e40cf258dd57}{02467}} \mbox{\hyperlink{g__journal_8c_a58b4f02835077851253b94a084862e35}{g\_journal\_taste}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__class}{g\_class}} *\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}, \textcolor{keyword}{struct} \mbox{\hyperlink{structg__provider}{g\_provider}} *\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}, \textcolor{keywordtype}{int} \mbox{\hyperlink{structg__geom_afa218bd6b4ead71e6238ecd0577e1cc9}{flags}} \_\_unused)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02468}02468 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02469}02469         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__journal__metadata}{g\_journal\_metadata}} md;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02470}02470         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__consumer}{g\_consumer}} *\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02471}02471         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__geom}{g\_geom}} *\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02472}02472         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02473}02473 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02474}02474         \mbox{\hyperlink{geom_8h_a1898dc8c812faa5de231ab840e8562bf}{g\_topology\_assert}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02475}02475         \mbox{\hyperlink{geom_8h_a7588d7ea7fbf7180b345df84b8797166}{g\_trace}}(\mbox{\hyperlink{geom_8h_a7f1804ff1a11f763a1ab5bdbd3e1287c}{G\_T\_TOPOLOGY}}, \textcolor{stringliteral}{"{}\%s(\%s, \%s)"{}}, \_\_func\_\_, \mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}-\/>\mbox{\hyperlink{structg__class_a66bf8381cf0afbf7ccdebfa6b90a4a96}{name}}, \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02476}02476         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(2, \textcolor{stringliteral}{"{}Tasting \%s."{}}, \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02477}02477         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_afe5c92b8a2a9e4cdf1cab6daa96923c1}{geom}}-\/>\mbox{\hyperlink{structg__geom_a502c2ffb3c41ad9d30d9875c678f5404}{class}} == \mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02478}02478                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02479}02479 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02480}02480         \mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}} = \mbox{\hyperlink{geom_8h_a4000befe2ff4b405b8333ccc5b0fdb41}{g\_new\_geomf}}(\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}, \textcolor{stringliteral}{"{}journal:taste"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02481}02481         \textcolor{comment}{/* This orphan function should be never called. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02482}02482         \mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}-\/>\mbox{\hyperlink{structg__geom_a67386b3b9a49233eca9f73d28bc70325}{orphan}} = \mbox{\hyperlink{g__journal_8c_ada9ac559f6c27163ddaa8702bf123930}{g\_journal\_taste\_orphan}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02483}02483         \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}} = \mbox{\hyperlink{geom_8h_aef9ca3f0eecc1b245c3c9cd0bac1cdc4}{g\_new\_consumer}}(\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02484}02484         \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_acf792357913c0445233b71f8259764d9}{flags}} |= \mbox{\hyperlink{geom_8h_a712586d00e1fe2a8069adfc048fee210}{G\_CF\_DIRECT\_SEND}} | \mbox{\hyperlink{geom_8h_a2184f2512ddb7a67ddbb71409cdd953f}{G\_CF\_DIRECT\_RECEIVE}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02485}02485         error = \mbox{\hyperlink{geom_8h_a7f6ee69db47bae6ff5284f6a9cfceb91}{g\_attach}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}, \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02486}02486         \textcolor{keywordflow}{if} (error == 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02487}02487                 error = \mbox{\hyperlink{g__journal_8c_a5819d4cbeadae30c5a863db519c44052}{g\_journal\_metadata\_read}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}, \&md);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02488}02488                 \mbox{\hyperlink{geom_8h_a037802c2ec5d43fcf1222215f9f8a735}{g\_detach}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02489}02489         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02490}02490         \mbox{\hyperlink{geom_8h_a9f53f6118c5e44ca2bcbd7ae548597b9}{g\_destroy\_consumer}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02491}02491         \mbox{\hyperlink{geom_8h_ac8307c99785f672632d3cf33134211ea}{g\_destroy\_geom}}(\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02492}02492         \textcolor{keywordflow}{if} (error != 0)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02493}02493                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02494}02494         \mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}} = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02495}02495 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02496}02496         \textcolor{keywordflow}{if} (md.\mbox{\hyperlink{structg__journal__metadata_a06c46f5cc5497d01af06948f12b7689e}{md\_provider}}[0] != \textcolor{charliteral}{'\(\backslash\)0'} \&\&}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02497}02497             !\mbox{\hyperlink{geom_8h_aa938569bc5b975d490103a88a5cfcb02}{g\_compare\_names}}(md.\mbox{\hyperlink{structg__journal__metadata_a06c46f5cc5497d01af06948f12b7689e}{md\_provider}}, \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}}))}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02498}02498                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02499}02499         \textcolor{keywordflow}{if} (md.\mbox{\hyperlink{structg__journal__metadata_a078fa8e5d14046f255e8c7e49340532f}{md\_provsize}} != 0 \&\& md.\mbox{\hyperlink{structg__journal__metadata_a078fa8e5d14046f255e8c7e49340532f}{md\_provsize}} != \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a8f47c464c78aa91fa4ca5143ed3cd15e}{mediasize}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02500}02500                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02501}02501         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__journal_8c_a46680090bf15392d6c4741f1ee1566ba}{g\_journal\_debug}} >= 2)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02502}02502                 \mbox{\hyperlink{g__journal_8h_ab70eb9d41d2420ffa311461a4db015b7}{journal\_metadata\_dump}}(\&md);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02503}02503 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02504}02504         \mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}} = \mbox{\hyperlink{g__journal_8c_aab6f8d010ea343c7f0bf186df3253c94}{g\_journal\_create}}(\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}, \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}, \&md);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02505}02505         \textcolor{keywordflow}{return} (\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02506}02506 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02507}02507 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02508}02508 \textcolor{keyword}{static} \textcolor{keyword}{struct }\mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02509}\mbox{\hyperlink{g__journal_8c_a8de5463169efd2a41fd8a1d1e70e6be5}{02509}} \mbox{\hyperlink{g__journal_8c_a8de5463169efd2a41fd8a1d1e70e6be5}{g\_journal\_find\_device}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__class}{g\_class}} *\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *\mbox{\hyperlink{g__part__if_8m_aff5d3acc33944ecb11914d04ef06bb54}{name}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02510}02510 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02511}02511         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02512}02512         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__geom}{g\_geom}} *\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02513}02513         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__provider}{g\_provider}} *\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02514}02514 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02515}02515         \textcolor{keywordflow}{if} (strncmp(\mbox{\hyperlink{g__part__if_8m_aff5d3acc33944ecb11914d04ef06bb54}{name}}, \mbox{\hyperlink{geom_8h_a9e429780e6e3bb32284b54630bc60a0d}{\_PATH\_DEV}}, 5) == 0)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02516}02516                 \mbox{\hyperlink{g__part__if_8m_aff5d3acc33944ecb11914d04ef06bb54}{name}} += 5;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02517}02517         LIST\_FOREACH(\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}, \&\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}-\/>geom, \mbox{\hyperlink{structg__provider_afe5c92b8a2a9e4cdf1cab6daa96923c1}{geom}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02518}02518                 sc = \mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}-\/>\mbox{\hyperlink{structg__geom_aa83c08c83459420f6cbcfe64c6099466}{softc}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02519}02519                 \textcolor{keywordflow}{if} (sc == NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02520}02520                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02521}02521                 \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} \& \mbox{\hyperlink{g__journal_8h_a097061ce64a6042ebdcd0e0ed18bf0f0}{GJF\_DEVICE\_DESTROY}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02522}02522                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02523}02523                 \textcolor{keywordflow}{if} ((sc-\/>\mbox{\hyperlink{structg__journal__softc_affbf58ba9d075b00d0dd9011c987ce4b}{sc\_type}} \& \mbox{\hyperlink{g__journal_8h_aa310bc95d7cd624455b948f4488e54e4}{GJ\_TYPE\_COMPLETE}}) != \mbox{\hyperlink{g__journal_8h_aa310bc95d7cd624455b948f4488e54e4}{GJ\_TYPE\_COMPLETE}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02524}02524                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02525}02525                 \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}} = LIST\_FIRST(\&\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}-\/>provider);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02526}02526                 \textcolor{keywordflow}{if} (strcmp(sc-\/>sc\_name, \mbox{\hyperlink{g__part__if_8m_aff5d3acc33944ecb11914d04ef06bb54}{name}}) == 0)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02527}02527                         \textcolor{keywordflow}{return} (sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02528}02528                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}} != NULL \&\& strcmp(\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}}, \mbox{\hyperlink{g__part__if_8m_aff5d3acc33944ecb11914d04ef06bb54}{name}}) == 0)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02529}02529                         \textcolor{keywordflow}{return} (sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02530}02530         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02531}02531         \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02532}02532 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02533}02533 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02534}02534 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02535}\mbox{\hyperlink{g__journal_8c_a46e19331e404644c3406041ab67120e7}{02535}} \mbox{\hyperlink{g__journal_8c_a46e19331e404644c3406041ab67120e7}{g\_journal\_ctl\_destroy}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structgctl__req}{gctl\_req}} *\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{keyword}{struct} \mbox{\hyperlink{structg__class}{g\_class}} *\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02536}02536 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02537}02537         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02538}02538         \textcolor{keyword}{const} \textcolor{keywordtype}{char} *\mbox{\hyperlink{g__part__if_8m_aff5d3acc33944ecb11914d04ef06bb54}{name}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02539}02539         \textcolor{keywordtype}{char} param[16];}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02540}02540         \textcolor{keywordtype}{int} *nargs;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02541}02541         \textcolor{keywordtype}{int} error, i;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02542}02542 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02543}02543         \mbox{\hyperlink{geom_8h_a1898dc8c812faa5de231ab840e8562bf}{g\_topology\_assert}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02544}02544 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02545}02545         nargs = \mbox{\hyperlink{geom_8h_ab762d12640f528d8f1f60eee92bf5f3b}{gctl\_get\_paraml}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}nargs"{}}, \textcolor{keyword}{sizeof}(*nargs));}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02546}02546         \textcolor{keywordflow}{if} (nargs == NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02547}02547                 \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}No '\%s' argument."{}}, \textcolor{stringliteral}{"{}nargs"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02548}02548                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02549}02549         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02550}02550         \textcolor{keywordflow}{if} (*nargs <= 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02551}02551                 \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Missing device(s)."{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02552}02552                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02553}02553         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02554}02554 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02555}02555         \textcolor{keywordflow}{for} (i = 0; i < *nargs; i++) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02556}02556                 snprintf(param, \textcolor{keyword}{sizeof}(param), \textcolor{stringliteral}{"{}arg\%d"{}}, i);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02557}02557                 \mbox{\hyperlink{g__part__if_8m_aff5d3acc33944ecb11914d04ef06bb54}{name}} = \mbox{\hyperlink{geom_8h_ada33526012aac8ee446617bb3749a07c}{gctl\_get\_asciiparam}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, param);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02558}02558                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_aff5d3acc33944ecb11914d04ef06bb54}{name}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02559}02559                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}No 'arg\%d' argument."{}}, i);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02560}02560                         \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02561}02561                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02562}02562                 sc = \mbox{\hyperlink{g__journal_8c_a8de5463169efd2a41fd8a1d1e70e6be5}{g\_journal\_find\_device}}(\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}, \mbox{\hyperlink{g__part__if_8m_aff5d3acc33944ecb11914d04ef06bb54}{name}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02563}02563                 \textcolor{keywordflow}{if} (sc == NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02564}02564                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}No such device: \%s."{}}, \mbox{\hyperlink{g__part__if_8m_aff5d3acc33944ecb11914d04ef06bb54}{name}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02565}02565                         \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02566}02566                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02567}02567                 error = \mbox{\hyperlink{g__journal_8c_aa4185d491be0d4398d14c324ea2e4e4f}{g\_journal\_destroy}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02568}02568                 \textcolor{keywordflow}{if} (error != 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02569}02569                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Cannot destroy device \%s (error=\%d)."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02570}02570                             LIST\_FIRST(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_a51a9b0d797af1a185e8b83654fcf5739}{sc\_geom}}-\/>provider)-\/>name, error);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02571}02571                         \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02572}02572                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02573}02573         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02574}02574 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02575}02575 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02576}02576 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02577}\mbox{\hyperlink{g__journal_8c_abd1997e41b47c03cf8f5dea7f2c4dbfe}{02577}} \mbox{\hyperlink{g__journal_8c_abd1997e41b47c03cf8f5dea7f2c4dbfe}{g\_journal\_ctl\_sync}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structgctl__req}{gctl\_req}} *\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}} \_\_unused, \textcolor{keyword}{struct} \mbox{\hyperlink{structg__class}{g\_class}} *\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}} \_\_unused)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02578}02578 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02579}02579 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02580}02580         \mbox{\hyperlink{geom_8h_a1898dc8c812faa5de231ab840e8562bf}{g\_topology\_assert}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02581}02581         \mbox{\hyperlink{geom_8h_a4628d4de49ba84e7a6126cc30d23b83a}{g\_topology\_unlock}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02582}02582         \mbox{\hyperlink{g__journal_8c_ad0cc7565ac6110d18f2b094ae9e7306f}{g\_journal\_sync\_requested}}++;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02583}02583         wakeup(\&\mbox{\hyperlink{g__journal_8c_a060a89b3e3b1bb106740fc923ea2ce72}{g\_journal\_switcher\_state}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02584}02584         \textcolor{keywordflow}{while} (\mbox{\hyperlink{g__journal_8c_ad0cc7565ac6110d18f2b094ae9e7306f}{g\_journal\_sync\_requested}} > 0)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02585}02585                 tsleep(\&\mbox{\hyperlink{g__journal_8c_ad0cc7565ac6110d18f2b094ae9e7306f}{g\_journal\_sync\_requested}}, PRIBIO, \textcolor{stringliteral}{"{}j:sreq"{}}, hz / 2);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02586}02586         \mbox{\hyperlink{geom_8h_a232419d2cfa06ff3f4ff7551041aed31}{g\_topology\_lock}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02587}02587 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02588}02588 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02589}02589 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02590}\mbox{\hyperlink{g__journal_8c_a6a568e5dfc3332cbc227b782f442769a}{02590}} \mbox{\hyperlink{g__journal_8c_ae990d3367d54b59c9fee9b262d76d681}{g\_journal\_config}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structgctl__req}{gctl\_req}} *\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{keyword}{struct} \mbox{\hyperlink{structg__class}{g\_class}} *\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *verb)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02591}02591 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02592}02592         uint32\_t *version;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02593}02593 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02594}02594         \mbox{\hyperlink{geom_8h_a1898dc8c812faa5de231ab840e8562bf}{g\_topology\_assert}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02595}02595 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02596}02596         version = \mbox{\hyperlink{geom_8h_ab762d12640f528d8f1f60eee92bf5f3b}{gctl\_get\_paraml}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}version"{}}, \textcolor{keyword}{sizeof}(*version));}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02597}02597         \textcolor{keywordflow}{if} (version == NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02598}02598                 \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}No '\%s' argument."{}}, \textcolor{stringliteral}{"{}version"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02599}02599                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02600}02600         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02601}02601         \textcolor{keywordflow}{if} (*version != \mbox{\hyperlink{g__journal_8h_a5b78e7e0a6d670e3b6938786cb9ad209}{G\_JOURNAL\_VERSION}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02602}02602                 \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Userland and kernel parts are out of sync."{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02603}02603                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02604}02604         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02605}02605 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02606}02606         \textcolor{keywordflow}{if} (strcmp(verb, \textcolor{stringliteral}{"{}destroy"{}}) == 0 || strcmp(verb, \textcolor{stringliteral}{"{}stop"{}}) == 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02607}02607                 \mbox{\hyperlink{g__journal_8c_a46e19331e404644c3406041ab67120e7}{g\_journal\_ctl\_destroy}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02608}02608                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02609}02609         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (strcmp(verb, \textcolor{stringliteral}{"{}sync"{}}) == 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02610}02610                 \mbox{\hyperlink{g__journal_8c_abd1997e41b47c03cf8f5dea7f2c4dbfe}{g\_journal\_ctl\_sync}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02611}02611                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02612}02612         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02613}02613 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02614}02614         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Unknown verb."{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02615}02615 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02616}02616 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02617}02617 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02618}\mbox{\hyperlink{g__journal_8c_a4777e95677be1724bcce7e850e281beb}{02618}} \mbox{\hyperlink{g__journal_8c_a30d62d002bc5bda5ca47fea3a587e1aa}{g\_journal\_dumpconf}}(\textcolor{keyword}{struct} sbuf *\mbox{\hyperlink{g__part__if_8m_a4c23eb4bab5aa5d69bd84384b94d1f79}{sb}}, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *\mbox{\hyperlink{g__part__if_8m_a9a0d9ba518bc8db9a623d0a6ab81f81c}{indent}}, \textcolor{keyword}{struct} \mbox{\hyperlink{structg__geom}{g\_geom}} *\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02619}02619     \textcolor{keyword}{struct} \mbox{\hyperlink{structg__consumer}{g\_consumer}} *\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}, \textcolor{keyword}{struct} \mbox{\hyperlink{structg__provider}{g\_provider}} *\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02620}02620 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02621}02621         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02622}02622 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02623}02623         \mbox{\hyperlink{geom_8h_a1898dc8c812faa5de231ab840e8562bf}{g\_topology\_assert}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02624}02624 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02625}02625         sc = \mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}-\/>\mbox{\hyperlink{structg__geom_aa83c08c83459420f6cbcfe64c6099466}{softc}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02626}02626         \textcolor{keywordflow}{if} (sc == NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02627}02627                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02628}02628         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}} != NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02629}02629                 \textcolor{comment}{/* Nothing here. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02630}02630         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}} != NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02631}02631                 \textcolor{keywordtype}{int} first = 1;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02632}02632 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02633}02633                 sbuf\_printf(\mbox{\hyperlink{g__part__if_8m_a4c23eb4bab5aa5d69bd84384b94d1f79}{sb}}, \textcolor{stringliteral}{"{}\%s<Role>"{}}, \mbox{\hyperlink{g__part__if_8m_a9a0d9ba518bc8db9a623d0a6ab81f81c}{indent}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02634}02634                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}} == sc-\/>\mbox{\hyperlink{structg__journal__softc_a2c73cf0fe40ed3f96de698010a994b05}{sc\_dconsumer}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02635}02635                         sbuf\_cat(\mbox{\hyperlink{g__part__if_8m_a4c23eb4bab5aa5d69bd84384b94d1f79}{sb}}, \textcolor{stringliteral}{"{}Data"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02636}02636                         first = 0;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02637}02637                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02638}02638                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}} == sc-\/>\mbox{\hyperlink{structg__journal__softc_a2d40c99cf9409278e8447f5b5e986e1b}{sc\_jconsumer}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02639}02639                         \textcolor{keywordflow}{if} (!first)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02640}02640                                 sbuf\_cat(\mbox{\hyperlink{g__part__if_8m_a4c23eb4bab5aa5d69bd84384b94d1f79}{sb}}, \textcolor{stringliteral}{"{},"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02641}02641                         sbuf\_cat(\mbox{\hyperlink{g__part__if_8m_a4c23eb4bab5aa5d69bd84384b94d1f79}{sb}}, \textcolor{stringliteral}{"{}Journal"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02642}02642                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02643}02643                 sbuf\_cat(\mbox{\hyperlink{g__part__if_8m_a4c23eb4bab5aa5d69bd84384b94d1f79}{sb}}, \textcolor{stringliteral}{"{}</Role>\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02644}02644                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}} == sc-\/>\mbox{\hyperlink{structg__journal__softc_a2d40c99cf9409278e8447f5b5e986e1b}{sc\_jconsumer}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02645}02645                         sbuf\_printf(\mbox{\hyperlink{g__part__if_8m_a4c23eb4bab5aa5d69bd84384b94d1f79}{sb}}, \textcolor{stringliteral}{"{}<Jstart>\%jd</Jstart>\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02646}02646                             (intmax\_t)sc-\/>\mbox{\hyperlink{structg__journal__softc_a89bc44b8276a4b18afb4ea756b86f76a}{sc\_jstart}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02647}02647                         sbuf\_printf(\mbox{\hyperlink{g__part__if_8m_a4c23eb4bab5aa5d69bd84384b94d1f79}{sb}}, \textcolor{stringliteral}{"{}<Jend>\%jd</Jend>\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02648}02648                             (intmax\_t)sc-\/>\mbox{\hyperlink{structg__journal__softc_a4ed217d1be380b3a2282f9bf1a0906bd}{sc\_jend}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02649}02649                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02650}02650         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02651}02651                 sbuf\_printf(\mbox{\hyperlink{g__part__if_8m_a4c23eb4bab5aa5d69bd84384b94d1f79}{sb}}, \textcolor{stringliteral}{"{}\%s<ID>\%u</ID>\(\backslash\)n"{}}, \mbox{\hyperlink{g__part__if_8m_a9a0d9ba518bc8db9a623d0a6ab81f81c}{indent}}, (u\_int)sc-\/>\mbox{\hyperlink{structg__journal__softc_ad4d04ff053d5c7f2bdbb0237afccdb25}{sc\_id}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02652}02652         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02653}02653 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02654}02654 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02655}\mbox{\hyperlink{g__journal_8c_a9bced039715e47753a3e98eae49a99d1}{02655}} \textcolor{keyword}{static} eventhandler\_tag \mbox{\hyperlink{g__journal_8c_a9bced039715e47753a3e98eae49a99d1}{g\_journal\_event\_shutdown}} = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02656}\mbox{\hyperlink{g__journal_8c_a00edfc2a0d21e66d648f315661f1ed46}{02656}} \textcolor{keyword}{static} eventhandler\_tag \mbox{\hyperlink{g__journal_8c_a00edfc2a0d21e66d648f315661f1ed46}{g\_journal\_event\_lowmem}} = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02657}02657 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02658}02658 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02659}\mbox{\hyperlink{g__journal_8c_a632b8577bf7a875a0043ee694e4fd9f8}{02659}} \mbox{\hyperlink{g__journal_8c_a632b8577bf7a875a0043ee694e4fd9f8}{g\_journal\_shutdown}}(\textcolor{keywordtype}{void} *arg, \textcolor{keywordtype}{int} howto \_\_unused)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02660}02660 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02661}02661         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__class}{g\_class}} *\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02662}02662         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__geom}{g\_geom}} *\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}, *gp2;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02663}02663 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02664}02664         \textcolor{keywordflow}{if} (KERNEL\_PANICKED())}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02665}02665                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02666}02666         \mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}} = arg;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02667}02667         \mbox{\hyperlink{geom_8h_a232419d2cfa06ff3f4ff7551041aed31}{g\_topology\_lock}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02668}02668         LIST\_FOREACH\_SAFE(\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}, \&\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}-\/>geom, geom, gp2) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02669}02669                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}-\/>\mbox{\hyperlink{structg__geom_aa83c08c83459420f6cbcfe64c6099466}{softc}} == NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02670}02670                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02671}02671                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(0, \textcolor{stringliteral}{"{}Shutting down geom \%s."{}}, \mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}-\/>\mbox{\hyperlink{structg__geom_af64450500f1fea18f639b191a5017107}{name}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02672}02672                 \mbox{\hyperlink{g__journal_8c_aa4185d491be0d4398d14c324ea2e4e4f}{g\_journal\_destroy}}(\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}-\/>\mbox{\hyperlink{structg__geom_aa83c08c83459420f6cbcfe64c6099466}{softc}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02673}02673         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02674}02674         \mbox{\hyperlink{geom_8h_a4628d4de49ba84e7a6126cc30d23b83a}{g\_topology\_unlock}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02675}02675 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02676}02676 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02677}02677 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02678}02678 \textcolor{comment}{ * Free cached requests from inactive queue in case of low memory.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02679}02679 \textcolor{comment}{ * We free GJ\_FREE\_AT\_ONCE elements at once.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02680}02680 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02681}\mbox{\hyperlink{g__journal_8c_a8c0b9099d075c58cd92253c949d1a1c4}{02681}} \textcolor{preprocessor}{\#define GJ\_FREE\_AT\_ONCE 4}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02682}02682 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02683}\mbox{\hyperlink{g__journal_8c_a8d63486d0b1591124f5fa38affbb3359}{02683}} \mbox{\hyperlink{g__journal_8c_a8d63486d0b1591124f5fa38affbb3359}{g\_journal\_lowmem}}(\textcolor{keywordtype}{void} *arg, \textcolor{keywordtype}{int} howto \_\_unused)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02684}02684 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02685}02685         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02686}02686         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__class}{g\_class}} *\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02687}02687         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__geom}{g\_geom}} *\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02688}02688         \textcolor{keyword}{struct }bio *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02689}02689         u\_int nfree = \mbox{\hyperlink{g__journal_8c_a8c0b9099d075c58cd92253c949d1a1c4}{GJ\_FREE\_AT\_ONCE}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02690}02690 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02691}02691         \mbox{\hyperlink{g__journal_8c_ac0680b72d63b7ffac2661553bc214354}{g\_journal\_stats\_low\_mem}}++;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02692}02692         \mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}} = arg;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02693}02693         \mbox{\hyperlink{geom_8h_a232419d2cfa06ff3f4ff7551041aed31}{g\_topology\_lock}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02694}02694         LIST\_FOREACH(\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}, \&\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}-\/>geom, geom) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02695}02695                 sc = \mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}-\/>\mbox{\hyperlink{structg__geom_aa83c08c83459420f6cbcfe64c6099466}{softc}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02696}02696                 \textcolor{keywordflow}{if} (sc == NULL || (sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} \& \mbox{\hyperlink{g__journal_8h_a097061ce64a6042ebdcd0e0ed18bf0f0}{GJF\_DEVICE\_DESTROY}}))}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02697}02697                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02698}02698                 mtx\_lock(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02699}02699                 \textcolor{keywordflow}{for} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}} = sc-\/>\mbox{\hyperlink{structg__journal__softc_a9ed37f4f4b73662640e4dcbeb0f6083f}{sc\_inactive}}.\mbox{\hyperlink{structg__journal__journal_a857814a0d0fd54d26a70d888c5f082d9}{jj\_queue}}; nfree > 0 \&\& \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}} != NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02700}02700                     nfree-\/-\/, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}} = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_next) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02701}02701                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02702}02702 \textcolor{comment}{                         * This is safe to free the bio\_data, because:}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02703}02703 \textcolor{comment}{                         * 1. If bio\_data is NULL it will be read from the}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02704}02704 \textcolor{comment}{                         *    inactive journal.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02705}02705 \textcolor{comment}{                         * 2. If bp is sent down, it is first removed from the}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02706}02706 \textcolor{comment}{                         *    inactive queue, so it's impossible to free the}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02707}02707 \textcolor{comment}{                         *    data from under in-\/flight bio.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02708}02708 \textcolor{comment}{                         * On the other hand, freeing elements from the active}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02709}02709 \textcolor{comment}{                         * queue, is not safe.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02710}02710 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02711}02711                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_data != NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02712}02712                                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(2, \textcolor{stringliteral}{"{}Freeing data from \%s."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02713}02713                                     sc-\/>sc\_name);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02714}02714                                 \mbox{\hyperlink{g__journal_8c_af5af205b6121b79aa01357503d8b28bc}{gj\_free}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_data, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_length);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02715}02715                                 \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_data = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02716}02716                         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02717}02717                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02718}02718                 mtx\_unlock(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02719}02719                 \textcolor{keywordflow}{if} (nfree == 0)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02720}02720                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02721}02721         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02722}02722         \mbox{\hyperlink{geom_8h_a4628d4de49ba84e7a6126cc30d23b83a}{g\_topology\_unlock}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02723}02723 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02724}02724 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02725}02725 \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{g__journal_8c_af15538b8fd53831f44a4d77cac17ef43}{g\_journal\_switcher}}(\textcolor{keywordtype}{void} *arg);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02726}02726 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02727}02727 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02728}\mbox{\hyperlink{g__journal_8c_acebbf80cf01768d6e27c6e6884784e44}{02728}} \mbox{\hyperlink{g__journal_8c_ab5eea3e43e99bd1a9dadf8ffaa6b70e2}{g\_journal\_init}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__class}{g\_class}} *\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02729}02729 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02730}02730 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02731}02731         \textcolor{comment}{/* Pick a conservative value if provided value sucks. */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02732}02732         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__journal_8c_a04e9fe8729a1d236111d14806cb396dd}{g\_journal\_cache\_divisor}} <= 0 ||}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02733}02733             (vm\_kmem\_size / \mbox{\hyperlink{g__journal_8c_a04e9fe8729a1d236111d14806cb396dd}{g\_journal\_cache\_divisor}} == 0)) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02734}02734                 \mbox{\hyperlink{g__journal_8c_a04e9fe8729a1d236111d14806cb396dd}{g\_journal\_cache\_divisor}} = 5;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02735}02735         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02736}02736         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__journal_8c_a4c9e6c2c63842d88b28737ecd982124c}{g\_journal\_cache\_limit}} > 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02737}02737                 \mbox{\hyperlink{g__journal_8c_a4c9e6c2c63842d88b28737ecd982124c}{g\_journal\_cache\_limit}} = vm\_kmem\_size / \mbox{\hyperlink{g__journal_8c_a04e9fe8729a1d236111d14806cb396dd}{g\_journal\_cache\_divisor}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02738}02738                 \mbox{\hyperlink{g__journal_8c_a60bf13b7044e9e9fec39ce68b5daf4a6}{g\_journal\_cache\_low}} =}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02739}02739                     (\mbox{\hyperlink{g__journal_8c_a4c9e6c2c63842d88b28737ecd982124c}{g\_journal\_cache\_limit}} / 100) * \mbox{\hyperlink{g__journal_8c_a5e2abb952038df01030c62c17ad96363}{g\_journal\_cache\_switch}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02740}02740         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02741}02741         \mbox{\hyperlink{g__journal_8c_a9bced039715e47753a3e98eae49a99d1}{g\_journal\_event\_shutdown}} = EVENTHANDLER\_REGISTER(shutdown\_post\_sync,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02742}02742             \mbox{\hyperlink{g__journal_8c_a632b8577bf7a875a0043ee694e4fd9f8}{g\_journal\_shutdown}}, \mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}, EVENTHANDLER\_PRI\_FIRST);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02743}02743         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__journal_8c_a9bced039715e47753a3e98eae49a99d1}{g\_journal\_event\_shutdown}} == NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02744}02744                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(0, \textcolor{stringliteral}{"{}Warning! Cannot register shutdown event."{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02745}02745         \mbox{\hyperlink{g__journal_8c_a00edfc2a0d21e66d648f315661f1ed46}{g\_journal\_event\_lowmem}} = EVENTHANDLER\_REGISTER(vm\_lowmem,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02746}02746             \mbox{\hyperlink{g__journal_8c_a8d63486d0b1591124f5fa38affbb3359}{g\_journal\_lowmem}}, \mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}, EVENTHANDLER\_PRI\_FIRST);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02747}02747         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__journal_8c_a00edfc2a0d21e66d648f315661f1ed46}{g\_journal\_event\_lowmem}} == NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02748}02748                 \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(0, \textcolor{stringliteral}{"{}Warning! Cannot register lowmem event."{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02749}02749 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02750}02750 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02751}02751 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02752}\mbox{\hyperlink{g__journal_8c_a5dd9ad2a0e17899ab68fdfa7eedc2def}{02752}} \mbox{\hyperlink{g__journal_8c_a7a0285e1881caddb3d84356a867cdf6a}{g\_journal\_fini}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__class}{g\_class}} *\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02753}02753 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02754}02754 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02755}02755         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__journal_8c_a9bced039715e47753a3e98eae49a99d1}{g\_journal\_event\_shutdown}} != NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02756}02756                 EVENTHANDLER\_DEREGISTER(shutdown\_post\_sync,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02757}02757                     \mbox{\hyperlink{g__journal_8c_a9bced039715e47753a3e98eae49a99d1}{g\_journal\_event\_shutdown}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02758}02758         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02759}02759         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__journal_8c_a00edfc2a0d21e66d648f315661f1ed46}{g\_journal\_event\_lowmem}} != NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02760}02760                 EVENTHANDLER\_DEREGISTER(vm\_lowmem, \mbox{\hyperlink{g__journal_8c_a00edfc2a0d21e66d648f315661f1ed46}{g\_journal\_event\_lowmem}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02761}02761         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__journal_8c_a6d8764e06e60b7dbdb9961c44ce6accd}{g\_journal\_switcher\_proc}} != NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02762}02762                 \mbox{\hyperlink{g__journal_8c_ab7fd0045f922df36ad55f01329cf0569}{g\_journal\_stop\_switcher}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02763}02763 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02764}02764 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02765}\mbox{\hyperlink{g__journal_8c_ace0b4a02712718a9cc469437f0e68d28}{02765}} \mbox{\hyperlink{g__journal_8c_ace0b4a02712718a9cc469437f0e68d28}{DECLARE\_GEOM\_CLASS}}(\mbox{\hyperlink{g__journal_8c_a2b8ebec7149958e55f7cea21a7a174db}{g\_journal\_class}}, g\_journal);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02766}02766 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02767}02767 \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structg__journal__desc}{g\_journal\_desc}} *}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02768}\mbox{\hyperlink{g__journal_8c_a68cd02f6ba079281280b904cc9c90f64}{02768}} \mbox{\hyperlink{g__journal_8c_a68cd02f6ba079281280b904cc9c90f64}{g\_journal\_find\_desc}}(\textcolor{keyword}{const} \textcolor{keywordtype}{char} *fstype)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02769}02769 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02770}02770         \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structg__journal__desc}{g\_journal\_desc}} *desc;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02771}02771         \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02772}02772 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02773}02773         \textcolor{keywordflow}{for} (desc = \mbox{\hyperlink{g__journal_8c_a23cd1b925a6a1a38d5c117818669f55e}{g\_journal\_filesystems}}[i = 0]; desc != NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02774}02774              desc = \mbox{\hyperlink{g__journal_8c_a23cd1b925a6a1a38d5c117818669f55e}{g\_journal\_filesystems}}[++i]) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02775}02775                 \textcolor{keywordflow}{if} (strcmp(desc-\/>\mbox{\hyperlink{structg__journal__desc_a264f40ebb15774e173dd40e667d91c45}{jd\_fstype}}, fstype) == 0)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02776}02776                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02777}02777         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02778}02778         \textcolor{keywordflow}{return} (desc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02779}02779 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02780}02780 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02781}02781 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02782}\mbox{\hyperlink{g__journal_8c_a38ee47ffa1860553d6d8357d2a180934}{02782}} \mbox{\hyperlink{g__journal_8c_a38ee47ffa1860553d6d8357d2a180934}{g\_journal\_switch\_wait}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02783}02783 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02784}02784         \textcolor{keyword}{struct }bintime bt;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02785}02785 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02786}02786         mtx\_assert(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}}, MA\_OWNED);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02787}02787         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__journal_8c_a46680090bf15392d6c4741f1ee1566ba}{g\_journal\_debug}} >= 2) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02788}02788                 \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_aafc53963c19cdb0ceb350770db5fc8e6}{sc\_flush\_in\_progress}} > 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02789}02789                         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(2, \textcolor{stringliteral}{"{}\%d requests flushing."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02790}02790                             sc-\/>\mbox{\hyperlink{structg__journal__softc_aafc53963c19cdb0ceb350770db5fc8e6}{sc\_flush\_in\_progress}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02791}02791                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02792}02792                 \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_ace2dfb947e35203d5fbfcb760c048ed3}{sc\_copy\_in\_progress}} > 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02793}02793                         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(2, \textcolor{stringliteral}{"{}\%d requests copying."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02794}02794                             sc-\/>\mbox{\hyperlink{structg__journal__softc_ace2dfb947e35203d5fbfcb760c048ed3}{sc\_copy\_in\_progress}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02795}02795                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02796}02796                 \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_a8d2bd7d1d242f1d7b05363588548211d}{sc\_flush\_count}} > 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02797}02797                         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(2, \textcolor{stringliteral}{"{}\%d requests to flush."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02798}02798                             sc-\/>\mbox{\hyperlink{structg__journal__softc_a8d2bd7d1d242f1d7b05363588548211d}{sc\_flush\_count}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02799}02799                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02800}02800                 \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_a209e8528ae353cb8a3b65285e9226075}{sc\_delayed\_count}} > 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02801}02801                         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(2, \textcolor{stringliteral}{"{}\%d requests delayed."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02802}02802                             sc-\/>\mbox{\hyperlink{structg__journal__softc_a209e8528ae353cb8a3b65285e9226075}{sc\_delayed\_count}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02803}02803                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02804}02804         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02805}02805         \mbox{\hyperlink{g__journal_8c_a44a5ef0d5e2d6149aa7d4ed10566e375}{g\_journal\_stats\_switches}}++;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02806}02806         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_ace2dfb947e35203d5fbfcb760c048ed3}{sc\_copy\_in\_progress}} > 0)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02807}02807                 \mbox{\hyperlink{g__journal_8c_aef3302cfe07ec834c799b305519d07c0}{g\_journal\_stats\_wait\_for\_copy}}++;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02808}02808         \mbox{\hyperlink{g__journal_8h_a493a00ede0e6efaefff51a5f984529ba}{GJ\_TIMER\_START}}(1, \&bt);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02809}02809         sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} \&= \string~GJF\_DEVICE\_BEFORE\_SWITCH;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02810}02810         sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} |= \mbox{\hyperlink{g__journal_8h_a284256c54ae71bcb77628f7704b8a69c}{GJF\_DEVICE\_SWITCH}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02811}02811         wakeup(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02812}02812         \textcolor{keywordflow}{while} (sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} \& \mbox{\hyperlink{g__journal_8h_a284256c54ae71bcb77628f7704b8a69c}{GJF\_DEVICE\_SWITCH}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02813}02813                 msleep(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac51f404c529e60a3d430f31b1702d470}{sc\_journal\_copying}}, \&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}}, PRIBIO,}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02814}02814                     \textcolor{stringliteral}{"{}gj:switch"{}}, 0);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02815}02815         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02816}02816         \mbox{\hyperlink{g__journal_8h_a2a291fca79ca199f3d3f8c0aca0ac909}{GJ\_TIMER\_STOP}}(1, \&bt, \textcolor{stringliteral}{"{}Switch time of \%s"{}}, sc-\/>sc\_name);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02817}02817 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02818}02818 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02819}02819 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02820}\mbox{\hyperlink{g__journal_8c_abfa0b79fb7f2e2e22ed5c551c38d07ba}{02820}} \mbox{\hyperlink{g__journal_8c_abfa0b79fb7f2e2e22ed5c551c38d07ba}{g\_journal\_do\_switch}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__class}{g\_class}} *classp)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02821}02821 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02822}02822         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__journal__softc}{g\_journal\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02823}02823         \textcolor{keyword}{const} \textcolor{keyword}{struct }\mbox{\hyperlink{structg__journal__desc}{g\_journal\_desc}} *desc;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02824}02824         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__geom}{g\_geom}} *\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02825}02825         \textcolor{keyword}{struct }mount *\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02826}02826         \textcolor{keyword}{struct }bintime bt;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02827}02827         \textcolor{keywordtype}{char} *mountpoint;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02828}02828         \textcolor{keywordtype}{int} error, save;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02829}02829 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02830}02830         \mbox{\hyperlink{geom_8h_a232419d2cfa06ff3f4ff7551041aed31}{g\_topology\_lock}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02831}02831         LIST\_FOREACH(\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}, \&classp-\/>geom, geom) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02832}02832                 sc = \mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}-\/>\mbox{\hyperlink{structg__geom_aa83c08c83459420f6cbcfe64c6099466}{softc}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02833}02833                 \textcolor{keywordflow}{if} (sc == NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02834}02834                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02835}02835                 \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} \& \mbox{\hyperlink{g__journal_8h_a097061ce64a6042ebdcd0e0ed18bf0f0}{GJF\_DEVICE\_DESTROY}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02836}02836                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02837}02837                 \textcolor{keywordflow}{if} ((sc-\/>\mbox{\hyperlink{structg__journal__softc_affbf58ba9d075b00d0dd9011c987ce4b}{sc\_type}} \& \mbox{\hyperlink{g__journal_8h_aa310bc95d7cd624455b948f4488e54e4}{GJ\_TYPE\_COMPLETE}}) != \mbox{\hyperlink{g__journal_8h_aa310bc95d7cd624455b948f4488e54e4}{GJ\_TYPE\_COMPLETE}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02838}02838                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02839}02839                 mtx\_lock(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02840}02840                 sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} |= \mbox{\hyperlink{g__journal_8h_a5265175eb57a4ad0ae484c5c51cdf90d}{GJF\_DEVICE\_BEFORE\_SWITCH}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02841}02841                 mtx\_unlock(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02842}02842         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02843}02843         \mbox{\hyperlink{geom_8h_a4628d4de49ba84e7a6126cc30d23b83a}{g\_topology\_unlock}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02844}02844 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02845}02845         mtx\_lock(\&mountlist\_mtx);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02846}02846         TAILQ\_FOREACH(\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}, \&mountlist, mnt\_list) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02847}02847                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}-\/>mnt\_gjprovider == NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02848}02848                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02849}02849                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}-\/>mnt\_flag \& MNT\_RDONLY)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02850}02850                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02851}02851                 desc = \mbox{\hyperlink{g__journal_8c_a68cd02f6ba079281280b904cc9c90f64}{g\_journal\_find\_desc}}(\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}-\/>mnt\_stat.f\_fstypename);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02852}02852                 \textcolor{keywordflow}{if} (desc == NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02853}02853                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02854}02854                 \textcolor{keywordflow}{if} (vfs\_busy(\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}, MBF\_NOWAIT | MBF\_MNTLSTLOCK))}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02855}02855                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02856}02856                 \textcolor{comment}{/* mtx\_unlock(\&mountlist\_mtx) was done inside vfs\_busy() */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02857}02857 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02858}02858                 \mbox{\hyperlink{geom_8h_a232419d2cfa06ff3f4ff7551041aed31}{g\_topology\_lock}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02859}02859                 sc = \mbox{\hyperlink{g__journal_8c_a8de5463169efd2a41fd8a1d1e70e6be5}{g\_journal\_find\_device}}(classp, \mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}-\/>mnt\_gjprovider);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02860}02860                 \mbox{\hyperlink{geom_8h_a4628d4de49ba84e7a6126cc30d23b83a}{g\_topology\_unlock}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02861}02861 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02862}02862                 \textcolor{keywordflow}{if} (sc == NULL) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02863}02863                         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(0, \textcolor{stringliteral}{"{}Cannot find journal geom for \%s."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02864}02864                             \mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}-\/>mnt\_gjprovider);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02865}02865                         \textcolor{keywordflow}{goto} next;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02866}02866                 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__journal_8h_ab96214635b590ef9e396243b8e9abed2}{JEMPTY}}(sc)) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02867}02867                         mtx\_lock(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02868}02868                         sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} \&= \string~GJF\_DEVICE\_BEFORE\_SWITCH;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02869}02869                         mtx\_unlock(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02870}02870                         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(3, \textcolor{stringliteral}{"{}No need for \%s switch."{}}, sc-\/>sc\_name);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02871}02871                         \textcolor{keywordflow}{goto} next;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02872}02872                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02873}02873 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02874}02874                 mountpoint = \mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}-\/>mnt\_stat.f\_mntonname;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02875}02875 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02876}02876                 error = vn\_start\_write(NULL, \&\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}, V\_WAIT);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02877}02877                 \textcolor{keywordflow}{if} (error != 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02878}02878                         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(0, \textcolor{stringliteral}{"{}vn\_start\_write(\%s) failed (error=\%d)."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02879}02879                             mountpoint, error);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02880}02880                         \textcolor{keywordflow}{goto} next;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02881}02881                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02882}02882 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02883}02883                 save = curthread\_pflags\_set(TDP\_SYNCIO);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02884}02884 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02885}02885                 \mbox{\hyperlink{g__journal_8h_a493a00ede0e6efaefff51a5f984529ba}{GJ\_TIMER\_START}}(1, \&bt);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02886}02886                 vfs\_periodic(\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}, MNT\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02887}02887                 \mbox{\hyperlink{g__journal_8h_a2a291fca79ca199f3d3f8c0aca0ac909}{GJ\_TIMER\_STOP}}(1, \&bt, \textcolor{stringliteral}{"{}Msync time of \%s"{}}, mountpoint);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02888}02888 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02889}02889                 \mbox{\hyperlink{g__journal_8h_a493a00ede0e6efaefff51a5f984529ba}{GJ\_TIMER\_START}}(1, \&bt);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02890}02890                 error = VFS\_SYNC(\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}, MNT\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02891}02891                 \textcolor{keywordflow}{if} (error == 0)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02892}02892                         \mbox{\hyperlink{g__journal_8h_a2a291fca79ca199f3d3f8c0aca0ac909}{GJ\_TIMER\_STOP}}(1, \&bt, \textcolor{stringliteral}{"{}Sync time of \%s"{}}, mountpoint);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02893}02893                 \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02894}02894                         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(0, \textcolor{stringliteral}{"{}Cannot sync file system \%s (error=\%d)."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02895}02895                             mountpoint, error);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02896}02896                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02897}02897 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02898}02898                 curthread\_pflags\_restore(save);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02899}02899 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02900}02900                 vn\_finished\_write(\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02901}02901 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02902}02902                 \textcolor{keywordflow}{if} (error != 0)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02903}02903                         \textcolor{keywordflow}{goto} next;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02904}02904 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02905}02905                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02906}02906 \textcolor{comment}{                 * Send BIO\_FLUSH before freezing the file system, so it can be}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02907}02907 \textcolor{comment}{                 * faster after the freeze.}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02908}02908 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02909}02909                 \mbox{\hyperlink{g__journal_8h_a493a00ede0e6efaefff51a5f984529ba}{GJ\_TIMER\_START}}(1, \&bt);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02910}02910                 \mbox{\hyperlink{g__journal_8c_aa4a40c7e2f00dcb4d04cf8062e8fae88}{g\_journal\_flush\_cache}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02911}02911                 \mbox{\hyperlink{g__journal_8h_a2a291fca79ca199f3d3f8c0aca0ac909}{GJ\_TIMER\_STOP}}(1, \&bt, \textcolor{stringliteral}{"{}BIO\_FLUSH time of \%s"{}}, sc-\/>sc\_name);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02912}02912 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02913}02913                 \mbox{\hyperlink{g__journal_8h_a493a00ede0e6efaefff51a5f984529ba}{GJ\_TIMER\_START}}(1, \&bt);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02914}02914                 error = vfs\_write\_suspend(\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}, VS\_SKIP\_UNMOUNT);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02915}02915                 \mbox{\hyperlink{g__journal_8h_a2a291fca79ca199f3d3f8c0aca0ac909}{GJ\_TIMER\_STOP}}(1, \&bt, \textcolor{stringliteral}{"{}Suspend time of \%s"{}}, mountpoint);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02916}02916                 \textcolor{keywordflow}{if} (error != 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02917}02917                         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(0, \textcolor{stringliteral}{"{}Cannot suspend file system \%s (error=\%d)."{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02918}02918                             mountpoint, error);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02919}02919                         \textcolor{keywordflow}{goto} next;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02920}02920                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02921}02921 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02922}02922                 error = desc-\/>\mbox{\hyperlink{structg__journal__desc_a37dea9315b5f0fc6edaf6ada9e47f1d8}{jd\_clean}}(\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02923}02923                 \textcolor{keywordflow}{if} (error != 0)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02924}02924                         \textcolor{keywordflow}{goto} next;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02925}02925 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02926}02926                 mtx\_lock(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02927}02927                 \mbox{\hyperlink{g__journal_8c_a38ee47ffa1860553d6d8357d2a180934}{g\_journal\_switch\_wait}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02928}02928                 mtx\_unlock(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02929}02929 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02930}02930                 vfs\_write\_resume(\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}, 0);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02931}02931 next:}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02932}02932                 mtx\_lock(\&mountlist\_mtx);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02933}02933                 vfs\_unbusy(\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02934}02934         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02935}02935         mtx\_unlock(\&mountlist\_mtx);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02936}02936 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02937}02937         sc = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02938}02938         \textcolor{keywordflow}{for} (;;) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02939}02939                 \mbox{\hyperlink{geom_8h_a232419d2cfa06ff3f4ff7551041aed31}{g\_topology\_lock}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02940}02940                 LIST\_FOREACH(\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}, \&\mbox{\hyperlink{g__journal_8c_a2b8ebec7149958e55f7cea21a7a174db}{g\_journal\_class}}.geom, geom) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02941}02941                         sc = \mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}}-\/>\mbox{\hyperlink{structg__geom_aa83c08c83459420f6cbcfe64c6099466}{softc}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02942}02942                         \textcolor{keywordflow}{if} (sc == NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02943}02943                                 \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02944}02944                         mtx\_lock(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02945}02945                         \textcolor{keywordflow}{if} ((sc-\/>\mbox{\hyperlink{structg__journal__softc_affbf58ba9d075b00d0dd9011c987ce4b}{sc\_type}} \& \mbox{\hyperlink{g__journal_8h_aa310bc95d7cd624455b948f4488e54e4}{GJ\_TYPE\_COMPLETE}}) == \mbox{\hyperlink{g__journal_8h_aa310bc95d7cd624455b948f4488e54e4}{GJ\_TYPE\_COMPLETE}} \&\&}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02946}02946                             !(sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} \& \mbox{\hyperlink{g__journal_8h_a097061ce64a6042ebdcd0e0ed18bf0f0}{GJF\_DEVICE\_DESTROY}}) \&\&}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02947}02947                             (sc-\/>\mbox{\hyperlink{structg__journal__softc_a716f9d2aaea67b246a22a40f441e4b57}{sc\_flags}} \& \mbox{\hyperlink{g__journal_8h_a5265175eb57a4ad0ae484c5c51cdf90d}{GJF\_DEVICE\_BEFORE\_SWITCH}})) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02948}02948                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02949}02949                         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02950}02950                         mtx\_unlock(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02951}02951                         sc = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02952}02952                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02953}02953                 \mbox{\hyperlink{geom_8h_a4628d4de49ba84e7a6126cc30d23b83a}{g\_topology\_unlock}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02954}02954                 \textcolor{keywordflow}{if} (sc == NULL)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02955}02955                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02956}02956                 mtx\_assert(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}}, MA\_OWNED);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02957}02957                 \mbox{\hyperlink{g__journal_8c_a38ee47ffa1860553d6d8357d2a180934}{g\_journal\_switch\_wait}}(sc);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02958}02958                 mtx\_unlock(\&sc-\/>\mbox{\hyperlink{structg__journal__softc_ac89c56992caef651d04f8a79293f2ad7}{sc\_mtx}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02959}02959         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02960}02960 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02961}02961 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02962}02962 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02963}\mbox{\hyperlink{g__journal_8c_a605bac3f6157a873d00e174b53047ebf}{02963}} \mbox{\hyperlink{g__journal_8c_a605bac3f6157a873d00e174b53047ebf}{g\_journal\_start\_switcher}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__class}{g\_class}} *\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02964}02964 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02965}02965         \textcolor{keywordtype}{int} error \mbox{\hyperlink{g__bde_8h_aabb5ad70c88f55209cff7ec5684d13c1}{\_\_diagused}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02966}02966 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02967}02967         \mbox{\hyperlink{geom_8h_a1898dc8c812faa5de231ab840e8562bf}{g\_topology\_assert}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02968}02968         MPASS(\mbox{\hyperlink{g__journal_8c_a6d8764e06e60b7dbdb9961c44ce6accd}{g\_journal\_switcher\_proc}} == NULL);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02969}02969         \mbox{\hyperlink{g__journal_8c_a060a89b3e3b1bb106740fc923ea2ce72}{g\_journal\_switcher\_state}} = \mbox{\hyperlink{g__journal_8c_a88781934934467095a5bba6be7b7adf0}{GJ\_SWITCHER\_WORKING}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02970}02970         error = kproc\_create(\mbox{\hyperlink{g__journal_8c_af15538b8fd53831f44a4d77cac17ef43}{g\_journal\_switcher}}, \mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}, \&\mbox{\hyperlink{g__journal_8c_a6d8764e06e60b7dbdb9961c44ce6accd}{g\_journal\_switcher\_proc}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02971}02971             0, 0, \textcolor{stringliteral}{"{}g\_journal switcher"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02972}02972         KASSERT(error == 0, (\textcolor{stringliteral}{"{}Cannot create switcher thread."{}}));}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02973}02973 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02974}02974 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02975}02975 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02976}\mbox{\hyperlink{g__journal_8c_ab7fd0045f922df36ad55f01329cf0569}{02976}} \mbox{\hyperlink{g__journal_8c_ab7fd0045f922df36ad55f01329cf0569}{g\_journal\_stop\_switcher}}(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02977}02977 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02978}02978         \mbox{\hyperlink{geom_8h_a1898dc8c812faa5de231ab840e8562bf}{g\_topology\_assert}}();}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02979}02979         MPASS(\mbox{\hyperlink{g__journal_8c_a6d8764e06e60b7dbdb9961c44ce6accd}{g\_journal\_switcher\_proc}} != NULL);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02980}02980         \mbox{\hyperlink{g__journal_8c_a060a89b3e3b1bb106740fc923ea2ce72}{g\_journal\_switcher\_state}} = \mbox{\hyperlink{g__journal_8c_a239a65c86ffaa6af7539fde2eda58738}{GJ\_SWITCHER\_DIE}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02981}02981         wakeup(\&\mbox{\hyperlink{g__journal_8c_a060a89b3e3b1bb106740fc923ea2ce72}{g\_journal\_switcher\_state}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02982}02982         \textcolor{keywordflow}{while} (\mbox{\hyperlink{g__journal_8c_a060a89b3e3b1bb106740fc923ea2ce72}{g\_journal\_switcher\_state}} != \mbox{\hyperlink{g__journal_8c_a36b37793e3fefb3274a852c81204c5b7}{GJ\_SWITCHER\_DIED}})}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02983}02983                 tsleep(\&\mbox{\hyperlink{g__journal_8c_a060a89b3e3b1bb106740fc923ea2ce72}{g\_journal\_switcher\_state}}, PRIBIO, \textcolor{stringliteral}{"{}jfini:wait"{}}, hz / 5);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02984}02984         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(1, \textcolor{stringliteral}{"{}Switcher died."{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02985}02985         \mbox{\hyperlink{g__journal_8c_a6d8764e06e60b7dbdb9961c44ce6accd}{g\_journal\_switcher\_proc}} = NULL;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02986}02986 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02987}02987 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02988}02988 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02989}02989 \textcolor{comment}{ * TODO: Kill switcher thread on last geom destruction?}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02990}02990 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02991}02991 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02992}\mbox{\hyperlink{g__journal_8c_af15538b8fd53831f44a4d77cac17ef43}{02992}} \mbox{\hyperlink{g__journal_8c_af15538b8fd53831f44a4d77cac17ef43}{g\_journal\_switcher}}(\textcolor{keywordtype}{void} *arg)}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02993}02993 \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02994}02994         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__class}{g\_class}} *\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02995}02995         \textcolor{keyword}{struct }bintime bt;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02996}02996         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02997}02997 }
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02998}02998         \mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}} = arg;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l02999}02999         curthread-\/>td\_pflags |= TDP\_NORUNNINGBUF;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l03000}03000         \textcolor{keywordflow}{for} (;;) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l03001}03001                 \mbox{\hyperlink{g__journal_8c_abf0fc1105288d76e52bd447ed35fdb7e}{g\_journal\_switcher\_wokenup}} = 0;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l03002}03002                 error = tsleep(\&\mbox{\hyperlink{g__journal_8c_a060a89b3e3b1bb106740fc923ea2ce72}{g\_journal\_switcher\_state}}, PRIBIO, \textcolor{stringliteral}{"{}jsw:wait"{}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l03003}03003                     \mbox{\hyperlink{g__journal_8c_afdcd73703cb2bae47e8c0f5925dc338e}{g\_journal\_switch\_time}} * hz);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l03004}03004                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__journal_8c_a060a89b3e3b1bb106740fc923ea2ce72}{g\_journal\_switcher\_state}} == \mbox{\hyperlink{g__journal_8c_a239a65c86ffaa6af7539fde2eda58738}{GJ\_SWITCHER\_DIE}}) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l03005}03005                         \mbox{\hyperlink{g__journal_8c_a060a89b3e3b1bb106740fc923ea2ce72}{g\_journal\_switcher\_state}} = \mbox{\hyperlink{g__journal_8c_a36b37793e3fefb3274a852c81204c5b7}{GJ\_SWITCHER\_DIED}};}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l03006}03006                         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(1, \textcolor{stringliteral}{"{}Switcher exiting."{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l03007}03007                         wakeup(\&\mbox{\hyperlink{g__journal_8c_a060a89b3e3b1bb106740fc923ea2ce72}{g\_journal\_switcher\_state}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l03008}03008                         kproc\_exit(0);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l03009}03009                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l03010}03010                 \textcolor{keywordflow}{if} (error == 0 \&\& \mbox{\hyperlink{g__journal_8c_ad0cc7565ac6110d18f2b094ae9e7306f}{g\_journal\_sync\_requested}} == 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l03011}03011                         \mbox{\hyperlink{g__journal_8h_a15cb637da5d095a483afe9ce4ab1b94d}{GJ\_DEBUG}}(1, \textcolor{stringliteral}{"{}Out of cache, force switch (used=\%jd "{}}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l03012}03012                             \textcolor{stringliteral}{"{}limit=\%jd)."{}}, (intmax\_t)\mbox{\hyperlink{g__journal_8c_ad7c6bd3b76460d8f60e09f51c9f8f9bb}{g\_journal\_cache\_used}},}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l03013}03013                             (intmax\_t)\mbox{\hyperlink{g__journal_8c_a4c9e6c2c63842d88b28737ecd982124c}{g\_journal\_cache\_limit}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l03014}03014                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l03015}03015                 \mbox{\hyperlink{g__journal_8h_a493a00ede0e6efaefff51a5f984529ba}{GJ\_TIMER\_START}}(1, \&bt);}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l03016}03016                 \mbox{\hyperlink{g__journal_8c_abfa0b79fb7f2e2e22ed5c551c38d07ba}{g\_journal\_do\_switch}}(\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l03017}03017                 \mbox{\hyperlink{g__journal_8h_a2a291fca79ca199f3d3f8c0aca0ac909}{GJ\_TIMER\_STOP}}(1, \&bt, \textcolor{stringliteral}{"{}Entire switch time"{}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l03018}03018                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__journal_8c_ad0cc7565ac6110d18f2b094ae9e7306f}{g\_journal\_sync\_requested}} > 0) \{}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l03019}03019                         \mbox{\hyperlink{g__journal_8c_ad0cc7565ac6110d18f2b094ae9e7306f}{g\_journal\_sync\_requested}} = 0;}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l03020}03020                         wakeup(\&\mbox{\hyperlink{g__journal_8c_ad0cc7565ac6110d18f2b094ae9e7306f}{g\_journal\_sync\_requested}});}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l03021}03021                 \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l03022}03022         \}}
\DoxyCodeLine{\Hypertarget{g__journal_8c_source_l03023}03023 \}}

\end{DoxyCode}
