summaryrefslogtreecommitdiffstats
path: root/include/libssh/threads.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/libssh/threads.h')
0 files changed, 0 insertions, 0 deletions
ef='#n26'>26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309
\documentclass{book}[12pt]
\usepackage{graphicx}
% \usepackage{fancyhdr}

% \pagestyle{fancy}
\begin{document}

% \headheight 117pt
% \rhead{\includegraphics{zr-logo.eps}}

\author{Gluster}
\title{GlusterFS 1.3 Hacker's Guide}
\date{June 1, 2007}

\maketitle
\frontmatter
\tableofcontents

\mainmatter
\chapter{Introduction}

\section{Coding guidelines}
GlusterFS uses Git for version control. To get the latest source do:
\begin{verbatim}
  $ git clone git://git.sv.gnu.org/gluster.git glusterfs
\end{verbatim}
\noindent
GlusterFS follows the GNU coding
standards\footnote{http://www.gnu.org/prep/standards\_toc.html} for the
most part.

\chapter{Major components}
\section{libglusterfs}
\texttt{libglusterfs} contains supporting code used by all the other components. 
The important files here are:

\texttt{dict.c}: This is an implementation of a serializable dictionary type. It is
used by the protocol code to send requests and replies. It is also used to pass options
to translators.

\texttt{logging.c}: This is a thread-safe logging library. The log messages go to a
file (default \texttt{/usr/local/var/log/glusterfs/*}).

\texttt{protocol.c}: This file implements the GlusterFS on-the-wire
protocol. The protocol itself is a simple ASCII protocol, designed to
be easy to parse and be human readable.

A sample GlusterFS protocol block looks like this:
\begin{verbatim}
  Block Start                            header
  0000000000000023                       callid
  00000001                               type
  00000016                               op
  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx       human-readable name
  00000000000000000000000000000ac3       block size
  <...>                                  block
  Block End
\end{verbatim}

\texttt{stack.h}: This file defines the \texttt{STACK\_WIND} and
\texttt{STACK\_UNWIND} macros which are used to implement the parallel
stack that is maintained for inter-xlator calls. See the \textsl{Taking control
of the stack} section below for more details.

\texttt{spec.y}: This contains the Yacc grammar for the GlusterFS
specification file, and the parsing code.


Draw diagrams of trees
Two rules:
(1) directory structure is same
(2) file can exist only on one node

\section{glusterfs-fuse}
\section{glusterfsd}
\section{transport}
\section{scheduler}
\section{xlator}

\chapter{xlators}
\section{Taking control of the stack}
One can think of STACK\_WIND/UNWIND as a very specific RPC mechanism.

% \includegraphics{stack.eps}

\section{Overview of xlators}

\flushleft{\LARGE\texttt{cluster/}}
\vskip 2ex
\flushleft{\Large\texttt{afr}}
\vskip 2ex
\flushleft{\Large\texttt{stripe}}
\vskip 2ex
\flushleft{\Large\texttt{unify}}

\vskip 4ex
\flushleft{\LARGE\texttt{debug/}}
\vskip 2ex
\flushleft{\Large\texttt{trace}}
\vskip 2ex
The trace xlator simply logs all fops and mops, and passes them through to its child.

\vskip 4ex
\flushleft{\LARGE\texttt{features/}}
\flushleft{\Large\texttt{posix-locks}}
\vskip 2ex
This xlator implements \textsc{posix} record locking semantics over
any kind of storage.

\vskip 4ex
\flushleft{\LARGE\texttt{performance/}}

\flushleft{\Large\texttt{io-threads}}
\vskip 2ex
\flushleft{\Large\texttt{read-ahead}}
\vskip 2ex
\flushleft{\Large\texttt{stat-prefetch}}
\vskip 2ex
\flushleft{\Large\texttt{write-behind}}
\vskip 2ex

\vskip 4ex
\flushleft{\LARGE\texttt{protocol/}}
\vskip 2ex

\flushleft{\Large\texttt{client}}
\vskip 2ex

\flushleft{\Large\texttt{server}}
\vskip 2ex

\vskip 4ex
\flushleft{\LARGE\texttt{storage/}}
\flushleft{\Large\texttt{posix}}
\vskip 2ex
The \texttt{posix} xlator is the one which actually makes calls to the
on-disk filesystem. Currently this is the only storage xlator available. However,
plans to develop other storage xlators, such as one for Amazon's S3 service, are
on the roadmap.

\chapter{Writing a simple xlator}
\noindent
In this section we're going to write a rot13 xlator. ``Rot13'' is a
simple substitution cipher which obscures a text by replacing each
letter with the letter thirteen places down the alphabet. So `a' (0)
would become `n' (12), `b' would be 'm', and so on.  Rot13 applied to
a piece of ciphertext yields the plaintext again, because rot13 is its
own inverse, since: