\input{configpres}

\subsection{UBI - Unsorted Block Images}
\title{\lq UBI - Unsorted Block Images\rq}
\maketitle

\begin{frame}
\tableofcontents
\end{frame}

\subsubsection{Concepts}

\begin{frame}
\frametitle{UBI}
\begin{beamerboxesrounded}[shadow=true]{Provides}
\begin{itemize}
\item Volume manager for FLASH
\item Full device wear leveling
\item Non-linear Logical to Physical Eraseblock mapping
\item Bad block handling
\item Data integrity mechanisms
\end{itemize}
\end{beamerboxesrounded}
\end{frame}

\begin{frame}
\frametitle{Layers}
\begin{beamerboxesrounded}[shadow=true]{UBI works on top of MTD}
\includegraphics[scale=0.325]{images/ubi-big-picture.png}
\end{beamerboxesrounded}
\end{frame}

\begin{frame}
\frametitle{UBI Eraseblock mapping}
\begin{beamerboxesrounded}[shadow=true]{Volume management}
\begin{center}
\includegraphics[scale=0.3]{images/ubi.png}
\end{center}
\end{beamerboxesrounded}
\end{frame}

\begin{frame}
\frametitle{UBI User interface}
\begin{beamerboxesrounded}[shadow=true]{Volume type}
\begin{itemize}
\item static
\begin{itemize}
\item used for a single binary
\item no filesystem
\item easy readable e.g. by a bootloader
\end{itemize}
\item dynamic
\begin{itemize}
\item used for filesystems
\end{itemize}
\end{itemize}
\end{beamerboxesrounded}
\end{frame}

\subsubsection{Flash Metadata}

\begin{frame}
\frametitle{UBI Metadata Storage}
\begin{center}
\includegraphics[scale=0.5]{images/ubi-block.png}
\end{center}
\end{frame}

\begin{frame}
\frametitle{UBI Headers}
\begin{beamerboxesrounded}[shadow=true]{Metadata}
\begin{itemize}
\item Erasecount header
\item Volume information header
\end{itemize}
\end{beamerboxesrounded}
\end{frame}

\begin{frame}
\frametitle{UBI Headers}
\begin{beamerboxesrounded}[shadow=true]{Volume information header}
\begin{itemize}
\item Volume id
\item Logical eraseblock number in volume
\item Version counter
\end{itemize}
\end{beamerboxesrounded}
\end{frame}

\begin{frame}
\frametitle{UBI Device Scan}
\begin{beamerboxesrounded}[shadow=true]{Metadata retrieval}
\begin{center}
\includegraphics[scale=0.4]{images/ubiscan.png}
\end{center}
\end{beamerboxesrounded}
\end{frame}

\begin{frame}
\frametitle{UBI}
\begin{beamerboxesrounded}[shadow=true]{Attach time}
\begin{itemize}
\item O(N)
\item Grows linear with FLASH size
\end{itemize}
\end{beamerboxesrounded}
\end{frame}

\begin{frame}
\frametitle{UBI}
\begin{beamerboxesrounded}[shadow=true]{Attach time}
\begin{semiverbatim}
N  = number of eraseblocks

Tp = time to read a single flash page

Hp = number of header pages


Ta = N * Tp * Hp
\end{semiverbatim}
\end{beamerboxesrounded}
\end{frame}

\begin{frame}
\frametitle{UBI attach time}
\begin{beamerboxesrounded}[shadow=true]{Example I: NAND 64MB 1024PEBs 512B
pagesize}
\begin{semiverbatim}
N  = 1024

Tp = 50us

Hp = 1


Ta = 1024 * 50us * 1 = 51.2ms
\end{semiverbatim}
\end{beamerboxesrounded}
\end{frame}

\begin{frame}
\frametitle{UBI attach time}
\begin{beamerboxesrounded}[shadow=true]{Example II: NAND 4GB 8192PEBs 4K
pagesize}
\begin{semiverbatim}
N  = 8192

Tp = 100us.

Hp = 2


\begin{alertenv}
Ta = 8192 * 100us * 2 = 1.6384s
\end{alertenv}
\end{semiverbatim}
\end{beamerboxesrounded}
\end{frame}

\subsubsection{UBI Fastmap}

\begin{frame}
\frametitle{UBI attach time}
\begin{beamerboxesrounded}[shadow=true]{Can we be smarter?}
\begin{itemize}
\item Store metadata in a special volume
\item but ...
\pause
\item Where to store metadata?
\begin{itemize}
\item No static storage space on NAND
\item Metadata update needs to be rare
\item No violation of UBI robustness
\end{itemize}
\end{itemize}
\end{beamerboxesrounded}
\end{frame}

\begin{frame}
\frametitle{UBI metadata volume}
\begin{beamerboxesrounded}[shadow=true]{How to find it?}
\begin{itemize}
\item Split into two volumes
\begin{itemize}
\item Reference volume
\item Data volume
\end{itemize}
\end{itemize}
\end{beamerboxesrounded}
\end{frame}

\begin{frame}
\frametitle{UBI metadata volumes}
\begin{beamerboxesrounded}[shadow=true]{Reference volume}
\begin{itemize}
\item contains information about the metadata volume location
\item is located within the first N physical erase blocks
\item has to be found by scanning
\end{itemize}
\end{beamerboxesrounded}
\end{frame}

\begin{frame}
\frametitle{UBI metadata volumes}
\begin{beamerboxesrounded}[shadow=true]{Data volume}
\begin{itemize}
\item contains information about all physical eraseblocks
\item condenses UBI header data
\end{itemize}
\end{beamerboxesrounded}
\end{frame}

\begin{frame}
\frametitle{UBI metadata volumes}
\begin{beamerboxesrounded}[shadow=true]{Avoid fast updates}
\begin{itemize}
\item by storing a pool list
\item by scanning the erase blocks in the pool list
\item by rewriting metadata only when pool list changes
\end{itemize}
\end{beamerboxesrounded}
\end{frame}

\begin{frame}
\frametitle{UBI metadata volumes}
\begin{beamerboxesrounded}[shadow=true]{Pool list}
\begin{itemize}
\item Configurable number of erase blocks
\item Used for current write operations
\end{itemize}
\end{beamerboxesrounded}
\end{frame}

\begin{frame}
\frametitle{UBI metadata volumes}
\begin{beamerboxesrounded}[shadow=true]{Pool list changes}
\begin{itemize}
\item due to wear leveling
\item due to client (e.g. UBIFS) requirements
\end{itemize}
\end{beamerboxesrounded}
\end{frame}

\begin{frame}
\frametitle{UBI metadata volumes}
\begin{beamerboxesrounded}[shadow=true]{Preserve robustness}
\begin{itemize}
\item by preserving the UBI header semantics
\item by fallback to full scanning mode
\end{itemize}
\end{beamerboxesrounded}
\end{frame}

\begin{frame}
\frametitle{Device Scan}
\begin{beamerboxesrounded}[shadow=true]{Attach mode scheme - w/o Fastmap}
\begin{center}
\includegraphics[scale=0.4]{images/ubiscan.png}
\end{center}
\end{beamerboxesrounded}
\end{frame}

\begin{frame}
\frametitle{Device Scan}
\begin{beamerboxesrounded}[shadow=true]{Attach mode scheme}
\begin{center}
\includegraphics[scale=0.4]{images/ubifast.png}
\end{center}
\end{beamerboxesrounded}
\end{frame}

\begin{frame}
\frametitle{UBI fastmap attach time}
\begin{beamerboxesrounded}[shadow=true]{Example I: NAND 64MB 1024PEBs 512B
pagesize}
\begin{itemize}
\item 51.2ms (UBI)
\item 17.6ms (UBI Fastmap)
\end{itemize}
\end{beamerboxesrounded}~\\
\begin{beamerboxesrounded}[shadow=true]{Example II: NAND 4GB 8192PEBs 4K
pagesize}
\begin{itemize}
\item 1.6384s (UBI)
\item 96.0ms (UBI Fastmap)
\end{itemize}
\end{beamerboxesrounded}
\end{frame}

\begin{frame}
\frametitle{Conclusion}
\begin{beamerboxesrounded}[shadow=true]{Summary}
\begin{itemize}
\item Fastmap provides significant speedup
\item Speedup grows with flash size
\end{itemize}
\end{beamerboxesrounded}
\end{frame}

\begin{frame}
\frametitle{Future directions}
\begin{beamerboxesrounded}[shadow=true]{Further possible optimizations}
\begin{itemize}
\item Compressed fastmap storage
\item Let the bootloader hand the scan table to the kernel
\item Implement supplementary NVRAM support
\end{itemize}
\end{beamerboxesrounded}
\end{frame}

\begin{frame}
\frametitle{Mainline status}
\begin{beamerboxesrounded}[shadow=true]{Code}
\begin{itemize}
\item Merged in Linux 3.7
\item Sponsored by CE Linux Forum (CELF)
\item Designed and implemented by linutronix
\end{itemize}
\end{beamerboxesrounded}
\end{frame}

\subsubsection{UBI Parameters}

\begin{frame}
\frametitle{sysfs Attributes}
\begin{beamerboxesrounded}[shadow=true]{in /sys/devices/virtual/ubi/ubi\textless n\textgreater}
\begin{itemize}
\item eraseblock\_size
\item avail\_eraseblocks
\item total\_eraseblocks
\item volumes\_count
\item max\_ec
\item reserved\_for\_bad
\item bad\_peb\_count
\item max\_vol\_count
\item min\_io\_size
\item bgt\_enabled
\item mtd\_num
\end{itemize}
\end{beamerboxesrounded}
\end{frame}

\begin{frame}
\frametitle{Kernel Configuration}
\begin{beamerboxesrounded}[shadow=true]{UBI}
\begin{itemize}
\item CONFIG\_MTD\_UBI\_WL\_THRESHOLD (Default: 4096)
\item CONFIG\_MTD\_UBI\_BEB\_LIMIT (Default: 20)
\item CONFIG\_MTD\_UBI\_FASTMAP
\item CONFIG\_MTD\_UBI\_GLUEBI
\end{itemize}
\end{beamerboxesrounded}
\begin{beamerboxesrounded}[shadow=true]{UBIFS}
\begin{itemize}
\item CONFIG\_UBIFS\_FS\_ADVANCED\_COMPR
\item CONFIG\_UBIFS\_FS\_LZO
\item CONFIG\_UBIFS\_FS\_ZLIB
\end{itemize}
\end{beamerboxesrounded}
\end{frame}

\subsubsection{}

\input{tailpres}
