WO2012022024A1 - 对存储设备中的数据进行搬移的方法、装置及存储设备 - Google Patents

对存储设备中的数据进行搬移的方法、装置及存储设备 Download PDF

Info

Publication number
WO2012022024A1
WO2012022024A1 PCT/CN2010/076047 CN2010076047W WO2012022024A1 WO 2012022024 A1 WO2012022024 A1 WO 2012022024A1 CN 2010076047 W CN2010076047 W CN 2010076047W WO 2012022024 A1 WO2012022024 A1 WO 2012022024A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
register
storage device
command
move
Prior art date
Application number
PCT/CN2010/076047
Other languages
English (en)
French (fr)
Inventor
黎小红
张琴
李欣
Original Assignee
成都市华为赛门铁克科技有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 成都市华为赛门铁克科技有限公司 filed Critical 成都市华为赛门铁克科技有限公司
Priority to PCT/CN2010/076047 priority Critical patent/WO2012022024A1/zh
Priority to CN2010800686124A priority patent/CN103229154A/zh
Publication of WO2012022024A1 publication Critical patent/WO2012022024A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/08Error detection or correction by redundancy in data representation, e.g. by using checking codes
    • G06F11/10Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's

Definitions

  • the present invention relates to the field of data storage technologies, and in particular, to a method, an apparatus, and a storage device for moving data in a storage device.
  • the page is the basic storage unit, and the data in the storage device is different from the ordinary storage device.
  • a solid state drive also known as an electronic hard disk or a solid state electronic disk
  • flash memory usually uses a NAND flash memory as a storage medium. Flash internally organizes data by means of blocks and pages. Among them, a page storage unit, a piece of Flash is composed of a plurality of blocks, and one block is composed of a plurality of pages.
  • the basic operations of Flash are: read, write, erase, where the basic unit of read and write operations is the page, and the basic unit of the erase operation is the block.
  • the data of the source block needs to be moved to the destination block.
  • the external controller reads the data in the source block, and then the data in the source block is written by the external controller into the destination block.
  • the external controller can only read and write one page of data at a time; and one block contains multiple pages of data, so the external controller needs to be used throughout the data transfer process. Performing multiple read and write operations, which seriously affects system performance.
  • the copyback command which is a copy command that allows you to copy a page from one block (source block) to a page in another block (destination block). . Therefore, when using the copyback command for data movement, the external controller only needs to send the copyback command, and Flash can automatically move the data in the source block to the destination block.
  • the external controller since the unit of the copyback operation is also a page, the external controller may also need to send multiple commands, but the number of read and write operations of the external controller can be reduced. As you can see, when you use the copyback command, you can greatly improve the system performance.
  • Embodiments of the present invention provide a method, apparatus, and storage device for moving data in a storage device, which can improve the reliability of data and reduce the impact on system performance while performing data movement.
  • a method for moving data in a storage device including:
  • the corrected data is written to the data register and a second move command is issued to the storage device to command the storage device to move data in the data register to the destination block.
  • a method for moving data in a storage device including:
  • the data of the source block is moved to the data register; when the second move command of the external controller is received, the data in the data register is moved to the destination block.
  • a device for moving data in a storage device comprising:
  • a first moving command unit configured to send a first move command to the storage device, to instruct the storage device to move data in the source block to the data register;
  • a verifying unit configured to read data in the data register, and verify data in the data register
  • An error correction unit configured to perform error correction on the data in the data register if the data error in the data register is verified, and write the corrected data to the data register;
  • a second move command unit configured to issue a second move command to the storage device to instruct the storage device to move data in the data register to the destination block.
  • a storage device comprising: a first moving unit, configured to: when receiving the first moving command of the external controller, move the data of the source block to the data register;
  • the second shifting unit is configured to move the data in the data register to the destination block when receiving the second move command of the external controller.
  • data can be verified during the execution of the COPYBACK command, and if the verification result is correct, the storage device is directly commanded to move the data in the page register to the destination block. Therefore, in the case of correct verification, the external controller does not need to perform a write operation, thereby reducing the impact on system performance. At the same time, since the data has been verified by the external controller, the data can be improved. Sex.
  • the data can be corrected, and then the corrected data is written to the page register, and then the memory device is commanded to move the corrected data in the page register to the destination block. To ensure the reliability of the data.
  • FIG. 2 is a schematic structural diagram of a command provided by an embodiment of the present invention.
  • FIG. 3 is a schematic diagram of a method provided by an embodiment of the present invention.
  • FIG. 5 is a schematic diagram of an apparatus according to an embodiment of the present invention.
  • FIG. 6 is a schematic diagram of a storage device according to an embodiment of the present invention. detailed description
  • NAND Flash has the following features: Write operations must be performed in a blank area. If data is already present in the target area, it must be erased and then written. That is, the destination block must be erased before writing data to the destination page.
  • write operations must be performed in a blank area. If data is already present in the target area, it must be erased and then written. That is, the destination block must be erased before writing data to the destination page.
  • the user needs to rewrite the data of a page in a block, that is, the data already exists in the block, but the data of one of the pages needs to be modified.
  • the data of one of the pages needs to be modified.
  • another block that has been erased is used as a new block, and the data in the block is moved to a new block. In the process of moving, the rewritten data is written to the corresponding page of the new block.
  • bad blocks may be generated during and during NAND Flash production.
  • a bad block is characterized by an error when writing data to this block or erasing the block. Therefore, you may encounter bad blocks in the process of writing data to a block, that is, some data has already been written in the block, but when it reaches a certain page, it is found that it cannot be written. At this point, you need to back up the contents of other good pages in the bad block to another empty good block. Therefore, you need to use another erased block as the new block, which already exists in the bad block. The data is moved to a new block.
  • the data in the source block needs to be moved to the destination block.
  • the block in which the data to be rewritten is located, or the block in which the bad block occurs is the source block, and the block that is erased as another block of the new block is the destination block.
  • the user data is stored in the block m. If the page n needs to be rewritten, according to the characteristics of the flash, the modified data cannot be directly written into the block m, and another erased block must be found. Block p, then move the valid data in block m and the data to be overwritten to block p.
  • the copyback command is used, in the above example, the process of data movement is: Move all the pages before page n using the copyback command to move the corresponding page of the block; the external controller writes the modified page n data to the page of the block. n; Then, use all the pages after age n to use the copyback command to move the corresponding page of the block.
  • the solid state hard disk is composed of a control unit and a solid state storage unit (DRAM or FLASH chip).
  • the main function of the control unit is to read and write data
  • the main function of the storage unit is to store data.
  • the external controller sends a command to the control unit of the SSD, and then the control unit of the SSD completes the specific data transfer process. Therefore, the external controller can be used to perform the write operation.
  • the block's data is moved to the corresponding page in the new block. Therefore, the data does not pass through the external controller during the entire data transfer process.
  • the control unit of the SSD usually does not have the data check function. Therefore, if some data in the copyback process generates an error, it cannot be found or corrected in time, so that the data in the destination block may already have an error.
  • the NAND Flash error will generally not cause the entire block or the entire page to be wrong, but only one or a few bits in the page are faulty, based on this feature.
  • Data in NAND Flash is usually verified by ECC (Error Checking and Correcting).
  • ECC Error Checking and Correcting
  • the error correction capability of ECC is usually limited. For example, when Hamming code error correction is used, only single bit errors and double bit errors can be corrected. That is, when only one bit in the data is wrong, ECC can be detected.
  • the error is corrected and can be corrected; however, when the data of two bits in the data is in error, the error can only be detected using ECC, but cannot be corrected; if the data of three bits in the data is wrong, The error cannot be detected using ECC.
  • ECC Error Correction Code
  • the ECC with strong error correction is usually used for error correction. For example, a 4-bit or 8-bit error can usually be corrected.
  • ECC error correction capability
  • the error correction capability of ECC is always limited. If the copyback process causes errors in the data moved to the destination block, then when the data in the destination block is verified (in When the data in the destination block needs to be used, the data in the block will be checked first.) The data may be invalid due to the error correction capability beyond the ECC.
  • the embodiment of the present invention provides the data in the storage device based on the foregoing problem.
  • the method of moving is described in detail below.
  • a method for moving data in a storage device includes the following steps:
  • the transfer of addresses, commands, and data is done through the page registers of NAND Flash, where the page register is a type of data register.
  • the control unit in NAND Flash executes the copyback command,
  • the data in the source block is first moved to the page register and then moved from the page register to the destination block. Since the unit of the copyback operation is a page, each time one page of data is moved to the page register.
  • the external controller is also performed using ECC. Because ECC encoding is performed when data is stored in NAND Flash, ECC can be used to determine whether the data in the register is correct when performing verification.
  • ECC Error Correction Code
  • S104 Write the corrected data to the data register, and issue a second move command to the storage device to instruct the storage device to move data in the data register to the destination block.
  • the second move command may be directly sent to the storage device to command the control unit in the storage device to data in the data register. Move to the destination block. If the result of the check is that there is an error in the data in the data register, the external controller needs to correct the data in the data register. Wrong, the corrected data is written to the data register and a second move command is issued to the storage device to command the storage device to move the data in the data register to the destination block. It can be seen that, in the embodiment of the present invention, after the control unit in the storage device moves the data in the source block to the data register, it does not directly move the data in the data register to the destination block, but waits for the external controller. The second move command moves the data in the data register to the destination block only when the second move command of the external controller is received.
  • the first move command may be expressed as a read for copyback (copyback read command), and the second move command may be represented as a program for copyback (copyback):
  • Step 1 The external controller sends a read for copyback command to the control unit in the NAND Flash to instruct the control unit in the NAND Flash to move the data in the source block to the page register;
  • the control unit in NAND Flash performs data movement in units of pages, that is, each time one page of data is transferred from the source block to the page register.
  • Step 2 The external controller reads the data in the page register
  • Step 3 The external controller verifies the data in the register
  • Step 4 If the verification result is correct, send the program for copyback command to the control unit in NAND Flash.
  • the control unit in NAND Flash receives program for After the copyback command, the data in the page register can be directly moved to the destination block.
  • the external controller reads the data of one page each time from the register. If the source block contains n pages of data, the external controller needs to execute n times. Read operation. However, when the data is correct, the external controller does not need to perform the write operation. At the same time, since the data is verified during the data movement, it is guaranteed that the data moved from the source block to the page register is Correct, improve the reliability of the data in the destination block.
  • step 3 if the external controller finds a data error, the following steps can be included:
  • Step 5 The external controller uses the ECC module to correct the data
  • Step 6 The external controller writes the corrected data to the page register
  • Step 7 The external controller sends a rogram for copyback command to the control unit in the NAND Flash.
  • the control unit in the NAND Flash moves the corrected data to the destination block.
  • the source data is verified by the external controller before the source data is moved to the destination block, and when the error is found, the source data is corrected, and then the error correction is performed.
  • the subsequent data is written to the destination block.
  • the object of the checksum error correction is the source data, and even if the data error is found during the verification process, only one write operation needs to be performed, thereby greatly reducing the overhead of the system, and Can guarantee the validity of the data.
  • S301 The control unit in the NAND Flash executes a read for copyback command to move data in the source block to the page register;
  • S303 The external controller checks and corrects the data in the page register.
  • S304 The external controller writes the corrected data into the page register
  • S305 The control unit in the NAND Flash executes the rogram for copyback command to move the corrected data in the page register to the destination block.
  • the external controller needs to perform a write operation after correcting the error data.
  • the number of times the write operation is performed is equal to the number of error corrections. Since the error is a small number after all, the total number of reads and writes performed by the external controller is still less than the total read and write performed by the external controller in the implementation method when the copyback is not used in the prior art. The number of entries is reduced, and therefore, it is also beneficial to reduce the impact on system performance.
  • the execution unit of the read/write operation described above is page, which is for Flash. That is to say, if the internal controller of Flash performs read and write operations, it will be in units of page.
  • the external controller does not necessarily read and write in page units. Therefore, when the external controller finds the error data and corrects it, it can write only the data of the smallest ECC unit when it needs to write to the page register of the flash. Go to the page register. For example, assuming that the minimum ECC unit is one sector, the minimum ECC unit means that each time the ECC check is performed on the data of one sector, the data of the current sector is found to be incorrect (may be one or some of the sectors). When several bits of data are used, the data of the sector can be written to the page register after the error data is corrected.
  • the data of the source block may have been invalidated, so the data in the source block can be erased for storage of other data.
  • the method may include the following steps:
  • S402 Move the data in the data register to the destination block when receiving the second move command of the external controller.
  • the SSD After moving the data of the source block to the page register, the SSD does not directly move the data in the page register to the destination block, but waits for the command from the external controller.
  • the program for copyback command of the external controller is received, the data in the page register is moved to the destination block.
  • the external controller checks the data in the page register, where the data in the page register is to be moved to the destination block if the external controller does not find an error during the verification process. This is the source data itself that was previously moved from the source block to the page register. In the case where the external controller finds an error and is capable of error correction, the external controller can correct the data, write the corrected data to the page register of the SSD, and then command the SSD to correct the page register. The subsequent data is moved to the destination block.
  • the data to be moved to the destination block in the page register is the data corrected by the external controller.
  • the embodiment of the present invention further provides a device for moving data in the storage device.
  • the device includes the following units:
  • a first moving command unit 501 configured to send a first move command to the storage device, to instruct the storage device to move data in the source block to the data register;
  • a verifying unit 502 configured to read data in the data page register, and verify data in the data register
  • the error correction unit 503 is configured to: if the data error in the data register is detected, perform error correction on the data in the data register, and write the corrected data to the data register;
  • the second move command unit 504 is configured to issue a second move command to the storage device to instruct the storage device to move data in the data register to the destination block.
  • the verification unit 502 can use the ECC to check the data in the data register; the error correction unit 503 can also use the ECC to correct the data in the data register.
  • the second move command unit 504 is also used to:
  • the second move command is issued to the storage device.
  • the data register refers to a page register of a solid state drive.
  • the data can be error-corrected, and then the corrected data is written to the page register, and then the SSD is commanded to correct the page register.
  • the subsequent data is moved to the destination block, thereby ensuring the reliability of the data.
  • the external controller does not need to perform a write operation if the verification is correct, thereby reducing the impact on system performance.
  • the reliability of the data can be improved.
  • the embodiment of the invention further provides a storage device.
  • the storage device includes the following units:
  • the first moving unit 601 is configured to: when receiving the first moving command of the external controller, move the data of the source block to the data register;
  • the second shifting unit 602 is configured to move data in the data register to the destination block when receiving the second move command of the external controller.
  • the storage device includes a solid state drive, and the data register includes a page register of the solid state drive.
  • the method includes the following steps: issuing a first move command to the storage device to instruct the storage device to move data in the source block to the data register; reading data in the page register, and data in the register Performing a check; if the data in the register is verified to be incorrect, correcting the data in the register, writing the corrected data to the page register, and issuing a second to the storage device Moving the command to command the storage device to move data in the data register to the destination block.
  • the storage medium is, for example, a ROM/RAM, a magnetic disk, an optical disk, or the like.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Description

对存储设备中的数据进行搬移的方法、 装置及存储设备 技术领域
本发明涉及数据存储技术领域,尤其涉及对存储设备中的数据进行搬移的 方法、 装置及存储设备。
背景技术
在一些存储设备中, 以页为基本存储单元,对这种存储设备中的数据进行 操作时, 与普通的存储设备有所不同。 以固态硬盘为例, 固态硬盘( Solid State Disk, SSD ), 也称作电子硬盘或者固态电子盘, 通常以 NAND型闪存(Flash ) 为存储介质。 Flash内部按块(block )和页(page )的方式来组织数据, 其中, 页 本存储单元, 一片 Flash由多个块组成, 一个块又由多个页组成。 Flash 的基本操作有: 读取、 写入、 擦除, 其中, 读写操作的基本单位是页, 擦除操 作的基本单位是块。
在一些情况下, 需要在两个块之间进行数据搬移, 即需要将源块的数据搬 移到目的块中。 为了完成该数据搬移过程, 通常可以如下进行: 外部控制器读 取源块中的数据, 然后由外部控制器将源块中的数据写入到目的块中。 但是, 由于读写操作的基本单位是页,使得外部控制器每次只能读写一页的数据; 而 一个块中会包含多页数据, 因此, 在整个数据搬移过程中, 外部控制器需要进 行多次的读写操作, 从而严重影响了系统性能。
为了避免对系统性能造成影响, 可以使用 copyback命令, copyback是一 种复制命令, 通过该命令可以将一个 block (源块)中的某个 page复制到另一 个 block (目的块) 的某个 page中。 因此, 在使用 copyback命令进行数据搬 移时, 外部控制器只需发送 copyback命令, Flash就可以自动将源块中的数据 搬移到目的块中。 当然, 由于 copyback操作的单位也是页, 因此, 外部控制 器可能也需要发送多次命令, 但是, 可以减少外部控制器的读写操作次数。 可 见, 在使用 copyback命令时, 能够给系统性能带来很大的提升。
然而, 在使用 copyback 过程中可能会给数据可靠性带来隐患, 因为 copyback过程中某些数据可能会产生错误, 多次使用 copyback命令可能产生 数据错误累积, 甚至可能会使得新块中的数据失效。 总之,现有技术中在进行数据搬移时,无法兼顾系统性能和数据的可靠性。 发明内容
本发明实施例提供了对存储设备中的数据进行搬移的方法、装置及存储设 备, 在进行数据搬移时, 能够在提高数据的可靠性的同时, 降低对系统性能的 影响。
本发明实施例提供了如下方案:
一种对存储设备中的数据进行搬移的方法, 包括:
向存储设备发出第一搬移命令,以命令所述存储设备将源块中的数据搬移 到数据寄存器;
读取所述数据寄存器中的数据, 并对所述数据寄存器中的数据进行校验; 如果校验出所述数据寄存器中的数据错误,则对所述数据寄存器中的数据 进行纠错;
将纠正后的数据写入到所述数据寄存器,并向所述存储设备发出第二搬移 命令, 以命令所述存储设备将所述数据寄存器中的数据搬移到目的块。
一种对存储设备中的数据进行搬移的方法, 包括:
接收到外部控制器的第一搬移命令时, 将源块的数据搬移到数据寄存器; 当接收到所述外部控制器的第二搬移命令时,将所述数据寄存器中的数据 搬移到目的块。
一种对存储设备中的数据进行搬移的装置, 包括:
第一搬移命令单元, 用于向存储设备发出第一搬移命令, 以命令所述存储 设备将源块中的数据搬移到数据寄存器;
校验单元, 用于读取所述数据寄存器中的数据, 并对所述数据寄存器中的 数据进行校验;
纠错单元, 用于如果校验出所述数据寄存器中的数据错误, 则对所述数据 寄存器中的数据进行纠错, 将纠正后的数据写入到所述数据寄存器;
第二搬移命令单元, 用于向所述存储设备发出第二搬移命令, 以命令所述 存储设备将所述数据寄存器中的数据搬移到目的块。
一种存储设备, 包括: 第一搬移单元, 用于接收到外部控制器的第一搬移命令时, 将源块的数据 搬移到数据寄存器;
第二搬移单元, 用于当接收到所述外部控制器的第二搬移命令时,将所述 数据寄存器中的数据搬移到目的块。
通过本发明实施例, 能够在执行 COPYBACK命令的过程中, 对数据进行 校验,如果校验结果为正确, 则直接命令存储设备将页寄存器中的数据搬移到 目的块。 因此, 在校验正确的情况下, 外部控制器不需要执行写操作, 从而降 低了对系统性能的影响; 同时, 由于已经由外部控制器对数据进行了校验, 因 此, 可以提高数据的可靠性。
另外, 如果校验结果为错误, 则可以对数据进行纠错, 然后将纠正后的数 据写入到页寄存器, 然后,命令存储设备将页寄存器中纠正后的数据搬移到目 的块中, 由此来保证数据的可靠性。 附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施 例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地, 下面描述 中的附图仅仅是本发明的一些实施例, 对于本领域普通技术人员来讲, 在不付 出创造性劳动性的前提下, 还可以根据这些附图获得其他的附图。
图 1是本发明实施例提供的方法的流程图;
图 2是本发明实施例提供的命令结构示意图;
图 3是本发明实施例提供的方法的示意图;
图 4是本发明实施例提供的另一方法的流程图;
图 5是本发明实施例提供的装置的示意图;
图 6是本发明实施例提供的存储设备的示意图。 具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清 楚、 完整地描述, 显然, 所描述的实施例仅仅是本发明一部分实施例, 而不是 全部的实施例。基于本发明中的实施例, 本领域普通技术人员在没有作出创造 性劳动前提下所获得的所有其他实施例, 都属于本发明保护的范围。 首先需要说明的是, 为了便于描述, 下面均以固态硬盘为例对本发明实施 例提供的方法进行介绍。
为了便于理解本发明实施例, 首先介绍本发明实施例的应用场景。 通常, NAND Flash具有以下特性: 写入操作必须在空白区域进行, 如果目标区域已 经存在数据, 必须先擦除后写入。 即, 在向目的 page写入数据之前必须将目 的 block擦除。 但是在实际应用中存在以下情况:
一种情况是, 用户需要改写某 block中某 page的数据, 即, 该 block中已 经存在数据, 但是需要修改其中某个 page的数据。 此时, 根据 NAND Flash 的上述特性, 就无法直接在该 block中改写, 为了达到改写数据的目的, 就需 要使用另外一块擦除过的 block作为新块,将该 block中的数据搬移到新块中, 并在搬移过程中, 将改写后的数据写入到新块相应的 page中。
另一种情况是, 由于 NAND Flash的工艺不能保证在整个生命周期中保持 性能的可靠,因此,在 NAND Flash的生产中及使用过程中都可能会产生坏块。 坏块的特点是, 当进行向这个块写入数据或者擦除这个块的操作时,会出现错 误。 因此, 在向某个 block写入数据的过程中可能会遇到坏块, 即, 该 block 中已经写入了部分数据, 但是当到某一 page时, 发现无法写入。 此时, 需要 把该坏块中其他好的 page里面的内容备份到另外一个空的好块里面, 因此, 同样需要使用另外一块擦除过的 block作为新块, 将该坏块中已经存在的数据 搬移到新块中。
换而言之, 当需要改写某 block中某 page的数据, 或者, 当向某 block写 入数据的过程中遇到坏块时, 都需要将源块中的数据搬移到目的块中。 其中, 该需要改写的数据所在的 block, 或者发生坏块的 block就是源块, 作为新块 的另外一块擦除过的 block就是目的块。
例如, 在一片 flash中, block m中存储用户数据, 如果需要改写其中的 page n, 则根据 flash的特性, 不能直接将修改后的数据写入 block m, 而必须 另找一个擦除过的块 block p,然后将 block m中的有效数据和需要改写的数据 搬移到 block p。 如果使用 copyback命令, 则在上述例子中,数据搬移的过程为: 将 page n 之前的所有 page使用 copyback命令搬移 block 的相应 page; 外部控制器将 修改后的 page n的数据写入到 block 的 page n; 然后, 将 age n之后的所有 page使用 copyback命令搬移 block 的相应 page。
需要说明的是, 固态硬盘由控制单元和固态存储单元( DRAM或 FLASH 芯片 )两部分组成。 其中, 控制单元的主要功能是读取、 写入数据, 存储单元 的主要功能的是存储数据。 当使用 copyback命令时, 是由外部控制器向固态 硬盘的控制单元发送命令,然后由固态硬盘的控制单元完成具体的数据搬移过 程, 因此, 不需要外部控制器进行写入操作, 就可以将源块的数据搬移到新块 中相应的 page中。 因此, 整个数据搬移过程中, 数据不会经过外部控制器。 而固态硬盘的控制单元通常不具备数据校验功能, 因此, 如果 copyback过程 中某些数据产生错误, 就无法得到及时地发现或者纠正,使得目的块中的数据 可能已经存在错误。
另外需要说明的是, 如果操作时序和电路稳定性不存在问题, 则 NAND Flash出错时一般不会造成整个 block或整个 page都出错,而是 page中只有一 个或少数几个比特出错, 基于该特点, NAND Flash 中的数据通常使用 ECC ( Error Checking and Correcting,错误检查和纠正)进行数据校验。但是, ECC 的纠错能力通常是比较有限的, 例如, 使用汉明码纠错时, 只能纠正单比特错 误和检测双比特错误, 即, 当数据中只有一个比特出错时, 则使用 ECC能够 检测出该错误,并且能够将其纠正;但是, 当数据中两个比特的数据都出错时, 则使用 ECC就只能检测出该错误, 但无法纠正; 如果数据中三个比特的数据 都出错, 则使用 ECC无法检测出该错误。 当然, 在实际应用中, 通常会釆用 纠错能够较强的 ECC来进行纠错, 例如, 通常可以纠正 4比特或者 8比特错 误。
但是, 即使使用纠错能力较强的 ECC, ECC的纠错能力总是有限的, 如 果 copyback过程使得搬移到目的块中的数据产生错误, 则在对目的块中的数 据进行校验时(在需要使用该目的块中的数据时, 都会首先对该块中的数据进 行校验)可能会由于超出 ECC的纠错能力, 而导致数据失效。
本发明实施例就是在上述问题的基础上,提供的对存储设备中的数据进行 搬移的方法, 下面进行详细描述。
参见图 1 , 本发明实施例提供的对存储设备中的数据进行搬移的方法包括 以下步骤:
S101 : 向存储设备发出第一搬移命令, 以命令所述存储设备将源块中的数 据搬移到数据寄存器;
例如,对于 NAND Flash的操作,地址、命令、数据的传递都是通过 NAND Flash 的页寄存器来完成的, 其中, 该页寄存器就是一种数据寄存器, NAND Flash中的控制单元在执行 copyback命令时, 会首先将源块中的数据搬移到页 寄存器, 然后再从页寄存器搬移到目的块中。 由于 copyback操作的单位是页, 因此, 每次搬移一页的数据到页寄存器中。
S102: 读取所述数据寄存器中的数据, 并对所述数据寄存器中的数据进行 校验;
当 NAND Flash中的控制单元将源块中的数据搬移到页寄存器后, 外部控 制器就可以读取页寄存器中的数据, 然后对这些数据进行校验。 可见, 进行数 据校验时, 这些数据尚未搬移到目的块中。
具体在对寄存器中的数据进行校验时,外部控制器也是使用 ECC进行的。 因为在数据存入 NAND Flash中时, 都会进行 ECC编码, 所以, 进行校验时, 利用 ECC就可以判断出寄存器中的数据是否正确。 关于具体的校验方法, 已 属于现有技术为本领域技术人员所公知, 因此可以参照现有技术中的方法实 现, 这里不再赘述。
S103: 如果校验出所述数据寄存器中的数据错误, 则对所述数据寄存器中 的数据进行纠错;
S104: 将纠正后的数据写入到所述数据寄存器, 并向所述存储设备发出第 二搬移命令, 以命令所述存储设备将所述数据寄存器中的数据搬移到目的块。
外部控制器在对数据寄存器中当前的数据进行校验后, 如果发现数据正 确, 则可以直接向存储设备发出所述第二搬移命令, 以命令存储设备中的控制 单元,将数据寄存器中的数据搬移到目的块中。如果校验的结果是所述数据寄 存器中的数据存在错误,则外部控制器需要对所述数据寄存器中的数据进行纠 错,将纠正后的数据写入到所述数据寄存器,并向存储设备发出第二搬移命令, 以命令所述存储设备将所述数据寄存器中的数据搬移到目的块。 可以看出,在 本发明实施例中,存储设备中的控制单元将源块中的数据搬移到数据寄存器之 后, 并不是直接将数据寄存器中的数据搬移到目的块, 而是要等待外部控制器 的第二搬移命令, 只有接收到外部控制器的第二搬移命令时, 才会将数据寄存 器中的数据搬移到目的块中。
以存储设备为 NAND Flash为例, 在本发明实施例中, 将 copyback命令 分成了两部分, 当向 NAND Flash中的控制单元发送第一搬移命令时 , NAND Flash中的控制单元会将源块中的数据搬移到页寄存器, 当向 NAND Flash中 的控制单元发送第二搬移命令时, NAND Flash中的控制单元再将页寄存器中 的数据搬移到目的块。 而现有技术中利用 copyback命令进行数据搬移的过程 中, 如果外部控制器向 NAND Flash 中的控制单元发送 copyback命令, 则 NAND Flash中的控制单元会将源块中的数据搬移到页寄存器, 并且直接将页 寄存器中的数据搬移到目的块中相应的页。 因此, 本发明实施例中, 完成一次 数据搬移, 则外部控制器需要向 NAND Flash中的控制单元发送两次命令, 并 且在两次命令之间, 由外部控制器完成对数据的校验过程。
在实际应用中,上述第一搬移命令可以表示为 read for copyback ( copyback 的读命令), 第二搬移命令可以表示为 program for copyback ( copyback的编程 样进行:
步骤 1 : 外部控制器向 NAND Flash中的控制单元发送 read for copyback 命令, 用以命令 NAND Flash中的控制单元将源块中的数据搬移到页寄存器;
NAND Flash中的控制单元以页为单位进行数据搬移, 即每次从源块中搬 移一页的数据到页寄存器中。
步骤 2: 外部控制器读取页寄存器中的数据;
步骤 3: 外部控制器对寄存器中的数据进行校验;
步骤 4: 如果校验结果为正确, 则向 NAND Flash 中的控制单元发送 program for copyback命令, NAND Flash中的控制单元在接收到 program for copyback命令之后, 就可以直接将页寄存器中的数据搬移到目的块中。
其中, 由于搬移操作为单位页, 因此, 每次在将页寄存器中的数据搬移到 目的块时, 是将页寄存中的数据搬移到目的块中相应的页中, 其中, 在确定目 的块中的页时, 相当于一个寻址过程, 这里不再赘述。
由上述可见, 由于每次搬移到寄存器中的是一页数据, 外部控制器每次从 寄存器读取的也是一页的数据,假设源块中包含 η页数据, 则外部控制器需要 执行 η次读取操作。 但是, 在数据正确的情况下, 外部控制器不需要执行写入 操作, 同时, 由于数据搬移的过程中对数据进行了校验, 因此, 可以保证在从 源块搬移到页寄存器中的数据是正确的, 提高了目的块中数据的可靠性。
此外, 在上述步骤 3之后, 如果外部控制器发现数据错误, 则可以按照以 下步骤包括:
步骤 5: 外部控制器使用 ECC模块对数据进行纠错;
步骤 6: 外部控制器将纠正后的数据写入到页寄存器中;
步骤 7 : 外部控制器向 NAND Flash 中的控制单元发送 rogram for copyback命令, NAND Flash中的控制单元将纠正后的数据搬移到目的块中。
可见, 在本发明实施例中, 是在将源数据搬移到目的块之前, 由外部控制 器对源数据进行校验, 并且当发现有错误时, 对源数据进行糾错, 然后再将纠 错后的数据写入到目的块中。 换言之, 在本发明实施例中, 校验及纠错的对象 是源数据,并且即使在校验过程中发现数据错误,也只需要执行一次写入操作, 因此, 大大减少了系统的开销, 并且能够保证数据的有效性。
参见图 3 , 其给出了当外部控制器发现数据错误并且能够纠错时, 数据搬 移的过程, 包括:
S301 : NAND Flash中的控制单元执行 read for copyback命令, 将源块中 的数据搬移到页寄存器;
S302: 外部控制器读取页寄存器中的数据;
S303: 外部控制器对页寄存器中的数据进行校验并进行纠错;
S304: 外部控制器将纠正后的数据写入到页寄存器中; S305: NAND Flash中的控制单元执行 rogram for copyback命令,将页寄 存器中纠正后的数据搬移到目的块中。
图 3中没有标示出外部控制器向 NAND Flash中的控制单元发送命令的过 程, 不过从前文的描述中可以确定, NAND Flash中的控制单元在执行的各种 命令, 都是由外部控制器发送的。
可见, 如果页寄存器中的数据出现错误, 则外部控制器需要针对出错的数 据进行纠错之后, 执行写入操作。 其中, 执行写入操作的次数等于纠错次数。 由于出错的情况毕竟是少数, 因此, 外部控制器执行的总的读取、 写入次数还 是会少于现有技术不使用 copyback时的实现方法中, 外部控制器执行的总的 读取、 写入次数减少, 因此, 也有利于降低对系统性能的影响。
需要说明的是,前文所述读写操作的执行单位是 page,是对 Flash而言的, 也就是说, 如果是 Flash的内部控制器执行读写操作, 则会以 page为单位。 但 是, 外部控制器进行读写时不一定是以 page为单位的, 因此, 当外部控制器 发现错误数据并纠正之后,在需要写入 Flash的页寄存器时,可以仅将最小 ECC 单位的数据写入到页寄存器中。 例如, 假设最小 ECC单位为一个扇区, 则最 小 ECC单位是指每次对一个扇区的数据执行 ECC校验,则发现当前扇区的数 据发生错误 (可能是该扇区中某个或某几个比特的数据 )时, 就可以将发生错 误的数据纠正之后, 将该扇区的数据写入到页寄存器中。
将源块中的全部数据都搬移到目的块之后, 源块的数据可能已经无效, 因 此, 就可以将源块中的数据擦除, 以备用于存储其他数据。
从前述实施例中的描述可知, 对于存储设备而言, 参见图 4, 该方法可以 包括以下步骤:
S401 :接收到外部控制器的第一搬移命令时,将源块的数据搬移到数据寄 存器;
S402: 当接收到所述外部控制器的第二搬移命令时,将所述数据寄存器中 的数据搬移到目的块。
对于固态硬盘而言, 在将源块的数据搬移到页寄存器之后, 固态硬盘并不 是直接将页寄存器中的数据搬移到目的块中, 而是要等待外部控制器的命令, 当收到外部控制器的 program for copyback命令时, 再将页寄存器中的数据搬 移到目的块。
在固态硬盘等待的过程中, 外部控制器对页寄存器中的数据进行校验, 其 中,在外部控制器在校验过程中没有发现错误的情况下, 页寄存器中待搬移到 目的块中的数据就是之前从源块搬移到页寄存器中的源数据本身。在外部控制 器发现错误并且能够进行纠错的情况下, 外部控制器可以对数据进行纠错, 并 将纠正后的数据写入到固态硬盘的页寄存器中,然后命令固态硬盘将页寄存器 中纠正后的数据搬移到目的块。相应的, 页寄存器中待搬移到目的块的数据是 由外部控制器纠正后的数据。
与本发明实施例提供的对存储设备中的数据进行搬移的方法相对应 ,本发 明实施例还提供了一种对存储设备中的数据进行搬移的装置, 参见图 5 , 该装 置包括以下单元:
第一搬移命令单元 501 , 用于向存储设备发出第一搬移命令, 以命令所述 存储设备将源块中的数据搬移到数据寄存器;
校验单元 502, 用于读取所述数据页寄存器中的数据, 并对所述数据寄存 器中的数据进行校验;
纠错单元 503 , 用于如果检测出所述数据寄存器中的数据错误, 则对所述 数据寄存器中的数据进行纠错, 将纠正后的数据写入到所述数据寄存器;
第二搬移命令单元 504, 用于向所述存储设备发出第二搬移命令, 以命令 所述存储设备将所述数据寄存器中的数据搬移到目的块。
其中,校验单元 502可以使用 ECC对所述数据寄存器中的数据进行校验; 纠错单元 503同样可以使用 ECC对所述数据寄存器中的数据进行纠错。
如果校验的结果是没有错误, 则第二搬移命令单元 504还用于:
如果校验出所述数据寄存器中的数据正确 ,则向所述存储设备发出所述第 二搬移命令。
仍以固态硬盘为例, 所述的数据寄存器是指固态硬盘的页寄存器。通过本 发明实施例提供的上述装置, 如果校验结果为错误, 则可以对数据进行纠错, 然后将纠正后的数据写入到页寄存器, 然后,命令固态硬盘将页寄存器中纠正 后的数据搬移到目的块中, 由此来保证数据的可靠性。 另外, 在校验正确的情 况下, 外部控制器不需要执行写操作, 从而降低了对系统性能的影响。 同时, 由于已经由外部控制器对数据进行了校验, 因此, 可以提高数据的可靠性。
本发明实施例还提供了一种存储设备, 参见图 6, 该存储设备包括以下单 元:
第一搬移单元 601 , 用于接收到外部控制器的第一搬移命令时, 将源块的 数据搬移到数据寄存器;
第二搬移单元 602, 用于当接收到所述外部控制器的第二搬移命令时, 将 所述数据寄存器中的数据搬移到目的块。
其中, 所述存储设备包括固态硬盘, 所述数据寄存器包括所述固态硬盘的 页寄存器。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分步骤 是可以通过程序来指令相关的硬件来完成,所述的程序可以存储于一计算机可 读取存储介质中, 该程序在执行时, 包括如下步骤: 向存储设备发出第一搬移 命令, 以命令所述存储设备将源块中的数据搬移到数据寄存器; 读取所述页寄 存器中的数据, 并对所述寄存器中的数据进行校验; 如果校验出所述寄存器中 的数据错误, 则对所述寄存器中的数据进行纠错, 将纠正后的数据写入到所述 页寄存器, 并向所述存储设备发出第二搬移命令, 以命令所述存储设备将所述 数据寄存器中的数据搬移到目的块。 所述的存储介质,如: ROM/RAM、磁碟、 光盘等。
以上所述仅是本发明的优选实施方式,应当指出, 对于本技术领域的普通 技术人员来说, 在不脱离本发明原理的前提下, 还可以做出若干改进和润饰, 这些改进和润饰也应视为本发明的保护范围。

Claims

权 利 要 求
1、 一种对存储设备中的数据进行搬移的方法, 其特征在于, 包括: 向存储设备发出第一搬移命令,以命令所述存储设备将源块中的数据搬移 到数据寄存器;
读取所述数据寄存器中的数据, 并对所述数据寄存器中的数据进行校验; 如果校验出所述数据寄存器中的数据错误,则对所述数据寄存器中的数据 进行纠错;
将纠正后的数据写入到所述数据寄存器,并向所述存储设备发出第二搬移 命令, 以命令所述存储设备将所述数据寄存器中的数据搬移到目的块。
2、 根据权利要求 1所述的方法, 其特征在于, 所述对所述数据寄存器中 的数据进行校验包括: 使用错误检查和纠正 ECC对所述寄存器中的数据进行 校验;
所述对所述数据寄存器中的数据进行纠错包括: 使用 ECC对所述寄存器 中的数据进行纠错。
3、 根据权利要求 1所述的方法, 其特征在于, 还包括:
如果校验出所述数据寄存器中的数据正确 ,则向所述存储设备发出所述第 二搬移命令。
4、 一种对存储设备中的数据进行搬移的方法, 其特征在于, 包括: 接收到外部控制器的第一搬移命令时, 将源块的数据搬移到数据寄存器; 当接收到所述外部控制器的第二搬移命令时,将所述数据寄存器中的数据 搬移到目的块。
5、 一种对存储设备中的数据进行搬移的装置, 其特征在于, 包括: 第一搬移命令单元, 用于向存储设备发出第一搬移命令, 以命令所述存储 设备将源块中的数据搬移到数据寄存器;
校验单元, 用于读取所述数据寄存器中的数据, 并对所述数据寄存器中的 数据进行校验;
纠错单元, 用于如果校验出所述数据寄存器中的数据错误, 则对所述数据 寄存器中的数据进行纠错, 将纠正后的数据写入到所述数据寄存器;
第二搬移命令单元, 用于向所述存储设备发出第二搬移命令, 以命令所述 存储设备将所述数据寄存器中的数据搬移到目的块。
6、 根据权利要求 5所述的装置, 其特征在于, 所述校验单元使用 ECC对 所述数据寄存器中的数据进行校验; 所述纠错单元使用 ECC对所述数据寄存 器中的数据进行纠错。
7、 根据权利要求 5所述的装置, 其特征在于, 所述第二搬移命令单元还 用于:
如果校验出所述数据寄存器中的数据正确 ,则向所述存储设备发出所述第 二搬移命令。
8、 根据权利要求 5至 7任一项所述的装置, 其特征在于, 所述存储设备 包括固态硬盘, 所述数据寄存器包括所述固态硬盘的页寄存器。
9、 一种存储设备, 其特征在于, 包括:
第一搬移单元, 用于接收到外部控制器的第一搬移命令时, 将源块的数据 搬移到数据寄存器;
第二搬移单元, 用于当接收到所述外部控制器的第二搬移命令时,将所述 数据寄存器中的数据搬移到目的块。
10、 根据权利要求 9所述的存储设备, 其特征在于, 所述存储设备包括固 态硬盘, 所述数据寄存器包括所述固态硬盘的页寄存器。
PCT/CN2010/076047 2010-08-17 2010-08-17 对存储设备中的数据进行搬移的方法、装置及存储设备 WO2012022024A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2010/076047 WO2012022024A1 (zh) 2010-08-17 2010-08-17 对存储设备中的数据进行搬移的方法、装置及存储设备
CN2010800686124A CN103229154A (zh) 2010-08-17 2010-08-17 对存储设备中的数据进行搬移的方法、装置及存储设备

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2010/076047 WO2012022024A1 (zh) 2010-08-17 2010-08-17 对存储设备中的数据进行搬移的方法、装置及存储设备

Publications (1)

Publication Number Publication Date
WO2012022024A1 true WO2012022024A1 (zh) 2012-02-23

Family

ID=45604679

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2010/076047 WO2012022024A1 (zh) 2010-08-17 2010-08-17 对存储设备中的数据进行搬移的方法、装置及存储设备

Country Status (2)

Country Link
CN (1) CN103229154A (zh)
WO (1) WO2012022024A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110673999B (zh) * 2019-09-27 2022-07-22 苏州浪潮智能科技有限公司 一种硬盘数据搬移测试方法、装置及电子设备和存储介质
CN112083891B (zh) * 2020-09-22 2022-12-06 深圳芯邦科技股份有限公司 一种存储器中数据块的检测方法及相关设备

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101290602A (zh) * 2008-06-13 2008-10-22 松翰科技股份有限公司 存储器管理系统与方法
CN101634938A (zh) * 2009-08-20 2010-01-27 成都市华为赛门铁克科技有限公司 固态硬盘的数据迁移方法、数据迁移装置及固态硬盘
CN101740123A (zh) * 2008-11-10 2010-06-16 扬智科技股份有限公司 存储器的数据保护方法

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101290602A (zh) * 2008-06-13 2008-10-22 松翰科技股份有限公司 存储器管理系统与方法
CN101740123A (zh) * 2008-11-10 2010-06-16 扬智科技股份有限公司 存储器的数据保护方法
CN101634938A (zh) * 2009-08-20 2010-01-27 成都市华为赛门铁克科技有限公司 固态硬盘的数据迁移方法、数据迁移装置及固态硬盘

Also Published As

Publication number Publication date
CN103229154A (zh) 2013-07-31

Similar Documents

Publication Publication Date Title
US7921339B2 (en) Flash storage device with data correction function
US9110832B2 (en) Object oriented memory in solid state devices
US8281218B1 (en) Data manipulation engine
TWI409821B (zh) 解碼方法、編碼方法及啟動控制系統
US8271515B2 (en) System and method for providing copyback data integrity in a non-volatile memory system
US9015553B2 (en) Data integrity in memory controllers and methods
US8438454B2 (en) Semiconductor memory device and controlling method
EP3633517B1 (en) Storage device and method of operating storage device
US20070170268A1 (en) Memory cards, nonvolatile memories and methods for copy-back operations thereof
US11157357B2 (en) Operation methods of memory system and host, and computing system
US20060120166A1 (en) Data processing apparatus and method for flash memory
WO2005111812A1 (ja) 不揮発性記憶装置のためのエラー訂正方法
US8756398B2 (en) Partitioning pages of an electronic memory
JP2008226245A (ja) フラッシュメモリに基づくメモリシステム
US20130304970A1 (en) Systems and methods for providing high performance redundant array of independent disks in a solid-state device
US20150046772A1 (en) Method and device for error correcting code (ecc) error handling
JP2013137708A (ja) メモリコントローラ、データ記憶装置およびメモリ制御方法
US8219883B2 (en) Data accessing method, controller and storage system using the same
US8868517B2 (en) Scatter gather list for data integrity
WO2007088597A1 (ja) エラー訂正コード生成方法及びメモリ管理装置
WO2015027678A1 (zh) 一种坏道修复方法及装置
WO2012022024A1 (zh) 对存储设备中的数据进行搬移的方法、装置及存储设备
CN111124742B (zh) Flash数据校验方法及Flash控制器、存储介质、设备
TWI750811B (zh) 用於記憶體的資料保護寫入方法、用於記憶體的資料保護讀取方法以及記憶體資料保護系統

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 10856022

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 10856022

Country of ref document: EP

Kind code of ref document: A1