This invention relates to a semiconductor memory system which uses an electrically rewritable nonvolatile memory, and more particularly, to a method of implementing a snapshot function of memory contents in a storage system which uses a flash memory as a nonvolatile memory.
A semiconductor memory system which is equipped with a flash memory and has a memory control function of preventing execution of a deletion cycle for each change of data stored in the flash memory has been known (e.g., U.S. Pat. No. 5,479,638). The deletion cycle means that a memory cell of a block to be deleted is deleted after programming (data writing) is complete. According to this memory system, the execution of the deletion cycle is prevented by programming update data in an unused part of a memory block without overwriting changing target data itself with the update data unlike a hard disk. However, the programmed memory block is periodically cleaned up. To execute the process, the memory system includes a flag indicating that a sector of each memory block is unused, used, or invalid, and a map for direct correspondence between an eternally provided logical address and a physical address of the memory block.
One of backup functions incorporated in the storage system is a snapshot function. This snapshot function enables a user to save contents of a past data file to thereby restore the contents later. The conventional semiconductor memory system such as that of U.S. Pat. No. 5,479,638 has a feature that data before and after updating temporarily coexist in the memory because update data is written without overwriting changing target data. This means that contents of a past data file are saved. However, the conventional semiconductor memory system treats a memory part which has stored the data before updating as invalid, and executes control to inhibit access from the outside of the memory system. Accordingly, even when the user wishes to restore the past data file, in the case of the conventional example, irrespective of the data file remaining somewhere in the semiconductor memory system, the user cannot access the data before updating, which creates a problem of disabled effective utilization.
In the case of realizing a snapshot function in the storage system which uses a hard disk drive as a recording medium, a recording medium controller must write past and current contents (or a difference from the past content) of the data file to manage addresses thereof. Accordingly, to access latest data and past data of the snapshot function, a plurality of logical addresses must be converted. This address conversion increases loads on the recording medium controller, which creates another problem.
This invention has been made in view of the aforementioned problems, and it is an object of this invention to enable data backing-up and to reduce loads on a controller in a semiconductor memory system equipped with a flash memory.
This invention provides a storage system for reading/writing data of a host computer (or host apparatus), in which a first data is stored according to a write request from the host apparatus which has designated a first logical address, then a second data is stored according to the write request from the host apparatus which has designated the first logical address and, after the first data and the second data are stored, one of the first data and the second data can be selectively output according to a read request from the host apparatus which has designated the first logical address.
Further, this invention provides a storage system including a flash memory and a memory controller, in which the memory controller is connected to the flash memory to control the flash memory, the flash memory includes a plurality of blocks that can be collectively deleted by the memory controller, each block is divided into a plurality of pages as write units for the memory controller, and the memory controller stores the first data and the second data item in different pages.
In the storage system, in which an address conversion table for storing physical addresses of at least two pages storing data written by designating a logical address from one of logical addresses to be designated by the read request is held in nonvolatile storage unit.
In the storage system of this invention, a page status register for storing one page status allocated to each page is held in the nonvolatile storage unit, and page statuses that can be detected by the memory controller include the at least following four statuses: (1) a status of storing data lastly written by designating a corresponding logical address, (2) a status of storing not latest data written by designating a corresponding logical address, (3) a status of storing invalid data not needed to be stored any more, and (4) a data unwritten status after deletion.
Further, this invention provides a semiconductor memory system, including: a flash memory including a plurality of blocks that can be collectively deleted and a plurality of pages obtained by dividing each block into a plurality of areas to store data; and a memory controller for controlling one of writing and reading in the flash memory by the page units and batch deletion by the block units, in which: the memory controller performs one of reading and writing data of a memory chip based on a logical address included in a request received from a host apparatus; the memory controller includes: a request judgment unit for judging which one of a latest data write request, a snapshot acquisition request, and a release request the received request is if the received request is a write request, and which of a read request of the latest data and a snapshot read request the received request is if the received request is a read request; an address conversion unit for managing a physical address of the page corresponding to the logical address included in the request; a page status setting unit for managing which of valid, invalid, and unwritten statuses stored data is for each page of each block; a snapshot management unit for managing a snapshot generation upon reception of the snapshot acquisition request, the read request, or the release request; an access destination deciding unit for referring to the address conversion unit, the status setting unit, and the snapshot management unit from the logical address included in the request judged by the request judgment unit to decide a physical address of a page to be accessed according to the request; and an access control unit for accessing the decided page according to the request; the address conversion unit includes: a first physical address group for storing a physical address of a page for storing the latest data for each logical address; and a second physical address group for storing a physical address of a page for storing the snapshot for each logical address, and a physical address for each snapshot generation; and the snapshot management unit sets validity or invalidity of an address group for each snapshot generation constituting the second physical address group.
According to this invention, data contents can be saved in the semiconductor memory system at an optional point of time according to the request from the recording medium controller (memory controller), so it is possible to use data after updating and data before updating by one logical address. Moreover, when the snapshot function is realized in the storage system which uses the semiconductor memory system as the recording medium, it is possible to reduce loads on the recording medium controller.
Furthermore, a snapshot generation can be updated for each update of data written in the semiconductor memory system, and usability of the semiconductor memory system can be enhanced.
Referring to the drawings, embodiments of this invention will be described below.
The flash memory 1040 includes one or more memory chips 1041 to 1043 which have enough capacities according to a storage capacity of the semiconductor memory system 1000. The nonvolatile RAM 1030 is a semiconductor memory capable of reading or writing data by byte units, e.g., a magneto-resistance memory or a phase-change memory. This is preferably a nonvolatile storage medium which has a rewriting life longer than that of the flash memory 1040.
The disk interface 1010 is an interface mechanism connected to an external host computer (host apparatus) 1100, and transmits read data stored in the semiconductor memory system 1000 to the host computer 1100 or receives write data to be stored in the semiconductor memory system 1000 from the host computer 1100 in response to a read/write command received from the host computer 1100. The host computer 1100 designates a data storage destination for requesting reading/writing based on a logical address. This logical address is a virtual address different from a physical address used for directly accessing the flash memory 1040.
A configuration of the disk interface 1010 and a protocol of transmission or reception of a command or data should preferably be compliant with interface specifications (e.g., parallel ATA, serial ATA, or SCSI) having compatibility with a standard hard disk drive.
Each of the memory chips 1041 to 1043 of the flash memory 1040 is a nonvolatile semiconductor memory having a structure where data is written by a page unit, and deleted by using a block constituted of a plurality of pages as a unit. Each chip includes a plurality of blocks.
The memory controller 1020 includes a microprocessor connected to the disk interface 1010, the flash memory 1040, and the nonvolatile RAM 1030 to control these components. The memory controller 1020 interprets a command (the read/write command) received from the host computer 1100 via the disk interface 1010, transmits/receives data to/from the host computer 1100 via the disk interface 1010, or executes access (read/write) to the nonvolatile RAM 1030 or access (read/write/delete) to the memory chips 1041 to 1043.
Five types of commands which can be interpreted by the memory controller 1020 and functions thereof will be described below.
The memory controller 1020 uses an address conversion table 1031 listing correspondences between logical addresses and physical addresses to manage where, i.e., which physical address page of which memory chip, data corresponding to a logical address designated by the host computer 1100 is stored.
In this address conversion table 1031, a correspondence is set between one logical address and two physical addresses (first and second physical addresses hereinafter). The first physical address indicates a storage position of data lastly written in the logical address. The second physical address indicates a storage position of data written in the logical address at a point of time when the host computer 1100 instructs a snapshot.
The address conversion table 1031 is stored in the nonvolatile RAM 1030, and the memory controller 1020 rewrites contents thereof according to a change in correspondence between a logical address and a physical address. However, a storage destination of the address conversion table 1031 may be a part of the flash memory 1040.
The memory controller 1020 uses a page status register 1032 for managing which status each page included in the memory chip is in. This page status register 1032 stores a status value obtained by encoding a predefined page status based on a value of a predetermined number of bits (e.g., 4 bits). For example, the following four values are defined for status values indicating page statuses. Each status value is represented by a hexadecimal number.
The page status register 1032 holds the status values by block units. For example, when a page status value of a certain block is “880F”, first and second pages include invalid data, a third page includes latest data corresponding to a certain logical address, and a fourth page is unwritten. The example where the number of bits for the page status value is represented by 4 bits is described. However, the number of bits only needs to be compliant with a type of a status value, and a status value may be represented by the smaller number of bits such as 3 bits or 2 bits.
The page status register 1032 is stored in the nonvolatile RAM 1030, and the memory controller 1020 rewrites contents according to a change in page status. However, a storage destination of the page status register 1032 may be a part of the flash memory 1040.
The memory controller 1020 uses a snapshot flag 1033 for managing a status as to whether the host computer 1100 is using the snapshot function of the semiconductor memory system 1000. This snapshot flag 1033 is stored in the nonvolatile RAM 1030, and the memory controller 1020 rewrites contents according to a change in use status. However, a storage destination of the snapshot flag 1033 may be part of the flash memory 1040.
In the example shown in the figures, to simplify description, logical addresses that can be designated from the host computer 1100 are sector units (1 sector=512 bytes), and a range thereof is limited to four sectors of 0 to 3. Only three blocks (block X 2000, block Y 2010, and block Z 2020) of the memory chips are used for reading or writing data. Each block of the memory chips is constituted of four pages, and a size of each page is 512 bytes (1 sector). Each page is represented by one of numerals 0 to 3, and an absolute physical address of each page is abbreviated as X3, Y0, or Z1. As shown in
First, it is presumed that the snapshot function is invalid and, as shown in
At this time, Xn (n=0 to 3) is set in each first physical address of a logical address LA=n in the address conversion table 1031, and no second physical addresses have been set in any logical addresses. Page status values of the blocks X to Z in the page status register 1032 are set to “0000”, “FFFF”, and “FFFF”, respectively, and OFF is set in a snapshot flag 1033. In other words, in a status shown in
From this status, the host computer 1100 issues commands to the semiconductor memory system 1000 in the following order.
The writing of data in the blocks is executed into free sectors of the blocks in predetermined order. For example, in
Then, the memory controller 1020 detects first physical addresses X0 and X1 corresponding to the logical addresses 0 and 1 from the address conversion table 1031, and pages status values of X0 and X1 of the page status register 1032 are set to 8 (invalid data) since latest data has been written in the pages 1 and 2 of the block X 2000. The memory controller 1020 sets physical addresses Y0 and Y1 of the block Y 2010 where latest data has been written in first physical addresses corresponding to the logical addresses LA=0 and 1 of the address conversion table 1031, and sets page status values corresponding to Y0 and Y1 of the page status register 1032 to 0 (latest data).
When the snapshot function is invalid, the memory controller 1020 sequentially writes new data in free pages of each block, sets a value of the page status register 1032 to “8” with past data set as invalid, and uses only the first physical address of the address conversion table 1031 to set a physical address of a block where latest data has been written in the first physical address.
Then, upon reception of the snapshot command (2), the memory controller 1020 sets ON in the snapshot flag 1033. The write commands thereafter are processed by validating the snapshot function to prevent a loss of the data stored thus far as follows.
Then, the memory controller 1020 detects first physical addresses X2 and X3 corresponding to the logical addresses LA=2 and 3 from the address conversion table 1031, and sets X2 and X3 in the sections of the second physical addresses, respectively. The memory controller 1020 sets page status values of X2 and X3 of the page status registers 1032 to “1” (snapshot data). Accordingly, a status value of the page status register 1032 of the block X 2000 is “8811”. The memory controller 1020 sets Y2 and Y3 in first physical addresses for physical addresses of latest data corresponding to the logical addresses LA=2 and 3 of the address conversion table 1031, and sets pages status values of Y2 and Y3 of the page status register 1032 to 0 (latest data), respectively. Accordingly, a value of the page status register 1032 of the block Y 2010 is set to “0000”.
As shown in
Then, the memory controller 1020 detects a first physical address Y3 of the logical address LA=3 form the address conversion table 1031, and sets a page status value of Y3 of the page status register 1032 corresponding to the updated data “D” to 8 (invalid data). The memory controller 1020 sets a physical address Z0 corresponding to the newly written data “D″” in the first physical address of the logical address LA=3 of the address conversion table 1031, and a page status value of Z0 of the page status register 1032 is set to 0 (latest data).
When a total number of data unwritten pages is equal to or less than a predetermined value (e.g., total number of unwritten pages of blocks X to Z is 3), by taking this as a trigger, the memory controller 1020 carries out the following clean-up process to increase the total number of unwritten pages of the logical addresses LA=0 to 3. In this process, data is deleted by a block unit because of the characteristics of the flash memory 1040. Thus, if latest data or data to be saved as a snapshot exists in a block, the data is deleted after it is saved in the other block.
First, the memory controller 1020 refers to the page status register 1032 to select a block X 2000 which includes most pages of page status values=8 (invalid data). The memory controller 1020 detects pages storing data to be saved in the block X 2000 of a deletion target, i.e., two pages at X2 and X3 of a page status value=0 (latest data) or 1 (snapshot data) as pages to be saved.
Then, the memory controller 1020 copies stored data C and D of pages of saving targets to pages at Z1 and Z2 of a page status value=F (unwritten) of the block Z 2020 not to be deleted this time. Upon completion of the copying, page status values of X2 and X3 of the page status register 1032 are copied to page status values of Z1 and Z2, and page status values of X2 and X3 are set to 8 (invalid data).
The memory controller 1020 retrieves two sections where the physical addresses X2 and X3 of the block X 2000 of the data saved from the block X 2000 to the block Z 2020 have been set in the address conversion table 1032, and sets physical addresses Z1 and Z2 of the block Z 2020 which are new storage destinations in the sections.
Accordingly, a page status value of the block X 2000 of the deletion target is set to “8888”, making all the pages invalid data, and a page status value of the block Z 2020 of the saving destination is set to “011F”, realizing a block which includes snapshot data in pages 2 and 3.
Then, the memory controller 1020 deletes the block X 2000 to set a page status value=FFFF of the block X 2000.
Upon reception of the read command (5), to refer to the requested logical addresses LA=0 to 3, the memory controller 1020 detects pages at Y0 to Y2 and Z0 of first physical addresses corresponding to the logical addresses LA=0 to 3 from the address conversion table 1031 of
Upon reception of the recovery command (3) of the logical addresses LA=0 to 3, the memory controller 1020 detects pages at Y0 and Y1 of first physical addresses corresponding to the logical addresses LA=0 and 1 from the address conversion table 1031 shown in
Upon reception of the snapshot function release command (7), the memory controller 1020 sets OFF in the snapshot flag 1033. In the read commands thereafter, only data lastly stored in the logical address can be read. Only the first physical address of the address conversion table 1031 is referred to invalidate the second physical address, and reference to the snapshot data is inhibited.
According to the writing process of the memory controller 1020, writing is sequentially executed from a head physical address of the block to a last address and, when there are no more free pages in the block, writing is carried out in a next block. Thus, the memory controller 1020 can write data in all the pages of the block X 2000, but free pages of the currently written block Z 2020 are wasted.
Then, the memory controller 1020 detects first and second physical addresses Y2 and Z1 of the logical address LA=2 from the address conversion table 1031, and sets page status values of Y2 and Z1 of the page status register 1032 to 8 (invalid data). A physical address=X0 of the newly written data C″ is set in the first physical address of the logical address LA=2 of the address conversion table 1031 to clear the second physical address. Lastly, the memory controller 1020 sets a page status value of X0 of the page status register 1032 where the new data C″ has been written to 0 (latest data).
Thus, not only the data C″ immediately before updating but also the snapshot data D are invalidated after the snapshot function is released.
First, a type of a received command is judged (4010).
If a result of the judgment of the step 4010 is a snapshot command, the snapshot flag 1033 is set to ON (4020) to finish the command process.
If a result of the command judgment of the step 4010 is a normal operation start command, the snapshot flag 1033 is set to OFF (4030) to finish the command process.
If a written command judgment result is a write command, data for writing is received from the host computer 1100 (4040) to select a page of a page status value=F, and the received data is written in the page (4050). At this time, retrieval of unwritten page status values “F” is sequentially carried out from a page next to a previously written page to the blocks X 2000 to Z 2020.
Then, whether the snapshot flag 1033 is ON is investigated (4060). If a result of the step 4060 is “yes” (ON), it is investigated whether a second physical address corresponding to a logical address designated as a writing destination in the address conversion table 1031 is unset (4070). If a result of the step 4070 is “yes” (unset), a value of a first physical address corresponding to the logical address is copied to a section of the second physical address corresponding to this logical address LA (4080). A page status value indicated by the second physical address in the page status register 1032 is set to 1, indicting a snapshot (4090). A physical address of a page where the received data is written in the step 4050 is set in a section of the first physical address corresponding to the logical address in the address conversion table 1031 (4100), and a page status value of a page indicated by the first physical address of the logical address LA in the page status register 1032 is set to 0 (4110). Subsequently, a block clean-up process is executed (4120) to finish the command process.
On the other hand, if the judgment result for the snapshot function of the step 4060 is “no” (OFF), and if the judgment result (for setting or unsetting of snapshot) of the step 4070 is “no” (set), a page status value of a page indicated by the first physical address corresponding to a writing destination logical address in the page status register 1032 is set to 8 (4130). Then, whether the snapshot flag 1033 is ON is investigated (4140). If a result of the step 4140 is “yes” (ON), the process proceeds to the step 4110. If the result is “no” (OFF), the process proceeds to the step 4150.
In the step 4150 where the snapshot function is invalid, it is investigated whether a second physical address corresponding to the writing destination logical address in the address conversion table 1031 is unset. If a result of the step 4150 is “yes” (unset), the process proceeds to the step 4100. If the result is “no” (set), a page status value of a page indicated by the second physical address in the page status register 1032 is set to 8 (invalid data) (4160). A section of the second physical address corresponding to the writing destination logical address in the address conversion table 1031 is cleared to an unset status (4170).
After the step 4170, the process proceeds to the step 4100. If a range of logical addresses where data are to be written by the write command includes a plurality of sectors, the process of the step 4060 and the subsequent steps is executed for each sector.
If the command judgment result of the step 4010 is a read command, a first physical address corresponding to a logical address indicated by the command in the address conversion table 1031 is detected, and data is read from a page indicated by the address (4180). Then, the data is transmitted to the host computer (4190) to finish the command process.
If the command judgment result of the step 4010 is a recovery read command, whether the snapshot flag 1033 is ON is investigated (4200). If the result is “yes” (ON), it is investigated whether a second physical address corresponding to the logical address designated by the command in the address conversion table 1031 is unset (4210). If the result is “no” (set), data is read from a page indicated by the second physical address (4220). Then, the data is transmitted to the host computer (4190) to finish the command process. On the other hand, if the result of the step 4200 is “no” (OFF), data requested by the host computer 1100 cannot be transmitted, and thus judged that an error has occurred to finish the command process. If the result of the step 4210 is “yes” (unset), the process proceeds to the step 4180. In other words, the command is processed as in the case of a normal read command. When a range of logical addresses to be read by the recovery read command includes a plurality of sectors, the process of the step 4200 and the subsequent steps is carried out for each sector.
First, the memory controller 1020 refers to the page status register 1032 to investigate whether the total number of pages of page status values=F (unwritten) is equal to or less than a predetermined value (e.g., 3) (5010). If a result of the step 5010 is “no” (larger than the predetermined value), nothing is executed to finish the process. On the other hand, if the result is “yes” (equal to or less than the predetermined value), one block which includes most pages of page status values=8 (invalid data) is selected to be set as a deletion target block. All the pages of page status values=0 (latest data) or page status values=1 (snapshot data) of the selected deletion target block are detected (5020). The number of detected pages is indicated by N, and set as saving target pages. N unwritten pages of page status values=F of a block other than the selected deletion target block are selected, and data stored in the saving target pages detected in the step 5020 are copied (saved) to one of the unwritten pages (5030). Then, in the page status register 1032, a page status value (0 or 1) of each saving target page detected in the step 5020 is copied to a page status value of a data copying destination page executed in the step 5030 (5040). All the page status values of the pages detected in the step 5020 are set to 8 (invalid data) (5050). Then, by retrieving addresses of the deletion target pages detected in the step 5020 from all the first and second physical addresses set in the address conversion table 1031, sections where the addresses are set are detected, and the physical addresses of the copying destination pages subjected to copying in the step 5030 are moved to the detected sections (5060). In other words, in the address conversion table 1031, the first and second physical addresses corresponding to the copying source logical address LA are moved to the first and second physical addresses corresponding to the copying destination logical address to delete values of the copying source physical addresses. Accordingly, all the pages of the deletion target block selected in the step 5020 are invalidated, and saving of page data which has been stored in the block to be saved is completed.
Then, the block selected in the step 5020 is deleted (5070). This deletion means writing of a predetermined value in all the pages of the block. Page status values of all the pages of the deletion target block in the page status register 1032 are set to F (unwritten) (5080) to finish the process.
A detailed method of implementing the address conversion table 1031 will be described. The section of the second physical address in the address conversion table 1031 may be “set” or “unset” depending on the logical address LA. When the address conversion table 1031 is implemented by using the nonvolatile RAM 1030, needless to say, it is impossible to prevent writing of any value in a storage position equivalent to the section of the second physical address. In this case, by defining a special value meaning “unset” and writing the value in the nonvolatile RAM 1030, unsetting of each second physical address is represented. For example, if a range of physical addresses necessary for identifying pages in the semiconductor memory system 1000 can be represented by values of 31 bits, a value “FFFFFFFF (hexadecimal number) of 32 bits is defined as a value meaning “unset”. Accordingly, if this value has been set in the storage position equivalent to the section of the second physical address, the memory controller 1020 judges that “the second physical address is unset”. When the memory controller 1020 sets this value in the storage position equivalent to the section of the second physical address, it means that “the second physical address is cleared”.
One embodiment of this invention has been described above. It is possible to achieve a higher snapshot function by extending the address conversion table 1031. For example, by adding third to fifth physical address sections to the address conversion table 1031, it is possible to manage snapshot data of four generations at the maximum. In this case, the function should preferably be extended so that parameters indicating generations can be provided to the recovery read command, whereby the host computer 1100 can read snapshot data of a desired generation.
For the block clean-up process carried out in the semiconductor memory system 1000 to which this invention is applied, the deciding condition of the block to be deleted is not limited to “the number of included invalid pages should be maximum”. The number of times of deleting each block of the flash memory may be counted to set “the number of deletion times should be minimum” as a condition, and various conditions can be applied.
It is not limited to the command from the host computer 1100 that instructs starting of the snapshot function. The semiconductor memory system 1000 can start the snapshot function based on its own judgment. For example, when the memory controller 1020 judges that a remaining life of the storage system is short because of a very large number of deletion times of each block of the flash memory, the snapshot flag 1033 may be automatically set to ON.
Furthermore, according to the first embodiment, the two types of commands, i.e., the read command and the recovery read command, are prepared so that the host computer 1100 can read both latest data and snapshot data. However, the process is not limited to this method. For example, a method which uses two types of commands, a normal read command and a read data selection command, can be employed. In this case, after data to be read is selected from two latest and snapshot data by the read data selection command, the data is read by the normal read command.
A second embodiment of this invention discloses a semiconductor memory system which can manage snapshot data of three generations at the maximum. According to the first embodiment, the snapshot data of a plurality of generations can be managed. However, the second embodiment is different from the first embodiment in that configurations and a using method of the address conversion table 1031, the page status register 1032, and the snapshot flag 1033 are different from those of the first embodiment, and the memory controller 1020 interprets a command for individually releasing a designated generation number among a plurality of obtained snapshots. Other components are the same as those of the first embodiment.
A simple internal configuration of the semiconductor memory system 1000 to which this invention is applied is shown in
Five types of commands interpreted by the memory controller 1020 and functions thereof according to the second embodiment are as follows.
In the address conversion table 1031 of the second embodiment, a correspondence is set between one logical address and four physical addresses (first to fourth physical addresses hereinafter). The first physical address stores a storage position (physical address) of data (latest data) lastly written in the logical address. In the second to fourth physical addresses, a host computer 1100 stores a storage position of latest data stored in each logical address at the time of receiving the snapshot acquisition command. According to the second embodiment, up to three generations of snapshots can be managed by the memory controller 1020.
Page statuses stored in the page status register 1032 of the second embodiment are the following four. Each status value is represented by a hexadecimal number.
The snapshot flag 1033 of the second embodiment manages whether a generation has been obtained (ON) or released (OFF) for each of generation numbers (1 to 3) of snapshots by three generations.
According to the second embodiment, the memory controller 1020 includes a nonvolatile RAM, and the host computer 1100 temporarily holds types (generations: N=0 to 3) selected by the read data selection command in a partial area of the nonvolatile RAM. The nonvolatile RAM and its area will be referred to as a read data selection register. The following four are defined for type values (designated values of generations) stored in the read data selection register. The read data selection register is initialized to a type value=0 immediately after power is turned on for the semiconductor memory system 1000.
In the example shown in the figures, to simplify description, logical addresses that can be designated from the host computer 1100 are sector units (1 sector=512 bytes), and a range thereof is limited to four sectors of 0 to 3. Only three blocks (block X 2000, block Y 2010, and block Z 2020) of the memory chips 1041 to 1043 are used for reading or writing data. The blocks 2000 to 2030 of the memory chips are each constituted of four pages, and a size of each page is 512 bytes (1 sector). Each page is represented by one of numerals 0 to 3, and an absolute physical address of each page is abbreviated as X3, Y0, or Z1. In the address conversion table 1031, LA indicates a logical address, a first PA indicates a first physical address, a second PA indicates a second physical address, and a third PA indicates a third physical address. A fourth PA (fourth physical address) exists but is not used in this description, so it is not shown in the figure.
The first physical address stores each physical address of a page corresponding to each of a plurality of logical addresses, and each physical address indicates a page which has stored latest data. The second physical address stores each physical address of a page corresponding to each of a plurality of logical addresses, and each physical address indicates a page which has stored a first generation snapshot. The third physical address stores a physical address of a page corresponding to each of a plurality of logical addresses, and each physical address indicates a page which stores a second generation snapshot. The fourth physical address stores each physical address of a page corresponding to each of the plurality of logical addresses, and each physical address indicates a page which stores a fourth generation snapshot. First physical addresses constitute a first physical address group for storing physical addresses of pages of latest data, and second to forth physical addresses constitute a second physical address group for storing physical addresses of snapshots for each generation.
First, it is presumed that no snapshot has been obtained and, as shown in
At this time, in the address conversion table 1031, Xn (n=0 to 3) is set in each first physical address of a logical address LA=n, second to fourth physical addresses have not been set in any logical address, page status values of blocks X, Y, and Z of the page status register 1032 are set to “0000”, “FFFF”, and “FFFF”, respectively, and OFF is set for all the three generations in the snapshot flag 1033.
A type value=0 meaning “latest” is set in the read data selection register. This means a status where latest data can be read by a read command.
From this status, the host computer 1100 issues commands to the semiconductor memory system 1000 in the following order.
Then, the memory controller 1020 detects first physical addresses X0 and X1 of the logical addresses 0 and 1 from the address conversion table 1031, and pages status values of X0 and X1 of the page status register 1032 are set to 8 (invalid data) since latest data has been written in the pages 1 and 2 of the block X 2000. The memory controller 1020 sets physical addresses Y0 and Y1 of the block Y 2010 where latest data has been written in first physical addresses corresponding to the logical addresses LA=0 and 1 of the address conversion table 1031, and sets page status values corresponding to Y0 and Y1 of the page status register 1032 to 0 (latest data).
Then, upon reception of the snapshot acquisition command (2), the memory controller 1020 copies contents of the first physical address of each logical address LA to a section of the second physical address for all the logical addresses LA of the address conversion table 1031. As a result, these second physical addresses indicate storage destinations of the first generation snapshot data. The memory controller 1020 sets a generation 1 of the snapshot flag 1033 ON, and returns a generation number “1” to the host computer 1100.
Then, the memory controller 1020 detects storage of first generation snapshot data in X2 and X3 of sections of first physical addresses of the logical addresses LA=2 and 3 from a second physical address in the address conversion table 1031. Accordingly, the memory controller 1020 maintains page status values of the second physical addresses X2 and X3 at 0 (valid data). Then, the memory controller 1020 sets Y2 and Y3 corresponding to the data C′ and D′ written by the write command (3) in each first logical address corresponding to the logical addresses LA=2 and 3 of the address conversion table 1031, respectively, and sets pages status values of Y2 and Y3 of the page status register 1032 to 0 (valid data).
Upon reception of the snapshot acquisition command (4), the memory controller 1020 copies contents of the first physical address of each logical address LA to sections of third physical addresses for all the logical addresses LA of the address conversion table 1031. As a result, the third physical addresses indicate storage destinations of second generation snapshot data. Then, the memory controller 1020 sets a generation 2 of the snapshot flag 1033 ON, and returns a generation number=2 to the host computer 1100.
Upon reception of the write command (5), the memory controller 1020 refers to the page status register 1032 to select a page at Z0 of a status value=F (unwritten), and writes the data D″ in the page at Z0. Then, the memory controller 1020 refers to the address conversion table 1031 to detect storage of second generation snapshot data in Y3 of the section of the first physical address of the logical address LA=3 form presence of Y3 in the third logical address LA=3. Accordingly, the memory controller 1020 maintains a page status value of Y3 of the page status register 1033 at 0 (valid data). Then, the memory controller 1020 sets ZO in the first physical address of the logical address LA=3 of the address conversion table 1031, and sets a page status value of Z0 of the page status register 1032 to 0 (valid data).
When a total number of data unwritten pages is equal to or less than a predetermined value (e.g., 3), by taking this as an opportunity, the memory controller 1020 carries out the following clean-up process to increase the total number of unwritten pages.
First, the memory controller 1020 refers to the page status register 1032 to select a block X 2000 which includes most pages of page status values=8 (invalid data), retrieves pages storing data to be saved in the block X 2000 from the address conversion table 1031, and detects two pages at X2 and X3 of page status values=0 from the second physical address. Then, the memory controller 1020 copies stored data C and D of the pages at X2 and X3 to pages at Z1 and Z2 of page status values=F (unwritten), respectively, sets page status values of Z1 and Z2 to 0 (valid data), and sets page status values of X2 and X3 to 8 (invalid data).
Then, the memory controller 1020 retrieves two sections where X2 and X3 are set in the address conversion table 1031, and sets pages at Z1 and Z2 of the data C and D moved to the section of the second physical address.
Accordingly, the stored data of the block X 2000 to be saved is saved in another block, and a status where invalid data are stored in all the pages is set.
Then, the memory controller 1020 deletes contents of a block X where all are invalid data to set a page status value of the block X=FFFF.
Upon reception of the read data selection command (6) of the first generation snapshot, the memory controller 1020 sets a type value=1 in the read data selection register.
Upon reception of the read command (7) for the logical addresses LA=0 to 3, the memory controller 1020 detects pages at Y0, Y1, Z1, and Z2 of the second PA indicating first generation snapshots corresponding to the logical addresses LA=0 to 3 in the address conversion table 1031, and reads data A′, B′, C, and D stored in these pages to transmit the data to the host computer 1100, respectively. These are snapshots of data stored in the logical addresses LA=0 to 3 at the time of
Upon reception of the read data selection command (8) for selecting the second generation snapshot, the memory controller 1020 sets a type value=2 in the read selection register.
Upon reception of the read command (9) for the logical addresses LA=0 to 3, the memory controller 1020 detects pages at Y0 to Y3 of third physical addresses corresponding to the second generation snapshots of the logical addresses LA=0 to 3 in the address conversion table 1031 because of type value=2 set in the read data selection register, and reads data A′, B′, C′, and D′ stored in these pages to transmit the data to the host computer 1100, respectively. These are snapshots of the data stored in the logical addresses at the time of
Upon reception of the read data selection command (10) for selecting latest data, the memory controller 1020 sets a type value=0 in the read data selection register.
Upon reception of the read command (11) for the logical addresses LA=0 to 3, the memory controller 1020 detects pages at Y0, Y1, Y2, and Z0 of the first PA corresponding to latest data of the logical addressees LA=0 to 3 in the address conversion table 1031 because of the type value=0 set in the read selection register, and reads data A′, B′, C′, and D′ stored in the pages to transmit the data to the host computer 1100, respectively. These are latest data stored in the logical addresses.
First, the memory controller 1020 judges a type of a received command (8010).
If a result of the command is a snapshot acquisition command, the memory controller 1020 retrieves an entry of an OFF status in the snapshot flag 1033 (8110). In step 8120, if there is no flag of an OFF status, judging that a permissible number of snapshot times is exceeded, an error of an acquisition failure is returned to the host computer 1100 to finish the command process.
On the other hand, if there is a flag (M-th) of an OFF status, contents of a first physical address is copied to a section of a (M+1)th physical address for all the logical addresses LA of the address conversion table 1031 (8130). Then, a generation M of the snapshot flag 1033 is set ON (8140), and a generation number M allocated to a currently obtained snapshot is returned to the host computer 1100 (8150) to finish the command processing.
If a result of the command judgment of the step 8010 is a snapshot release command, a generation number (M) to be released by the host computer 1100 is extracted from a parameter (type value) added to the command. If the generation M of the snapshot flag 1033 is set OFF in a step 8210 (i.e., has been released), an error of a release failure is returned to the host computer 1100 to finish the command process. On the other hand, if the generation M of the snapshot flag 1033 is set ON, the following process is carried out for all the logical addresses LA of the address conversion table 1031 (8220).
The memory controller 1020 “sets a page status of a (M+1)th physical address to 8 (invalid data) in the page status register 1032 if a value of the (M+1)th physical address does not overlap a value of any other physical address in all the physical addresses corresponding to each logical address LA”.
Then, the section of the (M+1)th physical address is cleared for all the logical addresses LA of the address conversion table 1031 (8230). Lastly, the generation M of the snapshot flag 1033 is set OFF (8240) to finish the command process.
If a result of the command judgment of the step 8010 is a write command, a write step 8310 (refer to
If a result of the command judgment of the step 8010 is a read data selection command, a type of read data (one of latest and first to third generation snapshots) requested by the host computer 1100 based on the read command is obtained from a parameter (type value) added to the command (8410). Then, a type value for identifying the type is set in the read data selection register (8420) to finish the command process.
If a result of the command judgment of the step 8010 is a read command, a read step 8510 (refer to
First, write data is received from the host computer 1100 (9010), a page of a page status value=F is selected in the page status register 1032, and the received data is written in the page (9020).
Then, all physical addresses corresponding to a logical address designated by the write command are detected in the address conversion table 1031, and whether a value of a first physical address (address of a page storing data before updating) is different from values of any other physical addresses (whether the value is not snapshot data) is retrieved (9030). If a result of the retrieval is “no” (overlaps), the process proceeds to step 9050. On the other hand, if a result of the retrieval is “yes” (does not overlap), in the page status register 1032, a page status of the first physical address corresponding to the designated logical address is set to 8 (invalid data) (9040). In the address conversion table 1031, an address (address of a page storing data after updating) of a page written in the section of the first physical address corresponding to the designated logical address in the step 9020 is set (9050). In the page status register 1032, a page status of a page indicated by the new first physical address is set to 0 (valid data). Lastly, a block clean-up step 9070 (refer to
First, whether a type value set in the read data selection register indicates “latest” (=0) is investigated (9110). If a result is “yes” (latest), in the address conversion table 1031, data stored in a first physical address corresponding to a logical address designated by the read command is read (9150), and the read data is transmitted to the host computer 1100 (9140). On the other hand, if a result is “no” (snapshot), for a selected generation number (N), whether a generation N of the snapshot flag 1033 is ON (whether a snapshot has been obtained) is investigated (9120). If the generation N of the snapshot flag 1033 is OFF, a read error is returned to the host computer 1100 to finish the read process. If the generation N of the snapshot flag 1033 is ON, data stored in a (n+1)th PA corresponding to the designated logical address is read (9130), and the read data is transmitted to the host computer 1100 (9140).
First, the memory controller 1020 refers to the page status register 1032 to judge whether the total number of pages of page status values=F (unwritten) is equal to or less than a predetermined value (10010). If a result of the judgment is “no” (larger than the predetermined value), no processing is executed to finish the process. On the other hand, if a result of the judgment is “yes” (equal to or less than the predetermined value), one block which includes most pages of page status values=8 (invalid data) is selected, and all valid pages of page status values=0 (valid data) in the block are detected (10020). The number of detected valid pages is indicated by P. P unwritten pages of page status values=F of a block other than the selected block are selected, and data stored in the valid pages detected in the step 10020 are copied (saved) to one of the unwritten pages (10030). Then, in the page status register 1032, a page status value of each copying destination page of the step 10030 is set to 0 (10040). All the page status values of the valid pages detected in the step 10020 are set to 8 (invalid data) (10050). Then, by retrieving addresses of the valid pages detected in the step 10020 from all the physical addresses set in the address conversion table 1031, sections where the addresses are set are specified, and the physical addresses of the copying destination pages of the step 10030 are copied to the specified sections (10060). Accordingly, all the pages of the block selected in the step 10020 are invalidated, and saving of page data which has been stored in the block to be saved is completed.
Then, the block selected in the step 10020 is deleted (10070). Page status values of all the pages of the block in the page status register 1032 are set to F (unwritten) (10080) to finish the process.
A detailed implementing method of the address conversion table 1031 will be described. The sections of the second to fourth physical addresses in the address conversion table 1031 are “unset” by releasing the snapshot. As in the case of the first embodiment, a unique value (“FFFFFFFF (hexadecimal number)) indicating “unset” may be defined, and this value may be written in the nonvolatile RAM 1030 to set an “unset” status. However, because the (N+1)th physical address can be judged to be in an “unset” status if a certain generation N of the snapshot flag 1033 has been released (OFF), it is not necessary to clarify the “unset” status in the address conversion table 1031, and written useless address values may be left as they are. In other words, the step 8230 of
The above described is the second embodiment.
According to the first and second embodiments, the semiconductor memory system 1000 allocates a plurality of physical addresses to one logical address. Thus, when a great deal of data is written after the host computer 1100 obtains the snapshot, there is a possibility that a total capacity of the provided flash memory 1040 may not be sufficient for processing the number of free physical pages. In this case, the snapshot must be released to secure free physical pages (this processing is equivalent to execution of the normal operation start command of the first embodiment. This processing is referred to as snapshot releasing and to release a snapshot hereinafter). Thus, when it is judged that the total number of valid data storage pages (page of status=0 or 1) exceeds a predetermined upper limit value during command processing, an error meaning disk-capacity-over may be returned to allow the host computer 1100 to release the snapshot.
The semiconductor memory system 1000 may automatically release the snapshots by itself. In this case, for example, the oldest snapshot is preferentially released. The snapshot flag 1033 is extended to record sequence numbers during acquisition. Then, a snapshot having a smallest sequence number can be detected as an oldest snapshot.
A setting command may be newly defined to validate or invalidate this automatic releasing. In this case, the semiconductor memory system 1000 interprets the command to validate or invalidate the automatic releasing beforehand. Alternatively, a flag indicating “permit/inhibit” this automatic releasing may be added to the parameters of the snapshot acquisition command so that the host computer 1100 can individually permit automatic releasing beforehand. In this case, the semiconductor memory computer 1000 interprets the flag, and records information thereof in the (extended) snapshot flag 1033 beforehand. Subsequently, when automatic releasing is necessary, the record is referred to, and an oldest snapshot among the snapshots of “permit” is preferentially released.
For an opportunity used by the semiconductor memory computer 1000 to automatically release the snapshots by itself, not only the capacity shortage as described above but also various events detected by the semiconductor memory computer 1000 may be applied. For example, the semiconductor memory computer 1000 may include a unit for acquiring current time, and the acquired current time is recorded in the (extended) snapshot flag 1033 in the case of snapshot acquisition. When a difference between the current time and acquisition time exceeds a predetermined value (e.g., 3 years), the snapshot is automatically released.
Not only the semiconductor memory computer 1000 releases the snapshot automatically itself, but also may automatically acquire a snapshot (this processing is equivalent to execution of the snapshot command process of the first embodiment. This processing is referred to as snapshot acquisition and to acquire a snapshot hereinafter). For an opportunity for the execution, various events detected by the semiconductor memory computer may be applied.
For example, the semiconductor memory computer 1000 may include a unit for acquiring current time. When predetermined time arrives, the snapshot acquisition is automatically executed. A command for setting the predetermined time may be newly defined. In other words, the semiconductor memory computer 1000 interprets the command to register the predetermined time therein (e.g., nonvolatile RAM 1030) beforehand.
As another example, a semiconductor memory computer 1000 may include an auxiliary power source (large-capacity capacitor) to prevent stored data destruction caused by power cutoff of the host computer 1100. The semiconductor memory computer 1000 detects use of the auxiliary power source to record a total number of use times or total use time in the nonvolatile RAM 1030. When a predetermined upper value is exceeded, snapshot acquisition is automatically executed judging deterioration of an external power environment.
As yet another example, when a total, an average, or a maximum value of the number of block deletion times of the flash memory 1040 exceeds a predetermined upper limit value, or a total of the number of writing or deleting errors of the flash memory 1040 exceeds a predetermined upper limit value, judging deterioration of reliability of the storage system, snapshot acquisition may be automatically executed.
In the above description, command codes uniquely defined for a vendor in the conventional semiconductor memory computer should preferably be allocated to the newly defined commands such as the snapshot acquisition/release command and the read data selection command, and the same standard command code as that of the read/write command of the conventional semiconductor memory computer should preferably be allocated to the read/write command, thereby improving high-order compatibility of the storage system.
In the description, as the unit for returning various errors regarding the snapshot generation number or the snapshot function to the host computer 1100, the status read command generally provided in the conventional semiconductor memory computer may be extended to realize the unit. In other words, a generation number is buried in an unused part of status information read by the command. Error codes unused by the standard are allocated to various errors regarding the snapshot function, and the codes are set in error information parts of the status information.
For convenience of the host computer 1100, the upper limit value of the number of snapshot generations which can be obtained by the semiconductor memory computer 1100 of this invention or a list of obtained snapshot generation numbers may be buried in an unused part of the status information as in the above case.
According to the second embodiment described above, the memory controller 1020 receives a read command for a desired logical address after a snapshot generation or latest data is designated by the read data selection command. Alternatively, a type value may be added to the read command to designate a logical address and a type of data to be read by one command.
(Supplement)
A semiconductor memory computer, including:
a flash memory including a plurality of blocks that can be collectively deleted and a plurality of pages obtained by dividing each block into a plurality of areas to store data; and
a memory controller for controlling one of writing and reading in the flash memory by the page units and batch deletion by the block units, in which:
the memory controller performs one of reading and writing data of a memory chip based on a logical address included in a request received from a host apparatus;
the memory controller includes:
the address conversion unit includes:
the snapshot management unit sets validity or invalidity of the snapshot.
While the present invention has been described in detail and pictorially in the accompanying drawings, the present invention is not limited to such detail but covers various obvious modifications and equivalent arrangements, which fall within the purview of the appended claims.
Number | Date | Country | Kind |
---|---|---|---|
2006-320240 | Nov 2006 | JP | national |
2007-036236 | Feb 2007 | JP | national |
Japan Priority Application 2006-320240, filed Nov. 28, 2006 including the specification, drawings, claims and abstract, is incorporated herein by reference in its entirety. Japan Priority Application 2007-036236, filed Feb. 16, 2007 including the specification, drawings, claims and abstract, is incorporated herein by reference in its entirety. This application is a Continuation of U.S. application Ser. No. 13/788,438 filed Mar. 7, 2013, incorporated hereby by reference in its entirety, which is a continuation of U.S. application Ser. No. 13/422,644, filed Mar. 16, 2012, now U.S. Pat. No. 8,417,896, incorporated herein by reference in its entirety, which is a Continuation of U.S. application Ser. No. 11/783,364, filed Apr. 9, 2007, now U.S. Pat. No. 8,151,060, incorporated herein by reference in its entirety.
Number | Date | Country | |
---|---|---|---|
Parent | 13788438 | Mar 2013 | US |
Child | 14188039 | US | |
Parent | 13422644 | Mar 2012 | US |
Child | 13788438 | US | |
Parent | 11783364 | Apr 2007 | US |
Child | 13422644 | US |