Reading-writing and updating method of L2P table and L2P table

文档序号:1737214 发布日期:2019-12-20 浏览:25次 中文

阅读说明:本技术 一种l2p表的读写、更新方法及l2p表 (Reading-writing and updating method of L2P table and L2P table ) 是由 苗森 于 2019-08-23 设计创作,主要内容包括:本发明实施例公开了一种L2P表的读写、更新方法及L2P表,所述L2P表的PBA用Nbit标示,所述N的取值根据盘容量S计算,为非32bit对齐的方式。降低了L2P对内存的使用容量,从而降低SSD的成本。进行数据读写和L2P表更新时,只需要根据LBA的值,计算对应PBA是否跨32bit,在PBA跨32bit的情况下,直接获取2个32bit,采用异或方式进行相应读写和更新操作即可,便于L2P的保存和恢复。(The embodiment of the invention discloses a reading-writing and updating method of an L2P table and an L2P table, wherein a PBA of the L2P table is marked by Nbit, and a value of N is calculated according to the disk capacity S and is in a non-32-bit alignment mode. The use capacity of the L2P to the memory is reduced, and therefore the cost of the SSD is reduced. When data reading and writing and L2P table updating are carried out, whether the corresponding PBA spans 32 bits or not is calculated according to the value of the LBA, 2 32 bits are directly obtained under the condition that the PBA spans 32 bits, corresponding reading and writing and updating operations are carried out in an exclusive OR mode, and the L2P can be conveniently stored and restored.)

1. An L2P table includes an LBA and a PBA having a mapping relationship, where the PBA is denoted by Nbit, and a value of N is calculated according to a disk capacity S, specifically: s/4-2N

2. A method for reading the table of claim 1 from the L2P, the method comprising:

and calculating whether the PBA spans 32 bits according to the values of the LBA and the N, acquiring the PBA corresponding to the current LBA, and reading data.

3. The reading method of claim 2, wherein the specific process of calculating whether the PBA spans 32 bits and acquiring the PBA corresponding to the current LBA is as follows:

judgment ofAndwhether the integer parts of the operation results are equal or not, wherein M is the value of the LBA in the L2P table;

if yes, the PBA does not span 32 bits, and 1 PBA is obtained to obtain a corresponding PBA;

if not, the PBA spans 32 bits, and 2 PBAs are obtained to obtain the corresponding PBA.

4. A method for writing to the L2P table according to claim 1, the method comprising:

and calculating whether the PBA spans 32 bits according to the values of the LBA and the N, acquiring the PBA corresponding to the current LBA, and writing data in an exclusive OR mode.

5. The writing method of claim 4, wherein whether the PBA spans 32 bits is calculated, and the PBA corresponding to the current LBA is obtained, and the specific process of writing data in an exclusive OR manner is as follows:

judgment ofAndwhether the integer parts of the operation results are equal or not, wherein M is the value of the LBA in the L2P table;

if yes, the PBA does not span 32 bits, 1 32 bits are obtained, a corresponding PBA is obtained, and data is written in by adopting an exclusive OR mode of memory operation;

if not, the PBA spans 32 bits, 2 PBAs are obtained, the corresponding PBA is obtained, and data is written in by adopting an exclusive OR mode of memory operation.

6. A method for updating an L2P table, based on the L2P table of claim 1, the method comprising the steps of:

calculating PBA according to the updated LBA, and performing data read-write operation;

sending variable information to an upper electrical module and a lower electrical module in the form of LBA + (N bit pba);

and when the power is on, the upper and lower electric modules read the variable information, calculate the position of the DDR where the PBA is located, and write the position into the DDR in an exclusive OR mode of memory operation.

7. The method of claim 6, wherein the calculating the position of the PBA in the DDR, and writing the position of the PBA in the DDR by means of XOR of the memory operations comprises:

calculating the position of the DDR of the PBA according to the LBA, and judging whether the current PBA spans 32 bits;

if yes, reading 2 32 bits corresponding to the DDR position, and filling the PBA into a new L2P table entry;

if not, reading 1 32 bits corresponding to the DDR position, and filling the PBA into a new L2P table entry;

and clearing the bits which are not filled with the PBA in the read 32 bits, and writing the bits into the DDR in an exclusive OR mode by using the memory operation.

Technical Field

The invention relates to the technical field of computer storage, in particular to a reading-writing and updating method of an L2P table and an L2P table.

Background

A mapping table (L2P) of a Solid State Drive (SSD) is a mapping between an LBA (Logical Block Address) and a PBA (physical Block Address), during reading and writing, a host issues the LBA to the SSD, and the SSD queries an L2P table to find the PBA, thereby finding a corresponding flash location to perform reading and writing operations.

L2P corresponds to a one-dimensional array with LBA as the subscript, each element of the array is a PBA, and all PBAs can be addressed to any false space of the SSD.

PBA in the existing L2P is generally de-labeled with 32bit, so that it is convenient to access the 32-aligned L2P table during SSD operation, but the size of L2P table is generally 1/1000 of the actual capacity of the disc. This wastes DDR (Double Data Rate, Double Rate synchronous dynamic random Access memory) since several bits are idle in each 32 bit. The existing enterprise-level SSD is generally TB level, and the capacity requirement on DDR is large, so that the cost of DDR greatly influences the cost of SSD.

Disclosure of Invention

The embodiment of the invention provides a reading-writing and updating method of an L2P table and an L2P table, and aims to solve the problems that the L2P table occupies a larger DDR space and increases the SSD cost in the prior art.

In order to solve the technical problem, the embodiment of the invention discloses the following technical scheme:

the first aspect of the present invention provides an L2P table, including an LBA and a PBA having a mapping relationship, where the PBA is denoted by Nbit, and a value of N is calculated according to a disk capacity S, specifically: s/4-2N

The second aspect of the present invention provides a reading method based on the L2P table, where the method includes:

and calculating whether the PBA spans 32 bits according to the values of the LBA and the Nbit, acquiring the PBA corresponding to the current LBA, and reading data.

Further, the specific process of calculating whether the PBA spans 32 bits and acquiring the PBA corresponding to the current LBA is as follows:

judgment ofAndwhether the integer parts of the operation results are equal or not, wherein M is the value of the LBA in the L2P table;

if yes, the PBA does not span 32 bits, and 1 PBA is obtained to obtain a corresponding PBA;

if not, the PBA spans 32 bits, and 2 PBAs are obtained to obtain the corresponding PBA.

The third aspect of the present invention provides a writing method based on the L2P table, the method including:

and calculating whether the PBA spans 32 bits according to the values of the LBA and the Nbit, acquiring the PBA corresponding to the current LBA, and writing data in an exclusive OR mode.

Further, whether the PBA spans 32 bits is calculated, and the PBA corresponding to the current LBA is obtained, and the specific process of writing data in an exclusive OR mode is as follows:

judgment ofAndwhether the integer parts of the operation results are equal or not, wherein M is the value of the LBA in the L2P table;

if yes, the PBA does not span 32 bits, 1 32 bits are obtained, a corresponding PBA is obtained, and data is written in by adopting an exclusive OR mode of memory operation;

if not, the PBA spans 32 bits, 2 PBAs are obtained, the corresponding PBA is obtained, and data is written in by adopting an exclusive OR mode of memory operation.

The fourth aspect of the present invention provides a method for updating an L2P table, wherein based on the L2P table, the method includes the following steps:

calculating PBA according to the updated LBA, and performing data read-write operation;

sending the variable information to the power-on and power-off module in the form of LBA + (N bit PBA);

and when the power is on, the upper and lower electric modules read the variable information, calculate the position of the DDR where the PBA is located, and write the position into the DDR in an exclusive OR mode of memory operation.

Further, the specific process of calculating the position of the PBA in the DDR and writing the PBA in the DDR in an exclusive or manner of memory operation includes:

calculating the position of the DDR of the PBA according to the LBA, and judging whether the current PBA spans 32 bits;

if yes, reading 2 32 bits corresponding to the DDR position, and filling the PBA into a new L2P table entry;

if not, reading 1 32 bits corresponding to the DDR position, and filling the PBA into a new L2P table entry;

and clearing the bits which are not filled with the PBA in the read 32 bits, and writing the bits into the DDR in an exclusive OR mode by using the memory operation.

Drawings

In order to more clearly illustrate the embodiments or technical solutions in the prior art of the present invention, the drawings used in the description of the embodiments or prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained based on these drawings without creative efforts.

FIG. 1 is a schematic representation of the PBA designation of the L2P table of the present invention;

FIG. 2 is a flow chart illustrating data reading based on the L2P table of the present invention;

FIG. 3 is a flow chart illustrating data writing based on the L2P table of the present invention;

fig. 4 is a schematic diagram of the update flow of the L2P table according to the present invention.

Detailed Description

In order to clearly explain the technical features of the present invention, the following detailed description of the present invention is provided with reference to the accompanying drawings. The following disclosure provides many different embodiments, or examples, for implementing different features of the invention. To simplify the disclosure of the present invention, the components and arrangements of specific examples are described below. Furthermore, the present invention may repeat reference numerals and/or letters in the various examples. This repetition is for the purpose of simplicity and clarity and does not in itself dictate a relationship between the various embodiments and/or configurations discussed. It should be noted that the components illustrated in the figures are not necessarily drawn to scale. Descriptions of well-known components and processing techniques and procedures are omitted so as to not unnecessarily limit the invention.

As shown in fig. 1, PBAs in the L2P table of the present invention are identified by a non-32-bit alignment method, the number of marking bits required for a PBA is calculated according to the disk capacity, and the PBA is marked once, that is, some PBAs are identified by a 32-bit-crossing method.

The PBA identification bit number is calculated as follows:

S/4=2N

in the formula, S is the disk capacity, N is the number of labeled bits required by PBA, 4 represents the size of the data block, each data block is 4K, and the formula is a labeled capacity unit. Taking the disk capacity 2T as an example for calculation, the value of N is 29, that is, when the disk capacity is 2T, the PBA needs 29 bits to be marked.

As shown in fig. 2, the process of reading data using the L2P table is as follows: calculating whether the PBA spans 32 bits according to the values of the LBA and the N, wherein the calculating method comprises the following steps:

respectively calculateAndand taking an integer part of the calculation result, judging whether the two integer parts are equal, if so, regarding the PBA corresponding to the current LBA as 32bit striding, otherwise, regarding the PBA corresponding to the current LBA as 32bit striding. Where M is the value of LBA in the L2P table.

If the current PBA does not span 32 bits, acquiring 1 32 bits, finding out the corresponding PBA, and reading data; if the current PBA spans 32 bits, 2 PBAs are acquired, and the corresponding PBA is found and the data is read.

As shown in fig. 3, the process of writing data using the L2P table is as follows: calculating whether the PBA spans 32 bits according to the values of the LBA and the N, wherein the calculating method comprises the following steps:

respectively calculateAndand taking an integer part of the calculation result, judging whether the two integer parts are equal, if so, regarding the PBA corresponding to the current LBA as 32bit striding, otherwise, regarding the PBA corresponding to the current LBA as 32bit striding. Where M is the value of LBA in the L2P table.

If the current PBA does not span 32 bits, acquiring 1 32 bits, finding out the corresponding PBA, and writing data in an exclusive OR mode of memory operation; if the current PBA spans 32 bits, 2 PBAs are acquired, the corresponding PBA is found, and data is written in by adopting an exclusive OR mode of memory operation. For example, for 2 32 bits, first find N1bit in the first 32bit, then find (N-N1) bit in the second 32bit, and use XOR operation in both 32 bits, i.e. do not change other bits except N1bit and (N-N1) bit.

As shown in fig. 4, when the L2P table is updated during the storage operation, the updating method includes:

calculating PBA according to the updated LBA, and performing data read-write operation; the read/write operation is the same as the operations shown in fig. 2 and fig. 3, except that the value of the LBA is changed, and details are not described here.

Sending the variable information to the power-on and power-off module in the form of LBA + (N bit PBA); the variable information, namely the updated value of the LBA, is sent in the form of "LBA + (N bit PBA)" in order for the power-up and power-down modules to recognize that the L2P is updated and to store the updated LBA.

When the power is on, the upper and lower electric modules read the variable information, calculate the position of the DDR where the PBA is located, and write the DDR in an exclusive OR mode of memory operation. Calculating the position of the DDR of the PBA according to the LBA, and judging whether the current PBA spans 32 bits; if yes, reading 2 32 bits corresponding to the DDR position, and filling the PBA into a new L2P table entry; if not, reading 1 32 bits corresponding to the DDR position, and filling the PBA into a new L2P table entry; and clearing the bits which are not filled with the PBA in the read 32 bits, and writing the bits into the DDR in an exclusive OR mode by using the memory operation. If the table entry (PBA) of the L2P table is 29 bits, the first PBA is within 32 bits; the second PBA spans 32 bits, the second PBA occupies 3 bits of the first 32 bits, and the second PBA occupies 26 bits of the first 32 bits; the third PBA also spans 32 bits, occupies 6 bits of the second 32 bits, occupies 23 bits of the third 32 bits, and so on to obtain the positions of all PBAs in the DDR, and after all PBAs are filled, the bits which are not filled into the PBA in the DDR are cleared, so that the DDR space is saved. In the process of writing the PBA, the DDR is still written in a memory operation exclusive OR mode.

The foregoing is only a preferred embodiment of the present invention, and it will be apparent to those skilled in the art that various modifications and improvements can be made without departing from the principle of the invention, and such modifications and improvements are also considered to be within the scope of the invention.

8页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:用于具有持久系统存储器的计算机系统的改进存储模型

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类