A system garbage collection method and a garbage collection method in a solid state hard disk
By modifying the logical address correspondence of the solid-state drive in the system controller, data migration between logical block groups is realized without actual data movement, which solves the write amplification problem caused by system garbage collection and extends the service life of the solid-state drive.
Patent Information
- Application Number
- CN201811233512.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2018-09-12
- Filing Date
- 2018-10-23
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2038-10-23
AI Technical Summary
Existing system garbage collection methods result in increased write amplification in SSDs because valid data needs to be moved between logical block groups, thereby increasing the number of write operations.
By determining the logical block group to be recycled in the system controller, and modifying the correspondence between its logical address and the actual address without actually moving the data, a new logical block group is created to migrate valid data and reduce write amplification. The specific method is: the system controller determines the logical block group to be recycled, creates a new logical block group, and modifies the corresponding relationship in the solid-state drive so that valid data does not need to be actually moved in the new logical block group.
It effectively reduces the number of write amplifications, extends the service life of the solid state drive, and improves the efficiency of the storage system.
Smart Images

Figure CN110895513B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of storage, and more specifically, to a system garbage collection method and a solid state drive garbage collection method. Background Art
[0002] Flash array refers to a storage system that includes a solid-state drive and a system controller. The system controller assigns logical addresses to the solid-state drive in units of logical block groups (CKGs). When there is insufficient free space in the system, the system controller will perform system garbage collection. During the system garbage collection operation, the system controller instructs the solid-state drive to move all valid data in the logical block group to a new logical block group, which causes the valid data to be moved inside the solid-state drive. Therefore, the number of write amplifications increases. Summary of the invention
[0003] The present application proposes a system garbage collection method and a garbage collection method in a solid-state hard disk, which can reduce the number of write amplifications.
[0004] In a first aspect, a system garbage collection method is provided, which is applied to a flash memory array, wherein the flash memory array includes a system controller and multiple solid-state hard disks. The system controller determines a first logic block group to be recycled, wherein the first logic block group includes multiple first data logic blocks, wherein the multiple first data logic blocks are distributed in different solid-state hard disks, wherein at least one of the multiple first data logic blocks stores data including valid data, wherein the address of the valid data in the first logic block is a first logical address, and the first logical address has a corresponding relationship with the actual address of the valid data stored in the solid-state hard disk. The system controller creates a second logic block group, wherein the second logic block group includes multiple second data logic blocks, wherein the second logic block group includes second data logic blocks, wherein at least one second data logic block is distributed in the solid-state hard disk where the first data logic block storing the valid data is located. The system controller allocates a second logical address to the valid data in at least one of the second data logic blocks, and then instructs the solid-state hard disk storing the valid data to modify the corresponding relationship between the first logical address and the actual address to the corresponding relationship between the second logical address and the actual address.
[0005] In the system garbage collection method provided in the first aspect, the first logical block group to be recovered includes multiple first data logical blocks, and the data stored in at least one first data logical block is valid data. Since at least one data logical block of the created second logical block group is distributed in the solid state hard disk where the first data logical block storing the valid data is located, the valid data does not need to be actually moved. It is only necessary to instruct the solid state hard disk storing the valid data to modify the corresponding relationship between the first logical address and the actual address to the corresponding relationship between the second logical address and the actual address, so that the valid data in at least one data logical block in the first logical block group to be recovered can be migrated to the created second logical block group. Since the valid data is not actually moved, write amplification can be reduced.
[0006] Among the multiple data logical blocks included in the first logical block group, only some of the data logical blocks (or even only one data logical block) may store valid data. In this case, when creating the second logical block group, it is only necessary to ensure that some of the data logical blocks or one data logical block in the second logical block group are distributed in the solid-state hard disk where the data logical blocks storing valid data in the first data logical block group are located, so that the valid data in the first logical block group can be migrated to the second logical block group without actually moving the valid data. In addition, it can be understood that even if some or all of the data logical blocks in the first logical block group store valid data, as long as it is ensured that at least one data logical block in the created second logical block group is distributed in the solid-state hard disk where the data logical blocks storing valid data in the first data logical block group are located, write amplification can be reduced to a certain extent.
[0007] Optionally, in another implementation, each data logic block included in the second logic block group is distributed in the solid state disk where one of the data logic blocks included in the first logic block group is located. In this way, write amplification can be minimized.
[0008] In a first implementation of the first aspect, the number of the first data logic blocks storing valid data is the same as the number of the at least one second data logic block. For example, if there is a first data logic block in the first logic block group that stores valid data, then there is also a second data logic block in the second logic block group that is distributed in the solid-state hard disk where the first data logic block storing the valid data is located. If there are two first data logic blocks in the first logic block group that store valid data, then there are also two second data logic blocks in the second logic block group that are respectively distributed in the solid-state hard disks where the two first data logic blocks storing the valid data are located. If each first data logic block in the first logic block group stores valid data, then all second data logic blocks in the second logic block group must also be distributed in the solid-state hard disks where all first data logic blocks are located.
[0009] In combination with the first implementation of the first aspect, in the second implementation of the first aspect, the creation of the second logical block group may specifically be to create the second logical block group according to the distribution of the plurality of first data logical blocks in the plurality of solid-state hard disks, and all the second data logical blocks in the created second logical block group are distributed in the solid-state hard disks where all the first data logical blocks are located. The second logical block group created in this manner can minimize write amplification.
[0010] In combination with any of the above implementations, in a third implementation of the first aspect, the first logic block group also includes a first verification logic block, and the first verification logic block is distributed in a solid-state hard disk different from the multiple first data logic blocks, and the second logic block group also includes a second verification logic block, and the second verification logic block is distributed in a solid-state hard disk different from the multiple second data logic blocks. The number of first verification logic blocks and the number of second verification logic blocks are the same, and are both determined according to the RAID type. The solid-state hard disk where the second verification logic block is located can be the same as or different from the solid-state hard disk where the first verification logic block is located. Normally, after valid data is migrated from the first logic block group to the second logic block group, the verification data needs to be recalculated and stored, so the present application does not limit the distribution of the second verification logic block.
[0011] In combination with any of the above implementations, in a fourth implementation of the first aspect, the first logical block group to be recycled can be selected according to certain conditions. For example, when the amount of valid data contained in a certain logical block group in the flash memory array is lower than a set threshold, it can be used as the first logical block group to be recycled. Alternatively, when the amount of invalid data contained in a certain logical block group in the flash memory array is higher than the set threshold, it can be used as the first logical block group to be recycled. Alternatively, the logical block group with the most invalid data or the least valid data in the flash memory array is selected as the first logical block group to be recycled. This can improve the efficiency of system garbage collection.
[0012] The second aspect provides a garbage collection method in a solid-state hard disk, which is applied to a solid-state hard disk, and the solid-state hard disk is connected to a system controller. The solid-state hard disk reads valid data and reverse mapping information of the valid data from a first physical block to be recycled, and sends the reverse mapping information of the valid data to the system controller, thereby obtaining a source logical address corresponding to the reverse mapping information. Then, the solid-state hard disk assigns a target logical address to the valid data, and copies the valid data to a second physical block. Then, the corresponding relationship between the source logical address and the actual address of the valid data stored in the first physical block is deleted, and a corresponding relationship between the target logical address and the actual address of the valid data information stored in the second physical block is created. Finally, the solid-state hard disk erases the data in the first physical block.
[0013] The reverse mapping information in the second aspect can be the virtual address of the valid data, the fingerprint of the valid data, or the offset address of the valid data in the file. As long as the information can be used to find the actual address of the valid data through the forward index, it is within the protection scope of this application.
[0014] The reverse mapping information of the data is usually written into the solid-state drive as a whole together with the data. This is to facilitate the search for the logical address of the data when performing garbage collection inside the solid-state drive to modify the correspondence between the logical address and the actual address in the flash translation layer. Traditionally, the reverse mapping information refers to the logical address of the data. However, in the present application, in order to keep the actual address of the valid data unchanged, it is also necessary to ensure that the actual address of the reverse mapping information of the valid data does not change. When the valid data is migrated from the first logical block group to the second logical block group, its logical address will change. Therefore, in the present application, the reverse mapping information of the valid data cannot be the logical address of the data, but can be the virtual address of the data, or information such as the fingerprint of the data.
[0015] Therefore, according to the implementation of the second aspect of the present application, the logical address of the valid data can be queried from the system controller according to the reverse mapping information of the valid data, thereby completing garbage collection inside the solid-state hard disk.
[0016] The third aspect of the present application provides a system controller, which includes an interface and a processor, wherein the interface is used to connect to a plurality of solid state drives, and the processor is used to execute any one of the methods of the first aspect.
[0017] A fourth aspect of the present application provides a system garbage collection device, which is located in a system controller of a flash memory array and is used to execute any one of the methods of the first aspect.
[0018] In a fifth aspect, the present application provides a solid state drive, the solid state drive comprising a flash memory controller, a first physical block and a second physical block. The flash memory controller is used to execute the method in the second aspect.
[0019] A sixth aspect of the present application provides a garbage collection device in a solid state drive, used to execute the method of the second aspect.
[0020] A seventh aspect of the present application provides a flash memory array, which includes a system controller and a solid state drive, wherein the system controller is used to execute any one of the methods of the first aspect, and the solid state drive is used to execute the method of the second aspect.
[0021] An eighth aspect of the present application provides a computer program product for system garbage collection, comprising a computer-readable storage medium storing program code, wherein the program code includes instructions for executing the method described in the first aspect.
[0022] A ninth aspect of the present application provides a computer program product for garbage collection in a solid-state hard disk, comprising a computer-readable storage medium storing program code, wherein the program code includes instructions for executing the method described in the second aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 is an application scenario diagram provided by an embodiment of the present invention;
[0024] Figure 2 is a structural diagram of a controller provided by an embodiment of the present invention;
[0025] Figure 3 is a schematic diagram of a logic block group provided by an embodiment of the present invention;
[0026] Figure 4 is a schematic diagram of a data writing process provided by an embodiment of the present invention;
[0027] Figure 5 is a flow chart of a system garbage collection method provided by an embodiment of the present invention;
[0028] Figure 6 is a schematic diagram of a system garbage collection method provided by an embodiment of the present invention;
[0029] Figure 7 is a flow chart of a garbage collection method in a solid state drive provided by an embodiment of the present invention;
[0030] Figure 8 is a schematic diagram of the structure of a system garbage collection device provided by an embodiment of the present invention;
[0031] Fig. 9 It is a structural schematic diagram of a garbage collection device in a solid state hard disk provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0032] The embodiment of the present invention provides a system garbage collection method and a storage system, which can reduce write amplification and thus increase the service life of a solid state drive.
[0033] Figure 1 A composition diagram of a flash memory array provided by an embodiment of the present invention is depicted. Figure 1 The flash memory array shown includes at least one controller (such as Figure 1 The controller 11 shown) and multiple solid state hard disks 22 (such as Figure 1 The controller 11 is connected to a host (not shown) via a storage area network (SAN). The controller 11 may be a computing device, such as a server, a desktop computer, and the like. An operating system and an application are installed on the controller 11. The controller 11 may receive input and output (I / O) requests from the host. The controller 11 may also store data (if any) carried in the I / O request and write the data to the solid state drive 22. A solid state drive (SSD) is a memory using a flash memory chip as a medium, also known as a solid state drive (SSD).
[0034] Figure 1 This is only an exemplary description. In actual applications, the storage system may include two or more controllers. The physical structure and function of each controller are similar to those of the controller 11. In addition, this embodiment does not limit the connection between controllers, and between any controller and the solid-state drive 22. As long as the controllers and the controllers and the solid-state drive 22 can communicate with each other. In addition, in this embodiment, when the controller 11 sends instructions to the solid-state drive, it often sends them to multiple solid-state drives. For the convenience of description, the set including multiple solid-state drives 22 is called a solid-state drive group.
[0035] Figure 2 is a structural example diagram of the controller 11, such as Figure 2 As shown, the controller 11 includes an interface card 110 , a processor 112 and an interface card 113 .
[0036] The interface card 110 is used to communicate with the host, and the controller 11 can receive the operation instructions of the host through the interface card 110. The processor 112 may be a central processing unit (CPU). In an embodiment of the present invention, the processor 112 can be used to receive an I / O request from the host and process the I / O request. The I / O request may be a write data request or a read data request, and the processor 112 can also send the data in the write data request to the solid state drive 22. In addition, the processor 112 can also be used to perform system garbage collection operations. The interface card 113 is used to communicate with the solid state drive 22, and the controller 11 can send the write data request (including data, the logical address of the data, and the virtual address of the data) to the solid state drive 22 for storage through the interface card 113.
[0037] Optionally, the controller 11 may also include a memory 111. The memory 111 is used to temporarily store data received from the host or data read from the solid state drive 22. When the controller 11 receives multiple write data requests sent by the host, the data in the multiple write data requests may be temporarily stored in the memory 111. When the capacity of the memory 111 reaches a certain threshold, the data stored in the memory 111, the virtual address of the data, and the logical address assigned to the data are sent to the solid state drive 22. The solid state drive 22 stores the data. The memory 111 includes a volatile memory, a flash memory chip, or a combination thereof. Volatile memory is, for example, a random access memory (RAM). Flash memory chips are various machine-readable media that can store program codes, such as floppy disks, hard disks, solid state drives (SSDs), optical disks, etc. The memory 111 has a power-saving function, which means that when the system loses power and then powers on again, the data stored in the memory 111 will not be lost.
[0038] After the data is written into the flash memory array, the controller 11 needs to record the validity of the data. The validity of the data is determined by whether the data has been modified. If the data is written for the first time, the data can be recorded as valid (called valid data). If the data is modified, the data before the modification is recorded as invalid (called invalid data). Specifically, a bitmap can be used to record the validity of the data. For example, each "bit" of the bitmap corresponds to a logical address of data with a size of 1KB. When the "bit" is 1, it means that the data stored in the logical address is valid. When the "bit" is 0, it means that the data stored in the logical address is invalid. The bitmap can be stored in the memory 111 or in a solid-state hard disk.
[0039] It should be noted that the controller 11 belongs to the system controller, which is an independent device and is different from the control chip in the solid state drive. In this embodiment, the control chip of the solid state drive is called a flash memory controller.
[0040] The solid state drive 22 includes a flash memory controller and a plurality of flash memory chips. The flash memory controller is used to execute operations such as a write data request or a read data request sent by the controller 11. The flash memory controller can be a processor located inside the solid state drive 22, or a field programmable gate array (FPGA) located outside the solid state drive 22.
[0041] The flash controller includes a flash translation layer (FTL). The flash translation layer is used to store the correspondence between the logical address of the data and the actual address. Therefore, the flash translation layer is used to convert the logical address in the write data request or read data request sent by the system controller into the actual address of the data in the solid-state hard disk. The logical address of the data is a subset of the logical address range assigned by the system controller and provided to the system controller by the solid-state hard disk. The logical address of the data includes a starting logical address and a length. The starting logical address indicates the position of the logical block group where the data is located, and the length represents the size of the data. The actual address of the data can be the physical address of the data in the solid-state hard disk, or it can be an address that is virtualized based on the physical address and is only visible to the flash controller. The virtualized actual address is not visible to the system controller. Usually, the physical address includes the number of the physical block where the data is located and the number of the page.
[0042] SSDs usually include one or more flash memory chips. Each flash memory chip includes several physical blocks (referred to as "blocks"). SSDs are based on a page when reading or writing, but erase operations can only be based on a physical block. The erase operation means setting all bits of this block to "1". Before erasing, the flash memory controller needs to copy the valid data in this physical block to a blank page of another block.
[0043] Each physical block contains multiple pages (English: page). When the solid-state hard disk executes a write data request, it writes data in units of pages. For example, the controller 11 sends a write data request to the flash memory controller. The write data request includes the logical address of the data. After receiving the write data request, the flash memory controller continuously writes the data into one or more physical blocks in the order of the time received. Continuously writing one or more physical blocks means that the flash memory controller searches for a blank physical block and writes the data into the blank physical block until the blank physical block is filled. When the size of the data exceeds the capacity of the physical block, the flash memory controller searches for the next blank physical block and continues writing. The flash memory translation layer establishes and saves the correspondence between the logical address and the actual address of the page where the data is written. When the controller 11 sends a read data request to the flash memory controller to read the data, the read data request includes the logical address. The flash memory controller reads the data according to the logical address and the correspondence between the logical address and the actual address, and sends the data to the controller 11.
[0044] In a flash array, a single solid-state drive may fail, resulting in data loss. This embodiment uses Redundant Array of Inexpensive Disks (RAID) technology to protect data. The following describes a mechanism for redundant protection of data in a solid-state drive.
[0045] First, the controller 11 manages the space of the solid state drive in the form of a logical block (English: chunk, abbreviated as: CK). A logical block is a spatial concept, and its size is 4MB for example, but is not limited to 4MB. Logical blocks from different solid state drives can constitute a logical block set, and the controller 11 divides the logical blocks in this logical block set into a data logical block group and a check logical block group according to the set RAID type. The data logical block group includes at least two logical blocks for storing data, and the check logical block group includes at least one check logical block for storing the check data of the data. In this embodiment, the logical block set including the data logical block group and the check logical block group is called a logical block group. When the controller 11 fills up a certain size of data in the memory 111, it can be divided into multiple data units according to the set RAID type, and the check unit is calculated, and the data unit and the check unit are sent to the solid state drive to be stored in the logical block group. Each logical block in the data group is used to store the data unit, and each logical block in the check group is used to store the check unit. After storage, these data units and the corresponding check units constitute a stripe. A logical block group includes multiple stripes.
[0046] The data unit and the check unit contained in the stripe can be referred to as a stripe unit. In this embodiment, the size of the stripe unit is 8KB, but it is not limited to 8KB. Figure 3 As shown, it is assumed that one logic block is taken out from each of the five solid-state hard disks to form a logic block set, and then the controller 11 groups the logic blocks in the logic block set according to the RAID type (taking RAID6 as an example), for example, logic block 1, logic block 2 and logic block 3 are data logic block groups, and logic block 4 and logic block 5 are check logic block groups. When the data stored in the memory 111 reaches 24KB (8KB*3), the data is divided into 3 data units, each of which is 8KB, and then 2 check units are calculated, each of which is also 8KB. The controller 11 sends these data units and check units to the solid-state hard disk and stores them in the logic block group (such as Figure 3 It can be understood that, according to the redundancy protection mechanism of RAID6, when any two data units or check units fail, the failed units can be reconstructed based on the remaining data units or check units.
[0047] Combine the following Figure 4 Describe the data writing method provided by the embodiment of the present invention, which can be applied to Figure 1 shown in the flash array and can be Figure 2 The processor 112 in the controller 11 shown in the figure executes or the solid state drive 22 executes. Figure 4 As shown, the method comprises the following steps:
[0048] 401: The controller 11 receives a write data request sent by the host, and the write data request includes the data to be written and the virtual address of the data to be written. The controller 11 provides its storage space to the host in the form of a logical unit (LU), and there is a binding relationship between the host and one or more logical units. When the user sends the data to be written to the controller 11 through the host, it is usually necessary to specify the virtual address for storing the data. Specifically, the virtual address is the identifier of the logical unit and the offset address of the data located in the logical unit.
[0049] 402 : The controller 11 writes the data to be written into the memory 111 .
[0050] 403: When the data in the memory 111 fills up a stripe size, the controller 11 determines a target stripe for receiving the data. Figure 3The logical address of the target stripe is a subset of the logical address of the logical block group in which it is located. The stripe size referred to here actually refers to the size of all data units in the stripe. Then, the controller 11 calculates the check data of these data. The data and the check data together constitute a stripe.
[0051] 404: The controller 11 allocates a logical address to the target stripe. It should be understood that the logical address here is different from the virtual address in 401, which is visible to the controller 11 and the host but not to the SSD 22, while the logical address in 404 is visible to the controller 11 and the SSD 22 but not to the host.
[0052] The controller 11 needs to determine whether there is an allocated logical block group. If there is an allocated logical block group and the logical block group still has enough space to accommodate the data, then the controller 11 can instruct the multiple solid-state hard disks to write the data into the allocated logical block group. Specifically, the controller 11 obtains an unused logical address from the logical address interval of the allocated logical block group, and sends the logical address to the solid-state hard disk 22 in 405 in the write data request. If the controller 11 determines that there is no allocated logical block group in the system, or the allocated logical block groups are full of data, then the controller 11 needs to create a new logical block group. The creation process can be that the controller 11 determines that the remaining space in the system is sufficient to create a new logical block group based on its own record of the available space owned by each solid-state hard disk. Next, the controller 11 obtains a logical block from each solid-state hard disk 22, and constructs these logical blocks into a new logical block group according to the set RAID type (see Figure 3 Description of the logical block group). Then, the controller 11 allocates a segment of logical addresses to each logical block, and these logical address sets are the logical addresses of the new logical block group. Among the logical addresses of the new logical block group, the controller 11 can obtain one segment as the logical address of the target stripe.
[0053] 405: The controller 11 sends write data instructions to multiple solid-state hard disks 22 respectively. Since the data in the target stripe should be distributed in multiple solid-state hard disks, it is necessary to send a write data instruction to each solid-state hard disk 22 in the multiple solid-state hard disks. The number of solid-state hard disks 22 that receive the write data instruction depends on the RAID type. Taking the RAID type of 3+2 (3 data units and 2 check units) as an example, the data in the target stripe will be distributed in 5 solid-state hard disks. Therefore, the controller 11 needs to generate 5 write data instructions, each of which is sent to one of the 5 solid-state hard disks. Each write data instruction carries the partial data or partial check data, as well as the logical address of the partial data or partial check data, and the virtual address of the partial data or partial check data. It should be understood that the logical address in each write data instruction is a subset of the logical address assigned by the controller 11 to the target stripe, and the virtual address in each write data instruction comes from the write data request sent by the host.
[0054] 406: For each solid state drive 22 that receives the write data instruction, the solid state drive 22 writes the data in the write data instruction and the virtual address of the data into a physical block. Optionally, the write data instruction can be a custom command to ensure that the data and the virtual address are written into the same physical block. The address of the data in the block is called the actual address (including the number of the physical block where the data is located and the number of the page). After writing, the solid state drive 22 saves the correspondence between the logical address of the data and the actual address in the flash translation layer.
[0055] The virtual address written into the physical block together with the data is also called reverse mapping information, which enables the solid state drive 22 to obtain the logical address of the data according to the virtual address of the data when performing on-disk garbage collection, and find the logical address of the data from the flash translation layer and modify it to a new logical address.
[0056] 407: After the SSD 22 successfully writes the data into the block, the controller 11 creates a correspondence between the virtual address of the data and the logical address. Subsequently, if the host sends a data read request to read the data in the virtual address, the controller 11 can read the data from the SSD 22 according to the correspondence between the virtual address and the logical address.
[0057] In the prior art, the reverse mapping information written into the physical block together with the data is the logical address of the data. Since the logical address of the data describes the location of the data in the logical block group, when the data is migrated from one logical block group to another logical block group, its logical address will change. Then, this also means that the data information containing the data and the logical address of the data will change. In this embodiment, in order to only change the logical block group to which the data information belongs during the system garbage collection process without actually moving the data, the system controller writes the data and the virtual address of the data, rather than the logical address, into the physical block when writing the data. This is because the virtual address of the data does not change during this process.
[0058] exist Figure 4 In the illustrated implementation, the reverse mapping information refers to the virtual address of the data, because when the data migrates between logical block groups, the virtual address of the data does not change. Optionally, in another implementation, the reverse mapping information refers to the fingerprint of the data, and the so-called fingerprint refers to the result obtained by performing a hash operation on the data. Or, the reverse mapping information is the offset address of the data in the file. Optionally, in a flash memory array with a key-value (KV) interface, the write data request sent by the host to the controller 11 contains the keyword of the data to be written, rather than the virtual address, and the keyword is obtained by calculating the virtual address. In this case, the reverse mapping information refers to the keyword of the data to be written, and accordingly, in 407, the controller 11 creates a corresponding relationship between the keyword of the data information and the logical address. Optionally, in a flash memory array with a log interface, the write data request sent by the host to the controller 11 contains the log address of the data to be written, rather than the virtual address. In this case, the reverse mapping information refers to the log address of the data to be written, and accordingly, in 407, the controller 11 creates a corresponding relationship between the log address of the data information and the logical address. In general, the reverse mapping information in the embodiments of the present invention refers to any information that can find the actual address of the data through the forward index, and is not limited to the various situations listed above. When the data is migrated between logical block groups, the information does not change. In the following description, this embodiment still takes the virtual address as an example. If the reverse mapping information refers to other information that can find the actual address of the data through the forward index, the operation method is similar.
[0059] In order to ensure that there is always enough free space in the flash array for creating logical block groups, the controller 11 can monitor the free space of each solid-state drive 22 in real time or regularly to obtain the free space of the entire system. When the free space of the system is lower than the set space threshold, the system garbage collection is started. For example, the capacity of a solid-state drive 22 is 128G, Figure 1 The total capacity of all solid-state drives contained in the flash array shown (assuming that the flash array contains 10 solid-state drives) is 1280G, and the space threshold can be set to 640G. That is to say, when the data stored in the flash array reaches half of the total capacity, the remaining available space also reaches the space threshold, and the controller 11 can perform system garbage collection at this time. It can be understood that 640G is just an example of a space threshold, and the space threshold can also be set to other values. In addition, when the used space of the system reaches the set space threshold, system garbage collection can also be triggered. System garbage collection is different from garbage collection inside the solid-state drive. Garbage collection inside the solid-state drive is completed by the solid-state drive itself.
[0060] Normally, the controller 11 performs system garbage collection in units of logical block groups. For example, the controller 11 obtains the logical address of valid data in a logical block group according to the bitmap, and sends the logical address of the valid data to the solid state drive group, so that each solid state drive 22 can read the data according to the logical address of the valid data and send it to the controller 11. The controller 11 assigns a new logical address to the valid data, and the new logical address belongs to the new logical block group, and sends the assigned new logical address to the solid state drive group. After each solid state drive 22 writes the valid data into a new physical block, it saves the mapping relationship between the actual address and the new logical address. Then, the controller 11 sends a demapping (English: unmap) command or a trim command to the solid state drive group, and the demapping command includes the logical address interval of the logical block group to be recycled. After receiving the demapping command, each solid state drive 22 deletes the corresponding relationship between the logical address of the logical address interval saved in the flash translation layer and the actual address. The solid state drive 22 can also mark the block corresponding to the actual address of the valid data before the move as a block that does not contain valid data or directly erase the block that does not contain valid data. Subsequently, the controller 11 may release the logical address interval of the to-be-reclaimed logical block group and the actual physical space (which may also be understood as the actual address) occupied by the logical block group.
[0061] It can be seen that system garbage collection will cause data to be moved between physical blocks, thereby increasing write amplification. An embodiment of the present invention provides a system garbage collection method that can complete the migration of valid data between logical block groups during system garbage collection without actually moving the data, thereby reducing write amplification.
[0062] Combine the following Figure 5 and Figure 6 Describe the system garbage collection method provided by the embodiment of the present invention, which can be applied to Figure 1 shown in the flash array and can be Figure 2 The processor 112 in the controller 11 shown in the figure executes. Figure 5 is a flow chart of the system garbage collection method provided in this embodiment. Figure 6 Figure 1 is a schematic diagram of implementing data migration between two logical block groups. Figure 5 As shown, the method comprises the following steps:
[0063] 501: When there is insufficient free space in the storage system, the controller 11 selects at least one logical block group from a plurality of logical block groups as an object of garbage collection. The selected logical block group needs to meet certain conditions, such as the invalid data contained in the logical block group reaches a first set threshold, or the logical block group is the logical block group containing the most invalid data among the plurality of logical block groups, or the valid data contained in the logical block group is lower than a second set threshold, or the logical block group is the logical block group containing the least valid data among the plurality of logical block groups. The amount of invalid data or valid data can be counted according to the bitmap described above. For the convenience of description, this embodiment refers to the selected logical block group for garbage collection as the first logical block group.
[0064] according to Figure 3 and Figure 6 From the description of the logic block group, it can be seen that the first logic block group includes a first data logic block group and a first check logic block group, and the first data logic block group includes at least two data logic blocks for storing data. The first check logic block group includes at least one logic block for storing check data. Each data logic block included in the first data logic block group and the check logic block included in the first check logic block group are from different solid state drives.
[0065] The first logic block group contains valid data and invalid data. Usually, during the system garbage collection process, the valid data in the first logic block group needs to be migrated to a new logic block group, and then the first logic block group is released. In this embodiment, the position where the valid data in the first logic block group is located in the first logic block group is the first logical address. There is a corresponding relationship between the first logical address and the actual address where the valid data is stored in the solid state drive.
[0066] 502: The controller 11 creates a second logic block group according to the distribution of the first data logic block group in the multiple solid-state hard disks. The second logic block group is a logic block group that receives valid data in the first logic block group. The RAID type of the created second logic block group is the same as the RAID type of the first logic block group. Therefore, the second logic block group includes a second data logic block group and a second check logic block group, wherein the number of data logic blocks included in the second data logic block group is the same as the number of data logic blocks included in the first data logic block group, and the number of check logic blocks included in the second check logic block group is the same as the number of check logic blocks included in the first check logic block group. In addition, the distribution of the second data logic block group in the multiple solid-state hard disks is the same as the distribution of the first data logic block group in the multiple solid-state hard disks. For example, logic block 1, logic block 2, and logic block 3 included in the first data logic block group are respectively located in solid-state hard disk 22A, solid-state hard disk 22B, and solid-state hard disk 22C. According to the distribution of logic block 1, logic block 2 and logic block 3 in these solid state drives, the controller 11 obtains a data logic block from each of solid state drives 22A, solid state drives 22B and solid state drives 22C to create a second logic block group. That is, the logic block 1', logic block 2' and logic block 3' in the second logic block group are also located in solid state drives 22A, solid state drives 22B and solid state drives 22C, respectively. Figure 6 As shown, the logic block 1 included in the first logic block group is distributed in the solid state drive 22A. In order to create the second logic block group, the controller 11 obtains the logic block 1' from the solid state drive 22A. Similarly, for the data logic block 2 and the data logic block 3 included in the first logic block group, the controller 11 also obtains the data logic block 2' and the data logic block 3' from the corresponding solid state drive according to their distribution in the solid state drive.
[0067] However, this embodiment does not require the controller 11 to create a second check logic block group according to the distribution of the first check block group in the multiple solid-state hard disks. In fact, the controller 11 can freely select a solid-state hard disk that provides a check logic block from the multiple solid-state hard disks, as long as it does not overlap with a solid-state hard disk that provides a data logic block. This is because, usually, the check data stored in the second check logic block needs to be recalculated rather than directly migrated from the first check logic block.
[0068] In 502, each data logic block included in the second logic block group is distributed in the solid state disk where one of the data logic blocks included in the first logic block group is located. However, in another embodiment, as long as at least one data logic block in the second logic block group is distributed in the solid state disk where the data logic block storing valid data in the first logic block group is located, the write amplification can be reduced to a certain extent. Moreover, it can be understood that the data stored in the data logic blocks included in the first data logic block group may be valid data or invalid data. That is to say, among the multiple data logic blocks, only some data logic blocks (or even only one data logic block) may store valid data. Then when creating the second logic block group, it is only necessary to ensure that some data logic blocks or one data logic block in the second logic block group are distributed in the solid state disk where the data logic block storing valid data in the first data logic block group is located, and the garbage collection of the first logic block group can be performed.
[0069] 503: The controller 11 allocates a second logical address to the valid data in the first logical block group. Figure 6 The shaded small square in the logic block 1 shown, it should be noted that, Figure 6 The shaded small squares shown are only a part of the valid data in the first logic block group, and the valid data may also be distributed in data logic block 2 and data logic block 3. The allocated second logical address is a subset of the logical address of the second logic block group. The second logic block group created in 502 can be used not only to store valid data in one logic block group, but also to store valid data in multiple logic block groups.
[0070] 504: The controller 11 modifies the first logical address of the valid data stored in the memory 111 to the second logical address. In the traditional system garbage collection, the controller 11 needs to read the valid data from the first logical block group and rewrite it into the second logical block group. This means that the valid data will be moved between the physical blocks of the solid state drive, and accordingly, the logical address and the actual address of the valid data will change. In this embodiment, the valid data is migrated from the first logical block group to the second logical block group, and only the logical address of the valid data needs to be modified (the first logical address belonging to the first logical block group is modified to the second logical address belonging to the second logical block group), and the actual storage location of the valid data in the solid state drive does not change. That is, in this embodiment, only the logical address of the valid data needs to be changed, and the actual address of the valid data does not change. Exemplarily, before the system garbage collection is performed on the first logical block group, the controller 11 stores the corresponding relationship between the virtual address of the valid data and the first logical address. In 504, the controller 11 can modify the corresponding relationship between the virtual address of the valid data and the first logical address to the corresponding relationship between the virtual address and the allocated second logical address.
[0071] 505: The controller 11 sends a mapping relationship modification instruction to the multiple solid-state hard disks, and the mapping relationship modification instruction is used to instruct the multiple solid-state hard disks to modify the correspondence between the first logical address of the valid data and the actual address to the correspondence between the second logical address and the actual address. In 504, the controller 11 changes the logical address of the valid data, and the change of the logical address also needs to be notified to the solid-state hard disk to ensure that the logical addresses of the valid data stored in the controller 11 and the solid-state hard disk 22 are consistent, so as to facilitate the future reading of the valid data. It can be understood that since each of the multiple solid-state hard disks stores some valid data, the controller 11 needs to send a mapping relationship modification instruction to each solid-state hard disk to instruct the solid-state hard disk to modify the correspondence of the part of the valid data stored in it.
[0072] It is understandable that if there is only one first data logic block in the first logic block group that contains valid data, and the created second logic block group also has only one second data logic block in the solid state drive that is the same as the solid state drive where the first data logic block storing valid data is located, then the controller 11 only needs to send a mapping relationship modification instruction to the solid state drive where the first data logic block containing valid data is located. Similarly, if there are a certain number (greater than or equal to 2) of first data logic blocks in the first logic block group that contain valid data, and the created second logic block group also has the same number of second data logic blocks in the solid state drive that is the same as the solid state drive where the first data logic block storing valid data is located, then the controller 11 only needs to send a mapping relationship modification instruction to the solid state drive storing valid data.
[0073] In another case, there are N (N is an integer greater than or equal to 2) first data logic blocks in the first logic block group containing valid data, and the solid state disk where the created second logic block group has M (M is an integer greater than or equal to 1) second data logic blocks is located is the same as the solid state disk where some of the N first data logic blocks are located, and M is less than N. In this case, the controller 11 only needs to send a mapping relationship modification instruction to the solid state disks where the M first data logic blocks are located.
[0074] Figure 5 The system garbage collection method shown can be implemented in the entire flash memory array, and can also be applied to a partial area of the flash memory array. For example, the logical addresses provided by the multiple solid-state hard disks 22 to the controller 11 can be divided into two sets, wherein the system garbage collection in the first set adopts the method provided by the embodiment of the present invention, and the system garbage collection in the second set adopts the traditional method.
[0075] After all valid data in the first logical block group is migrated to the second logical block group, all data in the first logical block group becomes invalid data. At this time, the controller 11 can transmit the information that the data of the first logical block group becomes invalid data (for example, the logical address of the first logical block group) to each solid-state hard disk 22 distributed in the first logical block group. The solid-state hard disk 22 marks the invalid data in the physical block according to the information. When the solid-state hard disk 22 performs internal garbage collection, the physical block containing the invalid data can be directly recovered without copying the valid data.
[0076] Figure 5The illustrated embodiment introduces the process of system garbage collection. As can be seen from the above description, system garbage collection is triggered and completed by the controller 11. However, the solid state drive 22 can also perform its own garbage collection. The garbage collection inside the solid state drive is tentatively referred to as in-disk garbage collection. Most of the operations of in-disk garbage collection are completed by the flash memory controller, and in a few cases, the controller 11 needs to cooperate. Figure 7 FIG. 1 is a flow chart of a method for collecting garbage on a disk provided in this embodiment. Figure 7 As shown, the method includes the following steps.
[0077] 701: When there are insufficient free blocks in the solid state drive 22, the flash memory controller of the solid state drive 22 selects at least one physical block to be reclaimed from a plurality of physical blocks. Figure 1 Any solid state drive shown. The selected physical block needs to meet certain conditions, such as the invalid data contained in the physical block reaches a third set threshold, or the physical block is the physical block with the most invalid data among the multiple physical blocks, or the valid data contained in the physical block is lower than a fourth set threshold, or the physical block is the physical block with the least valid data among the multiple physical blocks. For the convenience of description, the physical block selected for garbage collection is referred to as the first physical block in this embodiment.
[0078] The amount of invalid data or valid data can be counted according to the bitmap inside the solid state drive 22. The solid state drive 22 stores a bitmap, and the bitmap, as shown in Table 1, is used to describe the validity of the data stored in the actual address.
[0079] Physical address Effectiveness Physical address Effectiveness Block0, page0 0 Block1, page0 0 Block0, page1 0 Block1, page1 1 Block0, page2 1 Block1, page2 1 …… …… …… …… Block0, pageN 0 Block1, pageN 0
[0080] Among them, "0" represents that the data stored in the address is invalid data, and "1" represents that the data stored in the address is valid data. According to the bitmap, the solid state drive 22 can obtain the amount of valid data or invalid data of each physical block, thereby selecting the first physical block to be recycled.
[0081] 702: The flash memory controller reads valid data and a virtual address of the valid data from the first physical block. The actual address of the valid data, such as block0, page2, can be known from Table 1. However, the solid state drive 22 reads the stored valid data from the actual address. Since the virtual address of the data and the data are stored as a whole, the virtual address of the valid data can be read when reading the valid data.
[0082] 703: The flash memory controller sends the virtual address to the controller 11. If the logical address of the valid data and the valid data are stored together in a conventional manner, the solid state drive 22 can directly obtain the logical address of the valid data. However, in this embodiment, the solid state drive 22 stores the virtual address of the valid data instead of the logical address, so the solid state drive 22 needs to send the virtual address to the controller 11 to query the logical address of the valid data.
[0083] 703: The flash memory controller receives the logical address corresponding to the virtual address sent by the controller 11. The controller 11 stores the correspondence between the virtual address and the logical address. For example, the logical address here can be Figure 5 The second logical address in the illustrated embodiment may also be referred to as a source logical address.
[0084] 704: The flash memory controller allocates a target logical address.
[0085] 705: The flash memory controller copies the valid data to a second physical block, where the second physical block is a blank physical block. Since the valid data and the virtual address of the valid data are stored as a whole, when the flash memory controller copies the valid data to the second physical block, it also copies the virtual address of the valid data to the second physical block.
[0086] 706: After the copying is completed, the flash memory controller modifies the corresponding relationship stored in the flash memory translation layer. Specifically, the flash memory controller deletes the corresponding relationship between the source logical address and the actual address where the valid data is stored in the first physical block, and creates a corresponding relationship between the target logical address and the actual address where the valid data is stored in the second physical block.
[0087] 707: Erase the data in the first physical block.
[0088] In the same way, the solid state drive 22 can select other physical blocks as objects of garbage collection and repeat steps 701 to 707 , thereby completing the garbage collection inside the entire solid state drive 22 .
[0089] exist Figure 7 In the description shown, this embodiment uses virtual addresses as an example. However, it is understandable that the virtual addresses can be replaced by other forms of reverse mapping information. In this case, the operation mode of on-disk garbage collection is the same as that of Figure 7 The described method is similar and will not be repeated here.
[0090] In addition, this embodiment is also applicable to another storage system, which includes a system controller and multiple Shingled Magnetic Recording (SMR) hard disks. The storage system can also execute Figure 4 , Figure 5 as well as Figure 7 The method flow shown only requires replacing the solid-state hard disk with a shingled magnetic recording technology hard disk, which will not be repeated here.
[0091] Figure 8 is a schematic diagram of the structure of a system garbage collection device provided by an embodiment of the present invention. The device is located in the controller 11 of the flash memory array. Figure 8 As shown, the device includes a determination module 801 , a creation module 802 , an allocation module 803 and an indication module 804 .
[0092] Among them, the determination module 801 is used to determine the first logic block group to be recycled, the first logic block group includes multiple first data logic blocks, and the multiple first data logic blocks are distributed in different solid-state hard disks included in the flash memory array, wherein at least one of the multiple first data logic blocks stores data including valid data, and the location of the valid data in the first logic block is a first logical address, and the first logical address has a corresponding relationship with the actual address of the valid data stored in the solid-state hard disk. The function of this module can be executed by the processor 112 alone or by the processor 112 calling the program in the memory 111 to execute, and the specific reference can be made to Figure 5 The step 501 and related descriptions shown are not repeated here.
[0093] The creation module 802 is used to create a second logic block group, wherein the second logic block group includes a plurality of second data logic blocks, wherein at least one of the second data logic blocks is distributed in the solid state disk where the first data logic block storing the valid data is located. The functions of this module can be executed by the processor 112 alone or by the processor 112 calling a program in the memory 111 for execution. For details, please refer to Figure 5 Step 502 and related descriptions are not repeated here.
[0094] The allocation module 803 is used to allocate a second logical address to the valid data in the second logical block distributed in the solid state disk where the first logical block storing the valid data is located. The function of this module can be executed by the processor 112 alone or by the processor 112 calling the program in the memory 111 to execute. For details, please refer to Figure 5 Step 503 and related descriptions are not repeated here.
[0095] The instruction module 804 is used to instruct the solid state disk storing the valid data to modify the correspondence between the first logical address and the actual address to the correspondence between the second logical address and the actual address. The function of this module can be executed by the processor 112 alone or by the processor 112 calling the program in the memory 111 to execute. For details, please refer to Figure 5 Step 505 and related descriptions are not repeated here.
[0096] Fig. 9 is a schematic diagram of the structure of a garbage collection device in a solid state drive provided by an embodiment of the present invention. Fig. 9 As shown, the device includes a processing module 901 and a recovery module 902 .
[0097] The processing module 901 is used to read the valid data and the reverse mapping information of the valid data from the first physical block to be recycled; send the reverse mapping information to the system controller; receive the source logical address corresponding to the reverse mapping information sent by the system controller; assign a target logical address to the valid data, and copy the valid data to the second physical block. The functions of this module can be executed by the controller inside the solid state drive 22. For details, please refer to Figure 7 Steps 701 to 705 and related descriptions are not repeated here.
[0098] The recovery module 902 is used to delete the corresponding relationship between the source logical address and the actual address where the valid data is stored in the first physical block, create the corresponding relationship between the target logical address and the actual address where the valid data is stored in the second physical block, and erase the data in the first physical block. The functions of this module can be executed by the controller inside the solid state drive 22. For details, please refer to Figure 7 Steps 706 to 707 and related descriptions are not repeated here.
[0099] Those skilled in the art will appreciate that various aspects of the present invention, or possible implementations of various aspects, can be specifically implemented as systems, methods or computer program products. Therefore, various aspects of the present invention, or possible implementations of various aspects, can adopt the form of complete hardware embodiments, complete software embodiments (including firmware, resident software, etc.), or combined software and hardware embodiments, all collectively referred to as "circuit", "module" or "system" here. In addition, various aspects of the present invention, or possible implementations of various aspects, can adopt the form of computer program products, which refer to computer-readable program codes stored in computer-readable media.
[0100] Computer readable media include but are not limited to electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, apparatuses or devices, or any suitable combination of the foregoing, such as random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), and optical disks.
[0101] The processor in the computer reads the computer-readable program code stored in the computer-readable medium, so that the processor can execute the functional actions specified in each step or a combination of steps in the flowchart.
[0102] Computer readable program code can be executed completely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or completely on a remote computer or server. It should also be noted that in some alternative embodiments, the functions noted in each step in the flow chart or each block in the block diagram may not occur in the order noted in the figure. For example, depending on the function involved, two steps or two blocks shown in succession may actually be performed roughly simultaneously, or these blocks may sometimes be performed in reverse order.
[0103] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0104] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. A person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A system garbage collection method, characterized in that: The method is applied to a flash memory array, the flash memory array includes a system controller and a plurality of solid state hard disks, and the method is executed by the system controller, including the following steps: Determine a first logic block group to be recycled, the first logic block group includes a plurality of first data logic blocks, the plurality of first data logic blocks are distributed in different solid state hard disks, wherein data stored in at least one first data logic block among the plurality of first data logic blocks includes valid data, the location of the valid data in the first logic block is a first logic address, and the first logic address has a corresponding relationship with an actual address where the valid data is stored in the solid state hard disk; Creating a second logical block group, wherein the second logical block group includes a plurality of second data logical blocks, wherein at least one of the second data logical blocks is distributed in the solid state drive where the first data logical block storing the valid data is located, and the RAID type of the second logical block group is the same as the RAID type of the first logical block group; assigning a second logical address to the valid data in the at least one second logical block; Instruct the solid state hard disk storing the valid data to modify the correspondence between the first logical address and the actual address to the correspondence between the second logical address and the actual address.
2. The method according to claim 1, characterized in that The number of the first data logic blocks storing valid data is the same as the number of the at least one second data logic block.
3. The method according to claim 2, characterized in that The creation of the second logical block group includes: creating a second logical block group according to the distribution of the multiple first data logical blocks in the multiple solid-state hard drives, and the multiple second data logical blocks included in the second logical block group are distributed in the same solid-state hard drives as the multiple first data logical blocks.
4. The method according to any one of claims 1 to 3, characterized in that: The first logic block group also includes a first verification logic block, which is distributed in a solid state drive different from the multiple first data logic blocks. The second logic block group also includes a second verification logic block, which is distributed in a solid state drive different from the multiple second data logic blocks.
5. The method according to claim 4, characterized in that The solid state disk where the second verification logic block is located is the same as the solid state disk where the first verification logic block is located.
6. The method according to claim 4, characterized in that The solid state disk where the second verification logic block is located is different from the solid state disk where the first verification logic block is located.
7. The method according to claim 1, characterized in that Before determining the first logic block group to be recycled, the method further includes determining that the amount of valid data in the first logic block group is lower than a set threshold.
8. A system controller, characterized in that: The system controller comprises: An interface for communicating with multiple solid-state drives; and A processor is used to determine a first logic block group to be recycled, wherein the first logic block group includes a plurality of first data logic blocks, and the plurality of first data logic blocks are distributed in different solid state hard disks, wherein data stored in at least one first data logic block among the plurality of first data logic blocks includes valid data, and the location of the valid data in the first logic block is a first logic address, and the first logic address has a corresponding relationship with an actual address where the valid data is stored in the solid state hard disk; Creating a second logical block group, wherein the second logical block group includes a plurality of second data logical blocks, wherein at least one of the second data logical blocks is distributed in the solid state drive where the first data logical block storing the valid data is located, and the RAID type of the second logical block group is the same as the RAID type of the first logical block group; assigning a second logical address to the valid data in the at least one second logical block; The solid state drive storing the valid data is instructed, through the interface, to modify the correspondence between the first logical address and the actual address to the correspondence between the second logical address and the actual address.
9. The system controller according to claim 8, characterized in that: The number of the first data logic blocks storing valid data is the same as the number of the at least one second data logic block.
10. The system controller according to claim 9, characterized in that: The processor is specifically used to create a second logic block group according to the distribution of the multiple first data logic blocks in the multiple solid-state hard disks, and the multiple second data logic blocks contained in the second logic block group are distributed in the same solid-state hard disk as the multiple first data logic blocks.
11. The system controller according to any one of claims 8 to 10, characterized in that: The first logic block group also includes a first verification logic block, which is distributed in a solid state drive different from the multiple first data logic blocks. The second logic block group also includes a second verification logic block, which is distributed in a solid state drive different from the multiple second data logic blocks.
12. The system controller according to claim 11, characterized in that: The solid state disk where the second verification logic block is located is the same as the solid state disk where the first verification logic block is located.
13. The system controller according to claim 11, characterized in that: The solid state disk where the second verification logic block is located is different from the solid state disk where the first verification logic block is located.
14. The system controller according to claim 8, characterized in that: The processor is further configured to determine, before determining the first logic block group to be recycled, that the amount of valid data in the first logic block group is lower than a set threshold.
15. A flash memory array, characterized in that: Includes system controller and multiple solid-state drives; The system controller is used to determine a first logic block group to be recycled, the first logic block group includes a plurality of first data logic blocks, the plurality of first data logic blocks are distributed in different solid state hard disks, wherein data stored in at least one first data logic block among the plurality of first data logic blocks includes valid data, the location of the valid data in the first logic block is a first logic address, and the first logic address has a corresponding relationship with an actual address of the valid data stored in the solid state hard disk; Creating a second logical block group, wherein the second logical block group includes a plurality of second data logical blocks, wherein at least one of the second data logical blocks is distributed in the solid state drive where the first data logical block storing the valid data is located, and the RAID type of the second logical block group is the same as the RAID type of the first logical block group; assigning a second logical address to the valid data in the at least one second logical block; Instruct the solid state hard disk storing the valid data to modify the correspondence between the first logical address and the actual address to the correspondence between the second logical address and the actual address.
16. The flash memory array according to claim 15, characterized in that: The number of the first data logic blocks storing valid data is the same as the number of the at least one second data logic block.
17. The flash memory array according to claim 16, wherein: The system controller is specifically used to create a second logic block group according to the distribution of the multiple first data logic blocks in the multiple solid-state hard disks, and the multiple second data logic blocks included in the second logic block group are distributed in the same solid-state hard disk as the multiple first data logic blocks.
18. The flash memory array according to any one of claims 15 to 17, characterized in that: The first logic block group also includes a first verification logic block, which is distributed in a solid state drive different from the multiple first data logic blocks. The second logic block group also includes a second verification logic block, which is distributed in a solid state drive different from the multiple second data logic blocks.
19. The flash memory array according to claim 15, characterized in that: The solid state drive storing the valid data is further used to read the valid data and reverse mapping information of the valid data from the first physical block where the valid data is located; and send the reverse mapping information to the system controller; The system controller is further configured to query a second logical address corresponding to the reverse mapping information according to the reverse mapping information, and send the second logical address to the solid state drive storing the valid data; The solid state drive storing the valid data is further used to allocate a third logical address to the valid data, and copy the valid data to a second physical block; The solid state drive storing the valid data is further used to delete the correspondence between the second logical address and the actual address, and to create a correspondence between the third logical address and the actual address where the valid data is stored in the second physical block; The solid state drive storing the valid data is further configured to erase the data in the first physical block when it is determined that the first physical block does not contain other valid data.
20. The flash memory array according to claim 19, wherein: The reverse mapping information includes a virtual address of the valid data.
21. A garbage collection method in a solid state hard disk, characterized in that: The solid state drive is connected to the system controller, and the method is executed by the solid state drive, comprising the following steps: Reading valid data and reverse mapping information of the valid data from the first physical block to be recovered; sending the reverse mapping information to the system controller; receiving a source logical address corresponding to the reverse mapping information sent by the system controller; assigning a target logical address to the valid data, and copying the valid data to a second physical block; Deleting the correspondence between the source logical address and the actual address where the valid data is stored in the first physical block, and creating a correspondence between the target logical address and the actual address where the valid data is stored in the second physical block; The data in the first physical block is erased.
22. The method according to claim 21, characterized in that The reverse mapping information includes a virtual address of the valid data.
23. A solid state hard disk, characterized in that: comprising a controller, a first physical block and a second physical block; The controller is used to: Reading valid data and reverse mapping information of the valid data from the first physical block to be recycled; sending the reverse mapping information to a system controller; receiving a source logical address corresponding to the reverse mapping information sent by the system controller; assigning a target logical address to the valid data, and copying the valid data to the second physical block; Deleting the correspondence between the source logical address and the actual address where the valid data is stored in the first physical block, and creating a correspondence between the target logical address and the actual address where the valid data is stored in the second physical block; The data in the first physical block is erased.
24. The solid state drive according to claim 23, wherein: The reverse mapping information includes a virtual address of the valid data.
25. A system garbage collection device, characterized in that: The device is located in a system controller of a flash memory array, and comprises: a determination module, configured to determine a first logic block group to be recycled, wherein the first logic block group includes a plurality of first data logic blocks, and the plurality of first data logic blocks are distributed in different solid-state hard disks included in the flash memory array, wherein data stored in at least one first data logic block among the plurality of first data logic blocks includes valid data, and the location of the valid data in the first logic block is a first logic address, and the first logic address has a corresponding relationship with an actual address of the valid data stored in the solid-state hard disk; a creation module, configured to create a second logic block group, wherein the second logic block group includes a plurality of second data logic blocks, wherein at least one of the second data logic blocks is distributed in the solid state drive where the first data logic block storing the valid data is located, and the RAID type of the second logic block group is the same as the RAID type of the first logic block group; an allocation module, configured to allocate a second logical address to the valid data in the at least one second logical block; The instruction module is used to instruct the solid state disk storing the valid data to modify the correspondence between the first logical address and the actual address to the correspondence between the second logical address and the actual address.
26. The device according to claim 25, characterized in that The number of the first data logic blocks storing valid data is the same as the number of the at least one second data logic block.
27. The device according to claim 26, characterized in that The creation module is specifically used to create a second logic block group according to the distribution of the multiple first data logic blocks in the multiple solid-state hard drives, and the multiple second data logic blocks contained in the second logic block group are distributed in the same solid-state hard drives as the multiple first data logic blocks.
28. The device according to any one of claims 25 to 27, characterized in that: The first logic block group also includes a first verification logic block, which is distributed in a solid state drive different from the multiple first data logic blocks. The second logic block group also includes a second verification logic block, which is distributed in a solid state drive different from the multiple second data logic blocks.
29. The device according to claim 25, characterized in that The determination module is further configured to determine that the amount of valid data in the first logic block group is lower than a set threshold before determining the first logic block group to be recycled.
30. A garbage collection device in a solid state hard disk, characterized in that: include: A processing module, used for reading valid data and reverse mapping information of the valid data from the first physical block to be recycled; sending the reverse mapping information to a system controller; receiving a source logical address corresponding to the reverse mapping information sent by the system controller; assigning a target logical address to the valid data, and copying the valid data to a second physical block; A recycling module is used to delete the corresponding relationship between the source logical address and the actual address where the valid data is stored in the first physical block, create a corresponding relationship between the target logical address and the actual address where the valid data is stored in the second physical block; and erase the data in the first physical block.
31. The device according to claim 30, characterized in that The reverse mapping information includes a virtual address of the valid data.
