51 pages
English

ols2006-fs-tutorial-smf

Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres
51 pages
English
Le téléchargement nécessite un accès à la bibliothèque YouScribe
Tout savoir sur nos offres

Description

Linux Filesystems in 21 days 45 minutes ..A Step by Step Introduction to Writing (or Understanding) a Linux FilesystemSteve FrenchLinux Filesystems/Samba De signIBM Linux Technology Centerhttp://svn.samba.org/samba/ftp/cifs-cvs/samplefs.tar.gzLegal StatementThis work represents the views of the author and does not necessarily reflect the views of IBM Corporation.The following terms are trademarks or registered trademarks of International Business Machines Corporation in the United States and/or other countries: IBM (logo), A full list of U.S. trademarks owned by IBM may be found at http://www.ibm.com/legal/copytrade.shtml. Linux is a registered trademark of Linus Torvalds. Other company, product, and service names may be trademarks or service marks of others.O utline● Who am I?● FS background info● Days 1 through 7, basic ops● FS Data Structures● Days 8 and 9● FS O perations● Days 10 - 11 finished our sample● Days 12 - 21 – advanced opsWho Am I?● Author and maintainer of Linux cifs vfs (for accessing Samba, Windows and various SMB/CIFS based N AS appliances)● Me mber of the Samba team, coauthor of CIFS Technical Reference and former SN IA CIFS Working G roup chair● Architect for Filesystems/N FS/Samba in IBM LTCN ote ..● Linux is constantly evolving, interfaces change (even those used by these small samples)!–See Documentation directory of kernel (e.g. feature-removal-schedule.txt) or even better kernel source itself if ...

Informations

Publié par
Nombre de lectures 233
Langue English

Extrait

Linux Filesystems in 21 days 45 minutes ...
A Step by Step Introduction to Writing (or Understanding) a Linux Filesystem
Steve French Linux Filesystems/Samba Design IBM Linux Technology Center
http://svn.samba.org/samba/ftp/cifs-cvs/samplefs.tar.gz
Legal Statement
This work represents the views of the author and does not necessarily reflect the views of IBM Corporation.
The following terms are trademarks or registered trademarks of International Business Machines Corporation in the United States and/or other countries: IBM (logo), A full list of U.S. trademarks owned by IBM may be found at http://www.ibm.com/legal/copytrade.shtml.  
Linux is a registered trademark of Linus Torvalds.
Other company, product, and service names may be trademarks or service marks of others.
Who am I?
Outline
FS background info
Days 1 through 7, basic ops
FS Data Structures
Days 8 and 9
FS Operations
Days 10 - 11 finished our sample
Days 12 - 21 – advanced ops
Who Am I?
Author and maintainer of Linux cifs vfs (for accessing Samba, Windows and various SMB/CIFS based NAS appliances)
Member of the Samba team, coauthor of CIFS Technical Reference and former SNIA CIFS Working Group chair
Architect for Filesystems/NFS/Samba in IBM LTC
Note ...
Linux is constantly evolving, interfaces change (even those used by these small samples)!
See Documentation directory of kernel (e.g. feature-removal-schedule.txt) or even better kernel source itself if unsure about call
The kernel page of lwn.net is particularly useful: summarizing kernel API changes
Examples were built and/or lightly tested on 2.6.16.11 and 2.6.18-rc1
anivagitno ,caec, manipulation, fo ltad   a    , ssd antrrevaieo.grdeai/iiFw/kip://[httikipen.wemstsyle]
A Linux kernel module used to access files and directories. A filesystem provides access to this data for applications and system programs through consistent, standard interfaces exported by the VFS, and enables access to data that may be stored persistently on local media or on remote network servers/devices, or even transient data (such as debug data or kernel status) stored temporarily in RAM or special devices.
elystsmei  s aiFWhatcal organizationroga,eh eiarcrihteenfod thr ste aht ra tmi emelpt datracypesta t aesi  sa sb tfoil fa?emstsye  elif[ ]metsys
)
>16 special purpose local fs
>12 (general) local filesystems (e.g. ext2/3, reiserfs, xfs, UDF, ...)
Lots of samples in kernel:
Filesystems average under 30KLOC
e.g. Ramfs is working 390 LOC example (simpler shmem/tmpfs) and stubs in fs/libfs.c make starting easy
n ha tuxin Linr ellams eb nac smysteilesle fusabna dlb eiaal yvareO Samyno htiL? xune silisaeniml taatplrmfoepfrce tsfe pxreLinux ... f  sn(sfc/ultsreocfs2..., cifs, et nrkwo8
Some common Linux FS FS Name Type Approx. size (1000 LOC) Ramfs Local 0.4 Sysfs Spec. purp. 2 Proc Spec. purp. 4 FUSE Spec. purp. 4 Smbfs (obsol)network 6 Ext3 Local 12 NTFS Local 17 JFS Local 18 CIFS Network 21 Reiserfs Local 22 NFS Network 24 OCFS2 Cluster 31 XFS Local 71
samplefs
Goals for samplefs
Small, understandable (yet extend existing ramfs and rkfs samples)
Easy to compile on reasonably current (e.g. 2.6.9 or later) kernels
Demonstrate basic data structures and concepts that would help one:
Implementing a new fs for Linux
Experimenting with fs Linux
Learning Linux fs concepts to help debugging and/or tuning Linux
Day 1: Basic Module 101...
A Linux filesystem kernel driver:
Can be built as distinct module or
Can be built into vmlinuz itself
Kernel modules usually have:
 (./fs/Kconfig)Entry in Kconfig
New directory (fs/samplefs)
Makefile (fs/samplefs/Makefile)
C Code to do module init/remove
Day 1 – key data structure
We fill in struct file_system_type and information describing our filesystem kernel module
Name of fs
Method to allocate/kill superblock
  • Univers Univers
  • Ebooks Ebooks
  • Livres audio Livres audio
  • Presse Presse
  • Podcasts Podcasts
  • BD BD
  • Documents Documents
Alternate Text