Data files are often arranged in a directory structure in a file system. Such file systems may be implemented on storage systems such as disk drives, flash memory, and other data storage devices. A hierarchical directory structure organizes various files into groups that can be browsed and displayed.
Many file systems use a file allocation table otherwise known as FAT. The FAT may be used differently in various applications. In some applications, a FAT may be used to link various clusters of data together into a file that is comprised of several such clusters.
As file systems have become more and more complex, some operations performed on the file system may take several steps. The file system may be vulnerable to corruption if a power disruption or other interruption occurs during such steps and before they are complete.
Directories in a file system are defined with a dummy cluster in a file allocation table as the initial entry. Subsequent clusters in a directory's definition may define any data for the directory that can be changed in a transaction-safe mode. A directory may be modified in a transaction-safe mode by modifying any of the subsequent clusters while tracking changes in a second file allocation table. When the changes have been made to the directory, a pointer to the second file allocation table may be switched to indicate that the second file allocation table is now last known good. The first file allocation table may then be synchronized with the second.
This Summary is provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
In the drawings,
File modifications, including modifications to a directory structure, may be done in a transaction-safe manner by creating directories that have a first data cluster that contains dummy data. Subsequent clusters may contain data that describe the directory. Because a first cluster contains dummy data, the corresponding location in the file allocation table may be changed to point to a new location that may contain updated or modified directory data.
This structure is useful in a transaction-safe file system that uses a last known good copy of a file allocation table and a second or modified copy of a file allocation table. The second copy is used to prepare a file modification transaction and than a flag may be set to indicate that the second copy is now the last known good copy. This atomic modification commits the transaction, after which the two file allocation tables may be synchronized. Such a method may be used to minimize any problems that may occur when a power outage or other disruption might harm a file system because the file system is kept in a known good state even while changes are being processed. Only when the changes are complete is an atomic action used to commit the entire change.
Specific embodiments of the subject matter are used to illustrate specific inventive aspects. The embodiments are by way of example only, and are susceptible to various modifications and alternative forms. The appended claims are intended to cover all modifications, equivalents, and alternatives falling within the spirit and scope of the invention as defined by the claims.
Throughout this specification, like reference numbers signify the same elements throughout the description of the figures.
When elements are referred to as being “connected” or “coupled,” the elements can be directly connected or coupled together or one or more intervening elements may also be present. In contrast, when elements are referred to as being “directly connected” or “directly coupled,” there are no intervening elements present.
The subject matter may be embodied as devices, systems, methods, and/or computer program products. Accordingly, some or all of the subject matter may be embodied in hardware and/or in software (including firmware, resident software, micro-code, state machines, gate arrays, etc.) Furthermore, the subject matter may take the form of a computer program product on a computer-usable or computer-readable storage medium having computer-usable or computer-readable program code embodied in the medium for use by or in connection with an instruction execution system. In the context of this document, a computer-usable or computer-readable medium may be any medium that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device.
The computer-usable or computer-readable medium may be, for example but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, device, or propagation medium. By way of example, and not limitation, computer readable media may comprise computer storage media and communication media.
Computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can accessed by an instruction execution system. Note that the computer-usable or computer-readable medium could be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via, for instance, optical scanning of the paper or other medium, then compiled, interpreted, of otherwise processed in a suitable manner, if necessary, and then stored in a computer memory.
Communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. The term “modulated data signal” means a signal that has one or more of its characteristics set or changed in such a manner as to encode information in the signal. By way of example, and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, RF, infrared and other wireless media. Combinations of the any of the above should also be included within the scope of computer readable media.
When the subject matter is embodied in the general context of computer-executable instructions, the embodiment may comprise program modules, executed by one or more systems, computers, or other devices. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. Typically, the functionality of the program modules may be combined or distributed as desired in various embodiments.
In block 106, the two sets of file allocation tables and bitmaps are synchronized. A last known good (‘LKG’) flag is set to the first set in block 108, resulting in the LKG flag indicated on the first set 102 file allocation table and bitmap. Modifications to the file structure are made in block 110 using unused clusters, resulting in the second set 104 of file allocation table and bitmap being modified. After all modifications are made, an atomic change occurs in block 112 when the last known good flag is set to the second set 104 of modified file allocation table and bitmap. The first set 102 is now outdated, but is re-synchronized in block 106 and the cycle begins anew.
Embodiment 100 illustrates one method for performing a transaction-safe file modification. The file modification may include any type of change to a file system, from creating, modifying, renaming, or deleting a file to creating, modifying, renaming, moving, or deleting a directory. In some cases, multiple smaller actions may be performed in a single task. For example, a first file may be deleted and a second file renamed to take the place of the first file in a single transaction.
The embodiment 200 may be any type of computing device, from a server computer to a personal computer or handheld device such as a cellular telephone, digital camera, personal digital assistant, video recording device, or any other device that stores data using a file system.
In many cases, the data storage device 206 may be a removable data storage device. For example, the data storage device 206 may be a hot swappable hard disk drive, solid state memory stick, a Universal Serial Bus (‘USB’) attached data storage device, memory card, or any other removable data storage device. In other cases, the data storage device 206 may generally be a non-removable device but a user may desire to have protection from brownouts or unexpected power failures.
The processor 202 may be any type of computational device. In some cases, the processor 202 may be a state machine, gate array, specialized processor, or other type of logic device, or the processor 202 may be a general purpose processor capable of executing various instructions.
The operating system software 204 may be software that is executed by a general purpose processor 202, or may be built-in logic in a hardware state machine such as a gate array. In some instances, the operational logic may be a set of processor instructions that are stored on the data storage device 206 or on some other data storage device such as a programmable read only memory device, including those that are erasable as well as those that are not.
The root file directory 304 contains the Pictures subdirectory, which has a starting cluster of 10 and is a subdirectory. The root file directory 304 also contains a file logo.jpg which starts at cluster 100. The Pictures subdirectory 306 contains the subdirectory Christmas, which starts at cluster 07 and the subdirectory Birthday, which starts at cluster 09. The Christmas subdirectory 308 contains PIC—001, starting at cluster 110 and PIC—002 starting at cluster 120. The Birthday subdirectory 310 has PIC—004 starting at cluster 130 and PIC—005 starting at cluster 140.
The file allocation table 312 illustrates a portion of a file allocation table that illustrates the sequencing of the various directories. The file allocation table contains addresses that define the sequence of data clusters that are found on a data storage medium, such as a hard disk drive or data storage card. Each of the directories contains a placeholder cluster 314 that is the first cluster in a cluster chain.
In the example of embodiment 300, the root file directory 304 begins at cluster 02. An address of 03 is contained in the 02 register of the file allocation table 312, indicating that the next cluster in the sequence for the root directory 304 is cluster 03. Similarly, cluster 03 contains an address for cluster 04, which contains an EOF or end of file indicator. Similarly, the Pictures directory begins in cluster 10 and goes to cluster 11. The Christmas directory begins in cluster 07 and ends in cluster 08. The Birthday directory begins in cluster 09 and ends in cluster 12.
For each directory, the placeholder cluster 314 may contain dummy data and merely serve as a link to a second cluster that contains actual directory data. Using this architecture, the second cluster may be modified in a transaction-safe mode by creating a copy of the original data cluster and modifying the data cluster in a previously unallocated cluster. In a duplicate copy of the file allocation table 312, the placeholder cluster 314 assigned for that directory may be modified to point to the newly modified cluster. When the entire transaction is committed, the modified file allocation table will point to the newly modified cluster.
If a placeholder cluster 314 were not used, a change to a first cluster of a subdirectory would cause a change in the parent directory, since the parent directory may be modified to point to a new first directory of the modified subdirectory. Similarly, the parent directory of the previous parent directory may be modified and so on, all the way to the root directory. The use of a placeholder cluster 314 may simplify the modification of a duplicate file allocation table 312 in the instance of a transaction-safe system that uses a duplicate file allocation table.
The bitmap image 316 designates which clusters are allocated. As with the file allocation table 312, each register within the bitmap image 316 represents a specific cluster in the data storage media and corresponds with the file allocation table 312. In the present example, a single bit is used to represent whether the particular cluster is being used, with a 0 indicating that the cluster is unused and a 1 indicating that the cluster is used. The bitmap 316 indicates that clusters 02, 03, 04, 07, 08, 09, 10, 11 and 12 are allocated, which corresponds with the file allocation table 312 as illustrated.
The root directory 404 reflects changes to root directory 304 where the Birthday subdirectory 405 is added. The Birthday subdirectory's starting cluster is 09. Similarly, the Pictures subdirectory 406 reflects changes to the Pictures subdirectory 306 where the Birthday subdirectory was removed.
Each of the directories, including the root directory 404, the Pictures subdirectory 406, the Christmas subdirectory 308, and the Birthday subdirectory 310 retain their initial placeholder clusters 314 as shown in the modified file allocation table 412. The root directory 404 begins in cluster 02, but the changes to the root directory 404 are in the second cluster of the root directory cluster chain, which is now cluster 01 rather than cluster 03 as in embodiment 300. Similarly, changes to the Pictures directory 406 are in the second cluster of the sequence, which is now cluster 13 rather than cluster 11.
The bitmap 416 reflects the modifications to bitmap 316. Clusters 03 and 11 are now unallocated while clusters 01 and 13 are now allocated.
Embodiment 400 illustrates a modification to a file allocation table and bitmap image that may occur when a complex transaction is performed. In the present example, the transaction is to move a directory from one location to another. The transaction involves using a duplicate copy of the file allocation table and bitmap, and performing updates or changes to portions of the file system in unallocated or free clusters. The transaction does not involve modifying existing clusters of data on the data storage medium so that if the transaction is not committed, no data is lost.
The placeholder clusters 314 enable each directory to be referenced by the placeholder cluster. Rather than modifying the data within the placeholder cluster, modified data may be stored in a previously unallocated cluster. This technique may greatly simplify directory structure changes in a transaction-safe environment.
Embodiment 400 illustrates the movement of one subdirectory from a first place in a directory tree to a second place. However, the techniques illustrated in the example may be used for any type of modification to a file structure. For example, creating, modifying, renaming, moving, or deleting files or directories, among other tasks, may be performed using the techniques.
The foregoing description of the subject matter has been presented for purposes of illustration and description. It is not intended to be exhaustive or to limit the subject matter to the precise form disclosed, and other modifications and variations may be possible in light of the above teachings. The embodiment was chosen and described in order to best explain the principles of the invention and its practical application to thereby enable others skilled in the art to best utilize the invention in various embodiments and various modifications as are suited to the particular use contemplated. It is intended that the appended claims be construed to include other alternative embodiments except insofar as limited by the prior art.
This application is a continuation of and claims priority to co-pending U.S. patent application Ser. No. 11/653,585, which was filed on Jan. 16, 2007 and is incorporated by reference in its entirety.
Number | Name | Date | Kind |
---|---|---|---|
5086502 | Malcolm | Feb 1992 | A |
5201044 | Frey et al. | Apr 1993 | A |
5297148 | Harari et al. | Mar 1994 | A |
5469562 | Saether | Nov 1995 | A |
5537636 | Uchida et al. | Jul 1996 | A |
5546389 | Wippenbeck et al. | Aug 1996 | A |
5574907 | Jernigan, IV et al. | Nov 1996 | A |
5699548 | Choudhury et al. | Dec 1997 | A |
5732268 | Bizzarri | Mar 1998 | A |
5734340 | Kennedy | Mar 1998 | A |
5778168 | Fuller | Jul 1998 | A |
5813011 | Yoshida et al. | Sep 1998 | A |
5825734 | Igarashi et al. | Oct 1998 | A |
5832515 | Ledain et al. | Nov 1998 | A |
5850506 | Gordons | Dec 1998 | A |
5907672 | Matze et al. | May 1999 | A |
5983240 | Shoroff et al. | Nov 1999 | A |
6023744 | Shoroff et al. | Feb 2000 | A |
6032223 | Beelitz | Feb 2000 | A |
6037738 | Morita et al. | Mar 2000 | A |
6049807 | Carroll et al. | Apr 2000 | A |
6078999 | Raju et al. | Jun 2000 | A |
6108759 | Orcutt et al. | Aug 2000 | A |
6192432 | Slivka et al. | Feb 2001 | B1 |
6205558 | Sobel | Mar 2001 | B1 |
6286113 | Sembach et al. | Sep 2001 | B1 |
6374268 | Testardi | Apr 2002 | B1 |
6377958 | Orcutt | Apr 2002 | B1 |
6378031 | Kuno et al. | Apr 2002 | B1 |
6470345 | Doutre et al. | Oct 2002 | B1 |
6510552 | Benayoun et al. | Jan 2003 | B1 |
6529966 | Willman et al. | Mar 2003 | B1 |
6571259 | Zheng et al. | May 2003 | B1 |
6594725 | Ando et al. | Jul 2003 | B2 |
6615365 | Jenevein et al. | Sep 2003 | B1 |
6615404 | Garfunkel et al. | Sep 2003 | B1 |
6658437 | Lehman | Dec 2003 | B1 |
6662309 | Ando et al. | Dec 2003 | B2 |
6675180 | Yamashita | Jan 2004 | B2 |
6792518 | Armangau et al. | Sep 2004 | B2 |
6856993 | Verma et al. | Feb 2005 | B1 |
6883114 | Lasser | Apr 2005 | B2 |
6907184 | Yokota et al. | Jun 2005 | B1 |
6922708 | Sedler | Jul 2005 | B1 |
7051251 | Moore et al. | May 2006 | B2 |
7062602 | Moore et al. | Jun 2006 | B1 |
7089448 | Hinshaw | Aug 2006 | B2 |
7174420 | Malueg et al. | Feb 2007 | B2 |
7363540 | Patel et al. | Apr 2008 | B2 |
7613738 | Patel et al. | Nov 2009 | B2 |
7685171 | Beaverson et al. | Mar 2010 | B1 |
7747664 | Patel et al. | Jun 2010 | B2 |
20010016841 | Karasudani | Aug 2001 | A1 |
20010054129 | Wouters | Dec 2001 | A1 |
20020152354 | Harmer | Oct 2002 | A1 |
20030028765 | Cromer et al. | Feb 2003 | A1 |
20030233385 | Srinivasa et al. | Dec 2003 | A1 |
20040030847 | Tremaine | Feb 2004 | A1 |
20040078704 | Malueg et al. | Apr 2004 | A1 |
20040210706 | In et al. | Oct 2004 | A1 |
20040250172 | Patel et al. | Dec 2004 | A1 |
20050027746 | Lin et al. | Feb 2005 | A1 |
20050060316 | Kamath et al. | Mar 2005 | A1 |
20060020745 | Conley et al. | Jan 2006 | A1 |
20070136387 | Malueg et al. | Jun 2007 | A1 |
20070239957 | Lin | Oct 2007 | A1 |
20080172425 | Patel et al. | Jul 2008 | A1 |
20080172426 | Patel et al. | Jul 2008 | A1 |
20080177939 | Patel et al. | Jul 2008 | A1 |
Number | Date | Country | |
---|---|---|---|
20100049776 A1 | Feb 2010 | US |
Number | Date | Country | |
---|---|---|---|
Parent | 11653585 | Jan 2007 | US |
Child | 12611046 | US |