Data deletion and garbage collection method, device, system and storage medium
By implementing the FTL layer function on the host side, the GC function is combined with the data deletion operation, and the logic block of the data unit is to be deleted to be deleted. Writing life.
Patent Information
- Application Number
- CN201911078152.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-11-06
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2039-11-06
AI Technical Summary
The garbage collection mechanism of existing solid-state drives (SSDs) will bring about obvious write amplification problems, affecting the reliability of SSDs.
By implementing the FTL layer function of the solid -state hard drive on the side of the host, the GC function based on the FTL address mapping relationship is combined with the data deletion operation in the operating system. During the data deletion process, delete the metadata of the data unit to be deleted and mark the logic block it occupied as the deleted state, which means that it is in an invalid state. During the GC process, the logical block and FTL address mapping relationship marked as the deleted state are combined to determine the recyclable physical block in the solid -state hard disk and the garbage recovery.
By optimizing the GC process, the write amplification is reduced and the reliability of SSD is improved. It is expected that the write amplification can be reduced by 2 to 3 times, and the write life of the solid state drive is improved.
Smart Images

Figure CN112783420B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of storage technology, and in particular to a data deletion and garbage collection method, device, system and storage medium. Background Art
[0002] Solid State Drive (SSD), commonly known as SSD, is a type of hard disk made using a solid-state electronic storage chip array. Compared with traditional hard disks, it has the advantages of higher speed, lower power consumption, and lower noise, and is therefore becoming increasingly popular.
[0003] Existing SSDs mostly use a log structure-based writing method, which involves the issue of garbage collection (GC). Simply put, the GC process is to migrate all valid data in several physical blocks to a new block, and then erase these blocks to generate available blocks. The existing SSD garbage collection mechanism will bring about a more obvious write amplification problem. Summary of the invention
[0004] Multiple aspects of the present application provide a data deletion and garbage collection method, device, system and storage medium to optimize the GC process, reduce write amplification, and improve the reliability of SSD.
[0005] An embodiment of the present application provides a data deletion method applicable to a host including a solid-state hard disk, the method comprising: in response to a data deletion operation, marking a logical block occupied by a data unit to be deleted as a deleted state, and deleting the metadata of the data unit to be deleted; wherein the deleted state indicates that the data unit to be deleted is in an invalid state in the solid-state hard disk.
[0006] An embodiment of the present application also provides a garbage collection method, which is applicable to a host including a solid-state hard disk, and the method includes: determining a logical block marked as a deleted state, wherein the deleted state indicates that a data unit corresponding to the logical block marked as a deleted state is in an invalid state in the solid-state hard disk; determining a recyclable physical block in the solid-state hard disk based on a mapping relationship between the logical block marked as a deleted state and an FTL address, and performing garbage collection on the recyclable physical block.
[0007] An embodiment of the present application also provides a computer device, comprising: a memory and a processor; the memory comprises: a non-solid-state hard disk and a solid-state hard disk, the non-solid-state hard disk stores a data deletion program, and the solid-state hard disk stores data units to be deleted; the processor, coupled to the memory, is used to execute the data deletion program, so as to: in response to a data deletion operation, mark the logical block occupied by the data unit to be deleted as a deleted state, and delete the metadata of the data unit to be deleted; wherein the deleted state indicates that the data unit to be deleted is in an invalid state in the solid-state hard disk.
[0008] An embodiment of the present application also provides a computer device, comprising: a memory and a processor; the memory comprises: a non-solid-state hard disk and a solid-state hard disk, the non-solid-state hard disk stores a garbage collection program, and the solid-state hard disk stores various data units; the processor, coupled to the memory, is used to execute the garbage collection program to: determine a logical block marked as a deleted state, the deleted state indicating that the data unit corresponding to the logical block marked as a deleted state is in an invalid state in the solid-state hard disk; determine the recyclable physical blocks in the solid-state hard disk according to the mapping relationship between the logical block marked as a deleted state and the FTL address, and perform garbage collection on the recyclable physical blocks.
[0009] An embodiment of the present application also provides a storage system based on a solid-state drive, comprising: a host and a solid-state drive mounted on the host; the host is used to, in response to a data deletion operation, mark a logical block occupied by a data unit to be deleted as a deleted state, and delete the metadata of the data unit to be deleted; wherein the data unit to be deleted is stored in the solid-state drive, and the deleted state indicates that the data unit to be deleted is in an invalid state in the solid-state drive.
[0010] An embodiment of the present application also provides a storage system based on a solid-state hard disk, including: a host and a solid-state hard disk mounted on the host; the host is used to determine a logical block marked as a deleted state, wherein the deleted state indicates that a data unit corresponding to the logical block marked as a deleted state is in an invalid state in the solid-state hard disk; based on the mapping relationship between the logical block marked as a deleted state and the FTL address, determine the reclaimable physical blocks in the solid-state hard disk, and perform garbage collection on the reclaimable physical blocks.
[0011] The embodiments of the present application also provide a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the processor implements the steps in the methods provided in the embodiments of the present application.
[0012] An embodiment of the present application also provides a data processing method applicable to a host including an open channel SSD, the method comprising: in response to a data deletion operation, deleting the metadata of the data unit to be deleted; and marking the logical block occupied by the data unit to be deleted as a deleted state to indicate that the data unit to be deleted is in an invalid state in the open channel SSD.
[0013] An embodiment of the present application also provides a garbage collection method, which is applicable to a host including an open channel SSD, and the method includes: in response to a garbage collection triggering event, determining a logical block marked as deleted; determining a reclaimable physical block in the open channel SSD based on a mapping relationship between the logical block marked as deleted and an FTL address; and performing garbage collection on the reclaimable physical block.
[0014] In an embodiment of the present application, the FTL layer function of the solid-state drive is implemented on the host side, and the GC function based on the FTL address mapping relationship is combined with the data deletion operation in the operating system. In the process of data deletion, the corresponding logical block is marked as deleted to indicate that the data unit to be deleted is in an invalid state in the solid-state drive; further, in the GC process, the logical block marked as deleted and the FTL address mapping relationship can be combined to determine the recyclable physical blocks in the solid-state drive, which is conducive to selecting physical blocks with a relatively small number of valid pages for recycling, which can reduce the amount of data moved during the GC process, optimize the GC process to a certain extent, reduce write amplification, and improve the reliability of the SSD. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0016] Figure 1a A schematic diagram of a storage system based on a solid state drive provided for an exemplary embodiment of the present application;
[0017] Figure 1b A schematic diagram of the relationship between an FTL address mapping table, a bitmap and a status table provided for an exemplary embodiment of the present application;
[0018] Figure 1c The exemplary embodiments of the present application provide Figure 1a A schematic diagram of a working principle of a host in the storage system shown;
[0019] Figure 2 A flowchart of a data deletion method provided for an exemplary embodiment of the present application;
[0020] Figure 3aA schematic flow chart of a GC method provided for an exemplary embodiment of the present application;
[0021] Figure 3b A schematic flow chart of another GC method provided for an exemplary embodiment of the present application;
[0022] Figure 4 A schematic diagram of the structure of a computer device provided for an exemplary embodiment of the present application;
[0023] Figure 5 A schematic diagram of the structure of another computer device provided for an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0024] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0025] The existing GC mechanism will bring about a relatively obvious write amplification problem. To address this technical problem, in some embodiments of the present application, the FTL layer function of the solid-state drive is implemented on the host side, and the GC function based on the FTL address mapping relationship is combined with the data deletion operation in the operating system. In the process of data deletion, the corresponding logical block is marked as deleted to indicate that the data unit to be deleted is in an invalid state in the solid-state drive; further, in the GC process, the logical block marked as deleted and the FTL address mapping relationship can be combined to determine the recyclable physical blocks in the solid-state drive, which is conducive to selecting physical blocks with a relatively small number of valid pages for recycling, which can reduce the amount of data moved during the GC process, optimize the GC process to a certain extent, reduce write amplification, and improve the reliability of the SSD.
[0026] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0027] Figure 1a The following is a schematic diagram of a storage system based on a solid state drive provided by an exemplary embodiment of the present application. Figure 1a As shown, the storage system 100 includes: a host 101 and a solid state drive 102 mounted on the host 101 .
[0028] In this embodiment, the host 101 is not limited in any way, and all computer devices that require storage resources are applicable to the embodiments of this application. For example, the host 101 can be a terminal device such as a desktop computer, a laptop computer, a tablet computer, a smart phone, a game console, an MP3 player, a video camera, a camera, a television, or a smart speaker. For another example, the host 101 can also be a server device such as some conventional servers, cloud servers, or server arrays. For another example, the host 101 can also be some edge computing devices, such as street lights, signal lights, or traffic monitoring equipment. Traffic monitoring equipment can include, but is not limited to, various cameras or electronic eyes.
[0029] In this embodiment, there is no limitation on the solid-state hard disk 102, and it generally refers to any hard disk made of a solid-state electronic storage chip array. For example, from the perspective of the interface protocol, the solid-state hard disk 102 of this embodiment can be a solid-state hard disk that supports various interface protocols such as SATA-2, SATA-3, SAS, MSATA, PCIE, NGFF or CFast. For another example, from the perspective of the storage medium, the solid-state hard disk 102 of this embodiment can be a solid-state hard disk that uses flash memory (Flash) as the storage medium, or a solid-state hard disk that uses DRAM as the storage medium.
[0030] In this embodiment, the solid state drive 102 is connected to the host 101, but the connection method between the solid state drive 102 and the host 101 is not limited. Optionally, the solid state drive 102 can be fixedly installed in a hard disk position on the host 101, or can be inserted in the host 101 in a plug-in manner, or can be externally connected to the host 101. Among them, the solid state drive 102 can be used as a cache of a low-speed storage medium on the host 101, and can also be used as the final storage space of the host 101.
[0031] Regardless of how the SSD 102 is connected to the host 101, and regardless of the type of the SSD 102, for the host 101, the SSD 102 is a storage device, and the operating system of the host 101 can manage the storage of the SSD 102 through the file system. Among them, the file system generally uses the logical block address (Logical Block Address, LBA) to manage the storage space. In other words, for the user, the storage space is directly operated by the LBA; the LBA used by the user when performing read and write operations on the storage space will be mapped to the physical block address (Physics Block Address, PBA), thereby completing the reading and writing of the storage space.
[0032] Considering that the file system on the host 101 may not be specially designed for the solid-state drive 102, and may not be operated according to the characteristics of the solid-state drive 102, in order to facilitate the successful operation (such as reading) of the solid-state drive 102, the conversion can be performed through the Flash Translation Layer (FTL). The FTL layer is located between the file system and the solid-state drive 102, and is mainly responsible for address mapping from LBA to PBA and GC, etc. Because the FTL layer exists between the file system and the solid-state drive 102, the file system only needs to operate the logical block address (Logical Block Address, LBA) as before, and all conversion work from LBA to PBA is entirely handled by the FTL layer. In other words, the data unit written by the file system is only written to the logical address in the file system. After passing through the FTL layer, the data unit is finally written to the physical address of the solid-state disk 102. The FTL layer can convert the file system's operation on LBA into an operation on PBA, so as to achieve the purpose of the file system operating the solid-state drive 102.
[0033] With the help of the conversion function of the FTL layer between the file system and the solid-state drive 102, the file system on the host 101 side can organize and manage the data units stored in the solid-state drive 102, and the solid-state drive 102 can support any type of file system. For example, the file system can be various file systems such as ext2, ext3, ext4, xfs, brtfs, zfs, etc., or it can be a file system customized for a specific scenario. In addition, given that the solid-state drive 102 can support any type of file system, the solid-state drive 102 can also flexibly support various storage types, as long as the file system is compatible with the storage type supported by the solid-state drive 102. For example, the solid-state drive 102 can support block storage, file storage, or object storage, and accordingly, the file system can use a file system that supports block storage, file storage, or object storage.
[0034] In addition, depending on the storage type supported by the solid-state drive 102, the minimum data unit that the file system or solid-state drive 102 allows to operate will also be different. The operations here may include but are not limited to: reading, writing, deleting or copying. For ease of description, the minimum data unit that the file system or solid-state drive 102 allows to operate is referred to as a data unit. For example, if the solid-state drive 102 supports block storage, the data unit that the solid-state drive 102 or the file system allows to operate is a data block; if the solid-state drive 102 supports file storage, the data unit that the solid-state drive 102 or the file system allows to operate is a file; if the solid-state drive 102 supports object storage, the data unit that the solid-state drive 102 or the file system allows to operate is an object.
[0035] Among them, from the perspective of storage space, the read and write operations of the file system are performed in units of logical pages (Logical Page), and the deletion operations are performed in units of logical blocks (Logical Block); accordingly, the read and write operations of the solid-state hard disk 102 are performed in units of physical pages (Physics Page), and the erasure operations are performed in units of physical blocks (Physics Block). Among them, a logical block includes a fixed number of consecutive logical pages, and a physical block may include multiple physical pages. This embodiment does not limit the fixed number. It should be noted that in this embodiment, LBA and PBA can correspond to pages (Page), that is, LBA and PBA represent the addresses of logical pages and physical pages respectively; or, LBA and PBA can also correspond to blocks (Block), that is, LBA and PBA represent the addresses of logical blocks and physical blocks respectively.
[0036] In this embodiment, various data units are stored in the solid state drive 102, and the file system maintains metadata of various data units. A data unit refers to actual data in a block storage, file storage, or object storage, i.e., the actual content of a data block, file, or object; and metadata refers to system data used to describe the characteristics of a data unit, including, but not limited to: access rights, the owner of the data unit, the name of the data unit, the size of the data unit, the type of the data unit, the last access time of the data unit, and the storage location of the data unit, etc. When a user operates a data unit, he needs to obtain its metadata first, and then he can locate the storage location of the data unit and some attribute information related to the data unit.
[0037] In this embodiment, the FTL layer function is implemented on the host 101 side. For example, for an open-channel solid state drive, its FTL layer function is no longer implemented in the firmware of the solid state drive 102, but is transferred to the operating system of the host 101 for implementation. In other words, the host 101 of this embodiment can implement the FTL layer function of the solid state drive 102.
[0038] The FTL layer function includes a function of performing address mapping in IO operations on the solid state drive 102. The IO operations on the solid state drive include read operations, write operations, or update operations initiated on the solid state drive 102. In the IO operations on the solid state drive 102, the host 101 can perform IO operations on the solid state drive 102 normally, just like the FTL mechanism inside a common SSD, and update the FTL address mapping relationship and the usage status information of the corresponding physical block in the solid state drive 102 when necessary.
[0039] For example, when a user needs to write data to the solid state drive 102, a write operation to the solid state drive 102 can be initiated to the host 101; the host 101 can respond to the write operation to the solid state drive 102, write data to the solid state drive, and update the FTL address mapping relationship and the use status information of the physical block in the solid state drive 102 where the data is written. Wherein, updating the FTL address mapping relationship can be to add a mapping relationship between the LBA and the PBA corresponding to the newly written data. With such a mapping relationship, when the host 101 needs to read the data later, the PBA can be determined according to the mapping relationship, and then the solid state drive 102 can be accessed according to the PBA, so that the solid state drive 102 knows from which physical position to read the data. Wherein, the use status information of the physical block includes but is not limited to: the state of the physical block, the current write position in the physical block, the number of valid pages in the physical block, the number of erases and writes of the physical block, and the position of the valid page in the physical block. Wherein, the state of the physical block can include: free, allocated, garbage, valid and bad blocks, etc.
[0040] For another example, when the user needs to update the existing data in the solid state drive 102, the host 101 can initiate an update operation on the solid state drive 102; the host 101 can respond to the update operation on the solid state drive 102, write new data in the solid state drive, and update the FTL address mapping relationship and the use status information of the physical block where the data is written in the solid state drive 102. In the update operation, the process of writing new data in the solid state drive is: looking for a new position PBA_Y that has not been written inside the solid state drive 102 to write the new data, and the data at the original position PBA_X becomes old and invalid; the process of updating the FTL address mapping relationship is: establishing a mapping relationship between LBA and position PBA_Y, and releasing the mapping relationship between LBA and position PBA_X. The physical block here refers to the physical block corresponding to PBA_Y. The relevant description of the use status information of the physical block can be found in the above, which will not be repeated here.
[0041] In this embodiment, the host 101 is not limited to the method used to maintain the FTL address mapping relationship and the use status information of the physical block. For example, the host 101 can maintain the FTL address mapping relationship by means of an address mapping table (Map Table). For example, the host 101 can maintain the use status information of the physical block by means of a bitmap (bitmap) and a state table (State Table). The bitmap is used to mark the location of the valid page in the physical block, and the state table is used to record the number of valid pages contained in the physical block, the state of the physical block, the current write position in the physical block, the number of erase and write times of the physical block, and other information. Among them, the relationship between the FTL address mapping table, the bitmap, and the state table is as follows: Figure 1b As shown. Figure 1bIn the FTL address mapping table shown in the figure, LBA and PBA represent logical page and physical page respectively. Figure 1b As shown, LBA0 is mapped to PBA0, LBA1 is mapped to PBA1, ..., LBAn is mapped to PBAm. Figure 1b In the bitmap, "1" indicates that there is a mapping from LBA to PBA, and "0" indicates that there is no mapping from LBA to PBA. Among them, physical pages PBA0 and PBA1 belong to one physical block, and physical page PBAm and several other physical pages belong to another physical block. The positions of PBA0, PBA1 and PBAm in their respective physical blocks are as follows: Figure 1b Further, in Figure 1b In the status table, only the number of valid pages contained in each physical block is shown, and other information is not shown. It should be noted that Figure 1b The information shown is for example only and is not limiting.
[0042] In view of the address conversion and address mapping functions of the above-mentioned FTL layer, GC may be performed with reference to the address mapping of the FTL layer. In other words, the GC process of the solid-state drive 102 is mainly implemented by the host 101. With this advantage, the host 101 can dynamically and flexibly adjust the GC strategy according to the application scenario. Furthermore, with the advantage of the GC process being implemented on the host 101 side, the GC process can also be combined with the file system, specifically, the GC process can be combined with the data deletion process of the file system. By improving the data deletion process and the GC process of the file system, the purpose of optimizing the GC process can be achieved, the write amplification in the GC process can be reduced, and the reliability of the solid-state drive 102 can be improved. The following is combined with Figure 1c The principle block diagram shown here illustrates the improved data deletion process and GC process respectively:
[0043] For ease of description, the data unit to be deleted in this embodiment is referred to as a data unit to be deleted. In the data deletion process of this embodiment, the metadata of the data unit to be deleted will be deleted from the file system, but the data unit to be deleted will not be actually modified. In other words, the operation of "deleting the metadata of the data unit to be deleted from the file system" will not be perceived by the solid-state drive 102, and the data unit to be deleted is still stored in the solid-state drive 102, and before the logical block corresponding to the data unit to be deleted is overwritten and written to other data units, from the perspective of the solid-state drive 102, the data unit to be deleted is still in a valid state. Assume that before the logical block corresponding to the data unit to be deleted is overwritten and written to other data units, the GC mechanism of the solid-state drive 102 is triggered, and the physical block where the data unit to be deleted is located happens to be a physical block that needs to be recycled, then the data unit to be deleted as valid data (actually invalid) will still be moved to other physical blocks, which causes write amplification.
[0044] like Figure 1c As shown, in the data deletion process of this embodiment, not only the metadata of the data unit to be deleted is deleted, but also the logical block occupied by the data unit to be deleted is marked as deleted. Among them, the deleted state of the logical block can indicate that the data unit to be deleted occupying the logical block has been indicated to be deleted, and further can indicate that the data unit to be deleted is in an invalid state in the solid-state hard disk 102. It should be noted that a data unit can occupy one or more logical blocks, that is, the number of logical blocks occupied by the data unit to be deleted can be one or more, and there is no limitation on this, which can be determined by the size of the data unit and the logical block. In addition, this embodiment does not limit the method of marking the logical block, and any method that can mark the logical block as deleted is applicable to the embodiment of the present application.
[0045] By using the GC process of this embodiment to achieve this advantage on the host 101 side, the host 101 can obtain or sense the logical blocks marked as deleted in the above data deletion process. Therefore, based on the above data deletion process, in the GC process of this embodiment, the host 101 can determine the logical blocks marked as deleted, determine the recyclable physical blocks in the solid state drive 102 according to the mapping relationship between the logical blocks marked as deleted and the FTL address, and perform garbage collection on the recyclable physical blocks, such as Figure 1c In the process of determining the reclaimable physical blocks, it is beneficial to select physical blocks with a relatively small number of valid pages for recycling, which can reduce the amount of data moved during the GC process, optimize the GC process to a certain extent, reduce write amplification, and improve the reliability of the SSD.
[0046] In each embodiment of the present application, the manner in which the host 101 maintains the usage status of each logical block in the file system is not limited. In an optional embodiment, in order to facilitate the maintenance of the usage status of each logical block in the file system, a status mapping table may be created for the solid-state drive 102 after the solid-state drive 102 is powered on. The status mapping table may be located in the memory or cache of the host 101 to facilitate quick query. The status mapping table is used to record the usage status of each logical block in the file system. In this embodiment, the usage status of the logical block is divided into: a deleted state and a non-deleted state. Among them, the deleted state indicates that the data stored in the logical block has been instructed to be deleted, that is, the data stored in the logical block is in an invalid state; the non-deleted state indicates that valid data is stored in the logical block, or that the logical block has not yet been allocated (that is, no data is stored and it is in a pending allocation state).
[0047] Optionally, in the process of creating the state mapping table, information such as the overall capacity of the solid-state drive 102 and the format of the file system can be considered. For example, a state mapping table containing multiple bits can be created with the logical blocks contained in the file system as indexes. Each bit in the state mapping table corresponds to a logical block in the file system, and different values of the bit can identify different usage states of the logical block. In this embodiment, a first value and a second value can be set to represent the deleted state and the non-deleted state of the logical block, respectively. The first value and the second value are different values. In one example, the first value is 1 and the second value is 0, that is, if the value of the bit corresponding to the logical block is 1, it means that the logical block is marked as deleted, and if the value of the bit corresponding to the logical block is 0, it means that the logical block is in a non-deleted state. Of course, in other examples, the first value is 0 and the second value is 1; or, the first value is 11 and the second value is 12; and so on.
[0048] Further optionally, after the state mapping table is created, the value of each bit may be initialized to a second value, indicating that each logical block in the file system is in a non-deleted state.
[0049] Furthermore, whenever a data unit needs to be deleted, the host 101 can, on the one hand, delete the metadata of the data unit to be deleted from the file system; on the other hand, the value of the bit corresponding to the logical block occupied by the data unit to be deleted in the state mapping table can be set to the first value, so as to mark the logical block occupied by the data unit to be deleted as deleted, thereby achieving the purpose of identifying that the data unit to be deleted is in an invalid state in the solid state drive 102, such as Figure 1c shown.
[0050] Based on the above-mentioned status mapping table, when the GC process is triggered, the host 101 can determine the logical block corresponding to the bit with the first value in the status mapping table as the logical block marked as deleted in the file system; then, according to the mapping relationship between the logical block marked as deleted and the FTL address, determine the reclaimable physical block in the solid state drive 102, and perform garbage collection on the reclaimable physical block.
[0051] It should be noted that the logical block marked as deleted may correspond to one or more physical blocks; the reclaimable physical blocks may include the physical blocks corresponding to the logical blocks marked as deleted, or may not include the physical blocks corresponding to the logical blocks marked as deleted, which is related to the selection mechanism of the reclaimable physical blocks. If there is a logical block corresponding to the reclaimable physical block in the logical block marked as deleted, then after the reclaimable physical block is garbage collected, the reclaimed physical block will become an available physical block again, and accordingly, the logical block corresponding to the reclaimed physical block will also become an available logical block again. Based on this, in the case that there is a logical block corresponding to the reclaimable physical block in the logical block marked as deleted, the state of the logical block corresponding to the reclaimable physical block in the logical block marked as deleted can be updated to a non-deleted state.
[0052] Further, in combination with the above-mentioned status mapping table, an implementation method of updating the status of the logical block corresponding to the recyclable physical block to a non-deleted status includes: determining a target bit corresponding to the logical block corresponding to the recyclable physical block from the bit whose value is a first value in the status mapping table; and updating the value of the target bit from the first value to a second value, wherein the second value represents a non-deleted status.
[0053] In the embodiments of the present application, the specific implementation method of determining the reclaimable physical blocks based on the mapping relationship between the logical blocks marked as deleted and the FTL addresses is not limited. Any implementation method of determining the reclaimable physical blocks by comprehensively considering the mapping relationship between the logical blocks marked as deleted and the FTL addresses is applicable to the embodiments of the present application.
[0054] In an optional embodiment, when determining the logical blocks marked as deleted in the file system, the host 101 can determine the number of valid pages actually contained in each physical block in the solid state drive 102 based on the mapping relationship between the logical blocks marked as deleted and the FTL address; and determine the reclaimable physical blocks based on the number of valid pages actually contained in each physical block in the solid state drive 102. In this embodiment, in the process of determining the number of valid pages actually contained in each physical block in the solid state drive 102, the logical blocks marked as deleted in the file system are combined, which is equivalent to considering the information of the physical pages occupied by the data units that have been deleted but not yet perceived by the solid state drive 102, thereby improving the accuracy of the number of valid pages actually contained in each physical block, and thus more reasonably selecting the reclaimable physical blocks and optimizing the GC process.
[0055] Further optionally, in the process of determining the number of valid pages actually contained in each physical block in the solid-state hard disk, the usage status information of each physical block in the solid-state hard disk 102 counted by the FTL layer can be combined. For example, the physical page corresponding to the logical page in the logical block marked as deleted can be determined based on the FTL address mapping relationship. The data stored in the physical page corresponding to the logical page in the logical block marked as deleted has expired, so this physical page can be called an invalid physical page. In order to further distinguish it from the invalid physical page on each physical block counted by the FTL layer, the physical page corresponding to the logical page in the logical block marked as deleted is called a target invalid physical page. Furthermore, the number of valid pages actually contained in each physical block can be obtained based on the target invalid physical page and the usage status information of each physical block in the solid-state hard disk 102 counted by the FTL layer.
[0056] The number of target invalid physical pages may be one or more, generally multiple. Since a logical page can be mapped to any physical page, multiple target invalid physical pages may belong to different physical blocks, or may belong to the same physical block.
[0057] Furthermore, in this embodiment, the information of the number of valid pages contained in each physical block counted by the FTL layer is mainly used. Figure 1b The state table shown can obtain the number of valid pages contained in each physical block from the state table of each physical block counted by the FTL layer; according to the affiliation relationship between the target invalid physical page and the physical block, the number of valid pages contained in the corresponding physical block in the solid state drive 102 is updated to obtain the number of valid pages actually contained in each physical block. Specifically, for a physical block containing a target invalid physical page, the number of valid pages contained in the physical block counted by the FTL layer can be subtracted from the number of target invalid physical pages contained in the physical block to obtain the number of valid pages actually contained in the physical block.
[0058] It is to be noted that the "usage status information of each physical block counted by the FTL layer or the number of valid pages contained in each physical block counted by the FTL layer" mentioned above refers to the relevant information obtained by the host 101 executing the corresponding function of the FTL layer in the IO operation of the solid state drive 102.
[0059] After obtaining the number of valid pages actually included in each physical block, the reclaimable physical block can be determined according to the number of valid pages actually included in each physical block. In this embodiment, the implementation method of determining the reclaimable physical block according to the number of valid pages actually included in each physical block is not limited, and several exemplary implementation methods are given below.
[0060] Exemplary embodiment 1:
[0061] In exemplary implementation 1, from the dimension of physical blocks, the number of valid pages actually contained in each physical block is considered. Based on this, the physical block with the smallest number of valid pages actually contained in each physical block can be determined as a reclaimable physical block. This approach can maximize the free space obtained by garbage collection, minimize the number of reads and writes caused by each garbage collection operation, and greatly reduce write amplification.
[0062] Exemplary embodiment 2:
[0063] In exemplary embodiment 2, from the dimension of physical blocks, the factor of the number of valid pages actually contained in each physical block is mainly considered. Based on this, according to the number of valid pages actually contained in each physical block, the physical block whose actual number of valid pages is less than the first number threshold is determined as a reclaimable physical block. Compared with exemplary embodiment 1, this method may select multiple reclaimable physical blocks at one time, which can reduce the number of selections of reclaimed physical blocks and also reduce write amplification.
[0064] Exemplary embodiment 3:
[0065] In exemplary implementation 3, from the dimension of physical blocks, two factors are considered, namely, the number of valid pages actually contained in each physical block and the number of erases and writes. Based on this, the recyclable physical blocks can be determined according to the number of valid pages actually contained in each physical block and the number of erases and writes of each physical block. This method simultaneously considers the two factors of the number of valid pages actually contained in each physical block and the number of erases and writes, and can comprehensively consider the performance of GC and the loss of the solid-state drive. It can maximize the free space obtained by garbage collection while ensuring the service life of the solid-state drive, greatly reduce write amplification, and reduce the performance impact of garbage collection on the solid-state drive.
[0066] In this embodiment, the number of valid pages and the number of erase times actually contained in the physical block are comprehensively considered, but the comprehensive use of these two factors is not limited. For example, in a specific implementation, the number of valid pages and the number of erase times actually contained in each physical block can be weighted and summed to obtain the recycling weight of each physical block; according to the recycling weight of each physical block, the physical block with the smallest recycling weight is selected as the recyclable physical block.
[0067] It should be noted that the weights corresponding to the number of valid pages and the number of erase and write times can be flexibly set according to application requirements. For example, if you want to focus on the number of valid pages, you can set a higher weight for the number of valid pages; conversely, if you want to focus on the number of erase and write times, you can set a higher weight for the number of erase and write times. Of course, if you want to balance the two factors of the number of valid pages and the number of erase and write times, you can configure similar or identical weights for these two factors.
[0068] Exemplary embodiment 4:
[0069] In exemplary embodiment 4, considering that the solid state drive may support a super block (Super Block), each super block includes multiple physical blocks, and the affiliation between the physical block and the super block is determined. In order to reduce the number of GC times, recyclable physical blocks can be selected from the dimension of super blocks. Based on this, the number of valid pages actually contained in each super block in the solid state drive can be calculated according to the number of valid pages actually contained in each physical block; based on the number of valid pages actually contained in each super block, a recyclable super block is determined, and the recyclable super block includes multiple recyclable physical blocks.
[0070] Optionally, the number of valid pages actually contained in each physical block included in the super block can be accumulated to obtain the number of valid pages actually contained in the super block. Alternatively, the maximum number of valid pages actually contained in each physical block included in the super block can be used as the number of valid pages actually contained in the super block. Alternatively, the average number of valid pages actually contained in each physical block included in the super block can be used as the number of valid pages actually contained in the super block.
[0071] Further optionally, the implementation method of determining the reclaimable super blocks according to the actual number of valid pages contained in each super block includes: according to the actual number of valid pages contained in each super block, determining the super block with the smallest actual number of valid pages as the reclaimable super block; or, according to the actual number of valid pages contained in each super block, determining the super block with the actual number of valid pages less than a second number threshold as the reclaimable super block.
[0072] Further optionally, the implementation method of determining the recyclable super blocks according to the number of valid pages actually contained in each super block also includes: determining the recyclable super blocks according to the number of valid pages actually contained in each super block and the number of erasures of each super block. The number of erasures of the super block can be the sum of the number of erasures of each physical block contained in the super block, or the average number of erasures of each physical block contained in the super block, or the maximum number of erasures of each physical block contained in the super block, etc.
[0073] Furthermore, in the process of determining the recyclable super blocks based on the actual number of valid pages contained in each super block and the number of erase and write times of each super block, the actual number of valid pages contained in each super block and the number of erase and write times can be weightedly summed to obtain the recycling weight of each super block; based on the recycling weight of each super block, the super block with the smallest recycling weight is selected as the recyclable super block.
[0074] In various embodiments of the present application, the host 101 may start a GC operation when the triggering conditions for garbage collection are met. In various embodiments of the present application, the triggering conditions for garbage collection are not limited. For example, in an optional implementation, the host 101 may trigger a garbage collection operation during the idle period of the solid-state drive 101 to avoid occupying normal storage resources. For another example, in another optional implementation, an available storage space threshold may be set, such as 30%, and a garbage collection operation is triggered when the available storage space of the solid-state drive 102 is lower than the set threshold. For another example, in yet another optional implementation, a garbage collection operation may also be triggered when insufficient storage space occurs during an IO operation.
[0075] In each embodiment of the present application, after determining the recyclable physical block, garbage collection can be performed on the recyclable physical block. The process of performing garbage collection on the recyclable physical block mainly refers to: migrating the valid pages in the recyclable physical block to a new physical block, erasing the recyclable physical block, and generating a new available physical block. In this process, it is also necessary to update the FTL address mapping relationship.
[0076] In an embodiment of the present application, the GC function based on the FTL address mapping relationship is combined with the data deletion operation in the operating system. In the process of data deletion, the corresponding logical block is marked as deleted to indicate that the data unit to be deleted is in an invalid state in the solid-state hard disk; further, in the GC process, the logical block marked as deleted and the FTL address mapping relationship can be combined to determine the recyclable physical blocks in the solid-state hard disk, which is conducive to selecting physical blocks with a relatively small number of valid pages for recycling, and can reduce the amount of data moved during the GC process. The GC process is optimized to a certain extent, and the write amplification can be reduced. It is estimated that the write amplification can be reduced by 2 to 3 times, and the write life of the solid-state hard disk can be increased by 2 to 3 times, thereby improving the reliability of the solid-state hard disk.
[0077] Furthermore, when the solid-state drive 102 is used as a cache for the low-speed storage medium on the host 101, the data written to the solid-state drive 102 will be quickly transferred to the low-speed storage medium and then deleted from the solid-state drive 102. In this scenario, the reading and writing of the solid-state drive 102 will be very frequent, and the effect of using the GC method provided in the embodiment of the present application will be more obvious, which will greatly improve the performance and service life of the solid-state drive; in addition, the speed of data transfer from the solid-state drive to the low-speed storage medium will also be greatly improved.
[0078] It should be noted that in the storage system based on the solid state drive provided in the above embodiment of the present application, according to the actual situation, the host 101 can perform the improved data deletion operation alone, or can perform the improved GC operation alone. Among them, in the scheme of the host 101 performing the improved GC operation alone, it is not limited to the implementation method of marking the corresponding logical block as deleted during the data deletion process, that is, the method provided in the embodiment of the present application can be adopted, and other methods can also be adopted.
[0079] Figure 2 The following is a flow chart of a data deletion method provided by an exemplary embodiment of the present application. Figure 2 As shown, the method includes:
[0080] 201. In response to a data deletion operation, delete metadata of a data unit to be deleted.
[0081] 202. Mark the logic block occupied by the data unit to be deleted as a deleted state; wherein the deleted state indicates that the data unit to be deleted is in an invalid state in the solid state drive.
[0082] The method provided in this embodiment is applicable to a host including a solid-state hard disk, and the host can be any computer device that requires storage resources. Similarly, in this embodiment, there is no limitation on the solid-state hard disk, and it generally refers to any hard disk made of a solid-state electronic storage chip array. The implementation form of the host and the solid-state hard disk, as well as the description related to the host and the solid-state hard disk, can be found in the above-mentioned embodiment, and will not be repeated here.
[0083] In this embodiment, the host can perform a deletion operation on the data unit stored on the solid-state drive. For ease of description, the data unit to be deleted is referred to as a data unit to be deleted. In the data deletion process of this embodiment, the metadata of the data unit to be deleted will be deleted, but the data unit to be deleted will not be actually modified. In other words, the operation of "deleting the metadata of the data unit to be deleted" will not be perceived by the solid-state drive, and the data unit to be deleted is still stored in the solid-state drive, and before the logical block corresponding to the data unit to be deleted is overwritten and written to other data units, from the perspective of the solid-state drive, the data unit to be deleted is still in a valid state. Assume that before the logical block corresponding to the data unit to be deleted is overwritten and written to other data units, the GC mechanism of the solid-state drive is triggered, and the physical block where the data unit to be deleted is located happens to be a physical block that needs to be recycled, then the data unit to be deleted as valid data (actually invalid) will still be moved to other physical blocks, which causes write amplification.
[0084] In order to solve the write amplification problem caused by data deletion, in the data deletion process of this embodiment, in addition to deleting the metadata of the data unit to be deleted, the logical block occupied by the data unit to be deleted will also be marked as deleted. Among them, the deleted state of the logical block can indicate that the data unit to be deleted occupying the logical block has been indicated to be deleted, and further can indicate that the data unit to be deleted is in an invalid state in the solid-state hard disk. It should be noted that a data unit can occupy one or more logical blocks, that is, the number of logical blocks occupied by the data unit to be deleted can be one or more, and there is no limitation on this, which can be determined by the size of the data unit and the logical block. In addition, this embodiment does not limit the method of marking the logical block, and any method that can mark the logical block as deleted is applicable to the embodiment of the present application.
[0085] It should be noted that this embodiment does not limit the execution order of step 201 and step 202, which can be executed in parallel or in sequence. Figure 2 Alternatively, the operation shown in step 202 may be performed first, and then the operation shown in step 201 may be performed.
[0086] In an optional embodiment, the logical block occupied by the data unit to be deleted is marked as a deleted state, including: setting the value of the bit corresponding to the logical block occupied by the data unit to be deleted in the state mapping table to a first value; wherein the state mapping table is used to record the usage status of each logical block in the file system, and the first value represents the deleted state.
[0087] In an optional embodiment, after the solid state drive is powered on, the method of this embodiment further includes: an operation of creating a state mapping table for the solid state drive.
[0088] In an optional embodiment, the method of this embodiment also includes: in response to a write operation or update operation on the solid state drive, writing data in the solid state drive, and updating the FTL address mapping relationship and the usage status information of the physical block where the data is written in the solid state drive.
[0089] Furthermore, an implementation method of updating the usage status information of the physical blocks in the solid-state hard disk where data is written includes: updating the bitmap and status table corresponding to the physical blocks in the solid-state hard disk where data is written; wherein the bitmap marks the position of the valid pages in the physical block, and the status table records the number of valid pages contained in the physical block.
[0090] Optionally, the solid state drive of this embodiment may be an open channel solid state drive, but is not limited thereto.
[0091] The data deletion method provided in this embodiment can provide a data basis for the host to perform the GC process. Based on this, when the host is performing the GC process, the logical blocks marked as deleted can be determined, and the recyclable physical blocks in the solid-state drive can be determined according to the mapping relationship between the logical blocks marked as deleted and the FTL address, and the recyclable physical blocks can be garbage collected. Among them, in the process of determining the recyclable physical blocks, it is beneficial to select physical blocks with a relatively small number of valid pages for recycling, which can reduce the amount of data moved during the GC process, optimize the GC process to a certain extent, reduce write amplification, and improve the reliability of the SSD.
[0092] Figure 3a A schematic diagram of a GC method provided as an exemplary embodiment of the present application. Figure 3a As shown, the method includes:
[0093] 301. Determine a logical block marked as deleted, where the deleted status indicates that a data unit corresponding to the logical block marked as deleted is in an invalid state in the solid state drive.
[0094] 302. Determine a reclaimable physical block in the solid state drive according to a mapping relationship between a logical block marked as deleted and an FTL address.
[0095] 303. Perform garbage collection on recyclable physical blocks.
[0096] The method provided in this embodiment is applicable to a host including a solid-state hard disk, and the host can be any computer device that requires storage resources. Similarly, in this embodiment, there is no limitation on the solid-state hard disk, and it generally refers to any hard disk made of a solid-state electronic storage chip array. The implementation form of the host and the solid-state hard disk, as well as the description related to the host and the solid-state hard disk, can be found in the above-mentioned embodiment, and will not be repeated here.
[0097] In this embodiment, the logic block for storing the data unit will be marked as deleted as the data unit is deleted. For a method of marking the logic block as deleted, please refer to the description of the above embodiment, which will not be repeated here.
[0098] During the GC process, the host determines the logical blocks marked as deleted, and then determines the reclaimable physical blocks in the SSD based on the mapping relationship between the logical blocks marked as deleted and the FTL address, and performs garbage collection on the reclaimable physical blocks. In the process of determining the reclaimable physical blocks, combining the logical blocks marked as deleted is equivalent to considering the information of the physical pages occupied by the data units that have been deleted but not yet perceived by the SSD, which is conducive to selecting physical blocks with a relatively small number of valid pages for recycling, which can reduce the amount of data moved during the GC process, optimize the GC process to a certain extent, reduce write amplification, and improve the reliability of the SSD.
[0099] In an alternative embodiment, if Figure 3b As shown, after garbage collection is performed on the recyclable physical block, it also includes: 304. If there is a logical block corresponding to the recyclable physical block in the logical block marked as deleted, the state of the logical block corresponding to the recyclable physical block in the logical block marked as deleted is updated to a non-deleted state.
[0100] In an optional embodiment, a state mapping table is used to record the usage status of each logical block in the file system. Based on this, the method of determining the logical block marked as deleted in step 301 includes: determining the logical block corresponding to the bit in the state mapping table whose value is a first value; wherein the first value represents the deleted state.
[0101] Based on the above-mentioned status mapping table, the method of updating the status of the logical block corresponding to the recyclable physical block in the logical block that will be marked as deleted to the non-deleted status includes: determining the target bit corresponding to the logical block corresponding to the recyclable physical block from the bit whose value is the first value in the status mapping table; updating the value of the target bit from the first value to the second value, and the second value represents the non-deleted status.
[0102] In an optional embodiment, an implementation method of determining the reclaimable physical blocks in the solid-state hard disk in step 302 includes: determining the number of valid pages actually contained in each physical block in the solid-state hard disk based on the mapping relationship between the logical blocks marked as deleted and the FTL address; and determining the reclaimable physical blocks based on the number of valid pages actually contained in each physical block.
[0103] Furthermore, the above-mentioned method for determining the actual number of valid pages contained in each physical block in the solid-state hard disk includes: determining the target invalid physical page corresponding to the logical page in the logical block marked as deleted according to the FTL address mapping relationship; and obtaining the actual number of valid pages contained in each physical block according to the target invalid physical page and the usage status information of each physical block in the solid-state hard disk counted by the FTL layer.
[0104] Furthermore, the above-mentioned method of obtaining the actual number of valid pages contained in each physical block based on the target invalid physical page and the usage status information of each physical block in the solid-state hard disk counted by the FTL layer includes: obtaining the number of valid pages contained in each physical block from the status table of each physical block counted by the FTL layer; and updating the number of valid pages contained in the corresponding physical block in each physical block according to the affiliation between the target invalid physical page and the physical block, so as to obtain the actual number of valid pages contained in each physical block.
[0105] Furthermore, one method of determining the reclaimable physical blocks according to the actual number of valid pages contained in each physical block includes: according to the actual number of valid pages contained in each physical block, determining the physical block with the smallest actual number of valid pages as the reclaimable physical block.
[0106] Furthermore, another method of determining the reclaimable physical blocks based on the number of valid pages actually contained in each physical block includes: determining the reclaimable physical blocks based on the number of valid pages actually contained in each physical block and the number of erase and write times of each physical block.
[0107] Furthermore, based on the actual number of valid pages contained in each physical block and the number of erase and write times of each physical block, the recyclable physical blocks are determined, including: taking a weighted sum of the actual number of valid pages contained in each physical block and the number of erase and write times to obtain a recycling weight of each physical block; and based on the recycling weight of each physical block, selecting the physical block with the smallest recycling weight as the recyclable physical block.
[0108] Furthermore, another method of determining the recyclable physical blocks based on the actual number of valid pages contained in each physical block includes: calculating the actual number of valid pages contained in each super block in the solid state drive based on the actual number of valid pages contained in each physical block; each super block includes multiple physical blocks; and determining the recyclable super block based on the actual number of valid pages contained in each super block, wherein the recyclable super block includes multiple recyclable physical blocks.
[0109] Furthermore, the above-mentioned determining the reclaimable super blocks according to the actual number of valid pages contained in each super block includes: according to the actual number of valid pages contained in each super block, determining the super block with the smallest actual number of valid pages as the reclaimable super block.
[0110] For the detailed implementation of each step in this embodiment, please refer to the description of the previous embodiment, which will not be repeated here.
[0111] In the above embodiments of the present application, there is no limitation on solid state drives, and any solid state drive that supports transferring the FTL layer function to the operating system on the host side is applicable to the above embodiments of the present application. For example, in the existing open channel SSD, the FTL layer function is no longer implemented in the firmware of the solid state drive, but is transferred to the operating system on the host side that uses the open channel SSD as the storage medium. The technical solution of the embodiment of the present application is described below using the open channel SSD as an example.
[0112] The exemplary embodiment of the present application also provides a data processing method, which is applicable to a host including an open channel SSD. The method includes: in response to a data deletion operation, deleting metadata of a data unit to be deleted; and marking a logical block occupied by the data unit to be deleted as a deleted state to indicate that the data unit to be deleted is in an invalid state in the open channel SSD.
[0113] Furthermore, the data processing method of this embodiment also includes: in response to a garbage collection triggering event, determining a logical block marked as deleted; determining the reclaimable physical block opened and provided to the SSD according to the mapping relationship between the logical block marked as deleted and the FTL address; and performing garbage collection on the reclaimable physical block. The logical block marked as deleted may be one or more.
[0114] In addition to the above data processing method, the embodiment of the present application also provides a garbage collection method, which is applicable to a host including an open channel SSD. The method includes: in response to a garbage collection trigger event, determining a logical block marked as deleted; determining a recyclable physical block in the open channel SSD according to the mapping relationship between the logical block marked as deleted and the FTL address; and performing garbage collection on the recyclable physical block. For the garbage collection trigger event, please refer to the "triggering condition for garbage collection" mentioned in the above embodiment, which will not be repeated here.
[0115] For the detailed implementation of each step in the above open channel SSD method embodiment, please refer to the description of the previous embodiment, which will not be repeated here.
[0116] It should be noted that the execution subject of each step of the method provided in the above embodiment can be the same device, or the method can be executed by different devices. For example, the execution subject of step 201 to step 202 can be device A; for another example, the execution subject of step 201 can be device A, and the execution subject of step 202 can be device B; and so on.
[0117] In addition, in some of the processes described in the above embodiments and the accompanying drawings, multiple operations that appear in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear in this article or executed in parallel, and the sequence numbers of the operations, such as 201, 202, etc., are only used to distinguish between different operations, and the sequence numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel. It should be noted that the descriptions of "first", "second", etc. in this article are used to distinguish different messages, devices, modules, etc., do not represent the order of precedence, and do not limit the "first" and "second" to be different types.
[0118] Figure 4 The following is a schematic diagram of a computer device provided by an exemplary embodiment of the present application. Figure 4 As shown, the computer device includes: a memory 41 and a processor 42.
[0119] The memory 41 includes: a non-solid state hard disk and a solid state hard disk; the non-solid state hard disk stores a computer program, such as a data deletion program; and the solid state hard disk stores data units to be deleted. It should be noted that other data units are also stored in the solid state hard disk. Optionally, the data deletion program can be a part of the program in the file system, but is not limited thereto.
[0120] In this embodiment, the solid-state hard disk refers to any hard disk made of a solid-state electronic storage chip array. For example, from the perspective of the interface protocol, the solid-state hard disk of this embodiment can be a solid-state hard disk that supports various interface protocols such as SATA-2, SATA-3, SAS, MSATA, PCIE, NGFF or CFast. For another example, from the perspective of the storage medium, the solid-state hard disk of this embodiment can be a solid-state hard disk that uses flash memory (Flash) as the storage medium, or a solid-state hard disk that uses DRAM as the storage medium.
[0121] In this embodiment, the solid state drive is connected to the computer device, but the connection method of the solid state drive and the computer device is not limited. Optionally, the solid state drive can be fixedly installed in the hard disk position on the computer device, or can be inserted in the computer device in a plug-in manner, or can be externally connected to the computer device. Among them, the solid state drive can be used as a cache of low-speed storage media on the computer device, and can also be used as the final storage space of the computer device.
[0122] In this embodiment, the non-solid-state hard disk can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, magnetic disk or optical disk.
[0123] Non-solid state drives are used to store computer programs, such as file systems, and may be configured to store various other data to support operations on a computer device. Examples of such data include instructions for any application or method operating on a computer device, contact data, phone book data, messages, pictures, videos, etc.
[0124] The processor 42 is coupled to the memory 41 and is used to execute a data deletion program stored in a non-solid-state hard disk, so as to: in response to a data deletion operation, mark the logical block occupied by the data unit to be deleted as a deleted state, and delete the metadata of the data unit to be deleted; wherein the deleted state indicates that the data unit to be deleted is in an invalid state in the solid-state hard disk.
[0125] In this embodiment, the data unit that needs to be deleted is referred to as a data unit to be deleted. Among them, the deleted state of the logical block may indicate that the data unit to be deleted occupying the logical block has been instructed to be deleted, and further may indicate that the data unit to be deleted is in an invalid state in the solid-state hard disk. It should be noted that a data unit can occupy one or more logical blocks, that is, the number of logical blocks occupied by the data unit to be deleted can be one or more, and there is no limitation on this, which may depend on the size of the data unit and the logical block. In addition, this embodiment does not limit the method of marking the logical block, and any method that can mark the logical block as deleted is applicable to the embodiments of the present application.
[0126] In an optional embodiment, when the processor 42 marks the logical block occupied by the data unit to be deleted as a deleted state, it is specifically used to: set the value of the bit corresponding to the logical block occupied by the data unit to be deleted in the state mapping table to a first value; wherein the state mapping table is used to record the usage status of each logical block in the file system, and the first value represents the deleted state.
[0127] In an optional embodiment, the processor 42 is further configured to: after the solid state drive is powered on, create a state mapping table for the solid state drive.
[0128] In an optional embodiment, the processor 42 is further used to: write data in the solid-state hard disk in response to a write operation or an update operation on the solid-state hard disk, and update the FTL address mapping relationship and the usage status information of the physical block where the data is written in the solid-state hard disk.
[0129] Furthermore, when the processor 42 updates the usage status information of the physical blocks where data is written in the solid-state hard disk, it is specifically used to: update the bitmap and status table corresponding to the physical blocks where data is written in the solid-state hard disk; wherein the bitmap is used to mark the position of the valid pages in the physical block, and the status table is used to record the number of valid pages contained in the physical block.
[0130] Optionally, the solid state drive of this embodiment may be an open channel solid state drive, but is not limited thereto.
[0131] Further, if Figure 4 As shown, the computer device also includes: a communication component 43, a display 44, a power component 45, an audio component 46 and other components. Figure 4 Only some components are shown schematically, and it does not mean that the computer equipment only includes Figure 4 In addition, Figure 4 The components in the dashed box are optional components, not mandatory components, and the specific components depend on the product form of the computer device. The computer device of this embodiment can be implemented as a terminal device such as a desktop computer, a laptop computer, a smart phone, or an IOT device, or a server device such as a conventional server, a cloud server, or a server array. If the computer device of this embodiment is implemented as a terminal device such as a desktop computer, a laptop computer, a smart phone, etc., it can include Figure 4 If the computer device of this embodiment is implemented as a server device such as a conventional server, a cloud server or a server array, it may not include Figure 4 Components within the dashed box.
[0132] The computer device provided in this embodiment marks the relevant logical blocks as deleted during the data deletion process, which can provide a data basis for the subsequent GC process, so that during the GC process, the recyclable physical blocks in the solid-state drive can be determined based on the mapping relationship between the logical blocks marked as deleted and the FTL addresses, which is conducive to selecting physical blocks with a relatively small number of valid pages for recycling, and can reduce the amount of data moved during the GC process. It optimizes the GC process to a certain extent, can reduce write amplification, and improve the reliability of the SSD.
[0133] Accordingly, the embodiment of the present application further provides a computer-readable storage medium storing a computer program, which can achieve the above-mentioned Figure 2 The steps in the method embodiment are shown.
[0134] Figure 5 The structural diagram of another computer device provided by the exemplary embodiment of the present application is as follows. Figure 5 As shown, the computer device includes: a memory 51 and a processor 52.
[0135] The memory 51 includes: a non-solid-state hard disk and a solid-state hard disk; the non-solid-state hard disk stores computer programs, such as a garbage collection program; and the solid-state hard disk stores various data units.
[0136] In this embodiment, the solid-state hard disk refers to any hard disk made of a solid-state electronic storage chip array. For example, from the perspective of the interface protocol, the solid-state hard disk of this embodiment can be a solid-state hard disk that supports various interface protocols such as SATA-2, SATA-3, SAS, MSATA, PCIE, NGFF or CFast. For another example, from the perspective of the storage medium, the solid-state hard disk of this embodiment can be a solid-state hard disk that uses flash memory (Flash) as the storage medium, or a solid-state hard disk that uses DRAM as the storage medium.
[0137] In this embodiment, the solid state drive is connected to the computer device, but the connection method of the solid state drive and the computer device is not limited. Optionally, the solid state drive can be fixedly installed in the hard disk position on the computer device, or can be inserted in the computer device in a plug-in manner, or can be externally connected to the computer device. Among them, the solid state drive can be used as a cache of low-speed storage media on the computer device, and can also be used as the final storage space of the computer device.
[0138] In this embodiment, the non-solid-state hard disk can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, magnetic disk or optical disk.
[0139] Non-solid state drives are used to store computer programs, such as garbage collection programs, and may be configured to store various other data to support operations on the computer device. Examples of such data include instructions for any application or method operating on the computer device, contact data, phone book data, messages, pictures, videos, etc.
[0140] The processor 52 is coupled to the memory 51 and is used to execute a garbage collection program stored in a non-solid-state hard disk, so as to: determine a logical block marked as deleted, where the deleted state indicates that a data unit corresponding to the logical block marked as deleted is in an invalid state in the solid-state hard disk; determine a recyclable physical block in the solid-state hard disk according to a mapping relationship between the logical block marked as deleted and an FTL address, and perform garbage collection on the recyclable physical block.
[0141] In an optional embodiment, after performing garbage collection on the reclaimable physical block, the processor 52 is also used to: if there is a logical block corresponding to the reclaimable physical block in the logical block marked as deleted, the state of the logical block corresponding to the reclaimable physical block in the logical block marked as deleted is updated to a non-deleted state.
[0142] In an optional embodiment, a state mapping table is used to record the usage status of each logical block in the file system. Based on this, when the processor 52 determines the logical block marked as deleted, it is specifically used to: determine the logical block corresponding to the bit in the state mapping table whose value is the first value; wherein the first value represents the deleted state.
[0143] Based on the above-mentioned state mapping table, when the processor 52 updates the state of the logical block corresponding to the recyclable physical block to a non-deleted state, it is specifically used to: determine the target bit corresponding to the logical block corresponding to the recyclable physical block from the bit whose value is the first value in the state mapping table; update the value of the target bit from the first value to the second value, and the second value represents the non-deleted state.
[0144] In an optional embodiment, when determining the reclaimable physical blocks in the solid-state hard disk, the processor 52 is specifically used to: determine the number of valid pages actually contained in each physical block in the solid-state hard disk based on the mapping relationship between the logical blocks marked as deleted and the FTL addresses; and determine the reclaimable physical blocks based on the number of valid pages actually contained in each physical block.
[0145] Furthermore, when determining the actual number of valid pages contained in each physical block in the solid-state hard disk, the processor 52 is specifically used to: determine the target invalid physical page corresponding to the logical page in the logical block marked as deleted according to the FTL address mapping relationship; and obtain the actual number of valid pages contained in each physical block according to the target invalid physical page and the usage status information of each physical block in the solid-state hard disk counted by the FTL layer.
[0146] Furthermore, when the processor 52 obtains the actual number of valid pages contained in each physical block, it is specifically used to: obtain the number of valid pages contained in each physical block from the status table of each physical block counted by the FTL layer; according to the affiliation between the target invalid physical page and the physical block, update the number of valid pages contained in the corresponding physical block in each physical block to obtain the actual number of valid pages contained in each physical block.
[0147] Furthermore, when determining the reclaimable physical block, the processor 52 is specifically configured to: determine, according to the number of valid pages actually contained in each physical block, a physical block having the smallest number of valid pages actually contained therein as the reclaimable physical block.
[0148] Furthermore, when determining the reclaimable physical blocks, the processor 52 is specifically configured to: determine the reclaimable physical blocks according to the number of valid pages actually contained in each physical block and the number of erase and write times of each physical block.
[0149] Furthermore, when the processor 52 determines the recyclable physical blocks based on the actual number of valid pages contained in each physical block and the number of erase and write times of each physical block, it is specifically used to: take a weighted sum of the actual number of valid pages contained in each physical block and the number of erase and write times to obtain the recycling weight of each physical block; and based on the recycling weight of each physical block, select the physical block with the smallest recycling weight as the recyclable physical block.
[0150] Furthermore, when determining the reclaimable physical blocks, the processor 52 is specifically used to: calculate the actual number of valid pages contained in each super block in the solid state drive according to the actual number of valid pages contained in each physical block; each super block includes multiple physical blocks; and determine the reclaimable super block according to the actual number of valid pages contained in each super block, and the reclaimable super block includes multiple reclaimable physical blocks.
[0151] Furthermore, when the processor 52 determines the reclaimable super blocks according to the actual number of valid pages contained in each super block, it is specifically used to: determine the super block with the smallest actual number of valid pages as the reclaimable super block according to the actual number of valid pages contained in each super block.
[0152] In an optional embodiment, a data deletion program is also stored in the non-solid state hard disk. Optionally, the data deletion program may be a part of a program in a file system. The processor 52 may also execute the data deletion program to: in response to a data deletion operation, mark the logical block occupied by the data unit to be deleted as a deleted state, and delete the metadata of the data unit to be deleted. The data unit to be deleted is a data unit in the storage domain solid state hard disk.
[0153] In an optional embodiment, when the processor 52 marks the logical block occupied by the data unit to be deleted as a deleted state, it is specifically used to: set the value of the bit corresponding to the logical block occupied by the data unit to be deleted in the state mapping table to a first value; wherein the state mapping table is used to record the usage status of each logical block in the file system, and the first value represents the deleted state.
[0154] In an optional embodiment, the processor 52 is further configured to: after the solid state drive is powered on, create a state mapping table for the solid state drive.
[0155] In an optional embodiment, the processor 52 is further used to: write data in the solid-state hard disk in response to a write operation or an update operation on the solid-state hard disk, and update the FTL address mapping relationship and the usage status information of the physical block where the data is written in the solid-state hard disk.
[0156] Furthermore, when the processor 52 updates the usage status information of the physical blocks where data is written in the solid-state hard disk, it is specifically used to: update the bitmap and status table corresponding to the physical blocks where data is written in the solid-state hard disk; wherein the bitmap is used to mark the position of the valid pages in the physical block, and the status table is used to record the number of valid pages contained in the physical block.
[0157] Optionally, the solid state drive of this embodiment may be an open channel solid state drive, but is not limited thereto.
[0158] Further, if Figure 5 As shown, the computer device also includes: a communication component 53, a display 54, a power component 55, an audio component 56 and other components. Figure 5 Only some components are shown schematically, and it does not mean that the computer equipment only includes Figure 5 In addition, Figure 5 The components in the dashed box are optional components, not mandatory components, and the specific components depend on the product form of the computer device. The computer device of this embodiment can be implemented as a terminal device such as a desktop computer, a laptop computer, a smart phone, or an IOT device, or a server device such as a conventional server, a cloud server, or a server array. If the computer device of this embodiment is implemented as a terminal device such as a desktop computer, a laptop computer, a smart phone, etc., it can include Figure 5 If the computer device of this embodiment is implemented as a server device such as a conventional server, a cloud server or a server array, it may not include Figure 5 Components within the dashed box.
[0159] The computer device provided in this embodiment combines the logical blocks marked as deleted and the FTL address mapping relationship to determine the reclaimable physical blocks in the solid-state drive, and then performs garbage collection on the reclaimable physical blocks, which is beneficial to selecting physical blocks with a relatively small number of valid pages for recycling, and can reduce the amount of data moved during the GC process. It optimizes the GC process to a certain extent, can reduce write amplification, and improve the reliability of the SSD.
[0160] Accordingly, the embodiment of the present application further provides a computer-readable storage medium storing a computer program, which can achieve the above-mentioned Figure 3a and Figure 3b The steps in the method embodiment are shown.
[0161] Above Figure 4 and Figure 5The communication component in is configured to facilitate wired or wireless communication between the device where the communication component is located and other devices. The device where the communication component is located can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component may also include a near field communication (NFC) module, a radio frequency identification (RFID) technology, an infrared data association (IrDA) technology, an ultra-wideband (UWB) technology, a Bluetooth (BT) technology, etc.
[0162] Above Figure 4 and Figure 5 The display in the embodiment includes a screen, which may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation.
[0163] Above Figure 4 and Figure 5 The power supply component in the device provides power to various components of the device where the power supply component is located. The power supply component may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device where the power supply component is located.
[0164] Above Figure 4 and Figure 5 The audio component in can be configured to output and / or input audio signals. For example, the audio component includes a microphone (MIC), and when the device where the audio component is located is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in a memory or sent via a communication component. In some embodiments, the audio component also includes a speaker for outputting an audio signal.
[0165] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0166] The present invention is described with reference to the flowchart and / or block diagram of the method, device (system), and computer program product according to the embodiment of the present invention. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the process and / or box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0167] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0168] These computer program instructions may also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0169] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0170] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0171] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0172] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity 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, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0173] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A data deletion method, applicable to a host including a solid state drive, characterized in that: The method comprises: In response to a data deletion operation, a value of a bit corresponding to a logical block occupied by a data unit to be deleted in a state mapping table is set to a first value; wherein the state mapping table is used to record the use status of each logical block in the file system, the first value represents a deleted state, and the metadata of the data unit to be deleted is deleted; The deleted state indicates that the data unit to be deleted is in an invalid state in the solid state drive; During the garbage collection phase, the host performs the following garbage collection method: Determine a logical block corresponding to a bit in a state mapping table whose value is a first value; wherein the state mapping table is used to record the use status of each logical block in the file system, the first value represents a deleted state, and the deleted state indicates that a data unit corresponding to the logical block marked as deleted is in an invalid state in the solid-state hard disk; determine a target invalid physical page corresponding to a logical page in the logical block marked as deleted according to an FTL address mapping relationship; obtain the number of valid pages contained in each physical block from the state table of each physical block counted by the FTL layer; and determine the number of valid pages contained in each physical block according to the relationship between the target invalid physical page and the physical block. According to the affiliation relationship, the number of valid pages contained in the corresponding physical block in each physical block is updated to obtain the number of valid pages actually contained in each physical block; based on the number of valid pages actually contained in each physical block, a recyclable physical block is determined; garbage collection is performed on the recyclable physical block; if there is a logical block corresponding to the recyclable physical block in the logical block marked as deleted, a target bit corresponding to the logical block corresponding to the recyclable physical block is determined from the bit with the first value in the status mapping table; the value of the target bit is updated from the first value to the second value, and the second value represents a non-deleted state.
2. The method according to claim 1, characterized in that Also includes: After the solid state drive is powered on, the state mapping table is created for the solid state drive.
3. The method according to claim 1, characterized in that Also includes: In response to a write operation or an update operation on the solid state drive, data is written into the solid state drive, and an FTL address mapping relationship and usage status information of a physical block into which data is written in the solid state drive are updated.
4. The method according to claim 3, characterized in that Updating the usage status information of the physical block in which the data is written in the solid state drive, including: The bitmap and status table corresponding to the physical block into which the data is written in the solid state drive are updated; wherein the bitmap is marked with the position of the valid page in the physical block, and the status table records the number of valid pages contained in the physical block.
5. The method according to any one of claims 1 to 4, characterized in that: The solid state drive is an open channel solid state drive.
6. A garbage collection method, applicable to a host including a solid state drive, characterized in that: The method comprises: Determine a logic block corresponding to a bit in a state mapping table whose value is a first value; wherein the state mapping table is used to record the use status of each logic block in the file system, the first value represents a deleted state, and the deleted state indicates that a data unit corresponding to the logic block marked as deleted is in an invalid state in the solid state drive; Determine, according to the FTL address mapping relationship, a target invalid physical page corresponding to the logical page in the logical block marked as deleted; From the status table of each physical block counted by the FTL layer, the number of valid pages contained in each physical block is obtained; according to the affiliation relationship between the target invalid physical page and the physical block, the number of valid pages contained in the corresponding physical block in each physical block is updated to obtain the number of valid pages actually contained in each physical block; Determine the reclaimable physical blocks according to the number of valid pages actually contained in each physical block; Performing garbage collection on the recyclable physical block; If there is a logical block corresponding to the recyclable physical block in the logical blocks marked as deleted, determine the target bit corresponding to the logical block corresponding to the recyclable physical block from the bit with the first value in the status mapping table; update the value of the target bit from the first value to the second value, and the second value represents a non-deleted state.
7. The method according to claim 6, characterized in that According to the number of valid pages actually contained in each physical block, the reclaimable physical block is determined, including: According to the number of valid pages actually contained in each physical block, a physical block having the smallest number of valid pages actually contained therein is determined as a reclaimable physical block.
8. The method according to claim 6, characterized in that According to the number of valid pages actually contained in each physical block, the reclaimable physical block is determined, including: According to the number of valid pages actually contained in each physical block and the number of times each physical block is erased and written, a reclaimable physical block is determined.
9. The method according to claim 8, characterized in that Determining the reclaimable physical blocks according to the number of valid pages actually included in each physical block and the number of times each physical block has been erased and written comprises: Performing weighted summation on the number of valid pages and the number of erase and write times actually contained in each physical block to obtain a recycling weight of each physical block; According to the recycling weights of the physical blocks, a physical block with the smallest recycling weight is selected as a recyclable physical block.
10. The method according to claim 6, characterized in that According to the number of valid pages actually contained in each physical block, the reclaimable physical block is determined, including: According to the number of valid pages actually contained in each physical block, the number of valid pages actually contained in each super block in the solid state drive is calculated; each super block includes multiple physical blocks; According to the number of valid pages actually contained in each super block, a reclaimable super block is determined, and the reclaimable super block includes multiple reclaimable physical blocks.
11. The method according to claim 10, characterized in that Determine the reclaimable super blocks based on the number of valid pages actually contained in each super block, including: According to the number of valid pages actually contained in each super block, the super block with the smallest number of valid pages actually contained is determined as the reclaimable super block.
12. A computer device, characterized in that: include: Memory and processor; The memory includes: a non-solid-state hard disk and a solid-state hard disk, the non-solid-state hard disk stores a data deletion program, and the solid-state hard disk stores data units to be deleted; The processor, coupled to the memory, is configured to execute the data deletion program to: In response to a data deletion operation, the logical block occupied by the data unit to be deleted is marked as a deleted state, and the metadata of the data unit to be deleted is deleted; wherein, the deleted state indicates that the data unit to be deleted is in an invalid state in the solid-state hard disk, so that the processor executes the garbage collection method described in any one of claims 6-11.
13. The computer device according to claim 12, characterized in that The non-solid state hard disk also stores a state mapping table, and the state mapping table is used to record the use status of each logic block in the file system; The processor is specifically used to: set the value of the bit corresponding to the logic block occupied by the to-be-deleted data unit in the state mapping table to a first value; the first value represents a deleted state.
14. The computer device according to claim 12 or 13, characterized in that: The solid state drive is an open channel solid state drive.
15. A computer device, characterized in that: include: Memory and processor; The memory includes: a non-solid-state hard disk and a solid-state hard disk, the non-solid-state hard disk stores a garbage collection program, and the solid-state hard disk stores various data units; The processor, coupled to the memory, is configured to execute the garbage collection program to: Determine a logic block corresponding to a bit in a state mapping table whose value is a first value; wherein the state mapping table is used to record the use status of each logic block in the file system, the first value represents a deleted state, and the deleted state indicates that a data unit corresponding to the logic block marked as deleted is in an invalid state in the solid state drive; Determine, according to the FTL address mapping relationship, a target invalid physical page corresponding to the logical page in the logical block marked as deleted; From the status table of each physical block counted by the FTL layer, the number of valid pages contained in each physical block is obtained; according to the affiliation relationship between the target invalid physical page and the physical block, the number of valid pages contained in the corresponding physical block in each physical block is updated to obtain the number of valid pages actually contained in each physical block; Determine the reclaimable physical blocks according to the number of valid pages actually contained in each physical block; Performing garbage collection on the recyclable physical block; If there is a logical block corresponding to the recyclable physical block in the logical blocks marked as deleted, determine the target bit corresponding to the logical block corresponding to the recyclable physical block from the bit with the first value in the status mapping table; update the value of the target bit from the first value to the second value, and the second value represents a non-deleted state.
16. The computer device according to claim 15, characterized in that The non-solid state hard disk further stores a data deletion program, and the processor is further configured to execute the data deletion program to: In response to the data deletion operation, the logical block occupied by the data unit to be deleted is marked as a deleted state, and the metadata of the data unit to be deleted is deleted.
17. A storage system based on a solid state drive, characterized in that: include: A host and a solid state drive mounted on the host; The host is used to, in response to a data deletion operation, mark the logical block occupied by the data unit to be deleted as a deleted state and delete the metadata of the data unit to be deleted; wherein the data unit to be deleted is stored in the solid-state hard disk, and the deleted state indicates that the data unit to be deleted is in an invalid state in the solid-state hard disk, so that the host executes the garbage collection method described in any one of claims 6-11.
18. A storage system based on a solid state drive, characterized in that: include: A host and a solid state drive mounted on the host; The host is used to determine a logical block corresponding to a bit having a first value in a state mapping table; wherein the state mapping table is used to record the use status of each logical block in the file system, the first value represents a deleted state, and the deleted state indicates that a data unit corresponding to the logical block marked as deleted is in an invalid state in the solid state drive; and determine a target invalid physical page corresponding to a logical page in the logical block marked as deleted according to an FTL address mapping relationship; From the status table of each physical block counted by the FTL layer, the number of valid pages contained in each physical block is obtained; according to the affiliation relationship between the target invalid physical page and the physical block, the number of valid pages contained in the corresponding physical block in each physical block is updated to obtain the number of valid pages actually contained in each physical block; Determine a reclaimable physical block based on the number of valid pages actually contained in each physical block; perform garbage collection on the reclaimable physical block; if there is a logical block corresponding to the reclaimable physical block in the logical block marked as deleted, determine a target bit corresponding to the logical block corresponding to the reclaimable physical block from the bit with the first value in the status mapping table; update the value of the target bit from the first value to the second value, wherein the second value represents a non-deleted state.
19. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the processor is caused to implement the steps in the method according to any one of claims 1 to 14.
20. A data processing method, applicable to a host including an open channel SSD, characterized in that: The method comprises: In response to the data deletion operation, deleting metadata of the data unit to be deleted; and Marking the logic block occupied by the to-be-deleted data unit as a deleted state, so as to indicate that the to-be-deleted data unit is in an invalid state in the open channel SSD; In response to a garbage collection triggering event, determining a logical block corresponding to a bit in a state mapping table whose value is a first value; wherein the state mapping table is used to record the usage status of each logical block in the file system, and the first value represents a deleted state; Determine, according to the FTL address mapping relationship, a target invalid physical page corresponding to a logical page in a logical block marked as deleted; From the status table of each physical block counted by the FTL layer, the number of valid pages contained in each physical block is obtained; according to the affiliation relationship between the target invalid physical page and the physical block, the number of valid pages contained in the corresponding physical block in each physical block is updated to obtain the number of valid pages actually contained in each physical block; Determine the reclaimable physical blocks according to the number of valid pages actually contained in each physical block; Performing garbage collection on the recyclable physical block; If there is a logical block corresponding to the recyclable physical block in the logical blocks marked as deleted, determine the target bit corresponding to the logical block corresponding to the recyclable physical block from the bit with the first value in the status mapping table; update the value of the target bit from the first value to the second value, and the second value represents a non-deleted state.
21. A garbage collection method, applicable to a host including an open channel SSD, characterized in that: The method comprises: In response to a garbage collection triggering event, determining a logical block corresponding to a bit in a state mapping table whose value is a first value; wherein the state mapping table is used to record the usage status of each logical block in the file system, and the first value represents a deleted state; Determine, according to the FTL address mapping relationship, a target invalid physical page corresponding to a logical page in a logical block marked as deleted; From the status table of each physical block counted by the FTL layer, the number of valid pages contained in each physical block is obtained; according to the affiliation relationship between the target invalid physical page and the physical block, the number of valid pages contained in the corresponding physical block in each physical block is updated to obtain the number of valid pages actually contained in each physical block; Determine the reclaimable physical blocks according to the number of valid pages actually contained in each physical block; Performing garbage collection on the recyclable physical block; If there is a logical block corresponding to the recyclable physical block in the logical blocks marked as deleted, determine the target bit corresponding to the logical block corresponding to the recyclable physical block from the bit with the first value in the status mapping table; update the value of the target bit from the first value to the second value, and the second value represents a non-deleted state.
Citation Information
Patent Citations
Method and system for shortening IO reading and writing time delay of SSD
CN105159622A
Deallocation command processing method and storage device thereof
CN109086219A
Method for processing data, storage apparatus, solid state disk and storage system
WO2017219364A1