没有合适的资源?快使用搜索试试~ 我知道了~
首页the Microsoft Flash File System
资源详情
资源评论
资源推荐
The Microsoft Flash File System
Peter Torelli
A file system stores and manipulates named objects in a hierarchical manner. Named objects,
called "files," can be organized and stored in sets, or directories. In turn, directories can store other
directories as well, leading to a file-directory hierarchy. The Microsoft MS-DOS and Intel RMX
operating systems use a File Allocation Table (FAT) file system to maintain a file-directory
hierarchy. A flash file system implements this basic file-directory scheme while exploiting the
benefits of flash media. Microsoft has implemented a flash file system for DOS, known as "FFS."
In his article, "Flash File Systems" (DDJ, May 1993), Drew Gislason described an implementation
for a basic flash translation layer. In this article, I'll continue his discussion by examining a byte-
oriented file system for flash media, focusing on the mechanics behind a flash file system based
on the Microsoft data structures.
FTL and FFS
As he himself acknowledged, Drew's device driver isn't really a flash file system, but rather a
layer of code that translates the DOS FAT file system requests from sectors to physical flash
addresses. This approach to using flash media as a DOS disk is commonly known as a "flash
translation layer" (FTL). Under this scheme, DOS still uses its FAT file system to process file and
directory operations, but the FTL block device driver accesses the media. The device driver
maintains the organization of the data within the media by means of special headers that describe
the arrangement of the sectors in each block. When the DOS FAT file system needs to read a
sector, the FTL processes the request by looking up that sector's physical address in its headers
and returning the requested data to DOS. The same process occurs for writes, unless no clean flash
space exists. In this case, the FTL driver performs a cleanup to reclaim deallocated space and then
performs the write.
FFS departs from the sector-oriented scheme by organizing and storing byte-sized data within
various structures. Unlike an FTL device driver, the DOS FAT file system plays no part in FFS;
instead, an "installable file system" enters the picture. DOS provides an interface for non-FAT file
systems commonly known as the "INT2F Network Redirector Interface;" see Figure 1. The
redirector accepts requests from DOS at a level above that of a specific file system, making it
possible for any type of storage device or network computer to interface with DOS. The FFS
interface to DOS works the same way.
Unlike the device driver, FFS performs no low-level I/O on the flash media. Instead, a PCMCIA-
compliant memory card device driver is needed to perform certain functions through the DOS
generic IOCTL call. BIOS vendors such as SystemSoft, AMI, Award, Phoenix, and Intel provide
these PCMCIA drivers.
Understanding FFS
Three concepts need to be understood before implementing an FFS: FFS data structures, their
arrangement in the media, and the basic manipulation of the data structures inherent to a file
system. (A fourth element, the interface to the OS, requires a separate discussion. See Andrew
Schulman's Undocumented DOS, Addison-Wesley, 1993, for a description of the DOS INT2F
redirector interface.)
Linked lists form the basis of FFS. Files, directories, and data are all stored in linked lists. The
different types of data structures described here serve as the links in these lists. Microsoft defines
four different structures for storing and arranging data in the FFS format: file entry, directory
entry, file info, and boot record. The boot record structure contains data describing the media's
geometry (size, number of blocks, erase block size, and so on), as well as FFS version
information. (Since only one copy of the boot record exists, I'll exclude it when I refer to "data
structures.")
The file-directory hierarchy exists in the file-entry directory-entry list (FEDE). In an FFS-
formatted flash card, the information displayed by typing a DIR command corresponds to the file
and directory entries in that directory's FEDE chain, as shown in Figure 2. All files or subdirectory
entries at the same level are part of one FEDE chain and are referred to as "siblings." If a
subdirectory exists in that FEDE chain, it points to another FEDE chain. If more subdirectories
exist in that FEDE chain, the tree continues.
Actual file-entry file data resembles the FEDE list, except that each entry in the file's list is a file-
info structure. This list of file-info structures points sequentially to the regions of the card that
contain the file's data. FFS performs a read-file request by locating the proper file entry, traversing
its file-info chain, and returning the requested data.
File-entry and directory-entry structures contain three pointers: sibling, primary, and secondary
(see Listing One). The sibling pointer always points to the next entry in the same level as that
structure. The primary pointer of a directory entry points to the first entry in that directory's FEDE
chain. The primary pointer of a file entry points to its file-info chain. The secondary pointers of
both structures point to files or directories of the same name that supersede the existing structures.
File-info structures point to "extents," regions of the card that contain file data. The maximum size
of an extent is 65,535 bytes. Like file and directory entries, file-info structures contain sibling and
secondary pointers, but the primary pointer has been replaced by an extent pointer. The extent
pointer points to the first extent of that file's data. The sibling pointer addresses the next file-info
structure in the chain, and the secondary pointer indicates where to find updated or superseded
extent data.
Allocation of Flash Media Space for Structures and File Data
The pointers I've just discussed don't explicitly reference the physical address of a structure or
extent within a block; instead, they point to a block-allocation member, which in turn points to the
physical location of that particular structure. Which brings us to the second detail of FFS: block-
allocation structures and members.
Each erase block contains one block-allocation structure (BAS). The BAS in Listing Two exists at
the topmost address range of every erase block. It contains the block's logical number and erase
count, whether or not it is a spare, and other block-specific fields. It also marks the starting point
to the chain of block-allocation members (BAMs). FFS uses the BASs to determine the logical
block ordering (that is, by locating the boot record or finding a spare block).
To maintain organization of the data structures and file extents, FFS uses BAMs; see Listing Two.
These 6-byte fields begin at the top of each erase block, just below the BAS, and grow downward
as more structures and extents are written to that block. They contain the length of the pointed-to
data region, the beginning offset of that data relative to address zero of that block, and a status
field indicating whether or not the data being pointed to is valid or deleted. FFS uses BAMs to
locate the physical offset of a data structure or extent by determining if the structure or extent has
been deleted via the status field and assisting FFS in performing reclaim.
As FFS writes files or directories to a block, the data structures and extents grow from address
zero of the block toward the top and allocation members grow downward from top to bottom; see
Figure 3.
剩余15页未读,继续阅读
qiweiliu
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- RTL8188FU-Linux-v5.7.4.2-36687.20200602.tar(20765).gz
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
- SPC统计方法基础知识.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1