\hypertarget{geom__vinum__raid5_8c_source}{}\doxysection{geom\+\_\+vinum\+\_\+raid5.\+c}
\label{geom__vinum__raid5_8c_source}\index{geom/vinum/geom\_vinum\_raid5.c@{geom/vinum/geom\_vinum\_raid5.c}}
\mbox{\hyperlink{geom__vinum__raid5_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00001}00001 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00002}00002 \textcolor{comment}{ * SPDX-\/License-\/Identifier: BSD-\/2-\/Clause-\/FreeBSD}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00003}00003 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00004}00004 \textcolor{comment}{ * Copyright (c) 2004, 2007 Lukas Ertl}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00005}00005 \textcolor{comment}{ * All rights reserved.}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00006}00006 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00007}00007 \textcolor{comment}{ * Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00008}00008 \textcolor{comment}{ * modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00009}00009 \textcolor{comment}{ * are met:}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00010}00010 \textcolor{comment}{ * 1. Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00011}00011 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00012}00012 \textcolor{comment}{ * 2. Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00013}00013 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer in the}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00014}00014 \textcolor{comment}{ *    documentation and/or other materials provided with the distribution.}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00015}00015 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00016}00016 \textcolor{comment}{ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00017}00017 \textcolor{comment}{ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00018}00018 \textcolor{comment}{ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00019}00019 \textcolor{comment}{ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00020}00020 \textcolor{comment}{ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00021}00021 \textcolor{comment}{ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00022}00022 \textcolor{comment}{ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00023}00023 \textcolor{comment}{ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00024}00024 \textcolor{comment}{ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00025}00025 \textcolor{comment}{ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00026}00026 \textcolor{comment}{ * SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00027}00027 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00028}00028 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00029}00029 \textcolor{preprocessor}{\#include <sys/cdefs.h>}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00030}\mbox{\hyperlink{geom__vinum__raid5_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{00030}} \mbox{\hyperlink{geom__vinum__raid5_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{\_\_FBSDID}}(\textcolor{stringliteral}{"{}\$FreeBSD\$"{}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00031}00031 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00032}00032 \textcolor{preprocessor}{\#include <sys/param.h>}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00033}00033 \textcolor{preprocessor}{\#include <sys/bio.h>}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00034}00034 \textcolor{preprocessor}{\#include <sys/lock.h>}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00035}00035 \textcolor{preprocessor}{\#include <sys/malloc.h>}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00036}00036 \textcolor{preprocessor}{\#include <sys/systm.h>}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00037}00037 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00038}00038 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{geom_8h}{geom/geom.h}}>}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00039}00039 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{geom__dbg_8h}{geom/geom\_dbg.h}}>}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00040}00040 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{geom__vinum__var_8h}{geom/vinum/geom\_vinum\_var.h}}>}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00041}00041 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{geom__vinum__raid5_8h}{geom/vinum/geom\_vinum\_raid5.h}}>}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00042}00042 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{geom__vinum_8h}{geom/vinum/geom\_vinum.h}}>}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00043}00043 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00044}00044 \textcolor{keyword}{static} \textcolor{keywordtype}{int}              \mbox{\hyperlink{geom__vinum__raid5_8c_a62a2013d49d91640f3c3ae8dfdbc11da}{gv\_raid5\_offset}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structgv__plex}{gv\_plex}} *, off\_t, off\_t,}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00045}00045                             off\_t *, off\_t *, \textcolor{keywordtype}{int} *, \textcolor{keywordtype}{int} *, \textcolor{keywordtype}{int});}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00046}00046 \textcolor{keyword}{static} \textcolor{keyword}{struct }bio *     \mbox{\hyperlink{geom__vinum__raid5_8c_a0472c7788de575386d9d8d0b75bff7f5}{gv\_raid5\_clone\_bio}}(\textcolor{keyword}{struct} bio *, \textcolor{keyword}{struct} \mbox{\hyperlink{structgv__sd}{gv\_sd}} *,}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00047}00047                             \textcolor{keyword}{struct} \mbox{\hyperlink{structgv__raid5__packet}{gv\_raid5\_packet}} *, caddr\_t, \textcolor{keywordtype}{int});}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00048}00048 \textcolor{keyword}{static} \textcolor{keywordtype}{int}      \mbox{\hyperlink{geom__vinum__raid5_8c_adca2c2283dfda3256be8280a2e929a5b}{gv\_raid5\_request}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structgv__plex}{gv\_plex}} *, \textcolor{keyword}{struct} \mbox{\hyperlink{structgv__raid5__packet}{gv\_raid5\_packet}} *,}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00049}00049                     \textcolor{keyword}{struct} bio *, caddr\_t, off\_t, off\_t, \textcolor{keywordtype}{int} *);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00050}00050 \textcolor{keyword}{static} \textcolor{keywordtype}{int}      \mbox{\hyperlink{geom__vinum__raid5_8c_ab8a81d71cb6f42419993c694018a3620}{gv\_raid5\_check}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structgv__plex}{gv\_plex}} *, \textcolor{keyword}{struct} \mbox{\hyperlink{structgv__raid5__packet}{gv\_raid5\_packet}} *,}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00051}00051                     \textcolor{keyword}{struct} bio *, caddr\_t, off\_t, off\_t);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00052}00052 \textcolor{keyword}{static} \textcolor{keywordtype}{int}      \mbox{\hyperlink{geom__vinum__raid5_8c_ad4a9178de88c39c05c0bf0c8a0c824b0}{gv\_raid5\_rebuild}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structgv__plex}{gv\_plex}} *, \textcolor{keyword}{struct} \mbox{\hyperlink{structgv__raid5__packet}{gv\_raid5\_packet}} *,}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00053}00053                     \textcolor{keyword}{struct} bio *, caddr\_t, off\_t, off\_t);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00054}00054 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00055}00055 \textcolor{keyword}{struct }\mbox{\hyperlink{structgv__raid5__packet}{gv\_raid5\_packet}} *}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00056}\mbox{\hyperlink{geom__vinum__raid5_8c_ae2d5c515c121b27da6b1e2373a5dfd6d}{00056}} \mbox{\hyperlink{geom__vinum__raid5_8c_ae2d5c515c121b27da6b1e2373a5dfd6d}{gv\_raid5\_start}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structgv__plex}{gv\_plex}} *p, \textcolor{keyword}{struct} \mbox{\hyperlink{structgv__raid5__packet_aabef64e8284af5bc89b79dc3b0042754}{bio}} *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, caddr\_t addr, off\_t boff,}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00057}00057     off\_t bcount)}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00058}00058 \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00059}00059         \textcolor{keyword}{struct }bio *cbp;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00060}00060         \textcolor{keyword}{struct }\mbox{\hyperlink{structgv__raid5__packet}{gv\_raid5\_packet}} *wp, *wp2;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00061}00061         \textcolor{keyword}{struct }\mbox{\hyperlink{structgv__bioq}{gv\_bioq}} *bq, *bq2;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00062}00062         \textcolor{keywordtype}{int} err, delay;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00063}00063 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00064}00064         delay = 0;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00065}00065         wp = \mbox{\hyperlink{geom_8h_a0f190247baa73dc863a79fea9d5f6b4f}{g\_malloc}}(\textcolor{keyword}{sizeof}(*wp), M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00066}00066         wp-\/>\mbox{\hyperlink{structgv__raid5__packet_aabef64e8284af5bc89b79dc3b0042754}{bio}} = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00067}00067         wp-\/>\mbox{\hyperlink{structgv__raid5__packet_ab4bd1a941ac8b998031f39c55016b0f2}{waiting}} = NULL;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00068}00068         wp-\/>\mbox{\hyperlink{structgv__raid5__packet_a5bdc6ade1ca13420fe77e6432448510d}{parity}} = NULL;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00069}00069         TAILQ\_INIT(\&wp-\/>bits);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00070}00070 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00071}00071         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_pflags \& \mbox{\hyperlink{geom__vinum__var_8h_a66b73898628473532c02ab0d692e17a7}{GV\_BIO\_REBUILD}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00072}00072                 err = \mbox{\hyperlink{geom__vinum__raid5_8c_ad4a9178de88c39c05c0bf0c8a0c824b0}{gv\_raid5\_rebuild}}(p, wp, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, addr, boff, bcount);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00073}00073         \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_pflags \& \mbox{\hyperlink{geom__vinum__var_8h_ae600d8e4f9500fea2a7e91e59198ccec}{GV\_BIO\_CHECK}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00074}00074                 err = \mbox{\hyperlink{geom__vinum__raid5_8c_ab8a81d71cb6f42419993c694018a3620}{gv\_raid5\_check}}(p, wp, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, addr, boff, bcount);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00075}00075         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00076}00076                 err = \mbox{\hyperlink{geom__vinum__raid5_8c_adca2c2283dfda3256be8280a2e929a5b}{gv\_raid5\_request}}(p, wp, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, addr, boff, bcount, \&delay);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00077}00077 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00078}00078         \textcolor{comment}{/* Means we have a delayed request. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00079}00079         \textcolor{keywordflow}{if} (delay) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00080}00080                 \mbox{\hyperlink{geom_8h_ad9924deb20de7b40cb6cf06e5ae28855}{g\_free}}(wp);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00081}00081                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00082}00082         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00083}00083 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00084}00084         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00085}00085 \textcolor{comment}{         * Building the sub-\/request failed, we probably need to clean up a lot.}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00086}00086 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00087}00087         \textcolor{keywordflow}{if} (err) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00088}00088                 \mbox{\hyperlink{geom__vinum_8h_a401cc8ac2a1f540d90c1da91ebf8e8db}{G\_VINUM\_LOGREQ}}(0, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \textcolor{stringliteral}{"{}raid5 plex request failed."{}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00089}00089                 TAILQ\_FOREACH\_SAFE(bq, \&wp-\/>bits, queue, bq2) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00090}00090                         TAILQ\_REMOVE(\&wp-\/>bits, bq, queue);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00091}00091                         \mbox{\hyperlink{geom_8h_ad9924deb20de7b40cb6cf06e5ae28855}{g\_free}}(bq);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00092}00092                 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00093}00093                 \textcolor{keywordflow}{if} (wp-\/>\mbox{\hyperlink{structgv__raid5__packet_ab4bd1a941ac8b998031f39c55016b0f2}{waiting}} != NULL) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00094}00094                         \textcolor{keywordflow}{if} (wp-\/>\mbox{\hyperlink{structgv__raid5__packet_ab4bd1a941ac8b998031f39c55016b0f2}{waiting}}-\/>bio\_cflags \& \mbox{\hyperlink{geom__vinum__var_8h_ad280c068b1168acdcdc2064024d54f95}{GV\_BIO\_MALLOC}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00095}00095                                 \mbox{\hyperlink{geom_8h_ad9924deb20de7b40cb6cf06e5ae28855}{g\_free}}(wp-\/>\mbox{\hyperlink{structgv__raid5__packet_ab4bd1a941ac8b998031f39c55016b0f2}{waiting}}-\/>bio\_data);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00096}00096                         \mbox{\hyperlink{geom__vinum_8h_a6f92d3f6dc698f442cbb8f28284ec572}{gv\_drive\_done}}(wp-\/>\mbox{\hyperlink{structgv__raid5__packet_ab4bd1a941ac8b998031f39c55016b0f2}{waiting}}-\/>bio\_caller1);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00097}00097                         \mbox{\hyperlink{geom_8h_ae3cbea7d4bf48f25bb609df3d3f0bb28}{g\_destroy\_bio}}(wp-\/>\mbox{\hyperlink{structgv__raid5__packet_ab4bd1a941ac8b998031f39c55016b0f2}{waiting}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00098}00098                 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00099}00099                 \textcolor{keywordflow}{if} (wp-\/>\mbox{\hyperlink{structgv__raid5__packet_a5bdc6ade1ca13420fe77e6432448510d}{parity}} != NULL) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00100}00100                         \textcolor{keywordflow}{if} (wp-\/>\mbox{\hyperlink{structgv__raid5__packet_a5bdc6ade1ca13420fe77e6432448510d}{parity}}-\/>bio\_cflags \& \mbox{\hyperlink{geom__vinum__var_8h_ad280c068b1168acdcdc2064024d54f95}{GV\_BIO\_MALLOC}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00101}00101                                 \mbox{\hyperlink{geom_8h_ad9924deb20de7b40cb6cf06e5ae28855}{g\_free}}(wp-\/>\mbox{\hyperlink{structgv__raid5__packet_a5bdc6ade1ca13420fe77e6432448510d}{parity}}-\/>bio\_data);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00102}00102                         \mbox{\hyperlink{geom__vinum_8h_a6f92d3f6dc698f442cbb8f28284ec572}{gv\_drive\_done}}(wp-\/>\mbox{\hyperlink{structgv__raid5__packet_a5bdc6ade1ca13420fe77e6432448510d}{parity}}-\/>bio\_caller1);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00103}00103                         \mbox{\hyperlink{geom_8h_ae3cbea7d4bf48f25bb609df3d3f0bb28}{g\_destroy\_bio}}(wp-\/>\mbox{\hyperlink{structgv__raid5__packet_a5bdc6ade1ca13420fe77e6432448510d}{parity}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00104}00104                 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00105}00105                 \mbox{\hyperlink{geom_8h_ad9924deb20de7b40cb6cf06e5ae28855}{g\_free}}(wp);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00106}00106 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00107}00107                 TAILQ\_FOREACH\_SAFE(wp, \&p-\/>packets, list, wp2) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00108}00108                         \textcolor{keywordflow}{if} (wp-\/>\mbox{\hyperlink{structgv__raid5__packet_aabef64e8284af5bc89b79dc3b0042754}{bio}} != \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00109}00109                                 \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00110}00110 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00111}00111                         TAILQ\_REMOVE(\&p-\/>packets, wp, list);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00112}00112                         TAILQ\_FOREACH\_SAFE(bq, \&wp-\/>bits, queue, bq2) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00113}00113                                 TAILQ\_REMOVE(\&wp-\/>bits, bq, queue);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00114}00114                                 \mbox{\hyperlink{geom_8h_ad9924deb20de7b40cb6cf06e5ae28855}{g\_free}}(bq);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00115}00115                         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00116}00116                         \mbox{\hyperlink{geom_8h_ad9924deb20de7b40cb6cf06e5ae28855}{g\_free}}(wp);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00117}00117                 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00118}00118 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00119}00119                 cbp = bioq\_takefirst(p-\/>\mbox{\hyperlink{structgv__plex_a0337c05399b527c7c515740e851e57d4}{bqueue}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00120}00120                 \textcolor{keywordflow}{while} (cbp != NULL) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00121}00121                         \textcolor{keywordflow}{if} (cbp-\/>bio\_cflags \& \mbox{\hyperlink{geom__vinum__var_8h_ad280c068b1168acdcdc2064024d54f95}{GV\_BIO\_MALLOC}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00122}00122                                 \mbox{\hyperlink{geom_8h_ad9924deb20de7b40cb6cf06e5ae28855}{g\_free}}(cbp-\/>bio\_data);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00123}00123                         \mbox{\hyperlink{geom__vinum_8h_a6f92d3f6dc698f442cbb8f28284ec572}{gv\_drive\_done}}(cbp-\/>bio\_caller1);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00124}00124                         \mbox{\hyperlink{geom_8h_ae3cbea7d4bf48f25bb609df3d3f0bb28}{g\_destroy\_bio}}(cbp);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00125}00125                         cbp = bioq\_takefirst(p-\/>\mbox{\hyperlink{structgv__plex_a0337c05399b527c7c515740e851e57d4}{bqueue}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00126}00126                 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00127}00127 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00128}00128                 \textcolor{comment}{/* If internal, stop and reset state. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00129}00129                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_pflags \& \mbox{\hyperlink{geom__vinum__var_8h_a94386dbf2c0a5844982a7b6762d88423}{GV\_BIO\_INTERNAL}}) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00130}00130                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_pflags \& \mbox{\hyperlink{geom__vinum__var_8h_ad280c068b1168acdcdc2064024d54f95}{GV\_BIO\_MALLOC}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00131}00131                                 \mbox{\hyperlink{geom_8h_ad9924deb20de7b40cb6cf06e5ae28855}{g\_free}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_data);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00132}00132                         \mbox{\hyperlink{geom_8h_ae3cbea7d4bf48f25bb609df3d3f0bb28}{g\_destroy\_bio}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00133}00133                         \textcolor{comment}{/* Reset flags. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00134}00134                         p-\/>\mbox{\hyperlink{structgv__plex_a5c5a39055cb50589d0f9ee76860d6a12}{flags}} \&= \string~(\mbox{\hyperlink{geom__vinum__var_8h_ae2f57f1186f28adbc12ccf3984be2fc2}{GV\_PLEX\_SYNCING}} | \mbox{\hyperlink{geom__vinum__var_8h_a13b286c390639eb1d6e8f3823443e7f0}{GV\_PLEX\_REBUILDING}} |}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00135}00135                             \mbox{\hyperlink{geom__vinum__var_8h_a7c137a85de28fa7c787fe903acf5e3b0}{GV\_PLEX\_GROWING}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00136}00136                         \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00137}00137                 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00138}00138                 \mbox{\hyperlink{geom_8h_a0975be2dcd40a26a56a1a9bfc80433e1}{g\_io\_deliver}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, err);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00139}00139                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00140}00140         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00141}00141 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00142}00142         \textcolor{keywordflow}{return} (wp);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00143}00143 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00144}00144 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00145}00145 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00146}00146 \textcolor{comment}{ * Check if the stripe that the work packet wants is already being used by}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00147}00147 \textcolor{comment}{ * some other work packet.}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00148}00148 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00149}00149 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00150}\mbox{\hyperlink{geom__vinum__raid5_8c_ae96ed2f1d2e5a2e6396193c82812700a}{00150}} \mbox{\hyperlink{geom__vinum__raid5_8c_ae96ed2f1d2e5a2e6396193c82812700a}{gv\_stripe\_active}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structgv__plex}{gv\_plex}} *p, \textcolor{keyword}{struct} bio *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00151}00151 \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00152}00152         \textcolor{keyword}{struct }\mbox{\hyperlink{structgv__raid5__packet}{gv\_raid5\_packet}} *wp, *owp;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00153}00153         \textcolor{keywordtype}{int} overlap;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00154}00154 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00155}00155         wp = \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_caller2;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00156}00156         \textcolor{keywordflow}{if} (wp-\/>\mbox{\hyperlink{structgv__raid5__packet_a70ec57db4b399770f6d61907160c3da4}{lockbase}} == -\/1)}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00157}00157                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00158}00158 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00159}00159         overlap = 0;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00160}00160         TAILQ\_FOREACH(owp, \&p-\/>packets, list) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00161}00161                 \textcolor{keywordflow}{if} (owp == wp)}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00162}00162                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00163}00163                 \textcolor{keywordflow}{if} ((wp-\/>\mbox{\hyperlink{structgv__raid5__packet_a70ec57db4b399770f6d61907160c3da4}{lockbase}} >= owp-\/>\mbox{\hyperlink{structgv__raid5__packet_a70ec57db4b399770f6d61907160c3da4}{lockbase}}) \&\&}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00164}00164                     (wp-\/>\mbox{\hyperlink{structgv__raid5__packet_a70ec57db4b399770f6d61907160c3da4}{lockbase}} <= owp-\/>\mbox{\hyperlink{structgv__raid5__packet_a70ec57db4b399770f6d61907160c3da4}{lockbase}} + owp-\/>\mbox{\hyperlink{structgv__raid5__packet_a96a328178f9ae023964ab7b2e7ad99aa}{length}})) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00165}00165                         overlap++;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00166}00166                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00167}00167                 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00168}00168                 \textcolor{keywordflow}{if} ((wp-\/>\mbox{\hyperlink{structgv__raid5__packet_a70ec57db4b399770f6d61907160c3da4}{lockbase}} <= owp-\/>\mbox{\hyperlink{structgv__raid5__packet_a70ec57db4b399770f6d61907160c3da4}{lockbase}}) \&\&}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00169}00169                     (wp-\/>\mbox{\hyperlink{structgv__raid5__packet_a70ec57db4b399770f6d61907160c3da4}{lockbase}} + wp-\/>\mbox{\hyperlink{structgv__raid5__packet_a96a328178f9ae023964ab7b2e7ad99aa}{length}} >= owp-\/>\mbox{\hyperlink{structgv__raid5__packet_a70ec57db4b399770f6d61907160c3da4}{lockbase}})) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00170}00170                         overlap++;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00171}00171                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00172}00172                 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00173}00173         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00174}00174 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00175}00175         \textcolor{keywordflow}{return} (overlap);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00176}00176 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00177}00177 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00178}00178 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00179}\mbox{\hyperlink{geom__vinum__raid5_8c_ab8a81d71cb6f42419993c694018a3620}{00179}} \mbox{\hyperlink{geom__vinum__raid5_8c_ab8a81d71cb6f42419993c694018a3620}{gv\_raid5\_check}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structgv__plex}{gv\_plex}} *p, \textcolor{keyword}{struct} \mbox{\hyperlink{structgv__raid5__packet}{gv\_raid5\_packet}} *wp, \textcolor{keyword}{struct} \mbox{\hyperlink{structgv__raid5__packet_aabef64e8284af5bc89b79dc3b0042754}{bio}} *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}},}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00180}00180     caddr\_t addr, off\_t boff, off\_t bcount)}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00181}00181 \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00182}00182         \textcolor{keyword}{struct }\mbox{\hyperlink{structgv__sd}{gv\_sd}} *parity, *s;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00183}00183         \textcolor{keyword}{struct }\mbox{\hyperlink{structgv__bioq}{gv\_bioq}} *bq;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00184}00184         \textcolor{keyword}{struct }bio *cbp;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00185}00185         \textcolor{keywordtype}{int} i, psdno;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00186}00186         off\_t real\_len, real\_off;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00187}00187 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00188}00188         \textcolor{keywordflow}{if} (p == NULL || LIST\_EMPTY(\&p-\/>subdisks))}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00189}00189                 \textcolor{keywordflow}{return} (ENXIO);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00190}00190 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00191}00191         \mbox{\hyperlink{geom__vinum__raid5_8c_a62a2013d49d91640f3c3ae8dfdbc11da}{gv\_raid5\_offset}}(p, boff, bcount, \&real\_off, \&real\_len, NULL, \&psdno, 1);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00192}00192 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00193}00193         \textcolor{comment}{/* Find the right subdisk. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00194}00194         parity = NULL;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00195}00195         i = 0;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00196}00196         LIST\_FOREACH(s, \&p-\/>subdisks, in\_plex) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00197}00197                 \textcolor{keywordflow}{if} (i == psdno) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00198}00198                         parity = s;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00199}00199                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00200}00200                 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00201}00201                 i++;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00202}00202         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00203}00203 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00204}00204         \textcolor{comment}{/* Parity stripe not found. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00205}00205         \textcolor{keywordflow}{if} (parity == NULL)}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00206}00206                 \textcolor{keywordflow}{return} (ENXIO);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00207}00207 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00208}00208         \textcolor{keywordflow}{if} (parity-\/>\mbox{\hyperlink{structgv__sd_ae69fbd03ecc14fbc16b0d4ed0421b59d}{state}} != \mbox{\hyperlink{geom__vinum__var_8h_a85ea8962028c1319a7fd5cd7adc4e497}{GV\_SD\_UP}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00209}00209                 \textcolor{keywordflow}{return} (ENXIO);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00210}00210 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00211}00211         wp-\/>\mbox{\hyperlink{structgv__raid5__packet_a96a328178f9ae023964ab7b2e7ad99aa}{length}} = real\_len;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00212}00212         wp-\/>\mbox{\hyperlink{structgv__raid5__packet_ab53eca0f6576444a4a102432dd0cc2bd}{data}} = addr;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00213}00213         wp-\/>\mbox{\hyperlink{structgv__raid5__packet_a70ec57db4b399770f6d61907160c3da4}{lockbase}} = real\_off;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00214}00214 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00215}00215         \textcolor{comment}{/* Read all subdisks. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00216}00216         LIST\_FOREACH(s, \&p-\/>subdisks, in\_plex) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00217}00217                 \textcolor{comment}{/* Skip the parity subdisk. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00218}00218                 \textcolor{keywordflow}{if} (s == parity)}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00219}00219                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00220}00220                 \textcolor{comment}{/* Skip growing subdisks. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00221}00221                 \textcolor{keywordflow}{if} (s-\/>\mbox{\hyperlink{structgv__sd_a84a4472842dd92c5ebcf7b103be32c90}{flags}} \& \mbox{\hyperlink{geom__vinum__var_8h_a0cd7617b098897b809b9c9c9498a7605}{GV\_SD\_GROW}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00222}00222                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00223}00223 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00224}00224                 cbp = \mbox{\hyperlink{geom__vinum__raid5_8c_a0472c7788de575386d9d8d0b75bff7f5}{gv\_raid5\_clone\_bio}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, s, wp, NULL, 1);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00225}00225                 \textcolor{keywordflow}{if} (cbp == NULL)}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00226}00226                         \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00227}00227                 cbp-\/>bio\_cmd = BIO\_READ;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00228}00228 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00229}00229                 bioq\_insert\_tail(p-\/>\mbox{\hyperlink{structgv__plex_a0337c05399b527c7c515740e851e57d4}{bqueue}}, cbp);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00230}00230 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00231}00231                 bq = \mbox{\hyperlink{geom_8h_a0f190247baa73dc863a79fea9d5f6b4f}{g\_malloc}}(\textcolor{keyword}{sizeof}(*bq), M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00232}00232                 bq-\/>\mbox{\hyperlink{structgv__bioq_a2ca0d4bfe4e38758b45d4707d55af174}{bp}} = cbp;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00233}00233                 TAILQ\_INSERT\_TAIL(\&wp-\/>bits, bq, queue);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00234}00234         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00235}00235 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00236}00236         \textcolor{comment}{/* Read the parity data. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00237}00237         cbp = \mbox{\hyperlink{geom__vinum__raid5_8c_a0472c7788de575386d9d8d0b75bff7f5}{gv\_raid5\_clone\_bio}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, parity, wp, NULL, 1);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00238}00238         \textcolor{keywordflow}{if} (cbp == NULL)}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00239}00239                 \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00240}00240         cbp-\/>bio\_cmd = BIO\_READ;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00241}00241         wp-\/>\mbox{\hyperlink{structgv__raid5__packet_ab4bd1a941ac8b998031f39c55016b0f2}{waiting}} = cbp;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00242}00242 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00243}00243         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00244}00244 \textcolor{comment}{         * In case we want to rebuild the parity, create an extra BIO to write}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00245}00245 \textcolor{comment}{         * it out.  It also acts as buffer for the XOR operations.}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00246}00246 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00247}00247         cbp = \mbox{\hyperlink{geom__vinum__raid5_8c_a0472c7788de575386d9d8d0b75bff7f5}{gv\_raid5\_clone\_bio}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, parity, wp, addr, 1);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00248}00248         \textcolor{keywordflow}{if} (cbp == NULL)}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00249}00249                 \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00250}00250         wp-\/>\mbox{\hyperlink{structgv__raid5__packet_a5bdc6ade1ca13420fe77e6432448510d}{parity}} = cbp;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00251}00251 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00252}00252         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00253}00253 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00254}00254 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00255}00255 \textcolor{comment}{/* Rebuild a degraded RAID5 plex. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00256}00256 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00257}\mbox{\hyperlink{geom__vinum__raid5_8c_ad4a9178de88c39c05c0bf0c8a0c824b0}{00257}} \mbox{\hyperlink{geom__vinum__raid5_8c_ad4a9178de88c39c05c0bf0c8a0c824b0}{gv\_raid5\_rebuild}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structgv__plex}{gv\_plex}} *p, \textcolor{keyword}{struct} \mbox{\hyperlink{structgv__raid5__packet}{gv\_raid5\_packet}} *wp, \textcolor{keyword}{struct} bio *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}},}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00258}00258     caddr\_t addr, off\_t boff, off\_t bcount)}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00259}00259 \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00260}00260         \textcolor{keyword}{struct }\mbox{\hyperlink{structgv__sd}{gv\_sd}} *broken, *s;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00261}00261         \textcolor{keyword}{struct }\mbox{\hyperlink{structgv__bioq}{gv\_bioq}} *bq;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00262}00262         \textcolor{keyword}{struct }bio *cbp;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00263}00263         off\_t real\_len, real\_off;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00264}00264 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00265}00265         \textcolor{keywordflow}{if} (p == NULL || LIST\_EMPTY(\&p-\/>subdisks))}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00266}00266                 \textcolor{keywordflow}{return} (ENXIO);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00267}00267 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00268}00268         \mbox{\hyperlink{geom__vinum__raid5_8c_a62a2013d49d91640f3c3ae8dfdbc11da}{gv\_raid5\_offset}}(p, boff, bcount, \&real\_off, \&real\_len, NULL, NULL, 1);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00269}00269 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00270}00270         \textcolor{comment}{/* Find the right subdisk. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00271}00271         broken = NULL;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00272}00272         LIST\_FOREACH(s, \&p-\/>subdisks, in\_plex) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00273}00273                 \textcolor{keywordflow}{if} (s-\/>\mbox{\hyperlink{structgv__sd_ae69fbd03ecc14fbc16b0d4ed0421b59d}{state}} != \mbox{\hyperlink{geom__vinum__var_8h_a85ea8962028c1319a7fd5cd7adc4e497}{GV\_SD\_UP}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00274}00274                         broken = s;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00275}00275         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00276}00276 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00277}00277         \textcolor{comment}{/* Broken stripe not found. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00278}00278         \textcolor{keywordflow}{if} (broken == NULL)}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00279}00279                 \textcolor{keywordflow}{return} (ENXIO);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00280}00280 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00281}00281         \textcolor{keywordflow}{switch} (broken-\/>\mbox{\hyperlink{structgv__sd_ae69fbd03ecc14fbc16b0d4ed0421b59d}{state}}) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00282}00282         \textcolor{keywordflow}{case} \mbox{\hyperlink{geom__vinum__var_8h_a85ea8962028c1319a7fd5cd7adc4e497}{GV\_SD\_UP}}:}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00283}00283                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00284}00284 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00285}00285         \textcolor{keywordflow}{case} \mbox{\hyperlink{geom__vinum__var_8h_a5dd4abf3a748b1a4ee0da0bab79840d2}{GV\_SD\_STALE}}:}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00286}00286                 \textcolor{keywordflow}{if} (!(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_pflags \& \mbox{\hyperlink{geom__vinum__var_8h_a66b73898628473532c02ab0d692e17a7}{GV\_BIO\_REBUILD}}))}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00287}00287                         \textcolor{keywordflow}{return} (ENXIO);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00288}00288 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00289}00289                 \mbox{\hyperlink{geom__vinum_8h_a28cdbd7c30e435ff9ec8676f493593a0}{G\_VINUM\_DEBUG}}(1, \textcolor{stringliteral}{"{}sd \%s is reviving"{}}, broken-\/>\mbox{\hyperlink{structgv__sd_a835bdd1e1c9adf03425b91c873eebf1e}{name}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00290}00290                 \mbox{\hyperlink{geom__vinum_8h_a2dc4176c195982e77ba79874f999300e}{gv\_set\_sd\_state}}(broken, \mbox{\hyperlink{geom__vinum__var_8h_a7fe4bfdd815ab9446e630efe806619d1}{GV\_SD\_REVIVING}}, \mbox{\hyperlink{geom__vinum__var_8h_aff3aa8190eaa79b37017c0a247c4bfb9}{GV\_SETSTATE\_FORCE}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00291}00291                 \textcolor{comment}{/* Set this bit now, but should be set at end. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00292}00292                 broken-\/>\mbox{\hyperlink{structgv__sd_a84a4472842dd92c5ebcf7b103be32c90}{flags}} |= \mbox{\hyperlink{geom__vinum__var_8h_a580eee21c71602cef6f2e6443719adb8}{GV\_SD\_CANGOUP}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00293}00293                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00294}00294 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00295}00295         \textcolor{keywordflow}{case} \mbox{\hyperlink{geom__vinum__var_8h_a7fe4bfdd815ab9446e630efe806619d1}{GV\_SD\_REVIVING}}:}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00296}00296                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00297}00297 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00298}00298         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00299}00299                 \textcolor{comment}{/* All other subdisk states mean it's not accessible. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00300}00300                 \textcolor{keywordflow}{return} (ENXIO);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00301}00301         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00302}00302 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00303}00303         wp-\/>\mbox{\hyperlink{structgv__raid5__packet_a96a328178f9ae023964ab7b2e7ad99aa}{length}} = real\_len;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00304}00304         wp-\/>\mbox{\hyperlink{structgv__raid5__packet_ab53eca0f6576444a4a102432dd0cc2bd}{data}} = addr;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00305}00305         wp-\/>\mbox{\hyperlink{structgv__raid5__packet_a70ec57db4b399770f6d61907160c3da4}{lockbase}} = real\_off;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00306}00306 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00307}00307         KASSERT(wp-\/>\mbox{\hyperlink{structgv__raid5__packet_a96a328178f9ae023964ab7b2e7ad99aa}{length}} >= 0, (\textcolor{stringliteral}{"{}gv\_rebuild\_raid5: wp-\/>length < 0"{}}));}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00308}00308 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00309}00309         \textcolor{comment}{/* Read all subdisks. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00310}00310         LIST\_FOREACH(s, \&p-\/>subdisks, in\_plex) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00311}00311                 \textcolor{comment}{/* Skip the broken subdisk. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00312}00312                 \textcolor{keywordflow}{if} (s == broken)}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00313}00313                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00314}00314 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00315}00315                 \textcolor{comment}{/* Skip growing subdisks. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00316}00316                 \textcolor{keywordflow}{if} (s-\/>\mbox{\hyperlink{structgv__sd_a84a4472842dd92c5ebcf7b103be32c90}{flags}} \& \mbox{\hyperlink{geom__vinum__var_8h_a0cd7617b098897b809b9c9c9498a7605}{GV\_SD\_GROW}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00317}00317                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00318}00318 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00319}00319                 cbp = \mbox{\hyperlink{geom__vinum__raid5_8c_a0472c7788de575386d9d8d0b75bff7f5}{gv\_raid5\_clone\_bio}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, s, wp, NULL, 1);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00320}00320                 \textcolor{keywordflow}{if} (cbp == NULL)}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00321}00321                         \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00322}00322                 cbp-\/>bio\_cmd = BIO\_READ;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00323}00323 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00324}00324                 bioq\_insert\_tail(p-\/>\mbox{\hyperlink{structgv__plex_a0337c05399b527c7c515740e851e57d4}{bqueue}}, cbp);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00325}00325 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00326}00326                 bq = \mbox{\hyperlink{geom_8h_a0f190247baa73dc863a79fea9d5f6b4f}{g\_malloc}}(\textcolor{keyword}{sizeof}(*bq), M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00327}00327                 bq-\/>\mbox{\hyperlink{structgv__bioq_a2ca0d4bfe4e38758b45d4707d55af174}{bp}} = cbp;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00328}00328                 TAILQ\_INSERT\_TAIL(\&wp-\/>bits, bq, queue);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00329}00329         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00330}00330 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00331}00331         \textcolor{comment}{/* Write the parity data. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00332}00332         cbp = \mbox{\hyperlink{geom__vinum__raid5_8c_a0472c7788de575386d9d8d0b75bff7f5}{gv\_raid5\_clone\_bio}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, broken, wp, NULL, 1);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00333}00333         \textcolor{keywordflow}{if} (cbp == NULL)}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00334}00334                 \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00335}00335         wp-\/>\mbox{\hyperlink{structgv__raid5__packet_a5bdc6ade1ca13420fe77e6432448510d}{parity}} = cbp;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00336}00336 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00337}00337         p-\/>\mbox{\hyperlink{structgv__plex_a57ccdca6549fd9e5778635743104391e}{synced}} = boff;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00338}00338 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00339}00339         \textcolor{comment}{/* Post notification that we're finished. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00340}00340         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00341}00341 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00342}00342 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00343}00343 \textcolor{comment}{/* Build a request group to perform (part of) a RAID5 request. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00344}00344 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00345}\mbox{\hyperlink{geom__vinum__raid5_8c_adca2c2283dfda3256be8280a2e929a5b}{00345}} \mbox{\hyperlink{geom__vinum__raid5_8c_adca2c2283dfda3256be8280a2e929a5b}{gv\_raid5\_request}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structgv__plex}{gv\_plex}} *p, \textcolor{keyword}{struct} \mbox{\hyperlink{structgv__raid5__packet}{gv\_raid5\_packet}} *wp,}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00346}00346     \textcolor{keyword}{struct} bio *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, caddr\_t addr, off\_t boff, off\_t bcount, \textcolor{keywordtype}{int} *delay)}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00347}00347 \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00348}00348         \textcolor{keyword}{struct }\mbox{\hyperlink{structgv__sd}{gv\_sd}} *broken, *original, *parity, *s;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00349}00349         \textcolor{keyword}{struct }\mbox{\hyperlink{structgv__bioq}{gv\_bioq}} *bq;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00350}00350         \textcolor{keyword}{struct }bio *cbp;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00351}00351         \textcolor{keywordtype}{int} i, psdno, sdno, \mbox{\hyperlink{geom__flashmap_8c_a763fd8db6bba8fbbbc113ca0d61c47c2}{type}}, grow;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00352}00352         off\_t real\_len, real\_off;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00353}00353 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00354}00354         \textcolor{keywordflow}{if} (p == NULL || LIST\_EMPTY(\&p-\/>subdisks))}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00355}00355                 \textcolor{keywordflow}{return} (ENXIO);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00356}00356 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00357}00357         \textcolor{comment}{/* We are optimistic and assume that this request will be OK. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00358}00358 \textcolor{preprocessor}{\#define REQ\_TYPE\_NORMAL         0}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00359}00359 \textcolor{preprocessor}{\#define REQ\_TYPE\_DEGRADED       1}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00360}00360 \textcolor{preprocessor}{\#define REQ\_TYPE\_NOPARITY       2}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00361}00361 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00362}00362         \mbox{\hyperlink{geom__flashmap_8c_a763fd8db6bba8fbbbc113ca0d61c47c2}{type}} = \mbox{\hyperlink{geom__vinum__raid5_8c_ae78bad903cbfe83c2e779e940b4b516e}{REQ\_TYPE\_NORMAL}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00363}00363         original = parity = broken = NULL;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00364}00364 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00365}00365         \textcolor{comment}{/* XXX: The resize won't crash with rebuild or sync, but we should still}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00366}00366 \textcolor{comment}{         * be aware of it. Also this should perhaps be done on rebuild/check as}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00367}00367 \textcolor{comment}{         * well?}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00368}00368 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00369}00369         \textcolor{comment}{/* If we're over, we must use the old. */} }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00370}00370         \textcolor{keywordflow}{if} (boff >= p-\/>\mbox{\hyperlink{structgv__plex_a57ccdca6549fd9e5778635743104391e}{synced}}) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00371}00371                 grow = 1;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00372}00372         \textcolor{comment}{/* Or if over the resized offset, we use all drives. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00373}00373         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (boff + bcount <= p-\/>synced) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00374}00374                 grow = 0;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00375}00375         \textcolor{comment}{/* Else, we're in the middle, and must wait a bit. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00376}00376         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00377}00377                 bioq\_disksort(p-\/>\mbox{\hyperlink{structgv__plex_aa0e0c78ec187fb3900bcefa7e9775e60}{rqueue}}, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00378}00378                 *delay = 1;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00379}00379                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00380}00380         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00381}00381         \mbox{\hyperlink{geom__vinum__raid5_8c_a62a2013d49d91640f3c3ae8dfdbc11da}{gv\_raid5\_offset}}(p, boff, bcount, \&real\_off, \&real\_len,}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00382}00382             \&sdno, \&psdno, grow);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00383}00383 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00384}00384         \textcolor{comment}{/* Find the right subdisks. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00385}00385         i = 0;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00386}00386         LIST\_FOREACH(s, \&p-\/>subdisks, in\_plex) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00387}00387                 \textcolor{keywordflow}{if} (i == sdno)}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00388}00388                         original = s;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00389}00389                 \textcolor{keywordflow}{if} (i == psdno)}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00390}00390                         parity = s;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00391}00391                 \textcolor{keywordflow}{if} (s-\/>\mbox{\hyperlink{structgv__sd_ae69fbd03ecc14fbc16b0d4ed0421b59d}{state}} != \mbox{\hyperlink{geom__vinum__var_8h_a85ea8962028c1319a7fd5cd7adc4e497}{GV\_SD\_UP}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00392}00392                         broken = s;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00393}00393                 i++;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00394}00394         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00395}00395 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00396}00396         \textcolor{keywordflow}{if} ((original == NULL) || (parity == NULL))}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00397}00397                 \textcolor{keywordflow}{return} (ENXIO);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00398}00398 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00399}00399         \textcolor{comment}{/* Our data stripe is missing. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00400}00400         \textcolor{keywordflow}{if} (original-\/>\mbox{\hyperlink{structgv__sd_ae69fbd03ecc14fbc16b0d4ed0421b59d}{state}} != \mbox{\hyperlink{geom__vinum__var_8h_a85ea8962028c1319a7fd5cd7adc4e497}{GV\_SD\_UP}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00401}00401                 \mbox{\hyperlink{geom__flashmap_8c_a763fd8db6bba8fbbbc113ca0d61c47c2}{type}} = \mbox{\hyperlink{geom__vinum__raid5_8c_a0cb8a21f3394e41c70bcf4f95fbd3919}{REQ\_TYPE\_DEGRADED}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00402}00402 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00403}00403         \textcolor{comment}{/* If synchronizing request, just write it if disks are stale. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00404}00404         \textcolor{keywordflow}{if} (original-\/>\mbox{\hyperlink{structgv__sd_ae69fbd03ecc14fbc16b0d4ed0421b59d}{state}} == \mbox{\hyperlink{geom__vinum__var_8h_a5dd4abf3a748b1a4ee0da0bab79840d2}{GV\_SD\_STALE}} \&\& parity-\/>\mbox{\hyperlink{structgv__sd_ae69fbd03ecc14fbc16b0d4ed0421b59d}{state}} == \mbox{\hyperlink{geom__vinum__var_8h_a5dd4abf3a748b1a4ee0da0bab79840d2}{GV\_SD\_STALE}} \&\&}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00405}00405             \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_pflags \& \mbox{\hyperlink{geom__vinum__var_8h_a7ec2ae8b8f781367b43b86d0879acc13}{GV\_BIO\_SYNCREQ}} \&\& \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_cmd == BIO\_WRITE) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00406}00406                 \mbox{\hyperlink{geom__flashmap_8c_a763fd8db6bba8fbbbc113ca0d61c47c2}{type}} = \mbox{\hyperlink{geom__vinum__raid5_8c_ae78bad903cbfe83c2e779e940b4b516e}{REQ\_TYPE\_NORMAL}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00407}00407         \textcolor{comment}{/* Our parity stripe is missing. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00408}00408         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (parity-\/>\mbox{\hyperlink{structgv__sd_ae69fbd03ecc14fbc16b0d4ed0421b59d}{state}} != \mbox{\hyperlink{geom__vinum__var_8h_a85ea8962028c1319a7fd5cd7adc4e497}{GV\_SD\_UP}}) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00409}00409                 \textcolor{comment}{/* We cannot take another failure if we're already degraded. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00410}00410                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{geom__flashmap_8c_a763fd8db6bba8fbbbc113ca0d61c47c2}{type}} != \mbox{\hyperlink{geom__vinum__raid5_8c_ae78bad903cbfe83c2e779e940b4b516e}{REQ\_TYPE\_NORMAL}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00411}00411                         \textcolor{keywordflow}{return} (ENXIO);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00412}00412                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00413}00413                         \mbox{\hyperlink{geom__flashmap_8c_a763fd8db6bba8fbbbc113ca0d61c47c2}{type}} = \mbox{\hyperlink{geom__vinum__raid5_8c_ad900c42dd0384be35653c3903667c945}{REQ\_TYPE\_NOPARITY}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00414}00414         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00415}00415 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00416}00416         wp-\/>\mbox{\hyperlink{structgv__raid5__packet_a96a328178f9ae023964ab7b2e7ad99aa}{length}} = real\_len;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00417}00417         wp-\/>\mbox{\hyperlink{structgv__raid5__packet_ab53eca0f6576444a4a102432dd0cc2bd}{data}} = addr;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00418}00418         wp-\/>\mbox{\hyperlink{structgv__raid5__packet_a70ec57db4b399770f6d61907160c3da4}{lockbase}} = real\_off;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00419}00419 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00420}00420         KASSERT(wp-\/>\mbox{\hyperlink{structgv__raid5__packet_a96a328178f9ae023964ab7b2e7ad99aa}{length}} >= 0, (\textcolor{stringliteral}{"{}gv\_build\_raid5\_request: wp-\/>length < 0"{}}));}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00421}00421 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00422}00422         \textcolor{keywordflow}{if} ((p-\/>\mbox{\hyperlink{structgv__plex_a5c5a39055cb50589d0f9ee76860d6a12}{flags}} \& \mbox{\hyperlink{geom__vinum__var_8h_a13b286c390639eb1d6e8f3823443e7f0}{GV\_PLEX\_REBUILDING}}) \&\& (boff + real\_len < p-\/>synced))}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00423}00423                 \mbox{\hyperlink{geom__flashmap_8c_a763fd8db6bba8fbbbc113ca0d61c47c2}{type}} = \mbox{\hyperlink{geom__vinum__raid5_8c_ae78bad903cbfe83c2e779e940b4b516e}{REQ\_TYPE\_NORMAL}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00424}00424 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00425}00425         \textcolor{keywordflow}{if} ((p-\/>\mbox{\hyperlink{structgv__plex_a5c5a39055cb50589d0f9ee76860d6a12}{flags}} \& \mbox{\hyperlink{geom__vinum__var_8h_a13b286c390639eb1d6e8f3823443e7f0}{GV\_PLEX\_REBUILDING}}) \&\& (boff + real\_len >= p-\/>\mbox{\hyperlink{structgv__plex_a57ccdca6549fd9e5778635743104391e}{synced}})) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00426}00426                 bioq\_disksort(p-\/>\mbox{\hyperlink{structgv__plex_aa0e0c78ec187fb3900bcefa7e9775e60}{rqueue}}, \mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00427}00427                 *delay = 1;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00428}00428                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00429}00429         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00430}00430 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00431}00431         \textcolor{keywordflow}{switch} (\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}-\/>bio\_cmd) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00432}00432         \textcolor{keywordflow}{case} BIO\_READ:}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00433}00433                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00434}00434 \textcolor{comment}{                 * For a degraded read we need to read in all stripes except}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00435}00435 \textcolor{comment}{                 * the broken one plus the parity stripe and then recalculate}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00436}00436 \textcolor{comment}{                 * the desired data.}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00437}00437 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00438}00438                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{geom__flashmap_8c_a763fd8db6bba8fbbbc113ca0d61c47c2}{type}} == \mbox{\hyperlink{geom__vinum__raid5_8c_a0cb8a21f3394e41c70bcf4f95fbd3919}{REQ\_TYPE\_DEGRADED}}) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00439}00439                         bzero(wp-\/>\mbox{\hyperlink{structgv__raid5__packet_ab53eca0f6576444a4a102432dd0cc2bd}{data}}, wp-\/>\mbox{\hyperlink{structgv__raid5__packet_a96a328178f9ae023964ab7b2e7ad99aa}{length}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00440}00440                         LIST\_FOREACH(s, \&p-\/>subdisks, in\_plex) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00441}00441                                 \textcolor{comment}{/* Skip the broken subdisk. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00442}00442                                 \textcolor{keywordflow}{if} (s == broken)}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00443}00443                                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00444}00444                                 \textcolor{comment}{/* Skip growing if within offset. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00445}00445                                 \textcolor{keywordflow}{if} (grow \&\& s-\/>\mbox{\hyperlink{structgv__sd_a84a4472842dd92c5ebcf7b103be32c90}{flags}} \& \mbox{\hyperlink{geom__vinum__var_8h_a0cd7617b098897b809b9c9c9498a7605}{GV\_SD\_GROW}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00446}00446                                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00447}00447                                 cbp = \mbox{\hyperlink{geom__vinum__raid5_8c_a0472c7788de575386d9d8d0b75bff7f5}{gv\_raid5\_clone\_bio}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, s, wp, NULL, 1);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00448}00448                                 \textcolor{keywordflow}{if} (cbp == NULL)}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00449}00449                                         \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00450}00450 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00451}00451                                 bioq\_insert\_tail(p-\/>\mbox{\hyperlink{structgv__plex_a0337c05399b527c7c515740e851e57d4}{bqueue}}, cbp);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00452}00452 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00453}00453                                 bq = \mbox{\hyperlink{geom_8h_a0f190247baa73dc863a79fea9d5f6b4f}{g\_malloc}}(\textcolor{keyword}{sizeof}(*bq), M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00454}00454                                 bq-\/>\mbox{\hyperlink{structgv__bioq_a2ca0d4bfe4e38758b45d4707d55af174}{bp}} = cbp;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00455}00455                                 TAILQ\_INSERT\_TAIL(\&wp-\/>bits, bq, queue);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00456}00456                         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00457}00457 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00458}00458                 \textcolor{comment}{/* A normal read can be fulfilled with the original subdisk. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00459}00459                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00460}00460                         cbp = \mbox{\hyperlink{geom__vinum__raid5_8c_a0472c7788de575386d9d8d0b75bff7f5}{gv\_raid5\_clone\_bio}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, original, wp, addr, 0);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00461}00461                         \textcolor{keywordflow}{if} (cbp == NULL)}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00462}00462                                 \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00463}00463 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00464}00464                         bioq\_insert\_tail(p-\/>\mbox{\hyperlink{structgv__plex_a0337c05399b527c7c515740e851e57d4}{bqueue}}, cbp);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00465}00465                 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00466}00466                 wp-\/>\mbox{\hyperlink{structgv__raid5__packet_a70ec57db4b399770f6d61907160c3da4}{lockbase}} = -\/1;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00467}00467 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00468}00468                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00469}00469 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00470}00470         \textcolor{keywordflow}{case} BIO\_WRITE:}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00471}00471                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00472}00472 \textcolor{comment}{                 * A degraded write means we cannot write to the original data}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00473}00473 \textcolor{comment}{                 * subdisk.  Thus we need to read in all valid stripes,}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00474}00474 \textcolor{comment}{                 * recalculate the parity from the original data, and then}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00475}00475 \textcolor{comment}{                 * write the parity stripe back out.}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00476}00476 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00477}00477                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{geom__flashmap_8c_a763fd8db6bba8fbbbc113ca0d61c47c2}{type}} == \mbox{\hyperlink{geom__vinum__raid5_8c_a0cb8a21f3394e41c70bcf4f95fbd3919}{REQ\_TYPE\_DEGRADED}}) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00478}00478                         \textcolor{comment}{/* Read all subdisks. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00479}00479                         LIST\_FOREACH(s, \&p-\/>subdisks, in\_plex) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00480}00480                                 \textcolor{comment}{/* Skip the broken and the parity subdisk. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00481}00481                                 \textcolor{keywordflow}{if} ((s == broken) || (s == parity))}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00482}00482                                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00483}00483                                 \textcolor{comment}{/* Skip growing if within offset. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00484}00484                                 \textcolor{keywordflow}{if} (grow \&\& s-\/>\mbox{\hyperlink{structgv__sd_a84a4472842dd92c5ebcf7b103be32c90}{flags}} \& \mbox{\hyperlink{geom__vinum__var_8h_a0cd7617b098897b809b9c9c9498a7605}{GV\_SD\_GROW}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00485}00485                                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00486}00486 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00487}00487                                 cbp = \mbox{\hyperlink{geom__vinum__raid5_8c_a0472c7788de575386d9d8d0b75bff7f5}{gv\_raid5\_clone\_bio}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, s, wp, NULL, 1);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00488}00488                                 \textcolor{keywordflow}{if} (cbp == NULL)}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00489}00489                                         \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00490}00490                                 cbp-\/>bio\_cmd = BIO\_READ;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00491}00491 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00492}00492                                 bioq\_insert\_tail(p-\/>\mbox{\hyperlink{structgv__plex_a0337c05399b527c7c515740e851e57d4}{bqueue}}, cbp);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00493}00493 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00494}00494                                 bq = \mbox{\hyperlink{geom_8h_a0f190247baa73dc863a79fea9d5f6b4f}{g\_malloc}}(\textcolor{keyword}{sizeof}(*bq), M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00495}00495                                 bq-\/>\mbox{\hyperlink{structgv__bioq_a2ca0d4bfe4e38758b45d4707d55af174}{bp}} = cbp;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00496}00496                                 TAILQ\_INSERT\_TAIL(\&wp-\/>bits, bq, queue);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00497}00497                         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00498}00498 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00499}00499                         \textcolor{comment}{/* Write the parity data. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00500}00500                         cbp = \mbox{\hyperlink{geom__vinum__raid5_8c_a0472c7788de575386d9d8d0b75bff7f5}{gv\_raid5\_clone\_bio}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, parity, wp, NULL, 1);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00501}00501                         \textcolor{keywordflow}{if} (cbp == NULL)}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00502}00502                                 \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00503}00503                         bcopy(addr, cbp-\/>bio\_data, wp-\/>\mbox{\hyperlink{structgv__raid5__packet_a96a328178f9ae023964ab7b2e7ad99aa}{length}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00504}00504                         wp-\/>\mbox{\hyperlink{structgv__raid5__packet_a5bdc6ade1ca13420fe77e6432448510d}{parity}} = cbp;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00505}00505 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00506}00506                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00507}00507 \textcolor{comment}{                 * When the parity stripe is missing we just write out the data.}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00508}00508 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00509}00509                 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (\mbox{\hyperlink{geom__flashmap_8c_a763fd8db6bba8fbbbc113ca0d61c47c2}{type}} == \mbox{\hyperlink{geom__vinum__raid5_8c_ad900c42dd0384be35653c3903667c945}{REQ\_TYPE\_NOPARITY}}) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00510}00510                         cbp = \mbox{\hyperlink{geom__vinum__raid5_8c_a0472c7788de575386d9d8d0b75bff7f5}{gv\_raid5\_clone\_bio}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, original, wp, addr, 1);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00511}00511                         \textcolor{keywordflow}{if} (cbp == NULL)}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00512}00512                                 \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00513}00513 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00514}00514                         bioq\_insert\_tail(p-\/>\mbox{\hyperlink{structgv__plex_a0337c05399b527c7c515740e851e57d4}{bqueue}}, cbp);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00515}00515 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00516}00516                         bq = \mbox{\hyperlink{geom_8h_a0f190247baa73dc863a79fea9d5f6b4f}{g\_malloc}}(\textcolor{keyword}{sizeof}(*bq), M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00517}00517                         bq-\/>\mbox{\hyperlink{structgv__bioq_a2ca0d4bfe4e38758b45d4707d55af174}{bp}} = cbp;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00518}00518                         TAILQ\_INSERT\_TAIL(\&wp-\/>bits, bq, queue);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00519}00519 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00520}00520                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00521}00521 \textcolor{comment}{                 * A normal write request goes to the original subdisk, then we}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00522}00522 \textcolor{comment}{                 * read in all other stripes, recalculate the parity and write}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00523}00523 \textcolor{comment}{                 * out the parity again.}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00524}00524 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00525}00525                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00526}00526                         \textcolor{comment}{/* Read old parity. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00527}00527                         cbp = \mbox{\hyperlink{geom__vinum__raid5_8c_a0472c7788de575386d9d8d0b75bff7f5}{gv\_raid5\_clone\_bio}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, parity, wp, NULL, 1);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00528}00528                         \textcolor{keywordflow}{if} (cbp == NULL)}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00529}00529                                 \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00530}00530                         cbp-\/>bio\_cmd = BIO\_READ;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00531}00531 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00532}00532                         bioq\_insert\_tail(p-\/>\mbox{\hyperlink{structgv__plex_a0337c05399b527c7c515740e851e57d4}{bqueue}}, cbp);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00533}00533 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00534}00534                         bq = \mbox{\hyperlink{geom_8h_a0f190247baa73dc863a79fea9d5f6b4f}{g\_malloc}}(\textcolor{keyword}{sizeof}(*bq), M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00535}00535                         bq-\/>\mbox{\hyperlink{structgv__bioq_a2ca0d4bfe4e38758b45d4707d55af174}{bp}} = cbp;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00536}00536                         TAILQ\_INSERT\_TAIL(\&wp-\/>bits, bq, queue);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00537}00537 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00538}00538                         \textcolor{comment}{/* Read old data. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00539}00539                         cbp = \mbox{\hyperlink{geom__vinum__raid5_8c_a0472c7788de575386d9d8d0b75bff7f5}{gv\_raid5\_clone\_bio}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, original, wp, NULL, 1);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00540}00540                         \textcolor{keywordflow}{if} (cbp == NULL)}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00541}00541                                 \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00542}00542                         cbp-\/>bio\_cmd = BIO\_READ;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00543}00543 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00544}00544                         bioq\_insert\_tail(p-\/>\mbox{\hyperlink{structgv__plex_a0337c05399b527c7c515740e851e57d4}{bqueue}}, cbp);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00545}00545 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00546}00546                         bq = \mbox{\hyperlink{geom_8h_a0f190247baa73dc863a79fea9d5f6b4f}{g\_malloc}}(\textcolor{keyword}{sizeof}(*bq), M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00547}00547                         bq-\/>\mbox{\hyperlink{structgv__bioq_a2ca0d4bfe4e38758b45d4707d55af174}{bp}} = cbp;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00548}00548                         TAILQ\_INSERT\_TAIL(\&wp-\/>bits, bq, queue);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00549}00549 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00550}00550                         \textcolor{comment}{/* Write new data. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00551}00551                         cbp = \mbox{\hyperlink{geom__vinum__raid5_8c_a0472c7788de575386d9d8d0b75bff7f5}{gv\_raid5\_clone\_bio}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, original, wp, addr, 1);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00552}00552                         \textcolor{keywordflow}{if} (cbp == NULL)}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00553}00553                                 \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00554}00554 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00555}00555                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00556}00556 \textcolor{comment}{                         * We must not write the new data until the old data}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00557}00557 \textcolor{comment}{                         * was read, so hold this BIO back until we're ready}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00558}00558 \textcolor{comment}{                         * for it.}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00559}00559 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00560}00560                         wp-\/>\mbox{\hyperlink{structgv__raid5__packet_ab4bd1a941ac8b998031f39c55016b0f2}{waiting}} = cbp;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00561}00561 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00562}00562                         \textcolor{comment}{/* The final bio for the parity. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00563}00563                         cbp = \mbox{\hyperlink{geom__vinum__raid5_8c_a0472c7788de575386d9d8d0b75bff7f5}{gv\_raid5\_clone\_bio}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, parity, wp, NULL, 1);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00564}00564                         \textcolor{keywordflow}{if} (cbp == NULL)}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00565}00565                                 \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00566}00566 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00567}00567                         \textcolor{comment}{/* Remember that this is the BIO for the parity data. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00568}00568                         wp-\/>\mbox{\hyperlink{structgv__raid5__packet_a5bdc6ade1ca13420fe77e6432448510d}{parity}} = cbp;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00569}00569                 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00570}00570                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00571}00571 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00572}00572         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00573}00573                 \textcolor{keywordflow}{return} (EINVAL);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00574}00574         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00575}00575 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00576}00576         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00577}00577 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00578}00578 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00579}00579 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00580}00580 \textcolor{comment}{ * Calculate the offsets in the various subdisks for a RAID5 request. Also take}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00581}00581 \textcolor{comment}{ * care of new subdisks in an expanded RAID5 array. }}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00582}00582 \textcolor{comment}{ * XXX: This assumes that the new subdisks are inserted after the others (which}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00583}00583 \textcolor{comment}{ * is okay as long as plex\_offset is larger). If subdisks are inserted into the}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00584}00584 \textcolor{comment}{ * plexlist before, we get problems.}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00585}00585 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00586}00586 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00587}\mbox{\hyperlink{geom__vinum__raid5_8c_a62a2013d49d91640f3c3ae8dfdbc11da}{00587}} \mbox{\hyperlink{geom__vinum__raid5_8c_a62a2013d49d91640f3c3ae8dfdbc11da}{gv\_raid5\_offset}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structgv__plex}{gv\_plex}} *p, off\_t boff, off\_t bcount, off\_t *real\_off,}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00588}00588     off\_t *real\_len, \textcolor{keywordtype}{int} *sdno, \textcolor{keywordtype}{int} *psdno, \textcolor{keywordtype}{int} growing)}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00589}00589 \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00590}00590         \textcolor{keyword}{struct }\mbox{\hyperlink{structgv__sd}{gv\_sd}} *s;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00591}00591         \textcolor{keywordtype}{int} \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}, psd, sdcount;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00592}00592         off\_t len\_left, stripeend, stripeoff, stripestart;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00593}00593 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00594}00594         sdcount = p-\/>\mbox{\hyperlink{structgv__plex_ab8419aad736c119ac828740cce0e235c}{sdcount}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00595}00595         \textcolor{keywordflow}{if} (growing) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00596}00596                 LIST\_FOREACH(s, \&p-\/>subdisks, in\_plex) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00597}00597                         \textcolor{keywordflow}{if} (s-\/>\mbox{\hyperlink{structgv__sd_a84a4472842dd92c5ebcf7b103be32c90}{flags}} \& \mbox{\hyperlink{geom__vinum__var_8h_a0cd7617b098897b809b9c9c9498a7605}{GV\_SD\_GROW}})}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00598}00598                                 sdcount-\/-\/;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00599}00599                 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00600}00600         \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00601}00601 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00602}00602         \textcolor{comment}{/* The number of the subdisk containing the parity stripe. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00603}00603         psd = sdcount -\/ 1 -\/ ( boff / (p-\/>\mbox{\hyperlink{structgv__plex_a670e4abf06a7ee6c9737aeffd3e1e15e}{stripesize}} * (sdcount -\/ 1))) \%}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00604}00604             sdcount;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00605}00605         KASSERT(psdno >= 0, (\textcolor{stringliteral}{"{}gv\_raid5\_offset: psdno < 0"{}}));}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00606}00606 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00607}00607         \textcolor{comment}{/* Offset of the start address from the start of the stripe. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00608}00608         stripeoff = boff \% (p-\/>\mbox{\hyperlink{structgv__plex_a670e4abf06a7ee6c9737aeffd3e1e15e}{stripesize}} * (sdcount -\/ 1));}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00609}00609         KASSERT(stripeoff >= 0, (\textcolor{stringliteral}{"{}gv\_raid5\_offset: stripeoff < 0"{}}));}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00610}00610 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00611}00611         \textcolor{comment}{/* The number of the subdisk where the stripe resides. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00612}00612         \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}} = stripeoff / p-\/>\mbox{\hyperlink{structgv__plex_a670e4abf06a7ee6c9737aeffd3e1e15e}{stripesize}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00613}00613         KASSERT(sdno >= 0, (\textcolor{stringliteral}{"{}gv\_raid5\_offset: sdno < 0"{}}));}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00614}00614 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00615}00615         \textcolor{comment}{/* At or past parity subdisk. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00616}00616         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}} >= psd)}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00617}00617                 \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}++;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00618}00618 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00619}00619         \textcolor{comment}{/* The offset of the stripe on this subdisk. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00620}00620         stripestart = (boff -\/ stripeoff) / (sdcount -\/ 1);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00621}00621         KASSERT(stripestart >= 0, (\textcolor{stringliteral}{"{}gv\_raid5\_offset: stripestart < 0"{}}));}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00622}00622 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00623}00623         stripeoff \%= p-\/>\mbox{\hyperlink{structgv__plex_a670e4abf06a7ee6c9737aeffd3e1e15e}{stripesize}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00624}00624 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00625}00625         \textcolor{comment}{/* The offset of the request on this subdisk. */}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00626}00626         *real\_off = stripestart + stripeoff;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00627}00627 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00628}00628         stripeend = stripestart + p-\/>\mbox{\hyperlink{structgv__plex_a670e4abf06a7ee6c9737aeffd3e1e15e}{stripesize}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00629}00629         len\_left = stripeend -\/ *real\_off;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00630}00630         KASSERT(len\_left >= 0, (\textcolor{stringliteral}{"{}gv\_raid5\_offset: len\_left < 0"{}}));}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00631}00631 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00632}00632         *real\_len = (bcount <= len\_left) ? bcount : len\_left;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00633}00633 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00634}00634         \textcolor{keywordflow}{if} (sdno != NULL)}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00635}00635                 *sdno = \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00636}00636         \textcolor{keywordflow}{if} (psdno != NULL)}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00637}00637                 *psdno = psd;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00638}00638 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00639}00639         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00640}00640 \}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00641}00641 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00642}00642 \textcolor{keyword}{static} \textcolor{keyword}{struct }bio *}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00643}\mbox{\hyperlink{geom__vinum__raid5_8c_a0472c7788de575386d9d8d0b75bff7f5}{00643}} \mbox{\hyperlink{geom__vinum__raid5_8c_a0472c7788de575386d9d8d0b75bff7f5}{gv\_raid5\_clone\_bio}}(\textcolor{keyword}{struct} bio *\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}}, \textcolor{keyword}{struct} \mbox{\hyperlink{structgv__sd}{gv\_sd}} *s, \textcolor{keyword}{struct} \mbox{\hyperlink{structgv__raid5__packet}{gv\_raid5\_packet}} *wp,}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00644}00644     caddr\_t addr, \textcolor{keywordtype}{int} use\_wp)}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00645}00645 \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00646}00646         \textcolor{keyword}{struct }bio *cbp;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00647}00647 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00648}00648         cbp = \mbox{\hyperlink{geom_8h_a4ef26e4ec68e35e8f892692c524a3d4f}{g\_clone\_bio}}(\mbox{\hyperlink{g__part__if_8m_a3786db8db96c32f69df9f7cd325a7507}{bp}});}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00649}00649         \textcolor{keywordflow}{if} (cbp == NULL)}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00650}00650                 \textcolor{keywordflow}{return} (NULL);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00651}00651         \textcolor{keywordflow}{if} (addr == NULL) \{}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00652}00652                 cbp-\/>bio\_data = \mbox{\hyperlink{geom_8h_a0f190247baa73dc863a79fea9d5f6b4f}{g\_malloc}}(wp-\/>\mbox{\hyperlink{structgv__raid5__packet_a96a328178f9ae023964ab7b2e7ad99aa}{length}}, M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00653}00653                 cbp-\/>bio\_cflags |= \mbox{\hyperlink{geom__vinum__var_8h_ad280c068b1168acdcdc2064024d54f95}{GV\_BIO\_MALLOC}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00654}00654         \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00655}00655                 cbp-\/>bio\_data = addr;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00656}00656         cbp-\/>bio\_offset = wp-\/>\mbox{\hyperlink{structgv__raid5__packet_a70ec57db4b399770f6d61907160c3da4}{lockbase}} + s-\/>\mbox{\hyperlink{structgv__sd_a7affffaf0220e9c53c090bb6f41fb2b4}{drive\_offset}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00657}00657         cbp-\/>bio\_length = wp-\/>\mbox{\hyperlink{structgv__raid5__packet_a96a328178f9ae023964ab7b2e7ad99aa}{length}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00658}00658         cbp-\/>bio\_done = \mbox{\hyperlink{geom__vinum_8c_adbae7172cb3db2c9c35b43627fac0acf}{gv\_done}};}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00659}00659         cbp-\/>bio\_caller1 = s;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00660}00660         s-\/>\mbox{\hyperlink{structgv__sd_a2b31867e2118053e8a27ce048a84335e}{drive\_sc}}-\/>\mbox{\hyperlink{structgv__drive_a759edecae364198073e02410a6db4132}{active}}++;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00661}00661         \textcolor{keywordflow}{if} (use\_wp)}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00662}00662                 cbp-\/>bio\_caller2 = wp;}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00663}00663 }
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00664}00664         \textcolor{keywordflow}{return} (cbp);}
\DoxyCodeLine{\Hypertarget{geom__vinum__raid5_8c_source_l00665}00665 \}}

\end{DoxyCode}
