Information query method and system of solid state disk, electronic device and storage medium

文档序号:1888620 发布日期:2021-11-26 浏览:4次 中文

阅读说明:本技术 固态硬盘的信息查询方法、系统、电子设备及存储介质 (Information query method and system of solid state disk, electronic device and storage medium ) 是由 李敬超 于 2021-07-15 设计创作,主要内容包括:本申请公开了一种固态硬盘的信息查询方法,所述信息查询方法包括:若检测到所述固态硬盘上电,则并发查询固态硬盘中的每一闪存颗粒的目标区块中的目标Page;其中,所述目标Page为所述目标区块中最近一次写入所述关键信息的Page;按照所述关键信息的写入先后对所有所述目标Page进行排序;将写入顺序最晚的目标page中的关键信息设置为信息查询结果,以便利用所述信息查询结果控制所述固态硬盘恢复至上一次下电前的硬盘状态。本申请能够提高固态硬盘的信息查询效率,在固态硬盘上电后快速恢复硬盘状态。本申请还公开了一种固态硬盘的信息查询系统、一种存储介质及一种电子设备,具有以上有益效果。(The application discloses an information query method of a solid state disk, which comprises the following steps: if the solid state disk is detected to be powered on, concurrently inquiring a target Page in a target block of each flash memory particle in the solid state disk; the target Page is a Page in which the key information is written in the target block for the last time; sequencing all the target pages according to the writing sequence of the key information; and setting the key information written into the target page with the latest writing sequence as an information query result so as to control the solid state disk to recover to the state of the hard disk before the last power-off by using the information query result. The method and the device can improve the information query efficiency of the solid state disk, and quickly recover the state of the solid state disk after the solid state disk is electrified. The application also discloses an information query system of the solid state disk, a storage medium and an electronic device, which have the beneficial effects.)

1. The information query method of the solid state disk is characterized in that the key information updated each time by the solid state disk is sequentially stored in a Page of a target block of each flash memory particle, wherein the key information is information used for restoring the state of the solid state disk before the last power-off when the solid state disk is powered on, and the information query method comprises the following steps:

if the solid state disk is detected to be powered on, concurrently inquiring a target Page in a target block of each flash memory particle in the solid state disk; the target Page is a Page in which the key information is written in the target block for the last time;

sequencing all the target pages according to the writing sequence of the key information;

and setting the key information written into the target page with the latest writing sequence as an information query result so as to control the solid state disk to recover to the state of the hard disk before the last power-off by using the information query result.

2. The information query method of the solid state disk of claim 1, further comprising:

traversing all the Target blocks by switching Channel serial numbers, Target serial numbers and logical unit serial numbers of the flash memory particles; the flash memory grain comprises a plurality of blocks, and the target block is a block with the most front address in the flash memory grain;

sequentially numbering all the target blocks according to the traversal sequence;

and sequentially storing the key information updated each time by the solid state disk into the Page of the corresponding target block according to the number of the target block.

3. The information query method of claim 1, wherein querying a target Page in a target block of each flash granule in the solid state disk comprises:

selecting a target block to be analyzed from the flash memory particles in the solid state disk;

judging whether the last Page of the target block to be analyzed is empty or not;

and if the last Page of the target block to be analyzed is not empty, setting the last Page of the target block to be analyzed as the target Page.

4. The information query method of claim 3, after determining whether a last Page of the target block to be analyzed is empty, the method further comprising:

if the last Page of the target block to be analyzed is empty, judging whether the first Page of the target block to be analyzed is empty;

if the first Page of the target block to be analyzed is empty, judging that the target block to be analyzed does not comprise the target Page;

and if the first Page of the target block to be analyzed is not empty, retrieving the target Page in the target block to be analyzed through a dichotomy.

5. The information query method of claim 4, wherein retrieving the target Page in the target block to be analyzed by a dichotomy comprises:

determining a starting point Page and an end point Page;

determining a midpoint Page according to the starting Page and the end Page;

judging whether the middle point Page is empty or not;

if the middle point Page is empty, setting the middle point Page as a new end point Page, and performing the step of determining a starting Page and an end point Page;

if the middle point Page is not empty, setting the middle point Page as a new starting point Page, and entering the step of determining the starting point Page and the end point Page;

and if the Page number of the updated starting-point Page is equal to the Page number of the updated ending-point Page, taking the updated starting-point Page or the updated ending-point Page as the target Page in the target block to be analyzed.

6. The information query method of the solid state disk according to claim 5, wherein determining a midpoint Page according to the start Page and the end Page comprises:

setting the average value of the sum of the Page number of the starting Page and the Page number of the terminal Page as a middle value;

judging whether the intermediate value is an integer or not;

if so, setting the Page of the Page number corresponding to the intermediate value as the midpoint Page;

and if not, setting the Page number corresponding to the integer adjacent to the intermediate value as the middle point Page.

7. The information query method of the solid state disk of claim 3, further comprising:

and if the Page reading operation of the target block to be analyzed fails, marking the target block to be analyzed as a bad block, and terminating the retrieval operation of the target Page in the target block to be analyzed.

8. The information query system of the solid state disk is characterized in that the key information updated each time by the solid state disk is sequentially stored in a Page of a target block of each flash memory particle, the key information is information used for restoring the state of the solid state disk before the last power-off when the solid state disk is powered on, and the information query system comprises:

the query module is used for concurrently querying a target Page in a target block of each flash memory particle in the solid state disk if the solid state disk is detected to be powered on; the target Page is a Page in which the key information is written in the target block for the last time;

the sorting module is used for sorting all the target pages according to the writing sequence of the key information;

and the result output module is used for setting the key information written into the target page with the latest writing sequence as an information query result so as to control the solid state disk to recover to the hard disk state before the last power-off by using the information query result.

9. An electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the information query method of the solid state disk according to any one of claims 1 to 7 when calling the computer program in the memory.

10. A storage medium, wherein computer-executable instructions are stored in the storage medium, and when being loaded and executed by a processor, the computer-executable instructions implement the steps of the information query method of the solid state disk according to any one of claims 1 to 7.

Technical Field

The present disclosure relates to the field of data storage technologies, and in particular, to an information query method and system for a solid state disk, an electronic device, and a storage medium.

Background

With the advent of the big data era, the solid state disk with the advantages of fast read/write speed, high bandwidth and the like gradually becomes the dominant force of the storage medium and is widely applied. In the firmware implementation process of the Solid State disk, a fixed space needs to be divided on the Nandflash (flash memory particles) for storing key information such as system configuration information and State information, and the key information can be updated in real time in the operation process of the SSD (Solid State Drives). When the SSD is powered off, the SSD is stored in the Nandflash area where the key information is stored, after the SSD is powered on next time, the firmware reads the latest key information and restores the state before the SSD is powered off last time.

The method comprises the steps that key information is continuously updated in the running process of SSD firmware, the Nandflash is characterized in that the same area is not allowed to be overwritten and only erased and written, in order to guarantee the safety and traceability of data, each key information is numbered, the number is increased by 1 after each time of data updating, and the number of the latest key information is the largest. When the SSD is powered on, the key information with the largest number needs to be found, that is, the latest key information. In the related art, the latest key information is determined by comparing the numbers of the key information stored in each Page of each block one by one, which is inefficient.

Therefore, how to improve the information query efficiency of the solid state disk, and rapidly recovering the state of the solid state disk after the solid state disk is powered on is a technical problem that needs to be solved by those skilled in the art at present.

Disclosure of Invention

The application aims to provide an information query method and system of a solid state disk, an electronic device and a storage medium, which can improve the information query efficiency of the solid state disk and quickly recover the state of the solid state disk after the solid state disk is powered on.

In order to solve the technical problem, the present application provides an information query method for a solid state disk, where key information updated each time by the solid state disk is sequentially stored in a Page of a target block of each flash memory particle, the key information is information used for restoring a hard disk state before last power-off when the solid state disk is powered on, and the information query method includes:

if the solid state disk is detected to be powered on, concurrently inquiring a target Page in a target block of each flash memory particle in the solid state disk; the target Page is a Page in which the key information is written in the target block for the last time;

sequencing all the target pages according to the writing sequence of the key information;

and setting the key information written into the target page with the latest writing sequence as an information query result so as to control the solid state disk to recover to the state of the hard disk before the last power-off by using the information query result.

Optionally, the method further includes:

traversing all the Target blocks by switching the Channel serial number, the Target serial number and the Lun serial number of the flash memory granules; the flash memory grain comprises a plurality of blocks, and the target block is a block with the most front address in the flash memory grain;

sequentially numbering all the target blocks according to the traversal sequence;

and sequentially storing the key information updated each time by the solid state disk into the Page of the corresponding target block according to the number of the target block.

Optionally, querying a target Page in a target block of each flash granule in the solid state disk includes:

selecting a target block to be analyzed from the flash memory particles in the solid state disk;

judging whether the last Page of the target block to be analyzed is empty or not;

and if the last Page of the target block to be analyzed is not empty, setting the last Page of the target block to be analyzed as the target Page.

Optionally, after determining whether the last Page of the target block to be analyzed is empty, the method further includes:

if the last Page of the target block to be analyzed is empty, judging whether the first Page of the target block to be analyzed is empty;

if the first Page of the target block to be analyzed is empty, judging that the target block to be analyzed does not comprise the target Page;

and if the first Page of the target block to be analyzed is not empty, retrieving the target Page in the target block to be analyzed through a dichotomy.

Optionally, retrieving the target Page in the target block to be analyzed by a bisection method includes:

determining a starting point Page and an end point Page;

determining a midpoint Page according to the starting Page and the end Page;

judging whether the middle point Page is empty or not;

if the middle point Page is empty, setting the middle point Page as a new end point Page, and performing the step of determining a starting Page and an end point Page;

if the middle point Page is not empty, setting the middle point Page as a new starting point Page, and entering the step of determining the starting point Page and the end point Page;

and if the Page number of the updated starting-point Page is equal to the Page number of the updated ending-point Page, taking the updated starting-point Page or the updated ending-point Page as the target Page in the target block to be analyzed.

Optionally, determining a midpoint Page according to the start Page and the end Page includes:

setting the average value of the sum of the Page number of the starting Page and the Page number of the terminal Page as a middle value;

judging whether the intermediate value is an integer or not;

if so, setting the Page of the Page number corresponding to the intermediate value as the midpoint Page;

and if not, setting the Page number corresponding to the integer adjacent to the intermediate value as the middle point Page.

Optionally, the method further includes:

and if the Page reading operation of the target block to be analyzed fails, marking the target block to be analyzed as a bad block, and terminating the retrieval operation of the target Page in the target block to be analyzed.

The application also provides an information query system of solid state disk, the key information that solid state disk updated at every turn is saved in the Page of the target block of each flash memory granule in proper order, the key information is the information that is used for recovering the hard disk state before last power down when solid state disk is powered on, the information query system includes:

the query module is used for concurrently querying a target Page in a target block of each flash memory particle in the solid state disk if the solid state disk is detected to be powered on; the target Page is a Page in which the key information is written in the target block for the last time;

the sorting module is used for sorting all the target pages according to the writing sequence of the key information;

and the result output module is used for setting the key information written into the target page with the latest writing sequence as an information query result so as to control the solid state disk to recover to the hard disk state before the last power-off by using the information query result.

The application also provides a storage medium, on which a computer program is stored, and the computer program realizes the steps executed by the information query method of the solid state disk when executed.

The application also provides electronic equipment which comprises a memory and a processor, wherein a computer program is stored in the memory, and the processor realizes the steps executed by the information query method of the solid state disk when calling the computer program in the memory.

The application provides an information query method of a solid state disk, wherein the key information updated by the solid state disk at each time is sequentially stored in a Page of a target block of each flash memory particle, the key information is information used for recovering the state of the solid state disk before the last power-off when the solid state disk is powered on, and the information query method comprises the following steps: if the solid state disk is detected to be powered on, concurrently inquiring a target Page in a target block of each flash memory particle in the solid state disk; the target Page is a Page in which the key information is written in the target block for the last time; sequencing all the target pages according to the writing sequence of the key information; and setting the key information written into the target page with the latest writing sequence as an information query result so as to control the solid state disk to recover to the state of the hard disk before the last power-off by using the information query result.

According to the method and the device, after the solid state disk is powered on, the target Page in the target block of each flash memory particle is inquired in a concurrent mode. Since the key information updated by the solid state disk each time is stored in the Page of the target block of the flash memory granule, the latest key information in the target block is stored in the target Page in which the key information is written last time. According to the method and the device, all the target pages are sequenced according to the writing sequence of the key information, the key information in the target Page with the latest writing sequence is used as an information query result, and the state of the solid state disk is recovered by using the information query result. In the process of retrieving the key information, the latest key information in each target block is simultaneously inquired, and the latest key information in each target block is judged, so that the retrieval efficiency of the key information is improved, and the hard disk state can be quickly recovered after the solid state hard disk is electrified. The application also provides an information query system of the solid state disk, a storage medium and an electronic device, which have the beneficial effects and are not repeated herein.

Drawings

In order to more clearly illustrate the embodiments of the present application, the drawings needed for the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings can be obtained by those skilled in the art without inventive effort.

Fig. 1 is a flowchart of an information query method for a solid state disk according to an embodiment of the present application;

FIG. 2 is a flowchart of a method for retrieving a target page according to an embodiment of the present disclosure;

fig. 3 is a schematic structural diagram of an information query system of a solid state disk according to an embodiment of the present application.

Detailed Description

In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.

Referring to fig. 1, fig. 1 is a flowchart of an information query method for a solid state disk according to an embodiment of the present application.

The specific steps may include:

s101: if the solid state disk is detected to be powered on, concurrently inquiring a target Page in a target block of each flash memory particle in the solid state disk;

the embodiment can be applied to electronic equipment provided with the solid state disk, and in the working process of the solid state disk, the key information updated each time by the solid state disk can be sequentially stored in the Page of the target block of each flash memory particle. The key information is information used for recovering the state of the solid state disk before the solid state disk is powered on last time, and may include system configuration information and state information, for example.

The solid state disk may include a plurality of Nandflash, each flash memory particle may include a plurality of blocks, each Block may include a plurality of pages, and when storing the key information into a Page of a target Block, the pages may be stored in order from small to large in Page number of the pages, for example, the key information updated for the first time may be stored into a Page with a Page number of 0, the key information updated for the second time may be stored into a Page with a Page number of 1, the key information updated for the third time may be stored into a Page with a Page number of 2, … …, and so on. When all pages of a certain Block store key information, new key information can be stored in pages of other blocks.

Before the step, the solid state disk can be powered off, the key information generated before the solid state disk is powered off is stored in the solid state disk, and when the solid state disk is powered on again, the state of the solid state disk can be recovered by reading the key information. Since the solid state disk stores the key information updated many times, in order to restore the solid state disk to the state before powering down, the embodiment may retrieve the key information stored last time from the solid state disk, and further restore the state of the solid state disk.

In this embodiment, after it is detected that the solid state disk is powered on, a target Page in a target block of each flash memory granule in the solid state disk is queried in a concurrent manner, where the target Page is a Page in which the key information is written last time in the target block. Specifically, after the solid state disk is detected to be powered on, target blocks of all flash memory particles can be determined, key information retrieval is respectively performed on each target block in a concurrent mode, and a target Page in each target block is determined.

S102: sequencing all the target pages according to the writing sequence of the key information;

the latest key information in the target blocks can be determined according to the target pages, but since the key information of the solid state disk is stored in the target blocks of the plurality of flash memory particles, all the target pages can be sequenced according to the writing sequence of the key information, so that the latest key information in all the target blocks can be determined.

As a possible implementation manner, the key information updated by the solid state disk each time has a corresponding information number, and the larger the information number is, the later the writing order of the key information is (i.e. the later the order is).

S103: and setting the key information written into the target page with the latest writing sequence as an information query result so as to control the solid state disk to recover to the state of the hard disk before the last power-off by using the information query result.

After all the target pages are sequenced according to the writing sequence of the key information, the key information in the target Page with the latest writing sequence can be set as an information query result, and the solid state disk is controlled to be restored to the state of the hard disk before the last power-off by using the information query result. It is understood that the "hard disk state before last power-off" herein specifically refers to a state of the solid state disk corresponding to the time closest to the power-off time.

In this embodiment, after the solid state disk is powered on, the target Page in the target block of each flash memory granule is queried in a concurrent manner. Since the key information updated by the solid state disk each time is stored in the Page of the target block of the flash memory granule, the latest key information in the target block is stored in the target Page in which the key information is written last time. In this embodiment, all the target pages are sorted according to the writing sequence of the key information, the key information in the target Page with the latest writing sequence is used as the information query result, and the state of the solid state disk is restored by using the information query result. In the process of retrieving the key information, the latest key information in each target block is simultaneously inquired, and the latest key information in each target block is judged, so that the retrieval efficiency of the key information is improved, and the hard disk state can be quickly recovered after the solid state hard disk is electrified.

As a possible implementation, the embodiment corresponding to fig. 1 may further store the key information by: traversing all the Target blocks by switching the Channel serial number, the Target serial number and the Lun serial number of the flash memory granules; the flash memory grain comprises a plurality of blocks, and the target block is a block with the most front address in the flash memory grain; sequentially numbering all the target blocks according to the traversal sequence; and sequentially storing the key information updated each time by the solid state disk into the Page of the corresponding target block according to the number of the target block. The concurrency of Nandflash operation can be increased by traversing the Target block according to the sequence of Channel, Target and Lun, so that the Nandflash is more uniformly worn.

Specifically, in this embodiment, the first Block0 of all flash memory granules on the solid state disk card may be selected as the storage area of the key information (i.e., the target Block above). Numbering all Block0, following the switching of Channel, switching Target, and finally switching logic Unit number Lun (logical Unit number) to traverse all Block and number, and using in sequence according to the Block number when in use.

For example: channel0_ Target0_ Lun0_ Block0 can be numbered as the first Block, Channel1_ Target0_ Lun0_ Block0 can be numbered as the second Block, and so on. And each piece of key information is stored by using one Page in the blocks, the address of the next storage is Page _ Number +1, and when one Block is full, the Block with the next Number (the Number is added with 1) is switched. When the last Block is full, the first Block is used for saving, and the process is circulated. When the current Block is written, the next Block to be used can be pre-erased, so that an available space for storing data is ensured when the SSD is abnormally powered off.

Referring to fig. 2, fig. 2 is a flowchart of a method for retrieving a target page according to an embodiment of the present application, where the embodiment is further described with reference to S101 in the embodiment corresponding to fig. 1, and a further implementation manner can be obtained by combining the embodiment with the embodiment corresponding to fig. 1, where the embodiment may include the following steps:

s201: selecting a target block to be analyzed from the flash memory particles in the solid state disk;

s202: judging whether the last Page of the target block to be analyzed is empty or not; if not, the step S203 is entered; if yes, entering S204;

s203: and if the last Page of the target block to be analyzed is not empty, setting the last Page of the target block to be analyzed as the target Page.

S204: if the last Page of the target block to be analyzed is empty, judging whether the first Page of the target block to be analyzed is empty; if yes, go to S205; if not, the process goes to S206;

s205: if the first Page of the target block to be analyzed is empty, judging that the target block to be analyzed does not comprise the target Page;

s206: and if the first Page of the target block to be analyzed is not empty, retrieving the target Page in the target block to be analyzed through a dichotomy.

In this embodiment, a plurality of threads may be invoked, and the plurality of threads are utilized to concurrently execute the operations of S201 to S206 in this embodiment, so as to concurrently query the target Page in the target block of each flash granule in the solid state disk. Each thread has its corresponding target block to be analyzed so as to determine a target Page in the target block to be analyzed.

When the key information is stored in the target block, the updated key information is stored in an increasing order of Page numbers, so that if the last Page of the target block to be analyzed (i.e., the Page with the largest Page number) is not empty, it means that the key information is stored in the last Page, all pages of the target block store the key information, and the key information stored in the last Page is the latest updated (i.e., latest) key information in the same target block, the last Page of the target block to be analyzed can be directly set as the target Page.

If the last Page (i.e., the Page with the largest Page number) of the target block to be analyzed is empty, it indicates that the key information may not be stored in the target block to be analyzed, and at this time, it is determined whether the first Page (i.e., the Page with the smallest Page number) of the target block to be analyzed is empty. If the first Page of the target block to be analyzed is empty, it indicates that the key information is not stored in the target block to be analyzed, and the process is directly ended without continuously retrieving the target block to be analyzed. If the first Page of the target block to be analyzed is not empty, it indicates that the key information is stored in the target block to be analyzed, and at this time, the target Page in the target block to be analyzed may be continuously retrieved by using the bisection method.

As a possible implementation manner, the present embodiment may perform a binary search to obtain the target Page in the following manner:

step 1: determining a starting point Page and an end point Page;

when the step is executed for the first time, the starting Page is the first Page of the target block, and the ending Page is the last Page of the target block, and in the process of performing the binary search, the starting Page or the ending Page may be updated to the middle Page.

Step 2: determining a midpoint Page according to the starting Page and the end Page;

the midpoint Page refers to a Page located at the middle position between the start Page and the end Page, and in this embodiment, the midpoint Page may be determined in the following manner: setting the average value of the sum of the Page number of the starting Page and the Page number of the terminal Page as a middle value; judging whether the intermediate value is an integer or not; if so, setting the Page of the Page number corresponding to the intermediate value as the midpoint Page; and if not, setting the Page number corresponding to the integer adjacent to the intermediate value as the middle point Page. For example, if the Page number of the start-point Page is 3 and the Page number of the end-point Page is 8, and the median value in this case is 5.5, the pages with the Page numbers of 5 and 6 may be collectively referred to as the median Page, only the Page with the Page number of 5 may be referred to as the median Page, and only the Page with the Page number of 6 may be referred to as the median Page.

And step 3: judging whether the middle point Page is empty or not;

and 4, step 4: if the middle point Page is empty, setting the middle point Page as a new end point Page, and performing the step of determining a starting Page and an end point Page;

if the midpoint Page is empty, it is indicated that the latest key information is between the start Page (inclusive) and the midpoint Page (exclusive), and the dichotomy search operation in steps 1 to 6 can be executed again with the midpoint Page as a new end Page.

And 5: if the middle point Page is not empty, setting the middle point Page as a new starting point Page, and entering the step of determining the starting point Page and the end point Page;

if the midpoint Page is not empty, it is indicated that the latest key information is between the midpoint Page (inclusive) and the end point Page (exclusive), and the dichotomy search operation in steps 1 to 6 can be executed again with the midpoint Page as a new start point Page.

Step 6: and if the Page number of the updated starting-point Page is equal to the Page number of the updated ending-point Page, taking the updated starting-point Page or the updated ending-point Page as the target Page in the target block to be analyzed.

Specifically, the Page numbers of the start-point Page and the end-point Page determined in step 1 are equal, which means that the Page numbers of the start-point Page and the end-point Page both point to the same Page, and thus the position of the target Page is determined.

As a further description of the foregoing embodiment, if it is detected that a Page read operation of a target block to be analyzed fails, the target block to be analyzed may be marked as a bad block, and a retrieval operation of a target Page in the target block to be analyzed may be terminated.

The flow described in the above embodiment is described below by an embodiment in practical application, and this embodiment provides an information fast retrieval scheme using a flash memory granule Nandflash as a storage medium. The embodiment adopts a concurrent mode, simultaneously searches all blocks in the storage area, and combines the dichotomy to shorten the search time. The specific implementation method of the embodiment is as follows:

the method comprises the following steps: read the last Page of each Block:

a) if the Page read operation is successfully executed and the data is not empty, indicating that the Block is full, recording the number of the key data and terminating the data retrieval of the Block, wherein the data recorded by the last Page is the latest key data on the Block;

b) if the Page reading operation fails, the Block is indicated to be a bad Block, the recorded data can be regarded as invalid, and the maximum number of the Block is recorded to be 0 at the moment, and the data retrieval of the Block is terminated;

c) and if the Page read operation is successfully executed and the data is empty, the second step cannot be executed according to the state of the block.

Step two: reading the first Page of each Block:

a) if the Page reading operation is successfully executed and the data is empty, indicating that the Block Block is not used, recording the maximum number of the Block as 0 at the moment, and terminating the data retrieval of the Block;

b) if the Page reading operation fails, the Block is a bad Block, the recorded data can be regarded as invalid, the maximum number of the Block is recorded to be 0, and the data retrieval of the Block is terminated;

c) and if the Page read operation is successfully executed and the data is not empty, indicating that the Block is used but not yet full, and executing the third step.

Step three: continuing searching by the dichotomy;

a) setting the read address to midPage (startPage + endPage)/2, when the link is entered for the first time, the startPage (namely the Page Number of the start Page) is 0, and the endPage (namely the Page Number of the end Page) is Max _ Page _ Number (namely the maximum Page Number of the Block);

b) reading the content of the midPage (namely the midpoint Page), and if the data is not empty, setting the startPage to be the current midPage value, and keeping the endPage unchanged; if the data is empty, setting the endPage to be the current midPage value, and keeping the startPage unchanged;

c) and repeatedly executing the steps a) and b) until the startPage value is equal to the endPage value, ending the retrieval process, wherein the acquired key information is the latest key information on the Block, and recording the number of the key information.

Step four: and after all Block searches are finished, comparing the serial numbers of the key information recorded during all searches, wherein the key information with the largest serial number is the latest key information in all data.

According to the embodiment, in order to shorten the power-on starting time of the solid state disk and improve the efficiency of retrieving the key information, the scheme uses a multi-concurrency mode and combines a dichotomy algorithm to scan data in the Nandflash area for storing the key information, and the latest key information is retrieved quickly. Compared with single-process dichotomy algorithm retrieval, the method improves retrieval efficiency and ensures the reliability of retrieved data.

Compared with single-process full dichotomy retrieval, the concurrent mode of the embodiment has the advantages of capability reduction time compared with single process, meanwhile, the range of the dichotomy after the concurrency is reduced, the algorithm complexity is reduced, and the retrieval time can be saved. Further, the robustness of the algorithm can be ensured by the concurrent manner in this embodiment, because the range of the dichotomy search after the concurrency is one Block, the state of the Block has no influence on the algorithm, but the physical state of each Block directly influences the reliability of the algorithm, for example: according to the Nandflash characteristic, when a certain Block is marked as a weak Block, the Block is skipped when data is saved, when the content of the Block is tried to be read, success is returned and the data is empty, and the phenomenon at the time is the same as the judgment condition of the endPage in the dichotomy algorithm, so that the retrieved data is inaccurate. Therefore, the retrieval mechanism combining multiple concurrent modes with the dichotomy can improve the accuracy of data retrieval.

The weak block is a chaotic block between a good block and a bad block, and unlike the bad block, the weak block returns success when performing an erasing operation, but cannot guarantee data correctness when reading data.

Referring to fig. 3, fig. 3 is a schematic structural diagram of an information query system of a solid state disk according to an embodiment of the present application; the key information updated by the solid state disk each time is sequentially stored in a Page of a target block of each flash memory particle, the key information is information used for restoring the state of the solid state disk before the last power-off when the solid state disk is powered on, and the information query system comprises:

the query module 301 is configured to concurrently query a target Page in a target block of each flash memory particle in the solid state disk if it is detected that the solid state disk is powered on; the target Page is a Page in which the key information is written in the target block for the last time;

a sorting module 302, configured to sort all the target pages according to the writing order of the key information;

and the result output module 303 is configured to set the key information in the target page with the latest writing order as an information query result, so as to control the solid state disk to recover to the hard disk state before the last power down by using the information query result.

In this embodiment, after the solid state disk is powered on, the target Page in the target block of each flash memory granule is queried in a concurrent manner. Since the key information updated by the solid state disk each time is stored in the Page of the target block of the flash memory granule, the latest key information in the target block is stored in the target Page in which the key information is written last time. In this embodiment, all the target pages are sorted according to the writing sequence of the key information, the key information in the target Page with the latest writing sequence is used as the information query result, and the state of the solid state disk is restored by using the information query result. In the process of retrieving the key information, the latest key information in each target block is simultaneously inquired, and the latest key information in each target block is judged, so that the retrieval efficiency of the key information is improved, and the hard disk state can be quickly recovered after the solid state hard disk is electrified.

Further, the method also comprises the following steps:

the block numbering module is used for traversing all the Target blocks by switching the Channel serial numbers, Target serial numbers and Lun serial numbers of the flash memory granules; the flash memory grain comprises a plurality of blocks, and the target block is a block with the most front address in the flash memory grain; the system is also used for numbering all the target blocks in sequence according to the traversal sequence;

and the information storage module is used for sequentially storing the key information updated each time by the solid state disk into the Page of the corresponding target block according to the number of the target block.

Further, the query module 301 includes:

the block selection unit is used for selecting a target block to be analyzed from the flash memory particles in the solid state disk;

the first judgment unit is used for judging whether the last Page of the target block to be analyzed is empty or not; and if the last Page of the target block to be analyzed is not empty, setting the last Page of the target block to be analyzed as the target Page.

A second determining unit, configured to determine whether a first Page of the target block to be analyzed is empty if the last Page of the target block to be analyzed is empty; if the first Page of the target block to be analyzed is empty, judging that the target block to be analyzed does not comprise the target Page; and if the first Page of the target block to be analyzed is not empty, retrieving the target Page in the target block to be analyzed through a dichotomy.

Further, the process of retrieving the target Page in the target block to be analyzed by the second determining unit through the bisection method includes: determining a starting point Page and an end point Page; determining a midpoint Page according to the starting Page and the end Page; judging whether the middle point Page is empty or not; if the middle point Page is empty, setting the middle point Page as a new end point Page, and performing the step of determining a starting Page and an end point Page; if the middle point Page is not empty, setting the middle point Page as a new starting point Page, and entering the step of determining the starting point Page and the end point Page; and if the Page number of the updated starting-point Page is equal to the Page number of the updated ending-point Page, taking the updated starting-point Page or the updated ending-point Page as the target Page in the target block to be analyzed.

Further, the process of determining the middle point Page according to the starting point Page and the end point Page by the second determining unit includes: setting the average value of the sum of the Page number of the starting Page and the Page number of the terminal Page as a middle value; judging whether the intermediate value is an integer or not; if so, setting the Page of the Page number corresponding to the intermediate value as the midpoint Page; and if not, setting the Page number corresponding to the integer adjacent to the intermediate value as the middle point Page.

Further, the method also comprises the following steps:

and the bad block processing module is used for marking the target block to be analyzed as a bad block and terminating the retrieval operation of the target Page in the target block to be analyzed if the Page reading operation of the target block to be analyzed fails.

Since the embodiment of the system part corresponds to the embodiment of the method part, the embodiment of the system part is described with reference to the embodiment of the method part, and is not repeated here.

The present application also provides a storage medium having a computer program stored thereon, which when executed, may implement the steps provided by the above-described embodiments. The storage medium may include: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.

The application further provides an electronic device, which may include a memory and a processor, where the memory stores a computer program, and the processor may implement the steps provided by the foregoing embodiments when calling the computer program in the memory. Of course, the electronic device may also include various network interfaces, power supplies, and the like.

The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. For the system disclosed by the embodiment, the description is relatively simple because the system corresponds to the method disclosed by the embodiment, and the relevant points can be referred to the method part for description. It should be noted that, for those skilled in the art, it is possible to make several improvements and modifications to the present application without departing from the principle of the present application, and such improvements and modifications also fall within the scope of the claims of the present application.

It is further noted that, in the present specification, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.

14页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种缓存分区的管理方法、系统、设备及存储介质

网友询问留言

已有0条留言

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

精彩留言,会给你点赞!

技术分类