US 20060184723 A1
Host system data files are written directly to a large erase block flash memory system with a unique identification of each file and offsets of data within the file but without the use of any intermediate logical addresses or a virtual address space for the memory. Directory information of where the files are stored in the memory is maintained within the memory system by its controller, rather than by the host. The file based interface between the host and memory systems allows the memory system controller to utilize the data storage blocks within the memory with increased efficiency.
1. A memory system, comprising:
an array of non-volatile charge storing semiconductor memory cells organized into a plurality of individual blocks of memory cells that are simultaneously erased prior to new data being written therein, and
a controller connected with the memory cell array that operates to (a) cause data received by the memory system with offset addresses within a uniquely identified file to be stored in a selected one or more of the blocks of the memory array, (b) keep track of the blocks in which data of the uniquely identified files are stored by their offset addresses, and (c) in response to receiving a command to delete a specific file, cause data of the specific file stored in the selected one or more blocks to be deleted.
2. The memory system of
3. The memory system of
4. The memory system of
This application is a divisional of application Ser. No. 11/060,174, filed Feb. 16, 2005, which application is incorporated herein in its entirety by this reference.
This application relates to the operation of re-programmable non-volatile memory systems such as semiconductor flash memory, and, more specifically, to the management of the interface between a host device and the memory. All patents, patent applications, articles and other publications, documents and things referenced herein are hereby incorporated herein by this reference in their entirety for all purposes.
In an early generation of commercial flash memory systems, a rectangular array of memory cells were divided into a large number of groups of cells that each stored the amount of data of a standard disk drive sector, namely 512 bytes. An additional amount of data, such as 16 bytes, are also usually included in each group to store an error correction code (ECC) and possibly other overhead data relating to the user data and/or to the memory cell group in which it is stored. The memory cells in each such group are the minimum number of memory cells that are erasable together. That is, the erase unit is effectively the number of memory cells that store one data sector and any overhead data that is included. Examples of this type of memory system are described in U.S. Pat. Nos. 5,602,987 and 6,426,893. It is a characteristic of flash memory that the memory cells need to be erased prior to re-programming them with data.
Flash memory systems are most commonly provided in the form of a memory card or flash drive that is removably connected with a variety of hosts such as a personal computer, a camera or the like, but may also be embedded within such host systems. When writing data to the memory, the host typically assigns unique logical addresses to sectors, clusters or other units of data within a continuous virtual address space of the memory system. Like a disk operating system (DOS), the host writes data to, and reads data from, addresses within the logical address space of the memory system. A controller within the memory system translates logical addresses received from the host into physical addresses within the memory array, where the data are actually stored, and then keeps track of these address translations. The data storage capacity of the memory system is at least as large as the amount of data that is addressable over the entire logical address space defined for the memory system.
In later generations of flash memory systems, the size of the erase unit was increased to a block of enough memory cells to store multiple sectors of data. Even though host systems with which the memory systems are connected may program and read data in small minimum units such as sectors, a large number of sectors are stored in a single erase unit of the flash memory. It is common for some sectors of data within a block to become obsolete as the host updates or replaces logical sectors of data. Since the entire block must be erased before any data stored in the block can be overwritten, new or updated data are typically stored in another block that has been erased and has remaining capacity for the data. This process leaves the original block with obsolete data that take valuable space within the memory. But that block cannot be erased if there are any valid data remaining in it.
Therefore, in order to better utilize the memory's storage capacity, it is common to consolidate or collect valid partial block amounts of data by copying them into an erased block so that the block(s) from which these data are copied may then be erased and their entire storage capacity reused. It is also desirable to copy the data in order to group data sectors within a block in the order of their logical addresses since this increases the speed of reading the data and transferring the read data to the host. If such data copying occurs too frequently, the operating performance of the memory system can be degraded. This particularly affects operation of memory systems where the storage capacity of the memory is little more than the amount of data addressable by the host through the logical address space of the system, a typical case. In this case, data consolidation or collection may be required before a host programming command can be executed. The programming time is then increased.
The sizes of the blocks are increasing in successive generations of memory systems in order to increase the number of bits of data that may be stored in a given semiconductor area. Blocks storing 256 data sectors and more are becoming common. Additionally, two, four or more blocks of different arrays or sub-arrays are often logically linked together into metablocks in order to increase the degree of parallelism in data programming and reading. Along with such large capacity operating units come challenges in operating them efficiently.
Many techniques have been developed that overcome to various degrees certain of the problems encountered in efficiently operating such large erase block flash memory systems. The present invention, on the other hand, takes a more fundamental approach by changing the data transfer interface between the memory and host system. Rather than communicating data between them by the use of logical addresses within a virtual address space, as is currently done, a data file is identified by a filename assigned by the host and an offset address within the file. The memory system then knows the host file to which each sector or other unit of data belongs. The file unit being discussed herein is a set of data that is ordered, such as by having sequential offset addresses, and which is created and uniquely identified by an application program operating in a host computing system.
This is not employed by current commercial memory systems since hosts now identify data to the memory system within all files by a common set of logical addresses without identifying the files. By identifying host data by file objects instead of using logical addresses, the memory system controller can store the data in a manner that reduces the need for such frequent data consolidation and collection. The frequency of data copy operations and the amount of data copied are thus significantly reduced, thereby increasing the data programming and reading performance of the memory system. Further, the memory system controller maintains directory and index table information of the memory blocks into which host files are stored. It is then unnecessary for the host to maintain the file allocation table (FAT) that is currently necessary for managing a logical address interface.
An implementation of such a file based interface utilizes a host command to delete a file that is executed by the memory system by rendering the stored file data obsolete in all the memory cell blocks in which they are stored. Memory blocks that then contain only obsolete data as a result of the delete command can be either immediately erased or scheduled for an early erasure. Any memory blocks containing both obsolete data of the deleted file and valid data of another file may be garbage collected as part of the normal operation of the memory system to free up unused memory space for use.
A delete command is not part of existing logical address host/memory interfaces, where the memory system instead typically learns of the deletion of data by the host when the host attempts to write new data to a logical address of existing data. The existing data stored at overwritten logical addresses are then known to be obsolete but the full extent of the host's deletion is not known. Since, by the techniques herein, the memory system keeps track of files, it is directly informed by the host when a file is deleted. The memory controller then identifies the locations of all the data rendered obsolete as a result of the file's deletion, which allows space taken by obsolete data to be reclaimed and prepared to receive new data before it is needed. New data may then be written into pre-erased memory block capacity.
This significantly increases the number of pre-erased memory blocks available for programming and significantly decreases instances of garbage collection being necessarily performed in response to a data write command in order to have enough erased blocks to store the data. Since the block erasures may be done in the background without interfering with programming and reading operations, the performance of the memory system is thereby significantly increased.
Other aspects, advantages, features and details of the present invention are included in a description of exemplary examples thereof that follows, which description should be taken in conjunction with the accompanying drawings.
A current flash memory system and a typical operation with host devices are described with respect to
Host systems that use such memory cards and flash drives are many and varied. They include personal computers (PCs), laptop and other portable computers, cellular telephones, personal digital assistants (PDAs), digital still cameras, digital movie cameras and portable audio players. The host typically includes a built-in receptacle for one or more types of memory cards or flash drives but some require adapters into which a memory card is plugged.
The host system 1 of
The memory system 2 of
A typical controller chip 11 has its own internal bus 23 that interfaces with the system bus 13 through interface circuits 25. The primary functions normally connected to the bus are a processor 27 (such as a microprocessor or micro-controller), a read-only-memory (ROM) 29 containing code to initialize (“boot”) the system, read-only-memory (RAM) 31 used primarily to buffer data being transferred between the memory and a host, and circuits 33 that calculate and check an error correction code (ECC) for data passing through the controller between the memory and the host. The controller bus 23 interfaces with a host system through circuits 35, which, in the case of the system of
The memory chip 15, as well as any other connected with the system bus 13, typically contains an array of memory cells organized into multiple sub-arrays or planes, two such planes 41 and 43 being illustrated for simplicity but more, such as four or eight such planes, may instead be used. Alternatively, the memory cell array of the chip 15 may not be divided into planes. When so divided however, each plane has its own column control circuits 45 and 47 that are operable independently of each other. The circuits 45 and 47 receive addresses of their respective memory cell array from the address portion 19 of the system bus 13, and decode them to address a specific one or more of respective bit lines 49 and 51. The word lines 53 are addressed through row control circuits 55 in response to addresses received on the address bus 19. Source voltage control circuits 57 and 59 are also connected with the respective planes, as are p-well voltage control circuits 61 and 63. If the memory chip 15 has a single array of memory cells, and if two or more such chips exist in the system, the array of each chip may be operated similarly to a plane or sub-array within the multi-plane chip described above.
Data are transferred into and out of the planes 41 and 43 through respective data input/output circuits 65 and 67 that are connected with the data portion 17 of the system bus 13. The circuits 65 and 67 provide for both programming data into the memory cells and for reading data from the memory cells of their respective planes, through lines 69 and 71 connected to the planes through respective column control circuits 45 and 47.
Although the controller 11 controls the operation of the memory chip 15 to program data, read data, erase and attend to various housekeeping matters, each memory chip also contains some controlling circuitry that executes commands from the controller 11 to perform such functions. Interface circuits 73 are connected to the control and status portion 21 of the system bus 13. Commands from the controller are provided to a state machine 75 that then provides specific control of other circuits in order to execute these commands. Control lines 77-81 connect the state machine 75 with these other circuits as shown in
A NAND architecture of the memory cell arrays 41 and 43 is currently preferred, although other architectures, such as NOR, can also be used instead. Examples of NAND flash memories and their operation as part of a memory system may be had by reference to U.S. Pat. Nos. 5,570,315, 5,774,397, 6,046,935, 6,373,746, 6,456,528, 6,522,580, 6,771,536 and 6,781,877 and United States patent application publication no. 2003/0147278.
An example NAND array is illustrated by the circuit diagram of
Word lines 115-118 of
A second block 125 is similar, its strings of memory cells being connected to the same global bit lines as the strings in the first block 123 but having a different set of word and control gate lines. The word and control gate lines are driven to their proper operating voltages by the row control circuits 55. If there is more than one plane or sub-array in the system, such as planes 1 and 2 of
As described in several of the NAND patents and published application referenced above, the memory system may be operated to store more than two detectable levels of charge in each charge storage element or region, thereby to store more than one bit of data in each. The charge storage elements of the memory cells are most commonly conductive floating gates but may alternatively be non-conductive dielectric charge trapping material, as described in United States patent application publication no. 2003/0109093.
The individual blocks are in turn divided for operational purposes into pages of memory cells, as illustrated in
A metapage formed of physical pages of multiple planes, as illustrated in
With reference to
The amount of data in each logical page is typically an integer number of one or more sectors of data, each sector containing 512 bytes of data, by convention.
As the parallelism of memories increases, data storage capacity of the metablock increases and the size of the data page and metapage also increase as a result. The data page may then contain more than two sectors of data. With two sectors in a data page, and two data pages per metapage, there are four sectors in a metapage. Each metapage thus stores 2048 bytes of data. This is a high degree of parallelism, and can be increased even further as the number of memory cells in the rows are increased. For this reason, the width of flash memories is being extended in order to increase the amount of data in a page and a metapage.
The physically small re-programmable non-volatile memory cards and flash drives identified above are commercially available with data storage capacity of 512 megabytes (MB), 1 gigabyte (GB), 2 GB and 4 GB, and may go higher.
A common logical interface between the host and the memory system is illustrated in
Three Files 1, 2 and 3 are shown in the example of
When a File 2 is later created by the host, the host similarly assigns two different ranges of contiguous addresses within the logical address space 161, as shown in
The host keeps track of the memory logical address space by maintaining a file allocation table (FAT), where the logical addresses the host assigns to the various host files are maintained. The FAT table is typically stored in the non-volatile memory, as well as in a host memory, and is frequently updated by the host as new files are stored, other files deleted, files modified and the like. When a host file is deleted, for example, the host then deallocates the logical addresses previously allocated to the deleted file by updating the FAT table to show that they are now available for use with other data files.
The host is not concerned about the physical locations where the memory system controller chooses to store the files. The typical host only knows its logical address space and the logical addresses that it has allocated to its various files. The memory system, on the other hand, through a typical host/card interface, only knows the portions of the logical address space to which data have been written but does not know the logical addresses allocated to specific host files, or even the number of host files. The memory system controller converts the logical addresses provided by the host for the storage or retrieval of data into unique physical addresses within the flash memory cell array where host data are stored. A block 163 represents a working table of these logical-to-physical address conversions, which is maintained by the memory system controller.
The memory system controller is programmed to store data files within the blocks and metablocks of a memory array 165 in a manner to maintain the performance of the system at a high level. Four planes or sub-arrays are used in this illustration. Data are preferably programmed and read with the maximum degree of parallelism that the system allows, across an entire metablock formed of a block from each of the planes. At least one metablock 167 is usually allocated as a reserved block for storing operating firmware and data used by the memory controller. Another metablock 169, or multiple metablocks, may be allocated for storage of host operating software, the host FAT table and the like. Most of the physical storage space remains for the storage of data files. The memory controller does not know, however, how the data received has been allocated by the host among its various file objects. All the memory controller typically knows from interacting with the host is that data written by the host to specific logical addresses are stored in corresponding physical addresses as maintained by the controller's logical-to-physical address table 163.
In a typical memory system, a few extra blocks of storage capacity are provided than are necessary to store the amount of data within the address space 161. One or more of these extra blocks may be provided as redundant blocks for substitution for other blocks that may become defective during the lifetime of the memory. The logical grouping of blocks contained within individual metablocks may usually be changed for various reasons, including the substitution of a redundant block for a defective block originally assigned to the metablock. One or more additional blocks, such as metablock 171, are typically maintained in an erased block pool. When the host writes data to the memory system, the controller converts the logical addresses assigned by the host to physical addresses within a metablock in the erased block pool. Other metablocks not being used to store data within the logical address space 161 are then erased and designated as erased pool blocks for use during a subsequent data write operation.
Data stored at specific host logical addresses are frequently overwritten by new data as the original stored data become obsolete. The memory system controller, in response, writes the new data in an erased block and then changes the logical-to-physical address table for those logical addresses to identify the new physical block to which the data at those logical addresses are stored. The blocks containing the original data at those logical addresses are then erased and made available for the storage of new data. Such erasure often must take place before a current data write operation may be completed if there is not enough storage capacity in the pre-erased blocks from the erase block pool at the start of writing. This can adversely impact the system data programming speed. The memory controller typically learns that data at a given logical address has been rendered obsolete by the host only when the host writes new data to their same logical address. Many blocks of the memory can therefore be storing such invalid data for a time.
The sizes of blocks and metablocks are increasing in order to efficiently use the area of the integrated circuit memory chip. This results in a large proportion of individual data writes storing an amount of data that is less than the storage capacity of a metablock, and in many cases even less than that of a block. Since the memory system controller normally directs new data to an erased pool metablock, this can result in portions of metablocks going unfilled. If the new data are updates of some data stored in another metablock, remaining valid metapages of data from that other metablock having logical addresses contiguous with those of the new data metapages are also desirably copied in logical address order into the new metablock. The old metablock may retain other valid data metapages. This results over time in data of certain metapages of an individual metablock being rendered obsolete and invalid, and replaced by new data with the same logical address being written to a different metablock.
In order to maintain enough physical memory space to store data over the entire logical address space 161, such data are periodically compacted or consolidated (garbage collection). It is also desirable to maintain sectors of data within the metablocks in the same order as their logical addresses as much as practical, since this makes reading data in contiguous logical addresses more efficient. So data compaction and garbage collection are typically performed with this additional goal. Some aspects of managing a memory when receiving partial block data updates and the use of metablocks are described in U.S. Pat. No. 6,763,424.
Data compaction typically involves reading all valid data metapages from a metablock and writing them to a new block, ignoring metapages with invalid data in the process. The metapages with valid data are also preferably arranged with a physical address order that matches the logical address order of the data stored in them. The number of metapages occupied in the new metablock will be less than those occupied in the old metablock since the metapages containing invalid data are not copied to the new metablock. The old block is then erased and made available to store new data. The additional metapages of capacity gained by the consolidation can then be used to store other data.
During garbage collection, metapages of valid data with contiguous or near contiguous logical addresses are gathered from two or more metablocks and re-written into another metablock, usually one in the erased block pool. When all valid data metapages are copied from the original two or more metablocks, they may be erased for future use.
Data consolidation and garbage collection take time and can affect the performance of the memory system, particularly if data consolidation or garbage collection needs to take place before a command from the host can be executed. Such operations are normally scheduled by the memory system controller to take place in the background as much as possible but the need to perform these operations can cause the controller to have to give the host a busy status signal until such an operation is completed. An example of where execution of a host command can be delayed is where there are not enough pre-erased metablocks in the erased block pool to store all the data that the host wants to write into the memory and data consolidation or garbage collection is needed first to clear one or more metablocks of valid data, which can then be erased. Attention has therefore been directed to managing control of the memory in order to minimize such disruptions. Many such techniques are described in the following United States patent applications: Ser. No. 10/749,831, filed Dec. 30, 2003, entitled “Management of Non-Volatile Memory Systems Having Large Erase Blocks”; Ser. No. 10/750,155, filed Dec. 30, 2003, entitled “Non-Volatile Memory and Method with Block Management System”; Ser. No. 10/917,888, filed Aug. 13, 2004, entitled “Non-Volatile Memory and Method with Memory Planes Alignment”; Ser. No. 10/917,867, filed Aug. 13, 2004; Ser. No. 10/917,889, filed Aug. 13, 2004, entitled “Non-Volatile Memory and Method with Phased Program Failure Handling”; and Ser. No. 10/917,725, filed Aug. 13, 2004, entitled “Non-Volatile Memory and Method with Control Data Management.”
One challenge to efficiently control operation of memory arrays with very large erase blocks is to match and align the number of data sectors being stored during a given write operation with the capacity and boundaries of blocks of memory. One approach is to configure a metablock used to store new data from the host with less than a maximum number of blocks, as necessary to store a quantity of data less than an amount that fills an entire metablock. The use of adaptive metablocks is described in U.S. patent application Ser. No. 10/749,189, filed Dec. 30, 2003, entitled “Adaptive Metablocks.” The fitting of boundaries between blocks of data and physical boundaries between metablocks is described in patent application Ser. No. 10/841,118, filed May 7, 2004, and Ser. No. 11/016,271, filed Dec. 16, 2004, entitled “Data Run Programming.”
The memory controller may also use data from the FAT table, which is stored by the host in the non-volatile memory, to more efficiently operate the memory system. One such use is to learn when data has been identified by the host to be obsolete by deallocating their logical addresses. Knowing this allows the memory controller to schedule erasure of the blocks containing such invalid data before it would normally learn of it by the host writing new data to those logical addresses. This is described in U.S. patent application Ser. No. 10/897,049, filed Jul. 21, 2004, entitled “Method and Apparatus for Maintaining Data on Non-Volatile Memory Systems.” Other techniques include monitoring host patterns of writing new data to the memory in order to deduce whether a given write operation is a single file, or, if multiple files, where the boundaries between the files lie. U.S. patent application Ser. No. 11/022,369, filed Dec. 23, 2004, entitled “FAT Analysis for Optimized Sequential Cluster Management,” describes the use of techniques of this type.
To operate the memory system efficiently, it is desirable for the controller to know as much about the logical addresses assigned by the host to data of its individual files as it can. Data files can then be stored by the controller within a single metablock or group of metablocks, rather than being scattered among a larger number of metablocks when file boundaries are not known. The result is that the number and complexity of data consolidation and garbage collection operations are reduced. The performance of the memory system improves as a result. But it is difficult for the memory controller to know much about the host data file structure when the host/memory interface includes the logical address space 161 (
The improved interface between a host and memory system for the storage of mass amounts of data eliminates use of the logical address space. The host instead logically addresses each file by a unique fileID (or other unique reference) and offset addresses of units of data (such as bytes) within the file. This file address is given directly to the memory system controller, which then keeps its own table of where the data of each host file are physically stored. This new interface can be implemented with the same memory system as described above with respect to
This file-based interface is illustrated in
The file-based interface is also illustrated by
With reference to
A set of direct file interface commands from the host system supports the operation of the memory system. An example set of such commands is given in
Another data command is a Remove command. Unlike the other data commands of
The primary difference between the Delete and Erase commands is the priority given to erasing the designated file data. The host may use the Erase command to remove secure or sensitive data from the memory at the earliest practical time, while the Delete command causes such data to be erased with a lower priority. Use of the Erase command when powering down the memory system removes sensitive data before the memory device is removed from the host and thus prevents dissemination of that data to other users or host systems during a subsequent use of the memory device. Both of these commands are preferably executed in the background; i.e., without slowing down execution of the primary data commands (
Host commands that relate to directories within the memory system are listed in
The <fileID> parameter can be either a full pathname for the file, or some shorthand identifier for the file, referenced herein as a file_handle. A file pathname is provided to the Direct-File Interface of
Open files may alternatively be identified by a file_handle parameter, which is assigned by the storage device when the file is first created. The storage device can then communicate the shorthand file designation to the host each time the host opens the file. The host may then use the file_handle with the Write, Insert, Update, Read, Close and Close_after commands of an open file. Access to the file by the host will typically be quicker than if a full pathname is used since the hierarchy of the file directory need not be navigated. When a file is first opened by use of the Open command, the full pathname is usually used since a file_handle has likely not yet been assigned to that file by the memory system. But a file_handle can be used if already available. For the remaining Delete and Erase commands of
The directory commands of
The file_handle is a shortform identifier that is returned at the Direct-File Interface to the host by the mass storage device in response to an Open command. It is convenient to define the file_handle as being the pointer to the FIT that exists in the directory entry for the file. This pointer defines the logical FIT block number and logical file number within that block for the file. Using this as a file_handle allows the file FIT entries to be accessed without first having to search for the file in the file directory. For example, if the memory device can have up to 64 FIT blocks, and each FIT block can index up to 64 files, then a file with file_handle 1107 has the pointer to its data group entries in the FIT set to logical file 7 in FIT block 11. This file_handle is generated by the memory system controller when directory and FIT entries for a file are created in response to an Open command and becomes invalid in response to a Close command.
A Size command, shown in
When the host issues a Status command (
The host can use the second device busy in combination with the Idle command to allow housekeeping operations to take place within the memory device. After the host sends a command, or a series of commands, that likely creates the need for the device to do a housekeeping operation, the host can send the Idle command. As described later, the memory device can be programmed to respond to an Idle command by initiating a housekeeping operation and at the same time start the second busy described above. A Delete command, for example, creates the need to perform garbage collection, according to the algorithms described below. An Idle command from the host after having issued a series of Delete commands then allows the device time to perform garbage collection that may be necessary for the memory device to be able to respond to a subsequent host Write command. Otherwise, the garbage collection may need to be performed after receiving the next Write command but before it can be executed, thereby significantly slowing down execution of that command.
When a new data file is programmed into the memory, the data are written into an erased block of memory cells beginning with the first physical location in the block and proceeding through the locations of the block sequentially in order. The data are programmed in the order received from the host, regardless of the order of the offsets of that data within the file. Programming continues until all data of the file have been written into the memory. If the amount of data in the file exceeds the capacity of a single memory block, then, when the first block is full, programming continues in a second erased block. The second memory block is programmed in the same manner as the first, in order from the first location until either all the data of the file are stored or the second block is full. A third or additional blocks may be programmed with any remaining data of the file. Multiple blocks or metablocks storing data of a single file need not be physically or logically contiguous. For ease of explanation, unless otherwise specified, it is intended that the term “block” as used herein refer to either the block unit of erase or a multiple block “metablock,” depending upon whether metablocks are being used in a specific system.
A preferred way for the memory system to manage and keep track of the stored data is with the use of variable sized data groups. That is, data of a file are stored as a plurality of groups of data that may be chained together in a defined order to form the complete file. Preferably, however, the order of the data groups within the file is maintained by the memory system controller through use of a file index table (FIT). As a stream of data from the host are being written, a new data group is begun whenever there is a discontinuity either in the logical offset addresses of the file data or in the physical space in which the data are being stored. An example of such a physical discontinuity is when data of a file fills one block and begins to be written into another block. This is illustrated in
The amount of data being transferred through the host-memory interface may be expressed in terms of a number of bytes of data, a number of sectors of data, or with some other granularity. A host most often defines data of its files with byte granularity but then groups bytes into sectors of 512 bytes each, or into clusters of multiple sectors each, when communicating with a large capacity memory system through a current logical address interface. This is usually done to simplify operation of the memory system. Although the file-based host-memory interface being described herein may use some other unit of data, the original host file byte granularity is generally preferred. That is, data offsets, lengths, and the like, are preferably expressed in terms of byte(s), the smallest reasonable unit of data, rather than by sector(s), cluster(s) or the like. This allows more efficient use of the capacity of the flash memory storage with the techniques described herein.
In common existing logical address interfaces, the host also specifies the length of the data being written. This can also be done with the file-based interface described herein but since it is not necessary for execution of the Write command (
The new file written into the memory in the manner illustrated in
So long as the host maintains the file of
An example of the insertion of a block of data 191 into the previously written file of
To further illustrate the use of variable length data groups, a sequence of several write operations involving the same file is shown by
The file of
A second update to the open file is shown in
The offsets of the data of each file are preferably maintained continuous in the correct logical order after the file's creation or modification according to the preceding description. Therefore, as part of executing an Insert command, for example, offsets of the inserted data provided by the host are continuous from the offset immediately preceding the insert and data already in the file after the insert are incremented by an amount of the inserted data. The Update command most commonly results in data within a given address range of an existing file being replaced by a like amount of updated data, so the offsets of other data of the file usually need not be replaced. In place of a separate Update command, data of a file may alternatively be updated by use of the Write command since receipt of data from the host with a range of offsets that already exist in the stored file data can be interpreted by the memory system as an instruction to update the data in that offset range.
It will be noted that all of the data allocation and indexing functions described above and illustrated by
An advantage of directly writing file data from the host into the flash memory in the manner just described is that the granularity or resolution of the data so stored may be maintained the same as that of the host. If a host application writes file data with a one-byte granularity, for example, that data may be also be written into the flash memory with a one-byte granularity. The amount and location of data within an individual data group is then measured in a number of bytes. That is, the same offset unit of data that is separately addressable within the host application file is also separately addressable within that file when stored in the flash memory. Any boundaries between data groups of the same file within a block are then specified in the index table to the nearest byte or other host offset unit. Similarly, boundaries between data groups of different files within a block are defined in the unit of the host offset.
Although not used to write data, it is relevant to consider use of the Delete command to delete a portion of a file since such an operation is converse of the Insert command. The Delete command can be applied to a range of file offset addresses, with the following format: Delete <fileID><offset><length>. Data within the portion of the file beginning with the <offset> and continuing from that address for the <length> of the deletion are deleted. Offset addresses of the remaining data of the file after the deletion are then decremented by the host in order to maintain contiguous offset addresses throughout the file. This is the converse of the Insert command, where the host adds data to the middle of a file and then increments the offsets of the remaining file data after the insert so that the offsets of the modified file are continuous.
It will be noted from
It may also be noted that in addition to the file data updates of
The file of
Garbage collection also normally results in the formation of new and different data groups within the file being consolidated. In the case of
When a file is a candidate for garbage collection, the FIT data group entries for that file are examined to determine whether the file meets set criteria for garbage collection. Garbage collection will proceed when any of the memory cell blocks containing data of the file also contain obsolete data. If not, garbage collection is not necessary. That the file of
Garbage collection should usually not be performed on an opened file since the host can continue to make updates or inserts to the file that generate further obsolete data and/or store the data out of logical offset order. Many such garbage collection operations could then result. But in the case where the number of erased pool blocks falls below a set level, garbage collection of open files may be necessary to provide enough erased blocks for storing new data or other operations.
The closing of a file by the host normally causes garbage collection to be considered for that file. Garbage collection is preferably not performed immediately after a file is closed but rather a closed file is scheduled by the memory controller for garbage collection in the background when it will not interfere with current memory operations. A garbage collection queue may be kept, where a file is added to the queue after closure and then, when there are no other memory system operations of higher priority to be carried out, the file that has been in the queue the longest is selected by the memory controller and garbage collected if that is needed. Such a selection and garbage collection operation can be made, for example, in response to receipt from the host of an Idle command (
Since copying data is the most time consuming part of garbage collection, particularly for large files, the task may be divided into components by copying only a portion of the data of a file at any one time in short bursts. Such partial file copying can then be interleaved with other memory operations, and even take place while the host is transferring data to or from the memory system. The length of the individual copy data bursts can also be increased in response to the number of erased blocks falling below some designated number.
The goal is to perform garbage collection totally in the background without interfering with or slowing down the primary operations of transferring data with the host system. But this is not always possible, particularly if the number of erased blocks that are available in the erased block pool for programming new data becomes less than some preset minimum. Garbage collection is then made a priority and any files in the queue may be garbage collected in the foreground as a priority in order to consolidate data so that additional erased blocks are made available for receiving new data from the host system. If there are no files in the queue, then open files may have to be garbage collected. When garbage collection becomes a priority, the host will usually receive a busy status signal from the memory system and will therefore suspend any programming of new data until an adequate number of erased blocks again exist. On the other hand, if there are a sufficient number or more of erased pool blocks, then the frequency of garbage collection operations may be reduced, and garbage collection that could affect performance of the memory system postponed.
It will be noted that garbage collection is performed on host data files. Garbage collection is initiated on a file in response to the state of the file. When initiated, the index entries of all the data groups of the file in the FIT are examined as part of the process. When a file is garbage collected, its data are copied one data group at a time from their existing block to a newly opened copy block, in the order specified in the data group index entries for the file. This is in contrast to existing flash memory garbage collection, which is based entirely on the status of individual memory cell blocks.
However, it a general rule that only the individual blocks storing data of the file that also contains obsolete data will be garbage collected. So not all blocks storing data of a file will be garbage collected. If a file is stored in only two blocks, for instance, and the first block contains obsolete data and the second block does not, then the first block will be garbage collected while data of the second block are left alone. Valid data are copied from the first block into an erased copy block, and the copy block will then have some erased pages or other capacity left over that is in about the amount of the obsolete data. Use of erased storage capacity less than one block is described below. In the example of
As a modification of the general rule that only those blocks containing obsolete data are garbage collected, once it is determined that a given file is to be garbage collected, any data of the file in a partially filed block is included in the garbage collection operation. Therefore the U2 data in the fifth bock of
Certain file commands of
A significant advantage of the direct file storage system being discussed is that the memory learns immediately when the host deletes a file because the command to do so goes directly to the memory system. The memory controller can then erase the blocks storing data of the deleted file as soon as it can be done without adversely affecting other operations of the memory. The erased blocks are then made available for the storage of new data.
In the implementation being described, either of the commands to Delete or Erase a file causes data of that file to be erased as a direct response. In a typical logical based interface, on the other hand, such a command does not reach the memory controller directly. Rather, the host merely frees up certain segments of the memory logical address space that were occupied by the deleted or erased file. Only when the host later writes data to one or more of those same logical addresses does the memory system know that the data at the reused logical address segments have been obsolete. The memory still does not know that data of other logical address segments occupied by the file have been deleted or erased. The memory only knows when the host writes data to those other logical addresses that the data formerly written to those logical segments have been obsoleted.
A result of filling successive blocks with data for a single file is that when the file is closed and garbage collected, some of the file data may occupy only a portion of a memory cell block. Further, data of a small file may not even fill an entire block. This would result in a considerable amount of the space of individual blocks going unused if only data of one file could be stored in a block. Pages of storage capacity within individual blocks would remain erased and available to store data but would not be utilized.
Therefore, some memory cell blocks desirably store smaller amounts of data from each of two or more files, either entire small files and/or residual file data left over after other blocks have been filled. Residual file data are data of a closed file that do not occupy a full block, and may include one or more data groups. A file map can keep track of data groups of more than one file in a single memory cell block in the same manner as if all the data groups in the block are all of one file. The map of the individual data groups includes the fileID of which the data group is a part. A primary purpose of using common blocks is to minimize unused physical memory storage capacity that can result from writing data of files into the memory as described above. Most commonly, residual data of one or more data groups resulting from the garbage collection of a file will be written into a common block as part of the garbage collection. An example is the garbage collected file of
Alternatively, residual file data may be written directly from the host to a common block during garbage collection when the amount of residual data is known to be an amount that will fit into erased space within one of the designated common blocks. The Close_after command (
When a new data file is programmed into the memory, the data may be written into an open common block containing residual data for one or more other files, beginning at the first available physical location in the block and proceeding through the locations of the block sequentially in order, as an alternative to the method for writing data described previously and illustrated in
Therefore, a number of common blocks are desirably maintained in the memory system for storing common data groups of two or more different files. A common data group may have a size up to that of the storage capacity of a block, with a granularity of one byte. Only one of the common blocks preferably contains data of a given file but may contain more than one data group of the file. Also, a common data group is preferably stored in only one common block, and not divided for storage in multiple common blocks. This avoids garbage collection in multiple common blocks when the data group becomes obsolete. A common block is subject to garbage collection when a data group therein becomes obsolete. Any remaining valid data group(s) in such a common block are written into available erased space in another common block or to an erased pool block, and the common block is then erased. If the common block being garbage collected contains two or more valid data groups from different files, they need not be kept together but rather can be copied to different blocks.
An example of a common block is shown in
The number of blocks designated by the memory system as open common blocks to which residual data of more than one file may be written will normally be just a few but may become many if a large number of files that are garbage collected have residual file data that does not fit the available space in any existing open common block. Residual file data are written into one of the open common blocks that best utilizes the overall memory capacity. When there is not enough erased space in any of the open common blocks, one of the existing common blocks is closed and another common block is opened in its place. Alternatively, an existing open common block need not be closed, and the number of open common blocks may be allowed to increase. The new common block may designated as one of the erased pool blocks but is preferably an incompletely written block that already contains some residual file data, when available, such as the last block in
The third possibility (C) writes the residual file data into a block or metablock unit from the erase pool. Once the residual file data have been written into the completely erased unit, then it becomes a residual unit, and can later be opened by the memory system controller as a common block. In the example shown, possibility (C) would not normally be used since there is room in either of the residual units 2 or 5 for the residual file data.
Alternatively, residual data for a file may be allowed to split into two or more parts for storage in different common blocks. For example, no existing open common block may have sufficient available space for storage of residual data for a specific file and no erased block may be available to be opened as a new common block for the residual file data. In this case, the residual file data may be split between two or more open common blocks.
A common block can be closed before it is full of data. As mentioned above, an open common block with the least amount of erased space available will generally be closed when it is necessary to open another common block in order to store a given amount of residual data of a file. This is in part a consequence of the preferred operation where residual data for a file are not split for storage in different common blocks. When the memory system reports the amount of available memory storage space for new data to the host by responding to the host's Size command (
Because residual file data become obsolete due to the files of which they are a part being deleted or erased, data within the common blocks are also consolidated. For example, whenever residual file data within a common block is designated as obsolete, for whatever reason, that block is added to either the obsolete file data block queue discussed above or another queue. If the data become obsolete because of a host Delete command for its file, then the common block is placed at the end of the queue. But if it results from an Erase command, the common block goes to the head of the queue or otherwise is given priority for garbage collection.
Instead of a single queue, there may be the five different garbage collection queues maintained by the controller during operation of the memory system, entries in the first two queues being given priority:
The priority of items listed in the queues (4) and (5) are about the same, so could be reversed. Alternatively, there can be a more complicated priority system where files and common blocks are selected from the queues (4) and (5) according to a set criteria, perhaps even before one or more of the higher priority queues are empty. There are two goals of managing the garbage collection of common blocks. One is to minimize disruption to normal operation of the memory system that can result from garbage collection of a common block when a data group within the common block becomes obsolete. The other is to minimize indexing updates when a data group from a common block is relocated during garbage collection of the block.
During garbage collection of a common block, all common groups of valid data remaining in the block are copied one at a time to one of the common blocks that have the space. If there is no room in an opened common block for a common group being copied, the common group is written into a block from the erase pool and this block may then be designated as a common block. One of the opened common blocks is then typically closed as part of the process. As with all garbage collection operations, the file index table (FIT) is updated to reflect the new storage locations of the copied data groups.
The garbage collection queues should be recorded in the non-volatile memory. A read-modify-write operation on a page or metapage containing queue information should be performed to add or to remove an entry. Pages containing garbage collection queue information may be in a dedicated block or metablock, or may share a block or metablock with other types of pages, such as a swap block.
Buffering and Use of Metapages During Programming
The foregoing describes operation of a memory system without particular regard to whether the memory cell blocks are linked together as metablocks or not. The file-based interface between the host and memory system, and the related memory system operation described above, work in a memory system using metablocks as well as in one that does not. The trend is definitely to increase the amount of data that are written and read at one time (degree of parallelism) since this directly improves memory performance. The effective width of the individual memory cell blocks in terms of a number of data bits is increased by the use of metablocks formed of two or more such blocks.
One metapage of data for each of three host files are illustrated in
For host file 1, the metapage is shown in
Some flash memories do not allow the programming of data into an erased page more than once. In this case, both of the data groups 1 and 2 of
If it is later desired to write the beginning of another data group 4 of file 3 to the memory metapage of
It is significant to note that the direct file storage technique of the present invention can tolerate such unfilled gaps within blocks of the non-volatile memory. Such gaps cannot easily be tolerated by current systems, where the memory system interfaces with the host through a logical address space, as illustrated by
A portion of the buffer memory in the system controller, such as memory 31 of
The number of active host files with which the memory system deals at any one time may be equal to the number of currently open memory system files, or may be a lesser number. If the allowed maximum number of active files is less than the allowed maximum number of open files, provision must be made for changing the status of a file between active and open and vice versa. To allow this, a temporary storage block in flash memory is designated as a swap block, and data that are less than one metapage in length may be written from a file buffer to a metapage in the swap buffer, and vice versa. An index of valid swapped file buffers is maintained in the swap block. File buffer data are copied to the swap block as an integral number of pages, followed by a single page providing an index of the length and location of each copied file buffer, and the file to which it relates. The swap block is periodically compacted and written to an erased block when it becomes full.
When an open file A must be made active as a result of a host write operation to it, for example, the least recently written active file B is identified, and its file buffer data copied from the controller buffer memory to the next available pages in the swap block. The file buffer data for file A is then identified in the swap block, and are copied to the available space in the controller buffer memory previously allocated to file B.
Data from a file buffer are preferably written to the next available metapage in the open write block for that file in flash memory according to one of the cases shown in
As shown in
The metapage file buffers are also used during garbage collection. Valid data groups of a file can be read from the non-volatile memory and written into the controller buffer metapage for that file. If the file is being reordered at the same time, the data groups are written into the buffer in the order of their host data offsets. The data in each data group, of course, has contiguous logical offsets. Once the metapage buffer is full, its data are programmed in parallel into a new block of the non-volatile memory.
Each file stored in the memory system is defined by its own sequence of index entries, as described above, particularly with respect to
The sequence index entries shown in
Uniformly sized entries, each identifying either a directory or a file, are kept in the file directory 201. A set of contiguous entries is used to specify the elements within a specific directory. A pointer field in an entry specifying a directory identifies the start of other contiguous entries specifying the elements within that directory. A pointer field in an entry specifying a file defines a block number and file number within an associated file index table (FIT) 203.
The FIT 203 contains uniformly sized entries of the data groups, each entry identifying the offset of the start of the data group and the physical location within the memory system of the data group. If the logical addresses are maintained with byte granularity, then the offset of each FIT entry contains a specified number of bytes from the beginning of the file that designates the start of the data group. Similarly, the physical location of the beginning of the data group may be specified with a byte granularity. The contents of FIT entries for an exemplary file at different times were described above with respect to
The pathname supplied by the host for a file is used to traverse the hierarchy of the file directory to obtain the block number and file number within the FIT. The pathname normally includes one, two or more directories and sub-directories. These are used to access the directory within the file directory 201 that contains a file for which access is sought. The filenames within that directory are then searched to find an entry 205 for the filename supplied by the host. When found, the entry 205 provides a pointer to a group of contiguous entries in the FIT 203 for that file. These entries are in the nature of those described with respect to
The pointer of the directory entry 205 of
It will be noted that the file directory pages illustrated in
In a specific implementation, the directory block contains a fixed number of logical pages, which is a designated fraction (e.g. 50%) of the total pages in a memory cell block. A directory block is preferably a metablock dedicated to storage of directory pages but may be a single erase block. It may have the same parallelism as metablocks used for storage of data groups, or it may have a reduced parallelism. When a file directory block becomes full, it is compacted by copying the valid version of each logical page to a new block, before erasing the original block. Immediately after a directory block has been compacted, only a defined fraction (such as 50%) of the pages in the new copy block are written with directory entries. The remaining pages are in the erased state to allow updated or new entries to be written.
When an entry for a directory or file is created, modified, or deleted, the set of entries for the directory containing that directory or file are rewritten in the next available erased page in the directory block, thus keeping entries for a directory contiguous. This is done by a read/modify/write operation on the page previously containing entries for that directory. The previous page then becomes obsolete. The page pointer entry for that logical page is also updated to identify its new physical page. This can be done in the same page programming operation as is used to write the entries for the directory.
If the creation of an entry would cause the set of entries for a directory to overflow a page, it may instead be written as the first entry in another page. The existing page may also be rewritten to move the set of entries for the directory to the end of the page, if necessary. The logical page numbers within the directory block may be reassigned in the page pointers to keep entries for the directory contiguous.
The file index table (FIT) 203 of
The FIT pointer of the file entries in the file directory 201, such as entry 205, has two primary fields. The first is a FIT block number, identifying one of the logical FIT blocks that makes up the FIT. The actual physical block address allocated to a FIT block number is separately managed. The second field of the FIT pointer is a FIT file number, identifying a logical file number within the identified FIT block. The logical file number is translated to a physical file entry location by a specific file pointer stored within the most recently written page of the FIT block.
The FIT does not have a predefined size, and the number of FIT blocks is a function of the number of files and the number of data groups into which the data is organized. New FIT blocks will be created and FIT blocks eliminated during operation of the device.
With reference to
A host file is preferably defined by a set of contiguous data group entries that together define the ordered data groups that form the file. The shaded contiguous group entries shown in the page 215 of
A FIT block is preferably a metablock dedicated to storage of FIT pages. It may have the same parallelism as metablocks used for storage of data groups, or it may have a reduced parallelism. A single erase block may be used instead. Immediately after a FIT block has been compacted, only a defined fraction (such as 50%) of the pages in the block should contain entries. The remaining pages should be in the erased state to allow updated or new entries to be written. More than one FIT block may be necessary when a large number of files are being maintained.
The FIT is updated by writing the data group entries of one or more complete files in the next available unprogrammed page of the FIT block. The file pointer entries for the files are also updated to identify the new locations of the file entries. Both file data group entries and the file pointers are written in the same page program operation. The previous location of the file entry then becomes obsolete in the FIT block. Alternatively, a file entry may be updated by writing it in a different FIT block or a new FIT block. In this case, the file pointer in both blocks should be updated, and the logical pointer for the file in the file directory should be modified.
When a FIT block is full, valid group entries are copied in a compacted form to a new erased block and the previous FIT block is erased. The logical FIT block number and the logical file numbers are not changed by this operation. The number of data group entries should be restricted such that only a defined fraction (such as fifty percent) of the pages are programmed in the compacted FIT block. File entries should be moved to other FIT blocks, if necessary, and their logical pointers in the file directory modified.
It is desirable to keep all the FIT entries of an individual file in one page or metapage. This makes it relatively easy to read all the entries for a file. Although the FIT entries of a file could be chained together by including in each the physical address of the next, this would likely require reading more than one FIT page or metapage. It is also desirable to keep the FIT entries contiguous within the page. This can result in frequently writing new pages as the number of FIT entries increases, particularly when a closed file is opened and data groups are added to it. As new FIT entries are written into a new page, the existing entries are copied from another page and written along with the new entries in the new page. The space taken by the obsolete data in the prior page of the existing entries is retrieved for use when the FIT block is compacted.
The individual data groups, as discussed above, are contained within a single block or metablock, may start on any byte boundary within the block, and may have a length of any integral number of bytes. A header may be added to each data group by the controller as it is written into the memory. Such a header may include two fields. A first field contains a code to identify the start of a data group. This code may be the same for all data groups and is chosen as a bit pattern that infrequently exists in the data stored as part of the groups but it is not necessarily that the code never appear in such data. The start of a data group can be found by the memory controller scanning the stored data for this code and then confirming when it finds the bit pattern of the code that it is indeed the start of a data group and not data within a group. The second field of the header allows this confirmation to be made. This second field is a pointer to the file entry in the FIT 203 (
By including such a header as part of the data stored in the individual data groups, the file to which any data group in the memory belongs may be determined by reading its header and accessing the FIT entry to which the header points. The FIT entry 219 (
Instead of a header being made part of each data group, one header can be provided per file. It is advantageous to be able to identify the full pathname for a file when the location of a FIT entry for a data group in the file is known, and a file header makes this possible. Such a header may be provided as the first of the set of entries in the FIT for a file, or the first of a set of entries for a directory in the file directory.
This file header contains a code to identify it as a FIT file header, and a reverse pointer to the directory entry that is pointing to it. The FIT file header may also contain additional information, such as the length of the file and the number of data groups. Alternatively, the header entry may occupy the space of one or more normal entries.
Similarly, a directory header entry contains a code to identify it as a directory header, and a reverse pointer to the directory entry that is pointing to it. The root directory is identified explicitly in its header. The directory header may also contain additional information, such as the number of entries in the directory.
As an alternative to use of such data group or file headers, an index may be written at the end of each common block to identify the file to which each data group in the common block relates. When a common block is closed, such an index may be written. The index preferably contains a physical byte address within the common block where each data group in that block starts, and a pointer to the FIT entry for that data group. The file to which each common block data group is a part may then be determined by reference to the FIT entry provided in the data group's index entry.
The data group header described above may still be retained, even if these common block indices are employed, if it is desired to have some redundancy of file identification for the data groups stored in the memory.
Since the memory device manages the file directory and file indexing, it may therefore control device configuration parameters that are reported to a host. This is not normally possible when the file system for a device is managed by the host, as in current commercial systems. The memory device may vary the reported storage capacity, for example, both the capacity of the total device and the available unwritten capacity.
The pathname that is used for files at the Direct-File Interface may identify the ID of the storage device itself, and a partition within the storage device. It may be an advantage to allow the memory device to modify the size and number of partitions. If a partition becomes full, unused capacity from one or more other partitions may be reassigned to the full partition. Similarly, unused capacity from other partitions may be assigned if a new partition is created. The device may modify reported capacity for the various partitions, as above.
The directory structure shown in
The structure of
The method described with respect to
An alternative FIT update method causes updated sets of FIT entries to be written in a separate FIT update block, rather than into available erased capacity in the blocks in which they were originally located.
The description below relates to updating group entries in a FIT block as shown in
Reading group entries from the FIT block is as described above. The FIT Block No field of the FIT Pointer defines the logical FIT block. A FIT Block List is contained in a data structure in flash, and provides the information to translate the FIT Block No to the physical address of the block in which it is located. A block address in the FIT Block List is updated whenever a FIT Block is moved during a compaction or consolidation operation.
The File Pointers region of the most recently written page in that block allows the FIT File No value in the FIT Pointer to be translated to a File Pointer designating the start of the set of File Group Entries for the specified file. The File Group Entries may then be read from the FIT Block.
When the content of a group entry, or the number of group entries in the set for a file, is updated, the complete set of entries is rewritten in an erased page. (This is based on as assumption that a page being the minimum unit of programming in the flash memory, with multiple write operations to the same page prohibited between erase operations.) The set may occupy multiple pages, if required.
In the technique currently being described, this page is the next available page in the FIT block. In the revised scheme, this page is the next available page in a separate FIT Update Block. A FIT update block has the same page structure as a FIT block, as shown in
When a FIT Update Block becomes filled, its valid data may be written in compacted form to an erased block, which becomes a new FIT Update Block. There may be as little as a single page of valid data, if updates have related to only a few files. Multiple FIT Update Blocks may be compacted together to a single block. Block compaction is preferred to block consolidation if the update block related to a file or files that are still open, which may continue to be updated.
When group entries for a file are updated in a FIT Update Block, the entries for that file in the original FIT Block become obsolete. At some stage, the original FIT Block must undergo a garbage collection operation to clean it up. This may be done by consolidating valid data in the FIT Block and FIT Update Block into an erased block.
If the number of entries has increased during the update process, and valid data cannot be consolidated into a single erased block, files originally assigned to that FIT block may be reassigned to two or more FIT blocks, and the consolidation may be performed to two or more blocks.
Entries from a FIT Update Block may be consolidated with entries from a FIT Block, and therefore eliminated from the FIT Update Block, whilst entries for other files may remain in the FIT Update Block.
As a further alternative, the Directory Block and FIT Block structures may be merged into a single Index Block structure, which may contain both directory entries and file group entries. An Index Update Block may act as an update block for both directory entries and file group entries, either when there are separate Directory Block and FIT Block structures, or when there is a combined Index Block structure.
It will be recognized that the file directory and FIT described above with respect to
Specific Memory System Operation Example
Operational flowcharts of
Referring initially to
If the host command is other than Read, Write, Insert, Update, Delete, Erase or Idle, in this specific example, such another command is executed by a step 267 of
Returning to the step 253 of
Execution of a Read command in the step 257 of
It is assumed for the rest of this description of the flowcharts that the memory system is operating with metablocks and data are read and programmed in units of metapages, as previously described. A data metapage is read in a step 277 from the initial data group stored in the non-volatile memory that includes the starting byte address. The read data are typically then written into a controller buffer memory (RAM 31 of
When this occurs, the FIT entries for the file are again read, in a step 285, to determine, in a step 287, whether there are any further data groups of the current file to be read. If so, the data group number counter is updated in a step 289 to identify the next data group, and the data group length counter is initialized in a step 291 to the length of the data in the new group. The first metapage of the new data group is then read in a step 277, if it is determined by the step 283 that no other host command is pending. The steps 277 and 279 are then repeated for each metapage of the new data group until all of its data are read, at which time the steps 285 and 287 determine whether yet another data group exists, and so on. When it is determined by the step 287 that all the data groups of the file after the host supplied offset have been read, the processing returns to the step 253 of
In a special case where a file is being used as a circular buffer, reading of the file may be repeated after the step 287 of
An example of the data programming operation 261 of
But if the host designated file is determined by the step 295 not to be opened, a next step 299 asks whether the number of files currently opened by the memory system for programming is equal to or greater than a maximum number N1 that is allowed by the memory system to be open at the same time. The number N1 is preset within the memory system, and can be 5, 8 or some other number of files. If the number of opened files is less than N1, a next step 301 causes a new file to be opened by providing system resources necessary to program data to that file, and the processing proceeds to the step 297. If the number of open files is determined in the step 299 to be equal to or greater than N1, however, a currently opened file first needs to be closed, as indicated by a step 303, before the new file can be opened in the step 301. The basis upon which an open file is selected to be closed in the step 303 can vary but most commonly will be the opened file to which data has least recently been written by the host. It is presumed from this that the host is unlikely to write data to this file in the near future. But if it does, then that file is reopened after another open file is closed, if necessary at that time.
When it is determined in step 297 that at least a metapage of data of the current file are in the controller buffer, a next step 305 determines whether a metablock within the memory array has been opened for programming. If so, data are then programmed from the controller buffer memory into the open metablock, in a step 307. If not, a metablock is first opened, in a step 308, by providing the system resources necessary to program data to that metablock. Data are written into the open memory metablock, in this example, in units of one metapage at a time. Once this unit of data is written, a next step 309 determines whether the opened write metablock is full of data. If not, the process normally proceeds through steps 311 and 313 and back to the step 297 to repeat the process for programming the next metapage of data in the currently opened file.
If the write metablock is determined by the step 309 to be full, however, that metablock is closed, in a step 315, and the FIT is updated, in a step 317, including closing the current data group since a memory metablock boundary has been reached. Metablock entries of the lower priority obsolete metablock garbage collection queue are then updated, in a step 318. During the FIT update in the step 317, it is determined whether filling the write metablock has created another metablock that contains all obsolete data of the current file or is a common metablock containing obsolete data of the current file. If so, that metablock is added to an appropriate lower priority metablock queue by the step 318 for garbage collection. The processing then returns to the step 311 and passes through the step 313 back to the step 297. This time through the steps 305 and 307, the step 308 will open a new write metablock since the previous metablock has just been closed by the step 315.
The step 311 asks, after each metapage of data have been written by a path including the step 307, whether the number of metablocks currently existing in the erased metablock pool is in excess of a minimum number N2 that has been determined necessary to efficiently operate the memory system. If so, the step 313 asks whether another host command has been received. If no other host commend is pending, the step 297 is repeated for the next metapage of data to be programmed into the memory. But if a host command has been received, the FIT is updated, in a step 319, to close the data group that has been written. After updating the metablock entries in a lower priority obsolete metablock garbage collection queue in a step 320 (similar to the step 318 described above), the process returns to the step 253 of
But if it is determined in the step 311 of
The purpose of the garbage collection at this point in the process is to create additional erased metablocks for the erased metablock pool. But only a portion of a garbage collection operation is preferably performed each time by execution of the steps 325, 327 and 329. The copy operation is divided into smaller operations that are spread out over time in order to minimize the duration of the intervals that the memory is unavailable to the host, thereby to minimize the adverse impact on data programming performance. And the partial garbage collection operation is performed only every N3 programming cycles for that same reason. Although the numbers N2 and N3 can be preset in the system, they may alternatively be determined during operation of the memory system to adapt to particular conditions that may be encountered.
Since most of the time required by a complete garbage collection operation on a file or common metablock to provide one or more additional erased metablocks is taken by copying valid data into one or more copy metablocks, it is this copying that is primarily interleaved in
The interleaved nature of this garbage-programming algorithm is illustrated by a timeline of
Execution of the delete file routine 263 of
A first inquiry 339 for a data group is whether it lies in a common metablock or not. If so, a step 341 adds that metablock to one of the common block garbage collection queues. The metablock is placed in the priority common metablock queue if the file is being deleted by an Erase command, and in the other common metablock queue if by the Delete command. Any common metablock with a data group of a file to be deleted is scheduled for garbage collection. If it is determined by the step 339 that the data group is not in a common metablock, a next inquiry 343 determines whether the data group is within a metablock already scheduled for garbage collection by being in the obsolete metablock garbage collection queue. If the metablock is already scheduled for garbage collection, it should not again be added to that same queue. But if not so scheduled, such it is added by a step 345 to one of the obsolete metablock garbage collection queues. The metablock is placed in the priority obsolete metablock queue if the file is being deleted by an Erase command, and in the other obsolete metablock queue if by the Delete command.
After either of the steps 341 or 345 has been executed, or the inquiry of the step 343 is positive, the process for one data group is completed. A next step 347 increments the data group number counter. An inquiry 349 is then made as to whether there is another data group in the file. If so, the processing returns to the step 339 and is repeated for that next data group. If not, it is then known that all metablocks containing data of the file to be deleted have been entered into the obsolete and common metablock garbage collection queues. The FIT is then updated, in a step 351, to obsolete the data group records of the file to be deleted. Records in the FIT of obsolete data groups are then typically eliminated when the FIT is compacted. In a final step 353, the file directory 201 (
The flowchart of
A next set of steps 360, 362 and 366 determine the object of the garbage collection for the selected queue entry, since the process is different for files, common metablocks and obsolete metablocks. The inquiry 360 asks whether it is a file that is being garbage collected. If so, the FIT entries for the file are read in order, in steps 370 and 372, to set certain counters and a count. In the step 370, a first counter is set to the number of data groups in the file and a second counter is set to the number of metapages (length) of data in the first data group of the file. This length may be calculated from the FIT data group entries if their lengths are not part of their entries. Alternatively, the length of each data group may be included as part of its entry in the FIT, as shown in
Returning to the step 360, if the entry selected by the step 358 is not a file, a next inquiry 362 determines whether it is a common metablock that is to be garbage collected. If so, common metablock garbage collection 364 of
Returning to the step 355, if there is a pending garbage collection, that will be further processed. The step 357 of
If it is determined by the step 357 of
The common step 359 inquires whether there are one or more metapages within the current data group that have yet to be copied. This is determined by reference to the data group length counter. One metapage of a valid data group is examined and copied at a time by the subsequent steps. If data are determined by the step 359 to remain in a pending data group, a next inquiry 361 determines whether a copy metablock is open. If so, a metapage of data of the current data group of the file being garbage collected is read from the metablock in which it is stored, by a step 363, and written into the copy metablock, in step 365. The data group length counter is then decremented in a step 367 by one metapage, and the file metapage counter is decremented by one in a step 369.
If it is determined by the step 361 that a copy metablock is not opened, a next step 371 determines whether the file being garbage collected is an open file. If so, a next step 373 opens a copy metablock, and the process then proceeds to the step 363 previously described. But if not an open file, a next step 375 inquires whether the decremented count of the file metapage counter equals the residual metapage count. If not, a copy metablock is opened by the step 373. But if they are equal, that means that there is not a metablock of data remaining in the current file to be copied. Therefore, in a step 377, an open common metablock is identified for copying residual data into it. The processing of steps 363 and beyond then copies the remaining metapages of the current data group of the current file are copied into a common metablock. This path is not taken when it is an open file that is being garbage collected, as determined by the step 371, since other data groups could be written to the current file that would fill out another metablock. After the open file is closed, it is placed in a queue for garbage collection, at which time any residual data are copied to a common metablock by the step 377.
An inquiry 379 of
If the inquiry 389 of
Returning to the inquiry 359, if the data group length count is zero, that means that copying of one data group from the file metablock to the copy metablock has been completed. In this circumstance, a step 401 updates the FIT to reflect this condition. Next, it is determined in a step 403, by reference to the data group number counter, whether the current file being garbage collected includes another data group. If not, garbage collection of the file has been completed. The process then returns to the step 356 to garbage collect the next file or metablock in order from a queue. It will not return to the step 355 since completion of garbage collection of the current file means that there could no longer be garbage collection of a file in progress and which could be resumed.
If from the step 403 it is known that there is at least one more data group of the current file to be copied, it is then determined, in a step 405 whether the metablock containing this next data group also includes other data that is obsolete. As described earlier, metablocks containing obsolete data of a file are garbage collected but those which do not contain obsolete data of a file are preferably not garbage collected unless the metablock is a common metablock or an incomplete metablock containing residual data of the file. Therefore, if it is determined by the step 405 that there are obsolete data in the metablock of the next data group, the data group number counter is updated to the number of the next in order data group, by a step 407, and the data group length counter is initialized in a step 409 with the amount of data in the new data group. The processing then proceeds to the step 361 to copy data of the first metapage from the new data group of the file to the next erased metapage in a copy metablock, in the manner previously described.
But even if it is determined by the step 405 that there are no obsolete data in the metablock in which the next data group exists, garbage collection of the data in that metablock can still occur if either (1) the next data group is in a common metablock or (2) is in an incomplete metablock and the file is a closed file. An inquiry 411 is first made as to whether the current data group is in a common metablock or not. If it is, then a next step 413 adds the common metablock to the common metablock garbage collection queue for later garbage collection, but the processing proceeds with the steps 407 and 409 to update the data group number counter and the data group length counter to that of the next metablock for copying by the steps 361 et seq. However, if the current data group is not in a common metablock, a step 415 inquires whether the current data group is in an incomplete metablock. That is, the step 415 determines whether the current data group exists in a metablock that still has at least a minimum amount of erased capacity (such as the data group F3,D3 of
Returning to the step 356 of
When it is determined by the inquiry 362 of
When the data group length counter is determined by the step 433 to be greater than zero, copying of the current data group commences. By a step 437, a metapage of the current data group is read from the common metablock and, by a step 439, programmed into an open common metablock. In a step 441, the data group length counter is then decremented by one metapage. If doing garbage collection in the foreground, as indicated by the step 443, a step 445 causes the copy metablock metapage counter to be incremented by one. This counter keeps track of the number of metapages of data that have been copied in the current sequence. If this count is determined by a step 447 to be in excess of the predetermined number N4, the process then exits the foreground mode in a step 449. This is followed by the FIT being updated, in a step 451, and the processing then returns to the step 253 of
If the copy metablock metapage counter is determined by the step 447 of
Returning to the step 433 of
But if in step 468 it is determined that the current data group is not in existing residual data, new residual data of which it is a part is then identified, in a step 470. In a step 471, open common block with sufficient space to store all of the data of the new residual data is then identified. This prevents splitting residual data of a file between two or more different metablocks when the residual data contain two or more data groups. This could otherwise happen if the two or more data groups are copied independently. In that case, the first data group could be copied to a common block with enough erased space to store that data group but without enough space to also store the second data group. The second data group would then be copied to a different common block. This would be undesirable since residual data of a file should not be split between two different metablocks. If they are so split, garbage collection of the file or of the common blocks would then take more time.
The data group length counter for the current data group is then initialized by the step 469. The first metapage of data of the current data group is copied from the common metablock into the identified open common metablock, by the steps 437 and 439. However, if the FIT entry is determined by the step 467 not to match the current data group, the processing returns to the step 457 to determine whether another data group exists in the common metablock.
The garbage collection shown in the flowchart of
As an alternative to permanently presetting the numbers N3 and N4, they may be changed by the memory system controller in response to data programming patterns of the host, in order to sustain a uniform data programming speed.
Various States of Memory Blocks During Operation
The diagrm of
In the left-hand column, a block 501 is shown to be in an erased state, within an erased block pool.
In the next column, blocks 503, 505 and 507 each contain some valid data but also have erased capacity in which data from the host may be written. The Write Block 503 is partially written with valid data for a single file, and further data for the file should be written to this block when supplied by the host. The Copy Block 505 is partially written with valid data for a single file, and further data for the file should be written to it when copied during garbage collection of the file. The Open Common Block 507 is partially written with valid data for two or more files, and a residual data group for any file may be written to it during garbage collection.
Blocks 509 and 511 of the next column are full of file data. The File Block 509 is filled with valid data for a single file. The Common Block 51 is filled with valid data for two or more files.
The next to the right hand column of
An obsolete block 523 in the right hand column of
Transitions of individual blocks among the block states illustrated in
a—Erased Block 501 to Write Block 503: Data of a single host file are written to an erased block.
b—Write Block 503 to Write Block 503: Data for a single file from the host is written to a write block for that file.
c—Write Block 503 to File Block 509: Data for a single file from the host is written to fill a write block for that file.
d—File Block 509 to Obsolete File Block 513: Part of the data in a file block becomes obsolete as a result of an updated version of the data being written by the host in a write block for the file.
e—Obsolete File Block 513 to Obsolete Block 523: All valid data in an obsolete file block becomes obsolete as a result of the data being copied to another block during a garbage collection or of the file being deleted by the host.
f—Write Block 503 to Obsolete Write Block 515: Part of the data in a write block becomes obsolete as a result of an updated version of the data being written by the host in the same write block, or of the data being copied to another block during a garbage collection.
g—Obsolete Write Block 515 to Obsolete Write Block 513: Data for a single file from the host is written to an obsolete write block for that file.
h—Obsolete Write Block 515 to Obsolete File Block 513: Data for a single file from the host is written to fill an obsolete write block for that file.
i—Obsolete Write Block 515 to Obsolete Block 523: All valid data in an obsolete write block becomes obsolete as a result of the data being copied to another block during a garbage collection or of the file being deleted by the host.
j—Erased Block 501 to Copy Block 505: Data for a single file is copied from another block to an erased block during a garbage collection.
k—Write Block 503 to Copy Block 505: Data for a single file is copied from another block to a write block for that file during a garbage collection.
l—Copy Block 505 to Copy Block 505: Data for a single file is copied from another block to a copy block for that file during a garbage collection.
m—Copy Block 505 to File Block 509: Data for a single file is copied from another block to fill a copy block for that file during a garbage collection.
n—Copy Block 505 to Write Block 503: Data for a single file from the host is written to a copy block for that file when the file is reopened during a garbage collection.
o—Copy Block 505 to Obsolete Copy Block 517: Part or all of the data in a copy block becomes obsolete as a result of an updated version of the data being written by the host in a write block for the file, or of the file being deleted by the host.
p—Obsolete Copy Block 517 to Obsolete Block 523: All valid data in an obsolete copy block becomes obsolete as a result of the data being copied to another block during a garbage collection or of the file being deleted by the host.
q—Write Block 503 to Open Common Block 507: Residual data for a file is written to a write block for a different closed file during garbage collection.
r—Copy Block 505 to Open Common Block 507: Residual data for a file is written to a copy block containing residual data for a different file during garbage collection.
s—Open Common Block 507 to Open Common Block 507: Residual data for a file is copied from a different block to an open common block during garbage collection.
t—Open Common Block 507 to Obsolete Open Common Block 519: Part or all of the data for one file in an open common block becomes obsolete as a result of an updated version of the data being written by the host in a write block for the file, of the data being copied to another block during a garbage collection, or of the file being deleted by the host.
u—Obsolete Open Common Block 519 to Obsolete Block 523: All valid data in an obsolete open common block becomes obsolete s a result of the data being copied to another block during a garbage collection or of the file being deleted by the host.
v—Open Common Block 507 to Common Block 511: A residual data group for a file is copied from another block to fill an open common block for that file during a garbage collection.
w—Common Block 511 to Obsolete Common Block 521: Part or all of the data for one file in a common block becomes obsolete as a result of an updated version of the data being written by the host in a write block for the file, of the data being copied to another block during a garbage collection, or of the file being deleted by the host.
x—Obsolete Common Block 521 to Obsolete Block 523: All valid data in an obsolete common block becomes obsolete as a result of the data being copied to another block during a garbage collection or of the file being deleted by the host.
y—Write Block 503 to Obsolete Block 523: All valid data for a single file in a write block becomes obsolete as a result of the file being deleted by the host.
z—Copy Block 505 to Obsolete Block 523: All valid data in a copy block becomes obsolete as a result of the data being copied to another block during a garbage collection or of the file being deleted by the host.
aa—File Block 509 to Obsolete Block 523: All data in a file block becomes obsolete as a result of the file being deleted by the host.
ab—Obsolete Block 523 to Erased Block 501: An obsolete block is erased during a garbage collection.
Although the various aspects of the present invention have been described with respect to exemplary embodiments thereof, it will be understood that the present invention is entitled to protection within the full scope of the appended claims.