Solid state disk key information storage method

By adopting the pre-erase mechanism and cumulative update method in the solid-state drive, the problem of SSD repeatedly erasing physical blocks when updating key information is solved, which significantly reduces the number of erases of flash media and extends its service life.

CN119847438AActive Publication Date: 2025-04-18SHANDONG SINOCHIP SEMICON CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411932041.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-26
Publication Date
2025-04-18
Estimated Expiration
2044-12-26

AI Technical Summary

Technical Problem

In the prior art, solid state hard disks (SSDs) need to repeatedly erase physical blocks when updating and saving critical information, resulting in an increase in the number of erasings of flash memory media and damages its service life.

Method used

The pre-erase mechanism, cumulative update method and cycle usage method are adopted to reduce the number of erasing times by selecting continuous physical blocks as key information storage areas and using the characteristic that all data not written after erasing of flash media is 1.

Benefits of technology

It significantly reduces the number of erasing times of flash memory media, extends its service life, and speeds up the scanning process of key information on power-on.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119847438A_ABST
    Figure CN119847438A_ABST
Patent Text Reader

Abstract

The invention relates to a solid state disk key information storage method, which comprises the following steps of: dividing a storage area, judging an area in which key information is located by utilizing the characteristic that all unwritten data after erasing is 1, marking a pre-erased area in the judgment process, finally executing an erasing operation according to the mark of the pre-erased area, and executing a writing operation at an erased position. According to the method and the device, the erasing times can be obviously reduced, and the service life of the memory is prolonged.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of hardware storage technology, and in particular to a method for storing key information of a solid-state hard disk. Background Art

[0002] The growth of data volume has increased the storage demand, and the requirements for the performance, capacity, functionality and stability of solid state drives (SSDs) have also increased. Technicians refer to data that maintains SSD performance, guarantees SSD capacity, and maintains SSD functionality and stability as key information. Key information enables SSDs to meet various user needs. Key information is not stored in a fixed independent space, and needs to be updated and saved in a timely manner.

[0003] In the prior art, SSDs generally need to erase the entire physical block before performing a data write operation. The next time a data is written, the physical block is erased again and data is written again. Such a cycle will significantly increase the number of erase and write times of the flash memory medium and will damage the service life of the flash memory medium. Summary of the invention

[0004] The present application provides a method for storing key information of a solid state hard disk, which solves the problem of shortening the service life due to repeated erasing of physical blocks during the process of updating and saving key information.

[0005] The technical solution of this application is as follows: A method for storing key information of a solid state hard disk comprises the following steps: S1) selecting a continuous physical block in the SSD as a storage area for key information, and dividing the storage area into two parts, with the first half of the storage area being area 0 and the second half of the storage area being area 1; S2) reading the data structure of the key information at the header of area 0 and area 1 respectively, and defining the first field of the read data structure as a 32-bit magic number; S3) determining whether the first 32 bits of the data structure read from area 0 and area 1 are all 1; S31) If yes, read the last 32 bits of data at the end of area 0 to determine whether the last 32 bits of data are all 1; S311) If yes, then area 0 is not erased, and the starting address of area 0 is returned as the starting position of the next write operation; S312) If not, the mark area 0 is a pre-erased area; S32) If not, determine whether the first 32 bits of the data structure read in S3) are magic numbers; S321) If yes, then determine whether the last 32 bits of data at the end of area 0 are all 1: S3211) If yes, then area 0 is the area where the key information is located; S3212) If not, then area 1 is the area where the key information is located; S322) If only one area is 1, the area to which the magic number belongs is used as the area where the key information is located, and then determine whether the first 32 bits of the read data structure of the other area are all 1; S3221) If yes, then read the data structure at the end of this area and determine whether it is all 1; if yes, then mark this area as a non-erasable area; if no, then mark this area as a pre-erasable area; S3222) If not, marking the other area as a pre-erased area; S323) If none of them is found, it is deemed that the key information is not found and the starting address of area 0 is used as the starting position of the next write operation, and area 0 is marked as a pre-erased area; S4) in the area where the key information identified in step S3) is located: all data structures of the key information are read in sequence until a data structure whose initial 32 bits are all 1 is read, and the data structure is recorded as a data structure to be written as the starting position of the next write operation; if the structure to be written is not read after reading the current area, the current area is marked as a pre-erased area, and the starting address of another area is used as the starting position of the next write operation; S5) for the marked pre-erased area, determine whether the first 32 bits of data and the last 32 bits of data of its data structure are all 1; if so, delete the pre-erased area mark; if not, retain the pre-erased area mark; For the next write operation, the next write operation is performed at the starting position of the next write operation in step S311) or step S4).

[0006] Furthermore, the method for writing key information includes the following steps: SA1) The write program writes the key information to the cache area of ​​the memory, increases the pending write count, and generates an integrity check code and updates it to the 32-bit data area at the end of the key information; SA2) The writing program continuously checks and updates the pending write count. When the pending write count is greater than 0, the writing operation is performed to the memory. After the writing is successful, the pending write count is reduced by 1. SA3) When the write program detects that the write margin is insufficient, an erase operation is performed on the pre-erased area of ​​another area of ​​the area being written.

[0007] Further, in step SA1), the upper limit of the increase of the count to be written is 2.

[0008] Furthermore, a delay time is set, and when executing a write operation or an erase action, if it is detected that the memory is abnormally powered off, the write operation or the erase action is not initiated on the flash memory during the delay time.

[0009] Due to the adoption of the above technical solution, the beneficial effects of this application are as follows: 1. This application adopts a pre-erase mechanism, a cumulative update method, and a cyclic use method, which can significantly reduce the number of times the flash memory medium is erased and written, and increase the service life of the flash memory medium. The pre-erase mechanism will erase the location where data needs to be written in advance to ensure that key data information can be written in time. The storage of key information requires a time period, and key information changes during the storage process. This application implements the use of the last key information to be updated to be stored in the flash memory medium in the next update cycle. Key information generally has a small amount of data. This application reduces the number of times the flash memory medium is erased and written by cyclically using the minimum erase unit of the flash memory medium. .

[0010] 2. This application makes full use of the characteristic that all data is 1 when no data is written after the flash memory medium is erased, and uses this characteristic to significantly speed up the scanning process of key information on power-on. For the area that needs to be erased, this application performs redundant all-1 detection in the head and tail areas, further reducing the number of pre-erasure times of the flash memory medium. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] The drawings described herein are used to provide further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute improper limitations on the present application.

[0012] Figure 1 A flow chart of a method for storing key information of a solid state drive provided in this application. DETAILED DESCRIPTION

[0013] Based on the background technology, see the attached Figure 1 , this application provides a method for storing key information of a solid-state drive. It should be clear that after the flash memory is erased, the data in the unwritten area is all 1. The solid-state drive needs to classify the stored information. The amount of key information data is very small and extremely important and cannot be lost. This application does not define the content of key information. Key information generally refers to data that maintains SSD performance, ensures SSD capacity, and maintains SSD functionality and stability, but it can also be specified by the operator. This method specifically includes the following steps: S1) selecting a continuous physical block in the SSD as a storage area for key information, and dividing the storage area into two parts, with the first half of the storage area being area 0 and the second half of the storage area being area 1; S2) reading a data structure of key information from the header of area 0 and area 1 respectively, and defining the first field of the read data structure as a 32-bit magic number; S3) determining whether the first 32 bits of the data structure read from area 0 and area 1 are all 1; S31) If yes, read the last 32 bits of data at the end of area 0 to determine whether the last 32 bits of data are all 1; S311) If yes, then area 0 is not erased, and the starting address of area 0 is returned as the starting position of the next write operation; S312) If not, the mark area 0 is a pre-erased area; S32) If not, determine whether the first 32 bits of the data structure read in S3) are magic numbers; S321) If yes, then determine whether the last 32 bits of data at the end of area 0 are all 1: S3211) If yes, then area 0 is the area where the key information is located; S3212) If not, then area 1 is the area where the key information is located; S322) If only one area is 1, the area to which the magic number belongs is used as the area where the key information is located, and then determine whether the first 32 bits of the read data structure of the other area are all 1; S3221) If yes, then read the data structure at the end of this area and determine whether it is all 1; if yes, then mark this area as a non-erasable area; if no, then mark this area as a pre-erasable area; S3222) If not, marking the other area as a pre-erased area; S323) If none of them is found, it is deemed that the key information is not found and the starting address of area 0 is used as the starting position of the next write operation, and area 0 is marked as a pre-erased area; S4) in the area where the key information identified in step S3) is located: all data structures of the key information are read in sequence until a data structure whose initial 32 bits are all 1 is read, and the data structure is recorded as a data structure to be written as the starting position of the next write operation; if the structure to be written is not read after reading the current area, the current area is marked as a pre-erased area, and the starting address of another area is used as the starting position of the next write operation; S5) for the marked pre-erased area, determine whether the first 32 bits of data and the last 32 bits of data of its data structure are all 1; if so, delete the pre-erased area mark; if not, retain the pre-erased area mark; For the next write operation, the next write operation is performed at the starting position of the next write operation in step S311) or step S4).

[0014] As a preferred embodiment of the present application, the method for writing key information includes the following steps: SA1) The write program writes the key information to the cache area of ​​the memory, increases the pending write count, and generates an integrity check code and updates it to the 32-bit data area at the end of the key information; SA2) The writing program continuously checks and updates the pending write count. When the pending write count is greater than 0, the writing operation is performed to the memory. After the writing is successful, the pending write count is reduced by 1. SA3) When the write program detects that the write margin is insufficient, an erase operation is performed on the pre-erased area of ​​another area of ​​the area being written.

[0015] In a specific example of the above implementation, in step SA1), the upper limit of the increase of the count to be written is 2. This ensures that the latest updated key information will be written.

[0016] As a preferred embodiment of the above embodiments, the present application sets a delay time. When executing a write operation or an erase operation, if an abnormal power-off of the memory is detected, the write operation or the erase operation is not initiated on the flash memory during the delay time.

[0017] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims

1. A method for storing key information of a solid state hard disk, characterized in that: The following steps are involved: S1) selecting a continuous physical block in the SSD as a storage area for key information, and dividing the storage area into two parts, with the first half of the storage area being area 0 and the second half of the storage area being area 1; S2) reading the data structure of the key information at the header of area 0 and area 1 respectively, and defining the first field of the read data structure as a 32-bit magic number; S3) determining whether the first 32 bits of the data structure read from area 0 and area 1 are all 1; S31) If yes, read the last 32 bits of data at the end of area 0 to determine whether the last 32 bits of data are all 1; S311) If yes, then area 0 is not erased, and the starting address of area 0 is returned as the starting position of the next write operation; S312) If not, then the mark area 0 is a pre-erased area; S32) If not, determine whether the first 32 bits of the data structure read in S3) are magic numbers; S321) If yes, then determine whether the last 32 bits of data at the end of area 0 are all 1: S3211) If yes, then area 0 is the area where the key information is located; S3212) If not, then area 1 is the area where the key information is located; S322) If only one area is 1, the area to which the magic number belongs is used as the area where the key information is located, and then determine whether the first 32 bits of the read data structure of the other area are all 1; S3221) If yes, then read the data structure at the end of this area and determine whether it is all 1; if yes, then mark this area as a non-erasable area; if no, then mark this area as a pre-erasable area; S3222) If not, marking the other area as a pre-erased area; S323) If none of them is found, it is deemed that the key information is not found and the starting address of area 0 is used as the starting position of the next write operation, and area 0 is marked as a pre-erased area; S4) in the area where the key information identified in step S3) is located: all data structures of the key information are read in sequence until a data structure whose initial 32 bits are all 1 is read, and the data structure is recorded as a data structure to be written as the starting position of the next write operation; if the structure to be written is not read after reading the current area, the current area is marked as a pre-erased area, and the starting address of another area is used as the starting position of the next write operation; S5) for the marked pre-erased area, determine whether the first 32 bits of data and the last 32 bits of data of its data structure are all 1; if so, delete the pre-erased area mark; if not, retain the pre-erased area mark; For the next write operation, the next write operation is performed at the starting position of the next write operation in step S311) or step S4).

2. A method for storing key information of a solid state hard disk according to claim 1, characterized in that: The method for writing key information includes the following steps: SA1) The write program writes the key information to the cache area of ​​the memory, increases the pending write count, and generates an integrity check code and updates it to the 32-bit data area at the end of the key information; SA2) The writing program continuously checks and updates the pending write count. When the pending write count is greater than 0, the writing operation is performed to the memory. After the writing is successful, the pending write count is reduced by 1. SA3) When the write program detects that the write margin is insufficient, an erase operation is performed on the pre-erased area of ​​another area of ​​the area being written.

3. A method for storing key information of a solid state hard disk according to claim 2, characterized in that: In step SA1), the upper limit of the increase in the count to be written is 2.

4. A method for storing key information of a solid state hard disk according to claim 3, characterized in that: Set the delay time. When performing a write operation or an erase operation, if an abnormal power failure of the memory is detected, the write operation or the erase operation will not be initiated on the flash memory during the delay time.

Citation Information

Patent Citations

  • Memory management method, memory control circuit unit and memory storage apparatus

    CN106325764A

  • Data storage method and system applied to flash memory

    CN114816271A

  • Information processing apparatus, access controller, and information processing method

    JP2017068804A