From owner-svn-src-user@FreeBSD.ORG Tue Nov 26 10:48:08 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D59D9E1C; Tue, 26 Nov 2013 10:48:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C57BD23B8; Tue, 26 Nov 2013 10:48:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rAQAm8mZ021808; Tue, 26 Nov 2013 10:48:08 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rAQAm81D021807; Tue, 26 Nov 2013 10:48:08 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201311261048.rAQAm81D021807@svn.freebsd.org> From: Gleb Smirnoff Date: Tue, 26 Nov 2013 10:48:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r258640 - user/glebius/course/07.io X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Nov 2013 10:48:09 -0000 Author: glebius Date: Tue Nov 26 10:48:08 2013 New Revision: 258640 URL: http://svnweb.freebsd.org/changeset/base/258640 Log: Uncommitted slides from previous lection. Modified: user/glebius/course/07.io/lection.tex Modified: user/glebius/course/07.io/lection.tex ============================================================================== --- user/glebius/course/07.io/lection.tex Tue Nov 26 10:47:38 2013 (r258639) +++ user/glebius/course/07.io/lection.tex Tue Nov 26 10:48:08 2013 (r258640) @@ -28,6 +28,11 @@ \begin{frame} \frametitle{read(2), readv(2), write(2), writev(2)} +\note { + - Run the strategy.d and display typical I/O backtrace, + then continue with slides. The trace will lead us through + the entire lection. +} \begin{itemize} \onslide <1-> { \item {Syscall handler fills in \emph{struct uio}.} @@ -220,4 +225,100 @@ struct vnode { \end{figure} \end{frame} + +\FootReferences{vnode(9), VFS(9)}{sys/tools/vnode\_if.awk, + sys/kern/vnode\_if.src} +\begin{frame}[fragile] +\frametitle{VFS(9) - object oriented approach to vnodes} +Code is generated from vnode\_if.src file by vnode\_if.awk script. +\begin{verbatim} +%% read vp L L L +vop_read { + IN struct vnode *vp; + INOUT struct uio *uio; + IN int ioflag; + IN struct ucred *cred; +}; +\end{verbatim} +\end{frame} + +\FootReferences{vnode(9), VFS(9)}{sys/tools/vnode\_if.awk, + sys/kern/vnode\_if.src} +\begin{frame} +\frametitle{VFS(9) - object oriented approach to vnodes} +\onslide <1-> { +Generated in vnode\_if.h: +\begin{itemize} + \item{struct vop\_read\_args} + \item{VOP\_READ\_APV() declaration} + \item{VOP\_READ() inlined function} +\end{itemize} +} +\onslide <2-> { +Generated in vnode\_if.c: +\begin{itemize} + \item{VOP\_READ\_APV() function} +\end{itemize} +} +\onslide <3> { +VOP\_READ\_APV(): +\begin{itemize} + \item{Does locking assertions} + \item\textbf{Cycles through vop->vop\_default until vop\_read is defined} + \item{Does tracing: ktr(9) and sdt(9)} + \item{Runs VFS\_PROLOGUE(vp->v\_mount)} + \item\textbf{Runs vop->vop\_read} + \item{Runs VFS\_EPILOGUE(vp->v\_mount)} + \item{Does locking assertions} + \item{Does tracing: ktr(9) and sdt(9)} +\end{itemize} +} +\end{frame} + + +\FootReferences{buf(9)}{sys/sys/buf.h, sys/kern/vfs\_bio.c} +\begin{frame}[fragile] +\frametitle{buffer I/O} +\begin{verbatim} +struct buf { + long b_bufsize; /* Allocated buffer size. */ + caddr_t b_data; /* Base pointer. */ + off_t b_offset; /* Offset in the file. */ + long b_resid; /* Remaining bytes for i/o. */ + int b_dirtyoff; /* Offset in buffer of dirty region. */ + int b_dirtyend; /* Offset of end of dirty region. */ + ... + daddr_t b_blkno; /* Underlying physical block number. */ + daddr_t b_lblkno; /* Logical block number. */ + ... + struct vm_page *b_pages[btoc(MAXPHYS)]; + int b_npages; + ... + struct bufobj *b_bufobj; +} +\end{verbatim} +\end{frame} + + +\FootReferences{buf(9)}{sys/sys/bufobj.h, sys/kern/vfs\_bio.c} +\begin{frame}[fragile] +\frametitle{buffer I/O} +\begin{verbatim} +struct bufobj { + struct vm_object *bo_object; /* Place to store VM object */ + struct buf_ops *bo_ops; /* Buffer operations */ + struct bufv bo_clean; /* Clean buffers */ + struct bufv bo_dirty; /* Dirty buffers */ + ... +}; + +TAILQ_HEAD(buflists, buf); +struct bufv { + struct buflists bv_hd; /* Sorted blocklist */ + struct pctrie bv_root; /* Buf trie */ + int bv_cnt; /* Number of buffers */ +}; +\end{verbatim} +\end{frame} + \end{document}