CN102024497B - Method for storing data and storage device - Google Patents
Method for storing data and storage device Download PDFInfo
- Publication number
- CN102024497B CN102024497B CN200910173950.3A CN200910173950A CN102024497B CN 102024497 B CN102024497 B CN 102024497B CN 200910173950 A CN200910173950 A CN 200910173950A CN 102024497 B CN102024497 B CN 102024497B
- Authority
- CN
- China
- Prior art keywords
- data
- error correction
- flash memory
- correction code
- pages
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
Images
Landscapes
- Techniques For Improving Reliability Of Storages (AREA)
Abstract
本发明实施例公开了一种存储数据的方法及存储装置,该方法包括:获得数据和所述数据的纠错码;通过与闪存相连的数据通道,将所述数据和所述数据的纠错码分别存储到所述闪存不同的页中。本发明技术方案由于将数据的纠错码存储到独立的页中,即将存储空间的页划分为两类,包括:一类页用于存储数据,一类页用于存储数据的纠错码,因此,可以通过较少读出次数就可以获得数据和数据的所有纠错码,从而获取到正确的数据,减少了存储装置出错的概率,使得存储装置在存储数据时安全、稳定。
The embodiment of the present invention discloses a method for storing data and a storage device. The method includes: obtaining data and an error correction code of the data; The codes are respectively stored in different pages of the flash memory. Because the technical scheme of the present invention stores the error correction codes of the data in independent pages, the pages of the storage space are divided into two types, including: one type of page is used to store data, and one type of page is used to store the error correction code of the data. Therefore, the data and all the error correction codes of the data can be obtained through fewer reading times, thereby obtaining correct data, reducing the probability of errors in the storage device, and making the storage device safe and stable when storing data.
Description
技术领域 technical field
本发明涉及电子技术领域,具体涉及一种存储数据的方法及存储装置。The invention relates to the field of electronic technology, in particular to a data storage method and a storage device.
背景技术 Background technique
存储设备对于当今人们的生活有着非常重要的作用,人们用其存储文字资料、图片、视频等等。一种常用的存储设备如固态硬盘(SSD,Solid State Disk),由于它存储容量大,体积小,携带方便,在人们的日常生活中发挥着重要的作用。一种SSD可以是由闪存(Flash)组成的,如与非(NAND)Flash。由于NAND Flash制造工艺的原因,在进行数据的读、写及存储时都可能发生随机比特(bit)翻转,从而导致数据出错。随着制造Flash工艺的不断改进,单位存储空间存储的数据更多,则存储数据出错的机率更大。Storage devices play a very important role in people's lives today. People use them to store text materials, pictures, videos, etc. A commonly used storage device, such as a solid state drive (SSD, Solid State Disk), plays an important role in people's daily life because of its large storage capacity, small size, and easy portability. An SSD may be composed of flash memory (Flash), such as NAND Flash. Due to the NAND Flash manufacturing process, random bit (bit) flips may occur during data reading, writing, and storage, resulting in data errors. With the continuous improvement of the Flash manufacturing process, more data is stored in a unit storage space, and the probability of errors in the stored data is greater.
错误检查和纠正(ECC,Error Checking and Correcting,)技术可以对从Flash读出的数据进行错误检查和纠正,减少从Flash读出的数据的出错率。具体的操作方法包括:Error Checking and Correcting (ECC, Error Checking and Correcting,) technology can perform error checking and correction on data read from Flash, and reduce the error rate of data read from Flash. The specific operation methods include:
首先,对数据编码,具体实现包括:对写入Flash芯片的数据进行计算,从而获取存储数据的纠错码(ECC,Error Correction Code),该获取纠错码的过程也成为编码,其中,存储纠错码的空间也称为检验位,将存储的ECC和数据一起写入Flash芯片中,其中,纠错码的计算是以扇区(Sector)为单位,当获取的一个Sector中存储的数据的纠错码所占用的校验位,大于一个Sector中最多允许的校验位时,将该Sector中存储的数据的纠错码存储到多个Sector的校验位中;First, the data is encoded, and the specific implementation includes: calculating the data written into the Flash chip, so as to obtain the error correction code (ECC, Error Correction Code) of the stored data. The process of obtaining the error correction code is also called encoding. The space of the error correction code is also called the check bit. The stored ECC and data are written into the Flash chip together. The calculation of the error correction code is based on the sector (Sector). When the data stored in a sector is obtained When the check digit occupied by the error correction code is greater than the maximum allowable check digit in a Sector, the error correction code of the data stored in the Sector is stored in the check digits of multiple Sectors;
其次,对数据译码,具体实现包括:当要读取Flash芯片上存储的数据时,将数据和校验位上存储的该数据的纠错码读出,根据读出的纠错码和读数据时产生的纠错码,对读出的数据进行纠正,从而达到读出正确的数据的目的。Secondly, for data decoding, the specific implementation includes: when the data stored on the Flash chip is to be read, the error correction code of the data stored on the data and the check digit is read out, and according to the read error correction code and the read The error-correcting code generated when reading the data corrects the read data, so as to achieve the purpose of reading the correct data.
现有技术中一个扇区中存储空间的分配如图1所示,数据是以Sector为单位写入Flash中,或者从Flash中读出。一个Sector中最多可以存储528个字节(B,Bytes)的数据,但是,其中512B的空间作为数据空间,用于存储数据,16B作为冗余空间。在16B的冗余空间中至少有4B的空间用于存储逻辑块地址(LBA,Logic Block Address)地址,因此,用于存储纠错码的空间最多只有12B。The allocation of storage space in a sector in the prior art is shown in FIG. 1 , and data is written into the Flash or read from the Flash in units of sectors. A Sector can store up to 528 bytes (B, Bytes) of data, but 512B of it is used as data space for storing data, and 16B is used as redundant space. In the 16B redundant space, there is at least 4B space for storing Logical Block Address (LBA, Logic Block Address) addresses, so the space for storing error correction codes is only 12B at most.
在对现有技术的研究和实践过程中,本发明的发明人发现,现有技术中对于1个扇区,每纠正1比特(bit)数据通常需要13bit的纠错码,即要占用13bit的检验位,因此,对于一个扇区中12B空间的检验位最多可以纠正8bit错误数据,当要纠错更多比特的数据时,需要将纠错码存储到更多的Sector的校验位中,一个页中包括多个Sector,其中,页是存储装置写入、读出数据的最小单位,因此,导致了存储装置在读出数据时不能及时获取到与数据对应的纠错码,使得存储装置在存储数据时不够安全、稳定。During the research and practice of the prior art, the inventors of the present invention have found that for one sector in the prior art, a 13-bit error correction code is usually required for correcting 1 bit (bit) data, that is, 13-bit error correction codes are required. Check bit, therefore, the check bit of 12B space in a sector can correct up to 8 bits of erroneous data. When more bits of data are to be corrected, the error correction code needs to be stored in more Sector check bits. A page includes multiple Sectors, where a page is the smallest unit for writing and reading data in a storage device. Therefore, when the storage device reads data, it cannot obtain the error correction code corresponding to the data in time, so that the storage device It is not safe and stable enough to store data.
发明内容 Contents of the invention
本发明实施例提供一种存储数据的方法及存储装置,可以提高存储数据的安全性和稳定性。Embodiments of the present invention provide a data storage method and a storage device, which can improve the security and stability of stored data.
本发明实施例提供一种存储数据的方法,包括:An embodiment of the present invention provides a method for storing data, including:
获得数据和所述数据的纠错码;Obtaining data and an error correction code for the data;
通过与闪存相连的数据通道,将所述数据和所述数据的纠错码分别存储到所述闪存不同的页中。The data and the error correction codes of the data are respectively stored in different pages of the flash memory through a data channel connected to the flash memory.
本发明实施例提供还一种存储装置,其包括:数据通道,闪存,第一获取单元,第二获取单元和控制存储单元;An embodiment of the present invention provides a storage device, which includes: a data channel, a flash memory, a first acquisition unit, a second acquisition unit, and a control storage unit;
所述第一获取单元,用于获取数据;The first acquisition unit is used to acquire data;
所述第二获取单元,用于获取所述数据的纠错码;The second obtaining unit is configured to obtain an error correction code of the data;
所述控制存储单元,用于通过与所述闪存相连的所述数据通道,将所述数据和所述数据的纠错码分别存储到所述闪存不同的页中。The control storage unit is configured to respectively store the data and the error correction code of the data in different pages of the flash memory through the data channel connected to the flash memory.
本发明实施例采用将数据的纠错码存储到独立的页中,即将存储空间的页划分为两类,包括:一类页用于存储数据,一类页用于存储数据的纠错码;因此,可以通过较少读出次数就可以获得数据和数据的所有纠错码,从而获取到正确的数据,减少了存储装置出错的概率,使得存储装置在存储数据时安全、稳定。In the embodiment of the present invention, the error correction code of the data is stored in an independent page, that is, the pages of the storage space are divided into two types, including: one type of page is used to store data, and one type of page is used to store the error correction code of the data; Therefore, the data and all the error correction codes of the data can be obtained through fewer reading times, thereby obtaining correct data, reducing the probability of errors in the storage device, and making the storage device safe and stable when storing data.
附图说明 Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention. For those skilled in the art, other drawings can also be obtained according to these drawings without any creative effort.
图1是现有技术中一个扇区中存储空间的分配图;Fig. 1 is an allocation diagram of storage space in a sector in the prior art;
图2是本发明实施例一提供的一种存储数据的方法流程简图;FIG. 2 is a schematic flowchart of a method for storing data provided by Embodiment 1 of the present invention;
图3是本发明实施例二提供的一种存储数据的方法流程简图;FIG. 3 is a schematic flowchart of a method for storing data provided by
图4是本发明实施例二中一种存储空间的分配示意图;FIG. 4 is a schematic diagram of a storage space allocation in
图5是本发明实施例三提供的一种存储数据的方法流程简图;FIG. 5 is a schematic flowchart of a method for storing data provided by
图6是本发明实施例三中一种存储空间的分配示意图;FIG. 6 is a schematic diagram of a storage space allocation in
图7是本发明实施例四中提供的一种存储装置的逻辑单元示意图。FIG. 7 is a schematic diagram of a logical unit of a storage device provided in Embodiment 4 of the present invention.
具体实施方式 Detailed ways
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.
实施例一、Embodiment one,
本发明实施例提供了一种存储数据的方法,如图2所示,该方法包括:The embodiment of the present invention provides a method for storing data, as shown in Figure 2, the method includes:
步骤1:获取数据和该数据的纠错码(ECC);Step 1: Obtain the data and the error correction code (ECC) of the data;
其中,步骤1中获取的数据可以是接收其它设备发送的需要存储的数据,步骤1中获取该数据的纠错码可以是根据特定的算法,而计算出的数据的纠错码,获取数据的纠错码的具体操作可以参考现有技术。Wherein, the data obtained in
步骤2:通过与闪存相连的数据通道,将数据和数据的纠错码分别存储到闪存不同的页中。Step 2: Store the data and the error correction code of the data in different pages of the flash memory through the data channel connected to the flash memory.
其中,需要说明的是,存储装置在读数据和写数据时,都是以页(Page)为单位进行操作的。在步骤2中数据被存储到一个或者多于一个的页中,将数据的纠错码也存储到一个或者多于一个的页中,其中,存储数据的页和存储数据纠错码的页是不同的页。即可以理解存储装置中的页被分成为两部分,包括:存储数据的页和存储数据纠错码的页。Wherein, it should be noted that, when the storage device reads data and writes data, it operates in units of pages (Page). In
通过对本发明实施例提供的一种存储数据的方法的说明,该方法通过将数据的纠错码存储到独立的页中,即将存储空间的页划分为两类,包括:一类页用于存储数据,一类页用于存储数据的纠错码;因此,可以通过较少读出次数就可以获得数据和数据的所有纠错码,从而获取到正确的数据,减少了存储装置出错的概率,使得存储装置在存储数据时安全、稳定。Through the description of a method for storing data provided by the embodiment of the present invention, the method stores the error correction code of the data in an independent page, that is, the page of the storage space is divided into two types, including: one type of page is used for storing Data, a type of page is used to store the error correction code of the data; therefore, the data and all the error correction codes of the data can be obtained through fewer readout times, thereby obtaining correct data and reducing the probability of errors in the storage device. The storage device is safe and stable when storing data.
实施例二、Embodiment two,
本发明实施例提供了一种存储数据的方法,该方法与实施例一提供的方法相似,包括:都将数据的纠错码单独的以Page为单位进行存储,存储数据纠错码的Page不存储数据,同时,存储数据的Page不存储数据的纠错码;但是,本发明实施例提供一种更具体的存储数据及该数据纠错码的方法,便于通过更少的步骤,更快速的获取到数据的所有纠错码,从而获取到正确的存储数据。The embodiment of the present invention provides a method for storing data, which is similar to the method provided in
如图3所示,该方法包括:As shown in Figure 3, the method includes:
步骤A1:与实施例一中的步骤1相同,即获取数据和该数据的纠错码(ECC);Step A1: the same as
步骤A2:通过与闪存相连的数据通道,将数据和数据的纠错码分别存储到闪存不同的页中;其中,上述数据通道包括至少一条;上述与闪存相连的数据通道包括:与一个或者多于一个的闪存相连的至少一条数据通道;当上述闪存不同的页为闪存中编号相同的不同的页时,上述纠错码为闪存中编号相同的页中存储的数据的纠错码。Step A2: through the data channel connected to the flash memory, store the data and the error correction code of the data in different pages of the flash memory respectively; wherein, the above-mentioned data channel includes at least one; the above-mentioned data channel connected to the flash memory includes: one or more At least one data channel connected to one flash memory; when the different pages of the flash memory are different pages with the same number in the flash memory, the error correction code is the error correction code of the data stored in the page with the same number in the flash memory.
便于理解的说明包括:该存储装置将获取的数据和该数据的纠错码分别存储到不同的页中,当有多于一个闪存,且与闪存(Flash)相连的数据通道包括多于一条时,Flash被划分为多于一个的页,在所有Flash中编号相同的页中,有一个页用于存储纠错码,纠错码为所有Flash中编号相同的页中存储的数据的纠错码。The instructions for easy understanding include: the storage device stores the acquired data and the error correction code of the data in different pages, when there is more than one flash memory, and the data channels connected to the flash memory (Flash) include more than one , Flash is divided into more than one page, in all the pages with the same number in Flash, there is a page for storing error correction code, the error correction code is the error correction code of the data stored in the pages with the same number in all Flash .
需要理解的是,数据通道是用于将数据和纠错码输入给存储装置中的存储空间,或者,将数据和纠错码从存储空间输出。这里所述的存储空间通常是由多个闪存组成,一个数据通道通常与一个或者多于一个的闪存相连,闪存被划分为多个页,闪存以页为单位输出页中存储的数据或纠错码,以页为单位写入数据或者纠错码。It should be understood that the data channel is used to input data and error correction codes to the storage space in the storage device, or to output data and error correction codes from the storage space. The storage space described here is usually composed of multiple flash memories. A data channel is usually connected to one or more than one flash memory. The flash memory is divided into multiple pages. The flash memory outputs the data stored in the page or error correction in units of pages. Code, write data or error correction code in units of pages.
通常多条数据通道并行将数据输入或者输出存储装置。如图4所示,以存储装置中有四条数据通道为例,包括:第零通道(Channle0),第一通道(Channel1),第二通道(Channel2),和第三通道(Channel3)。其中,与每条通道相连的Flash中的各Page的编号是不同的,如图中显示出了与每个通道相连的Flash中的编号从Page0至Page7的编号连续的页。其中,步骤A2中所说的“在所有Flash中编号相同的页中,有一个页用于存储纠错码,纠错码为所有Flash中编号相同的页中存储的数据的纠错码”,针对图4的理解是,将与Channel0至Channel3相连的Flash中编号为Page0的页中,有一个页(即Channel0的Page0)用于存储与Channel1至Channel3相连的Flash中所有Page0中数据的纠错码。即将所有与数据通道相连的Flash中Page0内存储的数据定义为data0,所有与数据通道相连的Flash中Page1内存储的数据定义为data1,以此类推;把data0的纠错码存储在Page0的其中一个页中(即如图4中校验位Parity0所在的页),把data1的纠错码存储在Page1的一个页中(即如图4中校验位Parity1所在的页),以此类推。Typically multiple data channels pass data into or out of the storage device in parallel. As shown in FIG. 4 , taking four data channels in the storage device as an example, they include: the zeroth channel (Channel0 ), the first channel (Channel1 ), the second channel (Channel2 ), and the third channel (Channel3 ). Wherein, the numbering of each Page in the Flash connected to each channel is different, as shown in the figure, the consecutive pages with numbers from Page0 to Page7 in the Flash connected to each channel are shown. Wherein, said in step A2 " in all the pages with the same number in the Flash, there is a page for storing the error correction code, and the error correction code is the error correction code of the data stored in the pages with the same number in all the Flash", The understanding of Figure 4 is that among the pages numbered Page0 in the Flash connected to Channel0 to Channel3, there is a page (ie, Page0 of Channel0) used to store the error correction of the data in all Page0 in the Flash connected to Channel1 to Channel3 code. The data stored in Page0 of all Flash connected to the data channel is defined as data0, the data stored in Page1 of all Flash connected to the data channel is defined as data1, and so on; the error correction code of data0 is stored in Page0 In a page (that is, the page where the parity bit Parity0 is located in Figure 4), the error correction code of data1 is stored in a page of Page1 (ie, the page where the parity bit Parity1 is located in Figure 4), and so on.
还需要理解的是,所有数据中编号相同的页的物理地址通常是连续的,例如:通常与Channel0相连的Flash中的page0、与Channel1相连的Flash中的page0、与Channel2相连的Flash中的page0,和与Channel3相连的Flash中的page0的物理地址连续。It also needs to be understood that the physical addresses of pages with the same number in all data are usually continuous, for example: page0 in Flash connected to Channel0, page0 in Flash connected to Channel1, page0 in Flash connected to Channel2 , which is continuous with the physical address of page0 in the Flash connected to Channel3.
通过上述对本发明实施例提供的一种存储数据的方法的说明,当读取连续地址数据时,因为通道间并发,读一次就可以得到数据及该数据的纠错码,从而进行数据校验并输出。从而获取到正确的数据,减少了存储装置出错的概率,使得存储装置在存储数据时安全、稳定。Through the above description of a method for storing data provided by the embodiment of the present invention, when reading continuous address data, because the channels are concurrent, the data and the error correction code of the data can be obtained by reading once, so as to perform data verification and output. Therefore, correct data is obtained, the probability of errors in the storage device is reduced, and the storage device is safe and stable when storing data.
进一步,为了保证当读取地址不连续数据时,可以通过尽可能少的操作就可以读取数据对应的纠错码,则步骤A2中存储纠错码的页,还需要进一步限制,即:在与至少一条数据通道中的一条数据通道相连的闪存中,当与一个数据通道相连的闪存中不同的页为闪存中编号连续的N个页时,将纠错码存储在编号连续的N个页的一个页中,N的取值为所有数据通道的数量。Further, in order to ensure that when the address discontinuous data is read, the error correction code corresponding to the data can be read with as few operations as possible, the page for storing the error correction code in step A2 needs to be further restricted, namely: In the flash memory connected to one data channel in at least one data channel, when the different pages in the flash memory connected to one data channel are N pages with consecutive numbers in the flash memory, store the error correction code in the N pages with consecutive numbers In a page of , the value of N is the number of all data channels.
上一段文字的说明可以理解为,对步骤A2中存储纠错码的页,进一步限制包括:与一个数据通道相连的所有Flash中,编号连续的N个页中,只有一个页用于存储纠错码,其中,N为所有数据通道的数量。The explanation in the previous paragraph can be understood as, for the page storing the error correction code in step A2, further restrictions include: in all the Flash connected to a data channel, among the N pages with consecutive numbers, only one page is used to store the error correction code code, where N is the number of all data channels.
为了便于理解上一段文字,仍然参见图4所示,由于多条数据通道并行将数据输出存储装置,且同一时刻读取的地址是不连续时,例如:同一时刻读取的页包括:与Channel0相连的Flash中的Page0,与Channel1相连的Flash中的Page0,与Channel2相连的Flash中的Page1,与Channel3相连的Flash中的Page2,即读取的数据顺序的是:Parity0,data0,data1,data2。In order to facilitate the understanding of the previous paragraph, please still refer to Figure 4. Since multiple data channels output data to the storage device in parallel, and the addresses read at the same time are discontinuous, for example: the pages read at the same time include: and Channel0 Page0 in the connected Flash, Page0 in the Flash connected to Channel1, Page1 in the Flash connected to Channel2, Page2 in the Flash connected to Channel3, that is, the order of the read data is: Parity0, data0, data1, data2 .
由于与一个数据通道相连的所有Flash中,编号连续的N个页中,只有一个页用于存储纠错码,因此,存储装置再输出一次就可以将所有数据的纠错码读出,即下一刻读取的页至少包括:与Channel1相连的Flash中的Page1中存储的Parity1,和与Channel2相连的Flash中的Page2中存储的Parity2。如果Parity1和Parity2都存储在同一个数据通道中,就不可能在一次读取出data1、data2的纠错码Parity1、Parity2。Since in all the Flashes connected to a data channel, only one page is used to store the error correction code among the consecutively numbered N pages, the error correction code of all the data can be read out by the storage device outputting again, that is, the following The pages read at a moment include at least: Parity1 stored in Page1 in the Flash connected to Channel1, and Parity2 stored in Page2 in the Flash connected to Channel2. If both Parity1 and Parity2 are stored in the same data channel, it is impossible to read the error correction codes Parity1 and Parity2 of data1 and data2 at one time.
通过执行上述存储数据的方法,如图4所示,为最终在数据通道中输入的数据和数据的纠错码的分布示意图,可以看出,每个通道中连续四个页中只有一个页用于存储纠错码,其它三个页存储的数据。因此,用于存储纠错码页形成了如图4所示的有规律的阶梯分布。By implementing the above method of storing data, as shown in Figure 4, it is a schematic diagram of the distribution of the data finally input in the data channel and the error correction code of the data. It can be seen that only one of the four consecutive pages in each channel is used For storing error correction codes, the other three pages store data. Therefore, the pages used to store the error correction code form a regular step distribution as shown in FIG. 4 .
还需要说明的是,上述是以四条数据通道的存储装置进行举例说明,对于其它数量数据通道的情况,可以由此处的说明容易推出,因此,此处不应该理解为对本发明实施例的限制。It should also be noted that the above is an example of a storage device with four data channels. For other numbers of data channels, it can be easily deduced from the description here. Therefore, this should not be construed as limiting the embodiment of the present invention .
实施例三、Embodiment three,
本发明实施例提供了一种存储数据的方法,本发明实施例提供了一种存储数据的方法,该方法与实施例一提供的方法相似,包括:都将数据的纠错码单独的以Page为单位进行存储,存储数据纠错码的Page不存储数据,同时,存储数据的Page不存储数据的纠错码;但是,本发明实施例提供另一种更具体的存储数据及该数据纠错码的方法,便于通过更少的步骤,更快速的获取到数据的所有纠错码,从而获取到正确的存储数据。The embodiment of the present invention provides a method for storing data. The embodiment of the present invention provides a method for storing data. This method is similar to the method provided in
如图5所示,该方法包括:As shown in Figure 5, the method includes:
步骤B1:与实施例一中的步骤1相同,即获取数据和该数据的纠错码(ECC);Step B1: the same as
步骤B2:将数据和数据的纠错码分别存储到与不同数据通道相连的闪存的不同的页中;其中,上述数据通道包括至少一条;上述与闪存相连的数据通道包括:与一个或者多于一个的闪存相连的至少一条数据通道。Step B2: Store the data and the error correction codes of the data in different pages of the flash memory connected to different data channels; wherein, the above-mentioned data channels include at least one; the above-mentioned data channels connected to the flash memory include: one or more than one At least one data channel connected to a flash memory.
对步骤B2可以理解为:将获取的数据和该数据的纠错码分别存储到不同的页中,其中,当有多于一个闪存,且与闪存(Flash)相连的数据通道包括多于一条时,Flash被划分为多于一个页,与一条数据通道相连的所有Flash中存储的数据,与该数据的纠错码,存储在与不同的数据通道相连的闪存中;一条数据通道为任意一条数据通道。Step B2 can be understood as: storing the obtained data and the error correction code of the data in different pages, wherein, when there is more than one flash memory, and the data channel connected to the flash memory (Flash) includes more than one , Flash is divided into more than one page, the data stored in all Flash connected to one data channel, and the error correction code of the data are stored in flash memory connected to different data channels; one data channel is any data aisle.
其中,在步骤B2中将与一条数据通道相连的Flash中存储的数据的纠错码,存储在不同的Flash中,该不同的Flash是指与另一数据通道相连的Flash,当通道间并发数据时,可以将数据与该数据的纠错码同时输出,从而可以快速获取到正确的数据。Wherein, in step B2, the error correction code of the data stored in the Flash connected to one data channel is stored in different Flashes, and this different Flash refers to the Flash connected to another data channel. When , the data and the error correction code of the data can be output at the same time, so that the correct data can be obtained quickly.
如图6所示,以存储装置中有四条数据通道为例,存储数据的空间和数据纠错码的空间的分布示意图。其中,在各数据通道中自定义一段地址空间用于存储数据的纠错码,即如图6中每条数据通道中有线条一段地址空间是用于存储数据的纠错码;为了便于理解,在图6中把与Channel0相连的Flash中存储的所有数据定义为data0,把与Channel1相连的Flash中存储的所有数据定义为data1,与Channel2相连的Flash中存储的所有数据定义为data2,与Channe3相连的Flash中存储的所有数据定义为data3。将data0得所有纠错码存放在与Channel1相连的Flash中自定义的一段地址空间(即parity0),将data1得所有纠错码存放在与Channel2相连的Flash中自定义的一段地址空间(即parit1),将data2得所有纠错码存放在与Channel3相连的Flash中自定义的一段地址空间(即parity2),将data3得所有纠错码存放在与Channel0相连的Flash中自定义的一段地址空间(即parity3)。As shown in FIG. 6 , taking four data channels in the storage device as an example, the distribution diagram of the space for storing data and the space for data error correction codes is shown. Among them, a section of address space is defined in each data channel for error correction codes for storing data, that is, as shown in Figure 6, there is a line in each data channel and a section of address space is an error correction code for storing data; for easy understanding, In Figure 6, define all the data stored in the Flash connected to Channel0 as data0, define all the data stored in the Flash connected to Channel1 as data1, define all the data stored in the Flash connected to Channel2 as data2, and define all the data stored in the Flash connected to Channel2 as data2. All data stored in the connected Flash is defined as data3. Store all the error correction codes of data0 in a self-defined address space (i.e. parity0) in the Flash connected to Channel1, and store all the error correction codes of data1 in a self-defined address space in the Flash connected to Channel2 (i.e. parit1 ), store all the error correction codes of data2 in a self-defined address space (ie parity2) in the Flash connected to Channel3, and store all the error correction codes of data3 in a self-defined address space in the Flash connected to Channel0 ( Namely parity3).
其中,每个自定义的一段地址空间中都包括至少一个页。还需要理解的是,上述是有规律的存储数据的纠错码的情况,即如图6所示,与每一条数据通道相连的Flash中存储的数据的纠错码,存储在与之编号相邻的下一条数据通道相连的Flash中自定义的地址空间中。事实上,与一条数据通道相连的Flash中存储的数据,与该数据通道相连的Flash中存储的数据的纠错码,满足分别存储在与不同的数据通道相连的Flash中即可,当需要读取该数据通道中存储的数据时,就可以根据存储该数据的纠错码的地址,读出纠错码。其中,读出数据和数据的纠错码可以是同时的,也可以是分两次,包括:一次读出数据,一次读出数据的纠错码。读出数据及纠错码是可以根据存储数据及数据的纠错码的地址,选择最快速的读出数据及其纠错码的策略的。Wherein, each customized segment of address space includes at least one page. It should also be understood that the above is the case of the error correction codes of the regularly stored data, that is, as shown in Figure 6, the error correction codes of the data stored in the Flash connected to each data channel are stored in In the user-defined address space in the Flash connected to the adjacent next data channel. In fact, the data stored in the Flash connected to a data channel and the error correction code of the data stored in the Flash connected to the data channel can be stored in the Flash connected to different data channels respectively. When fetching the data stored in the data channel, the error correction code can be read out according to the address of the error correction code storing the data. Wherein, the reading of the data and the error correction code of the data may be performed simultaneously, or may be divided into two steps, including: reading the data once, and reading the error correction code of the data once. For reading data and error correction codes, the fastest strategy for reading data and error correction codes can be selected according to the address of the stored data and error correction codes.
通过对本发明实施例提供的一种存储数据的方法的说明,该方法将获取的数据和该数据的纠错码分别存储到不同的页中,其中,当有多于一个闪存,且与闪存(Flash)相连的数据通道包括多于一条时,Flash被划分为多于一个的页,与一条数据通道相连的所有Flash中存储的数据,与该数据的纠错码,存储在与不同的数据通道相连的闪存中;一条数据通道为任意一条数据通道;因此,可以通过较少读出次数就可以获得数据和数据的所有纠错码,从而获取到正确的数据,减少了存储装置出错的概率,使得存储装置在存储数据时安全、稳定。Through the description of a method for storing data provided by an embodiment of the present invention, the method stores the obtained data and the error correction code of the data in different pages, wherein, when there is more than one flash memory, and the flash memory ( When the data channel connected to Flash) includes more than one, Flash is divided into more than one page, and the data stored in all Flash connected to one data channel, and the error correction code of the data, are stored in different data channels In the connected flash memory; a data channel is any data channel; therefore, the data and all the error correction codes of the data can be obtained through fewer readout times, thereby obtaining correct data and reducing the probability of errors in the storage device. The storage device is safe and stable when storing data.
实施例四、Embodiment four,
本发明实施例提供一种存储装置,如图7所示,该存储装置包括:第一获取单元100,第二获取单元101,控制存储单元102,数据通道103和闪存104。An embodiment of the present invention provides a storage device. As shown in FIG. 7 , the storage device includes: a
其中,第一获取单元100,用于获取数据;Wherein, the
第二获取单元101,用于获取第一获取单元100中获取数据的纠错码;The second obtaining
其中,第一获取单元100中获取的数据可以是接收其它设备发送的需要存储的数据,第二获取单元101中获取该数据的纠错码可以是根据特定的算法,而计算出的数据的纠错码,获取数据的纠错码的具体操作可以参考现有技术。Wherein, the data obtained in the first obtaining
控制存储单元102,用于通过与闪存相连的数据通道,将数据和数据的纠错码分别存储到闪存不同的页中。The
数据通道103,用于传输数据及数据的纠错码,与现有技术中数据通道相同;The
闪存104,用于存储数据及纠错码,其中,闪存以页为单位被划分,与现有技术中闪存相同。The
其中,数据被存储到一个或者多于一个的页中,将数据的纠错码也存储到一个或者多于一个的页中,其中,存储数据的页和存储数据纠错码的页是不同的页。Wherein, the data is stored in one or more than one page, and the error correction code of the data is also stored in one or more than one page, wherein, the page storing the data is different from the page storing the data error correction code Page.
通过对本发明实施例提供的一种存储装置的说明,该装置通过将数据的纠错码存储到独立的页中,即将存储空间的页划分为两类,包括:一类页用于存储数据,一类页用于存储数据的纠错码;因此,可以通过较少读出次数就可以获得数据和数据的所有纠错码,从而获取到正确的数据,减少了存储装置出错的概率,使得存储装置在存储数据时安全、稳定。Through the description of a storage device provided by the embodiment of the present invention, the device stores the error correction code of the data in an independent page, that is, the page of the storage space is divided into two types, including: one type of page is used to store data, One type of page is used to store the error correction codes of the data; therefore, the data and all the error correction codes of the data can be obtained through fewer readout times, thereby obtaining correct data, reducing the probability of errors in the storage device, and making the storage The device is safe and stable when storing data.
可选的,当数据通道包括至少一条;且与一个或者多于一个的闪存与每一条数据通道相连;Optionally, when the data channel includes at least one; and one or more than one flash memory is connected to each data channel;
则控制存储单元102,具体用于通过与闪存相连的数据通道,将数据和数据的纠错码分别存储到闪存不同的页中;当闪存不同的页为闪存中编号相同的不同的页时,纠错码为闪存中编号相同的页中存储的数据的纠错码。Then control the
对于上两段文字对控制存储单元102的说明,还可以理解为,控制存储单元102具体用于将获取的数据和该数据的纠错码分别存储到不同的页中,其中,当有多于一个闪存,且与闪存(Flash)相连的数据通道包括多于一条时,Flash被划分为多于一个的页,在所有Flash中编号相同的页中,有一个页用于存储纠错码,纠错码为所有Flash中编号相同的页中存储的数据的纠错码。Regarding the description of the
其中,需要理解的是,该存储装置可以包括一个或者一个以上的Flash,该Flash提供存储空间,即用于存储数据和/或数据的纠错码,每个Flash又被划分为多个页,页是对Flash进行读或者写操作的最小单元。Wherein, it should be understood that the storage device may include one or more than one Flash, and the Flash provides a storage space, that is, an error correction code for storing data and/or data, and each Flash is divided into multiple pages, A page is the smallest unit for reading or writing to Flash.
通过对该存储装置中的控制存储单元102的进一步说明,使得该存储装置在当读取连续地址数据时,因为通道间并发,读一次就可以得到数据及该数据的纠错码,从而进行数据校验并输出。从而获取到正确的数据,减少了存储装置出错的概率,使得存储装置在存储数据时安全、稳定。Through further description of the
进一步,在上述关于该存储装置102的进一步说明的基础上,该存储装置102中与一个数据通道相连的所有Flash中,编号连续的N个页中,只有一个页用于存储纠错码,其中,N为所述数据通道的数量。Further, on the basis of the above further description about the
对上一段文字的说明也可以理解为:在与至少一条数据通道中的一条数据通道相连的闪存中,当与一个数据通道相连的闪存中不同的页为闪存中编号连续的N个页时,将纠错码存储在编号连续的N个页的一个页中,N的取值为所有数据通道的数量。The description of the previous paragraph can also be understood as: in the flash memory connected to at least one data channel in the flash memory, when the different pages in the flash memory connected to one data channel are N pages with consecutive numbers in the flash memory, The error correction code is stored in one page of N pages with consecutive numbers, and the value of N is the number of all data channels.
通过进一步增加对该存储装置中的控制存储单元102的说明,使得该存储装置在当读取地址不连续数据时,可以通过尽力少的操作就可以读取数据对应的纠错码。By further adding the description of the
可选的,该存储装置中当数据通道包括至少一条;且与一个或者多于一个的闪存与每一条数据通道相连;则控制存储单元102,具体用于将数据和数据的纠错码分别存储到与不同数据通道相连的闪存的不同的页中。Optionally, when the data channel in the storage device includes at least one; and one or more than one flash memory is connected to each data channel; then the
也可以理解为该存储装置中的控制存储单元102,可以具体用于将获取的数据和该数据的纠错码分别存储到不同的页中,其中,当有多于一个闪存,且与闪存(Flash)相连的数据通道包括多于一条时,Flash被划分为多于一个的页,与一条数据通道相连的所有Flash中存储的数据,与该数据的纠错码,存储在与不同的数据通道相连的闪存中;一条数据通道为任意一条数据通道。It can also be understood that the
通过上一段文字对该控制存储单元102的限定,使得该存储装置将与一条数据通道相连的Flash中存储的数据的纠错码,存储在与零一条数据通道相连的Flash中,当通道间并发数据时,可以将数据与该数据的纠错码同时输出,从而可以快速获取到正确的数据。The limitation of the
还需要说明的是,对于该存储装置的更多详细说明和理解,可以参考方法实施例一,二,和三中的说明。It should also be noted that for more detailed description and understanding of the storage device, reference may be made to the descriptions in
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读存储介质中,存储介质可以包括:ROM、RAM、磁盘或光盘等。Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above-mentioned embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium, and the storage medium can include: ROM, RAM, disk or CD, etc.
以上对本发明实施例所提供一种存储数据的方法及存储装置进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。The method and storage device for storing data provided by the embodiment of the present invention have been described above in detail. In this paper, specific examples are used to illustrate the principle and implementation of the present invention. The description of the above embodiment is only used to help understand the present invention. The method of the invention and its core idea; at the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation and scope of application. In summary, the content of this specification should not be understood To limit the present invention.
Claims (6)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN200910173950.3A CN102024497B (en) | 2009-09-22 | 2009-09-22 | Method for storing data and storage device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN200910173950.3A CN102024497B (en) | 2009-09-22 | 2009-09-22 | Method for storing data and storage device |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN102024497A CN102024497A (en) | 2011-04-20 |
| CN102024497B true CN102024497B (en) | 2013-10-02 |
Family
ID=43865690
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN200910173950.3A Expired - Fee Related CN102024497B (en) | 2009-09-22 | 2009-09-22 | Method for storing data and storage device |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN102024497B (en) |
Families Citing this family (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US8880977B2 (en) * | 2011-07-22 | 2014-11-04 | Sandisk Technologies Inc. | Systems and methods of storing data |
| CN110457160B (en) * | 2019-07-02 | 2023-11-17 | 深圳市金泰克半导体有限公司 | Error correction method and device |
Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1737801A (en) * | 2005-09-05 | 2006-02-22 | 威盛电子股份有限公司 | Data storage structure and method |
| CN101427225A (en) * | 2000-11-22 | 2009-05-06 | 三因迪斯克公司 | Operational Techniques for Non-Volatile Memory Systems with Data Sector Sizes Different from Memory Page and/or Block Sizes |
Family Cites Families (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US7155559B1 (en) * | 2000-08-25 | 2006-12-26 | Lexar Media, Inc. | Flash memory architecture with separate storage of overhead and user data |
| US6906961B2 (en) * | 2003-06-24 | 2005-06-14 | Micron Technology, Inc. | Erase block data splitting |
-
2009
- 2009-09-22 CN CN200910173950.3A patent/CN102024497B/en not_active Expired - Fee Related
Patent Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101427225A (en) * | 2000-11-22 | 2009-05-06 | 三因迪斯克公司 | Operational Techniques for Non-Volatile Memory Systems with Data Sector Sizes Different from Memory Page and/or Block Sizes |
| CN1737801A (en) * | 2005-09-05 | 2006-02-22 | 威盛电子股份有限公司 | Data storage structure and method |
Also Published As
| Publication number | Publication date |
|---|---|
| CN102024497A (en) | 2011-04-20 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11379301B2 (en) | Fractional redundant array of silicon independent elements | |
| US8239725B2 (en) | Data storage with an outer block code and a stream-based inner code | |
| KR101576102B1 (en) | Method for reading data from block of flash memory and associated memory device | |
| TWI514139B (en) | Physical page, logical page, and codeword correspondence | |
| KR101730510B1 (en) | Non-regular parity distribution detection via metadata tag | |
| TW201545167A (en) | Method of handling error correcting code in non-volatile memory and non-volatile storage device using the same | |
| CN103187104A (en) | Error correction method of memory | |
| TWI528372B (en) | Data storage device and data checking and correcting for volatile memory | |
| CN107918524A (en) | Data storage device and data maintenance method | |
| CN103594120A (en) | Memorizer error correction method adopting reading to replace writing | |
| US9754682B2 (en) | Implementing enhanced performance with read before write to phase change memory | |
| CN113838510A (en) | Fast replication via controller | |
| CN112214346A (en) | Method and apparatus for error detection during data modification in a memory subsystem | |
| CN111061592A (en) | Universal Nand Flash bit reversal error correction method | |
| CN101634938A (en) | Data migration method and data migration device of solid state disk and solid state disk | |
| CN101308706B (en) | Data writing method and error correction encoding/decoding method suitable for flash memory | |
| CN100458718C (en) | Method of correcting error code for multiple sector | |
| CN114913900B (en) | NAND error handling method, device, computer equipment and storage medium with static ECC error correction | |
| CN102024497B (en) | Method for storing data and storage device | |
| US10649841B2 (en) | Supporting multiple page lengths with unique error correction coding via galois field dimension folding | |
| CN104681095B (en) | Storage device and method of operation thereof | |
| CN102541677A (en) | Implementation method for increasing comparison table loading speed of nandflash storage device | |
| CN101996688B (en) | Flash memory control method using variable error correction code capacity | |
| CN111597126B (en) | Access method | |
| TWI537971B (en) | Storage device and access method thereof |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| C14 | Grant of patent or utility model | ||
| GR01 | Patent grant | ||
| C56 | Change in the name or address of the patentee |
Owner name: HUAWEI DIGITAL TECHNOLOGY (CHENGDU) CO., LTD. Free format text: FORMER NAME: CHENGDU HUAWEI SYMANTEC TECHNOLOGIES CO., LTD. |
|
| CP01 | Change in the name or title of a patent holder |
Address after: 611731 Chengdu high tech Zone, Sichuan, West Park, Qingshui River Patentee after: HUAWEI DIGITAL TECHNOLOGIES (CHENG DU) Co.,Ltd. Address before: 611731 Chengdu high tech Zone, Sichuan, West Park, Qingshui River Patentee before: CHENGDU HUAWEI SYMANTEC TECHNOLOGIES Co.,Ltd. |
|
| TR01 | Transfer of patent right | ||
| TR01 | Transfer of patent right |
Effective date of registration: 20220831 Address after: No. 1899 Xiyuan Avenue, high tech Zone (West District), Chengdu, Sichuan 610041 Patentee after: Chengdu Huawei Technologies Co.,Ltd. Address before: 611731 Qingshui River District, Chengdu hi tech Zone, Sichuan, China Patentee before: HUAWEI DIGITAL TECHNOLOGIES (CHENG DU) Co.,Ltd. |
|
| CF01 | Termination of patent right due to non-payment of annual fee | ||
| CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20131002 |
