WO2024130890A1 - Solid state drive garbage collection method, solid state drive garbage collection acceleration apparatus, and device and computer medium - Google Patents

Solid state drive garbage collection method, solid state drive garbage collection acceleration apparatus, and device and computer medium Download PDF

Info

Publication number
WO2024130890A1
WO2024130890A1 PCT/CN2023/086117 CN2023086117W WO2024130890A1 WO 2024130890 A1 WO2024130890 A1 WO 2024130890A1 CN 2023086117 W CN2023086117 W CN 2023086117W WO 2024130890 A1 WO2024130890 A1 WO 2024130890A1
Authority
WO
WIPO (PCT)
Prior art keywords
target
command
master controller
ssd
read command
Prior art date
Application number
PCT/CN2023/086117
Other languages
French (fr)
Chinese (zh)
Inventor
夏城
孟鹏涛
Original Assignee
深圳大普微电子科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳大普微电子科技有限公司 filed Critical 深圳大普微电子科技有限公司
Publication of WO2024130890A1 publication Critical patent/WO2024130890A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the present application relates to the field of computer technology, and in particular to a solid state hard disk garbage recovery method, an acceleration device, equipment and a computer medium.
  • GC Garbage Collection
  • SSD Solid State Drives
  • the GC function of SSD controller can be roughly understood as the defragmentation function of ordinary hard disk. It reads the valid data in SSD flash memory blocks into the external data cache in sequence. When the total length of the read data reaches the SSD page size, the valid data in the external cache is written to a new flash memory block, and then the old flash memory block is erased to obtain a new flash memory block.
  • the data cache space can be released. This will cause frequent interaction between software and hardware (SSD master controller) during the entire GC process, and each software-hardware interaction will introduce software-hardware interaction latency, resulting in a longer interval from allocation to release of cache space, which in turn leads to a lower interest rate efficiency of the entire data cache space, affecting the GC efficiency of the SSD.
  • SSD master controller software-hardware controller
  • This application is to provide a solid state drive garbage collection method, which can solve the technical problem of how to improve the garbage collection efficiency of solid state drives to a certain extent.
  • This application also provides a solid state drive garbage collection acceleration device, an electronic device and a computer-readable storage medium.
  • a solid state drive garbage collection method applied to a solid state drive garbage collection acceleration device, comprising:
  • the target write command is transmitted to the SSD master controller, so that the SSD master controller writes the target data into the second flash memory block based on the target write command.
  • generating a target read command corresponding to an SSD master controller of the target solid state drive based on the target GC command includes:
  • the parameter field in the command template is replaced with the read command parameter field to obtain the target read command.
  • the method further includes:
  • the target data read by the SSD master controller is acquired, and the target data is cached in the data cache space according to the storage address.
  • determining the storage address of the target read command in the data cache space includes:
  • the buffer area includes a storage space obtained by evenly dividing the data cache space.
  • the method further includes:
  • the target read command and the target data are recorded.
  • the method further includes:
  • the storage space corresponding to the storage address in the data cache space is released.
  • the method further includes:
  • a target GC response instruction corresponding to the target GC command is generated, and the target GC response instruction is transmitted to the GC management software.
  • a solid state hard disk garbage collection acceleration device comprising:
  • a receiving port used to receive a target GC command sent by the GC management software of the target solid state drive
  • a command builder is used to generate a target read command corresponding to the SSD master controller of the target solid state drive based on the target GC command; transmit the target read command to the SSD master controller so that the SSD master controller reads the corresponding target data from the first flash memory block based on the target read command; generate a target write command corresponding to the SSD master controller based on the target GC command; transmit the target write command to the SSD master controller so that the SSD master controller writes the target data into the second flash memory block based on the target write command.
  • An electronic device comprising:
  • a processor is used to implement the steps of any of the solid state drive garbage collection methods described above when executing the computer program.
  • a computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of any of the solid-state hard disk garbage collection methods described above are implemented.
  • the present application provides a solid-state hard disk garbage collection method, which is applied to a solid-state hard disk garbage collection acceleration device, receiving a target GC command sent by the GC management software of the target solid-state hard disk; based on the target GC command, generating a target read command corresponding to the SSD main controller of the target solid-state hard disk; transmitting the target read command to the SSD main controller, so that the SSD main controller reads the corresponding target data from the first flash memory block based on the target read command; based on the target GC command, generating a target write command corresponding to the SSD main controller; transmitting the target write command to the SSD main controller, so that the SSD main controller writes the target data to the second flash memory block based on the target write command.
  • the solid-state hard disk garbage collection acceleration device after receiving the target GC command sent by the GC management software, can generate a corresponding target read command and send it to the SSD main controller for processing, and can generate a corresponding target write command based on the target GC command and send it to the SSD main controller for processing, so that the GC management software can complete the GC operation only by performing a hardware and software interaction with the SSD main controller once, reducing the hardware and software interaction latency introduced by the hardware and software interaction, and improving the garbage collection efficiency of the solid-state hard disk.
  • the solid-state hard disk garbage collection acceleration device, electronic device and computer-readable storage medium provided in this application also solve corresponding technical problems.
  • FIG1 is a schematic diagram of data reading during GC operation
  • FIG2 is a schematic diagram of data writing during GC operation
  • FIG3 is a schematic diagram of data erasure during GC operation
  • FIG4 is a schematic diagram of executing a GC read command on a solid state drive with the aid of software
  • FIG5 is a schematic diagram of executing a GC write command on a solid state drive with the aid of software
  • FIG6 is a schematic diagram of the time composition of the entire GC in the prior art
  • FIG7 is a first flow chart of a solid state drive garbage collection method provided by an embodiment of the present application.
  • FIG8 is a schematic diagram of GC time composition in the solid state drive garbage collection method provided by the present application.
  • FIG9 is a second flow chart of a solid state drive garbage collection method provided by an embodiment of the present application.
  • FIG10 is a schematic diagram of the structure of a solid state drive garbage collection system provided in an embodiment of the present application.
  • FIG11 is a diagram showing the interaction process between the solid state drive garbage collection acceleration device, the GC management software, and the SSD main controller;
  • FIG12 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
  • FIG. 13 is another schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
  • GC Garbage Collection
  • SSD Solid State Drives
  • the GC function of SSD controller can be roughly understood as the defragmentation function of ordinary hard disk. It reads the valid data in SSD flash memory block to the external data cache in sequence. The process is shown in Figure 1. When the total length of the read data reaches the SSD page size, the valid data of the external cache is written to a new flash memory block. The process is shown in Figure 2. Then the old flash memory block is erased. The process is shown in Figure 3 to obtain a new flash memory block.
  • FIG. 7 is a first flow chart of a solid state drive garbage collection method provided in an embodiment of the present application.
  • Step S101 receiving a target GC command sent by the GC management software of the target solid state drive.
  • the solid state drive garbage collection acceleration device can first receive the target GC command sent by the GC management software of the target solid state drive.
  • the content of the target GC command can be determined according to the specific GC operation requirements, and this application does not make specific limitations here.
  • Step S102 Based on the target GC command, a target read command corresponding to the SSD master controller of the target solid state drive is generated.
  • the solid-state hard disk garbage collection acceleration device receives the target GC command sent by the GC management software of the target solid-state hard disk, it can first generate a target read command corresponding to the SSD main controller of the target solid-state hard disk based on the target GC command, so as to subsequently control the SSD main controller to perform corresponding data reading operations based on the target read command.
  • Step S103 transmitting a target read command to the SSD master controller, so that the SSD master controller reads corresponding target data from the first flash memory block based on the target read command.
  • the target read command can be transmitted to the SSD master controller, so that the SSD master controller reads the corresponding target data from the first flash memory block based on the target read command, that is, reads the valid data that needs to be retained from the first flash memory block as the target data.
  • Step S104 Based on the target GC command, a target write command corresponding to the SSD master controller is generated.
  • the solid-state drive garbage collection acceleration device transmits the target read command to the SSD master controller so that the SSD master controller reads the corresponding target data from the first flash memory block based on the target read command, it also needs to generate a target write command corresponding to the SSD master controller based on the target GC command, so as to control the SSD master controller to re-write the target data into the solid-state drive with the help of the target write command.
  • Step S105 transmitting the target write command to the SSD master controller, so that the SSD master controller writes the target data into the second flash memory block based on the target write command.
  • the solid-state drive garbage collection acceleration device generates a target write command corresponding to the SSD master controller based on the target GC command, and can transmit the target write command to the SSD master controller so that the SSD master controller writes the target data into the second flash memory block based on the target write command.
  • the solid-state drive garbage collection acceleration device can also generate a target GC response instruction corresponding to the target GC command in order to promptly inform the GC management software that the GC operation has been completed, and transmit the target GC response instruction to the GC management software.
  • the present application provides a solid-state hard disk garbage collection method, which is applied to a solid-state hard disk garbage collection acceleration device, receiving a target GC command sent by the GC management software of the target solid-state hard disk; based on the target GC command, generating a target read command corresponding to the SSD main controller of the target solid-state hard disk; transmitting the target read command to the SSD main controller, so that the SSD main controller reads the corresponding target data from the first flash memory block based on the target read command; based on the target GC command, generating a target write command corresponding to the SSD main controller; transmitting the target write command to the SSD main controller, so that the SSD main controller writes the target data to the second flash memory block based on the target write command.
  • the solid-state hard disk garbage collection acceleration device can generate a corresponding target read command and send it to the SSD main controller for processing, and can generate a corresponding target write command based on the target GC command and send it to the SSD main controller for processing, so that the GC management software can complete the GC operation only by performing a hardware and software interaction with the SSD main controller once, reducing the hardware and software interaction latency introduced by the hardware and software interaction, and improving the garbage collection efficiency of the solid-state hard disk.
  • FIG. 1 To facilitate understanding of the efficiency of the solid-state hard disk garbage collection method provided by the present application, please refer to FIG.
  • FIG. 8 is a schematic diagram of the GC time composition in the solid-state hard disk garbage collection method provided by the present application.
  • the present application In one GC process, the software and hardware interact with each other at most twice, which is at least one less software and hardware interaction than the prior art. That is, the present application can reduce the software and hardware interaction latency introduced by the software and hardware interaction and improve the garbage collection efficiency of the solid-state hard disk.
  • FIG. 9 is a second flow chart of a solid state drive garbage collection method provided in an embodiment of the present application.
  • Step S201 receiving a target GC command sent by the GC management software of the target solid state drive.
  • Step S202 Acquire a pre-stored command template of the SSD master controller, where the command template includes a fixed field and a parameter field.
  • Step S203 extracting the read command parameter field in the target GC command.
  • Step S204 Replace the parameter field in the command template with the read command parameter field to obtain the target read command.
  • the solid-state drive garbage collection acceleration device when the solid-state drive garbage collection acceleration device generates a target read command corresponding to the SSD master controller of the target solid-state drive based on the target GC command, taking into account the different read and write command formats of different SSD master controllers, in order to quickly generate the read and write commands corresponding to the SSD master controller, the solid-state drive garbage collection acceleration device can obtain a pre-stored command template of the SSD master controller.
  • the command template includes a fixed field and a parameter field, and its format can be as shown in Table 1, wherein the light gray table represents the SSD controller parameter field, and the dark gray table represents the SSD controller command fixed field; extract the read command parameter field in the target GC command; replace the parameter field in the command template with the read command parameter field to obtain a target read command compatible with different SSD master controllers.
  • the solid-state drive garbage collection acceleration device can generate the target read command in the process of: First read the command template and opcode.
  • the opcode is used to describe the parameter fields in the read command template and replace them with the gc sq fields. For example, bit0 ⁇ bit3, bit4 ⁇ 8...are replaced with the fields in gc sq in sequence to generate the target read command, etc.
  • the SSD master controller can parse the target read command in its own parsing method to respond, etc.
  • the read command field includes ch, fq, cmd_type, cmd_sub_type, lc, 2mtc, bitmap and other fields, among which cmd_type, cmd_sub_type, lc, 2mtc, gc fields are fixed fields, because the contents of these fields are the same for each read command; the remaining fields are called parameter fields, and the contents of these fields are different for each read command, and need to be replaced with the parameters in gc sq.
  • Step S205 transmitting the target read command to the SSD master controller, so that the SSD master controller reads the corresponding target data from the first flash memory block based on the target read command.
  • Step S206 Based on the target GC command, a target write command corresponding to the SSD master controller is generated.
  • the solid-state drive garbage collection acceleration device when a solid-state drive garbage collection acceleration device generates a target write command corresponding to an SSD master controller based on a target GC command, the solid-state drive garbage collection acceleration device can obtain a pre-stored command template of the SSD master controller, the command template including a fixed field and a parameter field; extract the write command parameter field in the target GC command; replace the parameter field in the command template with the write command parameter field to obtain the target write command, etc.
  • Step S207 transmitting the target write command to the SSD master controller, so that the SSD master controller writes the target data into the second flash memory block based on the target write command.
  • the solid-state hard disk garbage collection acceleration device can also determine the storage address of the target read command in the data cache space; obtain the target data read by the SSD main controller, and cache the target data to the data cache space according to the storage address, so as to store the target data with the help of the data cache space.
  • the solid state drive garbage collection acceleration device can determine the buffer code corresponding to the target read command in the process of determining the storage address of the target read command in the data cache space. number; the product of the buffer number and the buffer size is determined as the storage address, so as to quickly determine the storage address; wherein the buffer includes the storage space obtained by equally dividing the data cache space.
  • the solid-state drive garbage collection acceleration device can also record the target read command and target data, so as to determine whether all target data have been read completely based on the recorded information.
  • the solid-state drive garbage collection acceleration device can also release the corresponding storage space of the storage address in the data cache space after transmitting the target write command to the SSD main controller, so that the data cache space can be prepared for the next data storage.
  • FIG. 10 is a schematic diagram of the structure of a solid state drive garbage collection system provided in an embodiment of the present application.
  • An embodiment of the present application provides a solid state hard disk garbage collection acceleration device, which may include:
  • the receiving port 101 is used to receive a target GC command sent by the GC management software of the target solid state drive;
  • the command builder 102 is used to generate a target read command corresponding to the SSD master controller of the target solid state drive based on the target GC command; transmit the target read command to the SSD master controller so that the SSD master controller reads the corresponding target data from the first flash memory block based on the target read command; generate a target write command corresponding to the SSD master controller based on the target GC command; transmit the target write command to the SSD master controller so that the SSD master controller writes the target data into the second flash memory block based on the target write command.
  • An embodiment of the present application provides a solid state hard disk garbage collection acceleration device, and a command builder may include:
  • a first acquisition module is used to acquire a pre-stored command template of the SSD master controller, where the command template includes a fixed field and a parameter field;
  • a first extraction module used to extract a read command parameter field in a target GC command
  • the first replacement module is used to replace the parameter field in the command template with the read command parameter field. Replace and get the target read command.
  • a first determination module is used to determine the storage address of the target read command in the data cache space after the command builder transmits the target read command to the SSD master controller;
  • the second acquisition module is used to acquire the target data read by the SSD main controller, and cache the target data into the data cache space according to the storage address.
  • An embodiment of the present application provides a solid-state hard disk garbage collection acceleration device, in which the first determination module can be specifically used to: determine the buffer number corresponding to the target read command; determine the product value of the buffer number and the buffer size as the storage address; wherein the buffer includes the storage space obtained by evenly dividing the data cache space.
  • the first recording module is used to record the target read command and target data after the command builder transmits the target read command to the SSD master controller.
  • the first release module is used to release the corresponding storage space of the storage address in the data cache space after the command builder transmits the target write command to the SSD main controller.
  • the first generation module is used to generate a target GC response instruction corresponding to the target GC command after the command builder transmits the target write command to the SSD main controller, and transmit the target GC response instruction to the GC management software.
  • the interaction process between the solid state drive garbage collection acceleration device and the GC management software and the SSD main controller can be shown as 11, including the following steps:
  • the command building module first receives the gc_sq sent by the GC management software;
  • the command construction module applies for buf id from the data cache management module
  • the command building module notifies the read command status recording module of the applied buf id, and the read command status recording module records the buf id;
  • the command construction module reads the command and opcode from the command template, constructs the read command and sends it to the SSD controller;
  • the SSD master controller parses the command, reads valid data from the nand and transmits it to the universal solid state drive garbage collection acceleration device;
  • the read command status recording module After receiving the read command data, the read command status recording module writes the data to the data cache address corresponding to buf_id;
  • the read command status recording module determines whether all the read command data has been written to the data cache. If all the data has been written to the data cache, the driving command construction module generates an SSD controller write command;
  • the command construction module reads the write command template and opcode from the command template, constructs the write command and sends it to the SSD master;
  • the SSD master controller parses the command and requests data from the general GC acceleration module
  • the read command status recording module receives the data request, reads the data from the cache address corresponding to buf_id and transmits it to the SSD, and releases buf_id to the data cache management module;
  • the SSD master controller After receiving the data, the SSD master controller writes it to the new location of the nand and notifies the general GC acceleration module that the write command has been executed;
  • the solid state drive garbage collection acceleration device returns the software gc_cq to notify the GC management software that the gc command is completed.
  • the present application also provides an electronic device and a computer-readable storage medium, both of which have the corresponding effects of an electronic method provided in an embodiment of the present application.
  • Figure 12 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
  • An electronic device provided in an embodiment of the present application includes a memory 201 and a processor 202.
  • the memory 201 stores a computer program.
  • the processor 202 executes the computer program, the following steps are implemented:
  • the target write command is transmitted to the SSD master controller, so that the SSD master controller writes the target data into the second flash memory block based on the target write command.
  • An electronic device includes a memory 201 and a processor 202.
  • the memory 201 stores a computer program
  • the processor 202 implements the following steps when executing the computer program: obtaining a pre-stored command template of the SSD master controller, the command template including a fixed field and a parameter field; extracting a read command parameter field in a target GC command; replacing the parameter field in the command template with the read command parameter field to obtain a target read command.
  • An electronic device provided in an embodiment of the present application includes a memory 201 and a processor 202.
  • a computer program is stored in the memory 201.
  • the processor 202 executes the computer program, the following steps are implemented: after transmitting a target read command to an SSD master controller, a storage address of the target read command in a data cache space is determined; target data read by the SSD master controller is obtained, and the target data is cached in the data cache space according to the storage address.
  • An electronic device provided in an embodiment of the present application includes a memory 201 and a processor 202, wherein a computer program is stored in the memory 201, and the processor 202 implements the following steps when executing the computer program: determining a buffer number corresponding to a target read command; determining the product value of the buffer number and the buffer size as a storage address; wherein the buffer includes a storage space obtained by evenly dividing the data cache space.
  • An electronic device provided in an embodiment of the present application includes a memory 201 and a processor 202.
  • the memory 201 stores a computer program.
  • the processor 202 executes the computer program, the following steps are implemented: after transmitting a target read command to an SSD main controller, the target read command and target data are recorded.
  • An electronic device provided in an embodiment of the present application includes a memory 201 and a processor 202.
  • the memory 201 stores a computer program.
  • the processor 202 executes the computer program, the following steps are implemented: after transmitting the target write command to the SSD main controller, the corresponding storage space of the storage address in the data cache space is released.
  • An electronic device provided in an embodiment of the present application includes a memory 201 and a processor 202.
  • a computer program is stored in the memory 201.
  • the processor 202 executes the computer program, the following steps are implemented: after transmitting the target write command to the SSD main controller, a target GC response instruction corresponding to the target GC command is generated, and the target GC response instruction is transmitted to the GC management software.
  • another electronic device may further include: an input port 203 connected to the processor 202, used to transmit commands input from the outside to the processor 202; a display unit 204 connected to the processor 202, used to display the processing results of the processor 202 to the outside; and a communication module 205 connected to the processor 202, used to realize communication between the electronic device and the outside.
  • Display unit Element 204 can be a display panel, a laser scanning display, etc.; the communication method adopted by the communication module 205 includes but is not limited to mobile high-definition link technology (HML), universal serial bus (USB), high-definition multimedia interface (HDMI), wireless connection: wireless fidelity technology (WiFi), Bluetooth communication technology, low-power Bluetooth communication technology, and communication technology based on IEEE802.11s.
  • HML mobile high-definition link technology
  • USB universal serial bus
  • HDMI high-definition multimedia interface
  • WiFi wireless fidelity technology
  • Bluetooth communication technology Bluetooth communication technology
  • low-power Bluetooth communication technology low-power Bluetooth communication technology
  • An embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored.
  • a computer program is stored.
  • the following steps are implemented:
  • the target write command is transmitted to the SSD master controller, so that the SSD master controller writes the target data into the second flash memory block based on the target write command.
  • An embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored.
  • the computer program is executed by a processor, the following steps are implemented: obtaining a pre-stored command template of an SSD master controller, the command template including a fixed field and a parameter field; extracting a read command parameter field in a target GC command; replacing the parameter field in the command template with the read command parameter field to obtain a target read command.
  • An embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored.
  • the computer program is executed by a processor, the following steps are implemented: after transmitting a target read command to an SSD master controller, determining a storage address of the target read command in a data cache space; obtaining target data read by the SSD master controller, and caching the target data into the data cache space according to the storage address.
  • An embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored.
  • the computer program is executed by a processor, the following steps are implemented: determining a buffer number corresponding to a target read command; determining the product value of the buffer number and the buffer size as a storage address; wherein the buffer includes a storage space obtained by evenly dividing the data cache space.
  • a computer-readable storage medium provided in an embodiment of the present application, a computer-readable storage medium
  • a computer program is stored in the memory, and when the computer program is executed by the processor, the following steps are implemented: after transmitting the target read command to the SSD main controller, the target read command and the target data are recorded.
  • An embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored.
  • the computer program is executed by a processor, the following steps are implemented: after transmitting a target write command to an SSD master controller, the corresponding storage space of the storage address in the data cache space is released.
  • An embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored.
  • the computer program is executed by a processor, the following steps are implemented: after transmitting a target write command to an SSD master controller, a target GC response instruction corresponding to the target GC command is generated, and the target GC response instruction is transmitted to the GC management software.
  • the computer-readable storage medium involved in the present application includes random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disks, removable disks, CD-ROMs, or any other form of storage medium known in the technical field.
  • RAM random access memory
  • ROM read-only memory
  • electrically programmable ROM electrically erasable programmable ROM
  • registers hard disks, removable disks, CD-ROMs, or any other form of storage medium known in the technical field.
  • each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments.
  • the same or similar parts between the embodiments can be referred to each other.
  • the description is relatively simple, and the relevant parts can be referred to the method part.
  • the steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two.
  • the software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

A solid state drive (SSD) garbage collection (GC) method, an SSD GC acceleration apparatus, and a device and a computer medium. The method is applied to an SSD GC acceleration apparatus, and comprises: receiving a target GC command sent by GC management software of a target SSD; on the basis of the target GC command, generating a target read command corresponding to an SSD master controller of the target SSD; transmitting the target read command to the SSD master controller, such that the SSD master controller reads corresponding target data from a first flash memory block on the basis of the target read command; on the basis of the target GC command, generating a target write command corresponding to the SSD master controller; and transmitting the target write command to the SSD master controller, such that the SSD master controller writes the target data into a second flash memory block on the basis of the target write command. In the present application, GC management software only requires one instance of software hardware interaction with an SSD master controller to complete a GC operation, thereby reducing software and hardware interaction latency, and improving the GC efficiency of an SSD.

Description

固态硬盘垃圾回收方法、加速装置、设备及计算机介质Solid state hard disk garbage recovery method, acceleration device, equipment and computer medium
本申请要求于2022年12月23日提交中国专利局、申请号为202211666319.9、发明名称为“固态硬盘垃圾回收方法、加速装置、设备及计算机介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority to the Chinese patent application filed with the China Patent Office on December 23, 2022, with application number 202211666319.9 and invention name “Solid State Drive Garbage Recovery Method, Acceleration Device, Equipment and Computer Medium”, all contents of which are incorporated by reference in this application.
技术领域Technical Field
本申请涉及计算机技术领域,特别涉及固态硬盘垃圾回收方法、加速装置、设备及计算机介质。The present application relates to the field of computer technology, and in particular to a solid state hard disk garbage recovery method, an acceleration device, equipment and a computer medium.
背景技术Background technique
GC(Garbage Collection,垃圾回收)是固态硬盘(Solid State Drives,SSD)的一个基本技术,它对SSD的性能和寿命有直接的影响,SSD控制器的GC功能可以大致理解为普通硬盘的碎片整理功能,它将SSD闪存块中的有效数据依次读取到外部数据缓存,待读取数据总长度到达SSD page size时,将外部缓存的有效数据写入到一个新的闪存块,然后将旧的闪存块进行擦除操作,得到一个新的闪存块。GC (Garbage Collection) is a basic technology of Solid State Drives (SSD). It has a direct impact on the performance and life of SSD. The GC function of SSD controller can be roughly understood as the defragmentation function of ordinary hard disk. It reads the valid data in SSD flash memory blocks into the external data cache in sequence. When the total length of the read data reaches the SSD page size, the valid data in the external cache is written to a new flash memory block, and then the old flash memory block is erased to obtain a new flash memory block.
为了实现对固态硬盘的GC管控,可以借助软件来对固态硬盘进行GC操作;在此过程中,软件需通过FTL(flash translation layer)查找有效数据nand(NAND flash memory)存储位置,并分配新的nand写入位置,并根据操作命令对数据缓存空间进行管理,比如在读命令时需要分配空间,写命令执行完成后释放空间,且需构建SSD主控器读写命令下发给SSD主控器,并回收SSD主控器返回的命令completion。如此一来,在一次GC过程中,往往伴随着多个读命令和一个写命令,软件必须保证所有GC读命令的completion全部收到后,才可以下发给SSD主控器写命令,等收到写命令的completion后才可以释放数据缓存空间,这样会整个GC过程中软件,硬件(SSD主控制器)交互频繁,而每次软硬交互都会引入软硬交互latency(延迟),导致缓存空间从分配到释放的间隔变长,进而导致整个数据缓存空间利率效率变低,影响固态硬盘的GC效率。 In order to achieve GC control of SSD, software can be used to perform GC operation on SSD. In this process, the software needs to find the storage location of valid data nand (NAND flash memory) through FTL (flash translation layer), allocate new nand write location, and manage data cache space according to operation commands. For example, space needs to be allocated when reading commands, and space needs to be released after the write command is executed. In addition, the SSD master controller read and write commands need to be constructed and sent to the SSD master controller, and the command completion returned by the SSD master controller needs to be recovered. In this way, in a GC process, there are often multiple read commands and one write command. The software must ensure that the completion of all GC read commands is received before sending the write command to the SSD master controller. After receiving the completion of the write command, the data cache space can be released. This will cause frequent interaction between software and hardware (SSD master controller) during the entire GC process, and each software-hardware interaction will introduce software-hardware interaction latency, resulting in a longer interval from allocation to release of cache space, which in turn leads to a lower interest rate efficiency of the entire data cache space, affecting the GC efficiency of the SSD.
综上所述,如何提高固态硬盘的垃圾回收效率是目前本领域技术人员亟待解决的问题。In summary, how to improve the garbage collection efficiency of solid state drives is an urgent problem to be solved by those skilled in the art.
发明内容Summary of the invention
本申请的目的是提供一种固态硬盘垃圾回收方法,其能在一定程度上解决如何提高固态硬盘的垃圾回收效率的技术问题。本申请还提供了一种固态硬盘垃圾回收加速装置、电子设备及计算机可读存储介质。The purpose of this application is to provide a solid state drive garbage collection method, which can solve the technical problem of how to improve the garbage collection efficiency of solid state drives to a certain extent. This application also provides a solid state drive garbage collection acceleration device, an electronic device and a computer-readable storage medium.
为了实现上述目的,本申请提供如下技术方案:In order to achieve the above objectives, this application provides the following technical solutions:
一种固态硬盘垃圾回收方法,应用于固态硬盘垃圾回收加速装置,包括:A solid state drive garbage collection method, applied to a solid state drive garbage collection acceleration device, comprising:
接收目标固态硬盘的GC管理软件发送的目标GC命令;Receive a target GC command sent by the GC management software of the target solid state drive;
基于所述目标GC命令,生成与所述目标固态硬盘的SSD主控制器对应的目标读命令;Based on the target GC command, generating a target read command corresponding to the SSD master controller of the target solid state drive;
传输所述目标读命令至所述SSD主控制器,以使所述SSD主控制器基于所述目标读命令从第一闪存块中读取对应的目标数据;Transmitting the target read command to the SSD master controller, so that the SSD master controller reads corresponding target data from the first flash memory block based on the target read command;
基于所述目标GC命令,生成与所述SSD主控制器对应的目标写命令;Based on the target GC command, generating a target write command corresponding to the SSD master controller;
传输所述目标写命令至所述SSD主控制器,以使所述SSD主控制器基于所述目标写命令将所述目标数据写入第二闪存块中。The target write command is transmitted to the SSD master controller, so that the SSD master controller writes the target data into the second flash memory block based on the target write command.
优选的,所述基于所述目标GC命令,生成与所述目标固态硬盘的SSD主控制器对应的目标读命令,包括:Preferably, generating a target read command corresponding to an SSD master controller of the target solid state drive based on the target GC command includes:
获取预存的所述SSD主控制器的命令模板,所述命令模板包括固定字段和参数字段;Acquire a pre-stored command template of the SSD master controller, wherein the command template includes a fixed field and a parameter field;
提取所述目标GC命令中的读命令参数字段;Extracting a read command parameter field in the target GC command;
将所述命令模板中的所述参数字段用所述读命令参数字段进行替换,得到所述目标读命令。The parameter field in the command template is replaced with the read command parameter field to obtain the target read command.
优选的,所述传输所述目标读命令至所述SSD主控制器之后,还包括:Preferably, after transmitting the target read command to the SSD master controller, the method further includes:
确定所述目标读命令在数据缓存空间中的存储地址;Determining a storage address of the target read command in the data cache space;
获取所述SSD主控制器读取的所述目标数据,并按照所述存储地址将所述目标数据缓存至所述数据缓存空间中。 The target data read by the SSD master controller is acquired, and the target data is cached in the data cache space according to the storage address.
优选的,所述确定所述目标读命令在数据缓存空间中的存储地址,包括:Preferably, determining the storage address of the target read command in the data cache space includes:
确定所述目标读命令对应的缓冲区编号;Determine the buffer number corresponding to the target read command;
将所述缓冲区编号与缓冲区大小的乘积值确定为所述存储地址;Determine the product value of the buffer zone number and the buffer zone size as the storage address;
其中,缓冲区包括对所述数据缓存空间进行均分后得到的存储空间。The buffer area includes a storage space obtained by evenly dividing the data cache space.
优选的,所述传输所述目标读命令至所述SSD主控制器之后,还包括:Preferably, after transmitting the target read command to the SSD master controller, the method further includes:
记录所述目标读命令及所述目标数据。The target read command and the target data are recorded.
优选的,所述传输所述目标写命令至所述SSD主控制器之后,还包括:Preferably, after transmitting the target write command to the SSD master controller, the method further includes:
释放所述存储地址在所述数据缓存空间中的对应存储空间。The storage space corresponding to the storage address in the data cache space is released.
优选的,所述传输所述目标写命令至所述SSD主控制器之后,还包括:Preferably, after transmitting the target write command to the SSD master controller, the method further includes:
生成与所述目标GC命令对应的目标GC应答指令,并传输所述目标GC应答指令至所述GC管理软件。A target GC response instruction corresponding to the target GC command is generated, and the target GC response instruction is transmitted to the GC management software.
一种固态硬盘垃圾回收加速装置,包括:A solid state hard disk garbage collection acceleration device, comprising:
接收端口,用于接收目标固态硬盘的GC管理软件发送的目标GC命令;A receiving port, used to receive a target GC command sent by the GC management software of the target solid state drive;
命令构建器,用于基于所述目标GC命令,生成与所述目标固态硬盘的SSD主控制器对应的目标读命令;传输所述目标读命令至所述SSD主控制器,以使所述SSD主控制器基于所述目标读命令从第一闪存块中读取对应的目标数据;基于所述目标GC命令,生成与所述SSD主控制器对应的目标写命令;传输所述目标写命令至所述SSD主控制器,以使所述SSD主控制器基于所述目标写命令将所述目标数据写入第二闪存块中。A command builder is used to generate a target read command corresponding to the SSD master controller of the target solid state drive based on the target GC command; transmit the target read command to the SSD master controller so that the SSD master controller reads the corresponding target data from the first flash memory block based on the target read command; generate a target write command corresponding to the SSD master controller based on the target GC command; transmit the target write command to the SSD master controller so that the SSD master controller writes the target data into the second flash memory block based on the target write command.
一种电子设备,包括:An electronic device, comprising:
存储器,用于存储计算机程序;Memory for storing computer programs;
处理器,用于执行所述计算机程序时实现如上任一所述固态硬盘垃圾回收方法的步骤。A processor is used to implement the steps of any of the solid state drive garbage collection methods described above when executing the computer program.
一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机程序,所述计算机程序被处理器执行时实现如上任一所述固态硬盘垃圾回收方法的步骤。 A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of any of the solid-state hard disk garbage collection methods described above are implemented.
本申请提供的一种固态硬盘垃圾回收方法,应用于固态硬盘垃圾回收加速装置,接收目标固态硬盘的GC管理软件发送的目标GC命令;基于目标GC命令,生成与目标固态硬盘的SSD主控制器对应的目标读命令;传输目标读命令至SSD主控制器,以使SSD主控制器基于目标读命令从第一闪存块中读取对应的目标数据;基于目标GC命令,生成与SSD主控制器对应的目标写命令;传输目标写命令至SSD主控制器,以使SSD主控制器基于目标写命令将目标数据写入第二闪存块中。本申请中,固态硬盘垃圾回收加速装置在接收GC管理软件发送的目标GC命令后,可以生成相应的目标读命令并发送至SSD主控制器进行处理,且可以基于目标GC命令生成相应的目标写命令并发送至SSD主控制器进行处理,使得GC管理软件只需与SSD主控制器进行一次软硬件交互便可以完成GC操作,降低了软硬交互引入的软硬交互latency,提高了固态硬盘的垃圾回收效率。本申请提供的一种固态硬盘垃圾回收加速装置、电子设备及计算机可读存储介质也解决了相应技术问题。The present application provides a solid-state hard disk garbage collection method, which is applied to a solid-state hard disk garbage collection acceleration device, receiving a target GC command sent by the GC management software of the target solid-state hard disk; based on the target GC command, generating a target read command corresponding to the SSD main controller of the target solid-state hard disk; transmitting the target read command to the SSD main controller, so that the SSD main controller reads the corresponding target data from the first flash memory block based on the target read command; based on the target GC command, generating a target write command corresponding to the SSD main controller; transmitting the target write command to the SSD main controller, so that the SSD main controller writes the target data to the second flash memory block based on the target write command. In the present application, after receiving the target GC command sent by the GC management software, the solid-state hard disk garbage collection acceleration device can generate a corresponding target read command and send it to the SSD main controller for processing, and can generate a corresponding target write command based on the target GC command and send it to the SSD main controller for processing, so that the GC management software can complete the GC operation only by performing a hardware and software interaction with the SSD main controller once, reducing the hardware and software interaction latency introduced by the hardware and software interaction, and improving the garbage collection efficiency of the solid-state hard disk. The solid-state hard disk garbage collection acceleration device, electronic device and computer-readable storage medium provided in this application also solve corresponding technical problems.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are merely embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
图1为GC操作过程中的数据读取示意图;FIG1 is a schematic diagram of data reading during GC operation;
图2为GC操作过程中的数据写入示意图;FIG2 is a schematic diagram of data writing during GC operation;
图3为GC操作过程中的数据擦除示意图;FIG3 is a schematic diagram of data erasure during GC operation;
图4为借助软件对固态硬盘进行GC读命令的执行示意图;FIG4 is a schematic diagram of executing a GC read command on a solid state drive with the aid of software;
图5为借助软件对固态硬盘进行GC写命令的执行示意图;FIG5 is a schematic diagram of executing a GC write command on a solid state drive with the aid of software;
图6为现有技术中整个GC的时间组成示意图;FIG6 is a schematic diagram of the time composition of the entire GC in the prior art;
图7为本申请实施例提供的一种固态硬盘垃圾回收方法的第一流程图;FIG7 is a first flow chart of a solid state drive garbage collection method provided by an embodiment of the present application;
图8为本申请提供的固态硬盘垃圾回收方法中GC时间组成示意图; FIG8 is a schematic diagram of GC time composition in the solid state drive garbage collection method provided by the present application;
图9为本申请实施例提供的一种固态硬盘垃圾回收方法的第二流程图;FIG9 is a second flow chart of a solid state drive garbage collection method provided by an embodiment of the present application;
图10为本申请实施例提供的一种固态硬盘垃圾回收系统的结构示意图;FIG10 is a schematic diagram of the structure of a solid state drive garbage collection system provided in an embodiment of the present application;
图11为固态硬盘垃圾回收加速装置与GC管理软件、SSD主控制器间的交互过程图;FIG11 is a diagram showing the interaction process between the solid state drive garbage collection acceleration device, the GC management software, and the SSD main controller;
图12为本申请实施例提供的一种电子设备的结构示意图;FIG12 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
图13为本申请实施例提供的一种电子设备的另一结构示意图。FIG. 13 is another schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. 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 creative work are within the scope of protection of this application.
GC(Garbage Collection,垃圾回收)是固态硬盘(Solid State Drives,SSD)的一个基本技术,它对SSD的性能和寿命有直接的影响,SSD控制器的GC功能可以大致理解为普通硬盘的碎片整理功能,它将SSD闪存块中的有效数据依次读取到外部数据缓存,过程如图1所示,待读取数据总长度到达SSD page size时,将外部缓存的有效数据写入到一个新的闪存块,过程如图2所示,然后将旧的闪存块进行擦除操作,过程如图3所示,得到一个新的闪存块。GC (Garbage Collection) is a basic technology of Solid State Drives (SSD). It has a direct impact on the performance and life of SSD. The GC function of SSD controller can be roughly understood as the defragmentation function of ordinary hard disk. It reads the valid data in SSD flash memory block to the external data cache in sequence. The process is shown in Figure 1. When the total length of the read data reaches the SSD page size, the valid data of the external cache is written to a new flash memory block. The process is shown in Figure 2. Then the old flash memory block is erased. The process is shown in Figure 3 to obtain a new flash memory block.
为了实现对固态硬盘的GC管控,可以借助软件来对固态硬盘进行GC操作;整个过程如图4和图5所示,在此过程中,软件需通过FTL(flash translation layer)查找有效数据nand(NAND flash memory)存储位置,并分配新的nand写入位置,并根据操作命令对数据缓存空间进行管理,比如在读命令时需要分配空间,写命令执行完成后释放空间,且需构建SSD主控器读写命令下发给SSD主控器,并回收SSD主控器返回的命令completion。如此一来,在一次GC过程中,往往伴随着多个读命令和一个写命令,软件 必须保证所有GC读命令的completion全部收到后,才可以下发给SSD主控器写命令,等收到写命令的completion后才可以释放数据缓存空间,这样会整个GC过程中软件,硬件(SSD主控制器)交互频繁,而每次软硬交互都会引入软硬交互latency,整个GC的时间组成如图6所示,导致缓存空间从分配到释放的间隔变长,进而导致整个数据缓存空间利率效率变低,影响固态硬盘的GC效率。而本申请提供的固态硬盘垃圾回收方案可以提高固态硬盘的垃圾回收效率。In order to achieve GC control of SSDs, software can be used to perform GC operations on SSDs; the whole process is shown in Figures 4 and 5. During this process, the software needs to find the storage location of valid data nand (NAND flash memory) through FTL (flash translation layer), allocate new nand write locations, and manage data cache space according to operation commands. For example, space needs to be allocated when reading commands, and space needs to be released after the write command is executed. In addition, the SSD master controller read and write commands need to be constructed and sent to the SSD master controller, and the command completion returned by the SSD master controller needs to be recovered. In this way, in a GC process, there are often multiple read commands and one write command, and the software It is necessary to ensure that all GC read command completions are received before the write command can be sent to the SSD master controller, and the data cache space can be released only after the write command completion is received. This will cause frequent interactions between software and hardware (SSD master controller) during the entire GC process, and each software-hardware interaction will introduce software-hardware interaction latency. The time composition of the entire GC is shown in Figure 6, which will cause the interval from cache space allocation to release to become longer, which will in turn cause the entire data cache space interest rate efficiency to become lower, affecting the GC efficiency of the solid-state drive. The solid-state drive garbage collection solution provided by this application can improve the garbage collection efficiency of the solid-state drive.
请参阅图7,图7为本申请实施例提供的一种固态硬盘垃圾回收方法的第一流程图。Please refer to FIG. 7 , which is a first flow chart of a solid state drive garbage collection method provided in an embodiment of the present application.
本申请实施例提供的一种固态硬盘垃圾回收方法,应用于固态硬盘垃圾回收加速装置,可以包括以下步骤:A solid state drive garbage collection method provided in an embodiment of the present application is applied to a solid state drive garbage collection acceleration device and may include the following steps:
步骤S101:接收目标固态硬盘的GC管理软件发送的目标GC命令。Step S101: receiving a target GC command sent by the GC management software of the target solid state drive.
实际应用中,固态硬盘垃圾回收加速装置可以先接收目标固态硬盘的GC管理软件发送的目标GC命令,目标GC命令的内容可以根据具体的GC操作需求来确定,本申请在此不做具体限定。In actual applications, the solid state drive garbage collection acceleration device can first receive the target GC command sent by the GC management software of the target solid state drive. The content of the target GC command can be determined according to the specific GC operation requirements, and this application does not make specific limitations here.
步骤S102:基于目标GC命令,生成与目标固态硬盘的SSD主控制器对应的目标读命令。Step S102: Based on the target GC command, a target read command corresponding to the SSD master controller of the target solid state drive is generated.
实际应用中,在GC操作过程中,需先将目标固态硬盘中的有效数据读取出来,所以固态硬盘垃圾回收加速装置在接收目标固态硬盘的GC管理软件发送的目标GC命令之后,可以先基于目标GC命令,生成与目标固态硬盘的SSD主控制器对应的目标读命令,以便后续基于该目标读命令控制SSD主控制器进行相应的数据读取操作。In actual applications, during the GC operation, the valid data in the target solid-state hard disk needs to be read out first. Therefore, after the solid-state hard disk garbage collection acceleration device receives the target GC command sent by the GC management software of the target solid-state hard disk, it can first generate a target read command corresponding to the SSD main controller of the target solid-state hard disk based on the target GC command, so as to subsequently control the SSD main controller to perform corresponding data reading operations based on the target read command.
步骤S103:传输目标读命令至SSD主控制器,以使SSD主控制器基于目标读命令从第一闪存块中读取对应的目标数据。Step S103: transmitting a target read command to the SSD master controller, so that the SSD master controller reads corresponding target data from the first flash memory block based on the target read command.
实际应用中,固态硬盘垃圾回收加速装置在基于目标GC命令,生成与目标固态硬盘的SSD主控制器对应的目标读命令之后,便可以传输目标读命令至SSD主控制器,以使SSD主控制器基于目标读命令从第一闪存块中读取对应的目标数据,也即从第一闪存块中读取所需保留的有效数据来作为目标数据。 In actual applications, after the solid-state drive garbage collection acceleration device generates a target read command corresponding to the SSD master controller of the target solid-state drive based on the target GC command, the target read command can be transmitted to the SSD master controller, so that the SSD master controller reads the corresponding target data from the first flash memory block based on the target read command, that is, reads the valid data that needs to be retained from the first flash memory block as the target data.
步骤S104:基于目标GC命令,生成与SSD主控制器对应的目标写命令。Step S104: Based on the target GC command, a target write command corresponding to the SSD master controller is generated.
实际应用中,在GC操作过程中,还需将之前读取的数据写入固态硬盘中,所以固态硬盘垃圾回收加速装置在传输目标读命令至SSD主控制器,以使SSD主控制器基于目标读命令从第一闪存块中读取对应的目标数据之后,还需基于目标GC命令,生成与SSD主控制器对应的目标写命令,以便借助该目标写命令控制SSD主控制重新将目标数据写入固态硬盘中。In actual applications, during the GC operation, the previously read data needs to be written into the solid-state drive. Therefore, after the solid-state drive garbage collection acceleration device transmits the target read command to the SSD master controller so that the SSD master controller reads the corresponding target data from the first flash memory block based on the target read command, it also needs to generate a target write command corresponding to the SSD master controller based on the target GC command, so as to control the SSD master controller to re-write the target data into the solid-state drive with the help of the target write command.
步骤S105:传输目标写命令至SSD主控制器,以使SSD主控制器基于目标写命令将目标数据写入第二闪存块中。Step S105: transmitting the target write command to the SSD master controller, so that the SSD master controller writes the target data into the second flash memory block based on the target write command.
实际应用中,固态硬盘垃圾回收加速装置在基于目标GC命令,生成与SSD主控制器对应的目标写命令,便可以传输目标写命令至SSD主控制器,以使SSD主控制器基于目标写命令将目标数据写入第二闪存块中。In actual applications, the solid-state drive garbage collection acceleration device generates a target write command corresponding to the SSD master controller based on the target GC command, and can transmit the target write command to the SSD master controller so that the SSD master controller writes the target data into the second flash memory block based on the target write command.
具体应用场景中,固态硬盘垃圾回收加速装置在传输目标读命令至SSD主控制器之后,为了及时告知GC管理软件已完成GC操作,还可以生成与目标GC命令对应的目标GC应答指令,并传输目标GC应答指令至GC管理软件。In a specific application scenario, after transmitting the target read command to the SSD main controller, the solid-state drive garbage collection acceleration device can also generate a target GC response instruction corresponding to the target GC command in order to promptly inform the GC management software that the GC operation has been completed, and transmit the target GC response instruction to the GC management software.
本申请提供的一种固态硬盘垃圾回收方法,应用于固态硬盘垃圾回收加速装置,接收目标固态硬盘的GC管理软件发送的目标GC命令;基于目标GC命令,生成与目标固态硬盘的SSD主控制器对应的目标读命令;传输目标读命令至SSD主控制器,以使SSD主控制器基于目标读命令从第一闪存块中读取对应的目标数据;基于目标GC命令,生成与SSD主控制器对应的目标写命令;传输目标写命令至SSD主控制器,以使SSD主控制器基于目标写命令将目标数据写入第二闪存块中。本申请中,固态硬盘垃圾回收加速装置在接收GC管理软件发送的目标GC命令后,可以生成相应的目标读命令并发送至SSD主控制器进行处理,且可以基于目标GC命令生成相应的目标写命令并发送至SSD主控制器进行处理,使得GC管理软件只需与SSD主控制器进行一次软硬件交互便可以完成GC操作,降低了软硬交互引入的软硬交互latency,提高了固态硬盘的垃圾回收效率。为便于理解本申请提供的固态硬盘垃圾回收方法的效率,请参阅图8,图8为本申请提供的固态硬盘垃圾回收方法中GC时间组成示意图,对比图8和图6可知,本申请 在一次GC过程中,软硬件间最多交互两次,比现有技术至少少进行一次软硬件交互,也即本申请可以降低软硬交互引入的软硬交互latency,提高固态硬盘的垃圾回收效率。The present application provides a solid-state hard disk garbage collection method, which is applied to a solid-state hard disk garbage collection acceleration device, receiving a target GC command sent by the GC management software of the target solid-state hard disk; based on the target GC command, generating a target read command corresponding to the SSD main controller of the target solid-state hard disk; transmitting the target read command to the SSD main controller, so that the SSD main controller reads the corresponding target data from the first flash memory block based on the target read command; based on the target GC command, generating a target write command corresponding to the SSD main controller; transmitting the target write command to the SSD main controller, so that the SSD main controller writes the target data to the second flash memory block based on the target write command. In the present application, after receiving the target GC command sent by the GC management software, the solid-state hard disk garbage collection acceleration device can generate a corresponding target read command and send it to the SSD main controller for processing, and can generate a corresponding target write command based on the target GC command and send it to the SSD main controller for processing, so that the GC management software can complete the GC operation only by performing a hardware and software interaction with the SSD main controller once, reducing the hardware and software interaction latency introduced by the hardware and software interaction, and improving the garbage collection efficiency of the solid-state hard disk. To facilitate understanding of the efficiency of the solid-state hard disk garbage collection method provided by the present application, please refer to FIG. 8, which is a schematic diagram of the GC time composition in the solid-state hard disk garbage collection method provided by the present application. By comparing FIG. 8 with FIG. 6, it can be seen that the present application In one GC process, the software and hardware interact with each other at most twice, which is at least one less software and hardware interaction than the prior art. That is, the present application can reduce the software and hardware interaction latency introduced by the software and hardware interaction and improve the garbage collection efficiency of the solid-state hard disk.
请参阅图9,图9为本申请实施例提供的一种固态硬盘垃圾回收方法的第二流程图。Please refer to FIG. 9 , which is a second flow chart of a solid state drive garbage collection method provided in an embodiment of the present application.
本申请实施例提供的一种固态硬盘垃圾回收方法,应用于固态硬盘垃圾回收加速装置,可以包括以下步骤:A solid state drive garbage collection method provided in an embodiment of the present application is applied to a solid state drive garbage collection acceleration device and may include the following steps:
步骤S201:接收目标固态硬盘的GC管理软件发送的目标GC命令。Step S201: receiving a target GC command sent by the GC management software of the target solid state drive.
步骤S202:获取预存的SSD主控制器的命令模板,命令模板包括固定字段和参数字段。Step S202: Acquire a pre-stored command template of the SSD master controller, where the command template includes a fixed field and a parameter field.
步骤S203:提取目标GC命令中的读命令参数字段。Step S203: extracting the read command parameter field in the target GC command.
步骤S204:将命令模板中的参数字段用读命令参数字段进行替换,得到目标读命令。Step S204: Replace the parameter field in the command template with the read command parameter field to obtain the target read command.
实际应用中,固态硬盘垃圾回收加速装置在基于目标GC命令,生成与目标固态硬盘的SSD主控制器对应的目标读命令的过程中,考虑到不同SSD主控制器的读写命令格式不同,为了快速生成对应SSD主控制器的读写命令,固态硬盘垃圾回收加速装置可以获取预存的SSD主控制器的命令模板,命令模板包括固定字段和参数字段,其格式可以如表1所示,其中,浅灰色表格表示SSD控制器参数字段,深灰色表格表示SSD控制器命令固定字段;提取目标GC命令中的读命令参数字段;将命令模板中的参数字段用读命令参数字段进行替换,得到兼容不同SSD主控制器的目标读命令。In practical applications, when the solid-state drive garbage collection acceleration device generates a target read command corresponding to the SSD master controller of the target solid-state drive based on the target GC command, taking into account the different read and write command formats of different SSD master controllers, in order to quickly generate the read and write commands corresponding to the SSD master controller, the solid-state drive garbage collection acceleration device can obtain a pre-stored command template of the SSD master controller. The command template includes a fixed field and a parameter field, and its format can be as shown in Table 1, wherein the light gray table represents the SSD controller parameter field, and the dark gray table represents the SSD controller command fixed field; extract the read command parameter field in the target GC command; replace the parameter field in the command template with the read command parameter field to obtain a target read command compatible with different SSD master controllers.
表1命令模板示意表
Table 1 Command template diagram
为便于理解,假设在具体应用场景中,SSD主控制器的读命令模板如表2所示,则固态硬盘垃圾回收加速装置在生成目标读命令的过程中,可以 先读取命令模板和opcode,opcode用于描述读命令模板中的参数字段用gc sq字段替代,如bit0~bit3,bit4~8…分别用gc sq中的字段依次顺序替代生成目标读命令等,相应的,SSD主控器收到目标读命令后可以按照自己的解析方式,解析该目标读命令以进行响应等。如表2所示,读命令字段包括了ch、fq、cmd_type、cmd_sub_type、lc、2mtc、bitmap等字段,其中cmd_type、cmd_sub_type、lc、2mtc、gc字段是固定字段,因为每个读命令这些字段的内容都是相同的;剩下的字段称为参数字段,每个读命令这些字段内容是不相同的,需要用gc sq中的参数来替代。For ease of understanding, assuming that in a specific application scenario, the read command template of the SSD master controller is as shown in Table 2, the solid-state drive garbage collection acceleration device can generate the target read command in the process of: First read the command template and opcode. The opcode is used to describe the parameter fields in the read command template and replace them with the gc sq fields. For example, bit0~bit3, bit4~8...are replaced with the fields in gc sq in sequence to generate the target read command, etc. Correspondingly, after receiving the target read command, the SSD master controller can parse the target read command in its own parsing method to respond, etc. As shown in Table 2, the read command field includes ch, fq, cmd_type, cmd_sub_type, lc, 2mtc, bitmap and other fields, among which cmd_type, cmd_sub_type, lc, 2mtc, gc fields are fixed fields, because the contents of these fields are the same for each read command; the remaining fields are called parameter fields, and the contents of these fields are different for each read command, and need to be replaced with the parameters in gc sq.
表2 SSD主控制器的读命令模板示意表
Table 2 Schematic diagram of the read command template of the SSD host controller
步骤S205:传输目标读命令至SSD主控制器,以使SSD主控制器基于目标读命令从第一闪存块中读取对应的目标数据。Step S205: transmitting the target read command to the SSD master controller, so that the SSD master controller reads the corresponding target data from the first flash memory block based on the target read command.
步骤S206:基于目标GC命令,生成与SSD主控制器对应的目标写命令。Step S206: Based on the target GC command, a target write command corresponding to the SSD master controller is generated.
实际应用中,固态硬盘垃圾回收加速装置在基于目标GC命令,生成与SSD主控制器对应的目标写命令的过程中,可以获取预存的SSD主控制器的命令模板,命令模板包括固定字段和参数字段;提取目标GC命令中的写命令参数字段;将命令模板中的参数字段用写命令参数字段进行替换,得到目标写命令等。In practical applications, when a solid-state drive garbage collection acceleration device generates a target write command corresponding to an SSD master controller based on a target GC command, the solid-state drive garbage collection acceleration device can obtain a pre-stored command template of the SSD master controller, the command template including a fixed field and a parameter field; extract the write command parameter field in the target GC command; replace the parameter field in the command template with the write command parameter field to obtain the target write command, etc.
步骤S207:传输目标写命令至SSD主控制器,以使SSD主控制器基于目标写命令将目标数据写入第二闪存块中。Step S207: transmitting the target write command to the SSD master controller, so that the SSD master controller writes the target data into the second flash memory block based on the target write command.
实际应用中,固态硬盘垃圾回收加速装置在传输目标读命令至SSD主控制器之后,还可以确定目标读命令在数据缓存空间中的存储地址;获取SSD主控制器读取的目标数据,并按照存储地址将目标数据缓存至数据缓存空间中,以借助数据缓存空间存储目标数据。In actual applications, after transmitting the target read command to the SSD main controller, the solid-state hard disk garbage collection acceleration device can also determine the storage address of the target read command in the data cache space; obtain the target data read by the SSD main controller, and cache the target data to the data cache space according to the storage address, so as to store the target data with the help of the data cache space.
具体应用场景中,固态硬盘垃圾回收加速装置在确定目标读命令在数据缓存空间中的存储地址的过程中,可以确定目标读命令对应的缓冲区编 号;将缓冲区编号与缓冲区大小的乘积值确定为存储地址,以此来快速确定存储地址;其中,缓冲区包括对数据缓存空间进行均分后得到的存储空间。为便于理解,假设数据缓存空间被分成size相同的buf,每个buf分配一个唯一的buf_id,也即缓冲区编号,则通过buf_id可以快速计算出对应的存储地址=buf_id*size。In a specific application scenario, the solid state drive garbage collection acceleration device can determine the buffer code corresponding to the target read command in the process of determining the storage address of the target read command in the data cache space. number; the product of the buffer number and the buffer size is determined as the storage address, so as to quickly determine the storage address; wherein the buffer includes the storage space obtained by equally dividing the data cache space. For ease of understanding, assuming that the data cache space is divided into bufs of the same size, each buf is assigned a unique buf_id, that is, the buffer number, then the corresponding storage address can be quickly calculated through buf_id = buf_id*size.
具体应用场景中,固态硬盘垃圾回收加速装置在传输目标读命令至SSD主控制器之后,还可以记录目标读命令及目标数据,以便基于该记录信息判断目标数据是否全部读取完备等。In a specific application scenario, after transmitting the target read command to the SSD main controller, the solid-state drive garbage collection acceleration device can also record the target read command and target data, so as to determine whether all target data have been read completely based on the recorded information.
具体应用场景中,为了提高数据缓存空间的工作能力,固态硬盘垃圾回收加速装置在传输目标写命令至SSD主控制器之后,还可以释放存储地址在数据缓存空间中的对应存储空间,以便数据缓存空间为下一次的数据存储做好准备。In specific application scenarios, in order to improve the working capacity of the data cache space, the solid-state drive garbage collection acceleration device can also release the corresponding storage space of the storage address in the data cache space after transmitting the target write command to the SSD main controller, so that the data cache space can be prepared for the next data storage.
请参阅图10,图10为本申请实施例提供的一种固态硬盘垃圾回收系统的结构示意图。Please refer to FIG. 10 , which is a schematic diagram of the structure of a solid state drive garbage collection system provided in an embodiment of the present application.
本申请实施例提供的一种固态硬盘垃圾回收加速装置,可以包括:An embodiment of the present application provides a solid state hard disk garbage collection acceleration device, which may include:
接收端口101,用于接收目标固态硬盘的GC管理软件发送的目标GC命令;The receiving port 101 is used to receive a target GC command sent by the GC management software of the target solid state drive;
命令构建器102,用于基于目标GC命令,生成与目标固态硬盘的SSD主控制器对应的目标读命令;传输目标读命令至SSD主控制器,以使SSD主控制器基于目标读命令从第一闪存块中读取对应的目标数据;基于目标GC命令,生成与SSD主控制器对应的目标写命令;传输目标写命令至SSD主控制器,以使SSD主控制器基于目标写命令将目标数据写入第二闪存块中。The command builder 102 is used to generate a target read command corresponding to the SSD master controller of the target solid state drive based on the target GC command; transmit the target read command to the SSD master controller so that the SSD master controller reads the corresponding target data from the first flash memory block based on the target read command; generate a target write command corresponding to the SSD master controller based on the target GC command; transmit the target write command to the SSD master controller so that the SSD master controller writes the target data into the second flash memory block based on the target write command.
本申请实施例提供的一种固态硬盘垃圾回收加速装置,命令构建器可以包括:An embodiment of the present application provides a solid state hard disk garbage collection acceleration device, and a command builder may include:
第一获取模块,用于获取预存的SSD主控制器的命令模板,命令模板包括固定字段和参数字段;A first acquisition module is used to acquire a pre-stored command template of the SSD master controller, where the command template includes a fixed field and a parameter field;
第一提取模块,用于提取目标GC命令中的读命令参数字段;A first extraction module, used to extract a read command parameter field in a target GC command;
第一替换模块,用于将命令模板中的参数字段用读命令参数字段进行 替换,得到目标读命令。The first replacement module is used to replace the parameter field in the command template with the read command parameter field. Replace and get the target read command.
本申请实施例提供的一种固态硬盘垃圾回收加速装置,还可以包括:The solid state drive garbage collection acceleration device provided in the embodiment of the present application may also include:
第一确定模块,用于命令构建器传输目标读命令至SSD主控制器之后,确定目标读命令在数据缓存空间中的存储地址;A first determination module is used to determine the storage address of the target read command in the data cache space after the command builder transmits the target read command to the SSD master controller;
第二获取模块,用于获取SSD主控制器读取的目标数据,并按照存储地址将目标数据缓存至数据缓存空间中。The second acquisition module is used to acquire the target data read by the SSD main controller, and cache the target data into the data cache space according to the storage address.
本申请实施例提供的一种固态硬盘垃圾回收加速装置,第一确定模块可以具体用于:确定目标读命令对应的缓冲区编号;将缓冲区编号与缓冲区大小的乘积值确定为存储地址;其中,缓冲区包括对数据缓存空间进行均分后得到的存储空间。An embodiment of the present application provides a solid-state hard disk garbage collection acceleration device, in which the first determination module can be specifically used to: determine the buffer number corresponding to the target read command; determine the product value of the buffer number and the buffer size as the storage address; wherein the buffer includes the storage space obtained by evenly dividing the data cache space.
本申请实施例提供的一种固态硬盘垃圾回收加速装置,还可以包括:The solid state drive garbage collection acceleration device provided in the embodiment of the present application may also include:
第一记录模块,用于命令构建器传输目标读命令至SSD主控制器之后,记录目标读命令及目标数据。The first recording module is used to record the target read command and target data after the command builder transmits the target read command to the SSD master controller.
本申请实施例提供的一种固态硬盘垃圾回收加速装置,还可以包括:The solid state drive garbage collection acceleration device provided in the embodiment of the present application may also include:
第一释放模块,用于命令构建器传输目标写命令至SSD主控制器之后,释放存储地址在数据缓存空间中的对应存储空间。The first release module is used to release the corresponding storage space of the storage address in the data cache space after the command builder transmits the target write command to the SSD main controller.
本申请实施例提供的一种固态硬盘垃圾回收加速装置,还可以包括:The solid state drive garbage collection acceleration device provided in the embodiment of the present application may also include:
第一生成模块,用于命令构建器传输目标写命令至SSD主控制器之后,生成与目标GC命令对应的目标GC应答指令,并传输目标GC应答指令至GC管理软件。The first generation module is used to generate a target GC response instruction corresponding to the target GC command after the command builder transmits the target write command to the SSD main controller, and transmit the target GC response instruction to the GC management software.
需要说明的是,本申请中固态硬盘垃圾回收加速装置的具体结构可以根据实际需要灵活确定,比如在一实施例中,固态硬盘垃圾回收加速装置与GC管理软件、SSD主控制器间的交互过程可以如11所示,包括以下步骤:It should be noted that the specific structure of the solid state drive garbage collection acceleration device in the present application can be flexibly determined according to actual needs. For example, in one embodiment, the interaction process between the solid state drive garbage collection acceleration device and the GC management software and the SSD main controller can be shown as 11, including the following steps:
命令构建模块先接收GC管理软件发送的gc_sq;The command building module first receives the gc_sq sent by the GC management software;
命令构建模块从数据缓存管理模块申请buf id;The command construction module applies for buf id from the data cache management module;
命令构建模块将申请到的buf id通知给读命令状态记录模块,读命令状态记录模块记录buf id;The command building module notifies the read command status recording module of the applied buf id, and the read command status recording module records the buf id;
命令构建模块从命令模板读取命令和opcode,构建读命令下发给SSD主控器; The command construction module reads the command and opcode from the command template, constructs the read command and sends it to the SSD controller;
SSD主控器解析命令,从nand读取有效数据传给通用固态硬盘垃圾回收加速装置;The SSD master controller parses the command, reads valid data from the nand and transmits it to the universal solid state drive garbage collection acceleration device;
读命令状态记录模块收到读命令数据后,将数据写到buf_id对应的数据缓存地址中;After receiving the read command data, the read command status recording module writes the data to the data cache address corresponding to buf_id;
读命令状态记录模块判断读命令数据是否已全部写到数据缓存,如果全部写到数据缓存,驱动命令构建模块产生SSD控制器写命令;The read command status recording module determines whether all the read command data has been written to the data cache. If all the data has been written to the data cache, the driving command construction module generates an SSD controller write command;
命令构建模块从命令模板读取写命令模板和opcode,构建写命令下发给SSD主空器;The command construction module reads the write command template and opcode from the command template, constructs the write command and sends it to the SSD master;
SSD主控器解析命令,向通用GC加速模块请求数据;The SSD master controller parses the command and requests data from the general GC acceleration module;
读命令状态记录模块收到数据请求,从buf_id对应的缓存地址读数据传给SSD,并将buf_id释放到数据缓存管理模块;The read command status recording module receives the data request, reads the data from the cache address corresponding to buf_id and transmits it to the SSD, and releases buf_id to the data cache management module;
SSD主控器收到数据后,写入nand新位置后,通知通用GC加速模块写命令执行完成;After receiving the data, the SSD master controller writes it to the new location of the nand and notifies the general GC acceleration module that the write command has been executed;
固态硬盘垃圾回收加速装置返回软件gc_cq,通知GC管理软件gc命令完成。The solid state drive garbage collection acceleration device returns the software gc_cq to notify the GC management software that the gc command is completed.
本申请还提供了一种电子设备及计算机可读存储介质,其均具有本申请实施例提供的一种电子方法具有的对应效果。请参阅图12,图12为本申请实施例提供的一种电子设备的结构示意图。The present application also provides an electronic device and a computer-readable storage medium, both of which have the corresponding effects of an electronic method provided in an embodiment of the present application. Please refer to Figure 12, which is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
本申请实施例提供的一种电子设备,包括存储器201和处理器202,存储器201中存储有计算机程序,处理器202执行计算机程序时实现如下步骤:An electronic device provided in an embodiment of the present application includes a memory 201 and a processor 202. The memory 201 stores a computer program. When the processor 202 executes the computer program, the following steps are implemented:
接收目标固态硬盘的GC管理软件发送的目标GC命令;Receive a target GC command sent by the GC management software of the target solid state drive;
基于目标GC命令,生成与目标固态硬盘的SSD主控制器对应的目标读命令;Based on the target GC command, generate a target read command corresponding to the SSD master controller of the target solid state drive;
传输目标读命令至SSD主控制器,以使SSD主控制器基于目标读命令从第一闪存块中读取对应的目标数据;Transmitting a target read command to the SSD master controller, so that the SSD master controller reads corresponding target data from the first flash memory block based on the target read command;
基于目标GC命令,生成与SSD主控制器对应的目标写命令;Based on the target GC command, generate a target write command corresponding to the SSD master controller;
传输目标写命令至SSD主控制器,以使SSD主控制器基于目标写命令将目标数据写入第二闪存块中。The target write command is transmitted to the SSD master controller, so that the SSD master controller writes the target data into the second flash memory block based on the target write command.
本申请实施例提供的一种电子设备,包括存储器201和处理器202,存 储器201中存储有计算机程序,处理器202执行计算机程序时实现如下步骤:获取预存的SSD主控制器的命令模板,命令模板包括固定字段和参数字段;提取目标GC命令中的读命令参数字段;将命令模板中的参数字段用读命令参数字段进行替换,得到目标读命令。An electronic device provided in an embodiment of the present application includes a memory 201 and a processor 202. The memory 201 stores a computer program, and the processor 202 implements the following steps when executing the computer program: obtaining a pre-stored command template of the SSD master controller, the command template including a fixed field and a parameter field; extracting a read command parameter field in a target GC command; replacing the parameter field in the command template with the read command parameter field to obtain a target read command.
本申请实施例提供的一种电子设备,包括存储器201和处理器202,存储器201中存储有计算机程序,处理器202执行计算机程序时实现如下步骤:传输目标读命令至SSD主控制器之后,确定目标读命令在数据缓存空间中的存储地址;获取SSD主控制器读取的目标数据,并按照存储地址将目标数据缓存至数据缓存空间中。An electronic device provided in an embodiment of the present application includes a memory 201 and a processor 202. A computer program is stored in the memory 201. When the processor 202 executes the computer program, the following steps are implemented: after transmitting a target read command to an SSD master controller, a storage address of the target read command in a data cache space is determined; target data read by the SSD master controller is obtained, and the target data is cached in the data cache space according to the storage address.
本申请实施例提供的一种电子设备,包括存储器201和处理器202,存储器201中存储有计算机程序,处理器202执行计算机程序时实现如下步骤:确定目标读命令对应的缓冲区编号;将缓冲区编号与缓冲区大小的乘积值确定为存储地址;其中,缓冲区包括对数据缓存空间进行均分后得到的存储空间。An electronic device provided in an embodiment of the present application includes a memory 201 and a processor 202, wherein a computer program is stored in the memory 201, and the processor 202 implements the following steps when executing the computer program: determining a buffer number corresponding to a target read command; determining the product value of the buffer number and the buffer size as a storage address; wherein the buffer includes a storage space obtained by evenly dividing the data cache space.
本申请实施例提供的一种电子设备,包括存储器201和处理器202,存储器201中存储有计算机程序,处理器202执行计算机程序时实现如下步骤:传输目标读命令至SSD主控制器之后,记录目标读命令及目标数据。An electronic device provided in an embodiment of the present application includes a memory 201 and a processor 202. The memory 201 stores a computer program. When the processor 202 executes the computer program, the following steps are implemented: after transmitting a target read command to an SSD main controller, the target read command and target data are recorded.
本申请实施例提供的一种电子设备,包括存储器201和处理器202,存储器201中存储有计算机程序,处理器202执行计算机程序时实现如下步骤:传输目标写命令至SSD主控制器之后,释放存储地址在数据缓存空间中的对应存储空间。An electronic device provided in an embodiment of the present application includes a memory 201 and a processor 202. The memory 201 stores a computer program. When the processor 202 executes the computer program, the following steps are implemented: after transmitting the target write command to the SSD main controller, the corresponding storage space of the storage address in the data cache space is released.
本申请实施例提供的一种电子设备,包括存储器201和处理器202,存储器201中存储有计算机程序,处理器202执行计算机程序时实现如下步骤:传输目标写命令至SSD主控制器之后,生成与目标GC命令对应的目标GC应答指令,并传输目标GC应答指令至GC管理软件。An electronic device provided in an embodiment of the present application includes a memory 201 and a processor 202. A computer program is stored in the memory 201. When the processor 202 executes the computer program, the following steps are implemented: after transmitting the target write command to the SSD main controller, a target GC response instruction corresponding to the target GC command is generated, and the target GC response instruction is transmitted to the GC management software.
请参阅图13,本申请实施例提供的另一种电子设备中还可以包括:与处理器202连接的输入端口203,用于传输外界输入的命令至处理器202;与处理器202连接的显示单元204,用于显示处理器202的处理结果至外界;与处理器202连接的通信模块205,用于实现电子设备与外界的通信。显示单 元204可以为显示面板、激光扫描使显示器等;通信模块205所采用的通信方式包括但不局限于移动高清链接技术(HML)、通用串行总线(USB)、高清多媒体接口(HDMI)、无线连接:无线保真技术(WiFi)、蓝牙通信技术、低功耗蓝牙通信技术、基于IEEE802.11s的通信技术。Please refer to FIG. 13 , another electronic device provided in the embodiment of the present application may further include: an input port 203 connected to the processor 202, used to transmit commands input from the outside to the processor 202; a display unit 204 connected to the processor 202, used to display the processing results of the processor 202 to the outside; and a communication module 205 connected to the processor 202, used to realize communication between the electronic device and the outside. Display unit Element 204 can be a display panel, a laser scanning display, etc.; the communication method adopted by the communication module 205 includes but is not limited to mobile high-definition link technology (HML), universal serial bus (USB), high-definition multimedia interface (HDMI), wireless connection: wireless fidelity technology (WiFi), Bluetooth communication technology, low-power Bluetooth communication technology, and communication technology based on IEEE802.11s.
本申请实施例提供的一种计算机可读存储介质,计算机可读存储介质中存储有计算机程序,计算机程序被处理器执行时实现如下步骤:An embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:
接收目标固态硬盘的GC管理软件发送的目标GC命令;Receive a target GC command sent by the GC management software of the target solid state drive;
基于目标GC命令,生成与目标固态硬盘的SSD主控制器对应的目标读命令;Based on the target GC command, generate a target read command corresponding to the SSD master controller of the target solid state drive;
传输目标读命令至SSD主控制器,以使SSD主控制器基于目标读命令从第一闪存块中读取对应的目标数据;Transmitting a target read command to the SSD master controller, so that the SSD master controller reads corresponding target data from the first flash memory block based on the target read command;
基于目标GC命令,生成与SSD主控制器对应的目标写命令;Based on the target GC command, generate a target write command corresponding to the SSD master controller;
传输目标写命令至SSD主控制器,以使SSD主控制器基于目标写命令将目标数据写入第二闪存块中。The target write command is transmitted to the SSD master controller, so that the SSD master controller writes the target data into the second flash memory block based on the target write command.
本申请实施例提供的一种计算机可读存储介质,计算机可读存储介质中存储有计算机程序,计算机程序被处理器执行时实现如下步骤:获取预存的SSD主控制器的命令模板,命令模板包括固定字段和参数字段;提取目标GC命令中的读命令参数字段;将命令模板中的参数字段用读命令参数字段进行替换,得到目标读命令。An embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented: obtaining a pre-stored command template of an SSD master controller, the command template including a fixed field and a parameter field; extracting a read command parameter field in a target GC command; replacing the parameter field in the command template with the read command parameter field to obtain a target read command.
本申请实施例提供的一种计算机可读存储介质,计算机可读存储介质中存储有计算机程序,计算机程序被处理器执行时实现如下步骤:传输目标读命令至SSD主控制器之后,确定目标读命令在数据缓存空间中的存储地址;获取SSD主控制器读取的目标数据,并按照存储地址将目标数据缓存至数据缓存空间中。An embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented: after transmitting a target read command to an SSD master controller, determining a storage address of the target read command in a data cache space; obtaining target data read by the SSD master controller, and caching the target data into the data cache space according to the storage address.
本申请实施例提供的一种计算机可读存储介质,计算机可读存储介质中存储有计算机程序,计算机程序被处理器执行时实现如下步骤:确定目标读命令对应的缓冲区编号;将缓冲区编号与缓冲区大小的乘积值确定为存储地址;其中,缓冲区包括对数据缓存空间进行均分后得到的存储空间。An embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented: determining a buffer number corresponding to a target read command; determining the product value of the buffer number and the buffer size as a storage address; wherein the buffer includes a storage space obtained by evenly dividing the data cache space.
本申请实施例提供的一种计算机可读存储介质,计算机可读存储介质 中存储有计算机程序,计算机程序被处理器执行时实现如下步骤:传输目标读命令至SSD主控制器之后,记录目标读命令及目标数据。A computer-readable storage medium provided in an embodiment of the present application, a computer-readable storage medium A computer program is stored in the memory, and when the computer program is executed by the processor, the following steps are implemented: after transmitting the target read command to the SSD main controller, the target read command and the target data are recorded.
本申请实施例提供的一种计算机可读存储介质,计算机可读存储介质中存储有计算机程序,计算机程序被处理器执行时实现如下步骤:传输目标写命令至SSD主控制器之后,释放存储地址在数据缓存空间中的对应存储空间。An embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented: after transmitting a target write command to an SSD master controller, the corresponding storage space of the storage address in the data cache space is released.
本申请实施例提供的一种计算机可读存储介质,计算机可读存储介质中存储有计算机程序,计算机程序被处理器执行时实现如下步骤:传输目标写命令至SSD主控制器之后,生成与目标GC命令对应的目标GC应答指令,并传输目标GC应答指令至GC管理软件。An embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented: after transmitting a target write command to an SSD master controller, a target GC response instruction corresponding to the target GC command is generated, and the target GC response instruction is transmitted to the GC management software.
本申请所涉及的计算机可读存储介质包括随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质。The computer-readable storage medium involved in the present application includes random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disks, removable disks, CD-ROMs, or any other form of storage medium known in the technical field.
本申请实施例提供的固态硬盘垃圾回收装置、电子设备及计算机可读存储介质中相关部分的说明请参见本申请实施例提供的固态硬盘垃圾回收方法中对应部分的详细说明,在此不再赘述。另外,本申请实施例提供的上述技术方案中与现有技术中对应技术方案实现原理一致的部分并未详细说明,以免过多赘述。For the description of the relevant parts of the solid-state hard disk garbage collection device, electronic device, and computer-readable storage medium provided in the embodiments of the present application, please refer to the detailed description of the corresponding parts of the solid-state hard disk garbage collection method provided in the embodiments of the present application, which will not be repeated here. In addition, the parts of the above-mentioned technical solutions provided in the embodiments of the present application that are consistent with the implementation principles of the corresponding technical solutions in the prior art are not described in detail to avoid excessive elaboration.
本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其它实施例的不同之处,各个实施例之间相同或相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
专业人员还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现 不应认为超出本申请的范围。Professionals may further realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the composition and steps of each example according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation is not limited to the following: It should not be regarded as exceeding the scope of the present application.
结合本文中所公开的实施例描述的方法或算法的步骤可以直接用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
以上对本申请所提供的固态硬盘垃圾回收方案进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。 The above is a detailed introduction to the solid-state hard drive garbage collection solution provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims (10)

  1. 一种固态硬盘垃圾回收方法,其特征在于,应用于固态硬盘垃圾回收加速装置,包括:A solid state drive garbage collection method, characterized in that it is applied to a solid state drive garbage collection acceleration device, comprising:
    接收目标固态硬盘的GC管理软件发送的目标GC命令;Receive a target GC command sent by the GC management software of the target solid state drive;
    基于所述目标GC命令,生成与所述目标固态硬盘的SSD主控制器对应的目标读命令;Based on the target GC command, generating a target read command corresponding to the SSD master controller of the target solid state drive;
    传输所述目标读命令至所述SSD主控制器,以使所述SSD主控制器基于所述目标读命令从第一闪存块中读取对应的目标数据;Transmitting the target read command to the SSD master controller, so that the SSD master controller reads corresponding target data from the first flash memory block based on the target read command;
    基于所述目标GC命令,生成与所述SSD主控制器对应的目标写命令;Based on the target GC command, generating a target write command corresponding to the SSD master controller;
    传输所述目标写命令至所述SSD主控制器,以使所述SSD主控制器基于所述目标写命令将所述目标数据写入第二闪存块中。The target write command is transmitted to the SSD master controller, so that the SSD master controller writes the target data into the second flash memory block based on the target write command.
  2. 根据权利要求1所述的方法,其特征在于,所述基于所述目标GC命令,生成与所述目标固态硬盘的SSD主控制器对应的目标读命令,包括:The method according to claim 1, characterized in that the generating, based on the target GC command, a target read command corresponding to the SSD master controller of the target solid state drive comprises:
    获取预存的所述SSD主控制器的命令模板,所述命令模板包括固定字段和参数字段;Acquire a pre-stored command template of the SSD master controller, wherein the command template includes a fixed field and a parameter field;
    提取所述目标GC命令中的读命令参数字段;Extracting a read command parameter field in the target GC command;
    将所述命令模板中的所述参数字段用所述读命令参数字段进行替换,得到所述目标读命令。The parameter field in the command template is replaced with the read command parameter field to obtain the target read command.
  3. 根据权利要求1所述的方法,其特征在于,所述传输所述目标读命令至所述SSD主控制器之后,还包括:The method according to claim 1, characterized in that after transmitting the target read command to the SSD master controller, it also includes:
    确定所述目标读命令在数据缓存空间中的存储地址;Determining a storage address of the target read command in the data cache space;
    获取所述SSD主控制器读取的所述目标数据,并按照所述存储地址将所述目标数据缓存至所述数据缓存空间中。The target data read by the SSD master controller is acquired, and the target data is cached in the data cache space according to the storage address.
  4. 根据权利要求3所述的方法,其特征在于,所述确定所述目标读命令在数据缓存空间中的存储地址,包括:The method according to claim 3, characterized in that determining the storage address of the target read command in the data cache space comprises:
    确定所述目标读命令对应的缓冲区编号;Determine the buffer number corresponding to the target read command;
    将所述缓冲区编号与缓冲区大小的乘积值确定为所述存储地址;Determine the product value of the buffer zone number and the buffer zone size as the storage address;
    其中,缓冲区包括对所述数据缓存空间进行均分后得到的存储空间。The buffer area includes a storage space obtained by evenly dividing the data cache space.
  5. 根据权利要求3所述的方法,其特征在于,所述传输所述目标读命 令至所述SSD主控制器之后,还包括:The method according to claim 3, characterized in that the transmission of the target read command After the command is sent to the SSD master controller, it also includes:
    记录所述目标读命令及所述目标数据。The target read command and the target data are recorded.
  6. 根据权利要求3所述的方法,其特征在于,所述传输所述目标写命令至所述SSD主控制器之后,还包括:The method according to claim 3, characterized in that after transmitting the target write command to the SSD master controller, it also includes:
    释放所述存储地址在所述数据缓存空间中的对应存储空间。The storage space corresponding to the storage address in the data cache space is released.
  7. 根据权利要求1至6任一项所述的方法,其特征在于,所述传输所述目标写命令至所述SSD主控制器之后,还包括:The method according to any one of claims 1 to 6, characterized in that after transmitting the target write command to the SSD master controller, it also includes:
    生成与所述目标GC命令对应的目标GC应答指令,并传输所述目标GC应答指令至所述GC管理软件。A target GC response instruction corresponding to the target GC command is generated, and the target GC response instruction is transmitted to the GC management software.
  8. 一种固态硬盘垃圾回收加速装置,其特征在于,包括:A solid state hard disk garbage collection acceleration device, characterized by comprising:
    接收端口,用于接收目标固态硬盘的GC管理软件发送的目标GC命令;A receiving port, used to receive a target GC command sent by the GC management software of the target solid state drive;
    命令构建器,用于基于所述目标GC命令,生成与所述目标固态硬盘的SSD主控制器对应的目标读命令;传输所述目标读命令至所述SSD主控制器,以使所述SSD主控制器基于所述目标读命令从第一闪存块中读取对应的目标数据;基于所述目标GC命令,生成与所述SSD主控制器对应的目标写命令;传输所述目标写命令至所述SSD主控制器,以使所述SSD主控制器基于所述目标写命令将所述目标数据写入第二闪存块中。A command builder is used to generate a target read command corresponding to the SSD master controller of the target solid state drive based on the target GC command; transmit the target read command to the SSD master controller so that the SSD master controller reads the corresponding target data from the first flash memory block based on the target read command; generate a target write command corresponding to the SSD master controller based on the target GC command; transmit the target write command to the SSD master controller so that the SSD master controller writes the target data into the second flash memory block based on the target write command.
  9. 一种电子设备,其特征在于,包括:An electronic device, comprising:
    存储器,用于存储计算机程序;Memory for storing computer programs;
    处理器,用于执行所述计算机程序时实现如权利要求1至7任一项所述固态硬盘垃圾回收方法的步骤。A processor, configured to implement the steps of the solid state drive garbage collection method as described in any one of claims 1 to 7 when executing the computer program.
  10. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求1至7任一项所述固态硬盘垃圾回收方法的步骤。 A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the solid-state hard disk garbage collection method as described in any one of claims 1 to 7 are implemented.
PCT/CN2023/086117 2022-12-23 2023-04-04 Solid state drive garbage collection method, solid state drive garbage collection acceleration apparatus, and device and computer medium WO2024130890A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211666319.9A CN115934579A (en) 2022-12-23 2022-12-23 Solid state disk garbage recycling method, accelerating device, equipment and computer medium
CN202211666319.9 2022-12-23

Publications (1)

Publication Number Publication Date
WO2024130890A1 true WO2024130890A1 (en) 2024-06-27

Family

ID=86553871

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/086117 WO2024130890A1 (en) 2022-12-23 2023-04-04 Solid state drive garbage collection method, solid state drive garbage collection acceleration apparatus, and device and computer medium

Country Status (2)

Country Link
CN (1) CN115934579A (en)
WO (1) WO2024130890A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116775507B (en) * 2023-08-23 2023-10-20 四川云海芯科微电子科技有限公司 Hardware acceleration block selection method and device in garbage collection of solid state disk controller

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108334284A (en) * 2017-01-20 2018-07-27 三星电子株式会社 Tail delay perception foreground garbage collection algorithm
US20200097403A1 (en) * 2018-09-25 2020-03-26 Western Digital Technologies, Inc. Recency based victim block selection for garbage collection in a solid state device (ssd)
CN113377278A (en) * 2020-03-10 2021-09-10 阿里巴巴集团控股有限公司 Solid state disk, garbage recycling and controlling method, equipment, system and storage medium
WO2022017002A1 (en) * 2020-07-22 2022-01-27 华为技术有限公司 Garbage collection method and device
CN114741327A (en) * 2022-04-22 2022-07-12 中科驭数(北京)科技有限公司 Garbage recovery method and device
CN115391237A (en) * 2022-09-06 2022-11-25 山东华芯半导体有限公司 Garbage recovery system and method applied to flash memory storage controller

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108334284A (en) * 2017-01-20 2018-07-27 三星电子株式会社 Tail delay perception foreground garbage collection algorithm
US20200097403A1 (en) * 2018-09-25 2020-03-26 Western Digital Technologies, Inc. Recency based victim block selection for garbage collection in a solid state device (ssd)
CN113377278A (en) * 2020-03-10 2021-09-10 阿里巴巴集团控股有限公司 Solid state disk, garbage recycling and controlling method, equipment, system and storage medium
WO2022017002A1 (en) * 2020-07-22 2022-01-27 华为技术有限公司 Garbage collection method and device
CN114741327A (en) * 2022-04-22 2022-07-12 中科驭数(北京)科技有限公司 Garbage recovery method and device
CN115391237A (en) * 2022-09-06 2022-11-25 山东华芯半导体有限公司 Garbage recovery system and method applied to flash memory storage controller

Also Published As

Publication number Publication date
CN115934579A (en) 2023-04-07

Similar Documents

Publication Publication Date Title
US8521949B2 (en) Data deleting method and apparatus
US9734085B2 (en) DMA transmission method and system thereof
US9927998B2 (en) Flash memory compression
US8352676B2 (en) Apparatus and method to store a plurality of data having a common pattern and guarantee codes associated therewith in a single page
US9395921B2 (en) Writing data using DMA by specifying a buffer address and a flash memory address
CN109726138B (en) Data storage device and non-volatile memory operation method
TWI569139B (en) Valid data merging method, memory controller and memory storage apparatus
US20130166818A1 (en) Memory logical defragmentation during garbage collection
TW201118877A (en) Flash memory device, data storage system, and operation method of a data storage system
JP2008198208A (en) Operation method for host data processing device, host data processing device, and data storage device
US10585589B2 (en) Data collation method, storage device, storage controller, and storage array
WO2024130890A1 (en) Solid state drive garbage collection method, solid state drive garbage collection acceleration apparatus, and device and computer medium
TWI715248B (en) Apparatus and method and computer program product for executing host input-output commands
CN113760185A (en) Memory block recovery method and device
CN102479549A (en) Semiconductor storage device
US9524236B1 (en) Systems and methods for performing memory management based on data access properties
CN116257460B (en) Trim command processing method based on solid state disk and solid state disk
US20180217935A1 (en) Method and apparatus for reading redundant array of independent disks
KR20100056400A (en) Recordable memory device
TW202137013A (en) Data processing method and memory controller utilizing the same
WO2022021280A1 (en) Storage controller, storage control method, solid state disk and storage system
TWI805937B (en) Data processing method and memory controller utilizing the same
CN109284237A (en) A kind of full rubbish recovering method and system dodged in storage array
KR101278591B1 (en) System and operating method for flash memory
CN117492658A (en) Data power-on processing method, system, equipment and computer storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23905082

Country of ref document: EP

Kind code of ref document: A1