Method of managing IO write operations and storage device
By detecting the host's high-load write protection mode, obtaining data stream information and random update information, and judging and updating the order of IO write operations, the problem of verifying the legitimacy of IO write commands in high-load video recording of storage devices is solved, thereby improving write performance and reliability.
Patent Information
- Application Number
- CN202510999534.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-21
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2045-07-21
AI Technical Summary
The existing front-end modules of storage devices cannot meet the high-load video performance guarantee specifications of CFexpress memory cards when processing IO write commands, which makes it impossible to ensure the validity verification of IO write commands and stable write performance.
By detecting whether the host has enabled high-load write protection mode, obtaining data stream information and random update information, determining whether the IO write operation is a sequential write operation, and updating the location metadata in real time to maintain the consistency of storage space management, a high-load write protection mechanism is formed by using mode state detection, management information retrieval, and dynamic judgment logic.
It enables precise management of IO write operations under high-load video recording scenarios, ensuring dynamic consistency of data stream information and stability of write performance, and adapting to video performance assurance specifications.
Smart Images

Figure CN120508262B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer storage, and in particular to a method for managing IO write operations and a storage device. BACKGROUND
[0002] With the increasing demand for high-performance storage, users have higher requirements for the performance and reliability of storage devices, and this trend is particularly evident in the field of professional video production. Professional video production has a critical dependence on the safeguarding capabilities of storage devices during high-load video recording processes.
[0003] However, the current front-end module (FE) of the storage device has limitations when processing IO write commands. The front-end module is a critical part of the storage device responsible for communication and command processing with the host, and it ensures that the host's requests can be executed correctly through protocol processing and command distribution. In the existing management mode, the front-end module only performs basic legality checks on write commands, such as verifying whether namespace identifiers (NSIDs), physical region pages (PRPs), scatter-gather lists (SGLs), and logical block addresses (LBAs) conform to existing protocols (such as the NVMe protocol).
[0004] The existing management mode cannot meet the requirements of the CFexpress Video Performance Guarantee (VPG) specification for CFexpress memory cards. The VPG specification emphasizes the fine management of each IO write operation to ensure that the memory card can provide stable write speed during high-load video recording processes and avoid recording interruptions. However, the existing management mode fails to constrain each legal or illegal IO write operation as necessary, resulting in the inability of the memory card to perform detailed legality verification on each IO write command and ensuring that the IO write command fully complies with the requirements of the VPG specification.
[0005] Therefore, it is necessary to optimize and improve the management of the front-end module IO write commands of the memory card to meet the requirements of the VPG specification and improve performance and reliability in high-load video recording scenarios. SUMMARY
[0006] The technical problem to be solved by the present application is to provide a method for managing IO write operations and a storage device that can improve the reliability and write performance of the device during high-load video recording.
[0007] To solve the above technical problems, one technical solution adopted by the present application is:
[0008] A method for managing IO write operations, comprising:
[0009] Receiving an IO write operation issued by a host, detecting whether the host starts a high-load write protection mode;
[0010] If yes, obtaining write management information of the high-load write protection mode, the write management information including data flow information of historical IO write operations;
[0011] According to the data flow information, judging whether the IO write operation is a sequential write operation;
[0012] If yes, updating the data flow information according to position metadata of the IO write operation.
[0013] To solve the above technical problems, another technical solution adopted by the present application is:
[0014] A storage device includes a storage chip and a control chip, the storage chip stores a computer program, and the computer program is executed by the control chip to realize each step in the above-mentioned method of managing IO write operation.
[0015] The present application has the beneficial effects that: first, by detecting whether the host starts a high-load write protection mode (VPG specification), it can actively identify whether the current system is in a running state that needs special management. When the mode is started, by obtaining the write management information containing the data flow information, a decision basis is provided for subsequent sequential judgment of write operation. The VPG specification requires that each IO write operation that writes data flow information is sequential writing, and based on the data flow information, the historical writing rules can be traced, so that the current IO write operation and the data flow information are matched to accurately determine whether the current IO write operation belongs to sequential writing. For sequential write operation, by updating the data flow information corresponding to the position metadata in real time, the dynamic consistency of the storage space management information is maintained. The present application can ensure that the data flow information read by the host in the high-load write protection mode is sequential write operation, and there is no random write operation, so as to adapt to the video performance guarantee specification. BRIEF DESCRIPTION OF DRAWINGS
[0016] Figure 1 A flowchart of a method for managing IO write operation provided by the present application;
[0017] Figure 2 Another flowchart of a method for managing IO write operation provided by the present application;
[0018] Figure 3 A switching schematic diagram of VPG state provided by the present application;
[0019] Figure 4 An un-crossed area schematic diagram of IO write operation provided by the present application;
[0020] Figure 5A cross-area diagram of IO write operation provided by the present application;
[0021] Figure 6 A storage address diagram of random write operation provided by the present application;
[0022] Figure 7 A flow chart of a method for updating data flow information provided by the present application;
[0023] Figure 8 A storage address diagram of IO write operation satisfying allocation condition provided by the present application;
[0024] Figure 9 A storage address diagram of IO write operation satisfying release condition provided by the present application;
[0025] Figure 10 A storage address diagram of IO write operation of cross-unit write provided by the present application;
[0026] Figure 11 A storage address diagram of IO write operation of same-unit write provided by the present application;
[0027] Figure 12 A structure diagram of a storage device provided by the present application. DETAILED DESCRIPTION
[0028] To make the technical content, the achieved purposes and effects of the present application clear, the following will be described in detail in combination with embodiments and the accompanying drawings.
[0029] Embodiments of the present application provide a method for managing IO write operation, comprising:
[0030] receiving IO write operation issued by a host, and detecting whether the host starts high-load write protection mode;
[0031] if yes, obtaining write management information of the high-load write protection mode, wherein the write management information comprises data flow information of historical IO write operation and random update information of random update command;
[0032] judging whether the IO write operation is sequential write operation according to the data flow information;
[0033] if yes, updating the data flow information according to position metadata of the IO write operation;
[0034] otherwise, temporarily closing the high-load write protection mode to reset the random update information.
[0035] From the above description, the beneficial effects of the present application are: first, by detecting whether the host starts the high-load write protection mode (VPG specification), it can actively identify whether the current system is in the running state that needs special management. When the mode is started, by obtaining the write management information containing the data stream information, it provides a decision basis for the subsequent sequence judgment of the write operation. VPG specification requires that each IO write operation of the write data stream information is sequential writing, and based on the data stream information, the history writing rule can be traced back, so by matching the current IO write operation with the data stream information, it can accurately determine whether the current IO write operation belongs to sequential writing. For sequential write operation, by updating the data stream information corresponding to the position metadata in real time, the dynamic consistency of the storage space management information is maintained. The present application can ensure that the data stream information read by the host in the high-load write protection mode is sequential write operation, and there is no random write operation, so as to adapt to the video performance guarantee specification. The present application forms a dynamic management mechanism under the high-load write protection mode through the multi-level linkage of mode state detection, management information calling, dynamic judgment logic and feedback control mechanism.
[0036] Further, the write management information further includes random update information of a random update command;
[0037] Before judging whether the IO write operation is a sequential write operation according to the data stream information, further comprising:
[0038] Detecting whether the position metadata of the IO write operation is completely located in the user area of the storage space;
[0039] If yes, detecting whether there is an authorized address matched with the position metadata of the IO write operation in the random update information;
[0040] If yes, it is not necessary to judge whether the IO write operation is a sequential write operation according to the data stream information, and the data is directly written according to the position metadata;
[0041] If not, judging whether the IO write operation is a sequential write operation according to the data stream information;
[0042] Otherwise, write data according to the area type to which the position metadata belongs in the storage space.
[0043] As can be seen from the above description, the data in the non-user area is not limited by the VPG specification and can be randomly written. In the high-load write protection mode, only a small part of the addresses are allowed to be randomly written, and this part of the address is recorded in the random update information. Therefore, for the operation in the user area, the IO write operation is combined with the random update information to determine whether it is a legal random write operation in the high-load write protection mode. If it is a legal random write operation, since the address information of the operation has been recorded in the random update information, it does not violate the mandatory requirement of the high-load write protection mode for sequential writing, and therefore the data stream information does not need to be updated, and the step of determining whether it is a sequential write operation can be directly skipped, and the data writing is directly completed. For the operation in the non-user area, different processing strategies are adopted according to the type of the area to which the operation belongs, thereby ensuring the normal writing of the non-user area. This step-by-step judgment mechanism realizes accurate interception of illegal random writing.
[0044] Further, the determining whether the IO write operation is a sequential write operation according to the data stream information comprises:
[0045] determining a termination logical address of a previous IO write operation according to the data stream information;
[0046] comparing whether the termination logical address and position metadata of the IO write operation are same;
[0047] if the termination logical address and the position metadata of the IO write operation are same, determining that the IO write operation is a sequential write operation;
[0048] if the termination logical address and the position metadata of the IO write operation are not same, determining that the IO write operation is an illegal random write operation, and temporarily closing the high-load write protection mode to reset the random update information.
[0049] As can be seen from the above description, the random write operation is determined to be illegal, and the logical source comes from the mandatory requirement of the VPG specification for sequential writing. The VPG specification requires that all IO operations except the random update command are sequential writing, which can effectively avoid the performance degradation caused by random writing. The termination logical address of the previous write operation is obtained through the data stream information, and a continuity comparison is made between the termination logical address and the position metadata of the current write operation. If they are same, it indicates that the current operation is a sequential write, which meets the requirement of the high-load write protection mode. If they are not same, it is determined to be an illegal random write operation, the high-load write protection mode is closed, the host is returned to the traditional writing mode, and the random update information is reset to complete the mode initialization, thereby avoiding the illegal random write operation from being written into the random update information. This double-verification mechanism can accurately distinguish between legal and illegal operations, and ensure the stability of the writing performance in the high-load scenario.
[0050] Further, the updating the data stream information according to the position metadata of the IO write operation comprises:
[0051] According to the data stream information, it is detected whether the position metadata of the IO write operation belongs to a target management type of the high-load write protection mode;
[0052] If yes, the position metadata is updated to the data stream information according to the target management type to which the position metadata belongs;
[0053] Otherwise, the high-load write protection mode is temporarily closed to reset the random update information.
[0054] According to the above description, according to the data stream information, it is detected whether the position metadata of the IO write operation belongs to a target management type, which can screen out legal operations that meet the preset management rules. When the detection result is that the position metadata belongs to the target management type, the position metadata is dynamically updated to the data stream information according to the update rule corresponding to the type, so as to ensure the real-time effectiveness of the data stream information. If the detection result does not belong to the target management type, the high-load write protection mode is temporarily closed and the random update information is reset to forcibly interrupt illegal operations that may cause data stream disorder, thereby maintaining the running stability of the high-load write protection mode at the system level. Through the combination of the classification processing mechanism and the abnormal interruption mechanism, the contradiction between the data stream information maintenance and the illegal operation blocking in the high-concurrency scenario is effectively solved.
[0055] Further, the data stream information includes an old flow identifier that has been allocated and a new flow identifier that has not been allocated;
[0056] The target management type includes resource allocation management, resource recycling management, full update management and incremental update management;
[0057] According to the data stream information, it is detected whether the position metadata of the IO write operation belongs to a target management type of the high-load write protection mode includes:
[0058] According to the data stream information, it is verified whether the position metadata meets an allocation condition of the new flow identifier, and if the allocation condition is met, it is determined that the position metadata belongs to resource allocation management;
[0059] If the allocation condition is not met, it is verified according to the data stream information whether the position metadata meets a release condition of the old flow identifier, and if the release condition is met, it is determined that the position metadata belongs to resource recycling management;
[0060] If the release condition is not met, it is verified according to the data stream information whether the position metadata is cross-unit writing, and if it is cross-unit writing, it is determined that the position metadata belongs to full update management;
[0061] If not cross-unit write, verifying whether the location metadata is same-unit write according to the data flow information, if yes, determining that the location metadata belongs to incremental update management;
[0062] If not same-unit write, determining that the location metadata does not belong to the target management type.
[0063] From the above description, first, it is determined whether it belongs to resource allocation management by verifying the new flow identifier allocation condition, to determine the operation of allocating new resources; when the allocation condition is not met, it is determined whether it belongs to resource recycling management by verifying the old flow identifier release condition, to determine the operation of releasing resources; for the case that the first two conditions are not met, it is determined whether it belongs to full update management by detecting cross-unit write characteristics, to identify the operation involving multiple allocation units; if not cross-unit write, further detect same-unit write characteristics to determine whether it belongs to incremental update management, to identify the operation within the same allocation unit; finally, determine the abnormal operation that does not belong to any management type by exclusion method. This progressive classification detection mechanism realizes accurate classification of complex write scenarios, ensuring the accuracy and integrity of data flow information update.
[0064] Further, updating the location metadata to the data flow information according to the target management type to which the location metadata belongs comprises:
[0065] If the location metadata belongs to resource allocation management, obtaining a new flow identifier, and binding the location metadata to the new flow identifier;
[0066] If the location metadata belongs to resource recycling management, obtaining an old flow identifier of an allocated unit to which the location metadata currently belongs, and releasing all data bound by the old flow identifier;
[0067] If the location metadata belongs to full update management, obtaining an old flow identifier of an allocated unit to which the location metadata currently belongs, and binding the location metadata to the old flow identifier;
[0068] If the location metadata belongs to incremental update management, obtaining an old flow identifier of an allocated unit to which the location metadata currently belongs, and binding part of the location metadata to the old flow identifier.
[0069] From the above description, the new flow identifier is actively acquired and the binding relationship is established for the resource allocation management scene, which can effectively isolate different batches of write operations and avoid interference of random write on the allocated unit. Since the number of flow identifiers is limited, the binding data of the old flow identifier is released in the resource recycling management, so as to release the flow identifier in time to maintain the continuous writing performance and avoid writing failure caused by lack of flow identifier. The old flow identifier is re-bound for the full update scene, so as to ensure timely update of the identifier during bulk data writing; and only part of the metadata is bound during incremental update, so as to realize the balance between fine-grained data update and identifier management. The identifier operation strategy based on the difference of management types can timely update the data flow for each legal write protection operation, so as to ensure the legality of the data flow, and then adapt to the video performance guarantee specification.
[0070] Further, verifying whether the position metadata meets the allocation condition of the new flow identifier according to the data flow information comprises:
[0071] determining an unallocated unit in the user area according to the data flow information;
[0072] detecting whether the position metadata of the IO write operation is completely located in the unallocated unit and whether there is an unallocated new flow identifier in the data flow information;
[0073] if yes, it is determined that the position metadata meets the allocation condition of the new flow identifier;
[0074] otherwise, it is determined that the position metadata does not meet the allocation condition of the new flow identifier.
[0075] From the above description, firstly, the unallocated unit in the user area is located based on the data flow information, so as to ensure that the target address of the IO write operation belongs to the unoccupied storage space and avoid resource conflict. Secondly, whether there is an unallocated new flow identifier in the data flow information is detected, so as to prevent allocation failure caused by exhaustion of the identifier resource. Only when the position metadata is completely located in the unallocated unit and there is an available new identifier, the allocation operation is allowed to be executed. The cooperative verification mechanism effectively maintains the validity of the identifier resource pool and excludes the interference of cross-area writing, and establishes the pre-restriction of resource allocation, which together constitute the safety boundary of resource allocation in the high-load mode.
[0076] Further, verifying whether the position metadata meets the release condition of the old flow identifier according to the data flow information comprises:
[0077] determining the remaining space of the allocated unit to which the position metadata currently belongs according to the data flow information, and detecting whether the target space occupied by the position metadata is equal to the remaining space;
[0078] If yes, it is determined that the position metadata meets the release condition of the old stream identifier;
[0079] Otherwise, it is determined that the position metadata meets the release condition of the not old stream identifier.
[0080] As can be seen from the above description, the remaining space data of the allocated unit is obtained through the data stream information, the target space occupancy of the current IO write operation is compared with the remaining space in numerical value, and when the two are equal, it indicates that the unit space has been completely written after the current IO write operation, at which time the old stream identifier release condition is triggered, ensuring the timeliness and accuracy of resource recycling. If it is detected that the target space does not completely occupy the remaining space, the current resource allocation state is maintained, avoiding the false release of the storage resources in use. The mechanism realizes the fine management and efficient utilization of storage space resources.
[0081] Further, verifying whether the position metadata is a cross-unit write according to the data stream information comprises:
[0082] Determining an allocated unit to which the position metadata currently belongs according to the data stream information;
[0083] Determining an unallocated unit located next to the allocated unit in logical order;
[0084] Detecting whether the position metadata is partially located in the unallocated unit;
[0085] If yes, it is determined that the position metadata is a cross-unit write;
[0086] Otherwise, it is determined that the position metadata is not a cross-unit write.
[0087] As can be seen from the above description, first, the current allocated unit is located based on the data stream information, and its physical boundary is clear; second, the space continuity between adjacent units is established by determining the unallocated unit next to the allocated unit; and finally, the continuity feature of the write operation is judged by detecting whether the position metadata crosses the boundary of two units. This detection mechanism based on the logical order of the unit can effectively distinguish between full update and incremental update scenarios, and avoid resource allocation errors caused by cross-unit write.
[0088] Further, verifying whether the position metadata is a same-unit write according to the data stream information comprises:
[0089] Determining an allocated unit to which the position metadata currently belongs according to the data stream information;
[0090] Detecting whether the position metadata is completely located in the allocated unit;
[0091] If yes, it is determined that the position metadata is a same-unit write;
[0092] Otherwise, it is determined that the position metadata is not same-unit writing.
[0093] As can be seen from the above description, according to the data stream information, the state of the currently allocated unit is obtained in real time, and then whether the position metadata is completely located in the allocated unit is detected, so as to accurately distinguish the same-unit writing and the cross-unit writing. When it is detected that the position metadata is completely located in the allocated unit, it is determined that it is same-unit writing, so as to accurately classify the writing type, provide accurate basis conditions for subsequent updating of the data stream information, and effectively support the performance guarantee requirement in the high-load state in the storage space management level.
[0094] Further, before detecting whether the position metadata of the IO write operation is completely located in the user area of the storage space, the method further comprises:
[0095] determining the current state of the high-load write protection mode;
[0096] If the high-load write protection mode is in the start running state, whether the position metadata of the IO write operation is completely located in the user area of the storage space is detected;
[0097] If the high-load write protection mode is in the temporary stop state, the unallocated unit of the user area is determined according to the data stream information, and whether the IO write operation is sequentially written in the unallocated unit is detected. If not, the high-load write protection mode is closed to reset the write management information.
[0098] As can be seen from the above description, when the high-load write protection mode is in the start running state, the IO write operation is strictly limited to sequential writing, and the high-load write protection mode is forcibly closed to clear the random update information, so as to effectively avoid the interference of random writing on the video recording performance, thereby guaranteeing the continuity and high throughput of high-load video recording. When the high-load write protection mode is in the temporary stop state, only sequential writing operation on the unallocated unit is allowed, so as to prevent illegal writing during the pause from interfering with the recorded data or the pre-allocated stream information, and ensure the data continuity when the high-load write protection mode is restored.
[0099] Further, writing data according to the region type to which the position metadata belongs in the storage space comprises:
[0100] detecting whether the position metadata is completely located in the system area of the storage space;
[0101] If yes, the legality of the IO write operation is verified according to standard protocol parameters, and if the verification is passed, data is written according to the position metadata;
[0102] Otherwise, write data according to the position metadata, and mark the position metadata as abnormal data.
[0103] From the above description, by preferentially detecting whether the IO write operation is located in the system area, it is ensured that the writing of system critical data is not limited by the high-load write protection mode, and the standard protocol is directly followed, thereby improving the flexibility and compatibility of storage management. For write operations across the system area and the user area, abnormal data is marked for subsequent processing, thereby avoiding data disorder or state conflict caused by boundary writing, and enhancing the fault tolerance of the system. The legality of the IO write operation in the system area needs to be verified to prevent illegal command execution, while ensuring that the user area is still subject to the high-load write protection mode, thereby balancing high performance and data security.
[0104] Another embodiment of the present application provides a storage device including a storage chip and a control chip, wherein the storage chip stores a computer program, and the computer program implements each step in the above-mentioned method for managing IO write operations when executed by the control chip.
[0105] From the above description, the present application has the following beneficial effects. First, by detecting whether the host starts the high-load write protection mode (VPG specification), it can be actively identified whether the current system is in a running state that needs special management. When the mode is started, write management information containing data stream information is obtained to provide a decision basis for subsequent write operation sequence judgment. The VPG specification requires that each IO write operation writing data stream information is sequential writing, and the history writing rule can be traced based on the data stream information, so that the current IO write operation and the data stream information are matched to accurately determine whether the current IO write operation belongs to sequential writing. For sequential write operations, the position metadata corresponding to the data stream information is updated in real time to maintain the dynamic consistency of the storage space management information. The present application can ensure that the data stream information read by the host in the high-load write protection mode is sequential write operation, and there is no random write operation to adapt to the video performance guarantee specification.
[0106] The above-mentioned method for managing IO write operations and the storage device can be applied to a video shooting device, which can improve the reliability and write performance of the device when performing high-load video recording. The following will be described through a specific embodiment:
[0107] Please refer to Figures 1 to 6 , the embodiment one of the present application is:
[0108] As Figure 1 shown, a method for managing IO write operations includes the following steps:
[0109] S1, an IO write operation issued by a host is received, and it is detected whether the host starts a high-load write protection mode. If the high-load write protection mode is started, S2 is executed.
[0110] The host starts the high-load write protection mode, that is, the host starts the high-load video recording. In the high-load video recording, each IO write operation needs to meet the VPG specification. The VPG specification requires that each IO write operation issued by the host is a sequential write operation, and there is no illegal random write operation (which belongs to illegal access). This is because the sequential write performance of the storage device is much higher than the random write performance, which can effectively guarantee the high write performance of the entire storage space. When the IO write operation is an illegal random write operation under the VPG specification, the high-load video recording needs to be closed to fall back to the traditional write mode to process the IO write operation.
[0111] S2, obtain write management information of the high-load write protection mode, the write management information including data stream information (VPG_Stream_Info) of historical IO write operations and random update information (VPG_random_upadte_info) of a random update command (Random Update).
[0112] In some embodiments, in the VPG specification, the size of the write data issued by the host each time is fixed. This predefined unit is called an allocation unit (AU), which is the minimum data block size of each IO write operation in the VPG mode. Therefore, in the VPG mode, the entire storage space is divided into multiple AU of the same size. Among them, the AU in the storage space is divided into opened AU and unopened AU. Within a single AU, as long as new IO data is written from the start address of the current AU, it is defaulted that the current AU has been allocated (that is, opened); or the host issues a Random Update command, and if the logical block address of the Random Update command is located in the address range of a certain AU, it is defaulted that the AU has been allocated (that is, opened).
[0113] VPG _ Stream _ Info holds the Stream ID information of each Opened AU, and in each Stream ID, the Start Logical Block Address (SLBA) of the corresponding Opened AU and the number of Logical Block Addresses (LBA Cnt) of the data already written in the Opened AU are associated. As long as the AU information is saved to VPG _ Stream _ Info, it means that the current AU has been Opened. The number of Stream IDs is limited, and when all the Stream IDs are used, no new AU is allowed to be Opened. VPG _ random _ upadte _ info holds the SLBA and Access Type specified by the Random Update command.
[0114] As shown in Figure 2 , specifically, before S3, the method further comprises S301-S306:
[0115] S301, determine the current state of the high-load write protection mode, if the high-load write protection mode is in the start running state, execute S303; if the high-load write protection mode is in the temporary stop state, execute S302.
[0116] The host can be divided into three states according to the VPG state: Normal State, Enable State and Suspend State, wherein the Normal State means that the host does not start the high-load write protection mode (VPG management), and in this state, the VPG related write management information will be reset. The Enable State means that the host starts the high-load write protection mode and is in the start running state, that is, starts video recording, and in this state, the VPG related write management information can be updated. The Suspend State means that the host starts the high-load write protection mode, but is in the temporary stop state, that is, suspends video recording, and in this state, the VPG related other management information needs to be saved. Figure 3As shown, the host is in the Initial State when powered off. When powered on, the host can be set to any of the three states: Normal, Enable, and Suspend. For example, if the host starts video recording in the Normal State, it switches to the Enable State. If the host pauses video recording in the Enable State, it switches to the Suspend State. Conversely, if the host resumes video recording in the Suspend State, it switches back to the Enable State. If the host terminates video recording or experiences unauthorized access in the Enable State, it switches to the Normal State. Similarly, if the host terminates video recording or experiences unauthorized access in the Suspend State, it also switches back to the Normal State.
[0117] S302. Determine the unallocated units of the user area based on the data flow information, and detect whether the IO write operation is sequentially written within the unallocated units. If not, disable the high-load write protection mode to reset the write management information.
[0118] In one alternative implementation, such as Figure 3 As shown, when the host is in the VPG Suspend State, as long as the IO write operation is sequentially written under the Unopened AU (i.e., the SLBA of the IO write operation is equal to the SLBA of the Unopened AU), the IO write operation can be authenticated by the VPG specification. If the IO write operation is not sequential, then the IO write operation is considered an illegal access, and it is necessary to disable the high-load write protection mode, switch to the Normal State, and reset all information in VPG_Stream_Info and VPG_random_update_info.
[0119] S303. Detect whether the location metadata of the IO write operation is completely located within the user area of the storage space. If so, execute S304; otherwise, execute S306.
[0120] In some embodiments, the location metadata includes the starting logical block address (SLBA) and the number of logical blocks (NLB) used for writing data in the IO write operation, wherein the ending logical block address used for writing data can be represented as SLBA+NLB. The NLB of the IO write operation is stored in LBA Cnt within the Stream ID.
[0121] In an optional implementation, S303 specifically involves: detecting whether the SLBA and SLBA+NLB of the IO write operation are both located in the user area; if so, then executing S304.
[0122] S304. Detect whether there is an update address in the random update information that matches the location metadata of the IO write operation. If it exists, execute S305; otherwise, execute S3.
[0123] In an optional implementation, S304 specifically involves: detecting whether the SLBA recorded in VPG_random_upadte_info is the same as the SLBA of the IO write operation; if so, then executing S305.
[0124] S305. Without executing S3, write the data directly based on the location metadata.
[0125] S306. Write data according to the region type to which the location metadata belongs in the storage space.
[0126] S306 includes S3061-S3063:
[0127] S3061. Detect whether the location metadata is completely located within the system area of the storage space. If yes, execute S3062; otherwise, execute S3063.
[0128] In one alternative implementation, such as Figure 4 As shown, S3061 specifically checks whether the SLBA and SLBA+NLB of the IO write operation are both located in the System Area. If so, S3062 is executed. Figure 5 As shown, if the SLBA of the IO write operation is detected to be located in the System Area, but the SLBA+NLB of the IO write operation is not located in the System Area, then S3063 is executed.
[0129] It should be noted that the entire storage space is divided into multiple AUs. The system region only occupies the address space of the first N AUs starting from LBA=0, where N is an integer greater than or equal to 0. Data within the system region is not subject to VPG specification management and can be written randomly.
[0130] S3062. Verify the legality of the IO write operation according to the standard protocol parameters. If the verification is successful, write the data according to the location metadata.
[0131] In an alternative embodiment, the standard protocol parameters are obtained from the NVMe protocol, and the IO write operation is verified for legality with respect to parameters such as namespace identification (NSID), physical region page (PRP), scatter gather list (SGL), and logical block address (LBA) according to the standard protocol parameters.
[0132] S3063, write data according to the position metadata, and mark the position metadata as abnormal data.
[0133] S3, determine whether the IO write operation is a sequential write operation according to the data flow information, and if so, execute S4.
[0134] Specifically, S3 includes S31-S34:
[0135] S31, determine the termination logical address of the previous IO write operation according to the data flow information.
[0136] S32, compare whether the termination logical address and the position metadata of the IO write operation are the same.
[0137] S33, if the same, determine that the IO write operation is a sequential write operation.
[0138] S34, if not the same, determine that the IO write operation is an illegal random write operation, temporarily close the high-load write protection mode to reset the random update information.
[0139] In an alternative embodiment, as shown in Figure 6 if the position metadata of the current IO write operation falls within a certain Opened AU, but the number of logical block addresses in which data has been written in the current Opened AU is X, then the SLBA of the current IO write operation is equal to X, indicating that the current IO write operation is a sequential write operation, and the SLBA of the current IO write operation is not equal to X, indicating that the current IO write operation is an illegal random write operation.
[0140] It should be noted that temporarily closing the high-load write protection mode means switching to the Normal State, and after resetting the random update information, switching to the Enable State again.
[0141] S4, update the data flow information according to the position metadata of the IO write operation.
[0142] Please refer to Figures 7 to 11 , embodiment two of the present application is:
[0143] A method for managing IO write operations, which is different from embodiment one in that a specific implementation of S4 is provided.
[0144] AsFigure 7 As shown, specifically, S4 includes S41-S43:
[0145] S41, according to the data stream information, detecting whether the position metadata of the IO write operation belongs to the target management type of the high-load write protection mode, if yes, executing S42, otherwise executing S43.
[0146] S42, updating the position metadata to the data stream information according to the target management type to which the position metadata belongs.
[0147] The data stream information includes an allocated old stream identifier and an unallocated new stream identifier, and the target management type includes resource allocation management, resource recycling management, full update management and incremental update management.
[0148] Specifically, S41 includes S411-S414:
[0149] S411, according to the data stream information, verifying whether the position metadata meets the allocation condition of the new stream identifier, if the allocation condition is met, determining that the position metadata belongs to resource allocation management, and executing S421; if the allocation condition is not met, executing S412.
[0150] In an optional embodiment, S411 includes S4111-S4112:
[0151] S4111, according to the data stream information, determining an unallocated unit in the user area.
[0152] S4112, detecting whether the position metadata of the IO write operation is completely located in the unallocated unit and whether there is an unallocated new stream identifier in the data stream information, if yes, determining that the position metadata meets the allocation condition of the new stream identifier.
[0153] In a specific application scenario, as shown in the following table, the SLBA and NLB of the current IO write operation are judged with the SLBA and LBA Cnt of all Opened AU in VPG_Stream_Info. When the SLBA and NLB of this IO write operation do not fall within any Opened AU area, and the SLBA of the current IO write operation is the same as that of a certain Unopened AU, and there is an unallocated Stream ID, the allocation condition of the new stream identifier is met. Figure 8
[0154] S412, verifying whether the position metadata satisfies a release condition of the old stream identifier according to the data stream information, if the release condition is satisfied, determining that the position metadata belongs to resource recycling management, and performing S422; if the release condition is not satisfied, performing S413.
[0155] In an optional implementation, S412 includes S4121:
[0156] S4121, determining a remaining space of an allocated unit to which the position metadata currently belongs according to the data stream information, and detecting whether a target space occupied by the position metadata is equal to the remaining space, if yes, determining that the position metadata satisfies the release condition of the old stream identifier.
[0157] In a specific application scenario, as shown in Figure 9 The SLBA and NLB of the current IO write operation are compared with the SLBA and LBA Cnt bound by all Stream IDs in VPG_Stream_Info to determine whether the current IO write operation will fill the current Opened AU. That is, the position metadata of the current IO write operation satisfies the following relationship: SLBA of the current IO write operation = SLBA of the Stream ID in VPG_Stream_Info + LBA Cnt, and SLBA of the current IO write operation + NLB = SLBA of the Stream ID in VPG_Stream_Info + AU Size.
[0158] S413, verifying whether the position metadata is cross-unit writing according to the data stream information, if it is cross-unit writing, determining that the position metadata belongs to full update management, and performing S423; if it is not cross-unit writing, performing S414.
[0159] In an optional implementation, S413 includes S4131-S4133:
[0160] S4131, determining an allocated unit to which the position metadata currently belongs according to the data stream information.
[0161] S4132, determining an unallocated unit located at a next position of the allocated unit in a logical sequence.
[0162] S4133, detecting whether the position metadata is partially located in the unallocated unit, if yes, determining that the position metadata is cross-unit writing.
[0163] In a specific application scenario, as shown in Figure 10As shown, the SLBA and NLB of the current IO write operation are compared with the SLBA and LBA Cnt of each Opened AU in VPG_Stream_Info, respectively, to determine whether the current IO write operation is written from the Opened AU to which the current Stream ID belongs to the next logically continuous Unopened AU. That is, the position metadata of the current IO write operation satisfies the following relationship: SLBA of the current IO write operation = SLBA of VPG_Stream_Info + LBA Cnt of VPG_Stream_Info, and SLBA of the current IO write operation + NLB > SLBA of VPG_Stream_Info + AU Size, and SLBA of the current IO write operation + NLB < SLBA of VPG_Stream_Info + AU Size + AU Size.
[0164] S414, verifying whether the position metadata is same-unit write according to the data stream information, if yes, determining that the position metadata belongs to the incremental update management, and performing S424; if no, determining that the position metadata does not belong to the target management type.
[0165] It should be noted that S411-S414 above are sequentially determined step by step, and therefore the IO write operation not belonging to the target management type in S414 refers to the IO write operation not satisfying the allocation condition, not satisfying the release condition, not being cross-unit write, and not being same-unit write. As long as the IO write operation satisfies any one of the allocation condition, the release condition, the cross-unit write, and the same-unit write, it belongs to the IO write operation of the target management type.
[0166] In an optional embodiment, S414 includes S4141-S4142:
[0167] S4141, determining the allocated unit to which the position metadata currently belongs according to the data stream information.
[0168] S4142, detecting whether the position metadata is completely located in the allocated unit, if yes, determining that the position metadata is same-unit write.
[0169] In a specific application scenario, for example, Figure 11As shown, the SLBA and NLB of the current IO write operation are compared with the SLBA and LBA Cnt of each Opened AU in VPG_Stream_Info, respectively, to determine whether the current IO write operation is sequentially written into the same Opened AU. That is, the position metadata of the current IO write operation satisfies the following relationship: SLBA of the current IO write operation = SLBA of VPG_Stream_Info + LBA Cnt.
[0170] Specifically, S42 includes S421-S424:
[0171] S421, if the position metadata belongs to resource allocation management, a new stream identifier is obtained, and the position metadata is bound to the new stream identifier.
[0172] In a specific application scenario, the SLBA and NLB of the current IO write operation are saved into the new stream identifier Stream ID.
[0173] S422, if the position metadata belongs to resource recycling management, an old stream identifier of the allocated unit to which the position metadata currently belongs is obtained, and all data bound by the old stream identifier is released.
[0174] In a specific application scenario, all AU information bound by the current Stream ID is released.
[0175] S423, if the position metadata belongs to full update management, an old stream identifier of the allocated unit to which the position metadata currently belongs is obtained, and the position metadata is bound to the old stream identifier.
[0176] In a specific application scenario, the AU information bound by the current Stream ID is updated to the SLBA and LBA Cnt of the unallocated unit to which the data of the current IO write operation is about to be written.
[0177] S424, if the position metadata belongs to incremental update management, an old stream identifier of the allocated unit to which the position metadata currently belongs is obtained, and part of the position metadata is bound to the old stream identifier.
[0178] In a specific application scenario, the LBA Cnt in the AU information bound by the current Stream ID is updated to the LBA Cnt after the data of the current IO write operation is written.
[0179] S43, temporarily close the high-load write protection mode to reset the random update information.
[0180] Please refer to Figure 12 Embodiment three of the present application is:
[0181] A storage device 100, comprising a storage chip 101 and a control chip 102, the storage chip stores a computer program, the computer program is executed by the control chip 102 to realize each step in the method of managing IO write operation of embodiment one or embodiment two.
[0182] In summary, the application provides a method for managing IO write operation and a storage device, which realizes IO write operation management in a high-load write protection mode (VPG specification), and realizes high-performance sequential writing guarantee in a high-load scenario such as video recording through a multi-level linkage mechanism. The core is to dynamically detect the host state, and cooperatively manage the data flow information and the random update command to accurately distinguish between sequential writing and illegal random writing operation: for sequential writing operation, the data flow consistency is maintained by updating the position metadata in real time; for illegal random writing, the protection mode is forcibly closed and the random update information is reset to ensure writing compliance. The application adopts a classification processing mechanism to differentiate processing according to target types such as resource allocation / recycling, full / incremental update, and realizes fine-grained resource management through dynamic binding of flow identifiers. At the same time, a region verification mechanism is introduced to implement differentiated writing strategies for system regions and user regions, taking into account system flexibility and data security. This technology significantly improves the throughput stability of the storage system in a high-load environment, effectively avoids performance jitter caused by random writing, fully adapts to the video performance guarantee specification requirements, and enhances the fault tolerance of the system through the exception marking and state reset mechanism, providing a reliable storage management solution for high-performance continuous data writing scenarios.
[0183] In the above embodiments provided in the present application, it should be understood that the disclosed method, device, computer readable storage medium and electronic device can be implemented in other manners. For example, the above described device embodiment is only schematic, and for example, the division of the modules is only a logical function division, and there can be another division manner in actual implementation, for example, multiple components or modules can be combined or integrated into another device, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections can be indirect couplings or communication connections through some interfaces, devices or components or modules, and can be electrical, mechanical or other forms.
[0184] The components described as separated components can or can not be physically separated, and the components displayed as components can or can not be physical modules, that is, they can be located in one place, or can be distributed on multiple network modules. Some or all of the components can be selected according to actual needs to achieve the purpose of the embodiment scheme.
[0185] In addition, each function module in each embodiment of the present application can be integrated in one processing module, or each component can be physically present separately, or two or more modules can be integrated in one module. The integrated module can be realized in the form of hardware or in the form of a software function module.
[0186] When the integrated module is realized in the form of a software function 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 solutions of the present application or the whole or part of the technical solutions that essentially contribute to the prior art can be embodied in the form of a software product, which is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various program code storage media.
[0187] It should be noted that, for the foregoing method embodiments, in order to facilitate description, they are all expressed as a combination of a series of actions, but those skilled in the art should know that the present application is not limited by the described action sequence, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the actions and modules involved are not necessarily essential to the present application.
[0188] In the above embodiments, the description of each embodiment has its own emphasis, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.
[0189] The above is only an embodiment of the present application, and does not limit the patent scope of the present application, and any equivalent transformation or direct or indirect application in the related technical field based on the content of the specification and drawings of the present application is also included in the patent protection scope of the present application.
Claims
1. A method for managing I / O write operations, characterized in that, include: Upon receiving an IO write operation from the host, check whether the host has enabled high-load write protection mode; If enabled, the write management information of the high-load write protection mode is obtained, and the write management information includes the data stream information of historical IO write operations; Determine whether the IO write operation is a sequential write operation based on the data stream information; If so, the data stream information is updated according to the location metadata of the IO write operation; The written management information also includes random update information for random update commands; Before determining whether the IO write operation is a sequential write operation based on the data flow information, the method further includes: Detect whether the location metadata of the IO write operation is completely located within the user area of the storage space; If so, then check whether there is an update address in the random update information that matches the location metadata of the IO write operation; If it exists, there is no need to determine whether the IO write operation is a sequential write operation based on the data flow information; data can be written directly based on the location metadata. If it does not exist, then determine whether the IO write operation is a sequential write operation based on the data flow information; Otherwise, data is written according to the region type to which the location metadata belongs within the storage space; Updating the data stream information based on the location metadata of the IO write operation includes: Based on the data stream information, detect whether the location metadata of the IO write operation belongs to the target management type of the high-load write protection mode; If so, the location metadata is updated to the data stream information according to the target management type to which the location metadata belongs; Otherwise, temporarily disable the high-load write protection mode to reset the random update information.
2. The method for managing I / O write operations according to claim 1, characterized in that, Determining whether the IO write operation is a sequential write operation based on the data stream information includes: The termination logical address of the previous IO write operation is determined based on the data stream information; Compare whether the termination logical address is the same as the location metadata of the IO write operation; If they are the same, then the IO write operation is determined to be a sequential write operation; If they are different, the IO write operation is determined to be an illegal random write operation, and the high-load write protection mode is temporarily turned off to reset the random update information.
3. The method for managing I / O write operations according to claim 1, characterized in that, The data stream information includes allocated old stream identifiers and unassigned new stream identifiers; The target management types include resource allocation management, resource recycling management, full update management, and incremental update management; Based on the data stream information, detecting whether the location metadata of the IO write operation belongs to the target management type of the high-load write protection mode includes: Verify whether the location metadata meets the allocation conditions of the new flow identifier based on the data flow information. If the allocation conditions are met, determine that the location metadata belongs to resource allocation management. If the allocation conditions are not met, the location metadata is verified based on the data flow information to determine whether the release conditions of the old flow identifier are met. If the release conditions are met, the location metadata is determined to belong to resource reclamation management. If the release condition is not met, the location metadata is verified to be a cross-unit write based on the data stream information. If it is a cross-unit write, the location metadata is determined to be under full update management. If it is not a cross-unit write, then verify whether the location metadata is written within the same unit based on the data flow information. If it is written within the same unit, then determine that the location metadata belongs to incremental update management. If the data is not written to the same unit, then the location metadata is determined not to belong to the target management type.
4. The method for managing I / O write operations according to claim 3, characterized in that, Updating the location metadata to the data stream information according to the target management type to which the location metadata belongs includes: If the location metadata belongs to resource allocation management, then obtain the new flow identifier and bind the location metadata to the new flow identifier; If the location metadata belongs to resource reclamation management, then obtain the old flow identifier of the allocated unit to which the location metadata currently belongs, and unbind all data bound to the old flow identifier; If the location metadata is subject to full update management, then obtain the old flow identifier of the allocated unit to which the location metadata currently belongs, and bind the location metadata to the old flow identifier; If the location metadata belongs to incremental update management, then obtain the old flow identifier of the allocated unit to which the location metadata currently belongs, and bind part of the location metadata to the old flow identifier.
5. The method for managing I / O write operations according to claim 3, characterized in that, Verifying whether the location metadata meets the allocation conditions for the new stream identifier based on the data stream information includes: Unallocated units within the user area are determined based on the data stream information; Detect whether the location metadata of the IO write operation is completely located in the unallocated unit and whether there is an unallocated new stream identifier in the data stream information; If so, then the location metadata is determined to satisfy the allocation conditions for the new stream identifier.
6. The method for managing I / O write operations according to claim 3, characterized in that, Verifying whether the location metadata meets the release conditions of the old stream identifier based on the data stream information includes: Based on the data stream information, determine the remaining space of the allocated unit to which the location metadata currently belongs, and detect whether the target space occupied by the location metadata is equal to the remaining space; If so, then the location metadata is determined to satisfy the release condition of the old stream identifier.
7. The method for managing I / O write operations according to claim 3, characterized in that, Verifying whether the location metadata is a cross-cell write based on the data stream information includes: The allocated unit to which the location metadata currently belongs is determined based on the data stream information; Determine the unallocated unit whose logical order is one position after the allocated unit; Detect whether the location metadata is partially located within the unallocated unit; If so, then it is determined that the location metadata is written across cells.
8. The method for managing I / O write operations according to claim 3, characterized in that, Verifying whether the location metadata is written to the same unit based on the data stream information includes: The allocated unit to which the location metadata currently belongs is determined based on the data stream information; Detect whether the location metadata is completely located within the allocated unit; If so, then it is determined that the location metadata was written within the same unit.
9. The method for managing I / O write operations according to claim 1, characterized in that, Before detecting whether the location metadata of the IO write operation is completely within the user area of the storage space, the method further includes: Determine the current state of the high-load write protection mode; If the high-load write protection mode is in the running state, then it is detected whether the location metadata of the IO write operation is completely located in the user area of the storage space; If the high-load write protection mode is in a temporarily stopped state, the unallocated units of the user area are determined according to the data flow information, and it is detected whether the IO write operation is sequentially written in the unallocated units. If not, the high-load write protection mode is turned off to reset the write management information.
10. The method for managing I / O write operations according to claim 1, characterized in that, Writing data based on the region type to which the location metadata belongs within the storage space includes: Detect whether the location metadata is completely located within the system area of the storage space; If so, the legality of the IO write operation is verified according to the standard protocol parameters. If the verification passes, data is written according to the location metadata. Otherwise, write data according to the location metadata and mark the location metadata as abnormal data.
11. A storage device comprising a storage chip and a control chip, wherein the storage chip stores a computer program, characterized in that, When the computer program is executed by the control chip, it implements each step of the method for managing I / O write operations as claimed in any one of claims 1 to 10.
Citation Information
Patent Citations
Data read-write request processing method, electronic equipment, storage medium and program product
CN120233958A