forsyth20121205-174063a80cc13 years agoHistory
260 lines · 6.4 KB · Text
RawDownload
.TH LOGFS 3.SH NAMElogfs \- log-structured file system for flash devices.SH SYNOPSIS.B bind -b '#ʟ' /dev.PP.B /dev/logfsctl.br.B /dev/logfsusers.br.BI /dev/logfs name.br.BI /dev/logfs name boot.PP.B echo fsys.I name.B config.I flash-device.B "> /dev/logfsctl".br.B echo fsys.I name.B format.I boot-area-size.B "> /dev/logfsctl".br.B echo fsys.I name.B open.B "> /dev/logfsctl".br.BI "mount -Ac /dev/logfs" name.I dir.SH DESCRIPTION.I Logfsis a driver level implementation of the Inferno log structuredfilesystem, a file system designed with modern flash devices(such as NAND flash) in mind..I Logfsis itself hardware independent, requiring otherdevices to provide the physical medium. Currently only.IR flash (3)devices are supported..PPThe file system maintains two storage regions on the same medium:a log-structured hierarchical file system that implements all thefunctionality communicable by the 9P protocol(see.IR intro (5)),and a bootpartition that offers a fixed amount of flat storage suitable forholding such things as a kernel boot image, boot parameters etc.  Theboot partition can be accessed and updated without understanding allbut the simplest facts about the hierarchical file system, making iteasy to implement boot loaders with small footprints..PPThe physical layout of the file system varies from medium to medium,so that the specialised features of the medium can be accounted for..PPThe user table is maintained in memory; there is one table, shared betweenall file systems supported by this driver. There is no distinction betweenusers and groups: a user is a group with one member.The user table records a mappingbetween uidsandunames,as well as recording the leader and members of each group. A.I uidis a string naming a user or group that is stored in the file system. A.I unameis the string naming a user or group that is used infile system protocol messages (see.IR intro (5)).There is a distinction so thatunamescan be safely reused, even thoughuidscannot..PPConfiguration and control of the file systems is by writing commands to.BR /dev/logfsctl :.TP.BI fsys " name".brSets the current file system to.IR name ,which must be configured. Subsequent commands, not prefixed with.BI fsys name\fR,will by applied to the name file system..TP.BI [fsys " name\f5] config\fI flash-device".brConfigures file system.I nameto be written to.BI flash (3)device.IR flash-device .This does not initialise or format the filesystem, but simply bind.I nameto.IR flash-device .For each configured.IR name ,two files appear in the device name space,.BI /dev/logfs nameand.BI /dev/logfs name\f5boot\fI.The former serves the 9P protocol giving access to the hierarchical file system;the latter is a fixed size file that represents the boot partition..TP.BI [fsys " name\f5] format \fIbootsize".brFormats the underlying medium as a.I logfsformat file system. Sufficent storage is set aside to create a boot partition of atleast .I bootsizebytes. Some medium implementations (eg, for NAND flash) store file systemparameters (eg, location, size and boot partition size) to enable automaticlocation of file systems and improve bad block detection. These mustbe part of the boot partition so that they are easily accessible to boot loaders,so such medium implementations may also enforce a minimum size for theboot partition..TP.BI [fsys " name\f5] open [-P] [-W]".brInitialises the specified file system, and makes it available for use. The filesystem structure is verified, bad blocks are repaired and, in the case of thelog structured file system, and the log replayed to regenerate the directory structure.The.B -Woption reduces the permission control on.IR wstat (5)requests. Specifically it allows the.BR uid ,.BR gid ,.BR mtime ,and.B permto be changed by anyone.The.B -Poption removes all file access controls, allowing anyone to open any file inany mode..TP.BI [fsys " name\f5] sweep".brForces the log to be swept, if it has been written to since last being swept.The log is normally swept automatically when space is low..TP.BI [fsys " name\f5] sync".brFlush any buffered log or data to the underlying device.Use before shutting down the system if the device is not unmounted.(See notes below.).TP.BI [fsys " name\f5] trace [\fIlevel\f5]".brIf.Ilevelis non-zero, internal diagnostics for the log file system are enabled at thegiven level. If.I levelis zero, or missing, tracing is disabled..TP.BI [fsys " name\f5] unconfig".brremoves the configuration. The file system must not be mounted, or theboot partition open, before doing this..TP.BI uname " uname uid".TP.BI uname " uname \f5:\fPuid".bradds the user with uname.I unameand uid.I uidto the in-memory table.TP.BI uname " uname \f5%\fPnewname".brrenames.I unameto.IR newname ,throughout the user table.TP.BI uname " uname \f5=\fPleader".brsets the group leader to the uname.I leader.TP.BI uname " uname \f5=".brremoves the group leader; then all members are leaders.TP.BI uname " uname \f5+\fPmember".bradd the uname.Imemberto the group.TP.BI uname " uname \f5-\fPmember".brremoves the uname.Imemberfrom the group.SS NotesThe file system log may be subject to a small amount of buffering for efficiencypurposes; therefore, it is necessary to unmount the file system before disconnectingthe power to avoid losing recent updates. Failure to do this does not result ininconsistencies in the file system, but some recent changes will be lost.Equivalently, a.IR wstat (5)of any file or directory, with all fields set to.I no change(also known as a.I wstat.IR flush)will cause the log to be written to disk. Note that during a dismount, and also a.I wstat.IR flush ,a.I wstatflushis also applied to the underlying.IR flash (3)device. Furthermore, since some buffering is used on the log,needless use of.I wstat flushwill consume log space more rapidly than normal, although it will be recovered duringthe next sweep..PPThe log is automatically swept when space is low, so there is not normally anyneed to use the.B sweepcommand. .SH SOURCE.B /liblogfs.br.B /libnandfs.br.B /emu/port/devlogfs.c.br.B /os/port/devlogfs.c.SH SEE ALSO.IR flash (3),.IR ftl (3),.IR kfs (4).SH BUGSThe only medium currently supported is NAND flash. This is detected byrecognising the manufacturer and device ids supplied by the status file ofthe.IR flash (3)device.