Data storage method and device for solid state disk, medium and equipment
By introducing the concept of user data types in solid-state drives, different types of data are stored in different flash blocks, complete release and direct garbage collection when deleting a certain type of data is achieved, and the decline in read and write performance of solid-state drives is solved. The problem of this problem improves garbage recycling efficiency and extends service life.
Patent Information
- Application Number
- CN202510045006.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-13
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2045-01-13
AI Technical Summary
After the user deletes historical data, a large amount of junk data is generated internally by the solid-state drive, resulting in a serious decline in read and write performance and affecting the user experience.
By introducing the concept of user data types in solid-state drives, different types of data are stored in different flash blocks. When deleting a certain type of data, the flash block of that type can be completely released, thereby realizing direct garbage collection and improving garbage Recycling efficiency.
It maximizes the efficiency of garbage collection, reduces the delay in reading and writing, maintains the performance of solid-state drives, solves the problem of degraded storage performance, and extends the service life of solid-state drives.
Smart Images

Figure CN119440424A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer storage technology, and in particular to a data storage method, device, medium and equipment for a solid state hard disk. Background Art
[0002] With the rapid development of the big data era, the amount of data has increased exponentially, and people are demanding more and more data storage capacity and higher and higher storage performance.
[0003] Taking ordinary computers as an example, in order to achieve faster startup speed and smoother user experience, with the development of Solid State Drive (SSD) technology, it gradually replaces mechanical hard disks, ushering in a big step-by-step improvement in speed. However, with the use of SSD, after the user deletes some historical data, a large amount of garbage data will appear inside the SSD, and the read and write performance of the SSD will drop seriously, which will eventually manifest as a slow startup and a sharp drop in fluency, affecting the user experience. Taking high-speed data recorder equipment as an example, in order to achieve large capacity and high bandwidth, users may use SSD arrays to record multiple data at different rates at the same time, delete historical data after the disk is full, and continue to record, and require that the performance does not drop at all times. However, with the use of SSD, after the user deletes some historical data, a large amount of garbage data will be generated inside the SSD, and the read and write performance of the SSD will drop seriously, which will eventually not meet user needs. At this time, the solid state drive needs to select the block with the most garbage data through garbage collection, concentrate the remaining useful data into the block being written, and then erase the block to complete garbage collection. Usually, the garbage collection efficiency in this case is low, which will seriously affect the read and write performance of the SSD. Summary of the invention
[0004] Based on this, it is necessary to provide a data storage method, device, medium and equipment for a solid-state hard disk to address the above technical problems. The storage method enables the solid-state hard disk to have a higher garbage collection efficiency without affecting the performance of the solid-state hard disk.
[0005] The present invention adopts the following technical solutions: The present invention provides a data storage method for a solid state hard disk, comprising: In response to a user's write command, determining a sector number of data to be written and a type of user data; Find the current write data flash block of the user data type in the SSD; If the current write data flash memory block of the user data type is not found, apply for a free flash memory block from the free flash memory block list, and use the free flash memory block as the current write data flash memory block of the user data type in the solid state drive; Mapping the sector number of the data to be written and the current write data flash memory block of the user data type to form a mapping relationship; The mapping relationship is stored in a flash translation layer mapping table, and the data to be written is written into the write data flash memory block.
[0006] Preferably, in response to a user's write command, determining the sector number of the data to be written and the type of user data includes: Receive a write command from the user; the write command includes the data to be written and the write parameters; The write parameters in the write command are parsed to obtain the sector number, data size and user data type of the data to be written.
[0007] Preferably, the method further comprises: After the data to be written is written into the write data flash memory block, a signal of successful data writing is returned to the user.
[0008] Preferably, the method further comprises: In response to a read command from a user, determining a read sector number of data to be read; Find the flash memory block corresponding to the read sector number and the detailed address in the block in the flash translation layer mapping table; Read the data according to the detailed address within the flash block and return the data to the user.
[0009] Preferably, after the data of the specified user data type is deleted, all data in the flash memory block occupied by the specified user data type is invalid data; the method further includes: Through the garbage collection mechanism, the flash memory blocks occupied by the specified user data type are added to the erase queue; Erasing the flash memory blocks in the erase queue through the erase task; Return the erased flash blocks to the free flash block list.
[0010] Preferably, the solid state drive sets the maximum supported number of user data types to an extension field of the identification information of the solid state drive.
[0011] The present invention provides a data storage device of a solid state hard disk, comprising: A determination module, used for determining the sector number of the data to be written and the type of user data in response to a write command of the user; A search module, used for searching the current written data flash memory block of the user data type in the solid state drive; A creation module is used to apply for a free flash block from a free flash block list if the current write data flash block of the user data type is not found, and use the free flash block as the current write data flash block of the user data type in the solid state drive; A mapping module, used for mapping the sector number of the data to be written with the current write data flash memory block of the user data type to form a mapping relationship; The writing module is used to store the mapping relationship in the flash translation layer mapping table and write the data to be written into the write data flash memory block.
[0012] The present invention provides a computer-readable storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the data storage method of the solid state hard disk is implemented.
[0013] The present invention provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the data storage method of the solid state hard disk when executing the program.
[0014] At least one of the above technical solutions adopted by the present invention can achieve the following beneficial effects: In the present invention, the user data type is transferred to the solid-state drive, and the data is separated and stored according to the user data type through the solid-state drive, and the data of different user data types are stored in different flash memory blocks. In this way, when a certain type of data is deleted, it is independent of other data, so that when the data is deleted, as many complete flash memory blocks of the same type as possible can be released. For the completely released flash memory blocks, they will be directly recycled during garbage collection, which maximizes the efficiency of garbage collection and reduces the delay of reading and writing, so that the solid-state drive can exert the best performance and solves the problem of reduced storage performance of the solid-state drive. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings: Figure 1 A schematic flow chart of a data storage method for a solid state hard disk provided by the present invention; Figure 2 A flowchart of the steps of storing and destroying unclassified data provided by the present invention; Figure 3 A flowchart of the steps of classified storage and destruction of a specified user data type provided by the present invention; Figure 4 A schematic diagram of a data storage device of a solid state hard disk provided by the present invention; Figure 5 A schematic diagram of a computer device for implementing a data storage method of a solid state hard disk provided by the present invention. DETAILED DESCRIPTION
[0016] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the specific embodiments of the present invention and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0017] Advanced Technology Attachment (ATA) protocol SSDs that use NAND flash as storage media have a set of firmware algorithms for managing NAND flash arrays to complete data recording, reading, and erasing, and need to support bad block management, garbage collection, wear leveling, and other functions. Since users cannot specify and perceive the location where their data is stored in NAND flash, various user data is mixed and written into NAND flash blocks. When some data is deleted, only part of the data in the NAND flash block is deleted. A large number of NAND flash blocks have both useful data and garbage data. At this time, the firmware algorithm needs to select the block with the most garbage data through garbage collection, concentrate the remaining useful data into the block being written, and then erase the block to complete garbage collection. Usually, the garbage collection efficiency in this case is low, which will seriously affect the read and write performance of the SSD. Due to the large amount of NAND flash that is constantly generated and the low efficiency of garbage collection, the performance of the SSD will eventually continue to decline and cannot be recovered during use.
[0018] Among them, the firmware is a special program inside the solid-state drive that is used to complete the FTL function, handle the recording, reading, and erasing of user data, and needs to support bad block management, garbage collection, wear leveling and other functions.
[0019] The reason why the performance of SSDs based on the ATA protocol continues to decline is that data storage is chaotic. As it is used, a large amount of garbage data will appear, and the efficiency of garbage data recovery is low, which will eventually reduce the performance of the SSD to 20% of the initial performance or even lower.
[0020] Therefore, it is an important and beneficial requirement to design a firmware that can maximize the garbage collection efficiency and maintain the SSD read and write performance to the greatest extent during long-term use.
[0021] Based on this, the present invention proposes a data storage method for a solid-state hard disk. The method is extended based on the ATA protocol, and the user data type is passed to the storage product firmware through the extension field. The user data is separated and stored according to the data type through the storage product firmware, and the data is stored in different flash memory blocks. When a certain type of data is deleted, it is independent of other data, and as many complete flash memory blocks of the same type as possible can be released. For the completely released flash memory blocks, they will be directly recycled during garbage collection, which maximizes the efficiency of garbage collection, reduces the delay of reading and writing, and brings into play the best performance of the storage product, optimizes and solves the problem of single-disk storage performance degradation, and effectively extends the life of the storage product, improves the problem of electronic product system jamming, and improves the user experience.
[0022] The technical solutions provided by various embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. The present invention is described with a solid state hard disk as the execution subject.
[0023] Figure 1 This is a flow chart of a data storage method for a solid state hard disk in the present invention, which specifically includes the following steps: S101, in response to a user's write command, determining a sector number of data to be written and a user data type.
[0024] First, "Information Technology - ATA / ATAPI Command Set - 3 (ACS-3)" defines the standard ATA protocol, which specifies the access method of storage products supporting the standard ATA protocol. The present invention is based on the standard ATA protocol and expands the data write command.
[0025] Specifically, in the parameter structure of the write command (including WRITE BUFFER (CMDE8), WRITE BUFFER DMA (CMDEB), WRITE DMA (CMDCA), WRITE DMA EXT (CMD35), WRITE DMA FUA EXT (CMD3D), WRITEFPDMAQUEUED (CMD61), WRITE MULTIPLE (CMDC5), WRITE MULTIPLE EXT (CMD39), WRITEMULTIPLE FUA EXT (CMDCE), WRITE SECTOR (CMD30), WRITE SECTOR EXT (CMD34))) sent to the solid state drive, find the reserved field, such as Bit [3:0] of the Device parameter (hereinafter, Device parameter Bit [3:0] represents the user data type parameter), which is extended to be defined as the user data type, and is used to notify the solid state drive of the user data type parameter carried by the current command. The user data type is defined by the user. In the present invention, the user data type refers to the encoding of the user data type, which is represented by a type sequence number from 0 to N, where N is the maximum number of supported user data types.
[0026] In the data structure defined by the basic information identification (Identify) of the ATA protocol, find the reserved fields, such as Word
[70] (hereinafter, Word
[70] is used to represent the maximum number of supported user data types in the extended definition). The maximum number of supported user data types in the extended definition is limited by the width of the user data type field in the write command. For example, Bit[3:0] of the Device parameter supports a maximum of 16 data types.
[0027] The reserved field only serves as a placeholder in the ATA protocol and has no practical significance. Products that support the standard ATA protocol do not parse this field, which has no impact on the product itself and is compatible with the standard protocol. The solid-state hard disk involved in the present invention will classify data according to this parameter to complete the classification and storage of user data.
[0028] The SSD forms a complete Flash Translation Layer (FTL) mapping table based on the cascade relationship of the NAND FLASH designed in the hardware, and at the same time forms a flash block management table, and sets the maximum supported number of user data types to the extended field of the SSD's identification information.
[0029] The maximum number of user data types supported by the solid state drive is stored in Word
[70] of the identification information of the solid state drive. Word
[70] is a reserved field in the standard ATA protocol. The present invention uses this reserved field as a storage location for the maximum number of supported user data types. When the host identifies the solid state drive, it reads the identification information, obtains the model, serial number, capacity and other information of the solid state drive, and parses the extended maximum number of supported user data types field Word
[70] to obtain the maximum number of supported user data types. The user data type mentioned in the present invention is a new feature of the solid state drive extension.
[0030] Whether the SSD supports setting the user data type parameter is reflected in the identification information of the SSD. After the host obtains the identification information, it can query whether the user data type parameter is supported and the maximum number of supported user data types.
[0031] Specifically, in response to a user's write command, determining the sector number and user data type of the data to be written includes: receiving the user's write command; the write command includes the data to be written and write parameters; parsing the write parameters in the write command to obtain the sector number, data size and user data type of the data to be written.
[0032] The write parameters sent to the solid state drive are protocol instructions supported by the solid state drive. Therefore, the solid state drive can directly parse the write parameters to obtain the sector number, data size and user data type of the data to be written.
[0033] S102, searching for the current write data flash block of the user data type in the solid-state hard disk, if the current write data flash block of the user data type is not found, applying for a free flash block from the free flash block list, and using the free flash block as the current write data flash block of the user data type in the solid-state hard disk.
[0034] The current write data flash block of the user data type is searched in the solid-state hard disk. The current write data flash block represents a flash block that has not been filled with data. The solid-state hard disk can store a mapping relationship between the user data type and the current write data flash block. Therefore, the corresponding current write data flash block can be directly searched according to the user data type. If found, the found write data flash block is determined as the current write data flash block of the user data type.
[0035] If the current flash block of the user data type is not found, a free flash block is requested from the free flash block list, and the free flash block is used as the current write data flash block of the user data type in the solid state drive. The free flash block list includes multiple empty flash blocks.
[0036] S103, mapping the sector number of the data to be written and the current write data flash memory block of the user data type to form a mapping relationship.
[0037] The mapping relationship may include a corresponding relationship between a sector number, a flash memory block number, and a detailed address of a flash memory block.
[0038] S104, storing the mapping relationship in a flash translation layer mapping table, and writing the data to be written into a write data flash memory block.
[0039] Among them, the flash translation layer is used to complete the translation, or mapping, of the host logical address space to the flash physical address space. Every time the solid-state drive writes a piece of user logical data into the flash address space, it records the mapping relationship between the logical address and the physical address. The next time the host wants to read the data, the firmware can read the data from the flash memory based on this mapping and return it to the user. The mapping of the logical address to the flash physical address space completed by the flash translation layer inside the firmware forms a conversion relationship record table, which is the flash translation layer mapping table.
[0040] The mapping relationship is stored in a flash translation layer mapping table. When data is read, the location where the data is stored can be found from the flash translation layer mapping table; then the solid-state drive writes the data to be written carried by the write command into the current write data flash block.
[0041] Optionally, after the data to be written is written into the write data flash memory block, a signal indicating that the data has been written successfully is returned to the user.
[0042] In an exemplary embodiment, the data storage method of the solid state drive of the present invention also supports writing data of unspecified data types. Specifically, writing data of unspecified data types includes the following steps: S11, the user transmits the write parameters (including sector number, data size) and the data to be written to the solid state drive through a write command.
[0043] S12, after receiving the write parameters and the data to be written, the solid state drive first parses the write parameters to obtain the sector number and data size.
[0044] S13, the solid state drive searches for the current flash memory block for writing data. If it has been used up, S14 is executed to create it. If it has not been used up, S14 is skipped and S15 is executed.
[0045] S14, the solid state drive applies for a flash memory block from the free flash memory block list as the current data writing flash memory block.
[0046] S15, the solid state drive maps the sector number specified by the write command with the current write data flash memory block to form a new FTL mapping relationship.
[0047] S16, the solid state hard disk writes the to-be-written data carried by the write command into the current write data flash memory block.
[0048] S17, the write operation of the unspecified user data type is completed, and the write command returns success.
[0049] S18, the user can repeat S11 to S17 to complete writing more data into continuous flash memory blocks.
[0050] The writing of the specified user data type provided by the present invention specifically includes: S21, the user transmits the write parameters (including sector number, data size, extended user data type) and the data to be written to the solid state drive through a write command.
[0051] S22, after receiving the write parameters and the data to be written, the solid state drive first parses the write parameters to obtain the sector number, data size, and extended user data type.
[0052] S23, the solid state drive searches for the current write data flash memory block of the user data type. If not found, S24 is executed to create it. If found, S24 is skipped and S25 is executed.
[0053] S24, the solid state drive applies for a flash memory block from the free flash memory block list as the current write data flash memory block for the user data type.
[0054] S25, the solid state hard disk maps the sector number specified by the write command with the user data type specified by the write command to the data flash memory block currently written to form a new FTL mapping relationship.
[0055] S26, the solid state hard disk writes the to-be-written data carried by the write command into the current write data flash memory block of the user data type specified by the write command.
[0056] S27, the writing operation of the specified user data type is completed, and the writing command returns success.
[0057] S28, the user can repeat steps 21 to 27 to complete writing data of different user data types into different flash memory blocks.
[0058] In the present invention, the designated user data type data writing operation selects different flash memory blocks to store data according to the user data type designated by the user. The ATA protocol data writing command extension method and the method of allocating flash memory blocks by extending the user data type in the firmware algorithm in the operation belong to the scope of the present invention.
[0059] In an exemplary embodiment, after writing data to a solid-state drive, the data can also be read from the solid-state drive. The embodiment includes: determining the read sector number of the data to be read in response to a user's read command; searching the flash memory block and the detailed address within the block corresponding to the read sector number in the flash memory translation layer mapping table; reading the data according to the detailed address within the block of the flash memory block, and returning the data to the user.
[0060] Specifically, user data reading may include the following steps: S31, the user transmits the read parameters (including sector number, data size) and the data to be read to the solid state drive through a read command.
[0061] S32, after receiving the read parameters and the data to be read, the solid state drive first parses the read parameters to obtain the read sector number and the data size.
[0062] S33, the solid state drive searches the FTL mapping table for the flash memory block and the detailed address in the block corresponding to the read sector number.
[0063] S34, the solid state drive reads data from the detailed address within the found flash memory block.
[0064] S35, the solid state drive returns the read data to the host.
[0065] S36, the user data reading operation is completed.
[0066] S37, the user can repeat S31 to S36 to complete the reading of all data.
[0067] Completing this operation does not affect the storage location of the data. It should be noted that user data reading does not require specifying the user data type, and the solid-state hard disk can locate the flash memory block where the data is stored and the detailed address in the block according to the sector number to be accessed through the FTL mapping table. This operation is consistent with the read operation in the standard ATA protocol, and the present invention is compatible with the standard ATA data read operation.
[0068] In an exemplary embodiment, the user data may also be destroyed. The specific process of destroying the user data includes: S41, the user transfers the parameters and the data to be destroyed to the solid state drive through a data management command.
[0069] S42, after receiving the data management command parameters and the data to be destroyed, the solid state drive parses the parameters and the data to be destroyed to obtain a list of sectors to be destroyed; the list of sectors to be destroyed includes at least one sector to be destroyed.
[0070] S43, the solid state drive finds the sector to be destroyed and its detailed address mapped to the flash memory block in the FTL mapping table.
[0071] S44, the solid state drive releases the mapping relationship.
[0072] S45, the user data destruction operation is completed.
[0073] S46, the user can repeat S41 to S45 to complete the operation of destroying all sectors where data of the specified data type is written.
[0074] The unmapping relationship is divided into two types: an overwriting mapping relationship and an active unmapping relationship.
[0075] Overwriting mapping relationship: that is, the user updates data by overwriting the same logical address space. At the same time, the firmware algorithm releases the original mapping relationship in the mapping table and establishes a new mapping relationship from the logical address to the flash memory physical address space. Actively release mapping relationship: that is, the user actively notifies the storage product through the storage interface protocol that the data on certain logical addresses is no longer needed. The firmware algorithm releases the mapping relationship specified in the mapping table according to the address range given by the user.
[0076] It should be noted that user data destruction does not require specifying the data type, and destroying the sector number where the data is written can destroy the space of the specified data. This operation is consistent with the data destruction operation in the standard ATA protocol, and the present invention is compatible with the standard ATA data destruction operation.
[0077] In an exemplary embodiment, after the data of the specified user data type is deleted, all data in the flash memory block occupied by the specified user data type is invalid data; the flash memory block occupied by the specified user data type is recycled, including: adding the flash memory block occupied by the specified user data type to the erase queue through a garbage collection mechanism; erasing the flash memory block in the erase queue through an erase task; and returning the erased flash memory block to the free flash memory block list. Specifically, the following steps are included: S51, when the data destruction operation of the specified user data type is completed, all data in the flash memory block occupied by the specified user data type are invalid data, and other data are stored in other flash memory blocks, which does not affect the flash memory block occupied by the user data type.
[0078] S52, the solid state drive adds the flash memory block occupied by the specified user data type to an erase queue through garbage collection.
[0079] S53, the solid state drive erasing task erases the flash memory blocks in the erasing queue and waits for completion.
[0080] S54, after the solid state drive completes erasing the flash memory block, it returns the flash memory block to the idle queue.
[0081] S55, the solid state drive repeats S52 to S54 to complete the recovery of all flash memory blocks occupied by the specified user data type, and no data migration operation is performed during the process.
[0082] Among them, garbage collection is the process in which the firmware algorithm of the solid-state drive selects the block with the least valid data from all flash memory blocks, reads the valid data on this flash memory block and records it in other blocks, updates the valid data mapping relationship to the FTL mapping table, and then erases the flash memory block to obtain a new available flash memory block.
[0083] It should be noted that this operation is based on the implementation of the present invention, which stores different types of data in different flash memory blocks by specifying user data types, so that the occupied flash memory blocks can be completely released when the data is destroyed, achieving the effect of direct garbage collection, thereby reducing write amplification, extending the life of the solid-state drive, and improving the response speed of the solid-state drive, thereby optimizing the solution to the problem of single-disk storage performance degradation to the greatest extent.
[0084] In an exemplary embodiment, in order to illustrate the effectiveness of the method of the present invention, a comparison is made on the recovery of flash memory blocks occupied by unclassified data, specifically including: S61, unclassified data is mixedly stored in the flash memory block according to the order of writing. When the destruction operation of some unclassified data types is completed, after deleting part of the user data, some data in the occupied multiple flash memory blocks are valid and some data are invalid.
[0085] S62, the solid-state drive uses garbage collection to find the flash memory block with the least useful data from all used flash memory blocks.
[0086] S63, the solid state drive reads out the useful data in the flash memory block.
[0087] S64, the solid state drive writes the read data into the flash memory block being written.
[0088] S65, the solid state drive updates the original FTL mapping of the read data.
[0089] S66, the solid state drive repeats S63 to S65 to complete the migration of all valid data in the flash memory block.
[0090] S67, the solid state drive adds the flash memory block to the erase queue through garbage collection.
[0091] S68, the solid state drive erase task erases the flash memory blocks in the erase queue and waits for completion.
[0092] S69, after the solid state drive completes erasing the flash memory block, it returns the flash memory block to the idle queue.
[0093] The solid state drive repeats S62 to S69 to complete garbage collection of more flash memory blocks.
[0094] It should be noted that this operation is based on a general SSD firmware algorithm and implements a general garbage collection function. Since data classification is not performed, various data are mixed and stored in the flash memory block. After destroying some data, the data in some flash memory blocks cannot be completely destroyed. Therefore, data migration is required to rewrite the useful data to the currently written flash memory block and update the mapping table before the original flash memory block can be released. The garbage collection efficiency of the general firmware algorithm is low. After long-term use, data continues to be stored in a chaotic manner, and write amplification continues to exist, which affects the life of the SSD and seriously increases the command response time, affecting the user experience.
[0095] Write amplification refers to the phenomenon that when a user wants to write a certain amount of data, the SSD moves data during garbage collection to make room for writing this data. This causes additional data write operations, resulting in the amount of data written to the flash memory being larger than the actual amount of data written by the user. This is called write amplification.
[0096] In an exemplary embodiment, Figure 2 and Figure 3 As shown, Figure 2 A flowchart of the steps for storing and destroying unclassified data. Figure 3 For a flowchart of the steps for storing and destroying a specified user data type, see Figure 2 In the second step, three types of data are written and stored unclassified, and the data are stored in the flash blocks in sequence; in the third step, the second type of data is destroyed, and there are both valid data and invalid data in flash block 1 and flash block 2; when performing garbage collection, the remaining valid data in flash block 1 and flash block 2 are moved to flash block 3 (fourth step), and the FTL mapping table of valid data is updated to obtain flash block 1 and flash block 2 that are full of garbage (fifth step), and the two flash blocks 1 and flash blocks 2 that are full of garbage are erased to complete the recycling (sixth step).
[0097] See also Figure 3 In the second step, three types of data are written to classify and store user data, and the data is stored in different flash blocks according to different user data types; in the third step, the second type of data is destroyed, and all the data in flash block 2 is invalid, and a flash block full of garbage data is obtained; in the fourth step, the invalid data in flash block 2 is erased, and the recycling of flash block 2 is completed.
[0098] In the storage method of the solid-state hard disk provided by the present invention, flash memory blocks are allocated according to the type of user data, so that data of different user data types are stored in different flash memory blocks. Deleting a certain type of data will completely release the flash memory blocks, thereby realizing direct recycling of the flash memory blocks, achieving the effect of not affecting the performance of the solid-state hard disk, and solving the problem of performance degradation of the solid-state hard disk after long-term use.
[0099] At the same time, the present invention greatly reduces the data movement in the garbage collection process by realizing the direct recycling of flash memory blocks, and minimizes the write amplification of the solid-state hard disk, thereby extending the service life of the solid-state hard disk. For data recording products, multiple data are classified and stored, and historical data is deleted by cyclic overwriting, which will maximize the optimal management of the flash memory blocks proposed by the present invention, and achieve the effect of the solid-state hard disk performance continuing to maintain the initial performance, and completely solve the problem of performance degradation of data recording devices composed of ATA protocol SSD arrays. For ordinary electronic products, data is classified and stored. After deleting certain types of data, the garbage collection efficiency is greatly optimized, and the performance of storage products is improved, thereby maximizing the improvement of the jamming problem of electronic products and improving the user experience.
[0100] When applying the data storage method of the solid state hard disk provided by the present invention, it is not necessary to Figure 1 The steps are executed in the order shown. The specific execution order of the steps can be determined according to needs, and the present invention does not limit this.
[0101] The above is a data storage method for a solid state hard disk provided by one or more embodiments of the present invention. Based on the same idea, the present invention also provides a corresponding data storage device for a solid state hard disk, such as Figure 4 shown.
[0102] Figure 4 A schematic diagram of a data storage device of a solid state hard disk provided by the present invention, the device 400 comprises: The determination module 401 is used to determine the sector number of the data to be written and the type of user data in response to a write command from the user; A search module 402 is used to search the current written data flash memory block of the user data type in the solid state drive; A creation module 403 is used for applying for a free flash block from a free flash block list if the current write data flash block of the user data type is not found, and using the free flash block as the current write data flash block of the user data type in the solid state drive; A mapping module 404 is used to map the sector number of the data to be written with the current write data flash memory block of the user data type to form a mapping relationship; The writing module 405 is used to store the mapping relationship in the flash translation layer mapping table, and write the data to be written into the write data flash memory block.
[0103] For the specific definition of the data storage device of the solid-state hard disk, please refer to the definition of the data storage method of the solid-state hard disk above, which will not be repeated here. Each module in the above-mentioned data storage device of the solid-state hard disk can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0104] The present invention also provides a computer-readable storage medium, which stores a computer program, which can be used to execute the above Figure 1 A data storage method for a solid state hard disk is provided.
[0105] The present invention also provides Figure 5 The structural diagram of the computer device shown in FIG. Figure 5 As shown in the figure, at the hardware level, the computer device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include other hardware required for the business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to achieve the above Figure 1 A data storage method for a solid state hard disk is provided.
[0106] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0107] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of the present invention.
Claims
1. A data storage method for a solid state hard disk, characterized in that: include: In response to a user's write command, determining a sector number of data to be written and a type of user data; Searching the solid state drive for a current written data flash memory block for the user data type; If the current data writing flash memory block for the user data type is not found, apply for a free flash memory block from the free flash memory block list, and use the free flash memory block as the current data writing flash memory block for the user data type in the solid state drive; Mapping the sector number of the data to be written and the current write data flash memory block of the user data type to form a mapping relationship; The mapping relationship is stored in a flash translation layer mapping table, and the data to be written is written into the write data flash memory block.
2. The method according to claim 1, characterized in that: The step of determining the sector number of the data to be written and the type of the user data in response to the user's write command comprises: receiving a write command from the user; the write command includes data to be written and write parameters; The write parameters in the write command are parsed to obtain the sector number, data size and user data type of the data to be written.
3. The method according to claim 1, characterized in that The method further comprises: After the data to be written is written into the write data flash memory block, a signal indicating that the data is written successfully is returned to the user.
4. The method according to claim 1, characterized in that: The method further comprises: In response to a read command from a user, determining a read sector number of data to be read; Searching the flash memory block corresponding to the read sector number and the detailed address in the block in the flash memory translation layer mapping table; Data is read according to the detailed address within the flash memory block, and the data is returned to the user.
5. The method according to claim 1, characterized in that After the data of the specified user data type is deleted, all data in the flash memory block occupied by the specified user data type is invalid data; the method further includes: By means of a garbage collection mechanism, the flash memory blocks occupied by the specified user data type are added to an erasure queue; Erasing the flash memory blocks in the erase queue by an erase task; The flash memory blocks whose erasure is completed are returned to the free flash memory block list.
6. The method according to claim 1, characterized in that The solid state drive sets the maximum supported number of user data types to an extension field of the identification information of the solid state drive.
7. A data storage device of a solid state hard disk, characterized in that: include: A determination module, used for determining the sector number of the data to be written and the type of user data in response to a write command of the user; A search module, used for searching the current written data flash memory block of the user data type in the solid state drive; A creation module is used for applying for a free flash block from a free flash block list if the current write data flash block of the user data type is not found, and using the free flash block as the current write data flash block of the user data type in the solid state drive; A mapping module, used for mapping the sector number of the data to be written with the current writing data flash memory block of the user data type to form a mapping relationship; The writing module is used to store the mapping relationship in a flash translation layer mapping table, and write the data to be written into the write data flash memory block.
8. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
9. A computer device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Block access-based flash reading and writing method
CN101930345A
Method and system for reading cache with solid state disk as equipment and solid state disk
CN103543955A
Method and electronic equipment for storing data
CN103677654A
Eliminating garbage collection in NAND flash devices
CN106610900A
Data storage method and storage equipment
CN107092439A