\hypertarget{md__promise_8c_source}{}\doxysection{md\+\_\+promise.\+c}
\label{md__promise_8c_source}\index{geom/raid/md\_promise.c@{geom/raid/md\_promise.c}}
\mbox{\hyperlink{md__promise_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00001}00001 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00002}00002 \textcolor{comment}{ * SPDX-\/License-\/Identifier: BSD-\/2-\/Clause-\/FreeBSD}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00003}00003 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00004}00004 \textcolor{comment}{ * Copyright (c) 2011 Alexander Motin <mav@FreeBSD.org>}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00005}00005 \textcolor{comment}{ * Copyright (c) 2000 -\/ 2008 Søren Schmidt <sos@FreeBSD.org>}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00006}00006 \textcolor{comment}{ * All rights reserved.}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00007}00007 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00008}00008 \textcolor{comment}{ * Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00009}00009 \textcolor{comment}{ * modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00010}00010 \textcolor{comment}{ * are met:}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00011}00011 \textcolor{comment}{ * 1. Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00012}00012 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00013}00013 \textcolor{comment}{ * 2. Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00014}00014 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer in the}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00015}00015 \textcolor{comment}{ *    documentation and/or other materials provided with the distribution.}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00016}00016 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00017}00017 \textcolor{comment}{ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00018}00018 \textcolor{comment}{ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00019}00019 \textcolor{comment}{ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00020}00020 \textcolor{comment}{ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00021}00021 \textcolor{comment}{ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00022}00022 \textcolor{comment}{ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00023}00023 \textcolor{comment}{ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00024}00024 \textcolor{comment}{ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00025}00025 \textcolor{comment}{ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00026}00026 \textcolor{comment}{ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00027}00027 \textcolor{comment}{ * SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00028}00028 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00029}00029 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00030}00030 \textcolor{preprocessor}{\#include <sys/cdefs.h>}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00031}\mbox{\hyperlink{md__promise_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{00031}} \mbox{\hyperlink{md__promise_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{\_\_FBSDID}}(\textcolor{stringliteral}{"{}\$FreeBSD\$"{}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00032}00032 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00033}00033 \textcolor{preprocessor}{\#include <sys/param.h>}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00034}00034 \textcolor{preprocessor}{\#include <sys/bio.h>}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00035}00035 \textcolor{preprocessor}{\#include <sys/endian.h>}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00036}00036 \textcolor{preprocessor}{\#include <sys/kernel.h>}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00037}00037 \textcolor{preprocessor}{\#include <sys/kobj.h>}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00038}00038 \textcolor{preprocessor}{\#include <sys/limits.h>}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00039}00039 \textcolor{preprocessor}{\#include <sys/lock.h>}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00040}00040 \textcolor{preprocessor}{\#include <sys/malloc.h>}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00041}00041 \textcolor{preprocessor}{\#include <sys/mutex.h>}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00042}00042 \textcolor{preprocessor}{\#include <sys/systm.h>}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00043}00043 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{geom_8h}{geom/geom.h}}>}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00044}00044 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{geom__dbg_8h}{geom/geom\_dbg.h}}>}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00045}00045 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{g__raid_8h}{geom/raid/g\_raid.h}}"{}}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00046}00046 \textcolor{preprocessor}{\#include "{}g\_raid\_md\_if.h"{}}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00047}00047 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00048}\mbox{\hyperlink{md__promise_8c_a1282c78ceea4c7415b77efba7262cbac}{00048}} \textcolor{keyword}{static} \mbox{\hyperlink{md__promise_8c_a1282c78ceea4c7415b77efba7262cbac}{MALLOC\_DEFINE}}(M\_MD\_PROMISE, \textcolor{stringliteral}{"{}md\_promise\_data"{}}, \textcolor{stringliteral}{"{}GEOM\_RAID Promise metadata"{}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00049}00049 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00050}\mbox{\hyperlink{md__promise_8c_a6043ecc0cea629458c18b11a0f79d913}{00050}} \textcolor{preprocessor}{\#define PROMISE\_MAX\_DISKS       8}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00051}\mbox{\hyperlink{md__promise_8c_a1071bebcee9243fc289d40361d4793a6}{00051}} \textcolor{preprocessor}{\#define PROMISE\_MAX\_SUBDISKS    2}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00052}\mbox{\hyperlink{md__promise_8c_a77d6d528e35f43d5d45a031e3bf99406}{00052}} \textcolor{preprocessor}{\#define PROMISE\_META\_OFFSET     14}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00053}00053 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00054}\mbox{\hyperlink{structpromise__raid__disk}{00054}} \textcolor{keyword}{struct }\mbox{\hyperlink{structpromise__raid__disk}{promise\_raid\_disk}} \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00055}\mbox{\hyperlink{structpromise__raid__disk_a16f4266340575cf4ee5229f5f3d0ad95}{00055}}         \mbox{\hyperlink{binstream_8h_ab077fa1127453be2bd9d4c3c8a768fa7}{uint8\_t}}          \mbox{\hyperlink{structpromise__raid__disk_a16f4266340575cf4ee5229f5f3d0ad95}{flags}};                     \textcolor{comment}{/* Subdisk status. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00056}\mbox{\hyperlink{md__promise_8c_ace5b0dcdd7f2899d4ff25e0e06bf0d4c}{00056}} \textcolor{preprocessor}{\#define PROMISE\_F\_VALID         0x01}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00057}\mbox{\hyperlink{md__promise_8c_ac42df4956dd3764bd65643979d08322f}{00057}} \textcolor{preprocessor}{\#define PROMISE\_F\_ONLINE        0x02}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00058}\mbox{\hyperlink{md__promise_8c_af4d7a54dec02bc72a70beba68a64b22a}{00058}} \textcolor{preprocessor}{\#define PROMISE\_F\_ASSIGNED      0x04}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00059}\mbox{\hyperlink{md__promise_8c_a6b9b7233425401b727727ee7ef693662}{00059}} \textcolor{preprocessor}{\#define PROMISE\_F\_SPARE         0x08}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00060}\mbox{\hyperlink{md__promise_8c_a33bf50ef28d207d12fb42314516f1f87}{00060}} \textcolor{preprocessor}{\#define PROMISE\_F\_DUPLICATE     0x10}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00061}\mbox{\hyperlink{md__promise_8c_aa4244066795df910826a3ef954f8e87e}{00061}} \textcolor{preprocessor}{\#define PROMISE\_F\_REDIR         0x20}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00062}\mbox{\hyperlink{md__promise_8c_aa59a43a69b8ab9246e5c0462bc23d89e}{00062}} \textcolor{preprocessor}{\#define PROMISE\_F\_DOWN          0x40}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00063}\mbox{\hyperlink{md__promise_8c_a5d1e2e7e16092a0be16bf825562485ba}{00063}} \textcolor{preprocessor}{\#define PROMISE\_F\_READY         0x80}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00064}00064 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00065}\mbox{\hyperlink{structpromise__raid__disk_aceb1a87bdeded6d666ae56afa3923e92}{00065}}         \mbox{\hyperlink{binstream_8h_ab077fa1127453be2bd9d4c3c8a768fa7}{uint8\_t}}          \mbox{\hyperlink{structpromise__raid__disk_aceb1a87bdeded6d666ae56afa3923e92}{number}};                   \textcolor{comment}{/* Position in a volume. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00066}\mbox{\hyperlink{structpromise__raid__disk_a03d72caf83689e30f4ca8292f4ceb3e7}{00066}}         \mbox{\hyperlink{binstream_8h_ab077fa1127453be2bd9d4c3c8a768fa7}{uint8\_t}}          \mbox{\hyperlink{structpromise__raid__disk_a03d72caf83689e30f4ca8292f4ceb3e7}{channel}};         \textcolor{comment}{/* ATA channel number. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00067}\mbox{\hyperlink{structpromise__raid__disk_acbdc87b0ef54f89746938a9e56587941}{00067}}         \mbox{\hyperlink{binstream_8h_ab077fa1127453be2bd9d4c3c8a768fa7}{uint8\_t}}          \mbox{\hyperlink{structpromise__raid__disk_acbdc87b0ef54f89746938a9e56587941}{device}};                   \textcolor{comment}{/* ATA device number. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00068}\mbox{\hyperlink{structpromise__raid__disk_a9e75490629f1e90582d962eb948a47fd}{00068}}         uint64\_t        \textcolor{keywordtype}{id} \mbox{\hyperlink{structpromise__raid__disk_a9e75490629f1e90582d962eb948a47fd}{\_\_packed}};            \textcolor{comment}{/* Subdisk ID. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00069}\mbox{\hyperlink{md__promise_8c_a9da00a1c85e29640b43e72e814ff687a}{00069}} \} \mbox{\hyperlink{md__promise_8c_a9da00a1c85e29640b43e72e814ff687a}{\_\_packed}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00070}00070 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00071}\mbox{\hyperlink{structpromise__raid__conf}{00071}} \textcolor{keyword}{struct }\mbox{\hyperlink{structpromise__raid__conf}{promise\_raid\_conf}} \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00072}\mbox{\hyperlink{structpromise__raid__conf_a0c477989cfc0aee1927c1656f888ba12}{00072}}         \textcolor{keywordtype}{char}            \mbox{\hyperlink{structpromise__raid__conf_a0c477989cfc0aee1927c1656f888ba12}{promise\_id}}[24];}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00073}\mbox{\hyperlink{md__promise_8c_a29077fb14589c94c01d6d5f3b0a0ed28}{00073}} \textcolor{preprocessor}{\#define PROMISE\_MAGIC           "{}Promise Technology, Inc."{}}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00074}\mbox{\hyperlink{md__promise_8c_ac52e4556c81c5932f43ba8dd5a9f5ab9}{00074}} \textcolor{preprocessor}{\#define FREEBSD\_MAGIC           "{}FreeBSD ATA driver RAID "{}}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00075}00075 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00076}\mbox{\hyperlink{structpromise__raid__conf_a189ae93fe42a78e7e952586189a45504}{00076}}         uint32\_t        \mbox{\hyperlink{structpromise__raid__conf_a189ae93fe42a78e7e952586189a45504}{dummy\_0}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00077}\mbox{\hyperlink{structpromise__raid__conf_a331724d826a2460f73c4e1dfa0b5b676}{00077}}         uint64\_t        \mbox{\hyperlink{structpromise__raid__conf_a331724d826a2460f73c4e1dfa0b5b676}{magic\_0}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00078}\mbox{\hyperlink{md__promise_8c_ae2a5cb175f80f17ed047239424c217ef}{00078}} \textcolor{preprocessor}{\#define PROMISE\_MAGIC0(x)       (((uint64\_t)(x.channel) << 48) | \(\backslash\)}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00079}00079 \textcolor{preprocessor}{                                ((uint64\_t)(x.device != 0) << 56))}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00080}\mbox{\hyperlink{structpromise__raid__conf_a41330a7a342789c4e4fddda07b41ed52}{00080}}         uint16\_t        \mbox{\hyperlink{structpromise__raid__conf_a41330a7a342789c4e4fddda07b41ed52}{magic\_1}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00081}\mbox{\hyperlink{structpromise__raid__conf_a57a027a674ec1680402acb1e3bd81919}{00081}}         uint32\_t        \mbox{\hyperlink{structpromise__raid__conf_a57a027a674ec1680402acb1e3bd81919}{magic\_2}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00082}\mbox{\hyperlink{structpromise__raid__conf_a42974ceebdf7e98a5b06625d9a627bf1}{00082}}         \mbox{\hyperlink{binstream_8h_ab077fa1127453be2bd9d4c3c8a768fa7}{uint8\_t}}          \mbox{\hyperlink{structpromise__raid__conf_a42974ceebdf7e98a5b06625d9a627bf1}{filler1}}[470];}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00083}00083 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00084}\mbox{\hyperlink{structpromise__raid__conf_a377f334f6cd684aae8cf62fc8f668cb5}{00084}}         uint32\_t        \mbox{\hyperlink{structpromise__raid__conf_a377f334f6cd684aae8cf62fc8f668cb5}{integrity}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00085}\mbox{\hyperlink{md__promise_8c_aa488a845dca778997126c4c91984f6b8}{00085}} \textcolor{preprocessor}{\#define PROMISE\_I\_VALID         0x00000080}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00086}00086 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00087}\mbox{\hyperlink{structpromise__raid__conf_ae8467fc2b525d7517c291153f8c33119}{00087}}         \textcolor{keyword}{struct }\mbox{\hyperlink{structpromise__raid__disk}{promise\_raid\_disk}}       \mbox{\hyperlink{structdisk}{disk}};       \textcolor{comment}{/* This subdisk info. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00088}\mbox{\hyperlink{structpromise__raid__conf_a143a91a5acbd6f26144a9ffee198458d}{00088}}         uint32\_t        \mbox{\hyperlink{structpromise__raid__conf_a143a91a5acbd6f26144a9ffee198458d}{disk\_offset}};         \textcolor{comment}{/* Subdisk offset. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00089}\mbox{\hyperlink{structpromise__raid__conf_a24e4822147b219e5cdf41cb1557cd599}{00089}}         uint32\_t        \mbox{\hyperlink{structpromise__raid__conf_a24e4822147b219e5cdf41cb1557cd599}{disk\_sectors}};               \textcolor{comment}{/* Subdisk size */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00090}\mbox{\hyperlink{structpromise__raid__conf_af440803e33d5c8e2ea407cf3b365625a}{00090}}         uint32\_t        \mbox{\hyperlink{structpromise__raid__conf_af440803e33d5c8e2ea407cf3b365625a}{disk\_rebuild}};               \textcolor{comment}{/* Rebuild position. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00091}\mbox{\hyperlink{structpromise__raid__conf_a6564feadfd2dc21b64f5994567650a99}{00091}}         uint16\_t        \mbox{\hyperlink{structpromise__raid__conf_a6564feadfd2dc21b64f5994567650a99}{generation}};           \textcolor{comment}{/* Generation number. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00092}\mbox{\hyperlink{structpromise__raid__conf_a1c93f6d43b87511ff33e18e0fc237ddc}{00092}}         \mbox{\hyperlink{binstream_8h_ab077fa1127453be2bd9d4c3c8a768fa7}{uint8\_t}}          \mbox{\hyperlink{structpromise__raid__conf_a1c93f6d43b87511ff33e18e0fc237ddc}{status}};                   \textcolor{comment}{/* Volume status. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00093}\mbox{\hyperlink{md__promise_8c_ad44d358a01c6b79c8f123a69ad27695c}{00093}} \textcolor{preprocessor}{\#define PROMISE\_S\_VALID         0x01}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00094}\mbox{\hyperlink{md__promise_8c_a2043ed0b7cd044475360e18bb3c50184}{00094}} \textcolor{preprocessor}{\#define PROMISE\_S\_ONLINE        0x02}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00095}\mbox{\hyperlink{md__promise_8c_ad8501769df5f20d9bfe51343aa4d8562}{00095}} \textcolor{preprocessor}{\#define PROMISE\_S\_INITED        0x04}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00096}\mbox{\hyperlink{md__promise_8c_a4a3523744c245ded29aca407b04d6fa4}{00096}} \textcolor{preprocessor}{\#define PROMISE\_S\_READY         0x08}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00097}\mbox{\hyperlink{md__promise_8c_a7881eac97bc2dd90e115467cca0e31ac}{00097}} \textcolor{preprocessor}{\#define PROMISE\_S\_DEGRADED      0x10}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00098}\mbox{\hyperlink{md__promise_8c_a99ac63c32805a449e275affeceec5704}{00098}} \textcolor{preprocessor}{\#define PROMISE\_S\_MARKED        0x20}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00099}\mbox{\hyperlink{md__promise_8c_a44de585fc754ca46eb89026c8a0b0c43}{00099}} \textcolor{preprocessor}{\#define PROMISE\_S\_MIGRATING     0x40}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00100}\mbox{\hyperlink{md__promise_8c_af5aecd7aa35e0e2c0798f2700d56c86e}{00100}} \textcolor{preprocessor}{\#define PROMISE\_S\_FUNCTIONAL    0x80}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00101}00101 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00102}\mbox{\hyperlink{structpromise__raid__conf_aa047dcf61e52bced397c3d1b06388d3a}{00102}}         \mbox{\hyperlink{binstream_8h_ab077fa1127453be2bd9d4c3c8a768fa7}{uint8\_t}}          \mbox{\hyperlink{structpromise__raid__conf_aa047dcf61e52bced397c3d1b06388d3a}{type}};                       \textcolor{comment}{/* Voluem type. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00103}\mbox{\hyperlink{md__promise_8c_a91fac4d6c0b9f0871f07a481a0ee596c}{00103}} \textcolor{preprocessor}{\#define PROMISE\_T\_RAID0         0x00}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00104}\mbox{\hyperlink{md__promise_8c_a93bd586a834fc2937ea745d4facac00f}{00104}} \textcolor{preprocessor}{\#define PROMISE\_T\_RAID1         0x01}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00105}\mbox{\hyperlink{md__promise_8c_a80b741a47ab70d65b8c35a69bbefa717}{00105}} \textcolor{preprocessor}{\#define PROMISE\_T\_RAID3         0x02}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00106}\mbox{\hyperlink{md__promise_8c_afb8464fdc81351fa1c9bc98846405951}{00106}} \textcolor{preprocessor}{\#define PROMISE\_T\_RAID5         0x04}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00107}\mbox{\hyperlink{md__promise_8c_af4bc13398f46db47579bc5e3fef8c096}{00107}} \textcolor{preprocessor}{\#define PROMISE\_T\_SPAN          0x08}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00108}\mbox{\hyperlink{md__promise_8c_a0f7ef635ed5f29cfdb8d26f6dfae4323}{00108}} \textcolor{preprocessor}{\#define PROMISE\_T\_JBOD          0x10}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00109}00109 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00110}\mbox{\hyperlink{structpromise__raid__conf_a4591d4915850a182c44952a2e0e164e6}{00110}}         \mbox{\hyperlink{binstream_8h_ab077fa1127453be2bd9d4c3c8a768fa7}{uint8\_t}}          \mbox{\hyperlink{structpromise__raid__conf_a4591d4915850a182c44952a2e0e164e6}{total\_disks}};         \textcolor{comment}{/* Disks in this volume. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00111}\mbox{\hyperlink{structpromise__raid__conf_af0b1f65f4e1f592470e2556a9c53416b}{00111}}         \mbox{\hyperlink{binstream_8h_ab077fa1127453be2bd9d4c3c8a768fa7}{uint8\_t}}          \mbox{\hyperlink{structpromise__raid__conf_af0b1f65f4e1f592470e2556a9c53416b}{stripe\_shift}};               \textcolor{comment}{/* Strip size. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00112}\mbox{\hyperlink{structpromise__raid__conf_ac16f53d721267d1bea9a4209d0aaee57}{00112}}         \mbox{\hyperlink{binstream_8h_ab077fa1127453be2bd9d4c3c8a768fa7}{uint8\_t}}          \mbox{\hyperlink{structpromise__raid__conf_ac16f53d721267d1bea9a4209d0aaee57}{array\_width}};         \textcolor{comment}{/* Number of RAID0 stripes. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00113}\mbox{\hyperlink{structpromise__raid__conf_a0bf4b5c463116d88d2db8ce2fa64eaf8}{00113}}         \mbox{\hyperlink{binstream_8h_ab077fa1127453be2bd9d4c3c8a768fa7}{uint8\_t}}          \mbox{\hyperlink{structpromise__raid__conf_a0bf4b5c463116d88d2db8ce2fa64eaf8}{array\_number}};               \textcolor{comment}{/* Global volume number. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00114}\mbox{\hyperlink{structpromise__raid__conf_ac2e961fbef27d74bb376bd7e49d85688}{00114}}         uint32\_t        \mbox{\hyperlink{structpromise__raid__conf_ac2e961fbef27d74bb376bd7e49d85688}{total\_sectors}};             \textcolor{comment}{/* Volume size. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00115}\mbox{\hyperlink{structpromise__raid__conf_abff36247e7f1721bbf0aa15a9edd0b51}{00115}}         uint16\_t        \mbox{\hyperlink{structpromise__raid__conf_abff36247e7f1721bbf0aa15a9edd0b51}{cylinders}};             \textcolor{comment}{/* Volume geometry: C. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00116}\mbox{\hyperlink{structpromise__raid__conf_ac86e9c807bcfb50225ca418dde822c11}{00116}}         \mbox{\hyperlink{binstream_8h_ab077fa1127453be2bd9d4c3c8a768fa7}{uint8\_t}}          \mbox{\hyperlink{structpromise__raid__conf_ac86e9c807bcfb50225ca418dde822c11}{heads}};                     \textcolor{comment}{/* Volume geometry: H. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00117}\mbox{\hyperlink{structpromise__raid__conf_a63ba63125c6a1228a76eb850e59136ff}{00117}}         \mbox{\hyperlink{binstream_8h_ab077fa1127453be2bd9d4c3c8a768fa7}{uint8\_t}}          \mbox{\hyperlink{structpromise__raid__conf_a63ba63125c6a1228a76eb850e59136ff}{sectors}};         \textcolor{comment}{/* Volume geometry: S. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00118}\mbox{\hyperlink{structpromise__raid__conf_a1ab9a5277366dfcaca649d254aec7f12}{00118}}         uint64\_t        volume\_id \mbox{\hyperlink{structpromise__raid__conf_a1ab9a5277366dfcaca649d254aec7f12}{\_\_packed}};     \textcolor{comment}{/* Volume ID, */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00119}\mbox{\hyperlink{structpromise__raid__conf_a230625945ea844bdb2d31809448782b5}{00119}}         \textcolor{keyword}{struct }\mbox{\hyperlink{structpromise__raid__disk}{promise\_raid\_disk}}       \mbox{\hyperlink{structpromise__raid__conf_a230625945ea844bdb2d31809448782b5}{disks}}[\mbox{\hyperlink{md__promise_8c_a6043ecc0cea629458c18b11a0f79d913}{PROMISE\_MAX\_DISKS}}];}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00120}00120                                                 \textcolor{comment}{/* Subdisks in this volume. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00121}\mbox{\hyperlink{structpromise__raid__conf_ab943ab4ca64cac8ac96f3ea86abbbf92}{00121}}         \textcolor{keywordtype}{char}            \mbox{\hyperlink{structpromise__raid__conf_ab943ab4ca64cac8ac96f3ea86abbbf92}{name}}[32];           \textcolor{comment}{/* Volume label. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00122}00122 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00123}\mbox{\hyperlink{structpromise__raid__conf_a84a2d3a6b0ee7a86f7659099a9ab3d22}{00123}}         uint32\_t        \mbox{\hyperlink{structpromise__raid__conf_a84a2d3a6b0ee7a86f7659099a9ab3d22}{filler2}}[8];}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00124}\mbox{\hyperlink{structpromise__raid__conf_ac9097e3e7237652023cb106f90cf1f18}{00124}}         uint32\_t        \mbox{\hyperlink{structpromise__raid__conf_ac9097e3e7237652023cb106f90cf1f18}{magic\_3}}; \textcolor{comment}{/* Something related to rebuild. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00125}\mbox{\hyperlink{structpromise__raid__conf_a0c2f572ff18234677a0adbd5f1f2d9d1}{00125}}         uint64\_t        \mbox{\hyperlink{structpromise__raid__conf_a0c2f572ff18234677a0adbd5f1f2d9d1}{rebuild\_lba64}};     \textcolor{comment}{/* Per-\/volume rebuild position. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00126}\mbox{\hyperlink{structpromise__raid__conf_ad385936739933bd06f99fc56213b9ae6}{00126}}         uint32\_t        \mbox{\hyperlink{structpromise__raid__conf_ad385936739933bd06f99fc56213b9ae6}{magic\_4}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00127}\mbox{\hyperlink{structpromise__raid__conf_a7faec72b921b51314ac7d9d23c382abd}{00127}}         uint32\_t        \mbox{\hyperlink{structpromise__raid__conf_a7faec72b921b51314ac7d9d23c382abd}{magic\_5}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00128}\mbox{\hyperlink{structpromise__raid__conf_a2fac25865626604d1a3333072473f489}{00128}}         uint32\_t        \mbox{\hyperlink{structpromise__raid__conf_a2fac25865626604d1a3333072473f489}{total\_sectors\_high}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00129}\mbox{\hyperlink{structpromise__raid__conf_af4c40ab69a64d9c2e46e71dfd8e70b87}{00129}}         \mbox{\hyperlink{binstream_8h_ab077fa1127453be2bd9d4c3c8a768fa7}{uint8\_t}}          \mbox{\hyperlink{structpromise__raid__conf_af4c40ab69a64d9c2e46e71dfd8e70b87}{magic\_6}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00130}\mbox{\hyperlink{structpromise__raid__conf_a10de46f425232b9686c3834a7938e5e7}{00130}}         \mbox{\hyperlink{binstream_8h_ab077fa1127453be2bd9d4c3c8a768fa7}{uint8\_t}}          \mbox{\hyperlink{structpromise__raid__conf_a10de46f425232b9686c3834a7938e5e7}{sector\_size}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00131}\mbox{\hyperlink{structpromise__raid__conf_a6ba000a968770391d405f5b9aaea2dfd}{00131}}         uint16\_t        \mbox{\hyperlink{structpromise__raid__conf_a6ba000a968770391d405f5b9aaea2dfd}{magic\_7}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00132}\mbox{\hyperlink{structpromise__raid__conf_a88409fb5ef9da510eac10c481f5b89ac}{00132}}         uint32\_t        \mbox{\hyperlink{structpromise__raid__conf_a88409fb5ef9da510eac10c481f5b89ac}{magic\_8}}[31];}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00133}\mbox{\hyperlink{structpromise__raid__conf_a97d02f0d1cb92ba73610fa369530652e}{00133}}         uint32\_t        \mbox{\hyperlink{structpromise__raid__conf_a97d02f0d1cb92ba73610fa369530652e}{backup\_time}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00134}\mbox{\hyperlink{structpromise__raid__conf_ae941002b7349264bc28ad9f864befd97}{00134}}         uint16\_t        \mbox{\hyperlink{structpromise__raid__conf_ae941002b7349264bc28ad9f864befd97}{magic\_9}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00135}\mbox{\hyperlink{structpromise__raid__conf_afd71e747e37a0dd24e784becfde7cb6b}{00135}}         uint32\_t        \mbox{\hyperlink{structpromise__raid__conf_afd71e747e37a0dd24e784becfde7cb6b}{disk\_offset\_high}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00136}\mbox{\hyperlink{structpromise__raid__conf_a108318e260bbf343dfb77ed6d8603652}{00136}}         uint32\_t        \mbox{\hyperlink{structpromise__raid__conf_a108318e260bbf343dfb77ed6d8603652}{disk\_sectors\_high}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00137}\mbox{\hyperlink{structpromise__raid__conf_accae431c7d4a0bd2d86df235d55ff8a8}{00137}}         uint32\_t        \mbox{\hyperlink{structpromise__raid__conf_accae431c7d4a0bd2d86df235d55ff8a8}{disk\_rebuild\_high}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00138}\mbox{\hyperlink{structpromise__raid__conf_af322cf31d886b715dc92ebcdfcce0908}{00138}}         uint16\_t        \mbox{\hyperlink{structpromise__raid__conf_af322cf31d886b715dc92ebcdfcce0908}{magic\_10}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00139}\mbox{\hyperlink{structpromise__raid__conf_a020a35e5d375cd4a8b3581952903f22f}{00139}}         uint32\_t        \mbox{\hyperlink{structpromise__raid__conf_a020a35e5d375cd4a8b3581952903f22f}{magic\_11}}[3];}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00140}\mbox{\hyperlink{structpromise__raid__conf_a9fd51b92b02dca5ad11cf3b709eeded7}{00140}}         uint32\_t        \mbox{\hyperlink{structpromise__raid__conf_a9fd51b92b02dca5ad11cf3b709eeded7}{filler3}}[284];}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00141}\mbox{\hyperlink{structpromise__raid__conf_a9f5adcf6bfa26768101c569a33c5d604}{00141}}         uint32\_t        \mbox{\hyperlink{structpromise__raid__conf_a9f5adcf6bfa26768101c569a33c5d604}{checksum}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00142}00142 \} \mbox{\hyperlink{md__promise_8c_a9da00a1c85e29640b43e72e814ff687a}{\_\_packed}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00143}00143 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00144}\mbox{\hyperlink{structg__raid__md__promise__perdisk}{00144}} \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__promise__perdisk}{g\_raid\_md\_promise\_perdisk}} \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00145}\mbox{\hyperlink{structg__raid__md__promise__perdisk_ab4298e04bfd1fc70debb15180a449beb}{00145}}         \textcolor{keywordtype}{int}              \mbox{\hyperlink{structg__raid__md__promise__perdisk_ab4298e04bfd1fc70debb15180a449beb}{pd\_updated}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00146}\mbox{\hyperlink{structg__raid__md__promise__perdisk_af83a2a95e726587eddda9df693dc9fe3}{00146}}         \textcolor{keywordtype}{int}              \mbox{\hyperlink{structg__raid__md__promise__perdisk_af83a2a95e726587eddda9df693dc9fe3}{pd\_subdisks}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00147}\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{00147}}         \textcolor{keyword}{struct }\mbox{\hyperlink{structpromise__raid__conf}{promise\_raid\_conf}}       *\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[\mbox{\hyperlink{md__promise_8c_a1071bebcee9243fc289d40361d4793a6}{PROMISE\_MAX\_SUBDISKS}}];}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00148}00148 \};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00149}00149 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00150}\mbox{\hyperlink{structg__raid__md__promise__pervolume}{00150}} \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__promise__pervolume}{g\_raid\_md\_promise\_pervolume}} \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00151}\mbox{\hyperlink{structg__raid__md__promise__pervolume_a94097bae0d51bd8d9693a3bea313a5f6}{00151}}         \textcolor{keyword}{struct }\mbox{\hyperlink{structpromise__raid__conf}{promise\_raid\_conf}}       *\mbox{\hyperlink{structg__raid__md__promise__pervolume_a94097bae0d51bd8d9693a3bea313a5f6}{pv\_meta}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00152}\mbox{\hyperlink{structg__raid__md__promise__pervolume_a7529f3ff051c7927f2deaff5d206065a}{00152}}         uint64\_t                         \mbox{\hyperlink{structg__raid__md__promise__pervolume_a7529f3ff051c7927f2deaff5d206065a}{pv\_id}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00153}\mbox{\hyperlink{structg__raid__md__promise__pervolume_a5c1c2471fa8a2d05e30e622dbf1fea3b}{00153}}         uint16\_t                         \mbox{\hyperlink{structg__raid__md__promise__pervolume_a5c1c2471fa8a2d05e30e622dbf1fea3b}{pv\_generation}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00154}\mbox{\hyperlink{structg__raid__md__promise__pervolume_aae232a339e68704c62ecbd34c74f0624}{00154}}         \textcolor{keywordtype}{int}                              \mbox{\hyperlink{structg__raid__md__promise__pervolume_aae232a339e68704c62ecbd34c74f0624}{pv\_disks\_present}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00155}\mbox{\hyperlink{structg__raid__md__promise__pervolume_a87d7b4b6ae10863075c2b4ad6d95d93b}{00155}}         \textcolor{keywordtype}{int}                              \mbox{\hyperlink{structg__raid__md__promise__pervolume_a87d7b4b6ae10863075c2b4ad6d95d93b}{pv\_started}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00156}\mbox{\hyperlink{structg__raid__md__promise__pervolume_ad8bc77acb4795088f1438c80f7c8f8db}{00156}}         \textcolor{keyword}{struct }callout                   \mbox{\hyperlink{structg__raid__md__promise__pervolume_ad8bc77acb4795088f1438c80f7c8f8db}{pv\_start\_co}};        \textcolor{comment}{/* STARTING state timer. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00157}00157 \};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00158}00158 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00159}\mbox{\hyperlink{md__promise_8c_a17e455a67782328d7cce25522a1538cb}{00159}} \textcolor{keyword}{static} g\_raid\_md\_create\_t \mbox{\hyperlink{md__promise_8c_a17e455a67782328d7cce25522a1538cb}{g\_raid\_md\_create\_promise}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00160}\mbox{\hyperlink{md__promise_8c_af0c5d4a1a757fc2e2f9eb804ff105c10}{00160}} \textcolor{keyword}{static} g\_raid\_md\_taste\_t \mbox{\hyperlink{md__promise_8c_af0c5d4a1a757fc2e2f9eb804ff105c10}{g\_raid\_md\_taste\_promise}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00161}\mbox{\hyperlink{md__promise_8c_a297a1874012686e4504431289c642268}{00161}} \textcolor{keyword}{static} g\_raid\_md\_event\_t \mbox{\hyperlink{md__promise_8c_a297a1874012686e4504431289c642268}{g\_raid\_md\_event\_promise}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00162}\mbox{\hyperlink{md__promise_8c_aece57ece2029e92483664415f94eb9b5}{00162}} \textcolor{keyword}{static} g\_raid\_md\_volume\_event\_t \mbox{\hyperlink{md__promise_8c_aece57ece2029e92483664415f94eb9b5}{g\_raid\_md\_volume\_event\_promise}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00163}\mbox{\hyperlink{md__promise_8c_a9010499762f52acd716141d483b9c2b8}{00163}} \textcolor{keyword}{static} g\_raid\_md\_ctl\_t \mbox{\hyperlink{md__promise_8c_a9010499762f52acd716141d483b9c2b8}{g\_raid\_md\_ctl\_promise}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00164}\mbox{\hyperlink{md__promise_8c_aa84eb5d0f9c789e4d981e01fbababb63}{00164}} \textcolor{keyword}{static} g\_raid\_md\_write\_t \mbox{\hyperlink{md__promise_8c_aa84eb5d0f9c789e4d981e01fbababb63}{g\_raid\_md\_write\_promise}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00165}\mbox{\hyperlink{md__promise_8c_a9c2c5b4a6166ec33c5b3469c58692be0}{00165}} \textcolor{keyword}{static} g\_raid\_md\_fail\_disk\_t \mbox{\hyperlink{md__promise_8c_a9c2c5b4a6166ec33c5b3469c58692be0}{g\_raid\_md\_fail\_disk\_promise}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00166}\mbox{\hyperlink{md__promise_8c_a3c8423b7d0228bda25c1a262c24db1e9}{00166}} \textcolor{keyword}{static} g\_raid\_md\_free\_disk\_t \mbox{\hyperlink{md__promise_8c_a3c8423b7d0228bda25c1a262c24db1e9}{g\_raid\_md\_free\_disk\_promise}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00167}\mbox{\hyperlink{md__promise_8c_aeb9a5fa31424ef3bf4212b3a9cc9cbfc}{00167}} \textcolor{keyword}{static} g\_raid\_md\_free\_volume\_t \mbox{\hyperlink{md__promise_8c_aeb9a5fa31424ef3bf4212b3a9cc9cbfc}{g\_raid\_md\_free\_volume\_promise}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00168}\mbox{\hyperlink{md__promise_8c_afe12d0e175b23122f5362748008d044f}{00168}} \textcolor{keyword}{static} g\_raid\_md\_free\_t \mbox{\hyperlink{md__promise_8c_afe12d0e175b23122f5362748008d044f}{g\_raid\_md\_free\_promise}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00169}00169 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00170}\mbox{\hyperlink{md__promise_8c_a53f1e936e6ed021cbd45afe85d5839b6}{00170}} \textcolor{keyword}{static} kobj\_method\_t \mbox{\hyperlink{md__promise_8c_a53f1e936e6ed021cbd45afe85d5839b6}{g\_raid\_md\_promise\_methods}}[] = \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00171}00171         KOBJMETHOD(g\_raid\_md\_create,    \mbox{\hyperlink{md__promise_8c_a17e455a67782328d7cce25522a1538cb}{g\_raid\_md\_create\_promise}}),}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00172}00172         KOBJMETHOD(g\_raid\_md\_taste,     \mbox{\hyperlink{md__promise_8c_af0c5d4a1a757fc2e2f9eb804ff105c10}{g\_raid\_md\_taste\_promise}}),}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00173}00173         KOBJMETHOD(g\_raid\_md\_event,     \mbox{\hyperlink{md__promise_8c_a297a1874012686e4504431289c642268}{g\_raid\_md\_event\_promise}}),}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00174}00174         KOBJMETHOD(g\_raid\_md\_volume\_event,      \mbox{\hyperlink{md__promise_8c_aece57ece2029e92483664415f94eb9b5}{g\_raid\_md\_volume\_event\_promise}}),}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00175}00175         KOBJMETHOD(g\_raid\_md\_ctl,       \mbox{\hyperlink{md__promise_8c_a9010499762f52acd716141d483b9c2b8}{g\_raid\_md\_ctl\_promise}}),}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00176}00176         KOBJMETHOD(g\_raid\_md\_write,     \mbox{\hyperlink{md__promise_8c_aa84eb5d0f9c789e4d981e01fbababb63}{g\_raid\_md\_write\_promise}}),}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00177}00177         KOBJMETHOD(g\_raid\_md\_fail\_disk, \mbox{\hyperlink{md__promise_8c_a9c2c5b4a6166ec33c5b3469c58692be0}{g\_raid\_md\_fail\_disk\_promise}}),}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00178}00178         KOBJMETHOD(g\_raid\_md\_free\_disk, \mbox{\hyperlink{md__promise_8c_a3c8423b7d0228bda25c1a262c24db1e9}{g\_raid\_md\_free\_disk\_promise}}),}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00179}00179         KOBJMETHOD(g\_raid\_md\_free\_volume,       \mbox{\hyperlink{md__promise_8c_aeb9a5fa31424ef3bf4212b3a9cc9cbfc}{g\_raid\_md\_free\_volume\_promise}}),}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00180}00180         KOBJMETHOD(g\_raid\_md\_free,      \mbox{\hyperlink{md__promise_8c_afe12d0e175b23122f5362748008d044f}{g\_raid\_md\_free\_promise}}),}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00181}00181         \{ 0, 0 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00182}00182 \};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00183}00183 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00184}\mbox{\hyperlink{md__promise_8c_aaf13f2599af4d1d974965d7b400f7fff}{00184}} \textcolor{keyword}{static} \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__class}{g\_raid\_md\_class}} \mbox{\hyperlink{md__promise_8c_aaf13f2599af4d1d974965d7b400f7fff}{g\_raid\_md\_promise\_class}} = \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00185}00185         \textcolor{stringliteral}{"{}Promise"{}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00186}00186         \mbox{\hyperlink{md__promise_8c_a53f1e936e6ed021cbd45afe85d5839b6}{g\_raid\_md\_promise\_methods}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00187}00187         \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__object}{g\_raid\_md\_object}}),}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00188}00188         .mdc\_enable = 1,}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00189}00189         .mdc\_priority = 100}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00190}00190 \};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00191}00191 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00192}00192 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00193}\mbox{\hyperlink{md__promise_8c_adc9e23d231b12a99259b8ea7d2d79b24}{00193}} \mbox{\hyperlink{md__promise_8c_adc9e23d231b12a99259b8ea7d2d79b24}{g\_raid\_md\_promise\_print}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structpromise__raid__conf}{promise\_raid\_conf}} *meta)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00194}00194 \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00195}00195         \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00196}00196 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00197}00197         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid_8c_a60062ce0bb852760514459b7a1f3d32e}{g\_raid\_debug}} < 1)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00198}00198                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00199}00199 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00200}00200         printf(\textcolor{stringliteral}{"{}********* ATA Promise Metadata *********\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00201}00201         printf(\textcolor{stringliteral}{"{}promise\_id          <\%.24s>\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a0c477989cfc0aee1927c1656f888ba12}{promise\_id}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00202}00202         printf(\textcolor{stringliteral}{"{}disk                \%02x \%02x \%02x \%02x \%016jx\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00203}00203             meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ae8467fc2b525d7517c291153f8c33119}{disk}}.\mbox{\hyperlink{structpromise__raid__disk_a16f4266340575cf4ee5229f5f3d0ad95}{flags}}, meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ae8467fc2b525d7517c291153f8c33119}{disk}}.\mbox{\hyperlink{structpromise__raid__disk_aceb1a87bdeded6d666ae56afa3923e92}{number}}, meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ae8467fc2b525d7517c291153f8c33119}{disk}}.\mbox{\hyperlink{structpromise__raid__disk_a03d72caf83689e30f4ca8292f4ceb3e7}{channel}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00204}00204             meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ae8467fc2b525d7517c291153f8c33119}{disk}}.\mbox{\hyperlink{structpromise__raid__disk_acbdc87b0ef54f89746938a9e56587941}{device}}, meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ae8467fc2b525d7517c291153f8c33119}{disk}}.id);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00205}00205         printf(\textcolor{stringliteral}{"{}disk\_offset         \%u\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a143a91a5acbd6f26144a9ffee198458d}{disk\_offset}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00206}00206         printf(\textcolor{stringliteral}{"{}disk\_sectors        \%u\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a24e4822147b219e5cdf41cb1557cd599}{disk\_sectors}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00207}00207         printf(\textcolor{stringliteral}{"{}disk\_rebuild        \%u\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structpromise__raid__conf_af440803e33d5c8e2ea407cf3b365625a}{disk\_rebuild}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00208}00208         printf(\textcolor{stringliteral}{"{}generation          \%u\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a6564feadfd2dc21b64f5994567650a99}{generation}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00209}00209         printf(\textcolor{stringliteral}{"{}status              0x\%02x\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a1c93f6d43b87511ff33e18e0fc237ddc}{status}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00210}00210         printf(\textcolor{stringliteral}{"{}type                \%u\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structpromise__raid__conf_aa047dcf61e52bced397c3d1b06388d3a}{type}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00211}00211         printf(\textcolor{stringliteral}{"{}total\_disks         \%u\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a4591d4915850a182c44952a2e0e164e6}{total\_disks}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00212}00212         printf(\textcolor{stringliteral}{"{}stripe\_shift        \%u\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structpromise__raid__conf_af0b1f65f4e1f592470e2556a9c53416b}{stripe\_shift}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00213}00213         printf(\textcolor{stringliteral}{"{}array\_width         \%u\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ac16f53d721267d1bea9a4209d0aaee57}{array\_width}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00214}00214         printf(\textcolor{stringliteral}{"{}array\_number        \%u\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a0bf4b5c463116d88d2db8ce2fa64eaf8}{array\_number}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00215}00215         printf(\textcolor{stringliteral}{"{}total\_sectors       \%u\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ac2e961fbef27d74bb376bd7e49d85688}{total\_sectors}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00216}00216         printf(\textcolor{stringliteral}{"{}cylinders           \%u\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structpromise__raid__conf_abff36247e7f1721bbf0aa15a9edd0b51}{cylinders}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00217}00217         printf(\textcolor{stringliteral}{"{}heads               \%u\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ac86e9c807bcfb50225ca418dde822c11}{heads}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00218}00218         printf(\textcolor{stringliteral}{"{}sectors             \%u\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a63ba63125c6a1228a76eb850e59136ff}{sectors}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00219}00219         printf(\textcolor{stringliteral}{"{}volume\_id           0x\%016jx\(\backslash\)n"{}}, meta-\/>volume\_id);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00220}00220         printf(\textcolor{stringliteral}{"{}disks:\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00221}00221         \textcolor{keywordflow}{for} (i = 0; i < \mbox{\hyperlink{md__promise_8c_a6043ecc0cea629458c18b11a0f79d913}{PROMISE\_MAX\_DISKS}}; i++ ) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00222}00222                 printf(\textcolor{stringliteral}{"{}                    \%02x \%02x \%02x \%02x \%016jx\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00223}00223                     meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a230625945ea844bdb2d31809448782b5}{disks}}[i].\mbox{\hyperlink{structpromise__raid__disk_a16f4266340575cf4ee5229f5f3d0ad95}{flags}}, meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a230625945ea844bdb2d31809448782b5}{disks}}[i].\mbox{\hyperlink{structpromise__raid__disk_aceb1a87bdeded6d666ae56afa3923e92}{number}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00224}00224                     meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a230625945ea844bdb2d31809448782b5}{disks}}[i].\mbox{\hyperlink{structpromise__raid__disk_a03d72caf83689e30f4ca8292f4ceb3e7}{channel}}, meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a230625945ea844bdb2d31809448782b5}{disks}}[i].\mbox{\hyperlink{structpromise__raid__disk_acbdc87b0ef54f89746938a9e56587941}{device}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00225}00225                     meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a230625945ea844bdb2d31809448782b5}{disks}}[i].id);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00226}00226         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00227}00227         printf(\textcolor{stringliteral}{"{}name                <\%.32s>\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ab943ab4ca64cac8ac96f3ea86abbbf92}{name}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00228}00228         printf(\textcolor{stringliteral}{"{}magic\_3             0x\%08x\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ac9097e3e7237652023cb106f90cf1f18}{magic\_3}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00229}00229         printf(\textcolor{stringliteral}{"{}rebuild\_lba64       \%ju\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a0c2f572ff18234677a0adbd5f1f2d9d1}{rebuild\_lba64}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00230}00230         printf(\textcolor{stringliteral}{"{}magic\_4             0x\%08x\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ad385936739933bd06f99fc56213b9ae6}{magic\_4}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00231}00231         printf(\textcolor{stringliteral}{"{}magic\_5             0x\%08x\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a7faec72b921b51314ac7d9d23c382abd}{magic\_5}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00232}00232         printf(\textcolor{stringliteral}{"{}total\_sectors\_high  0x\%08x\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a2fac25865626604d1a3333072473f489}{total\_sectors\_high}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00233}00233         printf(\textcolor{stringliteral}{"{}sector\_size         \%u\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a10de46f425232b9686c3834a7938e5e7}{sector\_size}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00234}00234         printf(\textcolor{stringliteral}{"{}backup\_time         \%d\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a97d02f0d1cb92ba73610fa369530652e}{backup\_time}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00235}00235         printf(\textcolor{stringliteral}{"{}disk\_offset\_high    0x\%08x\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structpromise__raid__conf_afd71e747e37a0dd24e784becfde7cb6b}{disk\_offset\_high}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00236}00236         printf(\textcolor{stringliteral}{"{}disk\_sectors\_high   0x\%08x\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a108318e260bbf343dfb77ed6d8603652}{disk\_sectors\_high}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00237}00237         printf(\textcolor{stringliteral}{"{}disk\_rebuild\_high   0x\%08x\(\backslash\)n"{}}, meta-\/>\mbox{\hyperlink{structpromise__raid__conf_accae431c7d4a0bd2d86df235d55ff8a8}{disk\_rebuild\_high}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00238}00238         printf(\textcolor{stringliteral}{"{}=================================================\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00239}00239 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00240}00240 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00241}00241 \textcolor{keyword}{static} \textcolor{keyword}{struct }\mbox{\hyperlink{structpromise__raid__conf}{promise\_raid\_conf}} *}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00242}\mbox{\hyperlink{md__promise_8c_a0e997a4fd6d7be64d723864e1bc69aed}{00242}} \mbox{\hyperlink{md__promise_8c_a0e997a4fd6d7be64d723864e1bc69aed}{promise\_meta\_copy}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structpromise__raid__conf}{promise\_raid\_conf}} *meta)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00243}00243 \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00244}00244         \textcolor{keyword}{struct }\mbox{\hyperlink{structpromise__raid__conf}{promise\_raid\_conf}} *nmeta;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00245}00245 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00246}00246         nmeta = malloc(\textcolor{keyword}{sizeof}(*nmeta), M\_MD\_PROMISE, M\_WAITOK);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00247}00247         memcpy(nmeta, meta, \textcolor{keyword}{sizeof}(*nmeta));}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00248}00248         \textcolor{keywordflow}{return} (nmeta);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00249}00249 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00250}00250 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00251}00251 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00252}\mbox{\hyperlink{md__promise_8c_a6ef59af68b8cc76c1b2ca32836d08c78}{00252}} \mbox{\hyperlink{md__promise_8c_a6ef59af68b8cc76c1b2ca32836d08c78}{promise\_meta\_find\_disk}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structpromise__raid__conf}{promise\_raid\_conf}} *meta, uint64\_t \textcolor{keywordtype}{id})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00253}00253 \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00254}00254         \textcolor{keywordtype}{int} pos;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00255}00255 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00256}00256         \textcolor{keywordflow}{for} (pos = 0; pos < meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a4591d4915850a182c44952a2e0e164e6}{total\_disks}}; pos++) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00257}00257                 \textcolor{keywordflow}{if} (meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a230625945ea844bdb2d31809448782b5}{disks}}[pos].id == \textcolor{keywordtype}{id})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00258}00258                         \textcolor{keywordflow}{return} (pos);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00259}00259         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00260}00260         \textcolor{keywordflow}{return} (-\/1);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00261}00261 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00262}00262 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00263}00263 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00264}\mbox{\hyperlink{md__promise_8c_aecb311da502fea619e83c249c483e0c2}{00264}} \mbox{\hyperlink{md__promise_8c_aecb311da502fea619e83c249c483e0c2}{promise\_meta\_unused\_range}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structpromise__raid__conf}{promise\_raid\_conf}} **metaarr, \textcolor{keywordtype}{int} nsd,}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00265}00265     off\_t \mbox{\hyperlink{structpromise__raid__conf_a63ba63125c6a1228a76eb850e59136ff}{sectors}}, off\_t *off, off\_t *size)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00266}00266 \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00267}00267         off\_t coff, csize, tmp;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00268}00268         \textcolor{keywordtype}{int} i, j;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00269}00269 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00270}00270         \mbox{\hyperlink{structpromise__raid__conf_a63ba63125c6a1228a76eb850e59136ff}{sectors}} -\/= 131072;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00271}00271         *off = 0;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00272}00272         *size = 0;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00273}00273         coff = 0;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00274}00274         csize = \mbox{\hyperlink{structpromise__raid__conf_a63ba63125c6a1228a76eb850e59136ff}{sectors}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00275}00275         i = 0;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00276}00276         \textcolor{keywordflow}{while} (1) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00277}00277                 \textcolor{keywordflow}{for} (j = 0; j < nsd; j++) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00278}00278                         tmp = ((off\_t)metaarr[j]-\/>\mbox{\hyperlink{structpromise__raid__conf_afd71e747e37a0dd24e784becfde7cb6b}{disk\_offset\_high}} << 32) +}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00279}00279                             metaarr[j]-\/>\mbox{\hyperlink{structpromise__raid__conf_a143a91a5acbd6f26144a9ffee198458d}{disk\_offset}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00280}00280                         \textcolor{keywordflow}{if} (tmp >= coff)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00281}00281                                 csize = MIN(csize, tmp -\/ coff);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00282}00282                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00283}00283                 \textcolor{keywordflow}{if} (csize > *size) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00284}00284                         *off = coff;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00285}00285                         *size = csize;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00286}00286                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00287}00287                 \textcolor{keywordflow}{if} (i >= nsd)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00288}00288                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00289}00289                 coff = ((off\_t)metaarr[i]-\/>\mbox{\hyperlink{structpromise__raid__conf_afd71e747e37a0dd24e784becfde7cb6b}{disk\_offset\_high}} << 32) +}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00290}00290                      metaarr[i]-\/>\mbox{\hyperlink{structpromise__raid__conf_a143a91a5acbd6f26144a9ffee198458d}{disk\_offset}} +}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00291}00291                     ((off\_t)metaarr[i]-\/>\mbox{\hyperlink{structpromise__raid__conf_a108318e260bbf343dfb77ed6d8603652}{disk\_sectors\_high}} << 32) +}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00292}00292                      metaarr[i]-\/>\mbox{\hyperlink{structpromise__raid__conf_a24e4822147b219e5cdf41cb1557cd599}{disk\_sectors}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00293}00293                 csize = \mbox{\hyperlink{structpromise__raid__conf_a63ba63125c6a1228a76eb850e59136ff}{sectors}} -\/ coff;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00294}00294                 i++;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00295}00295         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00296}00296         \textcolor{keywordflow}{return} ((*size > 0) ? 1 : 0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00297}00297 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00298}00298 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00299}00299 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00300}\mbox{\hyperlink{md__promise_8c_ae78c674b460edb2aa59af8ec82bf15f6}{00300}} \mbox{\hyperlink{md__promise_8c_ae78c674b460edb2aa59af8ec82bf15f6}{promise\_meta\_translate\_disk}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__volume}{g\_raid\_volume}} *\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}, \textcolor{keywordtype}{int} md\_disk\_pos)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00301}00301 \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00302}00302         \textcolor{keywordtype}{int} disk\_pos, width;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00303}00303 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00304}00304         \textcolor{keywordflow}{if} (md\_disk\_pos >= 0 \&\& \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} == \mbox{\hyperlink{g__raid_8h_ad0ef2cd50760a49759a6cbaf2afeb286}{G\_RAID\_VOLUME\_RL\_RAID1E}}) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00305}00305                 width = \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a21482a5ac78a397faf4e95eb1ebef431}{v\_disks\_count}} / 2;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00306}00306                 disk\_pos = (md\_disk\_pos / width) +}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00307}00307                     (md\_disk\_pos \% width) * width;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00308}00308         \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00309}00309                 disk\_pos = md\_disk\_pos;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00310}00310         \textcolor{keywordflow}{return} (disk\_pos);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00311}00311 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00312}00312 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00313}00313 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00314}\mbox{\hyperlink{md__promise_8c_ab1c86b805bb9e87a864967f50af774de}{00314}} \mbox{\hyperlink{md__promise_8c_ab1c86b805bb9e87a864967f50af774de}{promise\_meta\_get\_name}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structpromise__raid__conf}{promise\_raid\_conf}} *meta, \textcolor{keywordtype}{char} *\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00315}00315 \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00316}00316         \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00317}00317 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00318}00318         strncpy(\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}, meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ab943ab4ca64cac8ac96f3ea86abbbf92}{name}}, 32);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00319}00319         \mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}[32] = 0;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00320}00320         \textcolor{keywordflow}{for} (i = 31; i >= 0; i-\/-\/) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00321}00321                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}[i] > 0x20)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00322}00322                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00323}00323                 \mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}[i] = 0;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00324}00324         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00325}00325 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00326}00326 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00327}00327 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00328}\mbox{\hyperlink{md__promise_8c_a22407168babfbed0f7893dd05df93d2a}{00328}} \mbox{\hyperlink{md__promise_8c_a22407168babfbed0f7893dd05df93d2a}{promise\_meta\_put\_name}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structpromise__raid__conf}{promise\_raid\_conf}} *meta, \textcolor{keywordtype}{char} *\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00329}00329 \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00330}00330 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00331}00331         memset(meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ab943ab4ca64cac8ac96f3ea86abbbf92}{name}}, 0x20, 32);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00332}00332         memcpy(meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ab943ab4ca64cac8ac96f3ea86abbbf92}{name}}, \mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}, MIN(strlen(\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}), 32));}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00333}00333 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00334}00334 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00335}00335 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00336}\mbox{\hyperlink{md__promise_8c_a83d8a8fa64db01a2e4c75914e9e29013}{00336}} \mbox{\hyperlink{md__promise_8c_a83d8a8fa64db01a2e4c75914e9e29013}{promise\_meta\_read}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__consumer}{g\_consumer}} *\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}, \textcolor{keyword}{struct} \mbox{\hyperlink{structpromise__raid__conf}{promise\_raid\_conf}} **metaarr)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00337}00337 \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00338}00338         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__provider}{g\_provider}} *\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00339}00339         \textcolor{keyword}{struct }\mbox{\hyperlink{structpromise__raid__conf}{promise\_raid\_conf}} *meta;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00340}00340         \textcolor{keywordtype}{char} *\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00341}00341         \textcolor{keywordtype}{int} error, i, subdisks;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00342}00342         uint32\_t \mbox{\hyperlink{structpromise__raid__conf_a9f5adcf6bfa26768101c569a33c5d604}{checksum}}, *ptr;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00343}00343 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00344}00344         \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}} = \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00345}00345         subdisks = 0;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00346}00346 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00347}00347         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}} * 4 < \textcolor{keyword}{sizeof}(*meta))}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00348}00348                 \textcolor{keywordflow}{return} (subdisks);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00349}00349         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}} * 4 > maxphys) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00350}00350                 \mbox{\hyperlink{g__raid_8h_a4333fbd8d0899facf171aee7b60697f6}{G\_RAID\_DEBUG}}(1, \textcolor{stringliteral}{"{}\%s: Blocksize is too big."{}}, \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00351}00351                 \textcolor{keywordflow}{return} (subdisks);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00352}00352         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00353}00353 next:}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00354}00354         \textcolor{comment}{/* Read metadata block. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00355}00355         \mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}} = \mbox{\hyperlink{geom_8h_a550c2071f79908eea3d1ccbf821c4e4f}{g\_read\_data}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}, \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a8f47c464c78aa91fa4ca5143ed3cd15e}{mediasize}} -\/ \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}} *}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00356}00356             (63 -\/ subdisks * \mbox{\hyperlink{md__promise_8c_a77d6d528e35f43d5d45a031e3bf99406}{PROMISE\_META\_OFFSET}}),}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00357}00357             \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}} * 4, \&error);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00358}00358         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00359}00359                 \mbox{\hyperlink{g__raid_8h_a4333fbd8d0899facf171aee7b60697f6}{G\_RAID\_DEBUG}}(1, \textcolor{stringliteral}{"{}Cannot read metadata from \%s (error=\%d)."{}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00360}00360                     \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}}, error);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00361}00361                 \textcolor{keywordflow}{return} (subdisks);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00362}00362         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00363}00363         meta = (\textcolor{keyword}{struct }\mbox{\hyperlink{structpromise__raid__conf}{promise\_raid\_conf}} *)\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00364}00364 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00365}00365         \textcolor{comment}{/* Check if this is an Promise RAID struct */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00366}00366         \textcolor{keywordflow}{if} (strncmp(meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a0c477989cfc0aee1927c1656f888ba12}{promise\_id}}, \mbox{\hyperlink{md__promise_8c_a29077fb14589c94c01d6d5f3b0a0ed28}{PROMISE\_MAGIC}}, strlen(\mbox{\hyperlink{md__promise_8c_a29077fb14589c94c01d6d5f3b0a0ed28}{PROMISE\_MAGIC}})) \&\&}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00367}00367             strncmp(meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a0c477989cfc0aee1927c1656f888ba12}{promise\_id}}, \mbox{\hyperlink{md__promise_8c_ac52e4556c81c5932f43ba8dd5a9f5ab9}{FREEBSD\_MAGIC}}, strlen(\mbox{\hyperlink{md__promise_8c_ac52e4556c81c5932f43ba8dd5a9f5ab9}{FREEBSD\_MAGIC}}))) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00368}00368                 \textcolor{keywordflow}{if} (subdisks == 0)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00369}00369                         \mbox{\hyperlink{g__raid_8h_a4333fbd8d0899facf171aee7b60697f6}{G\_RAID\_DEBUG}}(1,}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00370}00370                             \textcolor{stringliteral}{"{}Promise signature check failed on \%s"{}}, \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00371}00371                 \mbox{\hyperlink{geom_8h_ad9924deb20de7b40cb6cf06e5ae28855}{g\_free}}(\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00372}00372                 \textcolor{keywordflow}{return} (subdisks);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00373}00373         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00374}00374         meta = malloc(\textcolor{keyword}{sizeof}(*meta), M\_MD\_PROMISE, M\_WAITOK);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00375}00375         memcpy(meta, \mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}, MIN(\textcolor{keyword}{sizeof}(*meta), \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}} * 4));}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00376}00376         \mbox{\hyperlink{geom_8h_ad9924deb20de7b40cb6cf06e5ae28855}{g\_free}}(\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00377}00377 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00378}00378         \textcolor{comment}{/* Check metadata checksum. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00379}00379         \textcolor{keywordflow}{for} (\mbox{\hyperlink{structpromise__raid__conf_a9f5adcf6bfa26768101c569a33c5d604}{checksum}} = 0, ptr = (uint32\_t *)meta, i = 0; i < 511; i++)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00380}00380                 \mbox{\hyperlink{structpromise__raid__conf_a9f5adcf6bfa26768101c569a33c5d604}{checksum}} += *ptr++;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00381}00381         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structpromise__raid__conf_a9f5adcf6bfa26768101c569a33c5d604}{checksum}} != meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a9f5adcf6bfa26768101c569a33c5d604}{checksum}}) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00382}00382                 \mbox{\hyperlink{g__raid_8h_a4333fbd8d0899facf171aee7b60697f6}{G\_RAID\_DEBUG}}(1, \textcolor{stringliteral}{"{}Promise checksum check failed on \%s"{}}, \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00383}00383                 \mbox{\hyperlink{g__raid__md__if_8m_a4df9edb2717b3f7e4c3c903878577a54}{free}}(meta, M\_MD\_PROMISE);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00384}00384                 \textcolor{keywordflow}{return} (subdisks);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00385}00385         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00386}00386 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00387}00387         \textcolor{keywordflow}{if} ((meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a377f334f6cd684aae8cf62fc8f668cb5}{integrity}} \& \mbox{\hyperlink{md__promise_8c_aa488a845dca778997126c4c91984f6b8}{PROMISE\_I\_VALID}}) == 0) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00388}00388                 \mbox{\hyperlink{g__raid_8h_a4333fbd8d0899facf171aee7b60697f6}{G\_RAID\_DEBUG}}(1, \textcolor{stringliteral}{"{}Promise metadata is invalid on \%s"{}}, \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00389}00389                 \mbox{\hyperlink{g__raid__md__if_8m_a4df9edb2717b3f7e4c3c903878577a54}{free}}(meta, M\_MD\_PROMISE);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00390}00390                 \textcolor{keywordflow}{return} (subdisks);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00391}00391         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00392}00392 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00393}00393         \textcolor{keywordflow}{if} (meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a4591d4915850a182c44952a2e0e164e6}{total\_disks}} > \mbox{\hyperlink{md__promise_8c_a6043ecc0cea629458c18b11a0f79d913}{PROMISE\_MAX\_DISKS}}) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00394}00394                 \mbox{\hyperlink{g__raid_8h_a4333fbd8d0899facf171aee7b60697f6}{G\_RAID\_DEBUG}}(1, \textcolor{stringliteral}{"{}Wrong number of disks on \%s (\%d)"{}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00395}00395                     \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}}, meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a4591d4915850a182c44952a2e0e164e6}{total\_disks}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00396}00396                 \mbox{\hyperlink{g__raid__md__if_8m_a4df9edb2717b3f7e4c3c903878577a54}{free}}(meta, M\_MD\_PROMISE);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00397}00397                 \textcolor{keywordflow}{return} (subdisks);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00398}00398         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00399}00399 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00400}00400         \textcolor{comment}{/* Remove filler garbage from fields used in newer metadata. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00401}00401         \textcolor{keywordflow}{if} (meta-\/>\mbox{\hyperlink{structpromise__raid__conf_afd71e747e37a0dd24e784becfde7cb6b}{disk\_offset\_high}} == 0x8b8c8d8e \&\&}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00402}00402             meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a108318e260bbf343dfb77ed6d8603652}{disk\_sectors\_high}} == 0x8788898a \&\&}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00403}00403             meta-\/>\mbox{\hyperlink{structpromise__raid__conf_accae431c7d4a0bd2d86df235d55ff8a8}{disk\_rebuild\_high}} == 0x83848586) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00404}00404                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_afd71e747e37a0dd24e784becfde7cb6b}{disk\_offset\_high}} = 0;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00405}00405                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a108318e260bbf343dfb77ed6d8603652}{disk\_sectors\_high}} = 0;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00406}00406                 \textcolor{keywordflow}{if} (meta-\/>\mbox{\hyperlink{structpromise__raid__conf_af440803e33d5c8e2ea407cf3b365625a}{disk\_rebuild}} == UINT32\_MAX)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00407}00407                         meta-\/>\mbox{\hyperlink{structpromise__raid__conf_accae431c7d4a0bd2d86df235d55ff8a8}{disk\_rebuild\_high}} = UINT32\_MAX;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00408}00408                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00409}00409                         meta-\/>\mbox{\hyperlink{structpromise__raid__conf_accae431c7d4a0bd2d86df235d55ff8a8}{disk\_rebuild\_high}} = 0;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00410}00410                 \textcolor{keywordflow}{if} (meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a2fac25865626604d1a3333072473f489}{total\_sectors\_high}} == 0x15161718) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00411}00411                         meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a2fac25865626604d1a3333072473f489}{total\_sectors\_high}} = 0;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00412}00412                         meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a97d02f0d1cb92ba73610fa369530652e}{backup\_time}} = 0;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00413}00413                         \textcolor{keywordflow}{if} (meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a0c2f572ff18234677a0adbd5f1f2d9d1}{rebuild\_lba64}} == 0x2122232425262728)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00414}00414                                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a0c2f572ff18234677a0adbd5f1f2d9d1}{rebuild\_lba64}} = UINT64\_MAX;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00415}00415                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00416}00416         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00417}00417         \textcolor{keywordflow}{if} (meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a10de46f425232b9686c3834a7938e5e7}{sector\_size}} < 1 || meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a10de46f425232b9686c3834a7938e5e7}{sector\_size}} > 8)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00418}00418                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a10de46f425232b9686c3834a7938e5e7}{sector\_size}} = 1;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00419}00419 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00420}00420         \textcolor{comment}{/* Save this part and look for next. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00421}00421         *metaarr = meta;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00422}00422         metaarr++;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00423}00423         subdisks++;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00424}00424         \textcolor{keywordflow}{if} (subdisks < \mbox{\hyperlink{md__promise_8c_a1071bebcee9243fc289d40361d4793a6}{PROMISE\_MAX\_SUBDISKS}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00425}00425                 \textcolor{keywordflow}{goto} next;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00426}00426 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00427}00427         \textcolor{keywordflow}{return} (subdisks);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00428}00428 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00429}00429 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00430}00430 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00431}\mbox{\hyperlink{md__promise_8c_a6707745e52b7e36ab54cda898768c4f8}{00431}} \mbox{\hyperlink{md__promise_8c_a6707745e52b7e36ab54cda898768c4f8}{promise\_meta\_write}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__consumer}{g\_consumer}} *\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00432}00432     \textcolor{keyword}{struct} \mbox{\hyperlink{structpromise__raid__conf}{promise\_raid\_conf}} **metaarr, \textcolor{keywordtype}{int} nsd)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00433}00433 \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00434}00434         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__provider}{g\_provider}} *\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00435}00435         \textcolor{keyword}{struct }\mbox{\hyperlink{structpromise__raid__conf}{promise\_raid\_conf}} *meta;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00436}00436         \textcolor{keywordtype}{char} *\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00437}00437         off\_t off, size;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00438}00438         \textcolor{keywordtype}{int} error, i, subdisk, fake;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00439}00439         uint32\_t \mbox{\hyperlink{structpromise__raid__conf_a9f5adcf6bfa26768101c569a33c5d604}{checksum}}, *ptr;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00440}00440 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00441}00441         \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}} = \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00442}00442         subdisk = 0;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00443}00443         fake = 0;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00444}00444 next:}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00445}00445         \mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}} = malloc(\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}} * 4, M\_MD\_PROMISE, M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00446}00446         meta = NULL;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00447}00447         \textcolor{keywordflow}{if} (subdisk < nsd) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00448}00448                 meta = metaarr[subdisk];}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00449}00449         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!fake \&\& \mbox{\hyperlink{md__promise_8c_aecb311da502fea619e83c249c483e0c2}{promise\_meta\_unused\_range}}(metaarr, nsd,}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00450}00450             \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_a8f47c464c78aa91fa4ca5143ed3cd15e}{mediasize}} / \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00451}00451             \&off, \&size)) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00452}00452                 \textcolor{comment}{/* Optionally add record for unused space. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00453}00453                 meta = (\textcolor{keyword}{struct }\mbox{\hyperlink{structpromise__raid__conf}{promise\_raid\_conf}} *)\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00454}00454                 memcpy(\&meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a0c477989cfc0aee1927c1656f888ba12}{promise\_id}}[0], \mbox{\hyperlink{md__promise_8c_a29077fb14589c94c01d6d5f3b0a0ed28}{PROMISE\_MAGIC}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00455}00455                     \textcolor{keyword}{sizeof}(\mbox{\hyperlink{md__promise_8c_a29077fb14589c94c01d6d5f3b0a0ed28}{PROMISE\_MAGIC}}) -\/ 1);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00456}00456                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a189ae93fe42a78e7e952586189a45504}{dummy\_0}} = 0x00020000;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00457}00457                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a377f334f6cd684aae8cf62fc8f668cb5}{integrity}} = \mbox{\hyperlink{md__promise_8c_aa488a845dca778997126c4c91984f6b8}{PROMISE\_I\_VALID}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00458}00458                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ae8467fc2b525d7517c291153f8c33119}{disk}}.\mbox{\hyperlink{structpromise__raid__disk_a16f4266340575cf4ee5229f5f3d0ad95}{flags}} = \mbox{\hyperlink{md__promise_8c_ac42df4956dd3764bd65643979d08322f}{PROMISE\_F\_ONLINE}} | \mbox{\hyperlink{md__promise_8c_ace5b0dcdd7f2899d4ff25e0e06bf0d4c}{PROMISE\_F\_VALID}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00459}00459                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ae8467fc2b525d7517c291153f8c33119}{disk}}.\mbox{\hyperlink{structpromise__raid__disk_aceb1a87bdeded6d666ae56afa3923e92}{number}} = 0xff;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00460}00460                 arc4rand(\&meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ae8467fc2b525d7517c291153f8c33119}{disk}}.id, \textcolor{keyword}{sizeof}(meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ae8467fc2b525d7517c291153f8c33119}{disk}}.id), 0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00461}00461                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_afd71e747e37a0dd24e784becfde7cb6b}{disk\_offset\_high}} = off >> 32;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00462}00462                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a143a91a5acbd6f26144a9ffee198458d}{disk\_offset}} = (uint32\_t)off;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00463}00463                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a108318e260bbf343dfb77ed6d8603652}{disk\_sectors\_high}} = size >> 32;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00464}00464                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a24e4822147b219e5cdf41cb1557cd599}{disk\_sectors}} = (uint32\_t)size;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00465}00465                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_accae431c7d4a0bd2d86df235d55ff8a8}{disk\_rebuild\_high}} = UINT32\_MAX;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00466}00466                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_af440803e33d5c8e2ea407cf3b365625a}{disk\_rebuild}} = UINT32\_MAX;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00467}00467                 fake = 1;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00468}00468         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00469}00469         \textcolor{keywordflow}{if} (meta != NULL) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00470}00470                 \textcolor{comment}{/* Recalculate checksum for case if metadata were changed. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00471}00471                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a9f5adcf6bfa26768101c569a33c5d604}{checksum}} = 0;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00472}00472                 \textcolor{keywordflow}{for} (\mbox{\hyperlink{structpromise__raid__conf_a9f5adcf6bfa26768101c569a33c5d604}{checksum}} = 0, ptr = (uint32\_t *)meta, i = 0; i < 511; i++)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00473}00473                         \mbox{\hyperlink{structpromise__raid__conf_a9f5adcf6bfa26768101c569a33c5d604}{checksum}} += *ptr++;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00474}00474                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a9f5adcf6bfa26768101c569a33c5d604}{checksum}} = \mbox{\hyperlink{structpromise__raid__conf_a9f5adcf6bfa26768101c569a33c5d604}{checksum}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00475}00475                 memcpy(\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}, meta, MIN(\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}} * 4, \textcolor{keyword}{sizeof}(*meta)));}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00476}00476         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00477}00477         error = \mbox{\hyperlink{geom_8h_a9b87ecbd812c109546b077da483baada}{g\_write\_data}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}, \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a8f47c464c78aa91fa4ca5143ed3cd15e}{mediasize}} -\/ \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}} *}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00478}00478             (63 -\/ subdisk * \mbox{\hyperlink{md__promise_8c_a77d6d528e35f43d5d45a031e3bf99406}{PROMISE\_META\_OFFSET}}),}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00479}00479             \mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}, \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}} * 4);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00480}00480         \textcolor{keywordflow}{if} (error != 0) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00481}00481                 \mbox{\hyperlink{g__raid_8h_a4333fbd8d0899facf171aee7b60697f6}{G\_RAID\_DEBUG}}(1, \textcolor{stringliteral}{"{}Cannot write metadata to \%s (error=\%d)."{}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00482}00482                     \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}}, error);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00483}00483         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00484}00484         \mbox{\hyperlink{g__raid__md__if_8m_a4df9edb2717b3f7e4c3c903878577a54}{free}}(\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}, M\_MD\_PROMISE);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00485}00485 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00486}00486         subdisk++;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00487}00487         \textcolor{keywordflow}{if} (subdisk < \mbox{\hyperlink{md__promise_8c_a1071bebcee9243fc289d40361d4793a6}{PROMISE\_MAX\_SUBDISKS}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00488}00488                 \textcolor{keywordflow}{goto} next;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00489}00489 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00490}00490         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00491}00491 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00492}00492 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00493}00493 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00494}\mbox{\hyperlink{md__promise_8c_a313b2317debd09249a3cfb3b0697b87e}{00494}} \mbox{\hyperlink{md__promise_8c_a313b2317debd09249a3cfb3b0697b87e}{promise\_meta\_erase}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__consumer}{g\_consumer}} *\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00495}00495 \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00496}00496         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__provider}{g\_provider}} *\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00497}00497         \textcolor{keywordtype}{char} *\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00498}00498         \textcolor{keywordtype}{int} \mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}}, subdisk;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00499}00499 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00500}00500         \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}} = \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00501}00501         \mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}} = malloc(4 * \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}}, M\_MD\_PROMISE, M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00502}00502         \textcolor{keywordflow}{for} (subdisk = 0; subdisk < \mbox{\hyperlink{md__promise_8c_a1071bebcee9243fc289d40361d4793a6}{PROMISE\_MAX\_SUBDISKS}}; subdisk++) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00503}00503                 \mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}} = \mbox{\hyperlink{geom_8h_a9b87ecbd812c109546b077da483baada}{g\_write\_data}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}, \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a8f47c464c78aa91fa4ca5143ed3cd15e}{mediasize}} -\/ \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}} *}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00504}00504                     (63 -\/ subdisk * \mbox{\hyperlink{md__promise_8c_a77d6d528e35f43d5d45a031e3bf99406}{PROMISE\_META\_OFFSET}}),}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00505}00505                     \mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}, 4 * \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00506}00506                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}} != 0) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00507}00507                         \mbox{\hyperlink{g__raid_8h_a4333fbd8d0899facf171aee7b60697f6}{G\_RAID\_DEBUG}}(1, \textcolor{stringliteral}{"{}Cannot erase metadata on \%s (error=\%d)."{}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00508}00508                             \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}}, \mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00509}00509                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00510}00510         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00511}00511         \mbox{\hyperlink{g__raid__md__if_8m_a4df9edb2717b3f7e4c3c903878577a54}{free}}(\mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}, M\_MD\_PROMISE);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00512}00512         \textcolor{keywordflow}{return} (\mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00513}00513 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00514}00514 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00515}00515 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00516}\mbox{\hyperlink{md__promise_8c_aaca73179df3140e5d531d7c76e8db9f2}{00516}} \mbox{\hyperlink{md__promise_8c_aaca73179df3140e5d531d7c76e8db9f2}{promise\_meta\_write\_spare}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__consumer}{g\_consumer}} *\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00517}00517 \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00518}00518         \textcolor{keyword}{struct }\mbox{\hyperlink{structpromise__raid__conf}{promise\_raid\_conf}} *meta;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00519}00519         off\_t tmp;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00520}00520         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00521}00521 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00522}00522         meta = malloc(\textcolor{keyword}{sizeof}(*meta), M\_MD\_PROMISE, M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00523}00523         memcpy(\&meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a0c477989cfc0aee1927c1656f888ba12}{promise\_id}}[0], \mbox{\hyperlink{md__promise_8c_a29077fb14589c94c01d6d5f3b0a0ed28}{PROMISE\_MAGIC}}, \textcolor{keyword}{sizeof}(\mbox{\hyperlink{md__promise_8c_a29077fb14589c94c01d6d5f3b0a0ed28}{PROMISE\_MAGIC}}) -\/ 1);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00524}00524         meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a189ae93fe42a78e7e952586189a45504}{dummy\_0}} = 0x00020000;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00525}00525         meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a377f334f6cd684aae8cf62fc8f668cb5}{integrity}} = \mbox{\hyperlink{md__promise_8c_aa488a845dca778997126c4c91984f6b8}{PROMISE\_I\_VALID}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00526}00526         meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ae8467fc2b525d7517c291153f8c33119}{disk}}.\mbox{\hyperlink{structpromise__raid__disk_a16f4266340575cf4ee5229f5f3d0ad95}{flags}} = \mbox{\hyperlink{md__promise_8c_a6b9b7233425401b727727ee7ef693662}{PROMISE\_F\_SPARE}} | \mbox{\hyperlink{md__promise_8c_ac42df4956dd3764bd65643979d08322f}{PROMISE\_F\_ONLINE}} | \mbox{\hyperlink{md__promise_8c_ace5b0dcdd7f2899d4ff25e0e06bf0d4c}{PROMISE\_F\_VALID}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00527}00527         meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ae8467fc2b525d7517c291153f8c33119}{disk}}.\mbox{\hyperlink{structpromise__raid__disk_aceb1a87bdeded6d666ae56afa3923e92}{number}} = 0xff;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00528}00528         arc4rand(\&meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ae8467fc2b525d7517c291153f8c33119}{disk}}.id, \textcolor{keyword}{sizeof}(meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ae8467fc2b525d7517c291153f8c33119}{disk}}.id), 0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00529}00529         tmp = \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_a8f47c464c78aa91fa4ca5143ed3cd15e}{mediasize}} / \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}} -\/ 131072;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00530}00530         meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a108318e260bbf343dfb77ed6d8603652}{disk\_sectors\_high}} = tmp >> 32;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00531}00531         meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a24e4822147b219e5cdf41cb1557cd599}{disk\_sectors}} = (uint32\_t)tmp;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00532}00532         meta-\/>\mbox{\hyperlink{structpromise__raid__conf_accae431c7d4a0bd2d86df235d55ff8a8}{disk\_rebuild\_high}} = UINT32\_MAX;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00533}00533         meta-\/>\mbox{\hyperlink{structpromise__raid__conf_af440803e33d5c8e2ea407cf3b365625a}{disk\_rebuild}} = UINT32\_MAX;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00534}00534         error = \mbox{\hyperlink{md__promise_8c_a6707745e52b7e36ab54cda898768c4f8}{promise\_meta\_write}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}, \&meta, 1);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00535}00535         \mbox{\hyperlink{g__raid__md__if_8m_a4df9edb2717b3f7e4c3c903878577a54}{free}}(meta, M\_MD\_PROMISE);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00536}00536         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00537}00537 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00538}00538 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00539}00539 \textcolor{keyword}{static} \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__volume}{g\_raid\_volume}} *}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00540}\mbox{\hyperlink{md__promise_8c_a7ec6b8e35a71a1982c3feb3e234661dd}{00540}} \mbox{\hyperlink{md__promise_8c_a7ec6b8e35a71a1982c3feb3e234661dd}{g\_raid\_md\_promise\_get\_volume}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__softc}{g\_raid\_softc}} *sc, uint64\_t \textcolor{keywordtype}{id})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00541}00541 \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00542}00542         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__volume}{g\_raid\_volume}}       *\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00543}00543         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__promise__pervolume}{g\_raid\_md\_promise\_pervolume}} *pv;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00544}00544 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00545}00545         TAILQ\_FOREACH(\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}, \&sc-\/>sc\_volumes, v\_next) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00546}00546                 pv = \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a1f432fb732072f5b196b570dd1d1e998}{v\_md\_data}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00547}00547                 \textcolor{keywordflow}{if} (pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a7529f3ff051c7927f2deaff5d206065a}{pv\_id}} == \textcolor{keywordtype}{id})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00548}00548                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00549}00549         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00550}00550         \textcolor{keywordflow}{return} (\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00551}00551 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00552}00552 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00553}00553 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00554}\mbox{\hyperlink{md__promise_8c_a07e21cd261f1a1ee4981de958094c073}{00554}} \mbox{\hyperlink{md__promise_8c_a07e21cd261f1a1ee4981de958094c073}{g\_raid\_md\_promise\_purge\_volumes}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__softc}{g\_raid\_softc}} *sc)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00555}00555 \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00556}00556         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__volume}{g\_raid\_volume}}       *\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}, *tvol;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00557}00557         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__promise__pervolume}{g\_raid\_md\_promise\_pervolume}} *pv;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00558}00558         \textcolor{keywordtype}{int} i, res;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00559}00559 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00560}00560         res = 0;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00561}00561         TAILQ\_FOREACH\_SAFE(\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}, \&sc-\/>sc\_volumes, v\_next, tvol) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00562}00562                 pv = \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a1f432fb732072f5b196b570dd1d1e998}{v\_md\_data}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00563}00563                 \textcolor{keywordflow}{if} (!pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a87d7b4b6ae10863075c2b4ad6d95d93b}{pv\_started}} || \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a61fb0849390a6916c173c37a9653dada}{v\_stopping}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00564}00564                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00565}00565                 \textcolor{keywordflow}{for} (i = 0; i < \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a21482a5ac78a397faf4e95eb1ebef431}{v\_disks\_count}}; i++) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00566}00566                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a3c43185db4bd1c4818d95a415635854b}{v\_subdisks}}[i].\mbox{\hyperlink{structg__raid__subdisk_acd19794916930f74ecad38ca7dd69f69}{sd\_state}} != \mbox{\hyperlink{g__raid_8h_af37111ba44cfc01a98d97bed8f60d964}{G\_RAID\_SUBDISK\_S\_NONE}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00567}00567                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00568}00568                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00569}00569                 \textcolor{keywordflow}{if} (i >= \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a21482a5ac78a397faf4e95eb1ebef431}{v\_disks\_count}}) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00570}00570                         \mbox{\hyperlink{g__raid_8c_ab2c6132332d0e91db0d7402a150d7716}{g\_raid\_destroy\_volume}}(\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00571}00571                         res = 1;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00572}00572                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00573}00573         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00574}00574         \textcolor{keywordflow}{return} (res);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00575}00575 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00576}00576 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00577}00577 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00578}\mbox{\hyperlink{md__promise_8c_a15d123072f3eb970e226da92c7d02b4b}{00578}} \mbox{\hyperlink{md__promise_8c_a15d123072f3eb970e226da92c7d02b4b}{g\_raid\_md\_promise\_purge\_disks}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__softc}{g\_raid\_softc}} *sc)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00579}00579 \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00580}00580         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__disk}{g\_raid\_disk}}   *\mbox{\hyperlink{g__raid__md__if_8m_a9508e997a57ea259d6ecc0e563261993}{disk}}, *tdisk;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00581}00581         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__volume}{g\_raid\_volume}}       *\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00582}00582         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__promise__perdisk}{g\_raid\_md\_promise\_perdisk}} *pd;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00583}00583         \textcolor{keywordtype}{int} i, j, res;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00584}00584 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00585}00585         res = 0;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00586}00586         TAILQ\_FOREACH\_SAFE(\mbox{\hyperlink{structdisk}{disk}}, \&sc-\/>sc\_disks, d\_next, tdisk) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00587}00587                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{structdisk}{disk}}-\/>d\_state == \mbox{\hyperlink{g__raid_8h_a53208a3eca6d67917c6fdf6321292c99}{G\_RAID\_DISK\_S\_SPARE}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00588}00588                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00589}00589                 pd = (\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__promise__perdisk}{g\_raid\_md\_promise\_perdisk}} *)\mbox{\hyperlink{structdisk}{disk}}-\/>d\_md\_data;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00590}00590 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00591}00591                 \textcolor{comment}{/* Scan for deleted volumes. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00592}00592                 for (i = 0; i < pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_af83a2a95e726587eddda9df693dc9fe3}{pd\_subdisks}}; ) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00593}00593                         \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}} = \mbox{\hyperlink{md__promise_8c_a7ec6b8e35a71a1982c3feb3e234661dd}{g\_raid\_md\_promise\_get\_volume}}(sc,}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00594}00594                             pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[i]-\/>volume\_id);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00595}00595                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}} != NULL \&\& !\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a61fb0849390a6916c173c37a9653dada}{v\_stopping}}) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00596}00596                                 i++;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00597}00597                                 \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00598}00598                         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00599}00599                         \mbox{\hyperlink{g__raid__md__if_8m_a4df9edb2717b3f7e4c3c903878577a54}{free}}(pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[i], M\_MD\_PROMISE);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00600}00600                         \textcolor{keywordflow}{for} (j = i; j < pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_af83a2a95e726587eddda9df693dc9fe3}{pd\_subdisks}} -\/ 1; j++)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00601}00601                                 pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[j] = pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[j + 1];}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00602}00602                         pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_af83a2a95e726587eddda9df693dc9fe3}{pd\_subdisks}} -\/ 1] = NULL;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00603}00603                         pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_af83a2a95e726587eddda9df693dc9fe3}{pd\_subdisks}}-\/-\/;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00604}00604                         pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_ab4298e04bfd1fc70debb15180a449beb}{pd\_updated}} = 1;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00605}00605                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00606}00606 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00607}00607                 \textcolor{comment}{/* If there is no metadata left -\/ erase and delete disk. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00608}00608                 \textcolor{keywordflow}{if} (pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_af83a2a95e726587eddda9df693dc9fe3}{pd\_subdisks}} == 0) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00609}00609                         \mbox{\hyperlink{md__promise_8c_a313b2317debd09249a3cfb3b0697b87e}{promise\_meta\_erase}}(\mbox{\hyperlink{structdisk}{disk}}-\/>d\_consumer);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00610}00610                         \mbox{\hyperlink{g__raid_8c_ac1e32d950d9354f1dca5d2ca34244adc}{g\_raid\_destroy\_disk}}(\mbox{\hyperlink{structdisk}{disk}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00611}00611                         res = 1;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00612}00612                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00613}00613         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00614}00614         \textcolor{keywordflow}{return} (res);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00615}00615 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00616}00616 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00617}00617 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00618}\mbox{\hyperlink{md__promise_8c_a70b54911e536ffa263b866d57b1563ed}{00618}} \mbox{\hyperlink{md__promise_8c_a70b54911e536ffa263b866d57b1563ed}{g\_raid\_md\_promise\_supported}}(\textcolor{keywordtype}{int} level, \textcolor{keywordtype}{int} qual, \textcolor{keywordtype}{int} disks, \textcolor{keywordtype}{int} force)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00619}00619 \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00620}00620 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00621}00621         \textcolor{keywordflow}{if} (disks > \mbox{\hyperlink{md__promise_8c_a6043ecc0cea629458c18b11a0f79d913}{PROMISE\_MAX\_DISKS}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00622}00622                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00623}00623         \textcolor{keywordflow}{switch} (level) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00624}00624         \textcolor{keywordflow}{case} \mbox{\hyperlink{g__raid_8h_a6a49f4ddd0b45eb4210ce72528786a32}{G\_RAID\_VOLUME\_RL\_RAID0}}:}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00625}00625                 \textcolor{keywordflow}{if} (disks < 1)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00626}00626                         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00627}00627                 \textcolor{keywordflow}{if} (!force \&\& disks < 2)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00628}00628                         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00629}00629                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00630}00630         \textcolor{keywordflow}{case} \mbox{\hyperlink{g__raid_8h_a270bdf6b61fc7d810795e08ebbe60931}{G\_RAID\_VOLUME\_RL\_RAID1}}:}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00631}00631                 \textcolor{keywordflow}{if} (disks < 1)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00632}00632                         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00633}00633                 \textcolor{keywordflow}{if} (!force \&\& (disks != 2))}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00634}00634                         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00635}00635                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00636}00636         \textcolor{keywordflow}{case} \mbox{\hyperlink{g__raid_8h_ad0ef2cd50760a49759a6cbaf2afeb286}{G\_RAID\_VOLUME\_RL\_RAID1E}}:}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00637}00637                 \textcolor{keywordflow}{if} (disks < 2)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00638}00638                         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00639}00639                 \textcolor{keywordflow}{if} (disks \% 2 != 0)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00640}00640                         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00641}00641                 \textcolor{keywordflow}{if} (!force \&\& (disks != 4))}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00642}00642                         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00643}00643                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00644}00644         \textcolor{keywordflow}{case} \mbox{\hyperlink{g__raid_8h_acb418af006a1d84e0dd912c58cec6f57}{G\_RAID\_VOLUME\_RL\_SINGLE}}:}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00645}00645                 \textcolor{keywordflow}{if} (disks != 1)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00646}00646                         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00647}00647                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00648}00648         \textcolor{keywordflow}{case} \mbox{\hyperlink{g__raid_8h_abc695e94a9e4eff0f657ec01d1f19607}{G\_RAID\_VOLUME\_RL\_CONCAT}}:}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00649}00649                 \textcolor{keywordflow}{if} (disks < 2)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00650}00650                         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00651}00651                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00652}00652         \textcolor{keywordflow}{case} \mbox{\hyperlink{g__raid_8h_af6db015b03ea390243f2df897eb1189d}{G\_RAID\_VOLUME\_RL\_RAID5}}:}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00653}00653                 \textcolor{keywordflow}{if} (disks < 3)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00654}00654                         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00655}00655                 \textcolor{keywordflow}{if} (qual != \mbox{\hyperlink{g__raid_8h_a85a42d827015531803abc6df07b15e89}{G\_RAID\_VOLUME\_RLQ\_R5LA}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00656}00656                         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00657}00657                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00658}00658         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00659}00659                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00660}00660         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00661}00661         \textcolor{keywordflow}{if} (level != \mbox{\hyperlink{g__raid_8h_af6db015b03ea390243f2df897eb1189d}{G\_RAID\_VOLUME\_RL\_RAID5}} \&\& qual != \mbox{\hyperlink{g__raid_8h_a9c036957b2fb94761b5fd084e8f991c9}{G\_RAID\_VOLUME\_RLQ\_NONE}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00662}00662                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00663}00663         \textcolor{keywordflow}{return} (1);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00664}00664 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00665}00665 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00666}00666 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00667}\mbox{\hyperlink{md__promise_8c_a1be257df9ee481a1aef9991dfd3bf676}{00667}} \mbox{\hyperlink{md__promise_8c_a1be257df9ee481a1aef9991dfd3bf676}{g\_raid\_md\_promise\_start\_disk}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__disk}{g\_raid\_disk}} *\mbox{\hyperlink{structdisk}{disk}}, \textcolor{keywordtype}{int} sdn,}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00668}00668     \textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__volume}{g\_raid\_volume}} *\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00669}00669 \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00670}00670         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__softc}{g\_raid\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00671}00671         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__subdisk}{g\_raid\_subdisk}} *\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00672}00672         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__promise__perdisk}{g\_raid\_md\_promise\_perdisk}} *pd;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00673}00673         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__promise__pervolume}{g\_raid\_md\_promise\_pervolume}} *pv;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00674}00674         \textcolor{keyword}{struct }\mbox{\hyperlink{structpromise__raid__conf}{promise\_raid\_conf}} *meta;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00675}00675         off\_t eoff, esize, size;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00676}00676         \textcolor{keywordtype}{int} disk\_pos, md\_disk\_pos, i, resurrection = 0;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00677}00677 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00678}00678         sc = \mbox{\hyperlink{structdisk}{disk}}-\/>d\_softc;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00679}00679         pd = (\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__promise__perdisk}{g\_raid\_md\_promise\_perdisk}} *)\mbox{\hyperlink{structdisk}{disk}}-\/>d\_md\_data;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00680}00680 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00681}00681         pv = \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a1f432fb732072f5b196b570dd1d1e998}{v\_md\_data}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00682}00682         meta = pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a94097bae0d51bd8d9693a3bea313a5f6}{pv\_meta}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00683}00683 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00684}00684         if (sdn >= 0) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00685}00685                 \textcolor{comment}{/* Find disk position in metadata by its serial. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00686}00686                 md\_disk\_pos = \mbox{\hyperlink{md__promise_8c_a6ef59af68b8cc76c1b2ca32836d08c78}{promise\_meta\_find\_disk}}(meta, pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[sdn]-\/>\mbox{\hyperlink{structpromise__raid__conf_ae8467fc2b525d7517c291153f8c33119}{disk}}.id);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00687}00687                 \textcolor{comment}{/* For RAID0+1 we need to translate order. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00688}00688                 disk\_pos = \mbox{\hyperlink{md__promise_8c_ae78c674b460edb2aa59af8ec82bf15f6}{promise\_meta\_translate\_disk}}(\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}, md\_disk\_pos);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00689}00689         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00690}00690                 md\_disk\_pos = -\/1;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00691}00691                 disk\_pos = -\/1;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00692}00692         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00693}00693         \textcolor{keywordflow}{if} (disk\_pos < 0) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00694}00694                 \mbox{\hyperlink{g__raid_8h_ace7234f8197b96e1b636f9376de8d7ea}{G\_RAID\_DEBUG1}}(1, sc, \textcolor{stringliteral}{"{}Disk \%s is not part of the volume \%s"{}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00695}00695                     \mbox{\hyperlink{g__raid_8c_a8ceaeb12952563e6fe9869ed6b8daa5d}{g\_raid\_get\_diskname}}(\mbox{\hyperlink{structdisk}{disk}}), \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_abdedb24b3ca3f4d3020f94e62d63fa05}{v\_name}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00696}00696                 \textcolor{comment}{/* Failed stale disk is useless for us. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00697}00697                 \textcolor{keywordflow}{if} (sdn >= 0 \&\&}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00698}00698                     pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[sdn]-\/>\mbox{\hyperlink{structpromise__raid__conf_ae8467fc2b525d7517c291153f8c33119}{disk}}.\mbox{\hyperlink{structpromise__raid__disk_a16f4266340575cf4ee5229f5f3d0ad95}{flags}} \& \mbox{\hyperlink{md__promise_8c_aa59a43a69b8ab9246e5c0462bc23d89e}{PROMISE\_F\_DOWN}}) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00699}00699                         \mbox{\hyperlink{g__raid_8c_a342da571518e21e0521b6416c838d00e}{g\_raid\_change\_disk\_state}}(\mbox{\hyperlink{structdisk}{disk}}, \mbox{\hyperlink{g__raid_8h_ac204b4a9677b7e98bfeb81a687335e97}{G\_RAID\_DISK\_S\_STALE\_FAILED}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00700}00700                         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00701}00701                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00702}00702                 \textcolor{comment}{/* If we were given specific metadata subdisk -\/ erase it. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00703}00703                 \textcolor{keywordflow}{if} (sdn >= 0) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00704}00704                         \mbox{\hyperlink{g__raid__md__if_8m_a4df9edb2717b3f7e4c3c903878577a54}{free}}(pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[sdn], M\_MD\_PROMISE);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00705}00705                         \textcolor{keywordflow}{for} (i = sdn; i < pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_af83a2a95e726587eddda9df693dc9fe3}{pd\_subdisks}} -\/ 1; i++)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00706}00706                                 pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[i] = pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[i + 1];}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00707}00707                         pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_af83a2a95e726587eddda9df693dc9fe3}{pd\_subdisks}} -\/ 1] = NULL;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00708}00708                         pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_af83a2a95e726587eddda9df693dc9fe3}{pd\_subdisks}}-\/-\/;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00709}00709                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00710}00710                 \textcolor{comment}{/* If we are in the start process, that's all for now. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00711}00711                 \textcolor{keywordflow}{if} (!pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a87d7b4b6ae10863075c2b4ad6d95d93b}{pv\_started}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00712}00712                         \textcolor{keywordflow}{goto} nofit;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00713}00713                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00714}00714 \textcolor{comment}{                 * If we have already started -\/ try to get use of the disk.}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00715}00715 \textcolor{comment}{                 * Try to replace OFFLINE disks first, then FAILED.}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00716}00716 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00717}00717                 \mbox{\hyperlink{md__promise_8c_aecb311da502fea619e83c249c483e0c2}{promise\_meta\_unused\_range}}(pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}, pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_af83a2a95e726587eddda9df693dc9fe3}{pd\_subdisks}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00718}00718                     \mbox{\hyperlink{structdisk}{disk}}-\/>d\_consumer-\/>provider-\/>mediasize /}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00719}00719                     \mbox{\hyperlink{structdisk}{disk}}-\/>d\_consumer-\/>provider-\/>sectorsize,}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00720}00720                     \&eoff, \&esize);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00721}00721                 \textcolor{keywordflow}{if} (esize == 0) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00722}00722                         \mbox{\hyperlink{g__raid_8h_ace7234f8197b96e1b636f9376de8d7ea}{G\_RAID\_DEBUG1}}(1, sc, \textcolor{stringliteral}{"{}No free space on disk \%s"{}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00723}00723                             \mbox{\hyperlink{g__raid_8c_a8ceaeb12952563e6fe9869ed6b8daa5d}{g\_raid\_get\_diskname}}(\mbox{\hyperlink{structdisk}{disk}}));}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00724}00724                         \textcolor{keywordflow}{goto} nofit;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00725}00725                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00726}00726                 size = INT64\_MAX;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00727}00727                 \textcolor{keywordflow}{for} (i = 0; i < \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a21482a5ac78a397faf4e95eb1ebef431}{v\_disks\_count}}; i++) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00728}00728                         \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}} = \&\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a3c43185db4bd1c4818d95a415635854b}{v\_subdisks}}[i];}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00729}00729                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_acd19794916930f74ecad38ca7dd69f69}{sd\_state}} != \mbox{\hyperlink{g__raid_8h_af37111ba44cfc01a98d97bed8f60d964}{G\_RAID\_SUBDISK\_S\_NONE}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00730}00730                                 size = \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_abc4da1103e29e3a8e2bbadb18fbccbf6}{sd\_size}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00731}00731                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_acd19794916930f74ecad38ca7dd69f69}{sd\_state}} <= \mbox{\hyperlink{g__raid_8h_a2e56fb1cd5fdab097052e38c28a8c92f}{G\_RAID\_SUBDISK\_S\_FAILED}} \&\&}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00732}00732                             (disk\_pos < 0 ||}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00733}00733                              \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a3c43185db4bd1c4818d95a415635854b}{v\_subdisks}}[i].\mbox{\hyperlink{structg__raid__subdisk_acd19794916930f74ecad38ca7dd69f69}{sd\_state}} < \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_acd19794916930f74ecad38ca7dd69f69}{sd\_state}}))}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00734}00734                                 disk\_pos = i;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00735}00735                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00736}00736                 \textcolor{keywordflow}{if} (disk\_pos >= 0 \&\&}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00737}00737                     \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} != \mbox{\hyperlink{g__raid_8h_abc695e94a9e4eff0f657ec01d1f19607}{G\_RAID\_VOLUME\_RL\_CONCAT}} \&\&}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00738}00738                     (off\_t)esize * 512 < size) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00739}00739                         \mbox{\hyperlink{g__raid_8h_ace7234f8197b96e1b636f9376de8d7ea}{G\_RAID\_DEBUG1}}(1, sc, \textcolor{stringliteral}{"{}Disk \%s free space "{}}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00740}00740                             \textcolor{stringliteral}{"{}is too small (\%ju < \%ju)"{}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00741}00741                             \mbox{\hyperlink{g__raid_8c_a8ceaeb12952563e6fe9869ed6b8daa5d}{g\_raid\_get\_diskname}}(\mbox{\hyperlink{structdisk}{disk}}),}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00742}00742                             (off\_t)esize * 512, size);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00743}00743                         disk\_pos = -\/1;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00744}00744                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00745}00745                 \textcolor{keywordflow}{if} (disk\_pos >= 0) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00746}00746                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} != \mbox{\hyperlink{g__raid_8h_abc695e94a9e4eff0f657ec01d1f19607}{G\_RAID\_VOLUME\_RL\_CONCAT}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00747}00747                                 esize = size / 512;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00748}00748                         \textcolor{comment}{/* For RAID0+1 we need to translate order. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00749}00749                         md\_disk\_pos = \mbox{\hyperlink{md__promise_8c_ae78c674b460edb2aa59af8ec82bf15f6}{promise\_meta\_translate\_disk}}(\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}, disk\_pos);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00750}00750                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00751}00751 nofit:}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00752}00752                         \textcolor{keywordflow}{if} (pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_af83a2a95e726587eddda9df693dc9fe3}{pd\_subdisks}} == 0) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00753}00753                                 \mbox{\hyperlink{g__raid_8c_a342da571518e21e0521b6416c838d00e}{g\_raid\_change\_disk\_state}}(\mbox{\hyperlink{structdisk}{disk}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00754}00754                                     \mbox{\hyperlink{g__raid_8h_a53208a3eca6d67917c6fdf6321292c99}{G\_RAID\_DISK\_S\_SPARE}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00755}00755                         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00756}00756                         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00757}00757                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00758}00758                 \mbox{\hyperlink{g__raid_8h_ace7234f8197b96e1b636f9376de8d7ea}{G\_RAID\_DEBUG1}}(1, sc, \textcolor{stringliteral}{"{}Disk \%s takes pos \%d in the volume \%s"{}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00759}00759                     \mbox{\hyperlink{g__raid_8c_a8ceaeb12952563e6fe9869ed6b8daa5d}{g\_raid\_get\_diskname}}(\mbox{\hyperlink{structdisk}{disk}}), disk\_pos, \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_abdedb24b3ca3f4d3020f94e62d63fa05}{v\_name}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00760}00760                 resurrection = 1;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00761}00761         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00762}00762 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00763}00763         \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}} = \&\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a3c43185db4bd1c4818d95a415635854b}{v\_subdisks}}[disk\_pos];}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00764}00764 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00765}00765         \textcolor{keywordflow}{if} (resurrection \&\& \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_a5570ab684f57213078d94750e63354e1}{sd\_disk}} != NULL) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00766}00766                 \mbox{\hyperlink{g__raid_8c_a342da571518e21e0521b6416c838d00e}{g\_raid\_change\_disk\_state}}(\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_a5570ab684f57213078d94750e63354e1}{sd\_disk}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00767}00767                     \mbox{\hyperlink{g__raid_8h_ac204b4a9677b7e98bfeb81a687335e97}{G\_RAID\_DISK\_S\_STALE\_FAILED}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00768}00768                 TAILQ\_REMOVE(\&\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_a5570ab684f57213078d94750e63354e1}{sd\_disk}}-\/>d\_subdisks,}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00769}00769                     \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}, sd\_next);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00770}00770         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00771}00771         \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a3c43185db4bd1c4818d95a415635854b}{v\_subdisks}}[disk\_pos].\mbox{\hyperlink{structg__raid__subdisk_a5570ab684f57213078d94750e63354e1}{sd\_disk}} = \mbox{\hyperlink{g__raid__md__if_8m_a9508e997a57ea259d6ecc0e563261993}{disk}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00772}00772         TAILQ\_INSERT\_TAIL(\&\mbox{\hyperlink{structdisk}{disk}}-\/>d\_subdisks, \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}, sd\_next);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00773}00773 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00774}00774         \textcolor{comment}{/* Welcome the new disk. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00775}00775         \textcolor{keywordflow}{if} (resurrection)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00776}00776                 \mbox{\hyperlink{g__raid_8c_a342da571518e21e0521b6416c838d00e}{g\_raid\_change\_disk\_state}}(\mbox{\hyperlink{structdisk}{disk}}, \mbox{\hyperlink{g__raid_8h_aaf46a21394a57a2fcac34b1b7b52701c}{G\_RAID\_DISK\_S\_ACTIVE}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00777}00777         \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a230625945ea844bdb2d31809448782b5}{disks}}[md\_disk\_pos].\mbox{\hyperlink{structpromise__raid__disk_a16f4266340575cf4ee5229f5f3d0ad95}{flags}} \& \mbox{\hyperlink{md__promise_8c_aa59a43a69b8ab9246e5c0462bc23d89e}{PROMISE\_F\_DOWN}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00778}00778                 \mbox{\hyperlink{g__raid_8c_a342da571518e21e0521b6416c838d00e}{g\_raid\_change\_disk\_state}}(\mbox{\hyperlink{structdisk}{disk}}, \mbox{\hyperlink{g__raid_8h_a2135c7d2f628dbf559cad6d4ea1b5c8f}{G\_RAID\_DISK\_S\_FAILED}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00779}00779         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00780}00780                 \mbox{\hyperlink{g__raid_8c_a342da571518e21e0521b6416c838d00e}{g\_raid\_change\_disk\_state}}(\mbox{\hyperlink{structdisk}{disk}}, \mbox{\hyperlink{g__raid_8h_aaf46a21394a57a2fcac34b1b7b52701c}{G\_RAID\_DISK\_S\_ACTIVE}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00781}00781 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00782}00782         \textcolor{keywordflow}{if} (resurrection) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00783}00783                 \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_a9b4e12573b26ee18473a16408044819f}{sd\_offset}} = (off\_t)eoff * 512;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00784}00784                 \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_abc4da1103e29e3a8e2bbadb18fbccbf6}{sd\_size}} = (off\_t)esize * 512;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00785}00785         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00786}00786                 \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_a9b4e12573b26ee18473a16408044819f}{sd\_offset}} = (((off\_t)pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[sdn]-\/>\mbox{\hyperlink{structpromise__raid__conf_afd71e747e37a0dd24e784becfde7cb6b}{disk\_offset\_high}}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00787}00787                     << 32) + pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[sdn]-\/>\mbox{\hyperlink{structpromise__raid__conf_a143a91a5acbd6f26144a9ffee198458d}{disk\_offset}}) * 512;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00788}00788                 \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_abc4da1103e29e3a8e2bbadb18fbccbf6}{sd\_size}} = (((off\_t)pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[sdn]-\/>\mbox{\hyperlink{structpromise__raid__conf_a108318e260bbf343dfb77ed6d8603652}{disk\_sectors\_high}}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00789}00789                     << 32) + pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[sdn]-\/>\mbox{\hyperlink{structpromise__raid__conf_a24e4822147b219e5cdf41cb1557cd599}{disk\_sectors}}) * 512;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00790}00790         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00791}00791 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00792}00792         \textcolor{keywordflow}{if} (resurrection) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00793}00793                 \textcolor{comment}{/* Stale disk, almost same as new. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00794}00794                 \mbox{\hyperlink{g__raid_8c_a058db459d5349d2130fda3a02dd2af29}{g\_raid\_change\_subdisk\_state}}(\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00795}00795                     \mbox{\hyperlink{g__raid_8h_a9dd59db9322af74b4b15021c3fc8f2f5}{G\_RAID\_SUBDISK\_S\_NEW}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00796}00796         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a230625945ea844bdb2d31809448782b5}{disks}}[md\_disk\_pos].\mbox{\hyperlink{structpromise__raid__disk_a16f4266340575cf4ee5229f5f3d0ad95}{flags}} \& \mbox{\hyperlink{md__promise_8c_aa59a43a69b8ab9246e5c0462bc23d89e}{PROMISE\_F\_DOWN}}) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00797}00797                 \textcolor{comment}{/* Failed disk. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00798}00798                 \mbox{\hyperlink{g__raid_8c_a058db459d5349d2130fda3a02dd2af29}{g\_raid\_change\_subdisk\_state}}(\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00799}00799                     \mbox{\hyperlink{g__raid_8h_a2e56fb1cd5fdab097052e38c28a8c92f}{G\_RAID\_SUBDISK\_S\_FAILED}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00800}00800         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a230625945ea844bdb2d31809448782b5}{disks}}[md\_disk\_pos].\mbox{\hyperlink{structpromise__raid__disk_a16f4266340575cf4ee5229f5f3d0ad95}{flags}} \& \mbox{\hyperlink{md__promise_8c_aa4244066795df910826a3ef954f8e87e}{PROMISE\_F\_REDIR}}) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00801}00801                 \textcolor{comment}{/* Rebuilding disk. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00802}00802                 \mbox{\hyperlink{g__raid_8c_a058db459d5349d2130fda3a02dd2af29}{g\_raid\_change\_subdisk\_state}}(\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00803}00803                     \mbox{\hyperlink{g__raid_8h_a856d6801d600e0089b0cd39ff5af7224}{G\_RAID\_SUBDISK\_S\_REBUILD}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00804}00804                 \textcolor{keywordflow}{if} (pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[sdn]-\/>\mbox{\hyperlink{structpromise__raid__conf_a6564feadfd2dc21b64f5994567650a99}{generation}} != meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a6564feadfd2dc21b64f5994567650a99}{generation}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00805}00805                         \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_aca58c7c621e10d2cbe97cd1c87214d7b}{sd\_rebuild\_pos}} = 0;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00806}00806                 \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00807}00807                         \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_aca58c7c621e10d2cbe97cd1c87214d7b}{sd\_rebuild\_pos}} =}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00808}00808                             (((off\_t)pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[sdn]-\/>\mbox{\hyperlink{structpromise__raid__conf_accae431c7d4a0bd2d86df235d55ff8a8}{disk\_rebuild\_high}} << 32) +}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00809}00809                              pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[sdn]-\/>\mbox{\hyperlink{structpromise__raid__conf_af440803e33d5c8e2ea407cf3b365625a}{disk\_rebuild}}) * 512;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00810}00810                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00811}00811         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!(meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a230625945ea844bdb2d31809448782b5}{disks}}[md\_disk\_pos].\mbox{\hyperlink{structpromise__raid__disk_a16f4266340575cf4ee5229f5f3d0ad95}{flags}} \& \mbox{\hyperlink{md__promise_8c_ac42df4956dd3764bd65643979d08322f}{PROMISE\_F\_ONLINE}})) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00812}00812                 \textcolor{comment}{/* Rebuilding disk. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00813}00813                 \mbox{\hyperlink{g__raid_8c_a058db459d5349d2130fda3a02dd2af29}{g\_raid\_change\_subdisk\_state}}(\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00814}00814                     \mbox{\hyperlink{g__raid_8h_a9dd59db9322af74b4b15021c3fc8f2f5}{G\_RAID\_SUBDISK\_S\_NEW}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00815}00815         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[sdn]-\/>\mbox{\hyperlink{structpromise__raid__conf_a6564feadfd2dc21b64f5994567650a99}{generation}} != meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a6564feadfd2dc21b64f5994567650a99}{generation}} ||}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00816}00816             (meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a1c93f6d43b87511ff33e18e0fc237ddc}{status}} \& \mbox{\hyperlink{md__promise_8c_a99ac63c32805a449e275affeceec5704}{PROMISE\_S\_MARKED}})) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00817}00817                 \textcolor{comment}{/* Stale disk or dirty volume (unclean shutdown). */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00818}00818                 \mbox{\hyperlink{g__raid_8c_a058db459d5349d2130fda3a02dd2af29}{g\_raid\_change\_subdisk\_state}}(\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00819}00819                     \mbox{\hyperlink{g__raid_8h_a41bff35bee21218d2aba7a261eb2e83c}{G\_RAID\_SUBDISK\_S\_STALE}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00820}00820         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00821}00821                 \textcolor{comment}{/* Up to date disk. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00822}00822                 \mbox{\hyperlink{g__raid_8c_a058db459d5349d2130fda3a02dd2af29}{g\_raid\_change\_subdisk\_state}}(\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00823}00823                     \mbox{\hyperlink{g__raid_8h_a498effa0ffa87b75f6c40381c6d4eb39}{G\_RAID\_SUBDISK\_S\_ACTIVE}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00824}00824         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00825}00825         \mbox{\hyperlink{g__raid_8c_ac49cc1991dccaeef0743e0bc4f64e0b5}{g\_raid\_event\_send}}(\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}, \mbox{\hyperlink{g__raid_8h_ae59b963d99efabe56d8173f3ad914a07}{G\_RAID\_SUBDISK\_E\_NEW}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00826}00826             \mbox{\hyperlink{g__raid_8h_ae6ac3f8d5dcaa73174e3e8bb9dd12f1c}{G\_RAID\_EVENT\_SUBDISK}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00827}00827 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00828}00828         \textcolor{keywordflow}{return} (resurrection);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00829}00829 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00830}00830 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00831}00831 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00832}\mbox{\hyperlink{md__promise_8c_a44c9bc67c1ca436f79c903575a666c9f}{00832}} \mbox{\hyperlink{md__promise_8c_a44c9bc67c1ca436f79c903575a666c9f}{g\_raid\_md\_promise\_refill}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__softc}{g\_raid\_softc}} *sc)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00833}00833 \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00834}00834         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__volume}{g\_raid\_volume}} *\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00835}00835         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__subdisk}{g\_raid\_subdisk}} *\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00836}00836         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__disk}{g\_raid\_disk}} *\mbox{\hyperlink{g__raid__md__if_8m_a9508e997a57ea259d6ecc0e563261993}{disk}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00837}00837         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__object}{g\_raid\_md\_object}} *md;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00838}00838         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__promise__perdisk}{g\_raid\_md\_promise\_perdisk}} *pd;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00839}00839         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__promise__pervolume}{g\_raid\_md\_promise\_pervolume}} *pv;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00840}00840         \textcolor{keywordtype}{int} update, updated, i, bad;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00841}00841 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00842}00842         md = sc-\/>\mbox{\hyperlink{structg__raid__softc_a5bf7421452e0a324fc4f8b954b57314b}{sc\_md}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00843}00843 restart:}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00844}00844         updated = 0;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00845}00845         TAILQ\_FOREACH(\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}, \&sc-\/>sc\_volumes, v\_next) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00846}00846                 pv = \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a1f432fb732072f5b196b570dd1d1e998}{v\_md\_data}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00847}00847                 \textcolor{keywordflow}{if} (!pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a87d7b4b6ae10863075c2b4ad6d95d93b}{pv\_started}} || \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a61fb0849390a6916c173c37a9653dada}{v\_stopping}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00848}00848                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00849}00849 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00850}00850                 \textcolor{comment}{/* Search for subdisk that needs replacement. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00851}00851                 bad = 0;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00852}00852                 \textcolor{keywordflow}{for} (i = 0; i < \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a21482a5ac78a397faf4e95eb1ebef431}{v\_disks\_count}}; i++) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00853}00853                         \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}} = \&\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a3c43185db4bd1c4818d95a415635854b}{v\_subdisks}}[i];}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00854}00854                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_acd19794916930f74ecad38ca7dd69f69}{sd\_state}} == \mbox{\hyperlink{g__raid_8h_af37111ba44cfc01a98d97bed8f60d964}{G\_RAID\_SUBDISK\_S\_NONE}} ||}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00855}00855                             \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_acd19794916930f74ecad38ca7dd69f69}{sd\_state}} == \mbox{\hyperlink{g__raid_8h_a2e56fb1cd5fdab097052e38c28a8c92f}{G\_RAID\_SUBDISK\_S\_FAILED}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00856}00856                                 bad = 1;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00857}00857                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00858}00858                 \textcolor{keywordflow}{if} (!bad)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00859}00859                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00860}00860 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00861}00861                 \mbox{\hyperlink{g__raid_8h_ace7234f8197b96e1b636f9376de8d7ea}{G\_RAID\_DEBUG1}}(1, sc, \textcolor{stringliteral}{"{}Volume \%s is not complete, "{}}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00862}00862                     \textcolor{stringliteral}{"{}trying to refill."{}}, \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_abdedb24b3ca3f4d3020f94e62d63fa05}{v\_name}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00863}00863 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00864}00864                 TAILQ\_FOREACH(\mbox{\hyperlink{structdisk}{disk}}, \&sc-\/>sc\_disks, d\_next) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00865}00865                         \textcolor{comment}{/* Skip failed. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00866}00866                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structdisk}{disk}}-\/>d\_state < \mbox{\hyperlink{g__raid_8h_a53208a3eca6d67917c6fdf6321292c99}{G\_RAID\_DISK\_S\_SPARE}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00867}00867                                 \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00868}00868                         \textcolor{comment}{/* Skip already used by this volume. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00869}00869                         \textcolor{keywordflow}{for} (i = 0; i < \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a21482a5ac78a397faf4e95eb1ebef431}{v\_disks\_count}}; i++) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00870}00870                                 \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}} = \&\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a3c43185db4bd1c4818d95a415635854b}{v\_subdisks}}[i];}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00871}00871                                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_a5570ab684f57213078d94750e63354e1}{sd\_disk}} == \mbox{\hyperlink{structdisk}{disk}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00872}00872                                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00873}00873                         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00874}00874                         \textcolor{keywordflow}{if} (i < vol-\/>v\_disks\_count)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00875}00875                                 \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00876}00876 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00877}00877                         \textcolor{comment}{/* Try to use disk if it has empty extents. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00878}00878                         pd = \mbox{\hyperlink{structdisk}{disk}}-\/>d\_md\_data;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00879}00879                         \textcolor{keywordflow}{if} (pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_af83a2a95e726587eddda9df693dc9fe3}{pd\_subdisks}} < \mbox{\hyperlink{md__promise_8c_a1071bebcee9243fc289d40361d4793a6}{PROMISE\_MAX\_SUBDISKS}}) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00880}00880                                 update =}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00881}00881                                     \mbox{\hyperlink{md__promise_8c_a1be257df9ee481a1aef9991dfd3bf676}{g\_raid\_md\_promise\_start\_disk}}(\mbox{\hyperlink{structdisk}{disk}}, -\/1, \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00882}00882                         \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00883}00883                                 update = 0;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00884}00884                         \textcolor{keywordflow}{if} (update) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00885}00885                                 updated = 1;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00886}00886                                 \mbox{\hyperlink{md__promise_8c_aa84eb5d0f9c789e4d981e01fbababb63}{g\_raid\_md\_write\_promise}}(md, \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}, NULL, \mbox{\hyperlink{structdisk}{disk}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00887}00887                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00888}00888                         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00889}00889                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00890}00890         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00891}00891         \textcolor{keywordflow}{if} (updated)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00892}00892                 \textcolor{keywordflow}{goto} restart;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00893}00893 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00894}00894 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00895}00895 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00896}\mbox{\hyperlink{md__promise_8c_aee62d33c03c9865094aff6647aa3af4f}{00896}} \mbox{\hyperlink{md__promise_8c_aee62d33c03c9865094aff6647aa3af4f}{g\_raid\_md\_promise\_start}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__volume}{g\_raid\_volume}} *\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00897}00897 \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00898}00898         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__softc}{g\_raid\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00899}00899         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__subdisk}{g\_raid\_subdisk}} *\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00900}00900         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__disk}{g\_raid\_disk}} *\mbox{\hyperlink{g__raid__md__if_8m_a9508e997a57ea259d6ecc0e563261993}{disk}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00901}00901         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__object}{g\_raid\_md\_object}} *md;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00902}00902         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__promise__perdisk}{g\_raid\_md\_promise\_perdisk}} *pd;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00903}00903         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__promise__pervolume}{g\_raid\_md\_promise\_pervolume}} *pv;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00904}00904         \textcolor{keyword}{struct }\mbox{\hyperlink{structpromise__raid__conf}{promise\_raid\_conf}} *meta;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00905}00905         u\_int i;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00906}00906 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00907}00907         sc = \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a5ddf3eff3aa40bdcbbfedb4d0458b332}{v\_softc}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00908}00908         md = sc-\/>\mbox{\hyperlink{structg__raid__softc_a5bf7421452e0a324fc4f8b954b57314b}{sc\_md}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00909}00909         pv = \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a1f432fb732072f5b196b570dd1d1e998}{v\_md\_data}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00910}00910         meta = pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a94097bae0d51bd8d9693a3bea313a5f6}{pv\_meta}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00911}00911 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00912}00912         \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ad17bb2da7eadd462f1f27551cb1da76f}{v\_raid\_level\_qualifier}} = \mbox{\hyperlink{g__raid_8h_a9c036957b2fb94761b5fd084e8f991c9}{G\_RAID\_VOLUME\_RLQ\_NONE}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00913}00913         \textcolor{keywordflow}{if} (meta-\/>\mbox{\hyperlink{structpromise__raid__conf_aa047dcf61e52bced397c3d1b06388d3a}{type}} == \mbox{\hyperlink{md__promise_8c_a91fac4d6c0b9f0871f07a481a0ee596c}{PROMISE\_T\_RAID0}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00914}00914                 \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} = \mbox{\hyperlink{g__raid_8h_a6a49f4ddd0b45eb4210ce72528786a32}{G\_RAID\_VOLUME\_RL\_RAID0}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00915}00915         \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (meta-\/>\mbox{\hyperlink{structpromise__raid__conf_aa047dcf61e52bced397c3d1b06388d3a}{type}} == \mbox{\hyperlink{md__promise_8c_a93bd586a834fc2937ea745d4facac00f}{PROMISE\_T\_RAID1}}) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00916}00916                 \textcolor{keywordflow}{if} (meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ac16f53d721267d1bea9a4209d0aaee57}{array\_width}} == 1)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00917}00917                         \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} = \mbox{\hyperlink{g__raid_8h_a270bdf6b61fc7d810795e08ebbe60931}{G\_RAID\_VOLUME\_RL\_RAID1}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00918}00918                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00919}00919                         \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} = \mbox{\hyperlink{g__raid_8h_ad0ef2cd50760a49759a6cbaf2afeb286}{G\_RAID\_VOLUME\_RL\_RAID1E}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00920}00920         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (meta-\/>\mbox{\hyperlink{structpromise__raid__conf_aa047dcf61e52bced397c3d1b06388d3a}{type}} == \mbox{\hyperlink{md__promise_8c_a80b741a47ab70d65b8c35a69bbefa717}{PROMISE\_T\_RAID3}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00921}00921                 \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} = \mbox{\hyperlink{g__raid_8h_ace76bc9798da8c567b9a9620a2172ee4}{G\_RAID\_VOLUME\_RL\_RAID3}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00922}00922         \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (meta-\/>\mbox{\hyperlink{structpromise__raid__conf_aa047dcf61e52bced397c3d1b06388d3a}{type}} == \mbox{\hyperlink{md__promise_8c_afb8464fdc81351fa1c9bc98846405951}{PROMISE\_T\_RAID5}}) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00923}00923                 \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} = \mbox{\hyperlink{g__raid_8h_af6db015b03ea390243f2df897eb1189d}{G\_RAID\_VOLUME\_RL\_RAID5}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00924}00924                 \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ad17bb2da7eadd462f1f27551cb1da76f}{v\_raid\_level\_qualifier}} = \mbox{\hyperlink{g__raid_8h_a85a42d827015531803abc6df07b15e89}{G\_RAID\_VOLUME\_RLQ\_R5LA}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00925}00925         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (meta-\/>\mbox{\hyperlink{structpromise__raid__conf_aa047dcf61e52bced397c3d1b06388d3a}{type}} == \mbox{\hyperlink{md__promise_8c_af4bc13398f46db47579bc5e3fef8c096}{PROMISE\_T\_SPAN}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00926}00926                 \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} = \mbox{\hyperlink{g__raid_8h_abc695e94a9e4eff0f657ec01d1f19607}{G\_RAID\_VOLUME\_RL\_CONCAT}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00927}00927         \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (meta-\/>\mbox{\hyperlink{structpromise__raid__conf_aa047dcf61e52bced397c3d1b06388d3a}{type}} == \mbox{\hyperlink{md__promise_8c_a0f7ef635ed5f29cfdb8d26f6dfae4323}{PROMISE\_T\_JBOD}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00928}00928                 \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} = \mbox{\hyperlink{g__raid_8h_acb418af006a1d84e0dd912c58cec6f57}{G\_RAID\_VOLUME\_RL\_SINGLE}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00929}00929         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00930}00930                 \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} = \mbox{\hyperlink{g__raid_8h_a44d5861b2b013283a9dbff0d3ae791e8}{G\_RAID\_VOLUME\_RL\_UNKNOWN}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00931}00931         \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_af0ca6a1c61e893f02a43ca29953c8e39}{v\_strip\_size}} = 512 << meta-\/>\mbox{\hyperlink{structpromise__raid__conf_af0b1f65f4e1f592470e2556a9c53416b}{stripe\_shift}}; \textcolor{comment}{//ZZZ}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00932}00932         \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a21482a5ac78a397faf4e95eb1ebef431}{v\_disks\_count}} = meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a4591d4915850a182c44952a2e0e164e6}{total\_disks}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00933}00933         \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ad81a0903c26424634b555fa29c0cd400}{v\_mediasize}} = (off\_t)meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ac2e961fbef27d74bb376bd7e49d85688}{total\_sectors}} * 512; \textcolor{comment}{//ZZZ}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00934}00934         if (meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a2fac25865626604d1a3333072473f489}{total\_sectors\_high}} < 256) \textcolor{comment}{/* If value looks sane. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00935}00935                 \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ad81a0903c26424634b555fa29c0cd400}{v\_mediasize}} +=}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00936}00936                     ((off\_t)meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a2fac25865626604d1a3333072473f489}{total\_sectors\_high}} << 32) * 512; \textcolor{comment}{//ZZZ}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00937}00937         \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_af7b9dcf6621dc8d66be12ba187d5f34b}{v\_sectorsize}} = 512 * meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a10de46f425232b9686c3834a7938e5e7}{sector\_size}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00938}00938         \textcolor{keywordflow}{for} (i = 0; i < \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a21482a5ac78a397faf4e95eb1ebef431}{v\_disks\_count}}; i++) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00939}00939                 \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}} = \&\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a3c43185db4bd1c4818d95a415635854b}{v\_subdisks}}[i];}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00940}00940                 \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_a9b4e12573b26ee18473a16408044819f}{sd\_offset}} = (((off\_t)meta-\/>\mbox{\hyperlink{structpromise__raid__conf_afd71e747e37a0dd24e784becfde7cb6b}{disk\_offset\_high}} << 32) +}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00941}00941                     meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a143a91a5acbd6f26144a9ffee198458d}{disk\_offset}}) * 512;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00942}00942                 \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_abc4da1103e29e3a8e2bbadb18fbccbf6}{sd\_size}} = (((off\_t)meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a108318e260bbf343dfb77ed6d8603652}{disk\_sectors\_high}} << 32) +}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00943}00943                     meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a24e4822147b219e5cdf41cb1557cd599}{disk\_sectors}}) * 512;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00944}00944         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00945}00945         \mbox{\hyperlink{g__raid_8c_a7e6ffb9d11de08e7eaa3e36d1028aa28}{g\_raid\_start\_volume}}(\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00946}00946 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00947}00947         \textcolor{comment}{/* Make all disks found till the moment take their places. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00948}00948         TAILQ\_FOREACH(\mbox{\hyperlink{structdisk}{disk}}, \&sc-\/>sc\_disks, d\_next) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00949}00949                 pd = \mbox{\hyperlink{structdisk}{disk}}-\/>d\_md\_data;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00950}00950                 \textcolor{keywordflow}{for} (i = 0; i < pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_af83a2a95e726587eddda9df693dc9fe3}{pd\_subdisks}}; i++) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00951}00951                         \textcolor{keywordflow}{if} (pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[i]-\/>volume\_id == meta-\/>volume\_id)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00952}00952                                 \mbox{\hyperlink{md__promise_8c_a1be257df9ee481a1aef9991dfd3bf676}{g\_raid\_md\_promise\_start\_disk}}(\mbox{\hyperlink{structdisk}{disk}}, i, \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00953}00953                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00954}00954         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00955}00955 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00956}00956         pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a87d7b4b6ae10863075c2b4ad6d95d93b}{pv\_started}} = 1;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00957}00957         callout\_stop(\&pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_ad8bc77acb4795088f1438c80f7c8f8db}{pv\_start\_co}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00958}00958         \mbox{\hyperlink{g__raid_8h_ace7234f8197b96e1b636f9376de8d7ea}{G\_RAID\_DEBUG1}}(0, sc, \textcolor{stringliteral}{"{}Volume started."{}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00959}00959         \mbox{\hyperlink{md__promise_8c_aa84eb5d0f9c789e4d981e01fbababb63}{g\_raid\_md\_write\_promise}}(md, \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}, NULL, NULL);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00960}00960 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00961}00961         \textcolor{comment}{/* Pickup any STALE/SPARE disks to refill array if needed. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00962}00962         \mbox{\hyperlink{md__promise_8c_a44c9bc67c1ca436f79c903575a666c9f}{g\_raid\_md\_promise\_refill}}(sc);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00963}00963 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00964}00964         \mbox{\hyperlink{g__raid_8c_ac49cc1991dccaeef0743e0bc4f64e0b5}{g\_raid\_event\_send}}(\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}, \mbox{\hyperlink{g__raid_8h_ab4cc6f1792faa0f90f83ebf0f7217a9b}{G\_RAID\_VOLUME\_E\_START}}, \mbox{\hyperlink{g__raid_8h_aa6f84af705b9b366dcb0e4aabd807667}{G\_RAID\_EVENT\_VOLUME}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00965}00965 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00966}00966 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00967}00967 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00968}\mbox{\hyperlink{md__promise_8c_ad46291bd73b6e20369e072094b4e0b69}{00968}} \mbox{\hyperlink{md__promise_8c_ad46291bd73b6e20369e072094b4e0b69}{g\_raid\_promise\_go}}(\textcolor{keywordtype}{void} *arg)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00969}00969 \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00970}00970         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__volume}{g\_raid\_volume}} *\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00971}00971         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__softc}{g\_raid\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00972}00972         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__promise__pervolume}{g\_raid\_md\_promise\_pervolume}} *pv;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00973}00973 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00974}00974         \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}} = arg;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00975}00975         pv = \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a1f432fb732072f5b196b570dd1d1e998}{v\_md\_data}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00976}00976         sc = \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a5ddf3eff3aa40bdcbbfedb4d0458b332}{v\_softc}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00977}00977         \textcolor{keywordflow}{if} (!pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a87d7b4b6ae10863075c2b4ad6d95d93b}{pv\_started}}) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00978}00978                 \mbox{\hyperlink{g__raid_8h_ace7234f8197b96e1b636f9376de8d7ea}{G\_RAID\_DEBUG1}}(0, sc, \textcolor{stringliteral}{"{}Force volume start due to timeout."{}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00979}00979                 \mbox{\hyperlink{g__raid_8c_ac49cc1991dccaeef0743e0bc4f64e0b5}{g\_raid\_event\_send}}(\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}, \mbox{\hyperlink{g__raid_8h_a3194bc51f05db36f7acdf2d0e6ff1c1f}{G\_RAID\_VOLUME\_E\_STARTMD}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00980}00980                     \mbox{\hyperlink{g__raid_8h_aa6f84af705b9b366dcb0e4aabd807667}{G\_RAID\_EVENT\_VOLUME}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00981}00981         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00982}00982 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00983}00983 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00984}00984 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00985}\mbox{\hyperlink{md__promise_8c_a691f8ee19483db4bce71ae2cb37a85f1}{00985}} \mbox{\hyperlink{md__promise_8c_a691f8ee19483db4bce71ae2cb37a85f1}{g\_raid\_md\_promise\_new\_disk}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__disk}{g\_raid\_disk}} *\mbox{\hyperlink{structdisk}{disk}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00986}00986 \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00987}00987         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__softc}{g\_raid\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00988}00988         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__object}{g\_raid\_md\_object}} *md;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00989}00989         \textcolor{keyword}{struct }\mbox{\hyperlink{structpromise__raid__conf}{promise\_raid\_conf}} *pdmeta;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00990}00990         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__promise__perdisk}{g\_raid\_md\_promise\_perdisk}} *pd;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00991}00991         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__promise__pervolume}{g\_raid\_md\_promise\_pervolume}} *pv;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00992}00992         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__volume}{g\_raid\_volume}} *\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00993}00993         \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00994}00994         \textcolor{keywordtype}{char} \mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}[33];}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00995}00995 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00996}00996         sc = \mbox{\hyperlink{structdisk}{disk}}-\/>d\_softc;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00997}00997         md = sc-\/>\mbox{\hyperlink{structg__raid__softc_a5bf7421452e0a324fc4f8b954b57314b}{sc\_md}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00998}00998         pd = (\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__promise__perdisk}{g\_raid\_md\_promise\_perdisk}} *)\mbox{\hyperlink{structdisk}{disk}}-\/>d\_md\_data;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l00999}00999 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01000}01000         if (pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_af83a2a95e726587eddda9df693dc9fe3}{pd\_subdisks}} == 0) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01001}01001                 \mbox{\hyperlink{g__raid_8c_a342da571518e21e0521b6416c838d00e}{g\_raid\_change\_disk\_state}}(\mbox{\hyperlink{structdisk}{disk}}, \mbox{\hyperlink{g__raid_8h_a53208a3eca6d67917c6fdf6321292c99}{G\_RAID\_DISK\_S\_SPARE}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01002}01002                 \mbox{\hyperlink{md__promise_8c_a44c9bc67c1ca436f79c903575a666c9f}{g\_raid\_md\_promise\_refill}}(sc);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01003}01003                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01004}01004         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01005}01005 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01006}01006         \textcolor{keywordflow}{for} (i = 0; i < pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_af83a2a95e726587eddda9df693dc9fe3}{pd\_subdisks}}; i++) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01007}01007                 pdmeta = pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[i];}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01008}01008 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01009}01009                 \textcolor{comment}{/* Look for volume with matching ID. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01010}01010                 \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}} = \mbox{\hyperlink{md__promise_8c_a7ec6b8e35a71a1982c3feb3e234661dd}{g\_raid\_md\_promise\_get\_volume}}(sc, pdmeta-\/>volume\_id);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01011}01011                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01012}01012                         \mbox{\hyperlink{md__promise_8c_ab1c86b805bb9e87a864967f50af774de}{promise\_meta\_get\_name}}(pdmeta, \mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01013}01013                         \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}} = \mbox{\hyperlink{g__raid_8c_a582a2f56fe635a9f1d2783b9342126ee}{g\_raid\_create\_volume}}(sc, \mbox{\hyperlink{g__part__if_8m_ac14417684334d01b4e1e807a19d92816}{buf}}, pdmeta-\/>\mbox{\hyperlink{structpromise__raid__conf_a0bf4b5c463116d88d2db8ce2fa64eaf8}{array\_number}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01014}01014                         pv = malloc(\textcolor{keyword}{sizeof}(*pv), M\_MD\_PROMISE, M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01015}01015                         pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a7529f3ff051c7927f2deaff5d206065a}{pv\_id}} = pdmeta-\/>volume\_id;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01016}01016                         \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a1f432fb732072f5b196b570dd1d1e998}{v\_md\_data}} = pv;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01017}01017                         callout\_init(\&pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_ad8bc77acb4795088f1438c80f7c8f8db}{pv\_start\_co}}, 1);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01018}01018                         callout\_reset(\&pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_ad8bc77acb4795088f1438c80f7c8f8db}{pv\_start\_co}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01019}01019                             \mbox{\hyperlink{g__raid_8c_afcfadaaafd5305ba6550313e2cac825b}{g\_raid\_start\_timeout}} * hz,}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01020}01020                             \mbox{\hyperlink{md__promise_8c_ad46291bd73b6e20369e072094b4e0b69}{g\_raid\_promise\_go}}, \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01021}01021                 \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01022}01022                         pv = \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a1f432fb732072f5b196b570dd1d1e998}{v\_md\_data}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01023}01023 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01024}01024                 \textcolor{comment}{/* If we haven't started yet -\/ check metadata freshness. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01025}01025                 \textcolor{keywordflow}{if} (pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a94097bae0d51bd8d9693a3bea313a5f6}{pv\_meta}} == NULL || !pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a87d7b4b6ae10863075c2b4ad6d95d93b}{pv\_started}}) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01026}01026                         \textcolor{keywordflow}{if} (pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a94097bae0d51bd8d9693a3bea313a5f6}{pv\_meta}} == NULL ||}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01027}01027                             ((int16\_t)(pdmeta-\/>\mbox{\hyperlink{structpromise__raid__conf_a6564feadfd2dc21b64f5994567650a99}{generation}} -\/ pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a5c1c2471fa8a2d05e30e622dbf1fea3b}{pv\_generation}})) > 0) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01028}01028                                 \mbox{\hyperlink{g__raid_8h_ace7234f8197b96e1b636f9376de8d7ea}{G\_RAID\_DEBUG1}}(1, sc, \textcolor{stringliteral}{"{}Newer disk"{}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01029}01029                                 \textcolor{keywordflow}{if} (pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a94097bae0d51bd8d9693a3bea313a5f6}{pv\_meta}} != NULL)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01030}01030                                         \mbox{\hyperlink{g__raid__md__if_8m_a4df9edb2717b3f7e4c3c903878577a54}{free}}(pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a94097bae0d51bd8d9693a3bea313a5f6}{pv\_meta}}, M\_MD\_PROMISE);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01031}01031                                 pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a94097bae0d51bd8d9693a3bea313a5f6}{pv\_meta}} = \mbox{\hyperlink{md__promise_8c_a0e997a4fd6d7be64d723864e1bc69aed}{promise\_meta\_copy}}(pdmeta);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01032}01032                                 pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a5c1c2471fa8a2d05e30e622dbf1fea3b}{pv\_generation}} = pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a94097bae0d51bd8d9693a3bea313a5f6}{pv\_meta}}-\/>\mbox{\hyperlink{structpromise__raid__conf_a6564feadfd2dc21b64f5994567650a99}{generation}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01033}01033                                 pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_aae232a339e68704c62ecbd34c74f0624}{pv\_disks\_present}} = 1;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01034}01034                         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (pdmeta-\/>\mbox{\hyperlink{structpromise__raid__conf_a6564feadfd2dc21b64f5994567650a99}{generation}} == pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a5c1c2471fa8a2d05e30e622dbf1fea3b}{pv\_generation}}) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01035}01035                                 pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_aae232a339e68704c62ecbd34c74f0624}{pv\_disks\_present}}++;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01036}01036                                 \mbox{\hyperlink{g__raid_8h_ace7234f8197b96e1b636f9376de8d7ea}{G\_RAID\_DEBUG1}}(1, sc, \textcolor{stringliteral}{"{}Matching disk (\%d of \%d up)"{}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01037}01037                                     pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_aae232a339e68704c62ecbd34c74f0624}{pv\_disks\_present}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01038}01038                                     pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a94097bae0d51bd8d9693a3bea313a5f6}{pv\_meta}}-\/>\mbox{\hyperlink{structpromise__raid__conf_a4591d4915850a182c44952a2e0e164e6}{total\_disks}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01039}01039                         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01040}01040                                 \mbox{\hyperlink{g__raid_8h_ace7234f8197b96e1b636f9376de8d7ea}{G\_RAID\_DEBUG1}}(1, sc, \textcolor{stringliteral}{"{}Older disk"{}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01041}01041                         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01042}01042                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01043}01043         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01044}01044 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01045}01045         \textcolor{keywordflow}{for} (i = 0; i < pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_af83a2a95e726587eddda9df693dc9fe3}{pd\_subdisks}}; i++) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01046}01046                 pdmeta = pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[i];}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01047}01047 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01048}01048                 \textcolor{comment}{/* Look for volume with matching ID. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01049}01049                 \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}} = \mbox{\hyperlink{md__promise_8c_a7ec6b8e35a71a1982c3feb3e234661dd}{g\_raid\_md\_promise\_get\_volume}}(sc, pdmeta-\/>volume\_id);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01050}01050                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}} == NULL)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01051}01051                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01052}01052                 pv = \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a1f432fb732072f5b196b570dd1d1e998}{v\_md\_data}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01053}01053 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01054}01054                 \textcolor{keywordflow}{if} (pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a87d7b4b6ae10863075c2b4ad6d95d93b}{pv\_started}}) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01055}01055                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{md__promise_8c_a1be257df9ee481a1aef9991dfd3bf676}{g\_raid\_md\_promise\_start\_disk}}(\mbox{\hyperlink{structdisk}{disk}}, i, \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}))}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01056}01056                                 \mbox{\hyperlink{md__promise_8c_aa84eb5d0f9c789e4d981e01fbababb63}{g\_raid\_md\_write\_promise}}(md, \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}, NULL, NULL);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01057}01057                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01058}01058                         \textcolor{comment}{/* If we collected all needed disks -\/ start array. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01059}01059                         \textcolor{keywordflow}{if} (pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_aae232a339e68704c62ecbd34c74f0624}{pv\_disks\_present}} == pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a94097bae0d51bd8d9693a3bea313a5f6}{pv\_meta}}-\/>\mbox{\hyperlink{structpromise__raid__conf_a4591d4915850a182c44952a2e0e164e6}{total\_disks}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01060}01060                                 \mbox{\hyperlink{md__promise_8c_aee62d33c03c9865094aff6647aa3af4f}{g\_raid\_md\_promise\_start}}(\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01061}01061                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01062}01062         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01063}01063 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01064}01064 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01065}01065 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01066}\mbox{\hyperlink{md__promise_8c_a8dab2de948398816553ebd07bd9765ed}{01066}} \mbox{\hyperlink{md__promise_8c_a17e455a67782328d7cce25522a1538cb}{g\_raid\_md\_create\_promise}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__md__object}{g\_raid\_md\_object}} *md, \textcolor{keyword}{struct} \mbox{\hyperlink{structg__class}{g\_class}} *\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01067}01067     \textcolor{keyword}{struct} \mbox{\hyperlink{structg__geom}{g\_geom}} **\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01068}01068 \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01069}01069         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__geom}{g\_geom}} *geom;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01070}01070         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__softc}{g\_raid\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01071}01071 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01072}01072         \textcolor{comment}{/* Search for existing node. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01073}01073         LIST\_FOREACH(geom, \&\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}-\/>geom, geom) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01074}01074                 sc = geom-\/>\mbox{\hyperlink{structg__geom_aa83c08c83459420f6cbcfe64c6099466}{softc}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01075}01075                 \textcolor{keywordflow}{if} (sc == NULL)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01076}01076                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01077}01077                 \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__raid__softc_a92d7a08f5e32fa07a7b8769b5b3ca4f4}{sc\_stopping}} != 0)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01078}01078                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01079}01079                 \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__raid__softc_a5bf7421452e0a324fc4f8b954b57314b}{sc\_md}}-\/>\mbox{\hyperlink{structg__raid__md__object_ab622ae7b27ee826f1117caaf7fc38f48}{mdo\_class}} != md-\/>\mbox{\hyperlink{structg__raid__md__object_ab622ae7b27ee826f1117caaf7fc38f48}{mdo\_class}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01080}01080                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01081}01081                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01082}01082         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01083}01083         \textcolor{keywordflow}{if} (geom != NULL) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01084}01084                 *\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}} = geom;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01085}01085                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{g__raid__md__if_8m_a462421bd5367102456b64943db520823}{G\_RAID\_MD\_TASTE\_EXISTING}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01086}01086         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01087}01087 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01088}01088         \textcolor{comment}{/* Create new one if not found. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01089}01089         sc = \mbox{\hyperlink{g__raid_8c_aee6d4bf64b6c670eda4a8033cb968ae7}{g\_raid\_create\_node}}(\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}, \textcolor{stringliteral}{"{}Promise"{}}, md);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01090}01090         \textcolor{keywordflow}{if} (sc == NULL)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01091}01091                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{g__raid__md__if_8m_ae3e40a1a8689841d6d6f54a441d53d43}{G\_RAID\_MD\_TASTE\_FAIL}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01092}01092         md-\/>\mbox{\hyperlink{structg__raid__md__object_a4acc92ca2582509c74947d83b258e31d}{mdo\_softc}} = sc;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01093}01093         *\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}} = sc-\/>\mbox{\hyperlink{structg__raid__softc_aaaffc18ac5f4ad54f823080cf1842943}{sc\_geom}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01094}01094         \textcolor{keywordflow}{return} (\mbox{\hyperlink{g__raid__md__if_8m_aa5340dcca98f524650a3aa3675073120}{G\_RAID\_MD\_TASTE\_NEW}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01095}01095 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01096}01096 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01097}01097 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01098}\mbox{\hyperlink{md__promise_8c_ac220d0eb7fffab787703d6376bf2ece5}{01098}} \mbox{\hyperlink{md__promise_8c_af0c5d4a1a757fc2e2f9eb804ff105c10}{g\_raid\_md\_taste\_promise}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__md__object}{g\_raid\_md\_object}} *md, \textcolor{keyword}{struct} \mbox{\hyperlink{structg__class}{g\_class}} *\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01099}01099                               \textcolor{keyword}{struct} \mbox{\hyperlink{structg__consumer}{g\_consumer}} *\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}, \textcolor{keyword}{struct} \mbox{\hyperlink{structg__geom}{g\_geom}} **\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01100}01100 \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01101}01101         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__consumer}{g\_consumer}} *rcp;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01102}01102         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__provider}{g\_provider}} *\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01103}01103         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__softc}{g\_raid\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01104}01104         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__disk}{g\_raid\_disk}} *\mbox{\hyperlink{g__raid__md__if_8m_a9508e997a57ea259d6ecc0e563261993}{disk}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01105}01105         \textcolor{keyword}{struct }\mbox{\hyperlink{structpromise__raid__conf}{promise\_raid\_conf}} *metaarr[4];}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01106}01106         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__promise__perdisk}{g\_raid\_md\_promise\_perdisk}} *pd;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01107}01107         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__geom}{g\_geom}} *geom;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01108}01108         \textcolor{keywordtype}{int} i, j, result, len, subdisks;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01109}01109         \textcolor{keywordtype}{char} \mbox{\hyperlink{g__part__if_8m_aff5d3acc33944ecb11914d04ef06bb54}{name}}[16];}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01110}01110         uint16\_t vendor;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01111}01111 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01112}01112         \mbox{\hyperlink{g__raid_8h_a4333fbd8d0899facf171aee7b60697f6}{G\_RAID\_DEBUG}}(1, \textcolor{stringliteral}{"{}Tasting Promise on \%s"{}}, \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01113}01113         \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}} = \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01114}01114 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01115}01115         \textcolor{comment}{/* Read metadata from device. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01116}01116         \mbox{\hyperlink{geom_8h_a4628d4de49ba84e7a6126cc30d23b83a}{g\_topology\_unlock}}();}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01117}01117         vendor = 0xffff;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01118}01118         len = \textcolor{keyword}{sizeof}(vendor);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01119}01119         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_afe5c92b8a2a9e4cdf1cab6daa96923c1}{geom}}-\/>\mbox{\hyperlink{structg__geom_a6e00f814c9e37ee129d5d456d0379576}{rank}} == 1)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01120}01120                 \mbox{\hyperlink{geom_8h_a63ec0c10c4635c215416171e7e804d17}{g\_io\_getattr}}(\textcolor{stringliteral}{"{}GEOM::hba\_vendor"{}}, \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}, \&len, \&vendor);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01121}01121         subdisks = \mbox{\hyperlink{md__promise_8c_a83d8a8fa64db01a2e4c75914e9e29013}{promise\_meta\_read}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}, metaarr);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01122}01122         \mbox{\hyperlink{geom_8h_a232419d2cfa06ff3f4ff7551041aed31}{g\_topology\_lock}}();}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01123}01123         \textcolor{keywordflow}{if} (subdisks == 0) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01124}01124                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid_8c_afffb01dfa563be86d3c73e5f264c75ce}{g\_raid\_aggressive\_spare}}) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01125}01125                         \textcolor{keywordflow}{if} (vendor == 0x105a || vendor == 0x1002) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01126}01126                                 \mbox{\hyperlink{g__raid_8h_a4333fbd8d0899facf171aee7b60697f6}{G\_RAID\_DEBUG}}(1,}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01127}01127                                     \textcolor{stringliteral}{"{}No Promise metadata, forcing spare."{}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01128}01128                                 \textcolor{keywordflow}{goto} search;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01129}01129                         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01130}01130                                 \mbox{\hyperlink{g__raid_8h_a4333fbd8d0899facf171aee7b60697f6}{G\_RAID\_DEBUG}}(1,}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01131}01131                                     \textcolor{stringliteral}{"{}Promise/ATI vendor mismatch "{}}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01132}01132                                     \textcolor{stringliteral}{"{}0x\%04x != 0x105a/0x1002"{}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01133}01133                                     vendor);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01134}01134                         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01135}01135                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01136}01136                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{g__raid__md__if_8m_ae3e40a1a8689841d6d6f54a441d53d43}{G\_RAID\_MD\_TASTE\_FAIL}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01137}01137         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01138}01138 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01139}01139         \textcolor{comment}{/* Metadata valid. Print it. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01140}01140         \textcolor{keywordflow}{for} (i = 0; i < subdisks; i++)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01141}01141                 \mbox{\hyperlink{md__promise_8c_adc9e23d231b12a99259b8ea7d2d79b24}{g\_raid\_md\_promise\_print}}(metaarr[i]);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01142}01142 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01143}01143         \textcolor{comment}{/* Purge meaningless (empty/spare) records. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01144}01144         \textcolor{keywordflow}{for} (i = 0; i < subdisks; ) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01145}01145                 \textcolor{keywordflow}{if} (metaarr[i]-\/>\mbox{\hyperlink{structdisk}{disk}}.flags \& \mbox{\hyperlink{md__promise_8c_af4d7a54dec02bc72a70beba68a64b22a}{PROMISE\_F\_ASSIGNED}}) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01146}01146                         i++;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01147}01147                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01148}01148                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01149}01149                 \mbox{\hyperlink{g__raid__md__if_8m_a4df9edb2717b3f7e4c3c903878577a54}{free}}(metaarr[i], M\_MD\_PROMISE);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01150}01150                 \textcolor{keywordflow}{for} (j = i; j < subdisks -\/ 1; j++)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01151}01151                         metaarr[i] = metaarr[j + 1];}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01152}01152                 metaarr[subdisks -\/ 1] = NULL;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01153}01153                 subdisks-\/-\/;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01154}01154         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01155}01155 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01156}01156 search:}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01157}01157         \textcolor{comment}{/* Search for matching node. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01158}01158         sc = NULL;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01159}01159         LIST\_FOREACH(geom, \&\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}-\/>geom, geom) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01160}01160                 sc = geom-\/>\mbox{\hyperlink{structg__geom_aa83c08c83459420f6cbcfe64c6099466}{softc}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01161}01161                 \textcolor{keywordflow}{if} (sc == NULL)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01162}01162                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01163}01163                 \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__raid__softc_a92d7a08f5e32fa07a7b8769b5b3ca4f4}{sc\_stopping}} != 0)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01164}01164                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01165}01165                 \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__raid__softc_a5bf7421452e0a324fc4f8b954b57314b}{sc\_md}}-\/>\mbox{\hyperlink{structg__raid__md__object_ab622ae7b27ee826f1117caaf7fc38f48}{mdo\_class}} != md-\/>\mbox{\hyperlink{structg__raid__md__object_ab622ae7b27ee826f1117caaf7fc38f48}{mdo\_class}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01166}01166                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01167}01167                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01168}01168         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01169}01169 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01170}01170         \textcolor{comment}{/* Found matching node. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01171}01171         \textcolor{keywordflow}{if} (geom != NULL) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01172}01172                 \mbox{\hyperlink{g__raid_8h_a4333fbd8d0899facf171aee7b60697f6}{G\_RAID\_DEBUG}}(1, \textcolor{stringliteral}{"{}Found matching array \%s"{}}, sc-\/>sc\_name);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01173}01173                 result = \mbox{\hyperlink{g__raid__md__if_8m_a462421bd5367102456b64943db520823}{G\_RAID\_MD\_TASTE\_EXISTING}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01174}01174 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01175}01175         \} \textcolor{keywordflow}{else} \{ \textcolor{comment}{/* Not found matching node -\/-\/ create one. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01176}01176                 result = \mbox{\hyperlink{g__raid__md__if_8m_aa5340dcca98f524650a3aa3675073120}{G\_RAID\_MD\_TASTE\_NEW}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01177}01177                 snprintf(\mbox{\hyperlink{g__part__if_8m_aff5d3acc33944ecb11914d04ef06bb54}{name}}, \textcolor{keyword}{sizeof}(\mbox{\hyperlink{g__part__if_8m_aff5d3acc33944ecb11914d04ef06bb54}{name}}), \textcolor{stringliteral}{"{}Promise"{}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01178}01178                 sc = \mbox{\hyperlink{g__raid_8c_aee6d4bf64b6c670eda4a8033cb968ae7}{g\_raid\_create\_node}}(\mbox{\hyperlink{g__raid__md__if_8m_a4f7502795edfd2493d3d223d0df33e1d}{mp}}, \mbox{\hyperlink{g__part__if_8m_aff5d3acc33944ecb11914d04ef06bb54}{name}}, md);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01179}01179                 md-\/>\mbox{\hyperlink{structg__raid__md__object_a4acc92ca2582509c74947d83b258e31d}{mdo\_softc}} = sc;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01180}01180                 geom = sc-\/>\mbox{\hyperlink{structg__raid__softc_aaaffc18ac5f4ad54f823080cf1842943}{sc\_geom}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01181}01181         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01182}01182 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01183}01183         \textcolor{comment}{/* There is no return after this point, so we close passed consumer. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01184}01184         \mbox{\hyperlink{geom_8h_a27b7c72cc3bc5a4d07ce5976e1aa1b58}{g\_access}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}, -\/1, 0, 0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01185}01185 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01186}01186         rcp = \mbox{\hyperlink{geom_8h_aef9ca3f0eecc1b245c3c9cd0bac1cdc4}{g\_new\_consumer}}(geom);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01187}01187         rcp-\/>\mbox{\hyperlink{structg__consumer_acf792357913c0445233b71f8259764d9}{flags}} |= \mbox{\hyperlink{geom_8h_a2184f2512ddb7a67ddbb71409cdd953f}{G\_CF\_DIRECT\_RECEIVE}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01188}01188         \mbox{\hyperlink{geom_8h_a7f6ee69db47bae6ff5284f6a9cfceb91}{g\_attach}}(rcp, \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01189}01189         \textcolor{keywordflow}{if} (\mbox{\hyperlink{geom_8h_a27b7c72cc3bc5a4d07ce5976e1aa1b58}{g\_access}}(rcp, 1, 1, 1) != 0)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01190}01190                 ; \textcolor{comment}{//goto fail1;}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01191}01191 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01192}01192         \mbox{\hyperlink{geom_8h_a4628d4de49ba84e7a6126cc30d23b83a}{g\_topology\_unlock}}();}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01193}01193         sx\_xlock(\&sc-\/>\mbox{\hyperlink{structg__raid__softc_a6242ad65da243c1107889ace908799fd}{sc\_lock}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01194}01194 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01195}01195         pd = malloc(\textcolor{keyword}{sizeof}(*pd), M\_MD\_PROMISE, M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01196}01196         pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_af83a2a95e726587eddda9df693dc9fe3}{pd\_subdisks}} = subdisks;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01197}01197         \textcolor{keywordflow}{for} (i = 0; i < subdisks; i++)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01198}01198                 pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[i] = metaarr[i];}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01199}01199         \mbox{\hyperlink{structdisk}{disk}} = \mbox{\hyperlink{g__raid_8c_a7d896eb1612c17408eedbdda2032e897}{g\_raid\_create\_disk}}(sc);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01200}01200         \mbox{\hyperlink{structdisk}{disk}}-\/>d\_md\_data = (\textcolor{keywordtype}{void} *)pd;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01201}01201         \mbox{\hyperlink{structdisk}{disk}}-\/>d\_consumer = rcp;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01202}01202         rcp-\/>\mbox{\hyperlink{structg__consumer_a11273c1281d0cffbc3383eb4e49e7010}{private}} = \mbox{\hyperlink{g__raid__md__if_8m_a9508e997a57ea259d6ecc0e563261993}{disk}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01203}01203 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01204}01204         \mbox{\hyperlink{g__raid_8c_afbb51abcd221460c50c23ecc69be3114}{g\_raid\_get\_disk\_info}}(\mbox{\hyperlink{structdisk}{disk}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01205}01205 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01206}01206         \mbox{\hyperlink{md__promise_8c_a691f8ee19483db4bce71ae2cb37a85f1}{g\_raid\_md\_promise\_new\_disk}}(\mbox{\hyperlink{structdisk}{disk}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01207}01207 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01208}01208         sx\_xunlock(\&sc-\/>\mbox{\hyperlink{structg__raid__softc_a6242ad65da243c1107889ace908799fd}{sc\_lock}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01209}01209         \mbox{\hyperlink{geom_8h_a232419d2cfa06ff3f4ff7551041aed31}{g\_topology\_lock}}();}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01210}01210         *\mbox{\hyperlink{g__part__if_8m_abdc908a08b24cd2e589de2f44e40eeb9}{gp}} = geom;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01211}01211         \textcolor{keywordflow}{return} (result);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01212}01212 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01213}01213 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01214}01214 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01215}\mbox{\hyperlink{md__promise_8c_a76255366beebc70cf0b84483d8e321a9}{01215}} \mbox{\hyperlink{md__promise_8c_a297a1874012686e4504431289c642268}{g\_raid\_md\_event\_promise}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__md__object}{g\_raid\_md\_object}} *md,}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01216}01216     \textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__disk}{g\_raid\_disk}} *\mbox{\hyperlink{structdisk}{disk}}, u\_int \mbox{\hyperlink{g__raid__md__if_8m_a683a43faabf5ffc974caacd425b678d0}{event}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01217}01217 \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01218}01218         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__softc}{g\_raid\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01219}01219 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01220}01220         sc = md-\/>\mbox{\hyperlink{structg__raid__md__object_a4acc92ca2582509c74947d83b258e31d}{mdo\_softc}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01221}01221         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structdisk}{disk}} == NULL)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01222}01222                 \textcolor{keywordflow}{return} (-\/1);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01223}01223         \textcolor{keywordflow}{switch} (\mbox{\hyperlink{g__raid__md__if_8m_a683a43faabf5ffc974caacd425b678d0}{event}}) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01224}01224         \textcolor{keywordflow}{case} \mbox{\hyperlink{g__raid_8h_aa6e0d41a9b7f63b694bd95805efd6137}{G\_RAID\_DISK\_E\_DISCONNECTED}}:}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01225}01225                 \textcolor{comment}{/* Delete disk. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01226}01226                 \mbox{\hyperlink{g__raid_8c_a342da571518e21e0521b6416c838d00e}{g\_raid\_change\_disk\_state}}(\mbox{\hyperlink{structdisk}{disk}}, \mbox{\hyperlink{g__raid_8h_ad090f72fa79be3f1a59687ba60f85510}{G\_RAID\_DISK\_S\_NONE}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01227}01227                 \mbox{\hyperlink{g__raid_8c_ac1e32d950d9354f1dca5d2ca34244adc}{g\_raid\_destroy\_disk}}(\mbox{\hyperlink{structdisk}{disk}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01228}01228                 \mbox{\hyperlink{md__promise_8c_a07e21cd261f1a1ee4981de958094c073}{g\_raid\_md\_promise\_purge\_volumes}}(sc);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01229}01229 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01230}01230                 \textcolor{comment}{/* Write updated metadata to all disks. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01231}01231                 \mbox{\hyperlink{md__promise_8c_aa84eb5d0f9c789e4d981e01fbababb63}{g\_raid\_md\_write\_promise}}(md, NULL, NULL, NULL);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01232}01232 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01233}01233                 \textcolor{comment}{/* Check if anything left. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01234}01234                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid_8c_ad1004201fc232c60faacd7bd3f3b604f}{g\_raid\_ndisks}}(sc, -\/1) == 0)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01235}01235                         \mbox{\hyperlink{g__raid_8c_a99807e6db37e78d1738e46dfd48b7b5c}{g\_raid\_destroy\_node}}(sc, 0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01236}01236                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01237}01237                         \mbox{\hyperlink{md__promise_8c_a44c9bc67c1ca436f79c903575a666c9f}{g\_raid\_md\_promise\_refill}}(sc);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01238}01238                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01239}01239         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01240}01240         \textcolor{keywordflow}{return} (-\/2);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01241}01241 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01242}01242 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01243}01243 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01244}\mbox{\hyperlink{md__promise_8c_ae435f408340dbdd6d677af2e25635e53}{01244}} \mbox{\hyperlink{md__promise_8c_aece57ece2029e92483664415f94eb9b5}{g\_raid\_md\_volume\_event\_promise}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__md__object}{g\_raid\_md\_object}} *md,}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01245}01245     \textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__volume}{g\_raid\_volume}} *\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}, u\_int \mbox{\hyperlink{g__raid__md__if_8m_a683a43faabf5ffc974caacd425b678d0}{event}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01246}01246 \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01247}01247         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__promise__pervolume}{g\_raid\_md\_promise\_pervolume}} *pv;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01248}01248 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01249}01249         pv = (\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__promise__pervolume}{g\_raid\_md\_promise\_pervolume}} *)\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a1f432fb732072f5b196b570dd1d1e998}{v\_md\_data}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01250}01250         switch (\mbox{\hyperlink{g__raid__md__if_8m_a683a43faabf5ffc974caacd425b678d0}{event}}) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01251}01251         \textcolor{keywordflow}{case} \mbox{\hyperlink{g__raid_8h_a3194bc51f05db36f7acdf2d0e6ff1c1f}{G\_RAID\_VOLUME\_E\_STARTMD}}:}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01252}01252                 \textcolor{keywordflow}{if} (!pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a87d7b4b6ae10863075c2b4ad6d95d93b}{pv\_started}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01253}01253                         \mbox{\hyperlink{md__promise_8c_aee62d33c03c9865094aff6647aa3af4f}{g\_raid\_md\_promise\_start}}(\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01254}01254                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01255}01255         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01256}01256         \textcolor{keywordflow}{return} (-\/2);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01257}01257 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01258}01258 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01259}01259 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01260}\mbox{\hyperlink{md__promise_8c_acdf9cb507db4001aef8b0f0d50835e09}{01260}} \mbox{\hyperlink{md__promise_8c_a9010499762f52acd716141d483b9c2b8}{g\_raid\_md\_ctl\_promise}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__md__object}{g\_raid\_md\_object}} *md,}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01261}01261     \textcolor{keyword}{struct} \mbox{\hyperlink{structgctl__req}{gctl\_req}} *\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01262}01262 \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01263}01263         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__softc}{g\_raid\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01264}01264         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__volume}{g\_raid\_volume}} *\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}, *vol1;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01265}01265         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__subdisk}{g\_raid\_subdisk}} *\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01266}01266         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__disk}{g\_raid\_disk}} *\mbox{\hyperlink{g__raid__md__if_8m_a9508e997a57ea259d6ecc0e563261993}{disk}}, *disks[\mbox{\hyperlink{md__promise_8c_a6043ecc0cea629458c18b11a0f79d913}{PROMISE\_MAX\_DISKS}}];}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01267}01267         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__promise__perdisk}{g\_raid\_md\_promise\_perdisk}} *pd;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01268}01268         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__promise__pervolume}{g\_raid\_md\_promise\_pervolume}} *pv;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01269}01269         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__consumer}{g\_consumer}} *\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01270}01270         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__provider}{g\_provider}} *\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01271}01271         \textcolor{keywordtype}{char} arg[16];}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01272}01272         \textcolor{keyword}{const} \textcolor{keywordtype}{char} *nodename, *verb, *volname, *levelname, *diskname;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01273}01273         \textcolor{keywordtype}{char} *tmp;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01274}01274         \textcolor{keywordtype}{int} *nargs, *force;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01275}01275         off\_t esize, offs[\mbox{\hyperlink{md__promise_8c_a6043ecc0cea629458c18b11a0f79d913}{PROMISE\_MAX\_DISKS}}], size, \mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}}, strip;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01276}01276         intmax\_t *sizearg, *striparg;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01277}01277         \textcolor{keywordtype}{int} numdisks, i, len, level, qual;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01278}01278         \textcolor{keywordtype}{int} \mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01279}01279 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01280}01280         sc = md-\/>\mbox{\hyperlink{structg__raid__md__object_a4acc92ca2582509c74947d83b258e31d}{mdo\_softc}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01281}01281         verb = \mbox{\hyperlink{geom_8h_a3e3d6786258b3336d55a96607f9b8eb8}{gctl\_get\_param}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}verb"{}}, NULL);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01282}01282         nargs = \mbox{\hyperlink{geom_8h_ab762d12640f528d8f1f60eee92bf5f3b}{gctl\_get\_paraml}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}nargs"{}}, \textcolor{keyword}{sizeof}(*nargs));}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01283}01283         \mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}} = 0;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01284}01284         \textcolor{keywordflow}{if} (strcmp(verb, \textcolor{stringliteral}{"{}label"{}}) == 0) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01285}01285                 \textcolor{keywordflow}{if} (*nargs < 4) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01286}01286                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Invalid number of arguments."{}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01287}01287                         \textcolor{keywordflow}{return} (-\/1);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01288}01288                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01289}01289                 volname = \mbox{\hyperlink{geom_8h_ada33526012aac8ee446617bb3749a07c}{gctl\_get\_asciiparam}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}arg1"{}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01290}01290                 \textcolor{keywordflow}{if} (volname == NULL) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01291}01291                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}No volume name."{}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01292}01292                         \textcolor{keywordflow}{return} (-\/2);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01293}01293                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01294}01294                 levelname = \mbox{\hyperlink{geom_8h_ada33526012aac8ee446617bb3749a07c}{gctl\_get\_asciiparam}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}arg2"{}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01295}01295                 \textcolor{keywordflow}{if} (levelname == NULL) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01296}01296                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}No RAID level."{}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01297}01297                         \textcolor{keywordflow}{return} (-\/3);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01298}01298                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01299}01299                 \textcolor{keywordflow}{if} (strcasecmp(levelname, \textcolor{stringliteral}{"{}RAID5"{}}) == 0)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01300}01300                         levelname = \textcolor{stringliteral}{"{}RAID5-\/LA"{}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01301}01301                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid_8c_a54f71ba156f1c4128a0c379435d79f3a}{g\_raid\_volume\_str2level}}(levelname, \&level, \&qual)) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01302}01302                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Unknown RAID level '\%s'."{}}, levelname);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01303}01303                         \textcolor{keywordflow}{return} (-\/4);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01304}01304                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01305}01305                 numdisks = *nargs -\/ 3;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01306}01306                 force = \mbox{\hyperlink{geom_8h_ab762d12640f528d8f1f60eee92bf5f3b}{gctl\_get\_paraml}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}force"{}}, \textcolor{keyword}{sizeof}(*force));}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01307}01307                 \textcolor{keywordflow}{if} (!\mbox{\hyperlink{md__promise_8c_a70b54911e536ffa263b866d57b1563ed}{g\_raid\_md\_promise\_supported}}(level, qual, numdisks,}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01308}01308                     force ? *force : 0)) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01309}01309                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Unsupported RAID level "{}}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01310}01310                             \textcolor{stringliteral}{"{}(0x\%02x/0x\%02x), or number of disks (\%d)."{}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01311}01311                             level, qual, numdisks);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01312}01312                         \textcolor{keywordflow}{return} (-\/5);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01313}01313                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01314}01314 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01315}01315                 \textcolor{comment}{/* Search for disks, connect them and probe. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01316}01316                 size = INT64\_MAX;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01317}01317                 \mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}} = 0;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01318}01318                 bzero(disks, \textcolor{keyword}{sizeof}(disks));}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01319}01319                 bzero(offs, \textcolor{keyword}{sizeof}(offs));}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01320}01320                 \textcolor{keywordflow}{for} (i = 0; i < numdisks; i++) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01321}01321                         snprintf(arg, \textcolor{keyword}{sizeof}(arg), \textcolor{stringliteral}{"{}arg\%d"{}}, i + 3);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01322}01322                         diskname = \mbox{\hyperlink{geom_8h_ada33526012aac8ee446617bb3749a07c}{gctl\_get\_asciiparam}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, arg);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01323}01323                         \textcolor{keywordflow}{if} (diskname == NULL) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01324}01324                                 \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}No disk name (\%s)."{}}, arg);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01325}01325                                 \mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}} = -\/6;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01326}01326                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01327}01327                         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01328}01328                         \textcolor{keywordflow}{if} (strcmp(diskname, \textcolor{stringliteral}{"{}NONE"{}}) == 0)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01329}01329                                 \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01330}01330 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01331}01331                         TAILQ\_FOREACH(\mbox{\hyperlink{structdisk}{disk}}, \&sc-\/>sc\_disks, d\_next) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01332}01332                                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{structdisk}{disk}}-\/>d\_consumer != NULL \&\& }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01333}01333                                     \mbox{\hyperlink{structdisk}{disk}}-\/>d\_consumer-\/>provider != NULL \&\&}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01334}01334                                     strcmp(\mbox{\hyperlink{structdisk}{disk}}-\/>d\_consumer-\/>provider-\/>name,}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01335}01335                                      diskname) == 0)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01336}01336                                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01337}01337                         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01338}01338                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structdisk}{disk}} != NULL) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01339}01339                                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{structdisk}{disk}}-\/>d\_state != \mbox{\hyperlink{g__raid_8h_aaf46a21394a57a2fcac34b1b7b52701c}{G\_RAID\_DISK\_S\_ACTIVE}}) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01340}01340                                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Disk '\%s' is in a "{}}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01341}01341                                             \textcolor{stringliteral}{"{}wrong state (\%s)."{}}, diskname,}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01342}01342                                             \mbox{\hyperlink{g__raid_8c_acf83d9bb3bc6187dbd0df4d43d14670b}{g\_raid\_disk\_state2str}}(\mbox{\hyperlink{structdisk}{disk}}-\/>d\_state));}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01343}01343                                         \mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}} = -\/7;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01344}01344                                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01345}01345                                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01346}01346                                 pd = \mbox{\hyperlink{structdisk}{disk}}-\/>d\_md\_data;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01347}01347                                 \textcolor{keywordflow}{if} (pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_af83a2a95e726587eddda9df693dc9fe3}{pd\_subdisks}} >= \mbox{\hyperlink{md__promise_8c_a1071bebcee9243fc289d40361d4793a6}{PROMISE\_MAX\_SUBDISKS}}) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01348}01348                                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Disk '\%s' already "{}}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01349}01349                                             \textcolor{stringliteral}{"{}used by \%d volumes."{}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01350}01350                                             diskname, pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_af83a2a95e726587eddda9df693dc9fe3}{pd\_subdisks}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01351}01351                                         \mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}} = -\/7;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01352}01352                                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01353}01353                                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01354}01354                                 \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}} = \mbox{\hyperlink{structdisk}{disk}}-\/>d\_consumer-\/>provider;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01355}01355                                 disks[i] = \mbox{\hyperlink{g__raid__md__if_8m_a9508e997a57ea259d6ecc0e563261993}{disk}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01356}01356                                 \mbox{\hyperlink{md__promise_8c_aecb311da502fea619e83c249c483e0c2}{promise\_meta\_unused\_range}}(pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01357}01357                                     pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_af83a2a95e726587eddda9df693dc9fe3}{pd\_subdisks}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01358}01358                                     \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a8f47c464c78aa91fa4ca5143ed3cd15e}{mediasize}} / \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01359}01359                                     \&offs[i], \&esize);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01360}01360                                 size = MIN(size, (off\_t)esize * \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01361}01361                                 \mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}} = MAX(\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}}, \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01362}01362                                 \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01363}01363                         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01364}01364 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01365}01365                         \mbox{\hyperlink{geom_8h_a232419d2cfa06ff3f4ff7551041aed31}{g\_topology\_lock}}();}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01366}01366                         \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}} = \mbox{\hyperlink{g__raid_8c_acc4d5f993651e14eb607d9efe39061c8}{g\_raid\_open\_consumer}}(sc, diskname);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01367}01367                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01368}01368                                 \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Can't open disk '\%s'."{}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01369}01369                                     diskname);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01370}01370                                 \mbox{\hyperlink{geom_8h_a4628d4de49ba84e7a6126cc30d23b83a}{g\_topology\_unlock}}();}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01371}01371                                 \mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}} = -\/8;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01372}01372                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01373}01373                         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01374}01374                         \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}} = \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01375}01375                         pd = malloc(\textcolor{keyword}{sizeof}(*pd), M\_MD\_PROMISE, M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01376}01376                         \mbox{\hyperlink{structdisk}{disk}} = \mbox{\hyperlink{g__raid_8c_a7d896eb1612c17408eedbdda2032e897}{g\_raid\_create\_disk}}(sc);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01377}01377                         \mbox{\hyperlink{structdisk}{disk}}-\/>d\_md\_data = (\textcolor{keywordtype}{void} *)pd;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01378}01378                         \mbox{\hyperlink{structdisk}{disk}}-\/>d\_consumer = \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01379}01379                         disks[i] = \mbox{\hyperlink{g__raid__md__if_8m_a9508e997a57ea259d6ecc0e563261993}{disk}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01380}01380                         \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a11273c1281d0cffbc3383eb4e49e7010}{private}} = \mbox{\hyperlink{g__raid__md__if_8m_a9508e997a57ea259d6ecc0e563261993}{disk}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01381}01381                         \mbox{\hyperlink{geom_8h_a4628d4de49ba84e7a6126cc30d23b83a}{g\_topology\_unlock}}();}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01382}01382 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01383}01383                         \mbox{\hyperlink{g__raid_8c_afbb51abcd221460c50c23ecc69be3114}{g\_raid\_get\_disk\_info}}(\mbox{\hyperlink{structdisk}{disk}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01384}01384 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01385}01385                         \textcolor{comment}{/* Reserve some space for metadata. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01386}01386                         size = MIN(size, \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a8f47c464c78aa91fa4ca5143ed3cd15e}{mediasize}} -\/ 131072llu * \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01387}01387                         \mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}} = MAX(\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}}, \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01388}01388                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01389}01389                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}} != 0) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01390}01390                         \textcolor{keywordflow}{for} (i = 0; i < numdisks; i++) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01391}01391                                 \textcolor{keywordflow}{if} (disks[i] != NULL \&\&}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01392}01392                                     disks[i]-\/>d\_state == \mbox{\hyperlink{g__raid_8h_ad090f72fa79be3f1a59687ba60f85510}{G\_RAID\_DISK\_S\_NONE}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01393}01393                                         \mbox{\hyperlink{g__raid_8c_ac1e32d950d9354f1dca5d2ca34244adc}{g\_raid\_destroy\_disk}}(disks[i]);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01394}01394                         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01395}01395                         \textcolor{keywordflow}{return} (\mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01396}01396                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01397}01397 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01398}01398                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}} <= 0) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01399}01399                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Can't get sector size."{}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01400}01400                         \textcolor{keywordflow}{return} (-\/8);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01401}01401                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01402}01402 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01403}01403                 \textcolor{comment}{/* Handle size argument. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01404}01404                 len = \textcolor{keyword}{sizeof}(*sizearg);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01405}01405                 sizearg = \mbox{\hyperlink{geom_8h_a3e3d6786258b3336d55a96607f9b8eb8}{gctl\_get\_param}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}size"{}}, \&len);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01406}01406                 \textcolor{keywordflow}{if} (sizearg != NULL \&\& len == \textcolor{keyword}{sizeof}(*sizearg) \&\&}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01407}01407                     *sizearg > 0) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01408}01408                         \textcolor{keywordflow}{if} (*sizearg > size) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01409}01409                                 \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Size too big \%lld > \%lld."{}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01410}01410                                     (\textcolor{keywordtype}{long} \textcolor{keywordtype}{long})*sizearg, (\textcolor{keywordtype}{long} \textcolor{keywordtype}{long})size);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01411}01411                                 \textcolor{keywordflow}{return} (-\/9);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01412}01412                         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01413}01413                         size = *sizearg;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01414}01414                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01415}01415 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01416}01416                 \textcolor{comment}{/* Handle strip argument. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01417}01417                 strip = 131072;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01418}01418                 len = \textcolor{keyword}{sizeof}(*striparg);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01419}01419                 striparg = \mbox{\hyperlink{geom_8h_a3e3d6786258b3336d55a96607f9b8eb8}{gctl\_get\_param}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}strip"{}}, \&len);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01420}01420                 \textcolor{keywordflow}{if} (striparg != NULL \&\& len == \textcolor{keyword}{sizeof}(*striparg) \&\&}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01421}01421                     *striparg > 0) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01422}01422                         \textcolor{keywordflow}{if} (*striparg < \mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}}) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01423}01423                                 \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Strip size too small."{}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01424}01424                                 \textcolor{keywordflow}{return} (-\/10);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01425}01425                         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01426}01426                         \textcolor{keywordflow}{if} (*striparg \% \mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}} != 0) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01427}01427                                 \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Incorrect strip size."{}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01428}01428                                 \textcolor{keywordflow}{return} (-\/11);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01429}01429                         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01430}01430                         strip = *striparg;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01431}01431                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01432}01432 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01433}01433                 \textcolor{comment}{/* Round size down to strip or sector. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01434}01434                 \textcolor{keywordflow}{if} (level == \mbox{\hyperlink{g__raid_8h_a270bdf6b61fc7d810795e08ebbe60931}{G\_RAID\_VOLUME\_RL\_RAID1}} ||}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01435}01435                     level == \mbox{\hyperlink{g__raid_8h_acb418af006a1d84e0dd912c58cec6f57}{G\_RAID\_VOLUME\_RL\_SINGLE}} ||}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01436}01436                     level == \mbox{\hyperlink{g__raid_8h_abc695e94a9e4eff0f657ec01d1f19607}{G\_RAID\_VOLUME\_RL\_CONCAT}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01437}01437                         size -\/= (size \% \mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01438}01438                 \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (level == \mbox{\hyperlink{g__raid_8h_ad0ef2cd50760a49759a6cbaf2afeb286}{G\_RAID\_VOLUME\_RL\_RAID1E}} \&\&}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01439}01439                     (numdisks \& 1) != 0)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01440}01440                         size -\/= (size \% (2 * strip));}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01441}01441                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01442}01442                         size -\/= (size \% strip);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01443}01443                 \textcolor{keywordflow}{if} (size <= 0) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01444}01444                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Size too small."{}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01445}01445                         \textcolor{keywordflow}{return} (-\/13);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01446}01446                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01447}01447 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01448}01448                 \textcolor{comment}{/* We have all we need, create things: volume, ... */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01449}01449                 pv = malloc(\textcolor{keyword}{sizeof}(*pv), M\_MD\_PROMISE, M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01450}01450                 arc4rand(\&pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a7529f3ff051c7927f2deaff5d206065a}{pv\_id}}, \textcolor{keyword}{sizeof}(pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a7529f3ff051c7927f2deaff5d206065a}{pv\_id}}), 0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01451}01451                 pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a5c1c2471fa8a2d05e30e622dbf1fea3b}{pv\_generation}} = 0;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01452}01452                 pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a87d7b4b6ae10863075c2b4ad6d95d93b}{pv\_started}} = 1;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01453}01453                 \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}} = \mbox{\hyperlink{g__raid_8c_a582a2f56fe635a9f1d2783b9342126ee}{g\_raid\_create\_volume}}(sc, volname, -\/1);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01454}01454                 \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a1f432fb732072f5b196b570dd1d1e998}{v\_md\_data}} = pv;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01455}01455                 \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} = level;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01456}01456                 \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ad17bb2da7eadd462f1f27551cb1da76f}{v\_raid\_level\_qualifier}} = qual;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01457}01457                 \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_af0ca6a1c61e893f02a43ca29953c8e39}{v\_strip\_size}} = strip;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01458}01458                 \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a21482a5ac78a397faf4e95eb1ebef431}{v\_disks\_count}} = numdisks;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01459}01459                 \textcolor{keywordflow}{if} (level == \mbox{\hyperlink{g__raid_8h_a6a49f4ddd0b45eb4210ce72528786a32}{G\_RAID\_VOLUME\_RL\_RAID0}} ||}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01460}01460                     level == \mbox{\hyperlink{g__raid_8h_abc695e94a9e4eff0f657ec01d1f19607}{G\_RAID\_VOLUME\_RL\_CONCAT}} ||}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01461}01461                     level == \mbox{\hyperlink{g__raid_8h_acb418af006a1d84e0dd912c58cec6f57}{G\_RAID\_VOLUME\_RL\_SINGLE}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01462}01462                         \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ad81a0903c26424634b555fa29c0cd400}{v\_mediasize}} = size * numdisks;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01463}01463                 \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (level == \mbox{\hyperlink{g__raid_8h_a270bdf6b61fc7d810795e08ebbe60931}{G\_RAID\_VOLUME\_RL\_RAID1}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01464}01464                         \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ad81a0903c26424634b555fa29c0cd400}{v\_mediasize}} = size;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01465}01465                 \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (level == \mbox{\hyperlink{g__raid_8h_ace76bc9798da8c567b9a9620a2172ee4}{G\_RAID\_VOLUME\_RL\_RAID3}} ||}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01466}01466                     level == \mbox{\hyperlink{g__raid_8h_af6db015b03ea390243f2df897eb1189d}{G\_RAID\_VOLUME\_RL\_RAID5}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01467}01467                         \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ad81a0903c26424634b555fa29c0cd400}{v\_mediasize}} = size * (numdisks -\/ 1);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01468}01468                 \textcolor{keywordflow}{else} \{ \textcolor{comment}{/* RAID1E */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01469}01469                         \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ad81a0903c26424634b555fa29c0cd400}{v\_mediasize}} = ((size * numdisks) / strip / 2) *}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01470}01470                             strip;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01471}01471                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01472}01472                 \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_af7b9dcf6621dc8d66be12ba187d5f34b}{v\_sectorsize}} = \mbox{\hyperlink{structg__provider_aea3cd43d41461790b8d0afcd8c49a355}{sectorsize}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01473}01473                 \mbox{\hyperlink{g__raid_8c_a7e6ffb9d11de08e7eaa3e36d1028aa28}{g\_raid\_start\_volume}}(\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01474}01474 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01475}01475                 \textcolor{comment}{/* , and subdisks. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01476}01476                 \textcolor{keywordflow}{for} (i = 0; i < numdisks; i++) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01477}01477                         \mbox{\hyperlink{structdisk}{disk}} = disks[i];}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01478}01478                         \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}} = \&\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a3c43185db4bd1c4818d95a415635854b}{v\_subdisks}}[i];}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01479}01479                         \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_a5570ab684f57213078d94750e63354e1}{sd\_disk}} = \mbox{\hyperlink{g__raid__md__if_8m_a9508e997a57ea259d6ecc0e563261993}{disk}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01480}01480                         \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_a9b4e12573b26ee18473a16408044819f}{sd\_offset}} = (off\_t)offs[i] * 512;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01481}01481                         \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_abc4da1103e29e3a8e2bbadb18fbccbf6}{sd\_size}} = size;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01482}01482                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structdisk}{disk}} == NULL)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01483}01483                                 \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01484}01484                         TAILQ\_INSERT\_TAIL(\&\mbox{\hyperlink{structdisk}{disk}}-\/>d\_subdisks, \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}, sd\_next);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01485}01485                         \mbox{\hyperlink{g__raid_8c_a342da571518e21e0521b6416c838d00e}{g\_raid\_change\_disk\_state}}(\mbox{\hyperlink{structdisk}{disk}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01486}01486                             \mbox{\hyperlink{g__raid_8h_aaf46a21394a57a2fcac34b1b7b52701c}{G\_RAID\_DISK\_S\_ACTIVE}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01487}01487                         \mbox{\hyperlink{g__raid_8c_a058db459d5349d2130fda3a02dd2af29}{g\_raid\_change\_subdisk\_state}}(\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01488}01488                             \mbox{\hyperlink{g__raid_8h_a498effa0ffa87b75f6c40381c6d4eb39}{G\_RAID\_SUBDISK\_S\_ACTIVE}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01489}01489                         \mbox{\hyperlink{g__raid_8c_ac49cc1991dccaeef0743e0bc4f64e0b5}{g\_raid\_event\_send}}(\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}, \mbox{\hyperlink{g__raid_8h_ae59b963d99efabe56d8173f3ad914a07}{G\_RAID\_SUBDISK\_E\_NEW}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01490}01490                             \mbox{\hyperlink{g__raid_8h_ae6ac3f8d5dcaa73174e3e8bb9dd12f1c}{G\_RAID\_EVENT\_SUBDISK}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01491}01491                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01492}01492 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01493}01493                 \textcolor{comment}{/* Write metadata based on created entities. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01494}01494                 \mbox{\hyperlink{g__raid_8h_ace7234f8197b96e1b636f9376de8d7ea}{G\_RAID\_DEBUG1}}(0, sc, \textcolor{stringliteral}{"{}Array started."{}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01495}01495                 \mbox{\hyperlink{md__promise_8c_aa84eb5d0f9c789e4d981e01fbababb63}{g\_raid\_md\_write\_promise}}(md, \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}, NULL, NULL);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01496}01496 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01497}01497                 \textcolor{comment}{/* Pickup any STALE/SPARE disks to refill array if needed. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01498}01498                 \mbox{\hyperlink{md__promise_8c_a44c9bc67c1ca436f79c903575a666c9f}{g\_raid\_md\_promise\_refill}}(sc);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01499}01499 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01500}01500                 \mbox{\hyperlink{g__raid_8c_ac49cc1991dccaeef0743e0bc4f64e0b5}{g\_raid\_event\_send}}(\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}, \mbox{\hyperlink{g__raid_8h_ab4cc6f1792faa0f90f83ebf0f7217a9b}{G\_RAID\_VOLUME\_E\_START}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01501}01501                     \mbox{\hyperlink{g__raid_8h_aa6f84af705b9b366dcb0e4aabd807667}{G\_RAID\_EVENT\_VOLUME}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01502}01502                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01503}01503         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01504}01504         \textcolor{keywordflow}{if} (strcmp(verb, \textcolor{stringliteral}{"{}add"{}}) == 0) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01505}01505                 \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}`add` command is not applicable, "{}}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01506}01506                     \textcolor{stringliteral}{"{}use `label` instead."{}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01507}01507                 \textcolor{keywordflow}{return} (-\/99);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01508}01508         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01509}01509         \textcolor{keywordflow}{if} (strcmp(verb, \textcolor{stringliteral}{"{}delete"{}}) == 0) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01510}01510                 nodename = \mbox{\hyperlink{geom_8h_ada33526012aac8ee446617bb3749a07c}{gctl\_get\_asciiparam}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}arg0"{}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01511}01511                 \textcolor{keywordflow}{if} (nodename != NULL \&\& strcasecmp(sc-\/>sc\_name, nodename) != 0)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01512}01512                         nodename = NULL;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01513}01513 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01514}01514                 \textcolor{comment}{/* Full node destruction. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01515}01515                 \textcolor{keywordflow}{if} (*nargs == 1 \&\& nodename != NULL) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01516}01516                         \textcolor{comment}{/* Check if some volume is still open. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01517}01517                         force = \mbox{\hyperlink{geom_8h_ab762d12640f528d8f1f60eee92bf5f3b}{gctl\_get\_paraml}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}force"{}}, \textcolor{keyword}{sizeof}(*force));}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01518}01518                         \textcolor{keywordflow}{if} (force != NULL \&\& *force == 0 \&\&}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01519}01519                             \mbox{\hyperlink{g__raid_8c_a58ee15b5e8995450f68f052f5fe277bd}{g\_raid\_nopens}}(sc) != 0) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01520}01520                                 \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Some volume is still open."{}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01521}01521                                 \textcolor{keywordflow}{return} (-\/4);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01522}01522                         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01523}01523 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01524}01524                         TAILQ\_FOREACH(\mbox{\hyperlink{structdisk}{disk}}, \&sc-\/>sc\_disks, d\_next) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01525}01525                                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{structdisk}{disk}}-\/>d\_consumer)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01526}01526                                         \mbox{\hyperlink{md__promise_8c_a313b2317debd09249a3cfb3b0697b87e}{promise\_meta\_erase}}(\mbox{\hyperlink{structdisk}{disk}}-\/>d\_consumer);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01527}01527                         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01528}01528                         \mbox{\hyperlink{g__raid_8c_a99807e6db37e78d1738e46dfd48b7b5c}{g\_raid\_destroy\_node}}(sc, 0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01529}01529                         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01530}01530                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01531}01531 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01532}01532                 \textcolor{comment}{/* Destroy specified volume. If it was last -\/ all node. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01533}01533                 \textcolor{keywordflow}{if} (*nargs > 2) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01534}01534                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Invalid number of arguments."{}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01535}01535                         \textcolor{keywordflow}{return} (-\/1);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01536}01536                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01537}01537                 volname = \mbox{\hyperlink{geom_8h_ada33526012aac8ee446617bb3749a07c}{gctl\_get\_asciiparam}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01538}01538                     nodename != NULL ? \textcolor{stringliteral}{"{}arg1"{}} : \textcolor{stringliteral}{"{}arg0"{}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01539}01539                 \textcolor{keywordflow}{if} (volname == NULL) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01540}01540                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}No volume name."{}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01541}01541                         \textcolor{keywordflow}{return} (-\/2);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01542}01542                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01543}01543 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01544}01544                 \textcolor{comment}{/* Search for volume. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01545}01545                 TAILQ\_FOREACH(\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}, \&sc-\/>sc\_volumes, v\_next) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01546}01546                         \textcolor{keywordflow}{if} (strcmp(\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_abdedb24b3ca3f4d3020f94e62d63fa05}{v\_name}}, volname) == 0)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01547}01547                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01548}01548                         \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}} = \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a633aac264a87a0cc71846e28693c945e}{v\_provider}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01549}01549                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}} == NULL)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01550}01550                                 \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01551}01551                         \textcolor{keywordflow}{if} (strcmp(\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}}, volname) == 0)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01552}01552                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01553}01553                         \textcolor{keywordflow}{if} (strncmp(\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}}, \textcolor{stringliteral}{"{}raid/"{}}, 5) == 0 \&\&}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01554}01554                             strcmp(\mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}}-\/>\mbox{\hyperlink{structg__provider_a2bffb416ee58cf4df7839c6fd5ec004a}{name}} + 5, volname) == 0)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01555}01555                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01556}01556                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01557}01557                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01558}01558                         i = strtol(volname, \&tmp, 10);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01559}01559                         \textcolor{keywordflow}{if} (verb != volname \&\& tmp[0] == 0) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01560}01560                                 TAILQ\_FOREACH(\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}, \&sc-\/>sc\_volumes, v\_next) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01561}01561                                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_af90545cbb7240d2f2376df5fcae3b6fa}{v\_global\_id}} == i)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01562}01562                                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01563}01563                                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01564}01564                         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01565}01565                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01566}01566                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01567}01567                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Volume '\%s' not found."{}}, volname);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01568}01568                         \textcolor{keywordflow}{return} (-\/3);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01569}01569                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01570}01570 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01571}01571                 \textcolor{comment}{/* Check if volume is still open. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01572}01572                 force = \mbox{\hyperlink{geom_8h_ab762d12640f528d8f1f60eee92bf5f3b}{gctl\_get\_paraml}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}force"{}}, \textcolor{keyword}{sizeof}(*force));}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01573}01573                 \textcolor{keywordflow}{if} (force != NULL \&\& *force == 0 \&\&}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01574}01574                     \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a0b8a2a2e8d624f55afca59f2f33f3979}{v\_provider\_open}} != 0) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01575}01575                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Volume is still open."{}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01576}01576                         \textcolor{keywordflow}{return} (-\/4);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01577}01577                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01578}01578 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01579}01579                 \textcolor{comment}{/* Destroy volume and potentially node. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01580}01580                 i = 0;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01581}01581                 TAILQ\_FOREACH(vol1, \&sc-\/>sc\_volumes, v\_next)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01582}01582                         i++;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01583}01583                 \textcolor{keywordflow}{if} (i >= 2) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01584}01584                         \mbox{\hyperlink{g__raid_8c_ab2c6132332d0e91db0d7402a150d7716}{g\_raid\_destroy\_volume}}(\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01585}01585                         \mbox{\hyperlink{md__promise_8c_a15d123072f3eb970e226da92c7d02b4b}{g\_raid\_md\_promise\_purge\_disks}}(sc);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01586}01586                         \mbox{\hyperlink{md__promise_8c_aa84eb5d0f9c789e4d981e01fbababb63}{g\_raid\_md\_write\_promise}}(md, NULL, NULL, NULL);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01587}01587                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01588}01588                         TAILQ\_FOREACH(\mbox{\hyperlink{structdisk}{disk}}, \&sc-\/>sc\_disks, d\_next) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01589}01589                                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{structdisk}{disk}}-\/>d\_consumer)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01590}01590                                         \mbox{\hyperlink{md__promise_8c_a313b2317debd09249a3cfb3b0697b87e}{promise\_meta\_erase}}(\mbox{\hyperlink{structdisk}{disk}}-\/>d\_consumer);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01591}01591                         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01592}01592                         \mbox{\hyperlink{g__raid_8c_a99807e6db37e78d1738e46dfd48b7b5c}{g\_raid\_destroy\_node}}(sc, 0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01593}01593                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01594}01594                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01595}01595         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01596}01596         \textcolor{keywordflow}{if} (strcmp(verb, \textcolor{stringliteral}{"{}remove"{}}) == 0 ||}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01597}01597             strcmp(verb, \textcolor{stringliteral}{"{}fail"{}}) == 0) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01598}01598                 \textcolor{keywordflow}{if} (*nargs < 2) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01599}01599                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Invalid number of arguments."{}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01600}01600                         \textcolor{keywordflow}{return} (-\/1);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01601}01601                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01602}01602                 \textcolor{keywordflow}{for} (i = 1; i < *nargs; i++) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01603}01603                         snprintf(arg, \textcolor{keyword}{sizeof}(arg), \textcolor{stringliteral}{"{}arg\%d"{}}, i);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01604}01604                         diskname = \mbox{\hyperlink{geom_8h_ada33526012aac8ee446617bb3749a07c}{gctl\_get\_asciiparam}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, arg);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01605}01605                         \textcolor{keywordflow}{if} (diskname == NULL) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01606}01606                                 \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}No disk name (\%s)."{}}, arg);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01607}01607                                 \mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}} = -\/2;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01608}01608                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01609}01609                         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01610}01610                         \textcolor{keywordflow}{if} (strncmp(diskname, \mbox{\hyperlink{geom_8h_a9e429780e6e3bb32284b54630bc60a0d}{\_PATH\_DEV}}, 5) == 0)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01611}01611                                 diskname += 5;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01612}01612 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01613}01613                         TAILQ\_FOREACH(\mbox{\hyperlink{structdisk}{disk}}, \&sc-\/>sc\_disks, d\_next) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01614}01614                                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{structdisk}{disk}}-\/>d\_consumer != NULL \&\& }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01615}01615                                     \mbox{\hyperlink{structdisk}{disk}}-\/>d\_consumer-\/>provider != NULL \&\&}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01616}01616                                     strcmp(\mbox{\hyperlink{structdisk}{disk}}-\/>d\_consumer-\/>provider-\/>name,}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01617}01617                                      diskname) == 0)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01618}01618                                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01619}01619                         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01620}01620                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structdisk}{disk}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01621}01621                                 \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Disk '\%s' not found."{}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01622}01622                                     diskname);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01623}01623                                 \mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}} = -\/3;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01624}01624                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01625}01625                         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01626}01626 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01627}01627                         \textcolor{keywordflow}{if} (strcmp(verb, \textcolor{stringliteral}{"{}fail"{}}) == 0) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01628}01628                                 \mbox{\hyperlink{md__promise_8c_a9c2c5b4a6166ec33c5b3469c58692be0}{g\_raid\_md\_fail\_disk\_promise}}(md, NULL, \mbox{\hyperlink{structdisk}{disk}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01629}01629                                 \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01630}01630                         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01631}01631 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01632}01632                         \textcolor{comment}{/* Erase metadata on deleting disk and destroy it. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01633}01633                         \mbox{\hyperlink{md__promise_8c_a313b2317debd09249a3cfb3b0697b87e}{promise\_meta\_erase}}(\mbox{\hyperlink{structdisk}{disk}}-\/>d\_consumer);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01634}01634                         \mbox{\hyperlink{g__raid_8c_ac1e32d950d9354f1dca5d2ca34244adc}{g\_raid\_destroy\_disk}}(\mbox{\hyperlink{structdisk}{disk}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01635}01635                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01636}01636                 \mbox{\hyperlink{md__promise_8c_a07e21cd261f1a1ee4981de958094c073}{g\_raid\_md\_promise\_purge\_volumes}}(sc);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01637}01637 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01638}01638                 \textcolor{comment}{/* Write updated metadata to remaining disks. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01639}01639                 \mbox{\hyperlink{md__promise_8c_aa84eb5d0f9c789e4d981e01fbababb63}{g\_raid\_md\_write\_promise}}(md, NULL, NULL, NULL);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01640}01640 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01641}01641                 \textcolor{comment}{/* Check if anything left. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01642}01642                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid_8c_ad1004201fc232c60faacd7bd3f3b604f}{g\_raid\_ndisks}}(sc, -\/1) == 0)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01643}01643                         \mbox{\hyperlink{g__raid_8c_a99807e6db37e78d1738e46dfd48b7b5c}{g\_raid\_destroy\_node}}(sc, 0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01644}01644                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01645}01645                         \mbox{\hyperlink{md__promise_8c_a44c9bc67c1ca436f79c903575a666c9f}{g\_raid\_md\_promise\_refill}}(sc);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01646}01646                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01647}01647         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01648}01648         \textcolor{keywordflow}{if} (strcmp(verb, \textcolor{stringliteral}{"{}insert"{}}) == 0) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01649}01649                 \textcolor{keywordflow}{if} (*nargs < 2) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01650}01650                         \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Invalid number of arguments."{}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01651}01651                         \textcolor{keywordflow}{return} (-\/1);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01652}01652                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01653}01653                 \textcolor{keywordflow}{for} (i = 1; i < *nargs; i++) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01654}01654                         \textcolor{comment}{/* Get disk name. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01655}01655                         snprintf(arg, \textcolor{keyword}{sizeof}(arg), \textcolor{stringliteral}{"{}arg\%d"{}}, i);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01656}01656                         diskname = \mbox{\hyperlink{geom_8h_ada33526012aac8ee446617bb3749a07c}{gctl\_get\_asciiparam}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, arg);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01657}01657                         \textcolor{keywordflow}{if} (diskname == NULL) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01658}01658                                 \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}No disk name (\%s)."{}}, arg);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01659}01659                                 \mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}} = -\/3;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01660}01660                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01661}01661                         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01662}01662 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01663}01663                         \textcolor{comment}{/* Try to find provider with specified name. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01664}01664                         \mbox{\hyperlink{geom_8h_a232419d2cfa06ff3f4ff7551041aed31}{g\_topology\_lock}}();}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01665}01665                         \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}} = \mbox{\hyperlink{g__raid_8c_acc4d5f993651e14eb607d9efe39061c8}{g\_raid\_open\_consumer}}(sc, diskname);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01666}01666                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01667}01667                                 \mbox{\hyperlink{geom_8h_a1d51201471b52be7e19a98b0fcb144de}{gctl\_error}}(\mbox{\hyperlink{g__part__if_8m_a7a9f20c97e75f805eb506910bd3e70d3}{req}}, \textcolor{stringliteral}{"{}Can't open disk '\%s'."{}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01668}01668                                     diskname);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01669}01669                                 \mbox{\hyperlink{geom_8h_a4628d4de49ba84e7a6126cc30d23b83a}{g\_topology\_unlock}}();}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01670}01670                                 \mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}} = -\/4;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01671}01671                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01672}01672                         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01673}01673                         \mbox{\hyperlink{g__part__if_8m_a9bc7638f295763b77465c5ebebbd3442}{pp}} = \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a6435d5aec0376e995dce3131fd3beb52}{provider}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01674}01674                         \mbox{\hyperlink{geom_8h_a4628d4de49ba84e7a6126cc30d23b83a}{g\_topology\_unlock}}();}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01675}01675 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01676}01676                         pd = malloc(\textcolor{keyword}{sizeof}(*pd), M\_MD\_PROMISE, M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01677}01677 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01678}01678                         \mbox{\hyperlink{structdisk}{disk}} = \mbox{\hyperlink{g__raid_8c_a7d896eb1612c17408eedbdda2032e897}{g\_raid\_create\_disk}}(sc);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01679}01679                         \mbox{\hyperlink{structdisk}{disk}}-\/>d\_consumer = \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01680}01680                         \mbox{\hyperlink{structdisk}{disk}}-\/>d\_md\_data = (\textcolor{keywordtype}{void} *)pd;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01681}01681                         \mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}}-\/>\mbox{\hyperlink{structg__consumer_a11273c1281d0cffbc3383eb4e49e7010}{private}} = \mbox{\hyperlink{g__raid__md__if_8m_a9508e997a57ea259d6ecc0e563261993}{disk}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01682}01682 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01683}01683                         \mbox{\hyperlink{g__raid_8c_afbb51abcd221460c50c23ecc69be3114}{g\_raid\_get\_disk\_info}}(\mbox{\hyperlink{structdisk}{disk}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01684}01684 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01685}01685                         \textcolor{comment}{/* Welcome the "{}new"{} disk. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01686}01686                         \mbox{\hyperlink{g__raid_8c_a342da571518e21e0521b6416c838d00e}{g\_raid\_change\_disk\_state}}(\mbox{\hyperlink{structdisk}{disk}}, \mbox{\hyperlink{g__raid_8h_a53208a3eca6d67917c6fdf6321292c99}{G\_RAID\_DISK\_S\_SPARE}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01687}01687                         \mbox{\hyperlink{md__promise_8c_aaca73179df3140e5d531d7c76e8db9f2}{promise\_meta\_write\_spare}}(\mbox{\hyperlink{g__part__if_8m_a294f18324585ff37641fb8aa1c9ccd82}{cp}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01688}01688                         \mbox{\hyperlink{md__promise_8c_a44c9bc67c1ca436f79c903575a666c9f}{g\_raid\_md\_promise\_refill}}(sc);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01689}01689                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01690}01690                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{structg__provider_acacf1ee18cb6edbcfedc185846696e7f}{error}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01691}01691         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01692}01692         \textcolor{keywordflow}{return} (-\/100);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01693}01693 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01694}01694 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01695}01695 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01696}\mbox{\hyperlink{md__promise_8c_a2503543e13587d8cc287200ec7b61209}{01696}} \mbox{\hyperlink{md__promise_8c_aa84eb5d0f9c789e4d981e01fbababb63}{g\_raid\_md\_write\_promise}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__md__object}{g\_raid\_md\_object}} *md, \textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__volume}{g\_raid\_volume}} *tvol,}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01697}01697     \textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__subdisk}{g\_raid\_subdisk}} *tsd, \textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__disk}{g\_raid\_disk}} *tdisk)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01698}01698 \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01699}01699         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__softc}{g\_raid\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01700}01700         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__volume}{g\_raid\_volume}} *\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01701}01701         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__subdisk}{g\_raid\_subdisk}} *\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01702}01702         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__disk}{g\_raid\_disk}} *\mbox{\hyperlink{g__raid__md__if_8m_a9508e997a57ea259d6ecc0e563261993}{disk}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01703}01703         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__promise__perdisk}{g\_raid\_md\_promise\_perdisk}} *pd;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01704}01704         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__promise__pervolume}{g\_raid\_md\_promise\_pervolume}} *pv;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01705}01705         \textcolor{keyword}{struct }\mbox{\hyperlink{structpromise__raid__conf}{promise\_raid\_conf}} *meta;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01706}01706         off\_t \mbox{\hyperlink{structpromise__raid__conf_a0c2f572ff18234677a0adbd5f1f2d9d1}{rebuild\_lba64}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01707}01707         \textcolor{keywordtype}{int} i, j, pos, rebuild;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01708}01708 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01709}01709         sc = md-\/>\mbox{\hyperlink{structg__raid__md__object_a4acc92ca2582509c74947d83b258e31d}{mdo\_softc}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01710}01710 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01711}01711         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structg__raid__softc_a92d7a08f5e32fa07a7b8769b5b3ca4f4}{sc\_stopping}} == \mbox{\hyperlink{g__raid_8h_ae019bb639a31951ab4cf8dad7f68e46a}{G\_RAID\_DESTROY\_HARD}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01712}01712                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01713}01713 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01714}01714         \textcolor{comment}{/* Generate new per-\/volume metadata for affected volumes. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01715}01715         TAILQ\_FOREACH(\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}, \&sc-\/>sc\_volumes, v\_next) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01716}01716                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a61fb0849390a6916c173c37a9653dada}{v\_stopping}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01717}01717                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01718}01718 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01719}01719                 \textcolor{comment}{/* Skip volumes not related to specified targets. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01720}01720                 \textcolor{keywordflow}{if} (tvol != NULL \&\& \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}} != tvol)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01721}01721                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01722}01722                 \textcolor{keywordflow}{if} (tsd != NULL \&\& \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}} != tsd-\/>\mbox{\hyperlink{structg__raid__subdisk_ab7f11cd5b966d381d1ae75c6ac9e3ddd}{sd\_volume}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01723}01723                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01724}01724                 \textcolor{keywordflow}{if} (tdisk != NULL) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01725}01725                         \textcolor{keywordflow}{for} (i = 0; i < \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a21482a5ac78a397faf4e95eb1ebef431}{v\_disks\_count}}; i++) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01726}01726                                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a3c43185db4bd1c4818d95a415635854b}{v\_subdisks}}[i].\mbox{\hyperlink{structg__raid__subdisk_a5570ab684f57213078d94750e63354e1}{sd\_disk}} == tdisk)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01727}01727                                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01728}01728                         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01729}01729                         \textcolor{keywordflow}{if} (i >= \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a21482a5ac78a397faf4e95eb1ebef431}{v\_disks\_count}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01730}01730                                 \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01731}01731                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01732}01732 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01733}01733                 pv = (\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__promise__pervolume}{g\_raid\_md\_promise\_pervolume}} *)\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a1f432fb732072f5b196b570dd1d1e998}{v\_md\_data}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01734}01734                 pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a5c1c2471fa8a2d05e30e622dbf1fea3b}{pv\_generation}}++;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01735}01735 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01736}01736                 meta = malloc(\textcolor{keyword}{sizeof}(*meta), M\_MD\_PROMISE, M\_WAITOK | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01737}01737                 \textcolor{keywordflow}{if} (pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a94097bae0d51bd8d9693a3bea313a5f6}{pv\_meta}} != NULL)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01738}01738                         memcpy(meta, pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a94097bae0d51bd8d9693a3bea313a5f6}{pv\_meta}}, \textcolor{keyword}{sizeof}(*meta));}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01739}01739                 memcpy(meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a0c477989cfc0aee1927c1656f888ba12}{promise\_id}}, \mbox{\hyperlink{md__promise_8c_a29077fb14589c94c01d6d5f3b0a0ed28}{PROMISE\_MAGIC}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01740}01740                     \textcolor{keyword}{sizeof}(\mbox{\hyperlink{md__promise_8c_a29077fb14589c94c01d6d5f3b0a0ed28}{PROMISE\_MAGIC}}) -\/ 1);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01741}01741                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a189ae93fe42a78e7e952586189a45504}{dummy\_0}} = 0x00020000;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01742}01742                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a377f334f6cd684aae8cf62fc8f668cb5}{integrity}} = \mbox{\hyperlink{md__promise_8c_aa488a845dca778997126c4c91984f6b8}{PROMISE\_I\_VALID}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01743}01743 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01744}01744                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a6564feadfd2dc21b64f5994567650a99}{generation}} = pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a5c1c2471fa8a2d05e30e622dbf1fea3b}{pv\_generation}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01745}01745                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a1c93f6d43b87511ff33e18e0fc237ddc}{status}} = \mbox{\hyperlink{md__promise_8c_ad44d358a01c6b79c8f123a69ad27695c}{PROMISE\_S\_VALID}} | \mbox{\hyperlink{md__promise_8c_a2043ed0b7cd044475360e18bb3c50184}{PROMISE\_S\_ONLINE}} |}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01746}01746                     \mbox{\hyperlink{md__promise_8c_ad8501769df5f20d9bfe51343aa4d8562}{PROMISE\_S\_INITED}} | \mbox{\hyperlink{md__promise_8c_a4a3523744c245ded29aca407b04d6fa4}{PROMISE\_S\_READY}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01747}01747                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a5a90d68c226a2ae59ff670759f9cad28}{v\_state}} <= \mbox{\hyperlink{g__raid_8h_a127fdd15d01e1ff21b274d56dabc3df5}{G\_RAID\_VOLUME\_S\_DEGRADED}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01748}01748                         meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a1c93f6d43b87511ff33e18e0fc237ddc}{status}} |= \mbox{\hyperlink{md__promise_8c_a7881eac97bc2dd90e115467cca0e31ac}{PROMISE\_S\_DEGRADED}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01749}01749                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a1c672df93d899cfd72dc0f9b1f4e7139}{v\_dirty}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01750}01750                         meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a1c93f6d43b87511ff33e18e0fc237ddc}{status}} |= \mbox{\hyperlink{md__promise_8c_a99ac63c32805a449e275affeceec5704}{PROMISE\_S\_MARKED}}; \textcolor{comment}{/* XXX: INVENTED! */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01751}01751                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} == \mbox{\hyperlink{g__raid_8h_a6a49f4ddd0b45eb4210ce72528786a32}{G\_RAID\_VOLUME\_RL\_RAID0}} ||}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01752}01752                     \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} == \mbox{\hyperlink{g__raid_8h_acb418af006a1d84e0dd912c58cec6f57}{G\_RAID\_VOLUME\_RL\_SINGLE}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01753}01753                         meta-\/>\mbox{\hyperlink{structpromise__raid__conf_aa047dcf61e52bced397c3d1b06388d3a}{type}} = \mbox{\hyperlink{md__promise_8c_a91fac4d6c0b9f0871f07a481a0ee596c}{PROMISE\_T\_RAID0}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01754}01754                 \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} == \mbox{\hyperlink{g__raid_8h_a270bdf6b61fc7d810795e08ebbe60931}{G\_RAID\_VOLUME\_RL\_RAID1}} ||}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01755}01755                     \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} == \mbox{\hyperlink{g__raid_8h_ad0ef2cd50760a49759a6cbaf2afeb286}{G\_RAID\_VOLUME\_RL\_RAID1E}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01756}01756                         meta-\/>\mbox{\hyperlink{structpromise__raid__conf_aa047dcf61e52bced397c3d1b06388d3a}{type}} = \mbox{\hyperlink{md__promise_8c_a93bd586a834fc2937ea745d4facac00f}{PROMISE\_T\_RAID1}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01757}01757                 \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} == \mbox{\hyperlink{g__raid_8h_ace76bc9798da8c567b9a9620a2172ee4}{G\_RAID\_VOLUME\_RL\_RAID3}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01758}01758                         meta-\/>\mbox{\hyperlink{structpromise__raid__conf_aa047dcf61e52bced397c3d1b06388d3a}{type}} = \mbox{\hyperlink{md__promise_8c_a80b741a47ab70d65b8c35a69bbefa717}{PROMISE\_T\_RAID3}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01759}01759                 \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} == \mbox{\hyperlink{g__raid_8h_af6db015b03ea390243f2df897eb1189d}{G\_RAID\_VOLUME\_RL\_RAID5}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01760}01760                         meta-\/>\mbox{\hyperlink{structpromise__raid__conf_aa047dcf61e52bced397c3d1b06388d3a}{type}} = \mbox{\hyperlink{md__promise_8c_afb8464fdc81351fa1c9bc98846405951}{PROMISE\_T\_RAID5}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01761}01761                 \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} == \mbox{\hyperlink{g__raid_8h_abc695e94a9e4eff0f657ec01d1f19607}{G\_RAID\_VOLUME\_RL\_CONCAT}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01762}01762                         meta-\/>\mbox{\hyperlink{structpromise__raid__conf_aa047dcf61e52bced397c3d1b06388d3a}{type}} = \mbox{\hyperlink{md__promise_8c_af4bc13398f46db47579bc5e3fef8c096}{PROMISE\_T\_SPAN}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01763}01763                 \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01764}01764                         meta-\/>\mbox{\hyperlink{structpromise__raid__conf_aa047dcf61e52bced397c3d1b06388d3a}{type}} = \mbox{\hyperlink{md__promise_8c_a0f7ef635ed5f29cfdb8d26f6dfae4323}{PROMISE\_T\_JBOD}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01765}01765                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a4591d4915850a182c44952a2e0e164e6}{total\_disks}} = \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a21482a5ac78a397faf4e95eb1ebef431}{v\_disks\_count}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01766}01766                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_af0b1f65f4e1f592470e2556a9c53416b}{stripe\_shift}} = ffs(\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_af0ca6a1c61e893f02a43ca29953c8e39}{v\_strip\_size}} / 1024);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01767}01767                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ac16f53d721267d1bea9a4209d0aaee57}{array\_width}} = \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a21482a5ac78a397faf4e95eb1ebef431}{v\_disks\_count}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01768}01768                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} == \mbox{\hyperlink{g__raid_8h_a270bdf6b61fc7d810795e08ebbe60931}{G\_RAID\_VOLUME\_RL\_RAID1}} ||}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01769}01769                     \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} == \mbox{\hyperlink{g__raid_8h_ad0ef2cd50760a49759a6cbaf2afeb286}{G\_RAID\_VOLUME\_RL\_RAID1E}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01770}01770                         meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ac16f53d721267d1bea9a4209d0aaee57}{array\_width}} /= 2;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01771}01771                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a0bf4b5c463116d88d2db8ce2fa64eaf8}{array\_number}} = \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_af90545cbb7240d2f2376df5fcae3b6fa}{v\_global\_id}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01772}01772                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ac2e961fbef27d74bb376bd7e49d85688}{total\_sectors}} = \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ad81a0903c26424634b555fa29c0cd400}{v\_mediasize}} / 512;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01773}01773                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a2fac25865626604d1a3333072473f489}{total\_sectors\_high}} = (\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ad81a0903c26424634b555fa29c0cd400}{v\_mediasize}} / 512) >> 32;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01774}01774                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a10de46f425232b9686c3834a7938e5e7}{sector\_size}} = \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_af7b9dcf6621dc8d66be12ba187d5f34b}{v\_sectorsize}} / 512;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01775}01775                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_abff36247e7f1721bbf0aa15a9edd0b51}{cylinders}} = meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ac2e961fbef27d74bb376bd7e49d85688}{total\_sectors}} / (255 * 63) -\/ 1;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01776}01776                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ac86e9c807bcfb50225ca418dde822c11}{heads}} = 254;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01777}01777                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a63ba63125c6a1228a76eb850e59136ff}{sectors}} = 63;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01778}01778                 meta-\/>volume\_id = pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a7529f3ff051c7927f2deaff5d206065a}{pv\_id}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01779}01779                 rebuild\_lba64 = UINT64\_MAX;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01780}01780                 rebuild = 0;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01781}01781                 \textcolor{keywordflow}{for} (i = 0; i < \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a21482a5ac78a397faf4e95eb1ebef431}{v\_disks\_count}}; i++) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01782}01782                         \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}} = \&\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a3c43185db4bd1c4818d95a415635854b}{v\_subdisks}}[i];}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01783}01783                         \textcolor{comment}{/* For RAID0+1 we need to translate order. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01784}01784                         pos = \mbox{\hyperlink{md__promise_8c_ae78c674b460edb2aa59af8ec82bf15f6}{promise\_meta\_translate\_disk}}(\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}, i);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01785}01785                         meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a230625945ea844bdb2d31809448782b5}{disks}}[pos].\mbox{\hyperlink{structpromise__raid__disk_a16f4266340575cf4ee5229f5f3d0ad95}{flags}} = \mbox{\hyperlink{md__promise_8c_ace5b0dcdd7f2899d4ff25e0e06bf0d4c}{PROMISE\_F\_VALID}} |}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01786}01786                             \mbox{\hyperlink{md__promise_8c_af4d7a54dec02bc72a70beba68a64b22a}{PROMISE\_F\_ASSIGNED}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01787}01787                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_acd19794916930f74ecad38ca7dd69f69}{sd\_state}} == \mbox{\hyperlink{g__raid_8h_af37111ba44cfc01a98d97bed8f60d964}{G\_RAID\_SUBDISK\_S\_NONE}}) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01788}01788                                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a230625945ea844bdb2d31809448782b5}{disks}}[pos].\mbox{\hyperlink{structpromise__raid__disk_a16f4266340575cf4ee5229f5f3d0ad95}{flags}} |= 0;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01789}01789                         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_acd19794916930f74ecad38ca7dd69f69}{sd\_state}} == \mbox{\hyperlink{g__raid_8h_a2e56fb1cd5fdab097052e38c28a8c92f}{G\_RAID\_SUBDISK\_S\_FAILED}}) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01790}01790                                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a230625945ea844bdb2d31809448782b5}{disks}}[pos].\mbox{\hyperlink{structpromise__raid__disk_a16f4266340575cf4ee5229f5f3d0ad95}{flags}} |=}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01791}01791                                     \mbox{\hyperlink{md__promise_8c_aa59a43a69b8ab9246e5c0462bc23d89e}{PROMISE\_F\_DOWN}} | \mbox{\hyperlink{md__promise_8c_aa4244066795df910826a3ef954f8e87e}{PROMISE\_F\_REDIR}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01792}01792                         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_acd19794916930f74ecad38ca7dd69f69}{sd\_state}} <= \mbox{\hyperlink{g__raid_8h_a856d6801d600e0089b0cd39ff5af7224}{G\_RAID\_SUBDISK\_S\_REBUILD}}) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01793}01793                                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a230625945ea844bdb2d31809448782b5}{disks}}[pos].\mbox{\hyperlink{structpromise__raid__disk_a16f4266340575cf4ee5229f5f3d0ad95}{flags}} |=}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01794}01794                                     \mbox{\hyperlink{md__promise_8c_ac42df4956dd3764bd65643979d08322f}{PROMISE\_F\_ONLINE}} | \mbox{\hyperlink{md__promise_8c_aa4244066795df910826a3ef954f8e87e}{PROMISE\_F\_REDIR}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01795}01795                                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_acd19794916930f74ecad38ca7dd69f69}{sd\_state}} == \mbox{\hyperlink{g__raid_8h_a856d6801d600e0089b0cd39ff5af7224}{G\_RAID\_SUBDISK\_S\_REBUILD}}) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01796}01796                                         rebuild\_lba64 = MIN(rebuild\_lba64,}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01797}01797                                             \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_aca58c7c621e10d2cbe97cd1c87214d7b}{sd\_rebuild\_pos}} / 512);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01798}01798                                 \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01799}01799                                         rebuild\_lba64 = 0;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01800}01800                                 rebuild = 1;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01801}01801                         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01802}01802                                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a230625945ea844bdb2d31809448782b5}{disks}}[pos].\mbox{\hyperlink{structpromise__raid__disk_a16f4266340575cf4ee5229f5f3d0ad95}{flags}} |= \mbox{\hyperlink{md__promise_8c_ac42df4956dd3764bd65643979d08322f}{PROMISE\_F\_ONLINE}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01803}01803                                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_acd19794916930f74ecad38ca7dd69f69}{sd\_state}} < \mbox{\hyperlink{g__raid_8h_a498effa0ffa87b75f6c40381c6d4eb39}{G\_RAID\_SUBDISK\_S\_ACTIVE}}) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01804}01804                                         meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a1c93f6d43b87511ff33e18e0fc237ddc}{status}} |= \mbox{\hyperlink{md__promise_8c_a99ac63c32805a449e275affeceec5704}{PROMISE\_S\_MARKED}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01805}01805                                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_acd19794916930f74ecad38ca7dd69f69}{sd\_state}} == \mbox{\hyperlink{g__raid_8h_a8c3d62bf4e551976a8941a23c8984e5d}{G\_RAID\_SUBDISK\_S\_RESYNC}}) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01806}01806                                                 rebuild\_lba64 = MIN(rebuild\_lba64,}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01807}01807                                                     \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_aca58c7c621e10d2cbe97cd1c87214d7b}{sd\_rebuild\_pos}} / 512);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01808}01808                                         \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01809}01809                                                 rebuild\_lba64 = 0;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01810}01810                                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01811}01811                         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01812}01812                         \textcolor{keywordflow}{if} (pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a94097bae0d51bd8d9693a3bea313a5f6}{pv\_meta}} != NULL) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01813}01813                                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a230625945ea844bdb2d31809448782b5}{disks}}[pos].id = pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a94097bae0d51bd8d9693a3bea313a5f6}{pv\_meta}}-\/>\mbox{\hyperlink{structpromise__raid__conf_a230625945ea844bdb2d31809448782b5}{disks}}[pos].id;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01814}01814                         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01815}01815                                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a230625945ea844bdb2d31809448782b5}{disks}}[pos].\mbox{\hyperlink{structpromise__raid__disk_aceb1a87bdeded6d666ae56afa3923e92}{number}} = i * 2;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01816}01816                                 arc4rand(\&meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a230625945ea844bdb2d31809448782b5}{disks}}[pos].id,}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01817}01817                                     \textcolor{keyword}{sizeof}(meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a230625945ea844bdb2d31809448782b5}{disks}}[pos].id), 0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01818}01818                         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01819}01819                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01820}01820                 \mbox{\hyperlink{md__promise_8c_a22407168babfbed0f7893dd05df93d2a}{promise\_meta\_put\_name}}(meta, \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_abdedb24b3ca3f4d3020f94e62d63fa05}{v\_name}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01821}01821 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01822}01822                 \textcolor{comment}{/* Try to mimic AMD BIOS rebuild/resync behavior. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01823}01823                 \textcolor{keywordflow}{if} (rebuild\_lba64 != UINT64\_MAX) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01824}01824                         \textcolor{keywordflow}{if} (rebuild)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01825}01825                                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ac9097e3e7237652023cb106f90cf1f18}{magic\_3}} = 0x03040010UL; \textcolor{comment}{/* Rebuild? */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01826}01826                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01827}01827                                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ac9097e3e7237652023cb106f90cf1f18}{magic\_3}} = 0x03040008UL; \textcolor{comment}{/* Resync? */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01828}01828                         \textcolor{comment}{/* Translate from per-\/disk to per-\/volume LBA. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01829}01829                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} == \mbox{\hyperlink{g__raid_8h_a270bdf6b61fc7d810795e08ebbe60931}{G\_RAID\_VOLUME\_RL\_RAID1}} ||}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01830}01830                             \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} == \mbox{\hyperlink{g__raid_8h_ad0ef2cd50760a49759a6cbaf2afeb286}{G\_RAID\_VOLUME\_RL\_RAID1E}}) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01831}01831                                 rebuild\_lba64 *= meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ac16f53d721267d1bea9a4209d0aaee57}{array\_width}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01832}01832                         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} == \mbox{\hyperlink{g__raid_8h_ace76bc9798da8c567b9a9620a2172ee4}{G\_RAID\_VOLUME\_RL\_RAID3}} ||}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01833}01833                             \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_ab7c2840f8398e5a91b560d7644957a57}{v\_raid\_level}} == \mbox{\hyperlink{g__raid_8h_af6db015b03ea390243f2df897eb1189d}{G\_RAID\_VOLUME\_RL\_RAID5}}) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01834}01834                                 rebuild\_lba64 *= meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ac16f53d721267d1bea9a4209d0aaee57}{array\_width}} -\/ 1;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01835}01835                         \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01836}01836                                 rebuild\_lba64 = 0;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01837}01837                 \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01838}01838                         meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ac9097e3e7237652023cb106f90cf1f18}{magic\_3}} = 0x03000000UL;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01839}01839                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a0c2f572ff18234677a0adbd5f1f2d9d1}{rebuild\_lba64}} = rebuild\_lba64;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01840}01840                 meta-\/>\mbox{\hyperlink{structpromise__raid__conf_ad385936739933bd06f99fc56213b9ae6}{magic\_4}} = 0x04010101UL;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01841}01841 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01842}01842                 \textcolor{comment}{/* Replace per-\/volume metadata with new. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01843}01843                 \textcolor{keywordflow}{if} (pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a94097bae0d51bd8d9693a3bea313a5f6}{pv\_meta}} != NULL)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01844}01844                         \mbox{\hyperlink{g__raid__md__if_8m_a4df9edb2717b3f7e4c3c903878577a54}{free}}(pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a94097bae0d51bd8d9693a3bea313a5f6}{pv\_meta}}, M\_MD\_PROMISE);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01845}01845                 pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a94097bae0d51bd8d9693a3bea313a5f6}{pv\_meta}} = meta;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01846}01846 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01847}01847                 \textcolor{comment}{/* Copy new metadata to the disks, adding or replacing old. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01848}01848                 \textcolor{keywordflow}{for} (i = 0; i < \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a21482a5ac78a397faf4e95eb1ebef431}{v\_disks\_count}}; i++) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01849}01849                         \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}} = \&\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a3c43185db4bd1c4818d95a415635854b}{v\_subdisks}}[i];}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01850}01850                         \mbox{\hyperlink{structdisk}{disk}} = \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_a5570ab684f57213078d94750e63354e1}{sd\_disk}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01851}01851                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structdisk}{disk}} == NULL)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01852}01852                                 \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01853}01853                         \textcolor{comment}{/* For RAID0+1 we need to translate order. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01854}01854                         pos = \mbox{\hyperlink{md__promise_8c_ae78c674b460edb2aa59af8ec82bf15f6}{promise\_meta\_translate\_disk}}(\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}, i);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01855}01855                         pd = (\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__promise__perdisk}{g\_raid\_md\_promise\_perdisk}} *)\mbox{\hyperlink{structdisk}{disk}}-\/>d\_md\_data;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01856}01856                         for (j = 0; j < pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_af83a2a95e726587eddda9df693dc9fe3}{pd\_subdisks}}; j++) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01857}01857                                 \textcolor{keywordflow}{if} (pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[j]-\/>volume\_id == meta-\/>volume\_id)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01858}01858                                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01859}01859                         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01860}01860                         \textcolor{keywordflow}{if} (j == pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_af83a2a95e726587eddda9df693dc9fe3}{pd\_subdisks}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01861}01861                                 pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_af83a2a95e726587eddda9df693dc9fe3}{pd\_subdisks}}++;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01862}01862                         \textcolor{keywordflow}{if} (pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[j] != NULL)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01863}01863                                 \mbox{\hyperlink{g__raid__md__if_8m_a4df9edb2717b3f7e4c3c903878577a54}{free}}(pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[j], M\_MD\_PROMISE);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01864}01864                         pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[j] = \mbox{\hyperlink{md__promise_8c_a0e997a4fd6d7be64d723864e1bc69aed}{promise\_meta\_copy}}(meta);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01865}01865                         pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[j]-\/>\mbox{\hyperlink{structpromise__raid__conf_ae8467fc2b525d7517c291153f8c33119}{disk}} = meta-\/>\mbox{\hyperlink{structpromise__raid__conf_a230625945ea844bdb2d31809448782b5}{disks}}[pos];}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01866}01866                         pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[j]-\/>\mbox{\hyperlink{structpromise__raid__conf_ae8467fc2b525d7517c291153f8c33119}{disk}}.\mbox{\hyperlink{structpromise__raid__disk_aceb1a87bdeded6d666ae56afa3923e92}{number}} = pos;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01867}01867                         pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[j]-\/>\mbox{\hyperlink{structpromise__raid__conf_afd71e747e37a0dd24e784becfde7cb6b}{disk\_offset\_high}} =}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01868}01868                             (\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_a9b4e12573b26ee18473a16408044819f}{sd\_offset}} / 512) >> 32;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01869}01869                         pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[j]-\/>\mbox{\hyperlink{structpromise__raid__conf_a143a91a5acbd6f26144a9ffee198458d}{disk\_offset}} = \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_a9b4e12573b26ee18473a16408044819f}{sd\_offset}} / 512;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01870}01870                         pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[j]-\/>\mbox{\hyperlink{structpromise__raid__conf_a108318e260bbf343dfb77ed6d8603652}{disk\_sectors\_high}} =}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01871}01871                             (\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_abc4da1103e29e3a8e2bbadb18fbccbf6}{sd\_size}} / 512) >> 32;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01872}01872                         pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[j]-\/>\mbox{\hyperlink{structpromise__raid__conf_a24e4822147b219e5cdf41cb1557cd599}{disk\_sectors}} = \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_abc4da1103e29e3a8e2bbadb18fbccbf6}{sd\_size}} / 512;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01873}01873                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_acd19794916930f74ecad38ca7dd69f69}{sd\_state}} == \mbox{\hyperlink{g__raid_8h_a856d6801d600e0089b0cd39ff5af7224}{G\_RAID\_SUBDISK\_S\_REBUILD}}) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01874}01874                                 pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[j]-\/>\mbox{\hyperlink{structpromise__raid__conf_accae431c7d4a0bd2d86df235d55ff8a8}{disk\_rebuild\_high}} =}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01875}01875                                     (\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_aca58c7c621e10d2cbe97cd1c87214d7b}{sd\_rebuild\_pos}} / 512) >> 32;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01876}01876                                 pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[j]-\/>\mbox{\hyperlink{structpromise__raid__conf_af440803e33d5c8e2ea407cf3b365625a}{disk\_rebuild}} =}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01877}01877                                     \mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_aca58c7c621e10d2cbe97cd1c87214d7b}{sd\_rebuild\_pos}} / 512;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01878}01878                         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}-\/>\mbox{\hyperlink{structg__raid__subdisk_acd19794916930f74ecad38ca7dd69f69}{sd\_state}} < \mbox{\hyperlink{g__raid_8h_a856d6801d600e0089b0cd39ff5af7224}{G\_RAID\_SUBDISK\_S\_REBUILD}}) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01879}01879                                 pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[j]-\/>\mbox{\hyperlink{structpromise__raid__conf_accae431c7d4a0bd2d86df235d55ff8a8}{disk\_rebuild\_high}} = 0;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01880}01880                                 pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[j]-\/>\mbox{\hyperlink{structpromise__raid__conf_af440803e33d5c8e2ea407cf3b365625a}{disk\_rebuild}} = 0;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01881}01881                         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01882}01882                                 pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[j]-\/>\mbox{\hyperlink{structpromise__raid__conf_accae431c7d4a0bd2d86df235d55ff8a8}{disk\_rebuild\_high}} = UINT32\_MAX;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01883}01883                                 pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[j]-\/>\mbox{\hyperlink{structpromise__raid__conf_af440803e33d5c8e2ea407cf3b365625a}{disk\_rebuild}} = UINT32\_MAX;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01884}01884                         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01885}01885                         pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_ab4298e04bfd1fc70debb15180a449beb}{pd\_updated}} = 1;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01886}01886                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01887}01887         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01888}01888 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01889}01889         TAILQ\_FOREACH(\mbox{\hyperlink{structdisk}{disk}}, \&sc-\/>sc\_disks, d\_next) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01890}01890                 pd = (\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__promise__perdisk}{g\_raid\_md\_promise\_perdisk}} *)\mbox{\hyperlink{structdisk}{disk}}-\/>d\_md\_data;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01891}01891                 if (\mbox{\hyperlink{structdisk}{disk}}-\/>d\_state != \mbox{\hyperlink{g__raid_8h_aaf46a21394a57a2fcac34b1b7b52701c}{G\_RAID\_DISK\_S\_ACTIVE}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01892}01892                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01893}01893                 \textcolor{keywordflow}{if} (!pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_ab4298e04bfd1fc70debb15180a449beb}{pd\_updated}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01894}01894                         \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01895}01895                 \mbox{\hyperlink{g__raid_8h_a4333fbd8d0899facf171aee7b60697f6}{G\_RAID\_DEBUG}}(1, \textcolor{stringliteral}{"{}Writing Promise metadata to \%s"{}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01896}01896                     \mbox{\hyperlink{g__raid_8c_a8ceaeb12952563e6fe9869ed6b8daa5d}{g\_raid\_get\_diskname}}(\mbox{\hyperlink{structdisk}{disk}}));}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01897}01897                 \textcolor{keywordflow}{for} (i = 0; i < pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_af83a2a95e726587eddda9df693dc9fe3}{pd\_subdisks}}; i++)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01898}01898                         \mbox{\hyperlink{md__promise_8c_adc9e23d231b12a99259b8ea7d2d79b24}{g\_raid\_md\_promise\_print}}(pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[i]);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01899}01899                 \mbox{\hyperlink{md__promise_8c_a6707745e52b7e36ab54cda898768c4f8}{promise\_meta\_write}}(\mbox{\hyperlink{structdisk}{disk}}-\/>d\_consumer,}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01900}01900                     pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}, pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_af83a2a95e726587eddda9df693dc9fe3}{pd\_subdisks}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01901}01901                 pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_ab4298e04bfd1fc70debb15180a449beb}{pd\_updated}} = 0;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01902}01902         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01903}01903 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01904}01904         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01905}01905 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01906}01906 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01907}01907 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01908}\mbox{\hyperlink{md__promise_8c_a9bb6ed815d37a28127e509ae8422b4d0}{01908}} \mbox{\hyperlink{md__promise_8c_a9c2c5b4a6166ec33c5b3469c58692be0}{g\_raid\_md\_fail\_disk\_promise}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__md__object}{g\_raid\_md\_object}} *md,}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01909}01909     \textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__subdisk}{g\_raid\_subdisk}} *tsd, \textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__disk}{g\_raid\_disk}} *tdisk)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01910}01910 \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01911}01911         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__softc}{g\_raid\_softc}} *sc;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01912}01912         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__promise__perdisk}{g\_raid\_md\_promise\_perdisk}} *pd;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01913}01913         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__subdisk}{g\_raid\_subdisk}} *\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01914}01914         \textcolor{keywordtype}{int} i, pos;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01915}01915 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01916}01916         sc = md-\/>\mbox{\hyperlink{structg__raid__md__object_a4acc92ca2582509c74947d83b258e31d}{mdo\_softc}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01917}01917         pd = (\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__promise__perdisk}{g\_raid\_md\_promise\_perdisk}} *)tdisk-\/>\mbox{\hyperlink{structg__raid__disk_ab6681cb16ceeb79b9e88d639eca0bd9e}{d\_md\_data}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01918}01918 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01919}01919         \textcolor{comment}{/* We can't fail disk that is not a part of array now. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01920}01920         if (tdisk-\/>\mbox{\hyperlink{structg__raid__disk_a893b44bb63bf0b41d6f140424e0db523}{d\_state}} != \mbox{\hyperlink{g__raid_8h_aaf46a21394a57a2fcac34b1b7b52701c}{G\_RAID\_DISK\_S\_ACTIVE}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01921}01921                 \textcolor{keywordflow}{return} (-\/1);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01922}01922 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01923}01923         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01924}01924 \textcolor{comment}{         * Mark disk as failed in metadata and try to write that metadata}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01925}01925 \textcolor{comment}{         * to the disk itself to prevent it's later resurrection as STALE.}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01926}01926 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01927}01927         \textcolor{keywordflow}{if} (pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_af83a2a95e726587eddda9df693dc9fe3}{pd\_subdisks}} > 0 \&\& tdisk-\/>\mbox{\hyperlink{structg__raid__disk_a830f6bd55251c14ca26a7f8fceb06a89}{d\_consumer}} != NULL)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01928}01928                 \mbox{\hyperlink{g__raid_8h_a4333fbd8d0899facf171aee7b60697f6}{G\_RAID\_DEBUG}}(1, \textcolor{stringliteral}{"{}Writing Promise metadata to \%s"{}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01929}01929                     \mbox{\hyperlink{g__raid_8c_a8ceaeb12952563e6fe9869ed6b8daa5d}{g\_raid\_get\_diskname}}(tdisk));}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01930}01930         \textcolor{keywordflow}{for} (i = 0; i < pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_af83a2a95e726587eddda9df693dc9fe3}{pd\_subdisks}}; i++) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01931}01931                 pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[i]-\/>\mbox{\hyperlink{structpromise__raid__conf_ae8467fc2b525d7517c291153f8c33119}{disk}}.\mbox{\hyperlink{structpromise__raid__disk_a16f4266340575cf4ee5229f5f3d0ad95}{flags}} |=}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01932}01932                     \mbox{\hyperlink{md__promise_8c_aa59a43a69b8ab9246e5c0462bc23d89e}{PROMISE\_F\_DOWN}} | \mbox{\hyperlink{md__promise_8c_aa4244066795df910826a3ef954f8e87e}{PROMISE\_F\_REDIR}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01933}01933                 pos = pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[i]-\/>\mbox{\hyperlink{structpromise__raid__conf_ae8467fc2b525d7517c291153f8c33119}{disk}}.\mbox{\hyperlink{structpromise__raid__disk_aceb1a87bdeded6d666ae56afa3923e92}{number}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01934}01934                 \textcolor{keywordflow}{if} (pos >= 0 \&\& pos < \mbox{\hyperlink{md__promise_8c_a6043ecc0cea629458c18b11a0f79d913}{PROMISE\_MAX\_DISKS}}) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01935}01935                         pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[i]-\/>\mbox{\hyperlink{structpromise__raid__conf_a230625945ea844bdb2d31809448782b5}{disks}}[pos].\mbox{\hyperlink{structpromise__raid__disk_a16f4266340575cf4ee5229f5f3d0ad95}{flags}} |=}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01936}01936                             \mbox{\hyperlink{md__promise_8c_aa59a43a69b8ab9246e5c0462bc23d89e}{PROMISE\_F\_DOWN}} | \mbox{\hyperlink{md__promise_8c_aa4244066795df910826a3ef954f8e87e}{PROMISE\_F\_REDIR}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01937}01937                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01938}01938                 \mbox{\hyperlink{md__promise_8c_adc9e23d231b12a99259b8ea7d2d79b24}{g\_raid\_md\_promise\_print}}(pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[i]);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01939}01939         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01940}01940         \textcolor{keywordflow}{if} (tdisk-\/>\mbox{\hyperlink{structg__raid__disk_a830f6bd55251c14ca26a7f8fceb06a89}{d\_consumer}} != NULL)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01941}01941                 \mbox{\hyperlink{md__promise_8c_a6707745e52b7e36ab54cda898768c4f8}{promise\_meta\_write}}(tdisk-\/>\mbox{\hyperlink{structg__raid__disk_a830f6bd55251c14ca26a7f8fceb06a89}{d\_consumer}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01942}01942                     pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}, pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_af83a2a95e726587eddda9df693dc9fe3}{pd\_subdisks}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01943}01943 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01944}01944         \textcolor{comment}{/* Change states. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01945}01945         \mbox{\hyperlink{g__raid_8c_a342da571518e21e0521b6416c838d00e}{g\_raid\_change\_disk\_state}}(tdisk, \mbox{\hyperlink{g__raid_8h_a2135c7d2f628dbf559cad6d4ea1b5c8f}{G\_RAID\_DISK\_S\_FAILED}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01946}01946         TAILQ\_FOREACH(\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}, \&tdisk-\/>d\_subdisks, sd\_next) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01947}01947                 \mbox{\hyperlink{g__raid_8c_a058db459d5349d2130fda3a02dd2af29}{g\_raid\_change\_subdisk\_state}}(\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01948}01948                     \mbox{\hyperlink{g__raid_8h_a2e56fb1cd5fdab097052e38c28a8c92f}{G\_RAID\_SUBDISK\_S\_FAILED}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01949}01949                 \mbox{\hyperlink{g__raid_8c_ac49cc1991dccaeef0743e0bc4f64e0b5}{g\_raid\_event\_send}}(\mbox{\hyperlink{g__raid__md__if_8m_a910062273088d146e8533398780701eb}{sd}}, \mbox{\hyperlink{g__raid_8h_a11e4d6f6fe0cb9ecaceeb81d2b30a125}{G\_RAID\_SUBDISK\_E\_FAILED}},}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01950}01950                     \mbox{\hyperlink{g__raid_8h_ae6ac3f8d5dcaa73174e3e8bb9dd12f1c}{G\_RAID\_EVENT\_SUBDISK}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01951}01951         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01952}01952 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01953}01953         \textcolor{comment}{/* Write updated metadata to remaining disks. */}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01954}01954         \mbox{\hyperlink{md__promise_8c_aa84eb5d0f9c789e4d981e01fbababb63}{g\_raid\_md\_write\_promise}}(md, NULL, NULL, tdisk);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01955}01955 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01956}01956         \mbox{\hyperlink{md__promise_8c_a44c9bc67c1ca436f79c903575a666c9f}{g\_raid\_md\_promise\_refill}}(sc);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01957}01957         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01958}01958 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01959}01959 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01960}01960 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01961}\mbox{\hyperlink{md__promise_8c_a32012a5d8e1a888af3600167e0b21972}{01961}} \mbox{\hyperlink{md__promise_8c_a3c8423b7d0228bda25c1a262c24db1e9}{g\_raid\_md\_free\_disk\_promise}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__md__object}{g\_raid\_md\_object}} *md,}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01962}01962     \textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__disk}{g\_raid\_disk}} *\mbox{\hyperlink{structdisk}{disk}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01963}01963 \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01964}01964         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__promise__perdisk}{g\_raid\_md\_promise\_perdisk}} *pd;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01965}01965         \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01966}01966 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01967}01967         pd = (\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__promise__perdisk}{g\_raid\_md\_promise\_perdisk}} *)\mbox{\hyperlink{structdisk}{disk}}-\/>d\_md\_data;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01968}01968         for (i = 0; i < pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_af83a2a95e726587eddda9df693dc9fe3}{pd\_subdisks}}; i++) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01969}01969                 \textcolor{keywordflow}{if} (pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[i] != NULL) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01970}01970                         \mbox{\hyperlink{g__raid__md__if_8m_a4df9edb2717b3f7e4c3c903878577a54}{free}}(pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[i], M\_MD\_PROMISE);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01971}01971                         pd-\/>\mbox{\hyperlink{structg__raid__md__promise__perdisk_a1c82e583e44e3ff4d9f7287587a5223b}{pd\_meta}}[i] = NULL;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01972}01972                 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01973}01973         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01974}01974         \mbox{\hyperlink{g__raid__md__if_8m_a4df9edb2717b3f7e4c3c903878577a54}{free}}(pd, M\_MD\_PROMISE);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01975}01975         \mbox{\hyperlink{structdisk}{disk}}-\/>d\_md\_data = NULL;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01976}01976         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01977}01977 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01978}01978 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01979}01979 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01980}\mbox{\hyperlink{md__promise_8c_a22a9ac8faf3c4fd11a7e968660963159}{01980}} \mbox{\hyperlink{md__promise_8c_aeb9a5fa31424ef3bf4212b3a9cc9cbfc}{g\_raid\_md\_free\_volume\_promise}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__md__object}{g\_raid\_md\_object}} *md,}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01981}01981     \textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__volume}{g\_raid\_volume}} *\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}})}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01982}01982 \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01983}01983         \textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__promise__pervolume}{g\_raid\_md\_promise\_pervolume}} *pv;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01984}01984 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01985}01985         pv = (\textcolor{keyword}{struct }\mbox{\hyperlink{structg__raid__md__promise__pervolume}{g\_raid\_md\_promise\_pervolume}} *)\mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a1f432fb732072f5b196b570dd1d1e998}{v\_md\_data}};}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01986}01986         if (pv \&\& pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a94097bae0d51bd8d9693a3bea313a5f6}{pv\_meta}} != NULL) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01987}01987                 \mbox{\hyperlink{g__raid__md__if_8m_a4df9edb2717b3f7e4c3c903878577a54}{free}}(pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a94097bae0d51bd8d9693a3bea313a5f6}{pv\_meta}}, M\_MD\_PROMISE);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01988}01988                 pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a94097bae0d51bd8d9693a3bea313a5f6}{pv\_meta}} = NULL;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01989}01989         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01990}01990         \textcolor{keywordflow}{if} (pv \&\& !pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a87d7b4b6ae10863075c2b4ad6d95d93b}{pv\_started}}) \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01991}01991                 pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_a87d7b4b6ae10863075c2b4ad6d95d93b}{pv\_started}} = 1;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01992}01992                 callout\_stop(\&pv-\/>\mbox{\hyperlink{structg__raid__md__promise__pervolume_ad8bc77acb4795088f1438c80f7c8f8db}{pv\_start\_co}});}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01993}01993         \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01994}01994         \mbox{\hyperlink{g__raid__md__if_8m_a4df9edb2717b3f7e4c3c903878577a54}{free}}(pv, M\_MD\_PROMISE);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01995}01995         \mbox{\hyperlink{g__raid__md__if_8m_aaa46aabd2a891668d71cec64e90b4848}{vol}}-\/>\mbox{\hyperlink{structg__raid__volume_a1f432fb732072f5b196b570dd1d1e998}{v\_md\_data}} = NULL;}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01996}01996         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01997}01997 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01998}01998 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l01999}01999 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l02000}\mbox{\hyperlink{md__promise_8c_a5d0559936596b509a6a3212f366b8412}{02000}} \mbox{\hyperlink{md__promise_8c_afe12d0e175b23122f5362748008d044f}{g\_raid\_md\_free\_promise}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structg__raid__md__object}{g\_raid\_md\_object}} *md)}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l02001}02001 \{}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l02002}02002 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l02003}02003         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l02004}02004 \}}
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l02005}02005 }
\DoxyCodeLine{\Hypertarget{md__promise_8c_source_l02006}\mbox{\hyperlink{md__promise_8c_a2ad8bd0da14b169efe78c7d6462f69d8}{02006}} \mbox{\hyperlink{md__promise_8c_a2ad8bd0da14b169efe78c7d6462f69d8}{G\_RAID\_MD\_DECLARE}}(promise, \textcolor{stringliteral}{"{}Promise"{}});}

\end{DoxyCode}
