Dynamic switch raid protection method and device, storage device and storage medium

CN121116181BActive Publication Date: 2026-09-25SHENZHEN CITY TECHWIN SEMICONDUCTOR COMPANY LIMITED
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511150466.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-18
Publication Date
2026-09-25
Estimated Expiration
2045-08-18

AI Technical Summary

Technical Problem

[0004]为了克服现有技术的不足,本发明提供一种动态开关Raid保护方法、装置、存储设备及存储介质,解决了因存储芯片冗余空间有限,无法有效开启Raid保护的问题,在保障数据可靠性的同时,优化了存储设备性能与寿命

Benefits of technology

1、在存储设备运行过程中,每当FTL固件的Write/GC模块完成一笔写操作时进行有效用户数据计算动态更新,当Write/GC模块开一个新的Block以写入用户数据时,持续监控系统当前有效用户数据总量。这种动态的监控和更新机制能够实时掌握存储设备的负载情况,动态开启或关闭Raid保护;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121116181B_ABST
    Figure CN121116181B_ABST
Patent Text Reader

Abstract

The application relates to the storage technical field, in particular to a dynamic switch raid protection method and device, a storage device and a storage medium. In the running of the storage device, the Write / GC module of the FTL firmware performs effective user data calculation and dynamic update after completing each write operation. When the module starts to write user data in a new block, the total amount of the current effective user data of the system is continuously monitored, and whether to enable raid protection in the new block is determined according to the relationship between the total amount of the effective user data and a preset threshold value, so that the protection state is adapted to the real-time load of the device. If the total amount of the effective user data is greater than the preset threshold value, a garbage collection mechanism for releasing raid blocks is started, the protected blocks are selectively recombined, and the occupied redundant storage space is released. The application solves the problem that raid protection cannot be effectively started due to the limited redundant space of the storage chip, and optimizes the performance and service life of the storage device while ensuring data reliability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of storage technology, and in particular to a dynamic switch RAID protection method, apparatus, storage device, and storage medium. Background Technology

[0002] In the field of embedded solid-state storage, low-end chips (such as eMMC and USB) typically lack RAID protection. Mid-to-high-end products enable RAID for certain areas (SLC / TLC / table entry areas) or the entire user data area, depending on controller capabilities and the over-provisioning (OP) ratio of the NAND flash memory. However, in small-to-medium capacity storage chips, the over-provisioning (OP) space of the NAND flash memory is only around 7%, while enabling RAID across the entire drive requires around 3%. Enabling RAID significantly reduces OP, leading to performance degradation and reduced lifespan. Therefore, storage devices with low OP redundancy, such as consumer-grade SSDs / UFS / eMMC / uMCP / eMCP / ePOP, generally do not have RAID protection. However, downstream customers of these products have high requirements for data reliability, especially large mobile phone manufacturers or industrial equipment manufacturers. Enterprise-grade solid-state storage devices (such as enterprise-grade eSSDs) typically have a lot of redundant space in the media. RAID protection is enabled throughout the device's lifecycle during the solution design phase, resulting in higher costs. Therefore, low-end storage devices in the industry either do not have RAID protection or only have RAID protection in certain areas of the storage media. Enterprise-grade devices generally have RAID protection in all user data areas, leading to higher costs and selling prices.

[0003] Therefore, in some capacity specifications of embedded storage and consumer-grade storage devices, due to insufficient operation capacity (OP), it is impossible to enable RAID protection for all user data areas. Only SLC, TLC, or QLC areas or table entry areas are enabled by region, which cannot provide protection for all user data. If NAND with fewer bad blocks is selected for commercial use, it will lead to problems such as increased costs. Summary of the Invention

[0004] To overcome the shortcomings of the prior art, the present invention provides a dynamic switch RAID protection method, device, storage device and storage medium, which solves the problem that RAID protection cannot be effectively enabled due to the limited redundancy space of storage chips, and optimizes the performance and lifespan of storage devices while ensuring data reliability.

[0005] A first aspect of this application provides a dynamic switch RAID protection method, the method comprising: During the operation of the storage device, whenever the Write / GC module of the FTL firmware completes a write operation, it performs dynamic updates by calculating valid user data. When the Write / GC module opens a new Block to write user data, it continuously monitors the total amount of valid user data in the system and determines whether to enable the Raid protection function in the new Block based on the total amount of valid user data and a first preset threshold. When the total amount of valid user data is determined to be greater than the second preset threshold, the garbage collection mechanism for releasing the RAID Block is initiated to reclaim the Block protected by the RAID and release the redundant storage space occupied by the RAID.

[0006] In an optional implementation, the method further includes: The host obtains the current valid user data capacity information of the storage device; The Host terminal compares and analyzes the effective user data capacity with the preset threshold. Based on the comparison and analysis results, the Host generates a custom command to indicate whether the storage device should enable RAID protection; The host sends the custom command to the FTL firmware of the storage device, so that the FTL firmware of the storage device receives and parses the custom command, and determines whether to enable the RAID protection function when writing user data in a new block according to the command instructions.

[0007] In an optional implementation, the first preset threshold is set by the storage device according to a default value, which is the ratio of the effective user data volume to the maximum storage capacity supported by the storage device; the preset threshold can be set by the host and is either a percentage value or a valid data volume size.

[0008] In one optional implementation, the dynamic update of the data calculation includes: Increment the count of valid user data in the currently written new block. Map the original block to the logical block address of the written data, and perform a count decrement operation on the valid user data count of the original block; Synchronously update the total VPC of all blocks storing user data, g_totalVPC, to reflect the actual occupancy of valid user data in the current storage device.

[0009] In an optional implementation, determining whether to enable the Raid protection function in the new block based on the total amount of valid user data and a first preset threshold includes: Compare the total amount of valid user data with the first preset threshold; When it is determined that the total amount of valid user data is less than the first preset threshold, the Raid protection function is enabled during the process of writing user data into the new block. When the total amount of valid user data is determined to be greater than or equal to the first preset threshold, the Raid protection function is not enabled during the process of writing user data into the new block.

[0010] In an optional implementation, the initiation of the garbage collection mechanism to release the RAID Block, which reclaims the RAID-protected Block and releases the redundant storage space occupied by the RAID, includes: The GC module moves user data from a RAID-protected block to another block; during the move, RAID parity verification data is skipped to reduce unnecessary data movement. After the GC module has moved all valid user data from all blocks protected by RAID, it performs an erase operation on the source block to make the source block a blank block that can be rewritten with data, thereby releasing the physical space occupied by RAID.

[0011] A second aspect of this application provides a dynamic switch RAID protection device, the device comprising: The dynamic update module is used to dynamically update the effective user data whenever the Write / GC module of the FTL firmware completes a write operation during the operation of the storage device. The Raid protection module is used to continuously monitor the total amount of valid user data in the system when the Write / GC module opens a new block to write user data, and determine whether to enable the Raid protection function in the new block based on the total amount of valid user data and a first preset threshold. The space release module is used to initiate a garbage collection mechanism to release the Raid Block when it is determined that the total amount of valid user data is greater than a second preset threshold. This mechanism reclaims the Block protected by the Raid and releases the redundant storage space occupied by the Raid.

[0012] A third aspect of this application provides a storage device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the dynamic switch RAID protection method.

[0013] A fourth aspect of this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described dynamic switch RAID protection method.

[0014] In summary, the dynamic switch RAID protection method, apparatus, storage device, and storage medium provided in this application have at least one of the following beneficial effects: 1. During storage device operation, whenever the FTL firmware's Write / GC module completes a write operation, it dynamically updates the effective user data calculation. When the Write / GC module opens a new block to write user data, it continuously monitors the total amount of effective user data in the system. This dynamic monitoring and update mechanism can grasp the storage device's load status in real time and dynamically enable or disable RAID protection. 2. Determine whether to enable RAID protection in a new block based on the total amount of valid user data and a preset threshold. Make flexible decisions on whether to enable RAID in a new block according to the actual situation to ensure that resources are used as reasonably as possible to protect user data when OP is limited. 3. When the total amount of valid user data exceeds a preset threshold, a garbage collection mechanism to release RAID blocks is initiated. This reclaims RAID-protected blocks, releasing redundant storage space occupied by the RAID. Instead of relying on selecting NAND flash memory with fewer bad blocks to ensure data reliability, a dynamic garbage collection mechanism manages redundant space. Even if the NAND flash memory has some bad blocks, the space occupied by the RAID can be released reasonably, reducing the requirements for NAND flash memory selection while meeting data reliability requirements. This solves the problem of increased costs associated with using NAND flash memory with fewer bad blocks for commercial products. Attached Figure Description

[0015] Figure 1 This is a schematic diagram illustrating a RAID switching mechanism for a new block of a storage device driven by the proportion of effective user data, as shown in an embodiment of this application. Figure 2 This is a schematic flowchart illustrating a dynamic switch RAID protection method according to an embodiment of this application; Figure 3 This is a timing diagram illustrating the process of adjusting the VPC count and synchronously updating g_totalVPC after a Write / GC operation, as shown in an embodiment of this application. Figure 4 This is a timing diagram illustrating the threshold judgment and Raid marker return process when opening a new Block in a Write / GC module, as shown in an embodiment of this application. Figure 5 This is a timing diagram illustrating the interactive process of a host issuing a command to the device to configure a new Block Raid protection, as shown in an embodiment of this application. Figure 6This is a schematic diagram illustrating the dynamic adjustment of data migration and storage space of a RAID-protected block, as shown in an embodiment of this application. Figure 7 This is a functional block diagram of a dynamic switch RAID protection device shown in an embodiment of this application; Figure 8 This is a schematic diagram of the structure of a storage device shown in an embodiment of this application. Detailed Implementation

[0016] The present invention will be further described below with reference to the accompanying drawings and embodiments.

[0017] The following will clearly and completely describe the concept, specific structure, and technical effects of the present invention in conjunction with embodiments and accompanying drawings, so as to fully understand the purpose, features, and effects of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, not all of them. Other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are all within the scope of protection of the present invention. Furthermore, all connections / linkages involved in the patent do not simply refer to direct contact between components, but rather to the ability to form a better connection structure by adding or reducing connecting accessories according to specific implementation conditions. The various technical features in this invention can be combined interactively without contradicting each other.

[0018] Because enterprise storage generally has high reliability requirements, it is unacceptable to have RAID protection in some scenarios and not in others. Therefore, the storage devices are embedded and consumer-grade storage devices. However, in some industrial storage scenarios where reliability requirements are not high, the RAID protection method proposed in this application is still applicable, and the storage device can also be an enterprise-grade storage device.

[0019] The following describes the dynamic switch RAID protection method from the perspective of storage devices. These storage devices can be embedded and consumer-grade storage devices, or enterprise-grade storage devices; no specific limitation is made.

[0020] To achieve adaptive switching RAID protection based on the proportion of effective user data, this application employs an FTL algorithm for adaptive switching RAID protection based on the proportion of effective user data. This improves the reliability of data stored in NAND flash memory when OP is low but effective user data is not abundant. It adopts a "best-effort" approach, not promising to enable RAID protection for all data at all times, but providing RAID protection for user data in most scenarios. This better meets the demands of downstream manufacturers who want highly reliable storage chips / modules without increasing costs.

[0021] Specifically, when the proportion of valid user data is low, meaning the amount of valid user data does not exceed a preset threshold, the total parity of user data + RAID is also relatively small. The entire storage device can still operate smoothly with RAID protection, and in this case, effective RAID protection can be applied to all user data. For example, a configurable threshold can be set; for instance, for a 128GB phone, if user data is less than 100GB, RAID protection can be enabled. This threshold can be a capacity value or a percentage. When the proportion of user data is high, exceeding 80%, the GC (garbage collection) module is heavily loaded. Continuing to enable RAID protection will affect the GC module's load and WA (write amplification), leading to a decrease in storage device performance. Therefore, in this case, the newly opened block disables RAID protection. Valid user data refers to all data written by users (host writes). Invalid user data is data that has been written and then deleted; it does not exist on the file system's Node, but its status on the disk's storage medium is uncertain—it may or may not have been deleted. Data that has not yet been deleted is considered invalid user data. (See reference...) Figure 1 As shown, when the proportion of user data in the storage device is low, opening a new block of the storage medium enables RAID support; when the proportion of user data in the storage device is high, opening a new block of the storage medium does not support RAID protection.

[0022] It should be noted that the FTL algorithm proposed in this application is only described based on the proportion of user data and the enabling or disabling of RAID protection function. As for controller-related factors, such as whether the controller has a RAID protection engine and whether the controller has enough buf to support RAID, since these are more characteristics of the controller hardware itself, this application does not define whether the controller's RAID protection function is enabled or disabled.

[0023] Having clarified the basic concepts and expected effects of the dynamic switch RAID protection method, the following section will elaborate on its specific implementation process in storage devices. (Refer to...) Figure 2 The diagram shown is a flowchart illustrating a dynamic switch RAID protection method according to an embodiment of this application. The dynamic switch RAID protection method includes the following steps.

[0024] S21, during the operation of the storage device, whenever the Write / GC module of the FTL firmware completes a write operation, it performs dynamic updates by calculating valid user data.

[0025] Refer to together Figure 3During storage device operation, in the Write / GC process of the FTL firmware, after each write operation is completed, the count of valid user data in the currently written Open Block (i.e., the new Block) is incremented (++), and the count of valid user data in the previously written Block (i.e., the original Block) at the Logical Block Address (LBA) of this written data is decremented (--). If there is no original Block information in the storage device, the count decrement operation is not performed, such as when writing to an empty disk.

[0026] After the Write / GC module writes a piece of data, when modifying the table entry and the valid page count (VPC), it synchronously updates the total VPC of the block storing user data in the system, g_totalVPC, which is the total amount of valid user data, to reflect the actual occupancy of valid user data in the current storage device. Among these, modifying the table entry is the most basic and necessary operation in the FTL firmware process, and correctly maintaining the VPC of each block is also a basic function that FTL firmware must have.

[0027] S22, when the Write / GC module opens a new Block to write user data, it continuously monitors the total amount of valid user data in the system and determines whether to enable the Raid protection function in the new Block based on the total amount of valid user data and the first preset threshold.

[0028] During the operation of a storage device, there are two ways to dynamically determine the RAID protection status of newly written data.

[0029] Approach 1: The storage device itself makes the decision.

[0030] Refer to together Figure 4 When the Write / GC module needs to open a new block to write user data, it reads the value of the current total effective user data volume, g_totalVPC, and compares g_totalVPC with a first preset threshold. If g_totalVPC is less than the first preset threshold, then RAID protection is added to the newly opened block (i.e., the new block) during the user data writing process, and RAID protection is enabled. If g_totalVPC is greater than or equal to the first preset threshold, then RAID protection is not added to the newly opened block during the user data writing process, and RAID protection is not enabled.

[0031] The first preset threshold is set by the storage device based on a default value, which is the ratio of the effective user data volume to the maximum storage capacity supported by the storage device. For example, the default value is set to 80% to determine whether RAID protection is supported when a new Open Block is created, but the process of releasing redundant space is not actively initiated at this time. Additionally, the preset threshold can be set by the host, as a percentage value or a valid data volume size. A second preset threshold (e.g., 90%) is set to determine whether to initiate the process of releasing redundant space, where the second preset threshold is greater than the first preset threshold.

[0032] By using the total effective data volume at the system level (g_totalVPC) as the core parameter for decision-making, the system avoids relying on specific block-level operation details. Furthermore, by abstracting the system load into binary conditions (below / reached threshold) through preset thresholds, the decision-making complexity is simplified. Based on the judgment result, the RAID protection function is directly triggered to open or close, forming a closed-loop control mechanism of "condition-action". This improves data reliability while enhancing the stability of the storage system.

[0033] In an optional implementation, the method further includes: The host obtains the current valid user data capacity information of the storage device; The Host terminal compares and analyzes the effective user data capacity with the preset threshold. Based on the comparison and analysis results, the Host generates a custom command to indicate whether the storage device should enable RAID protection; The host sends the custom command to the FTL firmware of the storage device, so that the FTL firmware of the storage device receives and parses the custom command, and determines whether to enable the RAID protection function when writing user data in a new block according to the command instructions.

[0034] In this embodiment, step S22 can also be performed by the Host comparing the current effective user data capacity in the device with a preset threshold. The Host sends a custom command to the FTL firmware to determine whether newly written data has RAID protection when opening a block, enhancing flexibility and preventing bypassing. The Host does not know when a new block will be opened on the storage device side; the Host only detects the total / percentage of effective user data in the Device, performs a comparative analysis based on the percentage of effective data, and then sends a custom command. After receiving the command, if the storage device subsequently opens a new block, it can determine whether to enable or disable RAID protection according to the Host's command.

[0035] Approach 2: Host-side configuration decision.

[0036] Refer to together Figure 5 The host determines whether to enable RAID protection when writing user data to a newly opened block. The host calculates the current effective user data capacity (g_totalVPC) on the storage device, compares it with a preset threshold, and sends a custom command to the storage device's FTL firmware. The FTL firmware then uses this command to determine whether to enable RAID protection. If g_totalVPC is less than the first preset threshold, RAID protection is enabled during the writing process. If g_totalVPC is greater than or equal to the first preset threshold, RAID protection is disabled during the writing process.

[0037] Custom commands refer to storage protocols such as SATA / SAS / NVMe. In addition to data read / write commands and protocol-defined management commands, they all support vendor-defined commands (Vender Commond). Vender Commond allows each vendor to define various commands.

[0038] It's worth noting that while the dynamic on / off function can be implemented automatically by the storage device, configuring it on the host, such as by setting a preset threshold, offers greater flexibility. Similarly, dynamic RAID on / off can also be configured by the host to enable or disable it.

[0039] Through the aforementioned optional implementation methods, the dynamic switching of RAID protection is achieved through these two approaches. This ensures that the storage device can automatically adapt its RAID protection status based on real-time load conditions, while also allowing for flexible configuration at the host end to meet diverse application scenario requirements and flexibly set RAID protection strategies. This enables the storage device to better adapt to diverse usage environments. Furthermore, enabling RAID protection when there is little active user data improves data reliability; while disabling some RAID protection when the data volume is large reduces GC load and write amplification, improving system performance. This allows the storage device to operate stably and efficiently under various complex scenarios, providing users with higher-quality data storage services.

[0040] S23, when it is determined that the total amount of valid user data is greater than the second preset threshold, the garbage collection mechanism for releasing the Raid Block is started to reclaim the Block protected by Raid and release the redundant storage space occupied by Raid.

[0041] When the amount of valid user data increases further, the data in the RAID-protected blocks needs to be moved by the garbage collector (GC). The released blocks can then be used to write blocks without RAID information, thereby freeing up the space occupied by the RAID and ensuring that the reserved space (Over-Provisioning, OP) in the entire device is not damaged.

[0042] In an optional implementation, the initiation of the garbage collection mechanism to release the RAID Block, which reclaims the RAID-protected Block and releases the redundant storage space occupied by the RAID, includes: The GC module moves user data from a RAID-protected block to another block; during the move, RAID parity verification data is skipped to reduce unnecessary data movement. After the GC module has moved all valid user data from all blocks protected by RAID, it performs an erase operation on the source block to make the source block a blank block that can be rewritten with data, thereby releasing the physical space occupied by RAID.

[0043] The FTL firmware's garbage collection mechanism includes source blocks and destination blocks. During storage device operation, the value of g_totalVPC is continuously monitored. When g_totalVPC exceeds a second preset threshold, the storage device sends a trigger signal to the GC module, initiating the garbage collection mechanism to release RAID blocks. Specifically, after starting, the GC module scans and analyzes all blocks in the storage device, selecting those with RAID protection. These RAID-protected blocks store valid user data and corresponding RAID parity verification data. To reduce unnecessary data movement and improve data migration efficiency, the GC module employs an intelligent migration strategy. During migration, the GC module carefully distinguishes between user data and RAID parity verification data, reading user data (i.e., actual stored user files, application data, etc.) from RAID-protected blocks one by one according to certain rules (such as LBA order) and migrating them to other pre-selected free blocks via data channels. Regarding RAID parity check data, since the arrangement of RAID parity check data in the source block is strongly correlated, its arrangement in the destination block is likely to have changed after GC relocation. Therefore, the original RAID parity check data is no longer usable even after relocation and does not need to be moved. Thus, the GC module skips the RAID parity check data and does not read or relocate it. For example, suppose there is a RAID-protected block storing user data A, B, and C, and corresponding RAID parity check data P1, P2, and P3. During relocation, the GC module will only read A, B, and C and move them to the new block, while P1, P2, and P3 will remain in the original block, awaiting subsequent block erase operations for cleanup. (See also...) Figure 6 The GC moves the green data in Figure (6A) from the source block to the destination block, while the yellow data, which is Raid Parity verification data, does not need to be moved.

[0044] After all user data in the RAID-protected block has been successfully migrated to the new block, only some useless data remains in the source block (mainly skipped RAID parity check data and some potentially invalid data). To make these source blocks usable again on the storage device, becoming rewritable blank blocks, the GC module performs an Erase operation on the source blocks. See also... Figure 6 At this point, the space in the system that can be written to includes the unwritten space in the target block of GC on the right side of the above figure (6A), plus the entire block on the right side of the figure below (6B).

[0045] Through the aforementioned optional implementation methods, by dynamically monitoring the total amount of effective data and triggering RAID resource optimization, storage space waste caused by static RAID configuration is avoided. When the amount of data decreases, the system can proactively reclaim redundant space to increase storage density. During data migration, non-user data (such as RAID parity) is skipped, reducing I / O operations and mitigating the impact of GC on system performance, while ensuring that user data remains protected. Furthermore, by precisely controlling the RAID block release and blank block generation process, device OP fluctuations caused by space reclamation operations are prevented, maintaining the long-term stability of the storage system.

[0046] In an optional implementation, during the storage device startup or initialization phase, the FTL firmware can preset a threshold for determining whether RAID protection is enabled (i.e., a first preset threshold) and a threshold for determining whether OP active release is enabled (i.e., a second preset threshold). The Write module in the storage device is responsible for handling user data write requests. During the initialization phase, the FTL firmware configures the Write module to accurately identify valid user data and update the g_totalVPC counter accordingly when performing data write operations. Specifically, when the Write module receives a data write request, it first analyzes the data to determine if it is valid user data. If it is valid user data, the Write module increments the g_totalVPC value based on the size of the data being written and writes the data to the corresponding location on the storage device. The GC module is used to reclaim space occupied by invalid data in the storage device to improve storage device utilization. During the initialization phase, the FTL firmware configures the GC module to accurately identify and count valid user data in blocks (blocks currently being written) when performing garbage collection operations. When the GC module selects a block for garbage collection, it traverses all data pages in that block and determines whether the data in each page is valid user data. If it is valid user data, the GC module will move it to a new free block and update the g_totalVPC counter according to the size of the moved data; if it is invalid data, no moving process is performed.

[0047] Through the above optional implementation methods, by completing the setting of system parameters and configuration of related modules during the startup or initialization phase of the storage device, the storage device has the basic functions of accurately counting valid user data and dynamically adjusting the RAID protection status. This allows the storage device to flexibly enable or disable RAID protection according to the actual data volume during operation, thereby improving the performance and reliability of the storage device.

[0048] This application ensures the reliability of data in storage devices while flexibly deciding whether to enable RAID protection for new blocks based on a comparison of the total amount of valid user data with a preset threshold. When the data volume exceeds the threshold, redundant space is released through garbage collection, effectively avoiding excessive OP occupation caused by fixed RAID activation. It solves the problems of insufficient OP to protect all user data and selecting specific NAND to reduce costs, making the RAID protection status accurately match the real-time load of the storage device, optimizing the performance of the storage device and extending its service life.

[0049] Reference Figure 7 The diagram shown is a functional block diagram of a dynamic switch RAID protection device according to an embodiment of this application.

[0050] In some embodiments, the dynamic switch RAID protection device 70 may include multiple functional modules composed of computer program segments. The computer programs for each program segment of the dynamic switch RAID protection device 70 may be stored in the memory of a storage device and executed by at least one processor to perform (see details). Figure 2 (Description) The function of dynamic switch RAID protection. Based on its function, it can be divided into multiple functional modules. These functional modules may include: a dynamic update module 701, a RAID protection module 702, and a space release module 703. The module referred to in this application is a series of computer program segments that can be executed by at least one processor and perform a fixed function, stored in memory. In this embodiment, the functions of each module will be detailed in subsequent embodiments.

[0051] The dynamic update module 701 is used to perform dynamic updates of valid user data calculation whenever the Write / GC module of the FTL firmware completes a write operation during the operation of the storage device.

[0052] The Raid protection module 702 is used to continuously monitor the total amount of valid user data in the system when the Write / GC module opens a new block to write user data, and determine whether to enable the Raid protection function in the new block based on the total amount of valid user data and a first preset threshold.

[0053] The space release module 703 is used to initiate a garbage collection mechanism to release the Raid Block when it is determined that the total amount of valid user data is greater than a second preset threshold, to reclaim the Block protected by Raid and release the redundant storage space occupied by Raid.

[0054] The RAID protection module 702 is further configured to: obtain the current effective user data capacity information of the storage device at the host end; compare and analyze the effective user data capacity with the preset threshold at the host end; generate a custom command to indicate whether the storage device should enable RAID protection based on the comparison and analysis results; and send the custom command to the FTL firmware of the storage device so that the FTL firmware of the storage device can receive and parse the custom command, and determine whether to enable RAID protection when writing user data to a new block according to the command instructions.

[0055] The dynamic update module 701 is further specifically used for: incrementing the count of valid user data in the newly written block; mapping the original block to the logical block address of the written data and decrementing the count of valid user data in the original block; and synchronously updating the total VPC g_totalVPC of all blocks storing user data to reflect the actual occupancy of valid user data in the current storage device.

[0056] The RAID protection module 702 is further configured to: compare the total amount of valid user data with the first preset threshold; when it is determined that the total amount of valid user data is less than the first preset threshold, enable the RAID protection function during the process of writing user data in the new block; when it is determined that the total amount of valid user data is greater than or equal to the first preset threshold, not enable the RAID protection function during the process of writing user data in the new block.

[0057] The space release module 703 is further specifically used to: move user data from a block with RAID protection to other blocks via the GC module; wherein, during the moving process, the RAID parity verification data is skipped to reduce unnecessary data movement; after the GC module has moved all valid user data from all blocks with RAID protection, the source block is erased to make the source block a blank block that can be rewritten with data, thereby releasing the physical space occupied by the RAID.

[0058] It should be understood that the various variations and specific embodiments of the dynamic switch RAID protection method provided in the above embodiments are also applicable to the dynamic switch RAID protection device of this embodiment. Through the foregoing detailed description of the dynamic switch RAID protection method, those skilled in the art can clearly understand the implementation method of the dynamic switch RAID protection device in this embodiment. For the sake of brevity, it will not be described in detail here.

[0059] See Figure 8 The diagram shown is a schematic representation of the structure of a storage device according to an embodiment of this application. In a preferred embodiment of this application, the storage device 8 includes a memory 81, at least one processor 82, and at least one communication bus 83.

[0060] Those skilled in the art should understand that Figure 8 The structure of the storage device shown does not constitute a limitation of the embodiments of this application. The storage device 8 may also include more or fewer other hardware or software than shown, or different component arrangements.

[0061] In some embodiments, the storage device 8 is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions. Its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), programmable gate arrays (FPGAs), digital processors, and embedded devices. The storage device 8 may also include user equipment, including, but not limited to, any electronic product capable of human-computer interaction with a user via a keyboard, mouse, remote control, touchpad, or voice control device, such as a personal computer, tablet computer, smartphone, or digital camera.

[0062] In the embodiments provided in this application, it should be understood that the disclosed methods, apparatus, computer-readable storage media, and storage devices can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple components or modules may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection of devices, components, or modules may be electrical, mechanical, or other forms.

[0063] The components described as separate parts may or may not be physically separate. The components shown as components may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the components can be selected to achieve the purpose of this embodiment according to actual needs.

[0064] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing module, or each component can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.

[0065] If the integrated module is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes: USB flash drive, portable hard drive, read-only memory (ROM). Various media that can store program code, such as only memory, random access memory (RAM), magnetic disks or optical disks.

[0066] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the present invention is not limited to the described order of actions, because according to the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to the present invention.

[0067] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0068] The above is a detailed description of the preferred embodiments of the present invention. However, the present invention is not limited to the embodiments described. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present invention. All such equivalent modifications or substitutions are included within the scope defined by the claims of this application.

Claims

1. A dynamic switch RAID protection method, characterized in that, The method includes: During the operation of the storage device, whenever the Write / GC module of the FTL firmware completes a write operation, it performs dynamic updates by calculating valid user data. When the Write / GC module opens a new block to write user data, it continuously monitors the total amount of valid user data in the system and determines whether to enable RAID protection in the new block based on the total amount of valid user data and a first preset threshold. This includes: comparing the total amount of valid user data with the first preset threshold; when it is determined that the total amount of valid user data is less than the first preset threshold, enabling RAID protection during the writing of user data in the new block; and when it is determined that the total amount of valid user data is greater than or equal to the first preset threshold, not enabling RAID protection during the writing of user data in the new block. When the total amount of valid user data is determined to be greater than the second preset threshold, the garbage collection mechanism for releasing the RAID Block is initiated to reclaim the RAID-protected Block and release the redundant storage space occupied by the RAID; wherein the second preset threshold is greater than the first preset threshold.

2. The dynamic switch RAID protection method according to claim 1, characterized in that, The method further includes: The host obtains the current valid user data capacity information of the storage device; The Host terminal compares and analyzes the effective user data capacity with the preset threshold. Based on the comparison and analysis results, the Host generates a custom command to indicate whether the storage device should enable RAID protection; The host sends the custom command to the FTL firmware of the storage device, so that the FTL firmware of the storage device receives and parses the custom command, and determines whether to enable the RAID protection function when writing user data in a new block according to the command instructions.

3. The dynamic switch RAID protection method according to claim 2, characterized in that, The first preset threshold is set by the storage device according to a default value, which is the ratio of the effective user data volume to the maximum storage capacity supported by the storage device; The preset threshold can be set by the Host and can be a percentage value or a valid data volume.

4. The dynamic switch RAID protection method according to claim 1, characterized in that, The dynamic updating of the data calculation includes: Increment the count of valid user data in the currently written new block. Map the original block to the logical block address of the written data, and perform a count decrement operation on the valid user data count of the original block; Synchronously update the total VPC of all blocks storing user data, g_totalVPC, to reflect the actual occupancy of valid user data in the current storage device.

5. The dynamic switch RAID protection method according to claim 1, characterized in that, The aforementioned garbage collection mechanism for releasing RaidBlocks reclaims the blocks protected by Raid, releasing redundant storage space occupied by Raid, including: The GC module moves user data from a RAID-protected block to another block; during the move, RAID parity verification data is skipped to reduce unnecessary data movement. After the GC module has moved all valid user data from all blocks protected by RAID, it performs an erase operation on the source block to make the source block a blank block that can be rewritten with data, thereby releasing the physical space occupied by RAID.

6. A dynamic switch RAID protection device, characterized in that, The device includes: The dynamic update module is used to dynamically update the effective user data whenever the Write / GC module of the FTL firmware completes a write operation during the operation of the storage device. The RAID protection module is used to continuously monitor the total amount of valid user data in the system when the Write / GC module opens a new block to write user data, and determine whether to enable RAID protection in the new block based on the total amount of valid user data and a first preset threshold; including: comparing the total amount of valid user data with the first preset threshold; when it is determined that the total amount of valid user data is less than the first preset threshold, enabling RAID protection during the writing of user data in the new block; when it is determined that the total amount of valid user data is greater than or equal to the first preset threshold, not enabling RAID protection during the writing of user data in the new block; The space release module is used to initiate the garbage collection mechanism of the RaidBlock when it is determined that the total amount of valid user data is greater than a second preset threshold, to reclaim the Block protected by Raid and release the redundant storage space occupied by Raid; wherein the second preset threshold is greater than the first preset threshold.

7. A storage device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the dynamic switch RAID protection method according to any one of claims 1 to 5.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the dynamic switch RAID protection method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Device and method for dynamically regulating redundant RAID array reconstruction

    CN103345450A

  • Method and device for triggering refactoring of redundant array of independent disk (RAID)

    CN106126378A