WO2015196416A1 - Data storage method and device and non-volatile memory - Google Patents

Data storage method and device and non-volatile memory Download PDF

Info

Publication number
WO2015196416A1
WO2015196416A1 PCT/CN2014/080842 CN2014080842W WO2015196416A1 WO 2015196416 A1 WO2015196416 A1 WO 2015196416A1 CN 2014080842 W CN2014080842 W CN 2014080842W WO 2015196416 A1 WO2015196416 A1 WO 2015196416A1
Authority
WO
WIPO (PCT)
Prior art keywords
write
block
sub
written
data block
Prior art date
Application number
PCT/CN2014/080842
Other languages
French (fr)
Chinese (zh)
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/CN2014/080842 priority Critical patent/WO2015196416A1/en
Priority to CN201480003810.0A priority patent/CN105408961B/en
Publication of WO2015196416A1 publication Critical patent/WO2015196416A1/en

Links

Classifications

    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11CSTATIC STORES
    • G11C11/00Digital stores characterised by the use of particular electric or magnetic storage elements; Storage elements therefor
    • G11C11/56Digital stores characterised by the use of particular electric or magnetic storage elements; Storage elements therefor using storage elements with more than two stable states represented by steps, e.g. of voltage, current, phase, frequency

Abstract

Embodiments of the present invention provide a data storage method and device and a non-volatile memory (NVM). An NVM controller divides a to-be-written data block and a written-back data block, compares each sub-data block of the to-be-written data block with each sub-data block of the written-back data block to obtain the write power consumption of each sub-data block of the to-be-written data block, determines a write relationship corresponding to the minimum write power consumption of the to-be-written data block according to the write power consumption of each sub-data block of the to-be-written data block, and writes the sub-data blocks of the to-be-written data block into an NVM according to the write relationship corresponding to the minimum write power consumption. By means of the method, the correspondence of the minimum write power consumption is selected by means of comparison, the sub-data blocks of the to-be-written data block are written into the NVM, and thereby the write power consumption of the NVM can be lowered to the lowest level.

Description

数据存储方法、 装置和非易失性存储器  Data storage method, device and nonvolatile memory
技术领域 Technical field
本发明实施例涉及数据通信技术, 尤其涉及一种数据存储方法、 装置和 非易失性存储器。 背景技术  Embodiments of the present invention relate to data communication technologies, and in particular, to a data storage method, apparatus, and nonvolatile memory. Background technique
非易失性存储器(Non- Volatile Memory, 简称 NVM)的特点是在断电时 存储的数据不会丢失。 常见的 NVM有闪速存储器(Flash Memory)、 相变存 储器 (phase change memory, 简称 PCM) 、 铁电动态随机存取存储器 (Fe Random Access Memory, 简称 FRAM)等。在 NVM的应用中, 不管是 NVM 的复位 (RESET) 操作 (即写 1操作) , 还是置位 (SET) 操作 (即写 0操 作) , NVM的单次写入能耗比读能耗高 10-100倍左右, 而 NVM在工作过 程中需要不断执行写操作或者擦除操作, 因此, 减少 NVM的写次数可以降 低 NVM系统的能耗。  Non-Volatile Memory (NVM) is characterized by no loss of data stored during a power outage. Common NVMs include Flash Memory, Phase Change Memory (PCM), and Fe Random Access Memory (FRAM). In NVM applications, whether NVM's reset (RESET) operation (ie write 1 operation) or set (SET) operation (ie write 0 operation), NVM's single write energy consumption is higher than read energy consumption 10 -100 times or so, and NVM needs to continuously perform write operations or erase operations during work. Therefore, reducing the number of NVM writes can reduce the energy consumption of the NVM system.
现有技术提出了一种 Flip-N-Write 的方法, 用于减少内存的写次数。 该 方法中内存控制器首先通过一个读操作将待写数据从内存中读取到寄存器, 然后将待写数据的一个待写数据字节与写回数据的一个写回数据字节按比特 位进行异或运算。 假设一个字节的大小为 N比特, 若异或结果中 0的个数大 于 N/2 (即写回数据字节和待写数据字节大部分相同) , 内存控制器更新该 待写数据字节中不相同的数据。 若异或结果中 0的个数小于等于 N/2 (即写 回数据字节和待写数据字节大部分不同) , 内存控制器先对该待写数据字节 进行数据翻转,即将待写数据字节中的数据由 0变为 1或由 1变为 0,然后, 内存控制器更新该待写数据字节中相同的数据, 由于该待写数据字节中相同 的数据多于不同的数据, 进一歩减少了更新次数。 该方法中还需要为每个字 节增加一个标识位, 该标识位用来表示对应字节的数据是否发生翻转, 例如 用 0表示翻转, 1表示没有翻转, 在将待写数据写入内存时将该字节的标识 位写入该字节的后面, 当从内存中读取该字节时, 可以根据该字节的标识位 确定是否需要对读取到的字节进行数据翻转, 若该字节在存储时进行了数据 翻转, 那么需要对读取到的字节进行数据翻转才能正确的还原数据。 The prior art proposes a Flip-N-Write method for reducing the number of writes to memory. In the method, the memory controller first reads the data to be written from the memory into the register through a read operation, and then performs a write-back data byte of the data to be written and a write-back data byte of the write-back data by bit. XOR operation. Suppose the size of one byte is N bits. If the number of 0s in the XOR result is greater than N/2 (that is, the write back data byte is mostly the same as the data byte to be written), the memory controller updates the data word to be written. Not the same data in the section. If the number of 0s in the XOR result is less than or equal to N/2 (that is, the write back data byte is mostly different from the data byte to be written), the memory controller first flips the data byte to be written, and is about to be written. The data in the data byte is changed from 0 to 1 or from 1 to 0. Then, the memory controller updates the same data in the data byte to be written, because the same data in the data byte to be written is more than different. Data, further reduced the number of updates. In this method, an identifier bit is also added for each byte, and the flag bit is used to indicate whether the data of the corresponding byte is inverted, for example, 0 is used to indicate flipping, and 1 is not inverted, when the data to be written is written into the memory. Write the identifier of the byte to the end of the byte. When the byte is read from the memory, it can be determined according to the identifier of the byte whether the data needs to be flipped for the read byte. Bytes were data when they were stored Flip, then you need to flip the data of the read bytes to restore the data correctly.
现有技术的方案可以在一定程度上降低 NVM的写次数, 从而降低 NVM 的能耗, 但是该方案中每个字节都需要额外的一位标识位来还原数据, 额外 信息占的存储比例较大, 当将现有技术的方法应用于外存时, 大量的数据会 占用更多的额外存储空间。 发明内容  The prior art solution can reduce the number of writes of the NVM to a certain extent, thereby reducing the power consumption of the NVM, but each byte in the scheme requires an additional one bit to restore the data, and the additional information accounts for a smaller proportion of storage. Large, when applying the prior art method to external storage, a large amount of data will take up more additional storage space. Summary of the invention
本发明实施例提供一种数据存储方法、装置和非易失性存储器, 能够减 少 NVM的写入能耗。  Embodiments of the present invention provide a data storage method, apparatus, and non-volatile memory, which can reduce write energy consumption of an NVM.
本发明第一方面提供一种数据存储方法, 所述方法应用于非易失性存 储器 NVM中, 所述方法包括:  A first aspect of the present invention provides a data storage method, the method being applied to a non-volatile memory NVM, the method comprising:
接收写请求, 所述写请求中包含有待写入数据块以及地址;  Receiving a write request, where the write request includes a data block to be written and an address;
分别将所述待写入数据块以及缓存中与所述地址对应的写回数据块 平均划分为 N个子数据块, 其中, N为不小于 2的正整数;  And respectively, the data block to be written and the write back data block corresponding to the address in the cache are equally divided into N sub-blocks, where N is a positive integer not less than 2;
将所述每个待写入数据块的子数据块与所述每个写回数据块的子数 据块进行比较, 以获得所述待写入数据块的每个子数据块的写入能耗; 根据所述待写入数据块的每个子数据块的写入能耗确定所述待写入 数据块的最小写入能耗对应的写入关系, 其中, 所述写入关系包括所述待 写入数据块的子数据块与所述写回数据块的子数据块的对应关系;  Comparing each of the sub-blocks of the data block to be written with the sub-block of each of the write-back data blocks to obtain a write energy consumption of each sub-block of the data block to be written; Determining, according to a write energy consumption of each sub-block of the data block to be written, a write relationship corresponding to a minimum write energy consumption of the data block to be written, where the write relationship includes the to-be-written Corresponding relationship between the sub-block of the data block and the sub-block of the write-back block;
根据所述地址以及所述写入关系将所述待写入数据块的子数据块写 入所述 NVM。  The sub-block of the data block to be written is written to the NVM according to the address and the write relationship.
结合本发明第一方面, 在本发明第一方面的第一种可能的实现方式中, 所述将所述每个待写入数据块的子数据块与所述每个写回数据块的子数 据块进行比较, 以获得所述待写入数据块的每个子数据块的写入能耗, 包 括:  With reference to the first aspect of the present invention, in a first possible implementation manner of the first aspect of the present invention, the sub-data block of each of the data blocks to be written and the sub-data block of each of the data blocks are written The data blocks are compared to obtain the write energy consumption of each of the sub-blocks of the data block to be written, including:
分别将所述每个待写入数据块的子数据块与所述每个写回数据块的 子数据块进行比较, 以获得每一次比较过程中所述待写入数据块的每个子 数据块的写 0次数和写 1次数, 其中, 所述每一次比较过程包括所述待写 入数据块的一个子数据块与所述写回数据块的一个子数据块比较的过程; 根据所述待写入数据块的每个子数据块在每一次比较过程中的写 0次 数、 写 1次数以及预设的单次写 0能耗和单次写 1能耗计算所述待写入数 据块的每个子数据块在每一次比较过程中的写入能耗。 Comparing each of the sub-blocks of the data block to be written with the sub-block of each of the write-back data blocks, respectively, to obtain each sub-block of the data block to be written in each comparison process Writing 0 times and writing 1 times, wherein each of the comparing processes includes a process of comparing one sub-block of the data block to be written with one sub-block of the write-back data block; Write each sub-block of the data block 0 times during each comparison The number, the number of writes, and the preset single write 0 energy consumption and the single write 1 energy consumption calculate the write energy consumption of each sub-block of the data block to be written in each comparison process.
结合本发明第一方面以及第一方面的第一种可能的实现方式, 在本发 明第一方面的第二种可能的实现方式中, 所述根据所述待写入数据块的每 个子数据块的写入能耗确定所述待写入数据块的最小写入能耗对应的写 入关系, 包括:  With reference to the first aspect of the present invention, and the first possible implementation manner of the first aspect, in a second possible implementation manner of the first aspect of the present disclosure, The write energy consumption determines a write relationship corresponding to the minimum write energy consumption of the data block to be written, including:
以所述待写入数据块的每个子数据块以及所述写回数据块的每个子 数据块为顶点构造二分图, 所述二分图的各边权值为所述各边对应的待写 入数据块的子数据块在一次比较过程中的写入能耗, 其中, 所述待写入数 据块的子数据块在一次比较过程中的写入能耗为所述待写入数据块的子 数据块写入所述写回数据块的一个子数据块的写入能耗;  Constructing a bipartite graph with each sub-block of the data block to be written and each sub-block of the write-back data block as a vertex, and each edge weight of the bipartite graph is a corresponding to be written in the side The write power consumption of the sub-block of the data block in a comparison process, wherein the write data energy of the sub-block of the data block to be written in one comparison process is the sub-data block to be written Writing a write energy to a data block of the write back data block;
确定所述二分图的最佳匹配, 所述最佳匹配满足如下条件: 各边的权 值总和最小, 覆盖所述二分图的所有顶点, 任意两条边没有共同的顶点; 将所述最佳匹配作为所述最小写入能耗对应的写入方式。  Determining a best match of the bipartite graph, the best match satisfies the following condition: the sum of weights of each side is the smallest, covering all the vertices of the bipartite graph, and any two sides have no common vertices; The matching is the writing mode corresponding to the minimum write energy consumption.
结合本发明第一方面以及第一方面的第一种和第二种可能的实现方 式, 在本发明第一方面的第三种可能的实现方式中, 所述根据所述地址以 及所述写入关系将所述待写入数据块的子数据块写入所述 NVM, 包括: 根据所述地址以及所述写回数据块的每个子数据块的大小计算所述 写回数据块的每个子数据块的地址;  In conjunction with the first aspect of the present invention and the first and second possible implementations of the first aspect, in a third possible implementation of the first aspect of the present invention, the Writing the sub-block of the data block to be written to the NVM includes: calculating, according to the address and the size of each sub-block of the write-back data block, each sub-data of the write-back data block The address of the block;
根据所述写入关系和所述写回数据块的每个子数据块的地址将所述 待写入数据块的子数据块写入所述 NVM。  The sub-block of the block to be written is written to the NVM according to the write relationship and the address of each sub-block of the write-back data block.
结合本发明第一方面以及第一方面的第一种至第三种可能的实现方 式, 在本发明第一方面的第四种可能的实现方式中, 所述根据所述地址以 及所述写入关系将所述待写入数据块的子数据块写入所述 NVM之后, 还 包括:  With reference to the first aspect of the present invention, and the first to third possible implementation manners of the first aspect, in a fourth possible implementation manner of the first aspect of the present invention, After the relationship is written to the NVM by the sub-block of the data block to be written, the method further includes:
将所述写入关系写入所述 NVM, 以便从所述 NVM读取所述待写入 数据块的子数据块时, 根据所述写入关系恢复所述待写入数据块。  Writing the write relationship to the NVM to recover the sub-data block to be written from the NVM, and recovering the to-be-written data block according to the write relationship.
本发明第二方面提供一种数据存储装置, 包括:  A second aspect of the present invention provides a data storage device, including:
接收模块, 用于接收写请求, 所述写请求中包含有待写入数据块以及 地址; 划分模块, 用于分别将所述待写入数据块以及缓存中与所述地址对应 的写回数据块平均划分为 N个子数据块, 其中, N为不小于 2的正整数; 获取模块, 用于将所述每个待写入数据块的子数据块与所述每个写回 数据块的子数据块进行比较, 以获得所述待写入数据块的每个子数据块的 写入能耗; a receiving module, configured to receive a write request, where the write request includes a data block to be written and an address; a dividing module, configured to respectively divide the data block to be written and the write back data block corresponding to the address in the cache into N sub-blocks, where N is a positive integer not less than 2; Comparing the sub-blocks of each of the data blocks to be written with the sub-blocks of each of the write-back data blocks to obtain write energy consumption of each sub-block of the data block to be written ;
确定模块, 用于根据所述待写入数据块的每个子数据块的写入能耗确 定所述待写入数据块的最小写入能耗对应的写入关系, 其中, 所述写入关 系包括所述待写入数据块的子数据块与所述写回数据块的子数据块的对 应关系;  a determining module, configured to determine, according to a write energy consumption of each sub-block of the data block to be written, a write relationship corresponding to a minimum write energy consumption of the data block to be written, where the write relationship Corresponding relationship between the sub data block of the data block to be written and the sub data block of the write data block;
写入模块, 用于根据所述地址以及所述写入关系将所述待写入数据块 的子数据块写入非易失性存储器 NVM。  And a write module, configured to write the sub-block of the data block to be written into the non-volatile memory NVM according to the address and the write relationship.
结合本发明第二方面, 在本发明第二方面的第一种可能的实现方式中, 所述获取模块具体用于:  With reference to the second aspect of the present invention, in a first possible implementation manner of the second aspect of the present disclosure, the acquiring module is specifically configured to:
分别将所述每个待写入数据块的子数据块与所述每个写回数据块的 子数据块进行比较, 以获得每一次比较过程中所述待写入数据块的每个子 数据块的写 0次数和写 1次数, 其中, 所述每一次比较过程包括所述待写 入数据块的一个子数据块与所述写回数据块的一个子数据块比较的过程; 根据所述待写入数据块的每个子数据块在每一次比较过程中的写 0次 数、 写 1次数以及预设的单次写 0能耗和单次写 1能耗计算所述待写入数 据块的每个子数据块在每一次比较过程中的写入能耗。  Comparing each of the sub-blocks of the data block to be written with the sub-block of each of the write-back data blocks, respectively, to obtain each sub-block of the data block to be written in each comparison process Writing 0 times and writing 1 times, wherein each of the comparing processes includes a process of comparing one sub-block of the data block to be written with one sub-block of the write-back data block; Each sub-block of the write data block calculates the number of writes 0, the number of writes 1 and the preset single write 0 power consumption and the single write 1 power consumption in each comparison process to calculate each of the data blocks to be written The write energy consumption of each sub-block in each comparison process.
结合本发明第二方面以及第二方面的第一种可能的实现方式, 在本发 明第二方面的第二种可能的实现方式中, 所述确定模块具体用于:  In conjunction with the second aspect of the present invention and the first possible implementation of the second aspect, in a second possible implementation manner of the second aspect of the present disclosure, the determining module is specifically configured to:
以所述待写入数据块的每个子数据块以及所述写回数据块的每个子 数据块为顶点构造二分图, 所述二分图的各边权值为所述各边对应的待写 入数据块的子数据块在一次比较过程中的写入能耗, 其中, 所述待写入数 据块的子数据块在一次比较过程中的写入能耗为所述待写入数据块的子 数据块写入所述写回数据块的一个子数据块的写入能耗;  Constructing a bipartite graph with each sub-block of the data block to be written and each sub-block of the write-back data block as a vertex, and each edge weight of the bipartite graph is a corresponding to be written in the side The write power consumption of the sub-block of the data block in a comparison process, wherein the write data energy of the sub-block of the data block to be written in one comparison process is the sub-data block to be written Writing a write energy to a data block of the write back data block;
确定所述二分图的最佳匹配, 所述最佳匹配满足如下条件: 各边的权 值总和最小, 覆盖所述二分图的所有顶点, 任意两条边没有共同的顶点; 将所述最佳匹配作为所述最小写入能耗对应的写入方式。 结合本发明第二方面以及第二方面的第一种和第二种可能的实现方 式, 在本发明第二方面的第三种可能的实现方式中, 所述写入模块具体用 于: Determining a best match of the bipartite graph, the best match satisfies the following condition: the sum of weights of each side is the smallest, covering all the vertices of the bipartite graph, and any two sides have no common vertices; The matching is the writing mode corresponding to the minimum write energy consumption. With reference to the second aspect of the present invention and the first and second possible implementation manners of the second aspect, in a third possible implementation manner of the second aspect of the present invention, the writing module is specifically configured to:
根据所述地址以及所述写回数据块的每个子数据块的大小计算所述 写回数据块的每个子数据块的地址;  Calculating an address of each of the sub-data blocks of the write-back data block according to the address and a size of each sub-block of the write-back data block;
根据所述写入关系和所述写回数据块的每个子数据块的地址将所述 待写入数据块的子数据块写入所述 NVM。  The sub-block of the block to be written is written to the NVM according to the write relationship and the address of each sub-block of the write-back data block.
结合本发明第二方面以及第二方面的第一种至第三种可能的实现方 式,在本发明第二方面的第四种可能的实现方式中,所述写入模块还用于: 将所述写入关系写入所述 NVM, 以便从所述 NVM读取所述待写入数据 块的子数据块时, 根据所述写入关系恢复所述待写入数据块。  With reference to the second aspect of the present invention and the first to third possible implementation manners of the second aspect, in a fourth possible implementation manner of the second aspect of the present invention, the writing module is further configured to: Writing a write relationship to the NVM to recover the sub-data block to be written from the NVM, and recovering the to-be-written data block according to the write relationship.
本发明第三方面提供一种非易失性存储器 NVM, 包括: 存储介质、 NVM控制器和通信接口;  A third aspect of the present invention provides a nonvolatile memory NVM, including: a storage medium, an NVM controller, and a communication interface;
所述通信接口, 用于接收写请求;  The communication interface is configured to receive a write request;
所述 NVM控制器, 用于执行本发明第一方面以及第一方面的第一种 至第四种可能的实现方式所提供的方法;  The NVM controller is configured to perform the method provided by the first aspect of the present invention and the first to fourth possible implementations of the first aspect;
所述存储介质, 用于存储数据。  The storage medium is configured to store data.
本发明实施例的数据存储方法、 装置和非易失性存储器, NVM控制器 将待写入数据块和写回数据块分块, 通过将每个待写入数据块的子数据块 与每个写回数据块的子数据块进行比较, 以获得待写入数据块的每个子数 据块的写入能耗, 并根据待写入数据块的每个子数据块的写入能耗确定待 写入数据块的最小写入能耗对应的写入关系, 根据最小写入能耗对应的写 入关系将待写入数据块的子数据块写入 NVM。 所述方法通过比较选取写 入能耗最小的对应关系, 将待写入数据块的子数据块写入 NVM, 从而能 够使 NVM的写入能耗降低到最低。  In the data storage method, device and non-volatile memory of the embodiment of the present invention, the NVM controller divides the data block to be written and the data block to be written back, by using each sub-block of each data block to be written Writing back the sub-blocks of the data block for comparison, obtaining the write energy consumption of each sub-block of the data block to be written, and determining the write-to-write according to the write energy consumption of each sub-block of the data block to be written The write relationship corresponding to the minimum write power consumption of the data block, and the sub data block to be written to the data block is written to the NVM according to the write relationship corresponding to the minimum write power consumption. The method writes the sub-blocks of the data block to be written into the NVM by comparing the correspondences of the minimum write energy consumption, so that the write power consumption of the NVM can be minimized.
附图说明 DRAWINGS
为了更清楚地说明本发明实施例或现有技术中的技术方案, 下面将对 实施例或现有技术描述中所需要使用的附图作一简单地介绍。  In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, a brief description of the drawings used in the embodiments or the prior art description will be briefly made below.
图 1为本发明实施例提供的一种计算机的硬件结构示意图;  1 is a schematic structural diagram of a hardware of a computer according to an embodiment of the present invention;
图 2为本发明实施例提供的另一种计算机的硬件结构示意; 图 3为本发明实施例提供的一种数据存储方法的流程图; 图 4为待写入数据块和写回数据块的一种写入关系的示意图; 图 5为本发明实施例提供的一种确定最小写入能耗对应的写入关系的 流程图; 2 is a schematic structural diagram of hardware of another computer according to an embodiment of the present invention; FIG. 3 is a flowchart of a data storage method according to an embodiment of the present invention; FIG. 4 is a schematic diagram of a write relationship between a data block to be written and a write data block; FIG. a flow chart for determining a write relationship corresponding to a minimum write energy consumption;
图 6为本发明实施例提供的数据存储装置的结构示意图;  FIG. 6 is a schematic structural diagram of a data storage device according to an embodiment of the present disclosure;
图 7为本发明实施例提供的一种 NVM的结构示意图。 具体实施方式  FIG. 7 is a schematic structural diagram of an NVM according to an embodiment of the present invention. detailed description
为使本发明实施例的目的、 技术方案和优点更加清楚, 下面将结合本 发明实施例中的附图, 对本发明实施例中的技术方案进行清楚、 完整地描 述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。  The technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. It is a partial embodiment of the invention, and not all of the embodiments.
本发明实施例的方法以 NVM作为外存使用的场景为例进行说明, 图 1为本发明实施例提供的一种计算机的硬件结构示意图, 如图 1所示, 该 计算机包括:主板 11、中央处理单元(Central Processing Unit,简称 CPU) 12、 内存 (Memory) 13、 NVM14和外存 15。 其中, CPU12、 内存 13和 NVM14集成在主板 11上, CPU12和内存 13通过总线连接并通信。 常用 的 NVM有 PCM、 Flash, FRAM以及 NAND等, NVM14包括:存储介质、 NVM控制器以及通信接口, 存储介质用于存储数据, NVM控制器可通过 现场可编程门阵列 (Field—Programmable Gate Array, 简称 FPGA) 或专用 集成电路(Application Specific Integrated Circuit, 简称 ASIC)实现, NVM 控制器具有运算处理能力。内存 13通过输入 /输出(Input/Output,简称 I/O) 接口和 NVM连接, 该 I/O接口可以为串行 ATA接口 (Serial ATA, 简称 SATA) 、 串行 SCSI接口 (Serial Attached SCSI, 简称 SAS) 、 PCI快速 通道 (PCI express, 简称 PCIe) 。 可以理解的是, 主板 11上还可以集成 缓存(cache) 、 南桥芯片等其他硬件, 本发明实施例不一一列举, 也不对 其进行限制。  The method of the embodiment of the present invention is described by taking a scenario in which the NVM is used as an external memory. FIG. 1 is a schematic diagram of a hardware structure of a computer according to an embodiment of the present invention. As shown in FIG. 1 , the computer includes: a motherboard 11 and a central portion. Central Processing Unit (CPU) 12, Memory 13, NVM14 and external memory 15. The CPU 12, the memory 13 and the NVM 14 are integrated on the main board 11, and the CPU 12 and the memory 13 are connected and communicated via a bus. The commonly used NVMs include PCM, Flash, FRAM, and NAND. The NVM 14 includes: a storage medium, an NVM controller, and a communication interface. The storage medium is used to store data, and the NVM controller can pass a Field-Programmable Gate Array (Field-Programmable Gate Array, Referred to as FPGA) or Application Specific Integrated Circuit (ASIC), the NVM controller has the processing power. The memory 13 is connected to the NVM through an input/output (I/O) interface. The I/O interface can be a Serial ATA interface (SATA) or a Serial SCSI interface (Serial Attached SCSI). SAS), PCI Express (PCI Express). It can be understood that other hardware such as a cache and a south bridge chip can be integrated on the main board 11, which is not enumerated in the embodiment of the present invention, and is not limited thereto.
图 2为本发明实施例提供的另一种计算机的硬件结构示意图, 如图 2 所示, 本实施例的计算机包括: 主板 21、 CPU22、 内存 23、 NVM24 , 其 中, CPU22和内存 23集成在主板 21上, NVM24在主板 21的外部, NVM24 通过 I/O接口与主板连接, NVM24包括 NVM控制器, NVM24可以做成 扩展卡, 通过 PCIe接口与主板 21连接, 当有多个 NVM时, 可通过多个 扩展卡与主板连接。与图 1所示的计算机相比,本实施例的计算机中 NVM 并不是集成在主板上, 而是在主板外部。 本实施例中, 主板 21 上还可以 集成缓存 (cache) 、 南桥芯片等其他硬件, 这里不一一列举。 FIG. 2 is a schematic diagram of a hardware structure of another computer according to an embodiment of the present invention. As shown in FIG. 2, the computer of this embodiment includes: a motherboard 21, a CPU 22, a memory 23, and an NVM 24. The CPU 22 and the memory 23 are integrated in the motherboard. On the 21st, the NVM24 is external to the motherboard 21, the NVM24 is connected to the motherboard through an I/O interface, the NVM 24 includes an NVM controller, and the NVM 24 can be made up. The expansion card is connected to the motherboard 21 through the PCIe interface. When there are multiple NVMs, the expansion card can be connected to the motherboard through multiple expansion cards. Compared with the computer shown in FIG. 1, the NVM in the computer of this embodiment is not integrated on the motherboard but outside the motherboard. In this embodiment, the motherboard 21 can also integrate other hardware such as a cache and a south bridge chip, which are not enumerated here.
图 3为本发明实施例提供的一种数据存储方法的流程图, 本发明实施 例的方法可以由图 1和图 2所示的计算机中的 NVM控制器执行。 如图 3 所示, 本实施例的方法可以包括以下歩骤:  FIG. 3 is a flowchart of a data storage method according to an embodiment of the present invention. The method of the embodiment of the present invention may be performed by an NVM controller in the computer shown in FIG. 1 and FIG. As shown in FIG. 3, the method in this embodiment may include the following steps:
歩骤 101、 NVM控制器接收写请求, 写请求中包含有待写入数据块以 及地址。  Step 101: The NVM controller receives a write request, where the write request includes a data block to be written and an address.
当 NVM控制器接收到 CPU发送的写请求时,根据写请求中包括的地 址查看缓存区中是否有该地址对应的写回数据块, 若缓存区中有该地址对 应的写回数据则执行歩骤 102,若缓存区中没有该地址对应的写回数据块, 则 NVM控制器根据该地址从 NVM中读取该地址对应的写回数据块。 正 常情况下 NVM控制器能够从 NVM中读取到写回数据块, 当计算机发生 硬件故障或写冲突的情况下, NVM控制器不能从 NVM中读取到写回数 据块。 当 NVM控制器从 NVM中不能读取到写回数据块时, NVM控制器 可以直接将待写回数据块写入 NVM。  When the NVM controller receives the write request sent by the CPU, it checks whether there is a writeback data block corresponding to the address in the buffer according to the address included in the write request, and if the write data corresponding to the address is in the buffer area, the execution is performed. Step 102: If there is no write-back data block corresponding to the address in the buffer area, the NVM controller reads the write-back data block corresponding to the address from the NVM according to the address. Normally, the NVM controller can read back the data block from the NVM. When the computer has a hardware failure or a write conflict, the NVM controller cannot read back the data block from the NVM. When the NVM controller cannot read back the data block from the NVM, the NVM controller can directly write the data block to be written back to the NVM.
需说明的是, 本发明实施例中将写请求中携带的数据称为待写入数据 块, 将缓存区中缓存的与 NVM中相同位置的数据称为写回数据块。 这里 的待写入数据块和写回数据块均是指数据。  It should be noted that, in the embodiment of the present invention, the data carried in the write request is referred to as a data block to be written, and the data buffered in the buffer area and the same position in the NVM is referred to as a write back data block. Here, both the data block to be written and the data block to be written back refer to the data.
歩骤 102、NVM控制器分别将待写入数据块以及缓存中与该地址对应 的写回数据块平均划分为 N个子数据块, 其中, N为不小于 2的正整数。  Step 102: The NVM controller divides the data block to be written and the write data block corresponding to the address in the cache into N sub-blocks, where N is a positive integer not less than 2.
分块个数 N可以根据实际需要进行调整, N为不小于 2的正整数, 待 写入数据块和写回数据块的大小相同, 将写回数据块和待写入数据块平均 划分为 N个子数据块后, 每个待写入数据块的子数据块的大小相同, 每个 写回数据块的子数据块的大小相同, 并且待写入数据块的子数据块和写回 子数据块的子数据块的大小相同。假设待写入数据块的大小为 block— S1Ze, 则待写入数据块的子数据块的大小为 block— size /N, 写回数据块的子数据 块的大小也为 block— size /N。 The number of blocks N can be adjusted according to actual needs. N is a positive integer not less than 2, and the size of the data block to be written and the data block to be written back are the same. The data block to be written back and the data block to be written are equally divided into N. After each sub-block, the size of each sub-block to be written is the same, the size of the sub-block of each write-back block is the same, and the sub-block of the block to be written and the sub-block of the write-back are written. The size of the sub-blocks is the same. Assuming that the size of the data block to be written is block_S1Ze , the size of the sub-block of the data block to be written is block_size /N, and the size of the sub-block of the data block to be written back is also block_size/N .
歩骤 103、NVM控制器将每个待写入数据块的子数据块与每个写回数 据块的子数据块进行比较, 以获得待写入数据块的每个子数据块的写入能 耗。 Step 103: The NVM controller writes each sub-block of the data block to be written with each The comparison is performed on the sub-blocks of the block to obtain the write energy consumption of each sub-block of the block to be written.
假设每个待写入数据块的子数据块被记为 i=l〜N, 每个写回数据 块的子数据块被记为 ζ,」= ··Ν, 当 ι=1时, NVM控制器将待写入数据块的 第 1个子数据块与写回数据块的 N个子数据块分别进行比较, 总共有 N次比 较过程, 通过 N次比较过程获得待写入数据块的第 1个子数据块在 N次比较 过程中的写入能耗, 因此, 待写入数据块的第 1个子数据块共有 N个写入能 耗。 然后, 再按照上述计算第 1个子数据块的 N个写入能耗的方法分别计算 第 1+1个至第 N个子数据块的 N个写入能耗。 从而得到每个待写入数据块的 子数据块的写入能耗, 每个待写入数据块的子数据块都有 N个写入能耗。  Assuming that each sub-block of data to be written is recorded as i=l~N, the sub-block of each write-back block is marked as ζ,"= ··Ν, when ι=1, NVM control The first sub-block of the data block to be written is compared with the N sub-blocks of the data block to be written back, and there are a total of N comparison processes, and the first sub-data of the block to be written is obtained by N comparison processes. The write energy consumption of the block during N comparisons, therefore, the first sub-block of the data block to be written has a total of N write energy consumption. Then, the N write energy consumptions of the 1+1th to Nth subblocks are respectively calculated according to the above method for calculating the N write energy consumption of the first subblock. Thereby, the write energy consumption of each sub-block of the data block to be written is obtained, and each sub-block of the data block to be written has N write energy consumption.
NVM 控制器将每个待写入数据块的子数据块与每个写回数据块的子 数据块进行比较, 以获得待写入数据块的每个子数据块的写入能耗, 具体 为: 分别将每个待写入数据块的子数据块与每个写回数据块的子数据块进 行比较, 以获得每一次比较过程中待写入数据块的每个子数据块的写 0次 数和写 1次数, 其中, 所述每一次比较过程包括所述待写入数据块的一个 子数据块与所述写回数据块的一个子数据块比较的过程; 然后, 根据待写 入数据块的每个子数据块在每一次比较过程中的写 0次数、 写 1次数以及 预设的单次写 0能耗和单次写 1能耗计算待写入数据块的每个子数据块在 每一次比较过程中的写入能耗。  The NVM controller compares each sub-block of the data block to be written with the sub-block of each write-back data block to obtain the write energy consumption of each sub-block of the data block to be written, specifically: Comparing each sub-block of the data block to be written with the sub-block of each write-back data block, respectively, to obtain the number of writes 0 and write of each sub-block of the data block to be written in each comparison process. 1 times, wherein each of the comparing processes includes a process of comparing one sub-block of the data block to be written with one sub-block of the write-back data block; and then, according to each block to be written Each sub-block of data in each comparison process writes 0 times, writes 1 times, and presets a single write 0 energy consumption and a single write 1 energy consumption to calculate each sub-block of the data block to be written in each comparison process. Write energy consumption in .
举例来说, 当 N为 4时, 待写入数据块和写回数据块分别被划分为 4 个子数据块, 待写入数据块的第 1个子数据块的写入能耗包括 4次比较过 程的写入能耗, NVM控制器首先确定待写入数据块的第 1个子数据块写 入写回数据块的第 1个子数据块的写 0次数和写 1次数, 具体地: NVM 控制器比较待写入数据块的第 1个子数据块和写回数据块的第 1个子数据 块对应比特位上的数据, 若对应比特位上的数据相同, 则不更新该比特位 上的数据, 若对应比特位上的数据不同, 则需要更新该比特位上的数据, 并确定该比特位上的数据需要进行写 0操作还是写 1操作, 从而得到第一 次比较过程中待写入数据块的第 1个子数据块的写 0次数和写 1次数。  For example, when N is 4, the to-be-written data block and the write-back data block are respectively divided into 4 sub-blocks, and the write energy consumption of the 1st sub-block to be written into the data block includes 4 comparison processes. Write power consumption, the NVM controller first determines the first sub-block of the data block to be written and writes the number of writes 0 and writes 1 of the first sub-block of the write-back data block, specifically: NVM controller comparison The first sub-block of the data block to be written and the data of the corresponding bit of the first sub-block of the write-back data block, if the data on the corresponding bit is the same, the data on the bit is not updated, if corresponding If the data on the bit is different, the data on the bit needs to be updated, and it is determined whether the data on the bit needs to be written to 0 or written to 1 to obtain the first block to be written in the first comparison process. Write 0 times and write 1 times of 1 sub-block.
由于单次写 0能耗和单次写 1能耗不同, 因此, 本实施例中需要统计 写 0次数和写 1次数, 然后计算写 0的总能耗和写 1的总能耗, 在计算出 写 0的总能耗和写 1的总能耗后, 将写 0的总能耗和写 1的总能耗加起来 得到写入能耗。 单次写 0能耗和单次写 0能耗为固定值, 在数据初始化时 预先设置好, 在确定写 0次数和写 1次数后, 用单次写 0能耗乘以写 0次 数得到写 0的总能耗, 用单次写 1能耗乘以写 1次数得到写 1的总能耗。 Since the single write 0 energy consumption and the single write 1 energy consumption are different, in this embodiment, the number of write 0 times and the write 1 times need to be counted, and then the total energy consumption of writing 0 and the total energy consumption of writing 1 are calculated. Out After writing the total energy consumption of 0 and writing the total energy consumption of 1, the total energy consumption of writing 0 and the total energy consumption of writing 1 are added together to obtain the writing energy consumption. The single write 0 energy consumption and the single write 0 energy consumption are fixed values, which are set in advance when the data is initialized. After determining the number of writes 0 and the number of writes 1, the number of times written by 0 is multiplied by the number of writes 0 to get written. The total energy consumption of 0 is multiplied by the number of writes per write by 1 to get the total energy consumption of 1 write.
NVM通过上述的方法依次计算待写入数据块的第 1个子数据块写入 写回数据块的其他 3个子数据块的写入能耗, 待写入数据块的每个子数据 块的写入能耗都包括 4次比较过程的写入能耗。  The NVM sequentially calculates the write energy consumption of the first three sub-blocks of the data block to be written and the other three sub-blocks of the write-back data block by the above method, and the write energy of each sub-block of the data block to be written The consumption includes the write energy consumption of the 4 comparison processes.
歩骤 104、NVM控制器根据待写入数据块的每个子数据块的写入能耗 确定待写入数据块的最小写入能耗对应的写入关系, 其中, 写入关系包括 待写入数据块的子数据块与写回数据块的子数据块的对应关系。  Step 104: The NVM controller determines, according to a write energy consumption of each sub-block of the data block to be written, a write relationship corresponding to a minimum write energy consumption of the data block to be written, where the write relationship includes a write relationship to be written. The correspondence between the sub-block of the data block and the sub-block of the write back data block.
以图 4为例进行说明, 图 4为待写入数据块和写回数据块的一种写入 关系的示意图, 如图 4所示, 待写入数据块被划分为 4个子数据块: 、 d2、 d3、 d4, 待写入数据块的 4个子数据块的地址连续, 写回数据块也被 划分为 4个子数据块: fl、 f2、 f3、 f4, 写回数据块的 4个子数据块的地 址连续, 这里的地址连续均是指物理地址连续。 4 is used as an example for illustration. FIG. 4 is a schematic diagram of a write relationship between a data block to be written and a write data block. As shown in FIG. 4, the data block to be written is divided into four sub-blocks: d 2 , d 3 , d 4 , the addresses of the 4 sub-blocks to be written to the data block are consecutive, and the write-back data block is also divided into 4 sub-blocks: fl, f2, f3, f4, and 4 of the data block are written back. The address of each sub-block is continuous, and the address here continuously means that the physical address is continuous.
现有技术中, 待写入数据块和写回数据块的写入关系固定, 即 dl 写 入 fl, d2写入 f2, d3写入 f3, d4写入 f4。 本实施例中, 待写入数据块的 子数据块和写回数据块的子数据块之间并没有固定的写入关系, 当分块个 数为 N时, 共有 N!种写入关系, 图 4所示例子中 N的取值为 4, 因此, 共有 24中写入关系,待写入数据块采用不同的写入关系时写入能耗不同, 本歩骤的目的就是从 24种写入关系中选择一种写入能耗最小的写入关系。  In the prior art, the write relationship between the data block to be written and the write back data block is fixed, that is, dl is written to fl, d2 is written to f2, d3 is written to f3, and d4 is written to f4. In this embodiment, there is no fixed write relationship between the sub-block of the data block to be written and the sub-block of the data block to be written back. When the number of blocks is N, there are a total of N! In the example shown in Figure 4, the value of N is 4. Therefore, there are 24 write relationships. When the data blocks to be written have different write relationships, the write energy consumption is different. The purpose of this step is to write from 24 types. In the relationship, select a write relationship with the lowest write energy consumption.
一种实现方式中, NVM 控制器可以计算出每种写入关系对应的写入 能耗, 并比较各种写入关系对应的写入能耗的大小, 从中选择写入能耗最 小的写入关系。 另一种实现方式中, NVM 控制器可以通过二分图确定最 小写入能耗对应的写入关系。 例如, NVM 控制器确定的最小写入能耗对 应的写入关系为: dl→f3、 d2→f2、 d3→f4、 d4→fl, 即待写入数据块的 子数据块 dl写回数据块的子数据块 f3,待写入数据块的子数据块 d2写回 数据块的子数据块 Ω, 待写入数据块的子数据块 d3写入写回数据块的子 数据块 f4, 待写入数据块的子数据块 d4写入写回数据块的子数据块 fl。  In an implementation manner, the NVM controller can calculate the write energy consumption corresponding to each write relationship, and compare the write power consumption corresponding to the various write relationships, and select the write with the lowest power consumption. relationship. In another implementation, the NVM controller can determine the write relationship corresponding to the minimum write energy consumption through the bipartite graph. For example, the write relationship corresponding to the minimum write power determined by the NVM controller is: dl→f3, d2→f2, d3→f4, d4→fl, that is, the sub-block dl of the data block to be written is written back to the data block. The sub-data block f3, the sub-data block d2 of the data block to be written is written back to the sub-data block Ω of the data block, and the sub-data block d3 of the data block to be written is written into the sub-data block f4 of the write-back data block, to be written The sub-data block d4 of the incoming data block is written to the sub-data block fl of the write-back data block.
歩骤 105、NVM控制器根据地址以及写入关系将待写入数据块的子数 据块写入 NVM。 Step 105: The NVM controller records the number of sub-blocks to be written according to the address and the write relationship. The block is written to the NVM.
具体地, NVM 控制器根据地址以及写回数据块的每个子数据块的大 小计算写回数据块的每个子数据块的地址; 然后, 根据写入关系和写回数 据块的每个子数据块的地址将待写入数据块的子数据块写入 NVM。 NVM 控制器将待写入数据块的子数据块写入 NVM时有以下两种方式: 第一种 方式, NVM 控制器根据待写入数据块的子数据块以及写入关系对相应的 写回数据块的子数据块进行改写; 然后, 按照写回数据块的每个子数据块 的地址将改写后的写回数据块的子数据块写入 NVM 中。 第二种方式, NVM根据写回数据块的每个子数据块的地址和写入关系改写 NVM中的 数据。  Specifically, the NVM controller calculates an address of each sub-block of the write-back data block according to the address and the size of each sub-block of the write-back data block; and then, according to the write relationship and the write-back of each sub-block of the data block The address writes the sub-block of the data block to be written to the NVM. When the NVM controller writes the sub-blocks of the data block to be written to the NVM, there are two ways: In the first way, the NVM controller writes back corresponding data according to the sub-blocks of the data block to be written and the write relationship. The sub-block of the data block is overwritten; then, the sub-block of the rewritten write back data block is written into the NVM according to the address of each sub-block of the write-back data block. In the second mode, the NVM overwrites the data in the NVM according to the address and write relationship of each sub-block of the write-back data block.
NVM 控制器可以根据以下公式计算写回数据块的每个子数据块的地 址: Ara+j xM,其中, Α」为第」个写回数据块的子数据块的地址, j=l,…, N, a为写请求中携带的地址的起始地址, M为写回数据块的每个子数据 块的大小。 在确定写回数据块的每个子数据块的地址后, NVM 控制器根 据写入关系将待写入数据块的子数据块写入 NVM。 The NVM controller can calculate the address of each sub-block of the write-back data block according to the following formula: A r a+j xM, where Α is the address of the sub-block of the first write-back data block, j=l, ..., N, a is the starting address of the address carried in the write request, and M is the size of each sub-block of the write-back data block. After determining the address of each sub-block of the write data block, the NVM controller writes the sub-block of the block to be written to the NVM according to the write relationship.
本实施例中, NVM 控制器将待写入数据块和写回数据块分块, 通过 将每个待写入数据块的子数据块与每个写回数据块的子数据块进行比较, 以获得待写入数据块的每个子数据块的写入能耗, 并根据待写入数据块的 每个子数据块的写入能耗确定待写入数据块的最小写入能耗对应的写入 关系, 根据最小写入能耗对应的写入关系将待写入数据块的子数据块写入 NVMo所述方法通过比较选取写入能耗最小的对应关系,将待写入数据块 的子数据块写入 NVM, 从而能够使 NVM的写入能耗降低到最低。  In this embodiment, the NVM controller divides the to-be-written data block and the write-back data block into blocks, by comparing each sub-block of the data block to be written with each sub-block of the data block that is written back, Obtaining the write energy consumption of each sub-block of the data block to be written, and determining the write corresponding to the minimum write energy of the data block to be written according to the write energy consumption of each sub-block of the data block to be written Relationship, the sub-data block to be written to the data block is written to NVMo according to the write relationship corresponding to the minimum write power consumption. The method compares the correspondence between the selected write energy consumption and the sub-data to be written into the data block. The block is written to the NVM to minimize the write power consumption of the NVM.
通常, 待写入数据块和写回数据块存在很大的相似性, 当插入新数据 块或者对数据块进行移位导致写回数据块的地址变化时, 若采用现有技术 的方案, 将待写入数据块和写回数据块对应位置上的数据进行比较时, 大 部分数据不同,这种情况下 NVM的写入能耗很大。采用本实施例的方法, 可以有效的解决这一类问题。 仍以图 4为例说明, 当在 fl和 Ω之间插入 一个新数据块后, 原 f2、 f3、 f4 的地址都向后移动了一个数据块的大小。 若采用现有技术的方案, 则将 dl写入现有的 fl, 将 d2写入现有的 f2, 将 d3写入现有的 f3, 将 d4写入现有的 f4, 由于原 Ω的数据向后移动了, 导 致 d2与现有的 Ω的数据差异很大, 相应地, d3与现有的 f3的数据差异 很大, d4与现有的 f4的数据差异也很大, 大部分数据都需要重写, NVM 写入能耗很大。 而本实施例的方案, 通过比较各种写入关系对应的写入能 耗,可以将 dl写入现有的 fl,将 d2写入现有的 f3,将 d3写入现有的 f4, 将 d4写入现有的 f2, 由于 dl和现有的 fl的数据大部分相同, d2和现有 的 f3的数据大部分相同, d3与现有的 f4的数据大部分相同, 只有小部分 数据要写, 因此, 本实施例的方法能够降低 NVM的写入能耗。 Generally, there is a great similarity between the data block to be written and the data block to be written back. When a new data block is inserted or the data block is shifted, causing the address of the data block to be changed back, if the prior art solution is adopted, When the data to be written and the data at the corresponding position of the write data block are compared, most of the data is different. In this case, the write power consumption of the NVM is large. With the method of the embodiment, this type of problem can be effectively solved. Still taking FIG. 4 as an example, when a new data block is inserted between fl and Ω, the addresses of the original f2, f3, and f4 all move backward by the size of one data block. If the prior art scheme is used, dl is written to the existing fl, d2 is written to the existing f2, d3 is written to the existing f3, and d4 is written to the existing f4, due to the original Ω data. Moved backwards, guide The data of d2 and the existing Ω are very different. Correspondingly, the data of d3 is very different from the data of the existing f3. The data of d4 and the existing f4 are also very different. Most of the data needs to be rewritten, NVM. Write energy is very high. In the solution of this embodiment, by comparing the write energy consumption corresponding to various write relationships, dl can be written into the existing fl, d2 is written into the existing f3, and d3 is written into the existing f4, D4 writes the existing f2, since the data of dl and the existing fl are mostly the same, the data of d2 and the existing f3 are mostly the same, and the data of d3 is mostly the same as the data of the existing f4, only a small part of the data is required. Write, therefore, the method of the present embodiment can reduce the write power consumption of the NVM.
NVM控制器将待写入数据块的子数据块写入 NVM之后, 还要将写 入关系写入 NVM, 以便从 NVM读取待写入数据块的子数据块时, 根据 写入关系恢复待写入数据块。这是因为按照本实施例的方法将待写入数据 块写入 NVM后, 待写入数据块的内容的顺序被打乱了, 因此, 在将待写 入数据从 NVM中读出时, 要恢复待写入数据块的顺序。 写入关系可以存 储在 NVM中一块专用区域内, 当 NVM控制器从 NVM中读取数据时, 同时需要从该专用区域读取该数据对应的写入关系。 NVM 中存储的该写 入关系具体可以为待写入数据块的子数据块的标识, 当 N为 2k时, 每个 待写入数据块的子数据块需要的额外开销为 log(N)比特, 额外开销指存储 待写入数据块的子数据块所需的存储区域的大小, 那么待写入数据块的额 外开销为 N*log(N)比特, 当 N不为 2K时, 每个待写入数据块的子数据块 需要的额外开销为「i0g(N;n, 「,表示向上取整运算, 待写入数据块需要的 额外开销为 N「log(Nfl。 例如 N=4, 可以用 00、 01、 10、 1 1分别表示 4个 待写入数据块的子数据块。 本实施例的方法, 待写入数据块需要额外的 N*l0g(N;)比特位存储写入关系, 而现有技术中, 每个字节需要一个额外的 比特位存储翻转信息, 因此, 本实施例的方法还能够减少额外开销。 After the NVM controller writes the sub-block of the data block to be written to the NVM, the write relationship is also written to the NVM, so as to read the sub-block of the data block to be written from the NVM, and resume the recovery according to the write relationship. Write a block of data. This is because the order of the contents of the data block to be written is disturbed after the data block to be written is written to the NVM according to the method of the embodiment, and therefore, when the data to be written is read from the NVM, Restore the order in which the data blocks are to be written. The write relationship can be stored in a dedicated area in the NVM. When the NVM controller reads data from the NVM, it also needs to read the write relationship corresponding to the data from the dedicated area. The write relationship stored in the NVM may specifically be an identifier of a sub-block of the data block to be written. When N is 2 k , the additional overhead required for each sub-block of the data block to be written is log(N) Bit, the overhead refers to the size of the storage area required to store the sub-block of the data block to be written, then the overhead of the data block to be written is N*lo g (N) bits, when N is not 2 K , The additional overhead required for each sub-block of data block to be written is "i 0 g(N;n, ", indicating an up-rounding operation, and the overhead required to write the data block is N"log(Nfl. For example N=4, 00, 01, 10, 1 1 can be used to represent the four sub-blocks of the data block to be written respectively. The method of this embodiment requires an additional N*l 0g (N;) to be written to the data block. The bit stores the write relationship, whereas in the prior art, each byte requires an extra bit to store the flip information, and therefore, the method of the embodiment can also reduce the overhead.
图 5为本发明实施例提供的一种确定最小写入能耗对应的写入关系的 流程图, 本实施例是对图 3所示实施例中歩骤 104的详细说明, 本实施例 中通过构造二分图确定最小写入能耗对应的写入关系, 二分图只是求解最 小写入能耗对应的写入关系的一种可行方法, 当然还可以通过其他方法求 解。 如图 5所示, 本实施例的方法可以包括以下歩骤:  FIG. 5 is a flowchart of determining a write relationship corresponding to a minimum write power consumption according to an embodiment of the present invention. This embodiment is a detailed description of step 104 in the embodiment shown in FIG. 3, which is adopted in this embodiment. The bipartite graph is constructed to determine the write relationship corresponding to the minimum write energy consumption. The bipartite graph is only a feasible method for solving the write relationship corresponding to the minimum write energy consumption, and can of course be solved by other methods. As shown in FIG. 5, the method in this embodiment may include the following steps:
歩骤 201、NVM控制器以待写入数据块的每个子数据块以及写回数据 块的每个子数据块为顶点构造二分图, 二分图的各边权值为各边对应的待 写入数据块的子数据块在一次比较过程中的写入能耗, 其中, 待写入数据 块的子数据块在一次比较过程中的写入能耗为该待写入数据块的子数据 块写入写回数据块的一个子数据块的写入能耗。 Step 201: The NVM controller constructs a bipartite graph with each sub-block of the data block to be written and each sub-block of the write data block as a vertex, and the weights of the sides of the bipartite graph are corresponding to each side. Write energy consumption of a sub-block of a data block written in a comparison process, wherein a sub-data block of the data block to be written has a write energy consumption in a comparison process as a sub-data of the data block to be written The block writes the write energy of a sub-block of the write back data block.
假设二分图用 G(D, F)表示, D表示待写入数据块, F表示写回数据 块, 二分图的顶点为待写入数据块的子数据块或写回数据块的子数据块, 假设待写入数据块的第 1个子数据块 4写入写回数据块的第」个子数据块 的 ζ的写入能耗为 (1^), 那么二分图 G各边的权值为 eCd,, fj), 二 分图可以用一个NX N的矩阵来表示:E=[E1,j]NXN,i= 2…,N},j= 2…, N}。 Suppose the bipartite graph is represented by G(D, F), D represents the data block to be written, F represents the write back data block, and the vertex of the bipartite graph is the sub data block of the data block to be written or the sub data block of the write data block. Assuming that the write energy consumption of the first sub-block 4 of the data block to be written to the first sub-block of the write-back data block is (1^), the weight of each side of the bipartite graph G is eCd. ,, fj), the bipartite graph can be represented by a matrix of NX N: E = [E 1 , j ] NXN , i = 2..., N}, j = 2..., N}.
歩骤 202、 NVM控制器确定二分图的最佳匹配, 最佳匹配满足如下条 件: 各边的权值总和最小, 覆盖二分图的所有顶点, 任意两条边没有共同 的顶点。  Step 202: The NVM controller determines the best match of the bipartite graph. The best match satisfies the following conditions: The sum of the weights of each side is the smallest, covering all the vertices of the bipartite graph, and any two sides have no common vertices.
可采用现有的写入关系求解二分图的最佳匹配, 这里不做过多解释, 本实施例中该最佳匹配需要同时满足以下三个条件: (1 ) 各边的权值总 和最小, 每条边的权值都为一个写入能耗, 各边权值总和最小意味着各边 的写入能耗最小。 (2 ) 覆盖二分图的所有顶点, 由于二分图的顶点表示 待写入数据块的子数据块或写回数据块的子数据块, 覆盖二分图的所有顶 点是为了保证将待写入数据块的所有子数据块都写回对应的写回数据块 的子数据块。 (3 ) 任意两条边没有共同的顶点, 这是因为在将待写入数 据块的子数据块写回 NVM时, 任意一个待写入数据块的子数据块只能写 入写回数据块的其中一个子数据块, 若任意两条边有共同点, 那么说明一 个待写入数据块的子数据块可能对应两个写回数据块的子数据块。  The existing matching relationship can be used to solve the best matching of the bipartite graph. The explanation is not explained too much. In this embodiment, the best matching needs to satisfy the following three conditions simultaneously: (1) The sum of the weights of each side is the smallest, The weight of each edge is a write energy consumption, and the minimum sum of the weights on each side means that the write energy consumption of each side is the smallest. (2) Covering all vertices of the bipartite graph, since the vertices of the bipartite graph represent sub-blocks of the data block to be written or sub-blocks of the data block to be written back, all vertices covering the bipartite graph are used to ensure that the data block to be written is to be written All of the sub-blocks are written back to the corresponding sub-block of the write-back block. (3) There is no common vertex on any two sides. This is because when a sub-block of the data block to be written is written back to NVM, any sub-block of the block to be written can only be written to the write-back block. If one of the two sub-blocks has a common point, then the sub-block of the data block to be written may correspond to the sub-block of the two data blocks.
歩骤 203、NVM控制器将最佳匹配作为最小写入能耗对应的写入方式。 图 6为本发明实施例提供的数据存储装置的结构示意图,如图 6所示, 本实施例的装置可以包括: 接收模块 31、 划分模块 32、 获取模块 33、 确 定模块 34和写入模块 35。  Step 203: The NVM controller uses the best match as the write mode corresponding to the minimum write power consumption. FIG. 6 is a schematic structural diagram of a data storage device according to an embodiment of the present invention. As shown in FIG. 6, the device in this embodiment may include: a receiving module 31, a dividing module 32, an obtaining module 33, a determining module 34, and a writing module 35. .
其中, 接收模块 31, 用于接收写请求, 所述写请求中包含有待写入数 据块以及地址;  The receiving module 31 is configured to receive a write request, where the write request includes a data block to be written and an address;
划分模块 32,用于分别将所述待写入数据块以及缓存中与所述地址对 应的写回数据块平均划分为 N个子数据块,其中, N为不小于 2的正整数; 获取模块 33,用于将所述每个待写入数据块的子数据块与所述每个写 回数据块的子数据块进行比较, 以获得所述待写入数据块的每个子数据块 的写入能耗; The dividing module 32 is configured to divide the data block to be written and the write back data block corresponding to the address into N sub-blocks, wherein N is a positive integer not less than 2; An obtaining module 33, configured to compare the sub-block of each of the data blocks to be written with the sub-block of each of the write-back data blocks to obtain each sub-block of the data block to be written Write energy consumption;
确定模块 34,用于根据所述待写入数据块的每个子数据块的写入能耗 确定所述待写入数据块的最小写入能耗对应的写入关系, 其中, 所述写入 关系包括所述待写入数据块的子数据块与所述写回数据块的子数据块的 对应关系;  a determining module 34, configured to determine, according to a write energy consumption of each sub-block of the data block to be written, a write relationship corresponding to a minimum write energy consumption of the data block to be written, where the writing The relationship includes a correspondence between the sub-block of the data block to be written and the sub-block of the write-back data block;
写入模块 35,用于根据所述地址以及所述写入关系将所述待写入数据 块的子数据块写入非易失性存储器 NVM。  The writing module 35 is configured to write the sub-block of the data block to be written into the non-volatile memory NVM according to the address and the write relationship.
本实施例中, 获取模块 33 具体用于: 分别将所述每个待写入数据块 的子数据块与所述每个写回数据块的子数据块进行比较, 以获得每一次比 较过程中所述待写入数据块的每个子数据块的写 0次数和写 1次数,其中, 所述每一次比较过程包括所述待写入数据块的一个子数据块与所述写回 数据块的一个子数据块比较的过程; 然后, 根据所述待写入数据块的每个 子数据块在每一次比较过程中的写 0次数、 写 1次数以及预设的单次写 0 能耗和单次写 1能耗计算所述待写入数据块的每个子数据块在每一次比较 过程中的写入能耗。  In this embodiment, the obtaining module 33 is specifically configured to: compare each of the sub-blocks of the data block to be written with the sub-block of each of the data blocks, to obtain each comparison process. Writing 0 times and writing 1 times of each sub-block of the data block to be written, wherein each of the comparing processes includes one sub-block of the to-be-written data block and the write-back data block a process of comparing sub-blocks; then, according to each sub-block of the data block to be written, the number of writes 0, the number of writes 1 and the preset single write 0 energy consumption and single time in each comparison process Write 1 energy consumption calculates the write energy consumption of each sub-block of the data block to be written in each comparison process.
可选地, 所述确定模块 34 具体用于: 首先, 以所述待写入数据块的 每个子数据块以及所述写回数据块的每个子数据块为顶点构造二分图, 所 述二分图的各边权值为所述各边对应的待写入数据块的子数据块在一次 比较过程中的写入能耗, 其中, 所述待写入数据块的子数据块在一次比较 过程中的写入能耗为所述待写入数据块的子数据块写入所述写回数据块 的一个子数据块的写入能耗。 然后, 确定所述二分图的最佳匹配, 所述最 佳匹配满足如下条件:各边的权值总和最小,覆盖所述二分图的所有顶点, 任意两条边没有共同的顶点。 最后, 将所述最佳匹配作为所述最小写入能 耗对应的写入方式。  Optionally, the determining module 34 is specifically configured to: first, construct a bipartite graph with each sub-block of the to-be-written data block and each sub-block of the write-back data block as a vertex, and the bipartite graph The weight of each side of the edge is the write energy consumption of the sub-block of the data block to be written corresponding to each side in a comparison process, wherein the sub-block of the data block to be written is in a comparison process The write power consumption writes the write energy consumption of one sub-block of the write-back data block to the sub-block of the data block to be written. Then, the best match of the bipartite graph is determined, and the optimal match satisfies the condition that the sum of the weights of the sides is the smallest, covering all the vertices of the bipartite graph, and any two sides have no common vertices. Finally, the best match is used as the write mode corresponding to the minimum write energy consumption.
本实施例中, 写入模块 35 具体用于: 根据所述地址以及所述写回数 据块的每个子数据块的大小计算所述写回数据块的每个子数据块的地址; 然后, 根据所述写入关系和所述写回数据块的每个子数据块的地址将所述 待写入数据块的子数据块写入所述 NVM。 所述写入模块 35还用于: 将所 述写入关系写入所述 NVM, 以便从所述 NVM读取所述待写入数据块的 子数据块时, 根据所述写入关系恢复所述待写入数据块。 In this embodiment, the writing module 35 is specifically configured to: calculate an address of each sub-block of the write-back data block according to the address and a size of each sub-block of the write-back data block; The write relationship and the address of each sub-block of the write-back data block write the sub-block of the block to be written to the NVM. The writing module 35 is further configured to: Writing a write relationship to the NVM to recover the sub-data block to be written from the NVM, and recovering the to-be-written data block according to the write relationship.
本实施例的数据存储装置, 可以用于执行图 3所示方法实施例的技术 方案, 其实现原理和技术效果类似, 此处不再赘述。  The data storage device of this embodiment may be used to implement the technical solution of the method embodiment shown in FIG. 3, and the implementation principle and technical effects are similar, and details are not described herein again.
图 7为本发明实施例提供的一种 NVM的结构示意图, 如图 7所示, 本实施例的 NVM400包括:存储介质 41、NVM控制器 42和通信接口 43, 其中, 通信接口 42, 用于 NVM与计算机中的其他硬件通信, 具体可以用 于接收写请求; NVM控制器 42, 用于执行上述实施例提供的数据存储方 法, 其实现原理和技术效果类似, 此处不再赘述; 存储介质 42, 用于存储 数据。 NVM控制器具体可以为具有处理功能的芯片, 例如 CPU、 FPGA、 ASIC等。  FIG. 7 is a schematic structural diagram of an NVM according to an embodiment of the present invention. As shown in FIG. 7, the NVM 400 of the embodiment includes: a storage medium 41, an NVM controller 42 and a communication interface 43. The NVM communicates with other hardware in the computer, and is specifically configured to receive a write request. The NVM controller 42 is configured to perform the data storage method provided by the foregoing embodiment, and the implementation principle and technical effects are similar, and are not described herein again; 42, used to store data. The NVM controller may specifically be a chip having a processing function, such as a CPU, an FPGA, an ASIC, or the like.
本领域普通技术人员可以理解: 实现上述方法实施例的全部或部分歩骤 可以通过程序指令相关的硬件来完成, 前述的程序可以存储于一计算机可读 取存储介质中, 该程序在执行时, 执行包括上述方法实施例的歩骤; 而前述 的存储介质包括: ROM、 RAM, 磁碟或者光盘等各种可以存储程序代码的介 质。  A person skilled in the art can understand that all or part of the steps of implementing the above method embodiments may be implemented by hardware related to program instructions, and the foregoing program may be stored in a computer readable storage medium, when executed, The foregoing steps include the steps of the foregoing method embodiments; and the foregoing storage medium includes: a medium that can store program codes, such as a ROM, a RAM, a magnetic disk, or an optical disk.
最后应说明的是: 以上各实施例仅用以说明本发明的技术方案, 而非对 其限制; 尽管参照前述各实施例对本发明进行了详细的说明, 本领域的普通 技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改, 或者对其中部分或者全部技术特征进行等同替换; 而这些修改或者替换, 并 不使相应技术方案的本质脱离本发明各实施例技术方案的范围。  Finally, it should be noted that the above embodiments are only for explaining the technical solutions of the present invention, and are not intended to be limiting thereof; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art will understand that The technical solutions described in the foregoing embodiments may be modified, or some or all of the technical features may be equivalently replaced; and the modifications or substitutions do not deviate from the technical solutions of the embodiments of the present invention. range.

Claims

权 利 要 求 书 Claim
1、 一种数据存储方法, 所述方法应用于非易失性存储器 NVM中, 其 特征在于, 所述方法包括: A data storage method, the method being applied to a non-volatile memory NVM, wherein the method comprises:
接收写请求, 所述写请求中包含有待写入数据块以及地址;  Receiving a write request, where the write request includes a data block to be written and an address;
分别将所述待写入数据块以及缓存中与所述地址对应的写回数据块 平均划分为 N个子数据块, 其中, N为不小于 2的正整数;  And respectively, the data block to be written and the write back data block corresponding to the address in the cache are equally divided into N sub-blocks, where N is a positive integer not less than 2;
将所述每个待写入数据块的子数据块与所述每个写回数据块的子数 据块进行比较, 以获得所述待写入数据块的每个子数据块的写入能耗; 根据所述待写入数据块的每个子数据块的写入能耗确定所述待写入 数据块的最小写入能耗对应的写入关系, 其中, 所述写入关系包括所述待 写入数据块的子数据块与所述写回数据块的子数据块的对应关系;  Comparing each of the sub-blocks of the data block to be written with the sub-block of each of the write-back data blocks to obtain a write energy consumption of each sub-block of the data block to be written; Determining, according to a write energy consumption of each sub-block of the data block to be written, a write relationship corresponding to a minimum write energy consumption of the data block to be written, where the write relationship includes the to-be-written Corresponding relationship between the sub-block of the data block and the sub-block of the write-back block;
根据所述地址以及所述写入关系将所述待写入数据块的子数据块写 入所述 NVM。  The sub-block of the data block to be written is written to the NVM according to the address and the write relationship.
2、 根据权利要求 1 所述的方法, 其特征在于, 所述将所述每个待写 入数据块的子数据块与所述每个写回数据块的子数据块进行比较, 以获得 所述待写入数据块的每个子数据块的写入能耗, 包括:  2. The method according to claim 1, wherein the comparing the sub-blocks of each of the data blocks to be written with the sub-blocks of each of the write-back data blocks to obtain a The write energy consumption of each sub-block of the write data block, including:
分别将所述每个待写入数据块的子数据块与所述每个写回数据块的 子数据块进行比较, 以获得每一次比较过程中所述待写入数据块的每个子 数据块的写 0次数和写 1次数, 其中, 所述每一次比较过程包括所述待写 入数据块的一个子数据块与所述写回数据块的一个子数据块比较的过程; 根据所述待写入数据块的每个子数据块在每一次比较过程中的写 0次 数、 写 1次数以及预设的单次写 0能耗和单次写 1能耗计算所述待写入数 据块的每个子数据块在每一次比较过程中的写入能耗。  Comparing each of the sub-blocks of the data block to be written with the sub-block of each of the write-back data blocks, respectively, to obtain each sub-block of the data block to be written in each comparison process Writing 0 times and writing 1 times, wherein each of the comparing processes includes a process of comparing one sub-block of the data block to be written with one sub-block of the write-back data block; Each sub-block of the write data block calculates the number of writes 0, the number of writes 1 and the preset single write 0 power consumption and the single write 1 power consumption in each comparison process to calculate each of the data blocks to be written The write energy consumption of each sub-block in each comparison process.
3、 根据权利要求 1或 2所述的方法, 其特征在于, 所述根据所述待 写入数据块的每个子数据块的写入能耗确定所述待写入数据块的最小写 入能耗对应的写入关系, 包括:  The method according to claim 1 or 2, wherein the determining the minimum write energy of the data block to be written according to the write energy consumption of each sub-block of the data block to be written The corresponding write relationship, including:
以所述待写入数据块的每个子数据块以及所述写回数据块的每个子 数据块为顶点构造二分图, 所述二分图的各边权值为所述各边对应的待写 入数据块的子数据块在一次比较过程中的写入能耗, 其中, 所述待写入数 据块的子数据块在一次比较过程中的写入能耗为所述待写入数据块的子 数据块写入所述写回数据块的一个子数据块的写入能耗; Constructing a bipartite graph with each sub-block of the data block to be written and each sub-block of the write-back data block as a vertex, and each edge weight of the bipartite graph is a corresponding to be written in the side The write power consumption of the sub-block of the data block in a comparison process, wherein the write data energy of the sub-block of the data block to be written in one comparison process is the sub-data block to be written Writing a write energy to a data block of the write back data block;
确定所述二分图的最佳匹配, 所述最佳匹配满足如下条件: 各边的权 值总和最小, 覆盖所述二分图的所有顶点, 任意两条边没有共同的顶点; 将所述最佳匹配作为所述最小写入能耗对应的写入方式。  Determining a best match of the bipartite graph, the best match satisfies the following condition: the sum of weights of each side is the smallest, covering all the vertices of the bipartite graph, and any two sides have no common vertices; The matching is the writing mode corresponding to the minimum write energy consumption.
4、 根据权利要求 1-3中任一项所述的方法, 其特征在于, 所述根据所 述地址以及所述写入关系将所述待写入数据块的子数据块写入所述 NVM, 包括:  The method according to any one of claims 1 to 3, wherein the sub-block of the data block to be written is written into the NVM according to the address and the write relationship. , including:
根据所述地址以及所述写回数据块的每个子数据块的大小计算所述 写回数据块的每个子数据块的地址;  Calculating an address of each of the sub-data blocks of the write-back data block according to the address and a size of each sub-block of the write-back data block;
根据所述写入关系和所述写回数据块的每个子数据块的地址将所述 待写入数据块的子数据块写入所述 NVM。  The sub-block of the block to be written is written to the NVM according to the write relationship and the address of each sub-block of the write-back data block.
5、 根据权利要求 1-4中任一项所述的方法, 其特征在于, 所述根据所 述地址以及所述写入关系将所述待写入数据块的子数据块写入所述 NVM 之后, 还包括:  The method according to any one of claims 1 to 4, wherein the sub-block of the data block to be written is written into the NVM according to the address and the write relationship. After that, it also includes:
将所述写入关系写入所述 NVM, 以便从所述 NVM读取所述待写入 数据块的子数据块时, 根据所述写入关系恢复所述待写入数据块。  Writing the write relationship to the NVM to recover the sub-data block to be written from the NVM, and recovering the to-be-written data block according to the write relationship.
6、 一种数据存储装置, 其特征在于, 包括:  6. A data storage device, comprising:
接收模块, 用于接收写请求, 所述写请求中包含有待写入数据块以及 地址;  a receiving module, configured to receive a write request, where the write request includes a data block to be written and an address;
划分模块, 用于分别将所述待写入数据块以及缓存中与所述地址对应 的写回数据块平均划分为 N个子数据块, 其中, N为不小于 2的正整数; 获取模块, 用于将所述每个待写入数据块的子数据块与所述每个写回 数据块的子数据块进行比较, 以获得所述待写入数据块的每个子数据块的 写入能耗;  a dividing module, configured to respectively divide the data block to be written and the write back data block corresponding to the address in the cache into N sub-blocks, where N is a positive integer not less than 2; Comparing the sub-blocks of each of the data blocks to be written with the sub-blocks of each of the write-back data blocks to obtain write energy consumption of each sub-block of the data block to be written ;
确定模块, 用于根据所述待写入数据块的每个子数据块的写入能耗确 定所述待写入数据块的最小写入能耗对应的写入关系, 其中, 所述写入关 系包括所述待写入数据块的子数据块与所述写回数据块的子数据块的对 应关系;  a determining module, configured to determine, according to a write energy consumption of each sub-block of the data block to be written, a write relationship corresponding to a minimum write energy consumption of the data block to be written, where the write relationship Corresponding relationship between the sub data block of the data block to be written and the sub data block of the write data block;
写入模块, 用于根据所述地址以及所述写入关系将所述待写入数据块 的子数据块写入非易失性存储器 NVM。 And a write module, configured to write the sub-block of the data block to be written into the non-volatile memory NVM according to the address and the write relationship.
7、 根据权利要求 6所述的装置, 其特征在于, 所述获取模块具体用 于: The device according to claim 6, wherein the obtaining module is specifically used for:
分别将所述每个待写入数据块的子数据块与所述每个写回数据块的 子数据块进行比较, 以获得每一次比较过程中所述待写入数据块的每个子 数据块的写 0次数和写 1次数, 其中, 所述每一次比较过程包括所述待写 入数据块的一个子数据块与所述写回数据块的一个子数据块比较的过程; 根据所述待写入数据块的每个子数据块在每一次比较过程中的写 0次 数、 写 1次数以及预设的单次写 0能耗和单次写 1能耗计算所述待写入数 据块的每个子数据块在每一次比较过程中的写入能耗。  Comparing each of the sub-blocks of the data block to be written with the sub-block of each of the write-back data blocks, respectively, to obtain each sub-block of the data block to be written in each comparison process Writing 0 times and writing 1 times, wherein each of the comparing processes includes a process of comparing one sub-block of the data block to be written with one sub-block of the write-back data block; Each sub-block of the write data block calculates the number of writes 0, the number of writes 1 and the preset single write 0 power consumption and the single write 1 power consumption in each comparison process to calculate each of the data blocks to be written The write energy consumption of each sub-block in each comparison process.
8、 根据权利要求 6或 7所述的装置, 其特征在于, 所述确定模块具 体用于:  The device according to claim 6 or 7, wherein the determining module is specifically configured to:
以所述待写入数据块的每个子数据块以及所述写回数据块的每个子 数据块为顶点构造二分图, 所述二分图的各边权值为所述各边对应的待写 入数据块的子数据块在一次比较过程中的写入能耗, 其中, 所述待写入数 据块的子数据块在一次比较过程中的写入能耗为所述待写入数据块的子 数据块写入所述写回数据块的一个子数据块的写入能耗;  Constructing a bipartite graph with each sub-block of the data block to be written and each sub-block of the write-back data block as a vertex, and each edge weight of the bipartite graph is a corresponding to be written in the side The write power consumption of the sub-block of the data block in a comparison process, wherein the write data energy of the sub-block of the data block to be written in one comparison process is the sub-data block to be written Writing a write energy to a data block of the write back data block;
确定所述二分图的最佳匹配, 所述最佳匹配满足如下条件: 各边的权 值总和最小, 覆盖所述二分图的所有顶点, 任意两条边没有共同的顶点; 将所述最佳匹配作为所述最小写入能耗对应的写入方式。  Determining a best match of the bipartite graph, the best match satisfies the following condition: the sum of weights of each side is the smallest, covering all the vertices of the bipartite graph, and any two sides have no common vertices; The matching is the writing mode corresponding to the minimum write energy consumption.
9、 根据权利要求 6-8中任一项所述的装置, 其特征在于, 所述写入模 块具体用于:  The apparatus according to any one of claims 6-8, wherein the write module is specifically configured to:
根据所述地址以及所述写回数据块的每个子数据块的大小计算所述 写回数据块的每个子数据块的地址;  Calculating an address of each of the sub-data blocks of the write-back data block according to the address and a size of each sub-block of the write-back data block;
根据所述写入关系和所述写回数据块的每个子数据块的地址将所述 待写入数据块的子数据块写入所述 NVM。  The sub-block of the block to be written is written to the NVM according to the write relationship and the address of each sub-block of the write-back data block.
10、 根据权利要求 6-9中任一项所述的装置, 其特征在于, 所述写入 模块还用于: 将所述写入关系写入所述 NVM, 以便从所述 NVM读取所 述待写入数据块的子数据块时, 根据所述写入关系恢复所述待写入数据块。  The device according to any one of claims 6 to 9, wherein the writing module is further configured to: write the write relationship to the NVM, to read from the NVM When the sub-block of the data block is written, the block to be written is restored according to the write relationship.
11、一种非易失性存储器 NVM, 其特征在于, 包括: 存储介质、 NVM 控制器和通信接口; 所述通信接口, 用于接收写请求; 11. A non-volatile memory NVM, comprising: a storage medium, an NVM controller, and a communication interface; The communication interface is configured to receive a write request;
所述 NVM控制器, 用于执行权利要求 1-5中任一项所述的方法; 所述存储介质, 用于存储数据。 The NVM controller is configured to perform the method of any one of claims 1-5; the storage medium is configured to store data.
PCT/CN2014/080842 2014-06-26 2014-06-26 Data storage method and device and non-volatile memory WO2015196416A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2014/080842 WO2015196416A1 (en) 2014-06-26 2014-06-26 Data storage method and device and non-volatile memory
CN201480003810.0A CN105408961B (en) 2014-06-26 2014-06-26 Date storage method, device and nonvolatile memory

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2014/080842 WO2015196416A1 (en) 2014-06-26 2014-06-26 Data storage method and device and non-volatile memory

Publications (1)

Publication Number Publication Date
WO2015196416A1 true WO2015196416A1 (en) 2015-12-30

Family

ID=54936480

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/080842 WO2015196416A1 (en) 2014-06-26 2014-06-26 Data storage method and device and non-volatile memory

Country Status (2)

Country Link
CN (1) CN105408961B (en)
WO (1) WO2015196416A1 (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101329906A (en) * 2008-07-24 2008-12-24 中国科学院上海微系统与信息技术研究所 Non-volatile sequent modular memory, data storage and reading method
US20100030979A1 (en) * 2008-08-04 2010-02-04 Phison Electronics Corp. Data management method, and storage apparatus and controller thereof
CN102592665A (en) * 2011-10-24 2012-07-18 北京时代全芯科技有限公司 High-speed data writing structure and writing method for phase change memory

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103559145B (en) * 2013-10-22 2016-08-17 华为技术有限公司 A kind of digital independent, wiring method and electronic equipment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101329906A (en) * 2008-07-24 2008-12-24 中国科学院上海微系统与信息技术研究所 Non-volatile sequent modular memory, data storage and reading method
US20100030979A1 (en) * 2008-08-04 2010-02-04 Phison Electronics Corp. Data management method, and storage apparatus and controller thereof
CN102592665A (en) * 2011-10-24 2012-07-18 北京时代全芯科技有限公司 High-speed data writing structure and writing method for phase change memory

Also Published As

Publication number Publication date
CN105408961B (en) 2018-10-19
CN105408961A (en) 2016-03-16

Similar Documents

Publication Publication Date Title
US9471448B2 (en) Performing an atomic write operation across multiple storage devices
US9552290B2 (en) Partial R-block recycling
TWI506430B (en) Method of recording mapping information method, and memory controller and memory storage apparatus using the same
JP6285709B2 (en) Program failure recovery of non-volatile memory by redundant array
US9483404B2 (en) Write admittance policy for a memory cache
KR101491943B1 (en) Transaction log recovery
US10127166B2 (en) Data storage controller with multiple pipelines
US9684591B2 (en) Storage system and storage apparatus
JP6134857B2 (en) Storage device, apparatus having storage device, and storage control method
TWI459399B (en) Power interrupt management
US9146691B2 (en) Method for managing commands in command queue, memory control circuit unit and memory storage apparatus
TWI569139B (en) Valid data merging method, memory controller and memory storage apparatus
TWI423026B (en) Data writing method, memory controller and memory storage apparatus
JP2014507717A (en) Calculation of higher level redundant information
US20150142860A1 (en) Method and System for Forward Reference Logging in a Persistent Datastore
JP2013506190A (en) Stripe-based memory operation
US11775389B2 (en) Deferred error-correction parity calculations
TW201913382A (en) Decoding method, memory storage device and memory control circuit unit
US9304907B2 (en) Data management method, memory control circuit unit and memory storage apparatus
US10884632B2 (en) Techniques for determining the extent of data loss as a result of a data storage system failure
TWI540428B (en) Data writing method, memory controller and memory storage apparatus
TWI658361B (en) Memory management method, memory control circuit unit and memory storage apparatus
TWI436209B (en) Memory management table proceesing method, memory controller and memory storage apparatus
TW201913353A (en) Data storing method, memory control circuit unit and memory storage device
WO2015196416A1 (en) Data storage method and device and non-volatile memory

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 201480003810.0

Country of ref document: CN

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

Ref document number: 14895923

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: 14895923

Country of ref document: EP

Kind code of ref document: A1