Firmware hard disk data access method, device, computer equipment and storage medium
By integrating the timestamp function at the firmware level of the solid-state drive, the problem of timestamp information loss and inconsistency in traditional data storage is solved, time consistency and real-time performance are achieved throughout the data life cycle, and data accuracy and system efficiency in key business scenarios are improved.
Patent Information
- Application Number
- CN202510887539.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-27
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2045-06-27
AI Technical Summary
Traditional data storage methods add timestamps at the operating system or application level, resulting in lost, inconsistent, or inaccurate timestamp information. This affects the inability to accurately reflect the time-related attributes of the data, especially in scenarios such as financial transactions and industrial automation, affecting the real-time and accuracy of business.
The timestamp function is integrated at the firmware level of the solid-state drive and deeply bound to the configuration parameters of the namespace, so that the timestamp information is generated synchronously and stored in the same storage unit. This solves the migration loss and inconsistency problems between systems caused by separate timestamp storage, reduces the complexity of system software, and improves the real-time and accuracy of data.
It achieves time consistency throughout the entire data life cycle, enhances the real-time and accuracy of data in key business scenarios, and reduces the complexity of system software.
Smart Images

Figure CN120386492B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a firmware hard disk data access method, device, computer equipment, and storage medium. Background Art
[0002] With the development of information technology, data storage and management are becoming increasingly important. Among numerous data storage devices, solid-state drives (NVMe SSDs) are widely used in various computer systems and mobile devices due to their fast read and write speeds and strong shock resistance. However, when using data, it is often necessary to know time-related information, such as the data's generation and modification times, to facilitate data management, analysis, and traceability.
[0003] The traditional approach is to add timestamp information to data at the operating system or application level, but this approach has some significant drawbacks. First, because timestamp information is stored and managed separately from the data, it is prone to timestamp loss or inconsistency during data migration, backup, or interaction between different systems. This results in inaccurate representation of the data's time-related attributes, hindering its effective utilization. Second, in scenarios such as financial transaction data recording and industrial automation data collection, where real-time and accuracy requirements are extremely high, adding timestamps at the operating system or application level can introduce delays, leading to inaccurate timestamps and, in turn, impacting business operations and decision-making accuracy. Summary of the Invention
[0004] The present application provides a firmware hard disk data access method, apparatus, computer equipment and storage medium to at least solve the problem that related technologies, such as adding timestamps at the operating system or application level, cause timestamp information to be lost, inconsistent or inaccurate, and that the time-related attributes of data migration, backup or interaction between different systems cannot be accurately reflected, thus affecting the effective use of data and the normal operation of business.
[0005] This application provides a firmware hard disk data access method, which is applied to a solid-state hard disk, including:
[0006] Receive access instructions sent by the host and determine the target namespace based on the access instructions;
[0007] Obtain configuration parameters of the timestamp function in the target namespace, and determine the data to be processed corresponding to the access instruction based on the configuration parameters;
[0008] Execute corresponding processing operations on the data to be processed according to the access instructions.
[0009] The present application also provides a firmware hard disk data access device, which is applied to a solid-state hard disk, comprising:
[0010] A receiving module, configured to receive an access instruction sent by a host and determine a target namespace according to the access instruction;
[0011] An acquisition module, configured to obtain configuration parameters of a timestamp function in a target namespace and determine the data to be processed corresponding to the access instruction based on the configuration parameters;
[0012] The execution module is used to perform corresponding processing operations on the data to be processed according to the access instruction.
[0013] The present application also provides an electronic device, comprising: a memory for storing a computer program; and a processor for implementing the steps of any of the above-mentioned firmware hard disk data access methods when executing the computer program.
[0014] The present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned firmware hard disk data access methods are implemented.
[0015] The present application also provides a computer program product, including a computer program, which implements the steps of any of the above-mentioned firmware hard disk data access methods when executed by a processor.
[0016] Through this application, since the timestamp function is integrated into the firmware level of the solid-state drive and deeply bound to the configuration parameters of the namespace, the timestamp information can be synchronously generated and stored in the same storage unit when the data is written. Therefore, it can solve the problems of migration loss, inconsistency between systems, and delay errors caused by adding timestamps at the application layer due to the separate storage of data and timestamps in traditional software layer timestamp solutions, and achieve the technical effect of enhancing the time consistency of data throughout its life cycle, reducing the complexity of system software, and improving the real-time and accuracy of data in key business scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0018] Figure 1 A flowchart of a firmware hard disk data access method provided in an embodiment of the present application;
[0019] Figure 2 A schematic diagram of the operation logic of the host and solid-state drive timestamp function provided in an embodiment of the present application;
[0020] Figure 3A schematic diagram of the process of creating a namespace in a solid-state drive according to an embodiment of the present application;
[0021] Figure 4 A schematic diagram of the process of generating and appending timestamps in a solid-state drive according to an embodiment of the present application;
[0022] Figure 5 A structural block diagram of a firmware hard disk data access device provided in an embodiment of the present application;
[0023] Figure 6 A schematic diagram of the hardware structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0024] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0025] It should be noted that, in the description of this application, the terms "comprises," "includes," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. The terms "first," "second," etc., in this application are used to distinguish similar objects, and are not used to describe a particular order or sequence.
[0026] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0027] The embodiment of the present application provides a firmware hard disk data access method, which is applied to a solid state hard disk. Figure 1 FIG. 1 is a flow chart of a firmware hard disk data access method according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:
[0028] Step S101: receiving an access instruction sent by a host, and determining a target namespace according to the access instruction.
[0029] It should be noted that a namespace is the core logical unit that enables multi-user isolation and refined management in SSDs. By partitioning the physical flash memory into independently addressable virtual storage pools, each namespace can be configured with independent capacity, performance QoS, and data lifecycle policies. In NVMe SSDs, namespaces typically adhere to the NVMe protocol specification, using a 64-bit namespace identifier for globally unique addressing and support for dynamic creation and destruction. When the host initiates an access command, the SSD firmware parses the NSID field in the NVMe command structure and, in conjunction with an internal hash index table, quickly locates the metadata area of the target namespace (including the LBA mapping table, timestamp configuration parameters, and more). This process typically completes in microseconds, ensuring low-latency responses in high-concurrency scenarios. Furthermore, the namespace mechanism supports storage tiering strategies—for example, allocating SLC cache to critical business namespaces and enabling compression algorithms for cold data spaces—to maximize flash memory utilization and read / write performance.
[0030] In an embodiment of the present application, the solid-state drive will first receive an access instruction sent by the host, wherein the access instruction may be of different types such as a data write instruction or a data read instruction. Next, the solid-state drive will parse out a namespace identifier from the access instruction, and the namespace identifier can uniquely identify a target namespace. Afterwards, the solid-state drive matches the parsed namespace identifier with all the namespaces created in the system. The namespaces created in the system were previously created by receiving namespace creation requests and in accordance with corresponding rules, and these namespaces have their own unique identifiers. Through this matching, the solid-state drive can determine the target namespace pointed to by the access instruction, that is, to clarify which specific namespace the host wants to access, thereby laying the foundation for subsequent processing operations on the data in the namespace.
[0031] like Figure 2 As shown in the figure, the operational logic of the host and the solid-state drive related to the timestamp function: on the host side, when creating a namespace, you can specify whether to enable the timestamp function, you can customize the parameters to set whether the returned data has a timestamp, you can also query the function status, and decide whether to allocate expansion space for the storage unit based on whether the returned data needs to have a timestamp; on the solid-state drive side, if it contains corresponding preset parameters, a namespace with a timestamp function is created, and if the parameters indicate that the storage unit does not have expanded space, it is created without a timestamp. At the same time, it can receive the timestamp function parameters and read and write instructions of the upper storage system, and decide whether the returned data has a timestamp according to the parameters.
[0032] Step S102: obtaining configuration parameters of the timestamp function in the target namespace, and determining the data to be processed corresponding to the access instruction based on the configuration parameters.
[0033] In an embodiment of the present application, the SSD first obtains the configuration parameters for the timestamp function from the determined target namespace. These configuration parameters are set when the namespace is created, including the timestamp function parameters and the timestamp unit parameters. The SSD then extracts the timestamp function parameters and the timestamp unit parameters from the obtained configuration parameters. Next, the SSD makes a judgment based on the value of the timestamp function parameters. If the timestamp function parameter is enabled (i.e., the first preset parameter), the SSD obtains the user data corresponding to the access instruction and calculates the target timestamp based on the timestamp unit parameters. The user data and the target timestamp are then merged to obtain the data to be processed. If the timestamp function parameter is disabled (i.e., the second preset parameter), or if the timestamp function parameter does not exist, the SSD directly obtains the user data corresponding to the access instruction and uses it as the data to be processed. When calculating the target timestamp, the SSD first obtains the current CPU timing parameters, calculates an initial timestamp based on these parameters, and then adjusts the initial timestamp based on the timestamp unit information to ultimately obtain the target timestamp. Through this series of operations, the SSD can accurately determine the data to be processed corresponding to the access instruction, preparing for subsequent data processing operations based on the access instruction.
[0034] Step S103: performing corresponding processing operations on the data to be processed according to the access instruction.
[0035] In an embodiment of the present application, the solid-state drive first determines the type of access instruction received. If the access instruction is a data write instruction, the solid-state drive will store the user data in the data to be processed in the corresponding storage unit determined according to the logical block address format of the target namespace; at the same time, since the data to be processed also contains a target timestamp, the target timestamp is stored in the extended space corresponding to the storage unit. The extended space is allocated based on the timestamp unit parameter when creating a namespace containing a timestamp function. If the access instruction is a data read instruction, the solid-state drive directly sends the data to be processed to the host. The data to be processed may contain only user data or data that combines user data and target timestamps, depending on the configuration of the timestamp function of the target namespace. By performing corresponding operations according to different access instruction types, accurate processing of data is achieved.
[0036] In an embodiment of the present application, before receiving the access instruction sent by the host, the method further includes:
[0037] Step S201: receiving a namespace creation request, wherein the namespace creation request includes a timestamp function parameter and a timestamp unit parameter.
[0038] In an embodiment of the present application, the solid-state drive receives a namespace creation request from the upper storage system. This request contains two important parameters, namely the timestamp function parameter and the timestamp unit parameter. The timestamp function parameter is used to control whether the namespace has the timestamp function enabled, and the user can set the value of this parameter according to actual needs. The timestamp unit parameter is used to specify the unit of the timestamp, and the user can choose one from units such as milliseconds, seconds, minutes, and hours. After the solid-state drive receives the namespace creation request containing the timestamp function parameter and the timestamp unit parameter, it will save these parameters to provide a basis for the subsequent creation of the namespace and timestamp-related processing operations. By receiving the namespace creation request, the solid-state drive can flexibly create a namespace that meets the requirements according to the specific needs of the user, laying the foundation for subsequent data storage and management.
[0039] Step S202: If the timestamp function parameter is the first preset parameter, a namespace containing the timestamp function is created, corresponding extended space is allocated to each storage unit in the namespace according to the timestamp unit parameter, and the timestamp function parameter and the timestamp unit parameter are used as configuration parameters of the namespace.
[0040] In an embodiment of the present application, the solid-state drive first determines whether the received timestamp function parameter is the first preset parameter (such as 1). If so, it starts to create a namespace containing the timestamp function. Next, the size of the expansion space that needs to be allocated to each storage unit is determined based on the timestamp unit parameter. If the timestamp unit parameter is the first level, an expansion space of the first preset length is allocated in each storage unit. If the timestamp unit parameter is the second level, an expansion space of the second preset length is allocated. Finally, the timestamp function parameters and the timestamp unit parameters are saved as configuration parameters of the namespace, so that when data is subsequently written, the timestamp is recorded and stored according to these configuration parameters. In this way, flexible configuration of the namespace timestamp function and reasonable allocation of expansion space are achieved.
[0041] Step S203: If the timestamp function parameter is the second preset parameter, a namespace that does not include the timestamp function is created, and the timestamp function parameter is used as a configuration parameter of the namespace.
[0042] In an embodiment of the present application, the solid-state drive first determines whether the received timestamp function parameter is a second preset parameter (e.g., 0). If so, it begins creating a namespace that does not include the timestamp function. Since this namespace does not support the timestamp function, there is no need to allocate additional expansion space in the storage unit to store the timestamp information. Finally, the timestamp function parameter is saved as a configuration parameter of the namespace so that when processing access instructions later, it can be used to determine whether the namespace supports the timestamp function based on this parameter. In this way, the function of flexibly creating different types of namespaces based on user needs is achieved.
[0043] The method provided in the embodiment of the present application receives a namespace creation request containing timestamp function parameters and unit parameters before receiving an access instruction, and creates a namespace of corresponding function, allocates expansion space and saves configuration parameters according to the parameter values, thereby enabling users to flexibly configure the namespace timestamp function, thereby supporting multi-user storage isolation and refined management, and improving the resource adaptability of solid-state drives in different business scenarios.
[0044] In an embodiment of the present application, a corresponding extended space is allocated to each storage unit in the namespace according to the timestamp unit parameter, including: if the timestamp unit parameter is the first level, an extended space of a first preset length is allocated in each storage unit; or, if the timestamp unit parameter is the second level, an extended space of a second preset length is allocated in each storage unit.
[0045] Specifically, when creating a namespace that includes a timestamp function, it is necessary to allocate corresponding extended space for each storage unit based on the timestamp unit parameter: When a namespace creation request is received and the timestamp function parameter is enabled, the timestamp unit parameter is first parsed. If the parameter is set to the first level (such as milliseconds or seconds), an extended space of a first preset length, typically 8 bytes, is allocated to each storage unit for storing high-precision timestamps. If the timestamp unit parameter is set to the second level (such as minutes or hours), an extended space of a second preset length, typically 4 bytes, is allocated for storing low-precision timestamps. This allocation process occurs during the namespace initialization phase, predefining a fixed-length extended area in the storage unit to provide space for timestamp recording when subsequent data is written. After the allocation is completed, the mapping between the timestamp unit parameter and the extended space length is saved as a namespace configuration parameter, ensuring that the corresponding space can be accurately read and used during subsequent data operations.
[0046] As an example, Figure 3As shown, the host (HOST) sends a namespace creation request to the solid-state drive (SSD firmware), carrying parameters A (timestamp function parameter) and B (timestamp unit parameter), requesting the creation of a namespace (NAMESPACE_1). After receiving the request, the solid-state drive (SSD firmware) determines that parameter A (timestamp function parameter) is the first preset parameter (timestamp function enabled), and then creates a namespace (NAMESPACE_1) that includes the timestamp function. Based on parameter B (timestamp unit parameter), it allocates corresponding extended space to each storage unit in the namespace (if parameter B is the first level, it allocates extended space of the first preset length). At the same time, parameters A and B (timestamp function parameter and timestamp unit parameter) are used as configuration parameters for the namespace (NAMESPACE_1).
[0047] The method provided in the embodiment of the present application achieves refined management of storage resources by allocating expansion space of different lengths to storage units based on the level of timestamp unit parameters (such as high precision or low precision level). While meeting the timestamp accuracy requirements of different businesses, it avoids the waste of resources caused by fixed-length expansion space and improves the utilization of flash memory space.
[0048] In an embodiment of the present application, determining the data to be processed corresponding to the access instruction based on the configuration parameters includes the following steps A1-A3:
[0049] Step A1: extract the timestamp function parameter and the timestamp unit parameter from the configuration parameters.
[0050] Specifically, after determining the target namespace, the SSD operates from the configuration parameters saved in the target namespace. These configuration parameters are set and saved when the namespace is created, based on the custom parameters passed by the user through the management interface or specific commands. By reading the storage area of the configuration parameters, the SSD extracts the timestamp function parameters specifically used to indicate whether the timestamp function is enabled, as well as the timestamp unit parameters used to specify the timestamp recording unit. This provides the necessary data basis for subsequent operations such as determining the timestamp function status and calculating the target timestamp, thereby determining the data to be processed corresponding to the access instruction.
[0051] Step A2: If the timestamp function parameter is the first preset parameter, obtain the user data corresponding to the access instruction, and calculate the target timestamp according to the timestamp unit parameter; fuse the user data and the target timestamp to obtain the data to be processed.
[0052] Specifically, the SSD first determines whether the timestamp function parameter matches the first preset parameter. If so, it extracts the user data from the access instruction. Next, based on the timestamp unit parameter, it obtains the current CPU timing parameters and performs calculations to obtain an initial timestamp. This initial timestamp is then adjusted based on the timestamp unit information to obtain a target timestamp. Finally, the user data and the calculated target timestamp are merged to form the data to be processed. This method enables the addition of timestamp information to user data when the timestamp function is enabled.
[0053] Step A3: If the timestamp function parameter is the second preset parameter or the timestamp function parameter does not exist, then obtain the user data corresponding to the access instruction and use the user data as data to be processed.
[0054] Specifically, when the timestamp function parameter is the second preset parameter or the timestamp function parameter does not exist, the user data corresponding to the access instruction is obtained and used as the data to be processed: First, the solid-state drive extracts the timestamp function parameter from the configuration parameters of the target namespace to determine whether it is the second preset parameter (that is, the timestamp function is turned off) or whether the parameter does not exist (indicating that the namespace is not configured with the timestamp function). If any of the above conditions is met, the solid-state drive directly obtains the user data from the access instruction, and this process does not require additional calculation of the timestamp. Since the namespace does not support the timestamp function and the storage unit does not allocate extended space for recording timestamps, the obtained user data does not need to be merged with the timestamp and can be directly used as the data to be processed for subsequent operations such as writing to the storage unit or reading and sending to the host according to the access instruction.
[0055] The method provided in the embodiment of the present application extracts the timestamp function parameters and unit parameters from the configuration parameters, and decides whether to fuse user data with the target timestamp to generate the data to be processed based on the timestamp function parameters, thereby realizing dynamic adaptation of the data processing flow - automatically adding time attributes to the data when the timestamp function is turned on, and directly processing the original data when it is turned off, thereby ensuring data traceability and avoiding invalid computing overhead.
[0056] In an embodiment of the present application, the target timestamp is calculated according to the timestamp unit parameters, including: obtaining the current CPU timing parameters and calculating the initial timestamp according to the CPU timing parameters; adjusting the initial timestamp based on the timestamp unit information to obtain the target timestamp.
[0057] Specifically, the current CPU timing parameters are first obtained, including the current CPU tick count (number of ticks) and CPU frequency. Next, the host timestamp and initial CPU tick count (initial number of ticks) recorded when the driver was loaded are obtained. The initial timestamp is then calculated based on these parameters using the formula: Initial Timestamp = Host Timestamp + 1000 × [(CPU Tick Count - Initial CPU Tick Count) ÷ CPU Frequency]. This formula converts the CPU timing into time increments by dividing the difference between the CPU tick counts and the frequency. This is then added to the initial host timestamp to obtain the initial timestamp, accurate to the millisecond level.
[0058] As an example, in a real-world application scenario, assume that the SSD drive was loaded at 10:00:00 on January 1, 2001. The recorded host timestamp at this time is 1686976800000 milliseconds, and the initial CPU tick count is 100000000. Given a CPU frequency of 2.5 GHz (i.e., 2500000000 ticks per second), when the write command is received, the current CPU tick count is 100002500. By calculating the ratio of the tick difference (2500) to the frequency, the CPU runtime is calculated to be 0.000001 seconds. After converting this to 1 millisecond, the result is added to the initial host timestamp, resulting in a millisecond-level initial timestamp of 1686976800001 milliseconds, corresponding to the actual time of January 1, 2001, 10:00:00.001.
[0059] The method provided in the embodiment of the present application calculates the initial timestamp by obtaining the CPU timing parameters and adjusts the target timestamp in combination with the timestamp unit information, thereby achieving a precise match between the timestamp precision and the unit parameters, ensuring the consistency and accuracy of timestamp records in different namespaces, and providing a reliable time dimension basis for data lifecycle management.
[0060] In an embodiment of the present application, corresponding processing operations are performed on the data to be processed according to the access instruction, including: if the access instruction is a data write instruction, the user data to be processed is stored in the corresponding storage unit, and the target timestamp in the data to be processed is stored in the expansion space corresponding to the storage unit; or, if the access instruction is a data read instruction, the data to be processed is sent to the host.
[0061] Specifically, when the SSD receives an access instruction, it performs different operations based on the instruction type:
[0062] If it is a data write instruction, first store the user data in the data to be processed into the corresponding storage unit (the storage unit size is determined by the LBA format of the namespace, usually 512 bytes or 4096 bytes). If the data to be processed contains the target timestamp (that is, the timestamp function is enabled in the target namespace), then store the timestamp into the corresponding extended space of the storage unit (the size of the extended space is determined by the timestamp unit parameter set when the namespace is created, for example, millisecond units correspond to 8 bytes, and minute units correspond to 4 bytes).
[0063] If it is a data read command, the data to be processed is sent directly to the host. Before sending, the host will determine whether the data contains a timestamp based on the status of the custom FeatureID (such as 0xcf). The host can set the FeatureID parameter by sending the setfeature command (a timestamp is included when the parameter is 1 and not included when it is 0), or query the current status through the getfeature command. If a timestamp is included, the upper-layer storage system needs to increase the buffer allocated for the read operation to store the timestamp.
[0064] As an example, Figure 4 As shown, the process begins with the SSD driver loading. After loading, the SSD receives the host timestamp and then records the initial CPU tick count (SET_CPU_TICK). The host then writes data to a logical block address in the namespace, at which point the SSD records the current CPU tick count (CURRENT_TICK). The initial timestamp (in milliseconds) is then calculated using the formula: Initial Timestamp = Host Timestamp + 1000 × [(CPU Tick Count - Initial CPU Tick Count) ÷ CPU Frequency]. The initial timestamp is then converted to the unit set by the timestamp unit parameter to obtain the target timestamp. Finally, the target timestamp is appended to the user data, occupying a space determined by the timestamp unit parameter. This concludes the process.
[0065] The method provided in the embodiment of the present application performs differentiated operations on the processed data according to the access instruction type (write or read) (storing data and timestamps to the corresponding space when writing, and directly sending data when reading), thereby achieving efficient execution and integrity protection of data operations, ensuring that timestamp information is accurately recorded and transmitted during data flow, and improving the reliability of the storage system.
[0066] In the embodiment of the present application, the method further includes the following steps B1-B3:
[0067] Step B1: receiving a status query instruction sent by a host, and determining a target namespace according to the status query instruction.
[0068] Specifically, first, the SSD will receive a status query instruction from the host, which is used to obtain the timestamp function status information of the specified namespace. Next, the SSD parses the instruction content and extracts relevant information used to identify the target namespace from the instruction. This information may include a specific identifier or attribute description of the namespace. Then, based on this extracted information, the SSD performs a matching search in the many namespaces that have been created, thereby accurately locating the target namespace and preparing for the subsequent acquisition of the timestamp function configuration parameters of the namespace, determining its functional status and feeding back to the host. The entire process achieves accurate identification of the target namespace through the reception, parsing and search operations of the instruction.
[0069] Step B2: Obtain configuration parameters of the timestamp function in the target namespace.
[0070] Specifically, after determining the target namespace, the solid-state drive will search its storage system for the configuration parameter storage area associated with the target namespace. These configuration parameters are set and saved when the namespace is created, and include timestamp function parameters and timestamp unit parameters. The timestamp function parameter is used to indicate whether the timestamp function is enabled for the namespace. Its value is set by the user to the first preset parameter (indicating enabled) or the second preset parameter (indicating disabled) through a specific management interface or command when the namespace is created. The timestamp unit parameter is selected by the user from units such as milliseconds, seconds, minutes, and hours, and is used to determine the size of the space occupied by the timestamp and how the timestamp accuracy is adjusted. By reading the data in this storage area, the solid-state drive completely extracts the configuration parameters related to the timestamp function, providing the necessary data support for the subsequent determination of the functional status of the timestamp function. The entire acquisition process is based on the parameter setting mechanism when the namespace is created to ensure that the required configuration information can be accurately read.
[0071] Step B3: determining the functional status of the timestamp function according to the timestamp function parameters in the configuration parameters, and feeding back the functional status to the host.
[0072] Specifically, the solid-state drive will first read the configuration parameters of the target namespace, focusing on the timestamp function parameters. This parameter is set by the user through the management interface or specific commands when creating the namespace, and is used to control the turning on or off of the timestamp function. If the timestamp function parameter is the first preset parameter, it indicates that the timestamp function is turned on for the namespace, that is, a timestamp will be automatically appended when data is written; if it is the second preset parameter, it means that the timestamp function is turned on, and no timestamp will be added when data is written. After determining the status of the timestamp function, the solid-state drive will encapsulate this status information, and then feed back the status information to the host through the data transmission channel, so that the host can obtain the current status of the timestamp function of the target namespace for subsequent data management and operations.
[0073] The method provided in the embodiment of the present application implements a status synchronization mechanism between the host and the solid-state drive by receiving host status query instructions and feeding back the timestamp function status of the target namespace, enabling the upper-level system to grasp the configuration of storage resources in real time, providing data support for dynamically adjusting business policies and monitoring storage status, and improving the manageability and interactivity of the system.
[0074] In an embodiment of the present application, the method also includes: dynamically adjusting the timestamp precision and expansion space allocation based on characteristic parameters such as the access frequency, update cycle, and erase and write times of the target namespace, specifically determining the optimization strategy through a preset feature and precision mapping model, and executing timestamp unit reconfiguration and dynamic adjustment and data processing of the storage unit expansion space when the access characteristic fluctuation exceeds a threshold, so as to adaptively optimize storage resource utilization and ensure data consistency.
[0075] Specifically, the SSD dynamically adjusts timestamp precision based on data access characteristics: During data read and write operations, the SSD collects characteristic parameters such as the target namespace access frequency, data update cycle, and storage unit erase and write counts in real time. When fluctuations in these parameters exceed preset thresholds over multiple consecutive statistical periods, an optimization strategy is triggered based on a pre-established feature-precision mapping model. If access characteristics indicate frequent data updates, timestamp precision is increased and corresponding expansion space is allocated. If access characteristics indicate infrequent data updates, timestamp precision is reduced and excess expansion space is released.
[0076] During the adjustment process, the system temporarily locks namespace write operations, records unfinished data in the transaction log, reallocates or releases the storage unit's expansion space, and performs the appropriate precision conversion on the timestamp data. Once the adjustment is complete, the system updates the timestamp unit, expansion space status, and other information in the namespace metadata area and sends a notification command to the host to synchronize the latest configuration parameters.
[0077] By implementing a dynamic timestamp precision adjustment mechanism based on data access characteristics within the SSD, the system collects multi-dimensional namespace parameters in real time. When parameter fluctuations exceed preset thresholds, it automatically triggers optimization strategies to dynamically adjust timestamp precision and expansion space allocation. This mechanism maximizes storage resource utilization by intelligently identifying data access patterns (such as high-frequency updates or low-frequency cold data) and matching them with corresponding timestamp configurations (high precision / high space usage or low precision / low space usage). This avoids space waste caused by static configurations and improves timestamp validity through adaptive adjustments. Furthermore, measures such as write locking, transaction logging, and data consistency checks implemented during the adjustment process ensure data processing reliability, while metadata synchronization and host notification mechanisms maintain configuration coordination between upper and lower layers of the system. Ultimately, this mechanism, through intelligent resource optimization strategies, significantly improves the flexibility, scalability, and overall performance of the storage system, providing a more efficient timestamp management solution for enterprise-class storage applications.
[0078] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method.
[0079] The embodiment of the present application also provides a firmware hard disk data access device, which is applied to a solid state hard disk, such as Figure 5 Shown, including:
[0080] A receiving module 51 is configured to receive an access instruction sent by a host and determine a target namespace according to the access instruction;
[0081] An acquisition module 52 is configured to acquire configuration parameters of a timestamp function in a target namespace and determine the data to be processed corresponding to the access instruction based on the configuration parameters;
[0082] The execution module 53 is configured to execute corresponding processing operations on the data to be processed according to the access instruction.
[0083] Furthermore, the device also includes: a creation module, used to receive a namespace creation request, wherein the namespace creation request includes a timestamp function parameter and a timestamp unit parameter; if the timestamp function parameter is a first preset parameter, then a namespace including a timestamp function is created, and corresponding expansion space is allocated to each storage unit in the namespace according to the timestamp unit parameter, and the timestamp function parameter and the timestamp unit parameter are used as configuration parameters of the namespace; or, if the timestamp function parameter is a second preset parameter, then a namespace not including a timestamp function is created, and the timestamp function parameter is used as the configuration parameter of the namespace.
[0084] Furthermore, the creation module further includes: a first allocation submodule, a second allocation submodule;
[0085] a first allocating submodule, configured to allocate an extension space of a first preset length in each storage unit if the timestamp unit parameter is at a first level;
[0086] The second allocation submodule is configured to allocate an extension space of a second preset length in each storage unit if the timestamp unit parameter is at a second level.
[0087] Furthermore, the acquisition module 52 further includes: an extraction submodule, a first determination submodule, and a second determination submodule;
[0088] The extraction submodule is used to extract the timestamp function parameters and timestamp unit parameters in the configuration parameters;
[0089] A first determining submodule is configured to obtain user data corresponding to the access instruction if the timestamp function parameter is a first preset parameter, and calculate a target timestamp according to the timestamp unit parameter; and fuse the user data and the target timestamp to obtain data to be processed;
[0090] The second determining submodule is configured to obtain user data corresponding to the access instruction if the timestamp function parameter is a second preset parameter or the timestamp function parameter does not exist, and use the user data as data to be processed.
[0091] Furthermore, the first determining submodule further includes: an acquiring unit and an adjusting unit;
[0092] The acquisition unit obtains the current CPU timing parameters and calculates the initial timestamp based on the CPU timing parameters;
[0093] The adjustment unit adjusts the initial timestamp based on the timestamp unit information to obtain a target timestamp.
[0094] Furthermore, the execution module 53 is used to store the user data to be processed in the corresponding storage unit if the access instruction is a data write instruction, and store the target timestamp in the data to be processed in the expansion space corresponding to the storage unit; or, if the access instruction is a data read instruction, send the data to be processed to the host.
[0095] Furthermore, the device also includes: a feedback module for receiving a status query instruction sent by the host and determining the target namespace based on the status query instruction; obtaining the configuration parameters of the timestamp function in the target namespace; determining the functional status of the timestamp function based on the timestamp function parameters in the configuration parameters, and feeding back the functional status to the host.
[0096] See also Figure 6 , Figure 6is a structural diagram of a computer device provided by an optional embodiment of the present invention, such as Figure 6 As shown, the computer device includes: one or more processors 10, memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components utilize different buses to communicate with each other and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in the memory or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Equally, multiple computer devices can be connected, and each device provides part of the necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system).
[0097] The processor 10 may be a central processing unit, a network processor, or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit, a programmable logic device, or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic, or any combination thereof.
[0098] The memory 20 stores instructions that can be executed by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0099] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created based on the use of a computer device for displaying a small program landing page, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely located relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0100] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid-state drive; the memory 20 may also include a combination of the above types of memory.
[0101] The computer device further includes a communication interface 30 for the computer device to communicate with other devices or a communication network.
[0102] The embodiment of the present invention also provides a computer-readable storage medium. The above-mentioned method according to the embodiment of the present invention can be implemented in hardware, firmware, or implemented as a computer code that can be recorded in a storage medium, or implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and downloaded through a network and will be stored in a local storage medium, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memory. It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor or hardware, the method shown in the above embodiment is implemented.
[0103] Although the embodiments of the present invention have been described with reference to the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention. Such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A firmware hard disk data access method, applied to a solid state hard disk, characterized in that: include: receiving an access instruction sent by a host, and determining a target namespace according to the access instruction; Obtaining configuration parameters of a timestamp function in the target namespace, and determining to-be-processed data corresponding to the access instruction based on the configuration parameters; performing corresponding processing operations on the data to be processed according to the access instruction; The step of determining the data to be processed corresponding to the access instruction based on the configuration parameters includes: Extracting a timestamp function parameter and a timestamp unit parameter from the configuration parameters; If the timestamp function parameter is the first preset parameter, obtaining user data corresponding to the access instruction and calculating a target timestamp according to the timestamp unit parameter; fusing the user data and the target timestamp to obtain data to be processed; Alternatively, if the timestamp function parameter is the second preset parameter or the timestamp function parameter does not exist, user data corresponding to the access instruction is obtained, and the user data is used as data to be processed.
2. The method according to claim 1, characterized in that Before receiving the access instruction sent by the host, the method further includes: receiving a namespace creation request, wherein the namespace creation request includes a timestamp function parameter and a timestamp unit parameter; If the timestamp function parameter is the first preset parameter, a namespace containing a timestamp function is created, a corresponding extension space is allocated to each storage unit in the namespace according to the timestamp unit parameter, and the timestamp function parameter and the timestamp unit parameter are used as configuration parameters of the namespace; or, if the timestamp function parameter is the second preset parameter, a namespace that does not contain a timestamp function is created, and the timestamp function parameter is used as the configuration parameter of the namespace.
3. The method according to claim 2, characterized in that Allocating a corresponding extended space to each storage unit in the namespace according to the timestamp unit parameter includes: If the timestamp unit parameter is at the first level, allocating an extension space of a first preset length in each of the storage units; Alternatively, if the timestamp unit parameter is at the second level, an extension space of a second preset length is allocated in each of the storage units.
4. The method according to claim 1, wherein The calculating the target timestamp according to the timestamp unit parameter includes: Obtain current CPU timing parameters, and calculate an initial timestamp based on the CPU timing parameters; The initial timestamp is adjusted based on the timestamp unit parameter to obtain a target timestamp.
5. The method according to claim 1, characterized in that The performing a corresponding processing operation on the data to be processed according to the access instruction includes: If the access instruction is a data write instruction, the user data in the data to be processed is stored in the corresponding storage unit, and the target timestamp in the data to be processed is stored in the expansion space corresponding to the storage unit; or, if the access instruction is a data read instruction, the data to be processed is sent to the host.
6. The method according to claim 1, characterized in that The method further comprises: receiving a status query instruction sent by a host, and determining a target namespace according to the status query instruction; Obtain configuration parameters of the timestamp function in the target namespace; The functional status of the timestamp function is determined according to the timestamp function parameters in the configuration parameters, and the functional status is fed back to the host.
7. A firmware hard disk data access device, applied to a solid state hard disk, characterized in that: include: A receiving module, configured to receive an access instruction sent by a host and determine a target namespace according to the access instruction; an acquisition module, configured to acquire configuration parameters of a timestamp function in the target namespace, and determine the data to be processed corresponding to the access instruction based on the configuration parameters; An execution module, configured to execute corresponding processing operations on the data to be processed according to the access instruction; The acquisition module also includes: An extraction unit, configured to extract a timestamp function parameter and a timestamp unit parameter from the configuration parameters; A first processing unit is configured to obtain user data corresponding to the access instruction if the timestamp function parameter is a first preset parameter, calculate a target timestamp according to the timestamp unit parameter, and fuse the user data and the target timestamp to obtain data to be processed; The second processing unit is configured to obtain user data corresponding to the access instruction and use the user data as data to be processed if the timestamp function parameter is a second preset parameter or the timestamp function parameter does not exist.
8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the firmware hard disk data access method according to any one of claims 1 to 6 are implemented.
9. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the firmware hard disk data access method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Multi-namespace data management method and system
CN116450536A
Storage array system and storage access method
CN119396331A