\hypertarget{g__union_8h_source}{}\doxysection{g\+\_\+union.\+h}
\label{g__union_8h_source}\index{geom/union/g\_union.h@{geom/union/g\_union.h}}
\mbox{\hyperlink{g__union_8h}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00001}00001 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00002}00002 \textcolor{comment}{ * SPDX-\/License-\/Identifier: BSD-\/2-\/Clause-\/FreeBSD}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00003}00003 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00004}00004 \textcolor{comment}{ * Copyright (c) 2022 Marshall Kirk McKusick <mckusick@mckusick.com>}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00005}00005 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00006}00006 \textcolor{comment}{ * Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00007}00007 \textcolor{comment}{ * modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00008}00008 \textcolor{comment}{ * are met:}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00009}00009 \textcolor{comment}{ * 1. Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00010}00010 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00011}00011 \textcolor{comment}{ * 2. Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00012}00012 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer in the}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00013}00013 \textcolor{comment}{ *    documentation and/or other materials provided with the distribution.}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00014}00014 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00015}00015 \textcolor{comment}{ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00016}00016 \textcolor{comment}{ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00017}00017 \textcolor{comment}{ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00018}00018 \textcolor{comment}{ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00019}00019 \textcolor{comment}{ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00020}00020 \textcolor{comment}{ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00021}00021 \textcolor{comment}{ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00022}00022 \textcolor{comment}{ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00023}00023 \textcolor{comment}{ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00024}00024 \textcolor{comment}{ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00025}00025 \textcolor{comment}{ * SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00026}00026 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00027}00027 }
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00028}00028 \textcolor{preprocessor}{\#ifndef \_G\_UNION\_H\_}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00029}00029 \textcolor{preprocessor}{\#define \_G\_UNION\_H\_}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00030}00030 }
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00031}\mbox{\hyperlink{g__union_8h_ac7b12b9f78ed91db553e258c53212885}{00031}} \textcolor{preprocessor}{\#define G\_UNION\_CLASS\_NAME      "{}UNION"{}}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00032}\mbox{\hyperlink{g__union_8h_aff96addc01a410d9604098c6ce53518d}{00032}} \textcolor{preprocessor}{\#define G\_UNION\_VERSION         1}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00033}\mbox{\hyperlink{g__union_8h_a8acfe3f4ef6fca6c90511e3208074b19}{00033}} \textcolor{preprocessor}{\#define G\_UNION\_SUFFIX          "{}.union"{}}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00034}00034 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00035}00035 \textcolor{comment}{ * Special flag to instruct gunion to passthrough the underlying provider's}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00036}00036 \textcolor{comment}{ * physical path}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00037}00037 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00038}\mbox{\hyperlink{g__union_8h_ac6acd32fb79b17a0a8788be59df280ff}{00038}} \textcolor{preprocessor}{\#define G\_UNION\_PHYSPATH\_PASSTHROUGH "{}\(\backslash\)255"{}}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00039}00039 }
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00040}00040 \textcolor{preprocessor}{\#ifdef \_KERNEL}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00041}\mbox{\hyperlink{g__union_8h_ab32a612fa46ce75a7d9245bd973fe09d}{00041}} \textcolor{preprocessor}{\#define G\_UNION\_DEBUG(lvl, ...) \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00042}00042 \textcolor{preprocessor}{    \_GEOM\_DEBUG("{}GEOM\_UNION"{}}, g\_union\_debug, (lvl), NULL, \_\_VA\_ARGS\_\_)}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00043}\mbox{\hyperlink{g__union_8h_ae4c9389b1f83c0569f612179fc455384}{00043}} \textcolor{preprocessor}{\#define G\_UNION\_LOGREQLVL(lvl, bp, ...) \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00044}00044 \textcolor{preprocessor}{    \_GEOM\_DEBUG("{}GEOM\_UNION"{}}, g\_union\_debug, (lvl), (bp), \_\_VA\_ARGS\_\_)}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00045}\mbox{\hyperlink{g__union_8h_a39025574adf33d281cf28c529a55a3a8}{00045}} \textcolor{preprocessor}{\#define G\_UNION\_LOGREQ(bp, ...) G\_UNION\_LOGREQLVL(3, (bp), \_\_VA\_ARGS\_\_)}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00046}00046 }
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00047}\mbox{\hyperlink{g__union_8h_a73160e787a779fdacd6827e6626ba854}{00047}} \mbox{\hyperlink{g__union_8h_a73160e787a779fdacd6827e6626ba854}{TAILQ\_HEAD}}(wiplist, \mbox{\hyperlink{structg__union__wip}{g\_union\_wip}});}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00048}00048 }
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00049}00049 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00050}00050 \textcolor{comment}{ * State maintained by each instance of a UNION GEOM.}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00051}00051 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00052}\mbox{\hyperlink{structg__union__softc}{00052}} \textcolor{keyword}{struct }\mbox{\hyperlink{structg__union__softc}{g\_union\_softc}} \{}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00053}\mbox{\hyperlink{structg__union__softc_a40a15a5850b5e9634d6322a4727cae41}{00053}}         \textcolor{keyword}{struct }rwlock      \mbox{\hyperlink{structg__union__softc_a40a15a5850b5e9634d6322a4727cae41}{sc\_rwlock}};          \textcolor{comment}{/* writemap lock */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00054}\mbox{\hyperlink{structg__union__softc_afa4b7338ffcafd9aee798e37f88c5342}{00054}}         uint64\_t         **\mbox{\hyperlink{structg__union__softc_afa4b7338ffcafd9aee798e37f88c5342}{sc\_writemap\_root}};    \textcolor{comment}{/* root of write map */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00055}\mbox{\hyperlink{structg__union__softc_a7b77b0861cf943a2b3f32386df0049d4}{00055}}         uint64\_t          *\mbox{\hyperlink{structg__union__softc_a7b77b0861cf943a2b3f32386df0049d4}{sc\_leafused}};              \textcolor{comment}{/* 1 => leaf has allocation */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00056}\mbox{\hyperlink{structg__union__softc_a69eee1ed8424e2021f2a45a9c60247ea}{00056}}         uint64\_t           \mbox{\hyperlink{structg__union__softc_a69eee1ed8424e2021f2a45a9c60247ea}{sc\_map\_size}};              \textcolor{comment}{/* size of write map */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00057}\mbox{\hyperlink{structg__union__softc_afb6ffb3ea1c74134fa0852c0f3f940cd}{00057}}         \textcolor{keywordtype}{long}               \mbox{\hyperlink{structg__union__softc_afb6ffb3ea1c74134fa0852c0f3f940cd}{sc\_root\_size}};    \textcolor{comment}{/* entries in root node */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00058}\mbox{\hyperlink{structg__union__softc_a1771e7190c67bdfc7d2c2487b100a6a5}{00058}}         \textcolor{keywordtype}{long}               \mbox{\hyperlink{structg__union__softc_a1771e7190c67bdfc7d2c2487b100a6a5}{sc\_leaf\_size}};    \textcolor{comment}{/* entries in leaf node */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00059}\mbox{\hyperlink{structg__union__softc_a5bb7adf735608ec1dfb09508d3651a39}{00059}}         \textcolor{keywordtype}{long}               \mbox{\hyperlink{structg__union__softc_a5bb7adf735608ec1dfb09508d3651a39}{sc\_bits\_per\_leaf}};    \textcolor{comment}{/* bits per leaf node entry */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00060}\mbox{\hyperlink{structg__union__softc_acc3998341f14614d505906fcd9c6b25c}{00060}}         \textcolor{keywordtype}{long}               \mbox{\hyperlink{structg__union__softc_acc3998341f14614d505906fcd9c6b25c}{sc\_writemap\_memory}};        \textcolor{comment}{/* memory used by writemap */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00061}\mbox{\hyperlink{structg__union__softc_a51cf5341744c68784e74cfea1f061333}{00061}}         off\_t              \mbox{\hyperlink{structg__union__softc_a51cf5341744c68784e74cfea1f061333}{sc\_offset}};          \textcolor{comment}{/* starting offset in lower */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00062}\mbox{\hyperlink{structg__union__softc_a867419f99cf82ac97d6e27bf86e808dc}{00062}}         off\_t              \mbox{\hyperlink{structg__union__softc_a867419f99cf82ac97d6e27bf86e808dc}{sc\_size}};              \textcolor{comment}{/* size of union geom */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00063}\mbox{\hyperlink{structg__union__softc_a595d4b8e9e1fbb917555c1db5f46e8bd}{00063}}         off\_t              \mbox{\hyperlink{structg__union__softc_a595d4b8e9e1fbb917555c1db5f46e8bd}{sc\_sectorsize}};  \textcolor{comment}{/* sector size of geom */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00064}\mbox{\hyperlink{structg__union__softc_a2316b11ed80cdb8b28121d8578724bcc}{00064}}         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__consumer}{g\_consumer}} *\mbox{\hyperlink{structg__union__softc_a2316b11ed80cdb8b28121d8578724bcc}{sc\_uppercp}};              \textcolor{comment}{/* upper-\/level provider */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00065}\mbox{\hyperlink{structg__union__softc_a33d9026325bde6187127bce1b0a8ba08}{00065}}         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__consumer}{g\_consumer}} *\mbox{\hyperlink{structg__union__softc_a33d9026325bde6187127bce1b0a8ba08}{sc\_lowercp}};              \textcolor{comment}{/* lower-\/level provider */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00066}\mbox{\hyperlink{structg__union__softc_adedcb8e24c8f1093b3535bf78ee7732a}{00066}}         \textcolor{keyword}{struct }wiplist     \mbox{\hyperlink{structg__union__softc_adedcb8e24c8f1093b3535bf78ee7732a}{sc\_wiplist}};                \textcolor{comment}{/* I/O work-\/in-\/progress list */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00067}\mbox{\hyperlink{structg__union__softc_a8aeb771b9771aeaf335d2a0b36afc262}{00067}}         \textcolor{keywordtype}{long}               \mbox{\hyperlink{structg__union__softc_a8aeb771b9771aeaf335d2a0b36afc262}{sc\_flags}};            \textcolor{comment}{/* see flags below */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00068}\mbox{\hyperlink{structg__union__softc_aa69c9822e1975dd1a9c1d748928d6441}{00068}}         \textcolor{keywordtype}{long}               \mbox{\hyperlink{structg__union__softc_aa69c9822e1975dd1a9c1d748928d6441}{sc\_reads}};            \textcolor{comment}{/* number of reads done */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00069}\mbox{\hyperlink{structg__union__softc_a8a4977fc8d542045e74c58a7844f4b31}{00069}}         \textcolor{keywordtype}{long}               \mbox{\hyperlink{structg__union__softc_a8a4977fc8d542045e74c58a7844f4b31}{sc\_wrotebytes}};  \textcolor{comment}{/* number of bytes written */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00070}\mbox{\hyperlink{structg__union__softc_a708904e247e0960a2624b7e31fab212f}{00070}}         \textcolor{keywordtype}{long}               \mbox{\hyperlink{structg__union__softc_a708904e247e0960a2624b7e31fab212f}{sc\_writes}};          \textcolor{comment}{/* number of writes done */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00071}\mbox{\hyperlink{structg__union__softc_a51d8f432ba251f55ee1dcdebe4e04a86}{00071}}         \textcolor{keywordtype}{long}               \mbox{\hyperlink{structg__union__softc_a51d8f432ba251f55ee1dcdebe4e04a86}{sc\_readbytes}};    \textcolor{comment}{/* number of bytes read */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00072}\mbox{\hyperlink{structg__union__softc_a9a900326e10578e17a88ca5169d63fb6}{00072}}         \textcolor{keywordtype}{long}               \mbox{\hyperlink{structg__union__softc_a9a900326e10578e17a88ca5169d63fb6}{sc\_deletes}};                \textcolor{comment}{/* number of deletes done */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00073}\mbox{\hyperlink{structg__union__softc_ac4f9304d2590765e0e9cb927ab958c31}{00073}}         \textcolor{keywordtype}{long}               \mbox{\hyperlink{structg__union__softc_ac4f9304d2590765e0e9cb927ab958c31}{sc\_getattrs}};              \textcolor{comment}{/* number of getattrs done */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00074}\mbox{\hyperlink{structg__union__softc_a614e2f62d62755b32c055eacddb5c1e0}{00074}}         \textcolor{keywordtype}{long}               \mbox{\hyperlink{structg__union__softc_a614e2f62d62755b32c055eacddb5c1e0}{sc\_flushes}};                \textcolor{comment}{/* number of flushes done */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00075}\mbox{\hyperlink{structg__union__softc_aa868cbb5df50a5a0faf7ff9898fa6e52}{00075}}         \textcolor{keywordtype}{long}               \mbox{\hyperlink{structg__union__softc_aa868cbb5df50a5a0faf7ff9898fa6e52}{sc\_cmd0s}};            \textcolor{comment}{/* number of cmd0's done */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00076}\mbox{\hyperlink{structg__union__softc_ac6242926fa627456a27283bc10baecfe}{00076}}         \textcolor{keywordtype}{long}               \mbox{\hyperlink{structg__union__softc_ac6242926fa627456a27283bc10baecfe}{sc\_cmd1s}};            \textcolor{comment}{/* number of cmd1's done */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00077}\mbox{\hyperlink{structg__union__softc_ace02475248315cea5372f51f87afa389}{00077}}         \textcolor{keywordtype}{long}               \mbox{\hyperlink{structg__union__softc_ace02475248315cea5372f51f87afa389}{sc\_cmd2s}};            \textcolor{comment}{/* number of cmd2's done */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00078}\mbox{\hyperlink{structg__union__softc_a098c20a4fc875c650d8370348b23b2e6}{00078}}         \textcolor{keywordtype}{long}               \mbox{\hyperlink{structg__union__softc_a098c20a4fc875c650d8370348b23b2e6}{sc\_speedups}};              \textcolor{comment}{/* number of speedups done */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00079}\mbox{\hyperlink{structg__union__softc_ae7451a688338e911f5068e1c9a6c61d4}{00079}}         \textcolor{keywordtype}{long}               \mbox{\hyperlink{structg__union__softc_ae7451a688338e911f5068e1c9a6c61d4}{sc\_readcurrentread}};        \textcolor{comment}{/* reads current with read */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00080}\mbox{\hyperlink{structg__union__softc_a11cd9f61909d6ee341ef0efe9206fbbc}{00080}}         \textcolor{keywordtype}{long}               \mbox{\hyperlink{structg__union__softc_a11cd9f61909d6ee341ef0efe9206fbbc}{sc\_readblockwrite}};  \textcolor{comment}{/* writes blocked by read */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00081}\mbox{\hyperlink{structg__union__softc_a17dc4fcadf2aaa514e2ec8a4ea243b96}{00081}}         \textcolor{keywordtype}{long}               \mbox{\hyperlink{structg__union__softc_a17dc4fcadf2aaa514e2ec8a4ea243b96}{sc\_writeblockread}};  \textcolor{comment}{/* reads blocked by write */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00082}\mbox{\hyperlink{structg__union__softc_abc3da7e8cb31d6795b6627889b5a2211}{00082}}         \textcolor{keywordtype}{long}               \mbox{\hyperlink{structg__union__softc_abc3da7e8cb31d6795b6627889b5a2211}{sc\_writeblockwrite}};        \textcolor{comment}{/* writes blocked by write */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00083}00083 \};}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00084}00084 }
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00085}00085 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00086}00086 \textcolor{comment}{ * Structure to track work-\/in-\/progress I/O operations.}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00087}00087 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00088}00088 \textcolor{comment}{ * Used to prevent overlapping I/O operations from running concurrently.}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00089}00089 \textcolor{comment}{ * Created for each I/O operation.}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00090}00090 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00091}00091 \textcolor{comment}{ * In usual case of no overlap it is linked to sc\_wiplist and started.}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00092}00092 \textcolor{comment}{ * If found to overlap an I/O on sc\_wiplist, it is not started and is}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00093}00093 \textcolor{comment}{ * linked to wip\_waiting list of the I/O that it overlaps. When an I/O}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00094}00094 \textcolor{comment}{ * completes, it restarts all the I/O operations on its wip\_waiting list.}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00095}00095 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00096}\mbox{\hyperlink{structg__union__wip}{00096}} \textcolor{keyword}{struct }\mbox{\hyperlink{structg__union__wip}{g\_union\_wip}} \{}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00097}\mbox{\hyperlink{structg__union__wip_ad5e6e1dbd69a6efae6568b603a40ebb7}{00097}}         \textcolor{keyword}{struct }wiplist           \mbox{\hyperlink{structg__union__wip_ad5e6e1dbd69a6efae6568b603a40ebb7}{wip\_waiting}};        \textcolor{comment}{/* list of I/Os waiting on me */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00098}\mbox{\hyperlink{structg__union__wip_a046043790d72606093695e394de0d85a}{00098}}         \mbox{\hyperlink{structg__union__wip_a046043790d72606093695e394de0d85a}{TAILQ\_ENTRY}}(\mbox{\hyperlink{structg__union__wip}{g\_union\_wip}}) wip\_next;        \textcolor{comment}{/* pending or active I/O list */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00099}\mbox{\hyperlink{structg__union__wip_a7db603e8937e22c1e00bd7b086e89ea6}{00099}}         \textcolor{keyword}{struct }bio              *\mbox{\hyperlink{structg__union__wip_a7db603e8937e22c1e00bd7b086e89ea6}{wip\_bp}};  \textcolor{comment}{/* bio for this I/O */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00100}\mbox{\hyperlink{structg__union__wip_aeeccdbba92bee0e0651d34dad1872efd}{00100}}         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__union__softc}{g\_union\_softc}}       *\mbox{\hyperlink{structg__union__wip_aeeccdbba92bee0e0651d34dad1872efd}{wip\_sc}};  \textcolor{comment}{/* g\_union's softc */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00101}\mbox{\hyperlink{structg__union__wip_a693ebac8cf17e05d4ec51cffcbd07292}{00101}}         off\_t                    \mbox{\hyperlink{structg__union__wip_a693ebac8cf17e05d4ec51cffcbd07292}{wip\_start}};    \textcolor{comment}{/* starting offset of I/O */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00102}\mbox{\hyperlink{structg__union__wip_aa673c547aa12ae237172d364a89d7bba}{00102}}         off\_t                    \mbox{\hyperlink{structg__union__wip_aa673c547aa12ae237172d364a89d7bba}{wip\_end}};        \textcolor{comment}{/* ending offset of I/O */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00103}\mbox{\hyperlink{structg__union__wip_a62ab3a5bd182cf5d937cc09a216b4ac6}{00103}}         \textcolor{keywordtype}{long}                     \mbox{\hyperlink{structg__union__wip_a62ab3a5bd182cf5d937cc09a216b4ac6}{wip\_numios}};  \textcolor{comment}{/* BIO\_READs in progress */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00104}\mbox{\hyperlink{structg__union__wip_a865c978f53203c1db9c55b71d6e5583a}{00104}}         \textcolor{keywordtype}{long}                     \mbox{\hyperlink{structg__union__wip_a865c978f53203c1db9c55b71d6e5583a}{wip\_error}};    \textcolor{comment}{/* merged I/O errors */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00105}00105 \};}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00106}00106 }
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00107}00107 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00108}00108 \textcolor{comment}{ * UNION flags}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00109}00109 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00110}\mbox{\hyperlink{g__union_8h_a3ac829b71d1ce335676208ff657258bd}{00110}} \textcolor{preprocessor}{\#define DOING\_COMMIT    0x00000001      }\textcolor{comment}{/* a commit command is in progress */}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00111}00111 }
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00112}\mbox{\hyperlink{g__union_8h_a0c7735d465d6ac6e7ce5fa11674dac03}{00112}} \textcolor{preprocessor}{\#define DOING\_COMMIT\_BITNUM      0      }\textcolor{comment}{/* a commit command is in progress */}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00113}00113 }
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00114}\mbox{\hyperlink{g__union_8h_abfe642c84b5974b81a83766652af5e06}{00114}} \textcolor{preprocessor}{\#define BITS\_PER\_ENTRY  (sizeof(uint64\_t) * NBBY)}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00115}\mbox{\hyperlink{g__union_8h_a073609c18f5f280c8fbc3f0d2fe21de9}{00115}} \textcolor{preprocessor}{\#define G\_RLOCK(sc)     rw\_rlock(\&(sc)-\/>sc\_rwlock)}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00116}\mbox{\hyperlink{g__union_8h_ac32aed2a4ff0ca7c7dc539f3a217da4d}{00116}} \textcolor{preprocessor}{\#define G\_RUNLOCK(sc)   rw\_runlock(\&(sc)-\/>sc\_rwlock)}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00117}\mbox{\hyperlink{g__union_8h_a6eb0d4fae34d6eacc2ce59c18bd96b7c}{00117}} \textcolor{preprocessor}{\#define G\_WLOCK(sc)     rw\_wlock(\&(sc)-\/>sc\_rwlock)}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00118}\mbox{\hyperlink{g__union_8h_a39b482408d3c45e322c26a5cc138e2b4}{00118}} \textcolor{preprocessor}{\#define G\_WUNLOCK(sc)   rw\_wunlock(\&(sc)-\/>sc\_rwlock)}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00119}\mbox{\hyperlink{g__union_8h_a15d5edb457b87163020e1a28df3e34c3}{00119}} \textcolor{preprocessor}{\#define G\_WLOCKOWNED(sc) rw\_assert(\&(sc)-\/>sc\_rwlock, RA\_WLOCKED)}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00120}00120 }
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00121}00121 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00122}00122 \textcolor{comment}{ * The writelock is held while a commit operation is in progress.}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00123}00123 \textcolor{comment}{ * While held union device may not be used or in use.}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00124}00124 \textcolor{comment}{ * Returns == 0 if lock was successfully obtained.}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00125}00125 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00126}00126 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00127}\mbox{\hyperlink{g__union_8h_a7bf15cf1b393255e7a62df03b354083d}{00127}} \mbox{\hyperlink{g__union_8h_a7bf15cf1b393255e7a62df03b354083d}{g\_union\_get\_writelock}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__union__softc}{g\_union\_softc}} *sc)}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00128}00128 \{}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00129}00129 }
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00130}00130         \textcolor{keywordflow}{return} (atomic\_testandset\_long(\&sc-\/>\mbox{\hyperlink{structg__union__softc_a8aeb771b9771aeaf335d2a0b36afc262}{sc\_flags}}, \mbox{\hyperlink{g__union_8h_a0c7735d465d6ac6e7ce5fa11674dac03}{DOING\_COMMIT\_BITNUM}}));}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00131}00131 \}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00132}00132 }
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00133}00133 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00134}\mbox{\hyperlink{g__union_8h_a5cc3ea347981279a3a5d0ed19875b0c3}{00134}} \mbox{\hyperlink{g__union_8h_a5cc3ea347981279a3a5d0ed19875b0c3}{g\_union\_rel\_writelock}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__union__softc}{g\_union\_softc}} *sc)}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00135}00135 \{}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00136}00136         \textcolor{keywordtype}{long} ret \mbox{\hyperlink{g__bde_8h_aabb5ad70c88f55209cff7ec5684d13c1}{\_\_diagused}};}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00137}00137 }
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00138}00138         ret = atomic\_testandclear\_long(\&sc-\/>\mbox{\hyperlink{structg__union__softc_a8aeb771b9771aeaf335d2a0b36afc262}{sc\_flags}}, \mbox{\hyperlink{g__union_8h_a0c7735d465d6ac6e7ce5fa11674dac03}{DOING\_COMMIT\_BITNUM}});}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00139}00139         KASSERT(ret != 0, (\textcolor{stringliteral}{"{}UNION GEOM releasing unheld lock"{}}));}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00140}00140 \}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00141}00141 }
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00142}00142 \textcolor{preprocessor}{\#endif  }\textcolor{comment}{/* \_KERNEL */}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00143}00143 }
\DoxyCodeLine{\Hypertarget{g__union_8h_source_l00144}00144 \textcolor{preprocessor}{\#endif  }\textcolor{comment}{/* \_G\_UNION\_H\_ */}\textcolor{preprocessor}{}}

\end{DoxyCode}
