Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the invention, the technical scheme in the embodiment of the invention is clearly and completely described, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills belong to the scope of protection of the invention not making the every other embodiment that obtains under the creative work prerequisite.
Embodiment one,
The embodiment of the invention provides a kind of data storing method, and as shown in Figure 2, this method comprises:
Step 1: the error correcting code (ECC) of obtaining data and these data;
Wherein, the data of obtaining in the step 1 can be the data that receive the needs storage of miscellaneous equipment transmission, the error correcting code of obtaining these data in the step 1 can be according to specific algorithm, and the error correcting code of the data that calculate, the concrete operations of obtaining the error correcting code of data can be with reference to prior art.
Step 2: by the data channel that links to each other with flash memory, the error correcting code of data and data is stored into respectively in the different page or leaf of flash memory.
Wherein, need to prove that memory storage is that unit is operated with page or leaf (Page) all at read data with when writing data.Data are stored in one or more than in one the page or leaf in step 2, also store the error correcting code of data into one or more than in one the page or leaf, and wherein, the page or leaf of the page or leaf of storage data and storage correcting data error sign indicating number is different pages.The page or leaf that namely can understand in the memory storage is split up into two parts, comprising: the page or leaf of the page or leaf of storage data and storage correcting data error sign indicating number.
Explanation by a kind of data storing method that the embodiment of the invention is provided, this method stores into independently in the page or leaf by the error correcting code with data, the page or leaf that is about to storage space is divided into two classes, comprising: a class page or leaf is used for the storage data, and a class page or leaf is used for the error correcting code of storage data; Therefore, can just can obtain all error correcting codes of data and data by less read-around number, thereby get access to correct data, reduce the memory storage probability of errors, make memory storage safe, stable when the storage data.
Embodiment two,
The embodiment of the invention provides a kind of data storing method, this method is similar to the method that embodiment one provides, comprise: all with the error correcting code of data independent be that unit stores with Page, the Page of storage correcting data error sign indicating number does not store data, simultaneously, the Page of storage data does not store the error correcting code of data; But the embodiment of the invention provides a kind of method of storing data and this correcting data error sign indicating number more specifically, is convenient to the step by still less, gets access to all error correcting codes of data faster, thereby gets access to correct storage data.
As shown in Figure 3, this method comprises:
Steps A 1: identical with the step 1 among the embodiment one, namely obtain the error correcting code (ECC) of data and these data;
Steps A 2: by the data channel that links to each other with flash memory, the error correcting code of data and data is stored into respectively in the different page or leaf of flash memory; Wherein, above-mentioned data channel comprises at least one; The above-mentioned data channel that links to each other with flash memory comprises: with one or at least one data channel that links to each other more than one flash memory; When the different page or leaf of above-mentioned flash memory be in the flash memory during the identical different page or leaf of numbering, above-mentioned error correcting code is the error correcting code of the data of storing in the page or leaf that numbering is identical in the flash memory.
The explanation of being convenient to understand comprises: this memory storage stores the error correcting code of the data obtained and these data respectively in the different pages or leaves, as more than a flash memory, and when the data channel that links to each other with flash memory (Flash) comprises more than one, Flash is divided into the page or leaf more than, in the page or leaf that numbering is identical in all Flash, have a page or leaf to be used for the storage error correcting code, error correcting code is the error correcting code of the data of storage in the page or leaf that numbering is identical among all Flash.
It will be appreciated that data channel is for the storage space that data and error correcting code is inputed to memory storage, perhaps, data and error correcting code is exported from storage space.Storage space described here normally is made up of a plurality of flash memories, data passage usually with one or link to each other more than one flash memory, flash memory is divided into a plurality of pages or leaves, and flash memory is data or the error correcting code of storing in the unit output page with the page or leaf, is that unit writes data or error correcting code with the page or leaf.
Common many data channel and the data of being about to are imported or the output memory storage.As shown in Figure 4, be example so that four data channel to be arranged in the memory storage, comprising: zero passage (Channle0), first passage (Channel1), second channel (Channel2), and third channel (Channel3).Wherein, be different with the numbering of each Page among the Flash that every passage links to each other, as demonstrated among the figure with Flash that each passage links to each other in numbering from the numbering of Page0 to Page7 continuous page.Wherein, said in the steps A 2 " in the page or leaf that numbering is identical in all Flash; have a page or leaf to be used for the storage error correcting code; error correcting code is the error correcting code of the data of storage in the page or leaf that numbering is identical among all Flash ", understanding at Fig. 4 is, will with Flash that Channel0 to Channel3 links to each other in be numbered in the page or leaf of Page0, have a page or leaf (being the Page0 of Channel0) to be used for the error correcting code of data among all Page0 of Flash that storage links to each other with Channel1 to Channel3.Be about to all with Flash that data channel links to each other in the data definition stored in the Page0 be data0, all with Flash that data channel links to each other in the data definition stored in the Page1 be data1, by that analogy; The error correcting code of data0 is stored in one of them page or leaf of Page0 (namely as check bit Parity0 place among Fig. 4 page), the error correcting code of data1 is stored in the page or leaf of Page1 (namely as check bit Parity1 place among Fig. 4 page), by that analogy.
Also it will be appreciated that, the physical address of the page or leaf that numbering is identical in all data is normally continuous, for example: usually with Flash that Channel0 links to each other in page0, with Flash that Channel1 links to each other in page0, with Flash that Channel2 links to each other in page0, with Flash that Channel3 links to each other in the physical address of page0 continuous.
By the explanation of above-mentioned a kind of data storing method that the embodiment of the invention is provided, when reading the continuation address data, because interchannel is concurrent, read once just can obtain the error correcting code of data and these data, thereby carry out data check and output.Thereby get access to correct data, reduced the memory storage probability of errors, make memory storage safe, stable when the storage data.
Further, in order to guarantee when reading the address discrete date, can just can read the error correcting code of data correspondence by the least possible operation, then store the page or leaf of error correcting code in the steps A 2, also need further restriction, that is: with flash memory that a data channel at least one data channel links to each other in, when with flash memory that a data passage links to each other in different page or leaf be in the flash memory during continuous N page of numbering, error correcting code is stored in the page or leaf of N continuous page or leaf of numbering, the value of N is the quantity of all data channel.
The explanation of the preceding paragraph literal can be understood as, and to the page or leaf of storage error correcting code in the steps A 2, further restriction comprises: in all Flash that a data passage links to each other, number in N the continuous page or leaf, have only a page or leaf to be used for the storage error correcting code, wherein, N is the quantity of all data channel.
For the ease of understanding the preceding paragraph literal, still referring to shown in Figure 4, because many data channel and the data of being about to are exported memory storage, and when the address that synchronization reads is discontinuous, for example: the page or leaf that synchronization reads comprises: with the Page0 among the Flash that Channel0 links to each other, with the Page0 among the Flash that Channel1 links to each other, with the Page1 among the Flash that Channel2 links to each other, with the Page2 among the Flash that Channel3 links to each other, the data that namely read order be: Parity0, data0, data1, data2.
Because in all Flash that a data passage links to each other, number in N the continuous page or leaf, have only a page or leaf to be used for the storage error correcting code, therefore, memory storage is exported once again and just the error correcting code of all data can be read, the page or leaf that namely reads following a moment comprises at least: with the Parity1 that stores among the Page1 among the Flash that Channel1 links to each other, with Flash that Channel2 links to each other in Page2 in the Parity2 that stores.If Parity1 and Parity2 are stored in the same data channel, just can not be at the error correcting code Parity1 that once reads out data1, data2, Parity2.
By carrying out above-mentioned data storing method, as shown in Figure 4, be the distribution schematic diagram of the error correcting code of the data finally in data channel, imported and data, as can be seen, have only a page or leaf to be used for the storage error correcting code in each passage in continuous four pages or leaves, the data of other three page or leaf storages.Therefore, be used for storage error correcting code page or leaf and formed regular ladder distribution as shown in Figure 4.
Need to prove that also above-mentioned is that memory storage with four data channel is illustrated, and for the situation of other incremental data passage, can explanation from here release easily, therefore, should not be construed the restriction to the embodiment of the invention herein.
Embodiment three,
The embodiment of the invention provides a kind of data storing method, the embodiment of the invention provides a kind of data storing method, this method is similar to the method that embodiment one provides, comprise: all with the error correcting code of data independent be that unit stores with Page, the Page of storage correcting data error sign indicating number does not store data, simultaneously, the Page of storage data does not store the error correcting code of data; But the embodiment of the invention provides another kind of method of storing data and this correcting data error sign indicating number more specifically, is convenient to the step by still less, gets access to all error correcting codes of data faster, thereby gets access to correct storage data.
As shown in Figure 5, this method comprises:
Step B1: identical with the step 1 among the embodiment one, namely obtain the error correcting code (ECC) of data and these data;
Step B2: the error correcting code of data and data is stored into respectively in the different page or leaf of the flash memory that links to each other with the different pieces of information passage; Wherein, above-mentioned data channel comprises at least one; The above-mentioned data channel that links to each other with flash memory comprises: with one or at least one data channel that links to each other more than one flash memory.
B2 can be understood as to step: the error correcting code of the data obtained and these data is stored into respectively in the different pages or leaves, wherein, as more than a flash memory, and when the data channel that links to each other with flash memory (Flash) comprises more than one, Flash is divided into more than a page or leaf, with the data of storing among all Flash that a data channel links to each other, with the error correcting code of these data, be stored in the flash memory that links to each other with different data channel; Article one, data channel is any data channel.
Wherein, in step B2 will with the error correcting code of the data of storing among the Flash that a data channel links to each other, be stored among the different Flash, this different Flash refers to the Flash that links to each other with another data channel, when the concurrent data of interchannel, the error correcting code of data and these data can be exported simultaneously, thereby can be got access to correct data fast.
As shown in Figure 6, be example so that four data channel to be arranged in the memory storage, the space of storage data and the spatial distributions synoptic diagram of correcting data error sign indicating number.Wherein, a self-defined sector address space is used for the error correcting code of storage data in each data channel, and in every data channel lines one sector address space being arranged namely as among Fig. 6 is for the error correcting code of storing data; For the ease of understanding, in Fig. 6 with Flash that Channel0 links to each other in all data definitions of storing be data0, with Flash that Channel1 links to each other in all data definitions of storing be data1, being data2 with all data definitions of storing among the Flash that Channel2 links to each other, is data3 with all data definitions of storing among the Flash that Channe3 links to each other.With data0 must the Flash that all error correcting codes leave in Channel1 links to each other in a self-defining sector address space (being parity0), with data1 must the Flash that all error correcting codes leave in Channel2 links to each other in a self-defining sector address space (being parit1), with data2 must the Flash that all error correcting codes leave in Channel3 links to each other in a self-defining sector address space (being parity2), with data3 must the Flash that all error correcting codes leave in Channel0 links to each other in a self-defining sector address space (being parity3).
Wherein, comprise at least one page or leaf in each self-defining sector address space.Also it will be appreciated that, above-mentioned is the situation of the error correcting code of regular storage data, namely as shown in Figure 6, with the error correcting code of the data of storing among the Flash that each bar data channel links to each other, be stored in and number with it among the Flash that next adjacent bar data channel links to each other in the self-defining address space.In fact, with the data of storing among the Flash that a data channel links to each other, error correcting code with the data of storing among the Flash that this data channel links to each other, satisfy to be stored in respectively among the Flash that links to each other with different data channel and get final product, when needs read the data of storing in this data channel, just can read error correcting code according to the address of the error correcting code of storing these data.Wherein, the error correcting code of sense data and data can be simultaneously, also can be at twice, comprising: a sense data, the error correcting code of a sense data.Sense data and error correcting code are can be according to the address of the error correcting code of storage data and data, select the strategy of sense data the most fast and error correcting code thereof.
Explanation by a kind of data storing method that the embodiment of the invention is provided, this method stores the error correcting code of the data obtained and these data respectively in the different pages or leaves, wherein, as more than a flash memory, and when the data channel that links to each other with flash memory (Flash) comprised more than one, Flash was divided into the page or leaf more than, with the data of storing among all Flash that a data channel links to each other, with the error correcting code of these data, be stored in the flash memory that links to each other with different data channel; Article one, data channel is any data channel; Therefore, can just can obtain all error correcting codes of data and data by less read-around number, thereby get access to correct data, reduce the memory storage probability of errors, make memory storage safe, stable when the storage data.
Embodiment four,
The embodiment of the invention provides a kind of memory storage, and as shown in Figure 7, this memory storage comprises: first acquiring unit 100, second acquisition unit 101, control store unit 102, data channel 103 and flash memory 104.
Wherein, first acquiring unit 100 is used for obtaining data;
Second acquisition unit 101 is used for obtaining the error correcting code that first acquiring unit 100 obtains data;
Wherein, the data of obtaining in first acquiring unit 100 can be the data that receive the needs storage of miscellaneous equipment transmission, the error correcting code of obtaining these data in the second acquisition unit 101 can be according to specific algorithm, and the error correcting code of the data that calculate, the concrete operations of obtaining the error correcting code of data can be with reference to prior art.
Control store unit 102 is used for the data channel by linking to each other with flash memory, with the error correcting code of data and data store into respectively flash memory different page in.
Data channel 103 is for the error correcting code of transmission data and data, identical with data channel in the prior art;
Flash memory 104 is used for storage data and error correcting code, and wherein, flash memory is that unit is divided with the page or leaf, and is identical with flash memory in the prior art.
Wherein, data are stored in one or more than in one the page or leaf, also store the error correcting code of data into one or more than in one the page or leaf, and wherein, the page or leaf of the page or leaf of storage data and storage correcting data error sign indicating number is different pages.
Explanation by a kind of memory storage that the embodiment of the invention is provided, this device stores into independently in the page or leaf by the error correcting code with data, the page or leaf that is about to storage space is divided into two classes, comprising: a class page or leaf is used for the storage data, and a class page or leaf is used for the error correcting code of storage data; Therefore, can just can obtain all error correcting codes of data and data by less read-around number, thereby get access to correct data, reduce the memory storage probability of errors, make memory storage safe, stable when the storage data.
Optionally, comprise at least one when data channel; And with one or link to each other with each bar data channel more than one flash memory;
Then the control store unit 102, the concrete data channel that is used for by linking to each other with flash memory, with the error correcting code of data and data store into respectively flash memory different page in; When the different page or leaf of flash memory be in the flash memory during the identical different page or leaf of numbering, error correcting code is the error correcting code of the data of storing in the page or leaf that numbering is identical in the flash memory.
For the explanation of last two sections literal to control store unit 102, it is also understood that for, control store unit 102 concrete error correcting codes for the data that will obtain and these data store different pages or leaves respectively into, wherein, as more than a flash memory, and when the data channel that links to each other with flash memory (Flash) comprises more than one, Flash is divided into the page or leaf more than, in the page or leaf that numbering is identical in all Flash, have a page or leaf to be used for the storage error correcting code, error correcting code is the error correcting code of the data of storage in the page or leaf that numbering is identical among all Flash.
Wherein, it will be appreciated that this memory storage can comprise one or more than one Flash, this Flash provides storage space, the error correcting code that namely is used for storage data and/or data, each Flash is divided into a plurality of pages or leaves again, and page or leaf is that Flash is read or the minimum unit of write operation.
By further specifying the control store unit 102 in this memory storage, make this memory storage when reading the continuation address data, because interchannel is concurrent, reads once just can obtain the error correcting code of data and these data, thereby carry out data check and output.Thereby get access to correct data, reduced the memory storage probability of errors, make memory storage safe, stable when the storage data.
Further, on the above-mentioned basis that further specifies about this memory storage 102, among all Flash that link to each other with a data passage in this memory storage 102, number in N the continuous page or leaf, have only a page or leaf to be used for the storage error correcting code, wherein, N is the quantity of described data channel.
Explanation to the preceding paragraph literal also can be understood as: with flash memory that a data channel at least one data channel links to each other in, when with flash memory that a data passage links to each other in different page or leaf be in the flash memory during continuous N page of numbering, error correcting code is stored in the page or leaf of N continuous page or leaf of numbering, the value of N is the quantity of all data channel.
By the explanation of further increase to the control store unit 102 in this memory storage, make this memory storage when reading the address discrete date, can just can read the error correcting code of data correspondence by few operation of doing the best.
Optionally, work as data channel in this memory storage and comprise at least one; And with one or link to each other with each bar data channel more than one flash memory; Then the control store unit 102, the concrete different page or leaf that is used for the error correcting code of data and data is stored into respectively the flash memory that links to each other with the different pieces of information passage.
Also can be understood as the control store unit 102 in this memory storage, the error correcting code that can be specifically be used for the data that will obtain and these data stores different pages respectively into, wherein, as more than a flash memory, and when the data channel that links to each other with flash memory (Flash) comprised more than one, Flash was divided into the page or leaf more than, with the data of storing among all Flash that a data channel links to each other, with the error correcting code of these data, be stored in the flash memory that links to each other with different data channel; Article one, data channel is any data channel.
By the restriction of the preceding paragraph literal to this control store unit 102, make this memory storage will with the error correcting code of the data of storing among the Flash that a data channel links to each other, be stored among the Flash that links to each other with 01 data channel, when the concurrent data of interchannel, the error correcting code of data and these data can be exported simultaneously, thereby can be got access to correct data fast.
Also need to prove, for more detailed descriptions and the understanding of this memory storage, the explanation in can reference method embodiment one, two and three.
One of ordinary skill in the art will appreciate that all or part of step in the whole bag of tricks of above-described embodiment is to instruct relevant hardware to finish by program, this program can be stored in the computer-readable recording medium, and storage medium can comprise: ROM, RAM, disk or CD etc.
More than provide a kind of data storing method and memory storage to be described in detail to the embodiment of the invention, used specific case herein principle of the present invention and embodiment are set forth, the explanation of above embodiment just is used for helping to understand method of the present invention and core concept thereof; Simultaneously, for one of ordinary skill in the art, according to thought of the present invention, the part that all can change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention.