Data deletion method and device of block storage system, electronic equipment and storage medium
By precisely associating the physical data units of logical data blocks in the block storage system, constructing the deallocation range, and sending commands, the problem of invalid data migration in the prior art is solved, thereby improving storage system performance and extending hard drive life.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
- Filing Date
- 2026-01-14
- Publication Date
- 2026-04-28
AI Technical Summary
Existing technologies only reclaim the metadata area but fail to effectively manage the physical data area that stores the actual data. This causes the solid-state drive to continuously migrate invalid data that has been logically deleted during the background garbage collection process, resulting in significant write amplification and severely impacting the overall performance and lifespan of the storage system.
By determining the physical data units occupied by the logical data block in the physical data area of the storage device, a deallocation range is constructed, and a deallocation command is sent to the storage device to directly instruct the storage device to perform the deallocation operation. Finally, the metadata area is reset to ensure that the logical space is reclaimed.
It effectively cuts off the root cause of invalid data migration, directly reduces write amplification, improves the overall performance of the storage system, and extends the lifespan of the solid-state drive.
Smart Images

Figure CN121934779A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of block storage technology, and in particular to a data deletion method, apparatus, electronic device and storage medium for a block storage system. Background Technology
[0002] With the widespread adoption of non-volatile solid-state drives (SSDs) in block storage systems, effectively managing data lifecycles and improving storage efficiency has become crucial. In such systems, data is typically organized into fixed-size logical blocks, and metadata maintains the mapping between these blocks and their physical storage addresses.
[0003] In existing technologies, when a logical block needs to be deleted, the usual approach is to release or mark the index information occupied by that logical block in the metadata area, thereby completing the space reclamation at the logical level. This process mainly involves operations on the metadata structure.
[0004] However, the aforementioned existing technical solutions only reclaim the metadata area but do not effectively manage the physical data area that stores the actual data. This causes the solid-state drive to continuously migrate invalid data that has been logically deleted during the background garbage collection process, resulting in significant write amplification and seriously affecting the overall performance and lifespan of the storage system. Summary of the Invention
[0005] This application provides a data deletion method, apparatus, electronic device, and storage medium for a block storage system to solve the problem in the prior art where only the metadata area is reclaimed, but the physical data area storing the actual data is not effectively managed. This causes the solid-state drive to continuously migrate invalid data that has been logically deleted during the background garbage collection process, resulting in significant write amplification and seriously affecting the overall performance and lifespan of the storage system.
[0006] In a first aspect, this application provides a data deletion method for a block storage system, comprising: In response to a deletion instruction for a logical data block, determine the physical data units occupied by the logical data block in the physical data area of the storage device; Based on the physical address information of the physical data unit, a release range is constructed; Send a deallocation command containing the deallocation range to the storage device to instruct the storage device to perform a deallocation operation on the physical data unit; After the storage device completes processing the deallocation command, the metadata area corresponding to the logical data block is reset.
[0007] In one possible implementation, determining the physical data units occupied by the logical data block in the physical data area of the storage device includes: The logical data block is parsed to obtain multiple logical data sub-units that constitute the logical data block; Query the physical data unit corresponding to each logical data subunit from the metadata mapping table to obtain multiple physical data units; The multiple physical data units are determined as the physical data units occupied by the logical data block.
[0008] In one possible implementation, constructing the deallocation range based on the physical address information of the physical data unit includes: Obtain the starting logical block address of each physical data unit; For each starting logical block address, a release range corresponding to the starting logical block address is generated, resulting in multiple release ranges.
[0009] In one possible implementation, sending a deallocation command containing the deallocation range to the storage device includes: The multiple release allocation ranges are grouped according to a predetermined maximum number of submissions per session to obtain multiple range structure groups; The release command corresponding to each range structure group is sent to the storage device in sequence until all range structure groups have been processed.
[0010] In one possible implementation, prior to sending the deallocation command containing the deallocation range to the storage device, the method further includes: Count the number of the multiple release allocation ranges; If the quantity is greater than or equal to a preset quantity threshold, the step of sending a deallocation command containing the deallocation range to the storage device is executed; If the number is less than a preset threshold, the sending of the deallocation command will be stopped.
[0011] In one possible implementation, prior to sending the deallocation command containing the deallocation range to the storage device, the method further includes: Monitor the current read / write performance metrics of the storage device; If the current read / write performance index is less than a preset performance threshold, the step of sending a deallocation command containing the deallocation range to the storage device is executed. If the current read / write performance index is greater than or equal to a preset performance threshold, the sending of the deallocation command will be stopped.
[0012] In one possible implementation, before resetting the metadata area corresponding to the logical data block, the method further includes: Receive execution status feedback from the storage device during the deallocation operation; Upon receiving the execution status feedback, it is determined that the storage device has completed processing the deallocation command.
[0013] Secondly, this application provides a data deletion device for a block storage system, comprising: A determination module is used to determine, in response to a deletion instruction for a logical data block, the physical data units occupied by the logical data block in the physical data area of the storage device; The construction module is used to construct the deallocation range based on the physical address information of the physical data unit; The sending module is configured to send a deallocation command containing the deallocation range to the storage device, instructing the storage device to perform a deallocation operation on the physical data unit; The reset module is used to reset the metadata area corresponding to the logical data block after the storage device has completed processing the deallocation command.
[0014] In one possible implementation, the determining module is specifically used for: The logical data block is parsed to obtain multiple logical data sub-units that constitute the logical data block; Query the physical data unit corresponding to each logical data subunit from the metadata mapping table to obtain multiple physical data units; The multiple physical data units are determined as the physical data units occupied by the logical data block.
[0015] In one possible implementation, the construction module is specifically used for: Obtain the starting logical block address of each physical data unit; For each starting logical block address, a release range corresponding to the starting logical block address is generated, resulting in multiple release ranges.
[0016] In one possible implementation, the sending module is specifically used for: The multiple release allocation ranges are grouped according to a predetermined maximum number of submissions per session to obtain multiple range structure groups; The release command corresponding to each range structure group is sent to the storage device in sequence until all range structure groups have been processed.
[0017] In one possible implementation, the device further includes a statistics module for: Count the number of the multiple release allocation ranges; If the quantity is greater than or equal to a preset quantity threshold, the step of sending a deallocation command containing the deallocation range to the storage device is executed; If the number is less than a preset threshold, the sending of the deallocation command will be stopped.
[0018] In one possible implementation, the device further includes a monitoring module for: Monitor the current read / write performance metrics of the storage device; If the current read / write performance index is less than a preset performance threshold, the step of sending a deallocation command containing the deallocation range to the storage device is executed. If the current read / write performance index is greater than or equal to a preset performance threshold, the sending of the deallocation command will be stopped.
[0019] In one possible implementation, the device further includes a receiving module for: Receive execution status feedback from the storage device during the deallocation operation; Upon receiving the execution status feedback, it is determined that the storage device has completed processing the deallocation command.
[0020] Thirdly, this application provides an apparatus comprising: a processor and a memory, the processor being configured to execute a data deletion program for a block storage system stored in the memory, to implement the data deletion method for the block storage system described in any one of the first aspects.
[0021] Fourthly, this application provides a storage medium storing one or more programs that can be executed by one or more processors to implement the data deletion method of the block storage system described in any one aspect.
[0022] Compared with the prior art, the technical solution provided in this application has the following advantages: First, by determining the physical data unit occupied by the logical data block, the deletion operation is precisely associated with the specific physical storage space at the logical level. Next, a deallocation range is constructed based on the physical address information, and a deallocation command is sent to the storage device. This directly issues a clear indication of invalid data in a specific physical area to the solid-state drive (SSD), enabling the SSD's internal garbage collection mechanism to accurately identify that the data in these areas is invalid, thereby fundamentally avoiding unnecessary migration during garbage collection. Finally, after processing the deallocation command, the metadata area is reset, ensuring that the logical space is reclaimed. This solution effectively cuts off the root cause of invalid data migration, directly reduces write amplification, and thus improves the overall performance of the storage system and extends the lifespan of the SSD. Attached Figure Description
[0023] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0024] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0025] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.
[0026] Figure 1 A flowchart illustrating an embodiment of a data deletion method for a block storage system provided in this application; Figure 2 A flowchart illustrating an embodiment of another data deletion method for a block storage system provided in this application; Figure 3 A flowchart illustrating an embodiment of a data deletion method for a block storage system provided in this application; Figure 4 A flowchart illustrating an embodiment of a data deletion method for a block storage system provided in this application. Figure 5 This application provides an overall flowchart of a data deletion method for a block storage system. Figure 6 A block diagram illustrating an embodiment of a data deletion device for a block storage system provided in this application. Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0027] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0028] The following disclosure provides numerous different embodiments or examples for implementing various structures of this application. To simplify the disclosure, specific examples of components and arrangements are described below. These are merely examples and are not intended to limit the scope of this application. Furthermore, reference numerals and / or letters may be repeated in different examples. Such repetition is for simplification and clarity and does not in itself indicate a relationship between the various embodiments and / or arrangements discussed.
[0029] To address the technical problem in existing technologies where only the metadata area is reclaimed without effectively managing the physical data area storing the actual data, resulting in the continuous migration of logically deleted invalid data during background garbage collection of solid-state drives (SSDs), leading to significant write amplification and severely impacting the overall performance and lifespan of the storage system, this application provides a data deletion method for block storage systems. This method effectively cuts off the root cause of invalid data migration, directly reduces write amplification, and thereby improves the overall performance of the storage system and extends the lifespan of the solid-state drive.
[0030] Figure 1 This is a flowchart illustrating an embodiment of a data deletion method for a block storage system provided in this application. Figure 1 As shown, the method includes the following steps: Step 101: In response to the deletion instruction for the logical data block, determine the physical data unit occupied by the logical data block in the physical data area of the storage device.
[0031] Logical data block: refers to a data management unit in a block storage system that is divided into fixed sizes. The size of each logical data block is specified as 16 GiB.
[0032] Storage device: In this application, it specifically refers to a non-volatile solid-state drive that supports the NVMe (Non-Volatile Memory Express) protocol.
[0033] Physical data area: refers to the storage space area on a non-volatile solid-state drive (SSD) used to store actual user data, which is distinct from the metadata area that stores index information.
[0034] Physical data unit: refers to a fixed-size storage unit divided within a physical data area. Each physical data unit is called an extent, and its size is fixed at 4 MiB.
[0035] In this embodiment of the application, when the block storage system receives a deletion instruction for a certain logical data block, it first parses the metadata structure of the logical data block. The logical data block consists of 4096 logical data sub-units, and each logical data sub-unit corresponds to a physical data unit. Then, by querying the metadata mapping table, it obtains the identification information of all valid physical data units, thereby accurately determining all physical storage units actually occupied by the logical data block in the physical data area.
[0036] Step 102: Based on the physical address information of the physical data unit, construct the release range.
[0037] Release range: refers to a data structure that conforms to the data set management command requirements in the NVMe protocol. It describes the range of contiguous physical storage space to be released. This structure contains two main fields: the starting logical block address and the length.
[0038] In this embodiment, based on the physical address information of the physical data unit determined in step 101, a corresponding release range is generated according to the format required by the storage device. This range includes a starting address and length information, where the starting address is determined based on the actual location of the physical data unit in the storage device, and the length is set according to the size of the physical data unit. In practical implementation, depending on the characteristics of the storage device, corresponding release ranges can be constructed for multiple physical data units respectively, providing necessary data preparation for subsequently sending space release commands to the storage device.
[0039] Step 103: Send a deallocation command containing the deallocation range to the storage device to instruct the storage device to perform a deallocation operation on the physical data unit.
[0040] Deallocation command: refers to a space management command that conforms to the storage device protocol specification and is used to notify the storage device to perform a deallocation operation on a specified physical storage space.
[0041] In this embodiment, the deallocation scope constructed in step 102 is submitted to the storage device through the command interface provided by the storage device. Considering the processing capacity limitations of the storage device, multiple deallocation scopes can be grouped according to the maximum processing capacity supported by the device, and deallocation commands can be sent in batches. Through the execution of this command, the storage device can mark the specified physical data units as reclaimable, thereby avoiding unnecessary processing of these invalid data during subsequent storage maintenance.
[0042] Step 104: After the storage device completes the processing of the deallocation command, reset the metadata area corresponding to the logical data block.
[0043] Metadata area: This refers to a dedicated area on a storage device used to store management information for logical data blocks, recording the mapping relationship between logical data blocks and physical storage space.
[0044] In this embodiment of the application, after the storage device completes the processing of the deallocation command, a reset operation is performed on the metadata corresponding to the logical data block, including updating the metadata status and clearing mapping relationships.
[0045] Specifically, the following steps can be used to determine whether the storage device has completed processing the deallocation command: receiving execution status feedback from the storage device regarding the execution of the deallocation operation; and, upon receiving the execution status feedback, determining that the storage device has completed processing the deallocation command.
[0046] Execution status feedback: refers to the operation result information returned by the storage device after processing the deallocation command, which is used to indicate whether the deallocation operation was successfully completed.
[0047] The specific implementation process of this embodiment is as follows: After sending a deallocation command to the storage device, the system waits for and receives status feedback information returned by the storage device. This feedback information is obtained through the response mechanism of the storage device command interface and includes a status code indicating whether the operation was successful or failed. Only after receiving this status feedback, confirming that the storage device has completed processing the deallocation command, will the system execute the subsequent metadata area reset operation to ensure that the metadata reset and physical space release operation are synchronized.
[0048] This embodiment establishes an operation confirmation mechanism to achieve state synchronization between the deallocation operation and metadata management. This scheme ensures that the metadata reset operation is only executed after confirming that the physical space release operation has been completed, effectively avoiding data consistency issues caused by operation asynchrony, improving the reliability and state consistency of storage system data management, and providing a more secure and reliable data deletion guarantee for the system.
[0049] The technical solution provided in this application first determines the physical data unit occupied by the logical data block, precisely associating the deletion operation with the specific physical storage space at the logical level. Next, it constructs a deallocation range based on physical address information and sends a deallocation command to the storage device, directly issuing a clear indication of invalid data in a specific physical area to the solid-state drive (SSD). This allows the SSD's internal garbage collection mechanism to accurately identify that the data in these areas is invalid, fundamentally avoiding unnecessary migration during garbage collection. Finally, after processing the deallocation command, the metadata area is reset, ensuring that the logical space is reclaimed. This solution effectively cuts off the root cause of invalid data migration, directly reducing write amplification, thereby improving the overall performance of the storage system and extending the lifespan of the SSD.
[0050] Figure 2 A flowchart illustrating an embodiment of another data deletion method for a block storage system provided in this application. Figure 2 The process shown is in Figure 1 Based on the illustrated process, the following steps are included: Step 201: Parse the logical data block to obtain multiple logical data sub-units constituting the logical data block.
[0051] Logical data subunit: refers to the basic building block that constitutes a logical data block. In a specific implementation, each logical data block consists of 4096 logical data subunits.
[0052] In this embodiment, the identifier information of all logical data sub-units constituting the logical data block is parsed by reading the metadata structure of the logical data block. These logical data sub-units are logically arranged consecutively to form a complete logical data block.
[0053] Step 202: Query the physical data unit corresponding to each logical data subunit from the metadata mapping table to obtain multiple physical data units.
[0054] Metadata mapping table: refers to the data structure stored in the metadata area, used to record the mapping relationship between logical data sub-units and physical data units.
[0055] In this embodiment, based on the logical data sub-unit identifier obtained in step 201, the metadata mapping table is queried one by one to obtain the physical data unit identifier corresponding to each logical data sub-unit. During the query process, it is necessary to identify which logical data sub-units correspond to valid physical data units and exclude unallocated or released units.
[0056] Step 203: Determine the multiple physical data units as the physical data units occupied by the logical data block.
[0057] In this embodiment, all valid physical data units obtained in step 202 are aggregated to form a complete set of physical storage units occupied by the logical data block in the physical data area. These physical data units may be discontinuously distributed in the physical storage space, but through this aggregation process, a complete mapping relationship between the logical data block and all corresponding physical data units is established.
[0058] pass Figure 2 As shown in the process, the system can accurately establish a complete mapping relationship between logical data blocks and physical storage units, providing the necessary preparation for subsequent precise physical space release, and ensuring that data deletion operations can not only completely release physical storage space, but also not affect other valid data.
[0059] Figure 3 A flowchart illustrating an embodiment of a data deletion method for a block storage system provided in this application. Figure 3 The process shown is in Figure 1 Based on the illustrated process, the following steps are included: Step 301: Obtain the starting logical block address of each physical data unit.
[0060] Starting logical block address: refers to the starting position identifier of the physical data unit in the storage device, used to accurately locate the physical location of each physical data unit on the storage medium.
[0061] In this embodiment, based on the identification information of the physical data unit, combined with the starting address of the physical data area of the storage device and the storage space partitioning rules, the starting logical block address corresponding to each physical data unit is calculated. Specifically, the calculation formula is: the starting logical block address equals the starting address of the physical data area plus the product of the physical data unit identifier and the storage unit size, divided by the sector size. Through this calculation process, the system can accurately obtain the specific location information of each physical data unit to be released in the storage device.
[0062] Step 302: For each starting logical block address, generate the release range corresponding to the starting logical block address to obtain multiple release ranges.
[0063] In this embodiment, for each starting logical block address obtained in step 301, a corresponding release range structure is created. The starting address field is set to the starting logical block address of the physical data unit, and the length field is set to a fixed value determined by the size of the physical data unit. In a specific implementation, the length of each release range is set to 8192 sectors, corresponding to 4 MiB of storage space. Through this step, the system generates a corresponding release range for each physical data unit to be released, preparing the data for subsequent submission of space release commands to the storage device.
[0064] pass Figure 3 As shown in the process, the system can convert discrete physical data units into a set of release ranges that can be recognized by the storage device, realizing accurate conversion from physical storage units to device command parameters. This lays the technical foundation for efficient execution of physical space release operations and ensures the accuracy and effectiveness of storage space management.
[0065] Figure 4 A flowchart illustrating an embodiment of a data deletion method for a block storage system provided in this application. Figure 4 The process shown is in Figure 1Based on the illustrated process, the following steps are included: Step 401: Group the multiple release allocation ranges according to the predetermined maximum number of submissions per time to obtain multiple range structure groups.
[0066] Range structure group: refers to a set formed by grouping multiple release ranges according to specific quantity requirements.
[0067] Maximum number of writes per transaction: This refers to the maximum number of write operations that a single write command from a storage device can handle. This value is determined by the storage device's protocol specifications.
[0068] In this embodiment, the maximum number of deallocation ranges supported by the storage device in a single processing operation is first obtained. Then, all deallocation ranges to be processed are grouped according to this number. For example, when the maximum number of single submissions is 256 and the total number of deallocation ranges to be processed is 4096, they need to be divided into 16 range structure groups, each containing 256 deallocation ranges. This grouping method ensures that each range structure group meets the processing capacity requirements of the storage device.
[0069] Step 402: Send the deallocation command corresponding to each range structure group to the storage device in sequence until all range structure groups have been processed.
[0070] In this embodiment, the deallocation ranges in each range structure group are submitted to the storage device sequentially via the storage device's command interface, following the grouping order. For each range structure group, the system constructs a corresponding deallocation command containing all deallocation range information in that group. The system continues this submission process until all range structure groups have been processed. In a specific implementation, this process is achieved by repeatedly calling the storage device's command submission interface, processing one range structure group at a time.
[0071] pass Figure 4 As shown in the diagram, the system can effectively process a large number of deallocation requests in batches. This satisfies the storage device's limitation on the processing capacity of a single command while ensuring that all physical storage space to be released is effectively processed. This grouped submission method significantly improves the efficiency of storage space management, avoids processing failures caused by excessively large amounts of data submitted at once, and optimizes the overall performance of the storage system through reasonable task scheduling.
[0072] In another embodiment of this application, before step 103, the following steps may be included: counting the number of multiple deallocation ranges; if the number is greater than or equal to a preset number threshold, performing the step of sending a deallocation command containing the deallocation range to the storage device; if the number is less than the preset number threshold, suspending the sending of the deallocation command.
[0073] Preset quantity threshold: This refers to a pre-set critical value used to determine whether to immediately execute the deallocation command. This threshold is determined based on system performance optimization requirements.
[0074] The specific implementation process of this embodiment is as follows: First, the total number of currently pending deallocation ranges is counted, and then this number is compared with a preset threshold. When the number of pending ranges reaches or exceeds the threshold, the deallocation command sending operation in step 103 is executed immediately; when the number is insufficient, the command sending is not executed temporarily, and processing is delayed until more deallocation ranges are accumulated. In specific implementation, the threshold is set to 20 ranges. By accumulating a sufficient number of ranges and submitting them all at once, the number of command submissions is effectively reduced.
[0075] This embodiment introduces a quantity threshold-based judgment mechanism to achieve batch optimization processing of deallocation commands. When the number of ranges to be processed is small, sending is temporarily suspended, avoiding the problem of low command processing efficiency caused by a small number of ranges submitted at once. This intelligent scheduling mechanism significantly improves the throughput efficiency of storage device command processing, reduces unnecessary system overhead, and thus optimizes the overall performance of the storage system.
[0076] In another embodiment of this application, before step 103, the following steps may be included: monitoring the current read / write performance index of the storage device; if the current read / write performance index is less than a preset performance threshold, executing the step of sending a deallocation command containing the deallocation range to the storage device; if the current read / write performance index is greater than or equal to the preset performance threshold, suspending the sending of the deallocation command.
[0077] Current read / write performance metrics: These are quantitative parameters that reflect the real-time input / output load of the storage device, including but not limited to QPS (Queries Per Second). Preset performance thresholds: These are load thresholds pre-set according to system performance requirements, used to determine whether it is suitable to perform a deallocation operation.
[0078] The specific implementation process of this embodiment is as follows: continuously monitor the real-time QPS value of the storage device. When the monitored QPS value is lower than the preset threshold, it is determined that the system is in a low-peak period of business, and at this time, the release command is sent. When the QPS value reaches or exceeds the preset threshold, it is determined that the system is in a high-peak period of business, and at this time, the release command is not sent temporarily to avoid affecting the normal read and write business performance.
[0079] This embodiment introduces a dynamic judgment mechanism based on real-time performance indicators to achieve intelligent off-peak execution of deallocation operations. This solution effectively avoids interference with normal business input / output performance during periods of high storage device load when performing space reclamation operations, ensuring that deallocation operations are only performed during relatively idle periods of the system. Thus, while achieving the space reclamation goal, it maximizes the service quality and business performance stability of the storage system.
[0080] To better understand the connections between the steps mentioned above, the following will combine... Figure 5 The complete process of this invention will be described in its entirety: The entire process begins with a deletion command for a logical data block. The system first confirms that the block to be deleted exists in the storage structure, and then enters the core processing stage: traversing all logical data sub-units of the block (traversing blockextentid), and constructing a deallocation range structure for each valid sub-unit (constructing a valid range structure).
[0081] The process includes two key decision points: First, after constructing the scope structure, the system will determine whether the number of valid scopes is 0. If it is 0, it means that there are no physical data units that need to be released, and the system will directly jump to the metadata reset step; if it is not 0, the system will submit a deallocation command (submit spdk nvme deallocate cmd) and wait for the processing result.
[0082] Second, after the command is executed, regardless of its success or failure, the system will further determine whether the traversal of the entire block has been completed (whether the block extentid is all 4096). This determination ensures that even if the deallocation of a certain sub-unit fails, it will not prevent the process from continuing to process other sub-units and ultimately perform metadata reset.
[0083] The core design of the process lies in its robustness: Regardless of the execution result of the deallocation command, as long as the traversal is completed, the system will execute the final metadata reset step (reset the state of the BlockMeta occupied by the block) and persist it (commit the write cmd to update the state of the BlockMeta), ensuring that the logical space is reliably reclaimed.
[0084] In summary, this application achieves secure and efficient data deletion by introducing a physical space release operation and combining it with the aforementioned fault-tolerance mechanism. This fundamentally avoids invalid data migration, significantly reduces write amplification, and improves the performance and lifespan of the storage system.
[0085] Figure 6 This is a block diagram illustrating an embodiment of a data deletion device for a block storage system provided in this application. Figure 6 As shown, the device includes: The determination module 61 is used to determine the physical data unit occupied by the logical data block in the physical data area of the storage device in response to the deletion instruction of the logical data block; Construction module 62 is used to construct a release range based on the physical address information of the physical data unit; The sending module 63 is used to send a deallocation command containing the deallocation range to the storage device, so as to instruct the storage device to perform a deallocation operation on the physical data unit; The reset module 64 is used to reset the metadata area corresponding to the logical data block after the storage device has completed processing the deallocation command.
[0086] In one possible implementation, the determining module is specifically used for: The logical data block is parsed to obtain multiple logical data sub-units that constitute the logical data block; Query the physical data unit corresponding to each logical data subunit from the metadata mapping table to obtain multiple physical data units; The multiple physical data units are determined as the physical data units occupied by the logical data block.
[0087] In one possible implementation, the construction module is specifically used for: Obtain the starting logical block address of each physical data unit; For each starting logical block address, a release range corresponding to the starting logical block address is generated, resulting in multiple release ranges.
[0088] In one possible implementation, the sending module is specifically used for: The multiple release allocation ranges are grouped according to a predetermined maximum number of submissions per session to obtain multiple range structure groups; The release command corresponding to each range structure group is sent to the storage device in sequence until all range structure groups have been processed.
[0089] In one possible implementation, the device further includes a statistics module for: Count the number of the multiple release allocation ranges; If the quantity is greater than or equal to a preset quantity threshold, the step of sending a deallocation command containing the deallocation range to the storage device is executed; If the number is less than a preset threshold, the sending of the deallocation command will be stopped.
[0090] In one possible implementation, the device further includes a monitoring module for: Monitor the current read / write performance metrics of the storage device; If the current read / write performance index is less than a preset performance threshold, the step of sending a deallocation command containing the deallocation range to the storage device is executed. If the current read / write performance index is greater than or equal to a preset performance threshold, the sending of the deallocation command will be stopped.
[0091] In one possible implementation, the device further includes a receiving module for: Receive execution status feedback from the storage device during the deallocation operation; Upon receiving the execution status feedback, it is determined that the storage device has completed processing the deallocation command.
[0092] like Figure 7 As shown in the figure, this application provides a device including a processor 111, a communication interface 112, a memory 113, and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 communicate with each other through the communication bus 114. Memory 113 is used to store computer programs; In one embodiment of this application, when the processor 111 executes a program stored in the memory 113, it implements the data deletion method of the block storage system provided in any of the foregoing method embodiments, including: In response to a deletion instruction for a logical data block, determine the physical data units occupied by the logical data block in the physical data area of the storage device; Based on the physical address information of the physical data unit, a release range is constructed; Send a deallocation command containing the deallocation range to the storage device to instruct the storage device to perform a deallocation operation on the physical data unit; After the storage device completes processing the deallocation command, the metadata area corresponding to the logical data block is reset.
[0093] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the data deletion method for a block storage system as provided in any of the foregoing method embodiments.
[0094] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0095] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented using software plus a general-purpose hardware platform, or of course, using hardware. Based on this understanding, the above technical solutions, in essence or the parts that contribute to the related technology, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0096] It should be understood that the terminology used herein is for the purpose of describing particular exemplary embodiments only and is not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms “a,” “an,” and “described” as used herein may also include the plural forms. The terms “comprising,” “including,” “containing,” and “having” are inclusive and therefore indicate the presence of the stated features, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, elements, components, and / or combinations thereof. The method steps, processes, and operations described herein are not construed as requiring them to be performed in a particular order described or illustrated unless the order of performance is explicitly indicated. It should also be understood that additional or alternative steps may be used.
[0097] The above description is merely a specific embodiment of this application, enabling those skilled in the art to understand or implement this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A data deletion method for a block storage system, characterized in that, The method includes: In response to a deletion instruction for a logical data block, determine the physical data units occupied by the logical data block in the physical data area of the storage device; Based on the physical address information of the physical data unit, a release range is constructed; Send a deallocation command containing the deallocation range to the storage device to instruct the storage device to perform a deallocation operation on the physical data unit; After the storage device completes processing the deallocation command, the metadata area corresponding to the logical data block is reset.
2. The method according to claim 1, characterized in that, Determining the physical data units occupied by the logical data block in the physical data area of the storage device includes: The logical data block is parsed to obtain multiple logical data sub-units that constitute the logical data block; Query the physical data unit corresponding to each logical data subunit from the metadata mapping table to obtain multiple physical data units; The multiple physical data units are determined as the physical data units occupied by the logical data block.
3. The method according to claim 2, characterized in that, The process of constructing a release range based on the physical address information of the physical data unit includes: Obtain the starting logical block address of each physical data unit; For each starting logical block address, a release range corresponding to the starting logical block address is generated, resulting in multiple release ranges.
4. The method according to claim 3, characterized in that, Sending a deallocation command containing the deallocation range to the storage device includes: The multiple release allocation ranges are grouped according to a predetermined maximum number of submissions per session to obtain multiple range structure groups; The release command corresponding to each range structure group is sent to the storage device in sequence until all range structure groups have been processed.
5. The method according to claim 3, characterized in that, Before sending the deallocation command containing the deallocation range to the storage device, the method further includes: Count the number of the multiple release allocation ranges; If the quantity is greater than or equal to a preset quantity threshold, the step of sending a deallocation command containing the deallocation range to the storage device is executed; If the number is less than a preset threshold, the sending of the deallocation command will be stopped.
6. The method according to claim 1, characterized in that, Before sending the deallocation command containing the deallocation range to the storage device, the method further includes: Monitor the current read / write performance metrics of the storage device; If the current read / write performance index is less than a preset performance threshold, the step of sending a deallocation command containing the deallocation range to the storage device is executed. If the current read / write performance index is greater than or equal to a preset performance threshold, the sending of the deallocation command will be stopped.
7. The method according to claim 1, characterized in that, Before resetting the metadata area corresponding to the logical data block, the method further includes: Receive execution status feedback from the storage device during the deallocation operation; Upon receiving the execution status feedback, it is determined that the storage device has completed processing the deallocation command.
8. A data deletion device for a block storage system, characterized in that, The device includes: A determination module is used to determine, in response to a deletion instruction for a logical data block, the physical data units occupied by the logical data block in the physical data area of the storage device; The construction module is used to construct the deallocation range based on the physical address information of the physical data unit; The sending module is configured to send a deallocation command containing the deallocation range to the storage device, instructing the storage device to perform a deallocation operation on the physical data unit; The reset module is used to reset the metadata area corresponding to the logical data block after the storage device has completed processing the deallocation command.
9. An electronic device, characterized in that, include: A processor and a memory, the processor being configured to execute a data erasure program of a block storage system stored in the memory to implement the data erasure method of the block storage system according to any one of claims 1-7.
10. A storage medium, characterized in that, The storage medium stores one or more programs, which can be executed by one or more processors to implement the data deletion method of the block storage system according to any one of claims 1-7.