Storage space allocation method and device and solid state disk
By checking the health status of the SSD data blocks and eliminating all bad blocks, the storage space is allocated using SLC mode, and combining the reserved buffer to optimize data processing, the problem of low storage space allocation efficiency in the SSD is solved and the stability of the hard disk is improved and performance.
Patent Information
- Application Number
- CN202411327328.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-23
- Publication Date
- 2025-01-07
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In a solid-state drive, how to effectively allocate storage space to improve stability and read and write performance, especially when using a PLC system, it is necessary to ensure the data security of the system area and user area, and to improve storage performance.
By checking the health status of each data block, marking all bad data blocks as bad blocks, and excluding them in the storage space allocation of the system area and user area, and allocating the to be processed healthy data blocks to be processed in SLC mode to ensure that the system stability and performance of zones and user zones. Meanwhile, during the writing and garbage collection process, multiple buffers are reserved to optimize data processing efficiency.
It improves the stability and storage performance of the solid-state drive, improves the read and write performance, ensures the data security of the system area and the user area, and avoids inconsistency in the allocation results due to bad blocks.
Smart Images

Figure CN119271133A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of storage technology, and in particular to a storage space allocation method, device and solid state hard disk. Background Art
[0002] NAND Flash is a type of flash memory, i.e. a non-volatile memory, which is an important component of SSD (Solid State Drives). The basic storage unit (cell) of flash memory is a floating gate transistor, which forms a floating gate for storing electrons on a semiconductor where current is conducted unidirectionally between the source and the drain. The floating gate is surrounded by insulating layers above and below, and electrons are stored in the insulating layers.
[0003] SLC (Single-Level Cell) refers to a storage cell that stores 1 bit of information, that is, there are only two voltage changes: 0 and 1. TLC (Trinary-Level Cell) refers to a storage cell that stores 3 bits of information, that is, there are eight voltage changes: 000, 001, 010, 011, 100, 101, 110, and 111. Since the voltage control of TLC is more complicated, the read and write speed of SLC is faster than that of TLC. Although TLC can increase storage capacity and reduce production costs, its read and write performance is poor, the number of erasable times is low, and the service life is short. However, SLC has good read and write performance and reliability. In some scenarios where data stability or read and write performance requirements are high, a PLC (Pure SLC) system can be used.
[0004] For SSDs, it is usually necessary to divide the system area and user area to store different data. Currently, the SLC mode Block (data block) is usually used as the system area, and the TLC mode Block is used as the user area to allocate the storage space of the SSD. So for SSDs using the PLC system, how to allocate its storage space is a very important issue. Summary of the invention
[0005] In view of this, an object of the present invention is to provide a storage space allocation method, device and solid state hard disk.
[0006] In order to achieve the above object, the technical solution adopted by the present invention is as follows:
[0007] In a first aspect, the present invention provides a storage space allocation method, which is applied to a solid state drive, wherein all data blocks in the solid state drive adopt an SLC mode, and the storage space allocation method comprises:
[0008] Checking the health status of each of the data blocks, and marking each data block with a health status of being completely bad as a bad block;
[0009] From all data blocks, obtain each data block except all bad blocks to obtain a set of blocks to be processed;
[0010] The set of blocks to be processed is allocated to obtain a first storage space and a second storage space; wherein the first storage space is used as a system area and the second storage space is used as a user area.
[0011] In an optional implementation manner, each of the data blocks has a serial number, and the health status of each data block in the set of blocks to be processed is fully good or half good;
[0012] The step of allocating the set of blocks to be processed to obtain a first storage space and a second storage space comprises:
[0013] In the block set to be processed, each data block having a sequence number less than a preset reference sequence number is obtained to obtain a first block set, and each data block having a sequence number greater than or equal to the reference sequence number is obtained to obtain a second block set;
[0014] From the first block set, a plurality of data blocks in good health status matching the preset system area capacity are obtained and used as first data blocks, thereby obtaining a first storage space composed of all the first data blocks;
[0015] Each data block except all first data blocks in the first block set and each data block in the second block set are used as second data blocks to obtain a second storage space composed of all second data blocks.
[0016] In an optional implementation manner, the storage space allocation method further includes:
[0017] During the operation of the solid state hard disk, after an erasing operation is performed on any first data block in the first storage space, the erased first data block is reallocated to the first storage space.
[0018] In an optional implementation manner, the storage space allocation method further includes:
[0019] During the operation of the solid state hard disk, after an erasing operation is performed on any second data block in the second storage space, the erased second data block is reallocated to the second storage space.
[0020] In an optional implementation manner, the solid state drive reserves n first buffer zones, and the storage space allocation method further includes:
[0021] During the data writing process, for any data page to be written, a first target buffer is selected from the n first buffers according to the data page to be written, and a verification operation is performed on the data page to be written, and the verification result of the data page to be written is cached in the first target buffer.
[0022] In an optional implementation manner, each of the first buffers has a number and the numbers of the n first buffers are continuous, and the data page to be written has a sequence number;
[0023] The step of selecting a first target buffer from the n first buffers according to the data page to be written comprises:
[0024] A remainder is calculated for n according to the sequence number of the to-be-written data page, and a first buffer whose number is consistent with the remainder is used as a first target buffer.
[0025] In an optional implementation manner, the solid state hard disk reserves n second buffer zones, and the storage space allocation method further includes:
[0026] During the garbage collection process, for any data page to be recycled, a second target buffer is selected from the n second buffers according to the data page to be recycled, and a verification operation is performed on the data page to be recycled, and the verification result of the data page to be recycled is cached in the second target buffer.
[0027] In an optional implementation, each of the second buffers has a number and the numbers of the n second buffers are continuous, the numbers of the n first buffers are continuous with the numbers of the n second buffers, and the data page to be recycled has a sequence number;
[0028] The step of selecting a second target buffer from the n second buffers according to the data page to be recycled includes:
[0029] A remainder is calculated for n according to the sequence number of the to-be-reclaimed data page, and the sum of the remainder and n is used as a target value, and a second buffer having a number consistent with the target value is used as a second target buffer.
[0030] In a second aspect, the present invention provides a storage space allocation device, which is applied to a solid state drive, wherein all data blocks in the solid state drive adopt an SLC mode, and the storage space allocation device comprises:
[0031] A marking module, used for checking the health status of each of the data blocks, and marking each data block with a health status of being completely bad as a bad block;
[0032] An acquisition module is used to acquire each data block except all bad blocks from all data blocks to obtain a set of blocks to be processed;
[0033] An allocation module is used to allocate the set of blocks to be processed to obtain a first storage space and a second storage space; wherein the first storage space is used as a system area and the second storage space is used as a user area.
[0034] In a third aspect, the present invention provides a solid state drive for implementing the storage space allocation method described in any one of the aforementioned embodiments.
[0035] The storage space allocation method, device and solid-state hard disk provided by the present invention are applied to a solid-state hard disk using a PLC system. The method comprises: firstly checking the health status of each data block, and marking each data block with a health status of all bad as a bad block; then obtaining each data block except all bad blocks from all data blocks to obtain a set of blocks to be processed; finally allocating the set of blocks to be processed to obtain a first storage space and a second storage space; and the first storage space is used as a system area and the second storage space is used as a user area. The present invention improves the stability of the solid-state hard disk and the storage performance of the solid-state hard disk by checking the health status of each data block in the solid-state hard disk and marking the data blocks with a health status of all bad as bad blocks, so as to exclude these bad blocks when allocating storage space of the system area and the user area.
[0036] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0038] Figure 1 One of the flowcharts of the storage space allocation method provided by the embodiment of the present invention is shown;
[0039] Figure 2 A second flow chart of the storage space allocation method provided by an embodiment of the present invention is shown;
[0040] Figure 3 A functional module diagram of a storage space allocation device provided by an embodiment of the present invention is shown;
[0041] Figure 4 A block diagram of a solid state drive provided by an embodiment of the present invention is shown.
[0042] Icons: 100 - solid state drive; 110 - processor; 120 - memory; 130 - flash memory; 300 - storage space allocation device; 310 - marking module; 330 - acquisition module; 350 - allocation module; 370 - writing module; 390 - recycling module. DETAILED DESCRIPTION
[0043] The following will be combined with the accompanying drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0044] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present invention.
[0045] It should be noted that relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0046] See also Figure 1 , is a flow chart of a storage space allocation method provided in an embodiment of the present invention.
[0047] Step S202, checking the health status of each data block, and marking each data block with a health status of "all bad" as a bad block.
[0048] Step S204, obtaining each data block except all bad blocks from all data blocks to obtain a set of blocks to be processed.
[0049] Step S206, allocating the block set to be processed to obtain a first storage space and a second storage space; wherein the first storage space is used as a system area and the second storage space is used as a user area.
[0050] In this embodiment, all data blocks in the solid state drive adopt the SLC mode, that is, the storage unit included in each data block is used to store 1 bit of information.
[0051] For such a solid state drive using a PLC system, the health status of each data block in the solid state drive can be checked first, that is, whether each storage unit in the data block fails is checked, and the health status of the data block is determined based on the failure status of the storage unit in the data block.
[0052] If all storage units in the data block are determined to be failed, the health status of the data block is determined to be all bad. If some storage units in the data block are determined to be failed, the health status of the data block is determined to be half good. If all storage units in the data block are determined to be intact, the health status of the data block is determined to be all good.
[0053] Then, according to the health status of each data block, each data block with a health status of all bad is obtained and marked as a bad block. It can be understood that a bad block refers to a data block that cannot store information. Then, from all data blocks, each data block except all bad blocks is obtained, that is, each data block with a health status of all good and each data block with a health status of half good is obtained, and a set of blocks to be processed containing these data blocks is obtained.
[0054] Finally, the data blocks in the processing block set are allocated, that is, the first storage space and the second storage space are obtained, and the first storage space is used as the system area, and the second storage space is used as the user area. The system area refers to the storage area for storing key data such as mapping table data, system data, and snapshot data; the user area refers to the storage area for storing user data.
[0055] It can be understood that compared with traditional solid-state drives that use TLC and SLC, the data blocks in the system area and user area of the solid-state drive provided by the embodiment of the present invention both use SLC, and the read and write performance of SLC is better than TLC, so the read and write performance of the solid-state drive of the embodiment of the present invention will be better than that of traditional solid-state drives.
[0056] It can be understood that the embodiment of the present invention improves the stability of the solid-state hard disk and the storage performance of the solid-state hard disk by checking the health status of each data block in the solid-state hard disk and marking the data blocks with a health status of being completely bad as bad blocks, so as to exclude these bad blocks when allocating storage space in the system area and the user area.
[0057] It can be seen that based on the above steps, the health status of each data block is first checked, and each data block with a health status of all bad is marked as a bad block; then, from all data blocks, each data block except all bad blocks is obtained to obtain a set of blocks to be processed; finally, the set of blocks to be processed is allocated to obtain a first storage space and a second storage space; and the first storage space is used as a system area and the second storage space is used as a user area. The present invention checks the health status of each data block in the solid-state hard disk, and marks the data blocks with a health status of all bad as bad blocks, so as to exclude these bad blocks when allocating storage space in the system area and the user area, thereby improving the stability of the solid-state hard disk and the storage performance of the solid-state hard disk.
[0058] Optionally, for step S206, an embodiment of the present invention provides a possible implementation method.
[0059] Step S206-1, in the block set to be processed, obtain each data block with a sequence number less than a preset reference sequence number to obtain a first block set, and obtain each data block with a sequence number greater than or equal to the reference sequence number to obtain a second block set.
[0060] It is understandable that each data block has a serial number, which is the identifier of the data block. A reference serial number can be pre-set as a basis for preliminarily dividing the two storage spaces, and this reference serial number can be expressed as HSPD_block_ID.
[0061] In this embodiment, the sequence number of each data block in the block set to be processed can be traversed to obtain each data block whose sequence number is less than the reference sequence number, i.e., HSPD_block_ID, to obtain a first block set, which can be understood as a first storage space that is initially divided. And each data block whose sequence number is greater than or equal to the reference sequence number, i.e., HSPD_block_ID, can be obtained to obtain a second block set, which can be understood as a second storage space that is initially divided.
[0062] It can be understood that for data blocks with serial numbers less than the reference serial number HSPD_block_ID, they may be used as data blocks in the system area, while for data blocks with serial numbers greater than or equal to the reference serial number HSPD_block_ID, they can only be used as data blocks in the user area.
[0063] Step S206-3, from the first block set, a plurality of data blocks in good health status matching the preset system area capacity are obtained and used as first data blocks, thereby obtaining a first storage space composed of all first data blocks.
[0064] It is understandable that the system area capacity can be pre-set based on the capacity of the solid state drive, and the number of matching blocks, that is, the number of data blocks required to constitute the system area, can be determined according to the capacity of the system area. For example, if the capacity of the solid state drive is 4TB, then the number of data blocks required for the system area can be set to 12. It should be noted that the system area capacity and the number of blocks can be set according to actual conditions, and the embodiments of the present invention do not limit this.
[0065] In this embodiment, in the first block set, according to the number of blocks that matches the preset system area capacity, a corresponding number of data blocks with a healthy status of all good can be obtained and used as the first data blocks, so as to obtain a first storage space composed of all the first data blocks, that is, a storage space used as the system area.
[0066] It can be understood that, since the data stored in the system area is crucial to the stable operation of the solid state drive, the embodiment of the present invention uses the storage space composed of complete data blocks as the system area to improve the reliability of data storage.
[0067] Step S206-5: each data block in the first block set except all first data blocks and each data block in the second block set are taken as second data blocks to obtain a second storage space composed of all second data blocks.
[0068] In this embodiment, each data block except all first data blocks in the first block set is obtained, and each data block in the second block set is obtained, and these data blocks are all used as second data blocks, so as to obtain a second storage space composed of all second data blocks, that is, a storage space used as a user area.
[0069] It can be understood that, since the importance of data stored in the user area is lower than that of data stored in the system area, the embodiment of the present invention uses the storage space composed of semi-good and fully good data blocks as the user area to achieve reasonable allocation of storage resources.
[0070] Optionally, after step S206, the embodiment of the present invention further provides an implementation method for reallocating data blocks, see Figure 2 , is another flow chart of the storage space allocation method provided in an embodiment of the present invention.
[0071] Step S208A: during the operation of the solid state hard disk, after erasing any first data block in the first storage space, reallocate the erased first data block to the first storage space.
[0072] Step S208B: during the operation of the solid state hard disk, after erasing any second data block in the second storage space, reallocate the erased second data block to the second storage space.
[0073] It is understandable that after allocating the storage area in the above manner, during the operation of the solid-state drive, data blocks may be erased and reallocated. In order to make the reallocation result of the data block consistent with the previous allocation result, the stability of the solid-state drive is guaranteed. The embodiment of the present invention also provides a data block allocation mechanism during the operation of the solid-state drive, that is, after erasing a data block, the erased data block is reallocated to its original storage area.
[0074] In this embodiment, for any first data block in the first storage space, after the first data block is erased, the erased first data block is reallocated to the first storage space. Also, for any second data block in the second storage space, after the second data block is erased, the erased second data block is reallocated to the second storage space. This ensures that the reallocation result of the data block is consistent with the initial allocation result.
[0075] It is understandable that for a solid-state drive using the TLC mode, since one Word Line has three Pages, three buffers need to be reserved for RAID (Redundant Array of Independent Disks) processing. For a solid-state drive using the PLC system, although one word line has only one data page, the read and write speed of this solid-state drive is faster. If only one buffer is reserved, there will be a long wait for the buffer to be released, which will reduce the efficiency of data processing and affect the performance of the solid-state drive. Therefore, the embodiment of the present invention reserves n buffers in the solid-state drive for the data writing process, and reserves n buffers for the garbage collection process, and provides a corresponding implementation method to solve the above-mentioned problems.
[0076] Step S210A, during the data writing process, for any data page to be written, a first target buffer is selected from n first buffers according to the data page to be written, and a verification operation is performed on the data page to be written, and the verification result of the data page to be written is cached in the first target buffer.
[0077] It is understandable that, for the sake of convenience of description, the buffer used for the data writing process is called the first buffer, that is, the solid state drive has n first buffers reserved. In addition, for each data page to be written in the data writing process, the processing method is similar. For the sake of simplicity, the following description is taken as an example of a data page to be written.
[0078] In this embodiment, when performing RAID processing on the data page to be written, an idle first buffer is selected from n first buffers as the first target buffer, and after a verification operation is performed on the data page to be written, the verification result of the data page to be written is cached in the first target buffer.
[0079] Step S210B, during the garbage collection process, for any data page to be recycled, a second target buffer is selected from the n second buffers according to the data page to be recycled, and a verification operation is performed on the data page to be recycled, and the verification result of the data page to be recycled is cached in the second target buffer.
[0080] It is understandable that, for the sake of convenience, the buffer used for the data writing process is called the second buffer, that is, the solid state drive reserves n second buffers. In addition, for each data page to be recycled during the data writing process, the processing method is similar. For the sake of simplicity, the following takes a data page to be recycled as an example for description.
[0081] In this embodiment, when performing RAID processing on the data page to be recovered, an idle second buffer is selected from n second buffers as the second target buffer, and after a verification operation is performed on the data page to be recovered, the verification result of the data page to be recovered is cached in the second target buffer.
[0082] Optionally, for the process of selecting a first target buffer from n first buffers according to the data page to be written in step S210A, an embodiment of the present invention provides a possible implementation method, namely: calculating a remainder of n according to the sequence number of the data page to be written, and taking the first buffer having the same number as the remainder as the first target buffer.
[0083] It is understandable that each data page to be written has a serial number. Each first buffer has a serial number, and the serial numbers of the n first buffers are continuous.
[0084] For ease of understanding, an embodiment of the present invention provides an example. For example, a solid state drive reserves three first buffers, and the three first buffers are numbered 0, 1, and 2, respectively. Assuming that the sequence number of the data page to be written currently being processed is 5, then the sequence number of the data page to be written, that is, 5, is divided by n, that is, 3, and the remainder obtained is 2, and the first buffer numbered as the remainder, that is, 2, is used as the first target buffer, so that the first target buffer is used to cache the verification result of the data page to be written.
[0085] It can be understood that the embodiment of the present invention selects the first buffer to cache the verification result by setting a number for the first buffer and calculating the remainder according to the sequence number of the data page to be written and the total number of the first buffer. This realizes the use of the first buffer in turn, avoids the slow data writing caused by waiting for the buffer to be released, improves the speed and efficiency of data writing, and improves the storage performance of the solid-state hard disk.
[0086] Optionally, for the process of selecting a second target buffer from n second buffers according to the data page to be recovered in step S210B, an embodiment of the present invention provides a possible implementation method, namely: calculating the remainder n according to the sequence number of the data page to be recovered, and taking the sum of the remainder and n as the target value, and taking the second buffer whose number is consistent with the target value as the second target buffer.
[0087] It is understandable that each data page to be recycled has a serial number. Each second buffer has a serial number, and the serial numbers of the n second buffers are continuous, and the serial numbers of the n first buffers are also continuous with the serial numbers of the n second buffers.
[0088] For ease of understanding, an embodiment of the present invention provides an example. For example, a solid-state hard disk reserves three second buffers, and the three second buffers are numbered 3, 4, and 5, respectively. Assuming that the serial number of the data page to be recovered currently being processed is 5, then the serial number of the data page to be recovered, that is, 5, is divided by n, that is, 3, and the remainder of the two is 2, and the sum of the remainder, that is, 2, and n, that is, 3, is calculated to obtain a target value of 5, and then the second buffer numbered as the target value, that is, 5, is used as the second target buffer, so as to use the second target buffer to cache the verification result of the data page to be recovered.
[0089] It can be understood that the embodiment of the present invention selects the second buffer to cache the verification result by setting a number for the second buffer, calculating the remainder and summing the numbers of the data pages to be recovered and the total number of the second buffer. This enables the second buffer to be used in turn, avoids slow garbage collection due to waiting for the buffer to be released, improves the speed and efficiency of garbage collection, and improves the storage performance of the solid-state drive.
[0090] In order to better understand the effect of the present invention, the present invention provides a set of comparative examples. For example, a solid state drive with WDS particles of 2TB capacity is used, and the read and write performance of the solid state drive is tested when using a PLC system and when using a non-PLC system under the same test environment. The test data obtained are shown in the following table.
[0091]
[0092] In the above table, SEQ1M Q8T1 indicates the speed obtained by testing in a sequential read / write mode with a bit depth of 1024KB, 1 thread and 8 queues. RND4K Q32T16 indicates the speed obtained by testing in a random read / write mode with a bit depth of 1024*4KB, 16 threads and 32 queues. RND4K Q1T1 indicates the speed obtained by testing in a random read / write mode with a bit depth of 1024*4KB, 1 thread and 1 queue.
[0093] Based on the data in the above table, it can be seen that the performance of the solid-state hard disk using the PLC system is better than that of the traditional non-PLC system solid-state hard disk, whether sequential reading and writing or random reading and writing. That is, the method provided by the embodiment of the present invention greatly improves the performance of the solid-state hard disk.
[0094] In order to execute the corresponding steps in the above embodiments and various possible methods, a method for implementing a storage space allocation device is provided below. Figure 3 , is a functional module diagram of a storage space allocation device provided by an embodiment of the present invention. It should be noted that the basic principle and technical effects of the storage space allocation device 300 provided by this embodiment are the same as those of the above embodiment. For the sake of brief description, for the parts not mentioned in this embodiment, reference can be made to the corresponding contents in the above embodiment. The storage space allocation device 300 includes:
[0095] A marking module 310, configured to check the health status of each data block, and mark each data block whose health status is completely bad as a bad block;
[0096] The acquisition module 330 is used to acquire each data block except all bad blocks from all data blocks to obtain a set of blocks to be processed;
[0097] The allocation module 350 is used to allocate the set of blocks to be processed to obtain a first storage space and a second storage space; wherein the first storage space is used as a system area and the second storage space is used as a user area.
[0098] Optionally, the allocation module 350 is also used to: in the set of blocks to be processed, obtain each data block whose serial number is less than a preset reference serial number to obtain a first block set, and obtain each data block whose serial number is greater than or equal to the reference serial number to obtain a second block set; from the first block set, obtain multiple data blocks with a healthy status of all good that match the preset system area capacity and use them as first data blocks to obtain a first storage space composed of all first data blocks; use each data block in the first block set except all first data blocks and each data block in the second block set as second data blocks to obtain a second storage space composed of all second data blocks.
[0099] Optionally, the allocation module 350 is further configured to: during the operation of the solid state drive, after erasing any first data block in the first storage space, reallocate the erased first data block to the first storage space.
[0100] Optionally, the allocation module 350 is further configured to: during the operation of the solid state drive, after erasing any second data block in the second storage space, reallocate the erased second data block to the second storage space.
[0101] Optionally, the storage space allocation device 300 also includes a writing module 370, which is used to: in the process of writing data, for any data page to be written, select a first target buffer from n first buffers according to the data page to be written, and perform a verification operation on the data page to be written, and cache the verification result of the data page to be written to the first target buffer.
[0102] Optionally, the writing module 370 is further configured to: calculate a remainder n according to the sequence number of the data page to be written, and use a first buffer having a number consistent with the remainder as a first target buffer.
[0103] Optionally, the storage space allocation device 300 also includes a recycling module 390, which is used to: during the garbage collection process, for any data page to be recovered, select a second target buffer from n second buffers according to the data page to be recovered, perform a verification operation on the data page to be recovered, and cache the verification result of the data page to be recovered to the second target buffer.
[0104] Optionally, the recycling module 390 is further configured to: calculate a remainder n according to the sequence number of the data page to be recycled, and use the sum of the remainder and n as a target value, and use a second buffer having a number consistent with the target value as a second target buffer.
[0105] The embodiment of the present invention also provides a solid state hard disk, which is used to implement the storage space allocation method disclosed in the embodiment of the present invention. And the embodiment of the present invention also provides a block diagram of the solid state hard disk, please refer to Figure 4 The solid state drive 100 includes a processor 110, a memory 120, and a flash memory 130, and each component is electrically connected to each other directly or indirectly to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.
[0106] The processor 110 is used to read / write data or programs stored in the memory 120 and execute corresponding functions. It can be a general-purpose processor, such as a CPU (Central Processing Unit), NP (Network Processor), etc.; it can also be a DSP digital signal processor, an ASIC application-specific integrated circuit, an FPGA off-the-shelf programmable gate array or other programmable logic devices, discrete gates or transistor logic devices, and discrete hardware components.
[0107] The memory 120 is used to store programs or data. The memory 120 can be a RAM (Random Access Memory), a ROM (Read Only Memory), a PROM (Programmable Read-Only Memory), an EPROM (Erasable Programmable Read-Only Memory), an EEPROM (Electric Erasable Programmable Read-Only Memory), etc.
[0108] The flash memory 130 is used to store data for exchange and transmission with other electronic devices, and the flash memory 130 may be NAND Flash.
[0109] Understandably, Figure 4 The structure shown is only a schematic diagram of the structure of the solid state drive 100. The solid state drive 100 may also include Figure 4 More or fewer components as shown, or with Figure 4 Different configurations shown. Figure 4 Each component shown in the figure can be implemented by hardware, software or a combination thereof.
[0110] In several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, program segment or a part of the code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0111] In addition, the functional modules in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.
[0112] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0113] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A storage space allocation method, characterized in that: Applied to a solid state drive, all data blocks in the solid state drive adopt the SLC mode, and the storage space allocation method includes: Checking the health status of each of the data blocks, and marking each data block with a health status of being completely bad as a bad block; From all data blocks, obtain each data block except all bad blocks to obtain a set of blocks to be processed; The set of blocks to be processed is allocated to obtain a first storage space and a second storage space; wherein the first storage space is used as a system area and the second storage space is used as a user area.
2. The storage space allocation method according to claim 1, characterized in that: Each of the data blocks has a serial number, and the health status of each data block in the set of blocks to be processed is fully good or half good; The step of allocating the set of blocks to be processed to obtain a first storage space and a second storage space comprises: In the block set to be processed, each data block having a sequence number less than a preset reference sequence number is obtained to obtain a first block set, and each data block having a sequence number greater than or equal to the reference sequence number is obtained to obtain a second block set; From the first block set, a plurality of data blocks in good health status matching the preset system area capacity are obtained and used as first data blocks, thereby obtaining a first storage space composed of all the first data blocks; Each data block except all first data blocks in the first block set and each data block in the second block set are used as second data blocks to obtain a second storage space composed of all second data blocks.
3. The storage space allocation method according to claim 2, characterized in that: The storage space allocation method further includes: During the operation of the solid state hard disk, after an erasing operation is performed on any first data block in the first storage space, the erased first data block is reallocated to the first storage space.
4. The storage space allocation method according to claim 2, characterized in that: The storage space allocation method further includes: During the operation of the solid state hard disk, after an erasing operation is performed on any second data block in the second storage space, the erased second data block is reallocated to the second storage space.
5. The storage space allocation method according to claim 1, characterized in that: The solid state hard disk has n first buffers reserved, and the storage space allocation method further includes: During the data writing process, for any data page to be written, a first target buffer is selected from the n first buffers according to the data page to be written, and a verification operation is performed on the data page to be written, and the verification result of the data page to be written is cached in the first target buffer.
6. The storage space allocation method according to claim 5, characterized in that: Each of the first buffers has a number and the numbers of the n first buffers are continuous, and the data page to be written has a sequence number; The step of selecting a first target buffer from the n first buffers according to the data page to be written comprises: A remainder is calculated for n according to the sequence number of the to-be-written data page, and a first buffer whose number is consistent with the remainder is used as a first target buffer.
7. The storage space allocation method according to claim 6, characterized in that: The solid state hard disk has n second buffers reserved, and the storage space allocation method further includes: During the garbage collection process, for any data page to be recycled, a second target buffer is selected from the n second buffers according to the data page to be recycled, and a verification operation is performed on the data page to be recycled, and the verification result of the data page to be recycled is cached in the second target buffer.
8. The storage space allocation method according to claim 7, characterized in that: Each of the second buffers has a number and the numbers of the n second buffers are continuous, the numbers of the n first buffers are continuous with the numbers of the n second buffers, and the data page to be recycled has a sequence number; The step of selecting a second target buffer from the n second buffers according to the data page to be recycled includes: A remainder is calculated for n according to the sequence number of the to-be-reclaimed data page, and the sum of the remainder and n is used as a target value, and a second buffer having a number consistent with the target value is used as a second target buffer.
9. A storage space allocation device, characterized in that: Applied to a solid state drive, all data blocks in the solid state drive adopt the SLC mode, and the storage space allocation device includes: A marking module, used for checking the health status of each of the data blocks, and marking each data block with a health status of being completely bad as a bad block; An acquisition module is used to acquire each data block except all bad blocks from all data blocks to obtain a set of blocks to be processed; An allocation module is used to allocate the set of blocks to be processed to obtain a first storage space and a second storage space; wherein the first storage space is used as a system area and the second storage space is used as a user area.
10. A solid state hard disk, characterized in that: Used to implement the storage space allocation method described in any one of claims 1 to 8.
Citation Information
Patent Citations
NANDFLASH management method based on FAT file system
CN101667189A
Memorizer processing method and device
CN107783723A
Solid state disk physical block management method and system
CN112445429A
Solid state disk garbage collection algorithm based on reinforcement learning
CN114185492A
Bad block management method and system for industrial-grade solid state disk, medium and product
CN118312109A
Cited By
Hard disk management method, electronic equipment, storage medium and program product
CN120540610A
Hard disk management method, electronic device, storage medium, and program product
CN120540610B