Data writing method and device
By selecting a matching partition namespace for data writing based on the attributes of the data to be written, the problem of mismatch in service quality requirements of different data types is solved, and data writing performance and cost-effectiveness are improved.
Patent Information
- Application Number
- CN202210301689.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-25
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2042-03-25
AI Technical Summary
The requirements for service quality of different data types do not match, resulting in a mismatch between the partition namespace and the service quality of written data, which reduces data writing performance.
By receiving a data write request, the target media operation type is determined according to the attributes of the data to be written, and the partition namespace with the corresponding media operation type is found from the partition namespace of the storage device for data writing, ensuring that the partition namespace and The service quality requirements matching the data to be written.
It improves data writing performance, provides better cost-effectiveness, ensures that the partition namespace matches the service quality requirements of the data to be written, and improves the overall performance of the storage device.
Smart Images

Figure CN114625321B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this specification relate to the field of storage technology, and more particularly to a data writing method. One or more embodiments of this specification also relate to a data writing device, a computing device, and a computer-readable storage medium. Background Art
[0002] With the rapid development of computer technology and Internet technology, the demand for data storage has increased dramatically. Storage engines that support ZNS (Zone Namespace) can select separate storage locations according to different data types, so as to classify user data according to data types, thereby reducing write amplification caused by garbage collection and reducing flash memory wear. ZNS provides visibility and flexibility for storage engines. However, different data have different service quality requirements. Storing data in different zone namespaces by type may cause the allocated zone namespace to not match the service quality requirements of the written data, thereby reducing data writing performance. Summary of the invention
[0003] In view of this, an embodiment of the present specification provides a data writing method. One or more embodiments of the present specification also relate to a data writing device, a computing device, and a computer-readable storage medium to solve the technical defects existing in the prior art.
[0004] According to a first aspect of an embodiment of this specification, a data writing method is provided, including:
[0005] receiving a data write request, wherein the data write request carries data to be written and data attributes of the data to be written related to a medium operation type;
[0006] Determine the corresponding target medium operation type according to the data attribute of the data to be written;
[0007] According to the target medium operation type, searching for a corresponding target partition namespace from the partition namespace of the storage device, wherein the partition namespace is provided with a corresponding medium operation type, and different medium operation types correspond to different write working modes;
[0008] According to the write working mode corresponding to the target media operation type, the data to be written is written into the target partition namespace.
[0009] Optionally, the partition description information of the partition namespace includes a media operation type;
[0010] According to the target medium operation type, the corresponding target partition namespace is searched from the partition namespace of the storage device, including:
[0011] The partition description information of the partition namespace is traversed to determine a candidate partition namespace whose media operation type is the target media operation type in the partition namespace, and the candidate partition namespace is used as the target partition namespace.
[0012] Optionally, the data write request also carries the data type of the data to be written;
[0013] The candidate partition namespace is used as the target partition namespace, including:
[0014] When there are at least two candidate partition namespaces, the candidate partition namespace corresponding to the data type in the at least two candidate partition namespaces is used as the target partition namespace.
[0015] Optionally, before traversing the partition description information of the partition namespace, the following is also included:
[0016] Sending a region open command to the partition namespace in the initial state, wherein the region open command is used to instruct the partition namespace in the initial state to switch to the open state, and the region open command carries the first medium operation type;
[0017] A first medium operation type is added to the partition description information of the partition namespace in the open state.
[0018] Optionally, after searching the corresponding target partition namespace from the partition namespace of the storage device according to the target medium operation type, the method further includes:
[0019] Determine the storage capacity of the target partition namespace according to the target medium operation type;
[0020] Determine the current occupied capacity of the target partition namespace, and determine the capacity difference between the current occupied capacity and the storage capacity;
[0021] When the size of the data to be written is smaller than the capacity difference, the operation steps of writing the data to be written into the target partition namespace are executed according to the write operation mode corresponding to the target medium operation type.
[0022] Optionally, after determining the capacity difference between the current occupied capacity and the storage capacity, the method further includes:
[0023] When the capacity difference is less than the capacity threshold, the state of the target partition namespace is changed from open to full.
[0024] In the case that the data written in the target partition namespace is invalid, an erase command is sent to the target partition namespace, wherein the erase command is used to erase the data written in the target partition namespace and convert the target partition namespace to an initial state.
[0025] Optionally, after sending the erase command to the target partition namespace, the following steps are further included:
[0026] A region open command is sent to the target partition namespace in the initial state, wherein the region open command carries an update media operation type, and the update media operation type is different from the target media operation type.
[0027] Optionally, after sending the zone open command to the target partition namespace in the initial state, the method further includes:
[0028] The life cycle of the target partition namespace is determined based on the target media operation type and the update media operation type.
[0029] Optionally, the media operation types include single-layer storage, double-layer storage, triple-layer storage and quad-layer storage, the service quality of single-layer storage is better than double-layer storage, the service quality of double-layer storage is better than triple-layer storage, and the service quality of triple-layer storage is better than quad-layer storage.
[0030] According to a second aspect of an embodiment of this specification, a data writing device is provided, including:
[0031] A receiving module is configured to receive a data writing request, wherein the data writing request carries the data to be written and data attributes of the data to be written related to the medium operation type;
[0032] A determination module, configured to determine a corresponding target medium operation type according to a data attribute of the data to be written;
[0033] A search module is configured to search for a corresponding target partition namespace from a partition namespace of a storage device according to a target medium operation type, wherein the partition namespace is provided with a corresponding medium operation type, and different medium operation types correspond to different write operation modes;
[0034] The write module is configured to write the data to be written into the target partition namespace according to the write working mode corresponding to the target medium operation type.
[0035] According to a third aspect of an embodiment of this specification, a computing device is provided, including:
[0036] Memory and processor;
[0037] The memory is used to store computer executable instructions, and the processor is used to execute the computer executable instructions to implement the following method:
[0038] receiving a data write request, wherein the data write request carries data to be written and data attributes of the data to be written related to a medium operation type;
[0039] Determine the corresponding target medium operation type according to the data attribute of the data to be written;
[0040] According to the target medium operation type, searching for a corresponding target partition namespace from the partition namespace of the storage device, wherein the partition namespace is provided with a corresponding medium operation type, and different medium operation types correspond to different write working modes;
[0041] According to the write working mode corresponding to the target media operation type, the data to be written is written into the target partition namespace.
[0042] According to a fourth aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores computer-executable instructions, and when the instructions are executed by a processor, the steps of any data writing method are implemented.
[0043] An embodiment of the present specification provides a data writing method, receiving a data writing request, wherein the data writing request carries the data to be written and the data attributes of the data to be written related to the media operation type; determining the corresponding target media operation type according to the data attributes of the data to be written; searching the corresponding target partition namespace from the partition namespace of the storage device according to the target media operation type, wherein the partition namespace is provided with a corresponding media operation type, and different media operation types correspond to different writing working modes; writing the data to be written into the target partition namespace according to the writing working mode corresponding to the target media operation type. In this case, the corresponding media operation type can be set for the partition namespace, and different media operation types correspond to different writing working modes. When writing data in different writing working modes, the corresponding service quality is different. The data attributes in the data writing request are related to the media operation type. The media operation type can represent the service quality, that is, the data attributes of the data to be written can represent the demand for the service quality. In this way, the partition namespace can provide different service qualities. When writing data, the partition namespace that can meet the service quality requirements of the data to be written can be selected for data writing. The allocated partition namespace matches the service quality requirements of the data to be written, thereby improving data writing performance and providing better cost-effectiveness for the services of the storage device. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 is a flow chart of a data writing method provided by an embodiment of this specification;
[0045] Figure 2 is a schematic diagram of partition description information provided by an embodiment of this specification;
[0046] Figure 3It is a state machine diagram of a partition namespace provided by an embodiment of this specification;
[0047] Figure 4 It is a structural schematic diagram of a data writing device provided by an embodiment of this specification;
[0048] Figure 5 It is a structural block diagram of a computing device provided by an embodiment of this specification. DETAILED DESCRIPTION
[0049] Many specific details are described in the following description to facilitate a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of this specification, so this specification is not limited to the specific implementation disclosed below.
[0050] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0051] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0052] First, the terms involved in one or more embodiments of this specification are explained.
[0053] SSD (Solid State Disk): A computer storage device that mainly uses NAND Flash as permanent memory. SSDs consist of a control unit and a storage unit (FLASH chip, DRAM chip), and are widely used in industrial control, video monitoring, network monitoring, network terminals, navigation equipment and many other fields. Compared with mechanical hard disks, SSDs have higher read and write speeds, but their costs are also relatively high.
[0054] NVMe: It is a standard interface protocol that removes various restrictions imposed on SSDs by old standards, supports all common operating systems, has good scalability, and has the advantages of low latency, low energy consumption, and high performance.
[0055] Zone Name Space (ZNS): helps place data in certain areas of the storage device based on how often it is used, thereby reducing the rewriting and rearrangement of stored data, resulting in improved overall hard drive performance and lifespan. ZNS can allow for flexible and dynamic SSD configuration, which will enable dynamic capacity management and mixed-mode NAND operation, improving the "granularity of access to the SSD" and overall control over storage.
[0056] Single Level Cell (SLC): The principle is to store 1 bit of data in one memory storage unit (cell). The technical feature of SLC is that the oxide film between the floating gate and the source is thinner. When writing data, voltage is added to the charge of the floating gate, and then the stored charge can be eliminated through the source. In this way, one information unit can be stored. This technology can provide fast programming and reading.
[0057] Double-layer storage (Multi Level Cell, MLC): The principle of MLC is to store two bits of information in a floating gate (the part of the flash memory cell that stores charge), and then use charges of different potentials (Levels) to accurately read and write through the voltage control of the memory storage cell. MLC uses a large number of voltage levels to store two bits of data in each cell, and the data density is relatively high. The MLC architecture can have a better storage density. The common MLC architecture flash memory can store 2 bits per cell, and the capacity is twice that of the same SLC.
[0058] Triple-Level Cell (TLC): TLC is an extension of SLC and MLC technology. TLC means that one memory storage unit (cell) can store 3 bits, which further reduces the cost. TLC flash memory is a relatively cheap specification in flash memory production, and its storage reaches 3 bits. Although the high storage density realizes a relatively cheap large-capacity format, its read and write life cycle is greatly shortened, and the erase and write life cycle is only 500 to 1,000 times, and the read and write speed is poor.
[0059] Quad-Level Cell (QLC): Each QLC memory cell can store 4 bits of data. Compared with TLC, QLC's storage density is increased by 33%. QLC can not only withstand 1,000 programming or erasing cycles, but also has increased capacity and lower costs.
[0060] Quality of Service (QoS): refers to the ability to use various basic technologies to provide better service capabilities. It is a security mechanism that can be used to solve problems such as network delays and congestion. QoS guarantees are very important for storage spaces with limited capacity.
[0061] It should be noted that NAND flash memory is a better storage device than traditional hard disk drives. It uses non-volatile storage technology, that is, a storage device that can still save data after power failure. NAND flash memory is composed of multiple units in bits. These bits are turned on or off by electric charge. How to organize these switch units to store data on the SSD also determines the naming of NAND flash memory. For example, single-layer storage (SLC) flash memory contains 1 bit in each storage unit. Since the SSD circuit board specifications have industry standard sizes, double-layer storage (MLC) can double the capacity, triple-layer storage (TLC) can triple the capacity, and quad-layer storage (QLC) can quadruple the capacity under the same unit physical space. Based on this development, the road has been paved for SSDs to move towards large capacity.
[0062] In addition, hard disks are usually partitioned at the file system level. Due to the existence of the intermediate layer of the FTL flash mapping table, the logical partitions and the actual flash addresses are not fixedly corresponding, and cannot play the role of data classification and storage. Different data will be stored together in a mixed manner. SSDs that support ZNS partition namespaces can choose separate storage locations according to different data types, thereby reducing write amplification caused by garbage collection (reducing wear on flash memory). In addition, a ZNS Zone area can be defined as the size of one or more Block flash blocks (a Block is usually 16MB), and only sequential writing is supported within the Zone area (but random reading is supported), thereby achieving the purpose of reducing write amplification.
[0063] The ZNS standard was released together with NVMe2.0 and has been supported by the Linux kernel, providing visibility and flexibility for the storage engine. The storage engine can manage SSD storage media on a Zone basis. It can place user data in different areas so that user data can be classified according to data type and its attributes. By classifying different types of data into different areas, data with similar retention periods will be placed together, and the storage engine can benefit from write amplification, thereby reducing garbage collection. However, different data has different requirements for quality of service. Classifying data by type and storing it in different partition namespaces may cause the allocated partition namespace to not match the quality of service requirements of the written data, thereby reducing data write performance.
[0064] Therefore, in the embodiments of this specification, for classified data, different data should also have different service quality requirements. In order to provide graded service quality, a method for formatting the partition namespace into a specific media operation type (SLC / MLC / TLC / QLC) is provided so that different partition namespaces can provide different levels of service quality.
[0065] In this specification, a data writing method is provided. This specification also relates to a data writing device, a computing device, and a computer-readable storage medium, which are described in detail one by one in the following embodiments.
[0066] Figure 1 A flow chart of a data writing method provided according to an embodiment of the present specification is shown, including steps 102 to 108 .
[0067] Step 102: Receive a data write request, wherein the data write request carries the data to be written and data attributes of the data to be written related to the medium operation type.
[0068] Specifically, a data write request is a request to write data to a partition namespace of a storage device, and the storage device may be a solid-state drive (such as an SSD, which is a computer storage device that mainly uses NAND flash memory as a permanent memory) that supports a ZNS partition namespace. The media operation type is the type of solid-state drive particle, which is used to indicate the write operation mode of the partition namespace. NAND flash memory media can be accessed (erase / program / read) under different media operation types, and different media operation types can provide different media properties. The media operation types of NAND flash memory media can be divided into four categories according to the storage principle, namely single-layer storage (SLC), dual-layer storage (MLC), triple-layer storage (TLC), and quad-layer storage (QLC).
[0069] In an optional implementation of the present embodiment, the media operation types include single-layer storage, double-layer storage, triple-layer storage and quad-layer storage, the service quality of single-layer storage is better than that of double-layer storage, the service quality of double-layer storage is better than that of triple-layer storage, and the service quality of triple-layer storage is better than that of quad-layer storage.
[0070] Among them, single-layer storage (SLC) stores 1 bit of data in 1 memory storage unit (cell). In this mode, the capacity provided by the NAND medium is small, but the QoS (quality of service) is higher. Its program delay is about 400us, the erase delay is about 1000us, and the read delay is about 40us. This depends largely on the NAND supplier. SLC also has a higher PEC (program / erase cycle, indicating the service life of the medium) (30k to 40k).
[0071] Double-layer storage means storing 2 bits of data in one memory storage unit (cell). In this mode, the capacity of NAND media is twice that of SLC, while the QoS (quality of service) is lower than SLC. Its program delay is around 800us, erase delay is around 2000us, and read delay is around 60us. The PEC of MLC is usually between 7k and 12k.
[0072] Three-tier storage means storing 3 bits of data in one memory storage unit (cell). In this mode, the capacity of the NAND medium is three times that of SLC, and the QoS is lower than that of MLC. Its program delay is around 1200us, the erase delay is around 3000us, and the read delay is around 80us. The PEC of TLC is between 3k and 7k.
[0073] Four-layer storage means storing 4 bits of data in one memory storage unit (cell). In this mode, the capacity of NAND media is four times that of SLC, and the QoS is lower than TLC. Its program delay is around 1500us, erase delay is around 4000us, read delay is around 150us, and the PEC of QLC is between 1,000 and 3,000.
[0074] It should be noted that the data attributes of the data to be written refer to the attributes related to the media operation type, that is, the attributes that can indicate the media operation type required for the data to be written, such as data operation frequency, workload, size, etc. In addition, since the data attributes of the data to be written are related to the media operation type, different media operation types correspond to different service qualities, and thus the data attributes of the data to be written can indicate the service quality requirements of the data to be written.
[0075] In actual applications, the storage device is divided into at least two partition namespaces. In order to indicate the partition namespace to which the data to be written is to be written, data attributes related to the operating medium type of the data to be written can be carried in the data write request. Subsequently, the corresponding target operating medium type can be determined based on the data attributes, and then the corresponding target partition namespace is selected from at least two partition namespaces for data writing, so as to match the allocated partition namespace with the service quality requirements of the data to be written.
[0076] For example, taking the data attributes related to the data to be written and the media operation type as workload, if the data to be written is log records, caches and other data with a short term, then the data attributes related to the data to be written and the media operation type can be hot write data; if the data to be written is read cache, page files, etc., then the data attributes related to the data to be written and the media operation type can be hot read data; if the data to be written is data that is rarely updated, then the data attributes related to the data to be written and the media operation type can be cold write data.
[0077] In an embodiment of the present specification, media operation types may include four categories, namely single-layer storage, double-layer storage, triple-layer storage and quad-layer storage. Different media operation types write data in different write working modes and provide different service qualities. The service quality of single-layer storage is better than double-layer storage, which is better than triple-layer storage, which is better than quad-layer storage. The data write request may carry data attributes related to the data to be written and the media operation type. The data attributes are used to indicate the service quality requirements of the data to be written, thereby facilitating subsequent matching of the corresponding target partition namespace based on the service quality requirements. The target partition namespace can provide corresponding service quality to meet the service quality requirements of the data to be written, thereby achieving matching of the allocated partition namespace with the service quality requirements of the data to be written.
[0078] Step 104: Determine the corresponding target medium operation type according to the data attribute of the data to be written.
[0079] It should be noted that the data attribute is an attribute related to the data to be written and the medium operation type, and thus the corresponding target medium operation type can be determined based on the data attribute.
[0080] In actual applications, the correspondence between data attributes and media operation types can be pre-stored. When a data write request is received, the data write request can be parsed to obtain the data to be written and the data attributes related to the data to be written and the media operation type. According to the data attributes related to the data to be written and the media operation type, the corresponding target media operation type is searched in the correspondence between the pre-stored data attributes and the media operation type.
[0081] As an example, for different workloads, the storage engine can select different media operation types to provide better cost-effectiveness for the service. Hot write data (log records, caches, and other data with short terms) and hot read data (read caches, page files, etc.) can be placed in the partition namespace of the SLC. The SLC can provide higher QoS and better aging. From the perspective of DWPD (data written per day), even if the SLC capacity is lower, the storage engine still has better DWPD compared to MLC / TLC / QLC. For cold write data, since the data is rarely updated, the storage engine can place it in the QLC partition namespace that provides high capacity.
[0082] Assuming that the data attribute related to the data to be written and the media operation type is hot write data, the corresponding target media operation type can be determined as single-tier storage (SLC) based on the preset correspondence; assuming that the data attribute related to the data to be written and the media operation type is thermal data, the corresponding target media operation type can be determined as single-tier storage (SLC) based on the preset correspondence; assuming that the data attribute related to the data to be written and the media operation type is cold write data, the corresponding target media operation type can be determined as quad-tier storage (QLC) based on the preset correspondence.
[0083] In the embodiments of the present specification, the data attributes of the data to be written can indicate the service quality requirements of the data to be written, and different media operation types can provide different service qualities. Therefore, the corresponding target media operation type can be determined according to the data attributes of the data to be written. The target media operation type is a media operation type that can provide the service quality required by the data to be written. Subsequently, the partition namespace of the target media operation type can be selected to perform the data writing operation, so that the allocated partition namespace matches the service quality requirements of the data to be written, thereby improving the data writing performance and providing better cost-effectiveness for the services of the storage device.
[0084] Step 106: According to the target medium operation type, search for the corresponding target partition namespace from the partition namespace of the storage device, wherein the partition namespace is provided with the corresponding medium operation type, and different medium operation types correspond to different write working modes.
[0085] Among them, there can be at least two partition namespaces. The write working mode refers to the mode in which the partition namespace writes data with the corresponding media operation type. The media operation types include single-layer storage, double-layer storage, triple-layer storage and quad-layer storage. The write working mode of single-layer storage is to write 1 bit of data in 1 memory storage unit (cell), the write working mode of double-layer storage is to write 2 bits of data in 1 memory storage unit (cell), the write working mode of triple-layer storage is to write 3 bits of data in 1 memory storage unit (cell), and the write working mode of quad-layer storage is to write 4 bits of data in 1 memory storage unit (cell).
[0086] It should be noted that the storage device can be divided into at least two partition namespaces, each partition namespace is provided with a corresponding media operation type, different media operation types correspond to different write working modes, and when writing data in different write working modes, the corresponding service quality is different. That is, the media operation type can indicate the service quality that can be provided, and the target media operation type is determined based on the service quality requirements of the data to be written. Therefore, according to the target media operation type, the corresponding target partition namespace can be searched from at least two partition namespaces of the storage device, and the media operation type of the target partition namespace found is the target media operation type, which can provide the service quality required by the data to be written, complete the data writing, ensure that the allocated target partition namespace matches the service quality requirements of the data to be written, improve the data writing performance, and thus provide a better cost-effectiveness for the service of the storage device.
[0087] In an optional implementation of this embodiment, a record field of the media operation type may be added to the partition description information of the partition namespace, so that the target partition namespace corresponding to the target media operation type may be found based on the partition description information of the partition namespace, that is, the partition description information of the partition namespace includes the media operation type. At this time, according to the target media operation type, the corresponding target partition namespace is found from the partition namespace of the storage device. The specific implementation process may be as follows:
[0088] The partition description information of the partition namespace is traversed to determine a candidate partition namespace whose media operation type is the target media operation type in the partition namespace, and the candidate partition namespace is used as the target partition namespace.
[0089] It should be noted that the partition description information is used to record the attribute information of the partition namespace. The partition description information can be set with multiple fields, and each field records the corresponding attribute information. For example, the partition description information can include a ZT (ZoneType) field, which can define the access type of the partition namespace. 0x2 means that the partition namespace needs to be written in sequence, also known as append-only.
[0090] In actual applications, in the ZNS standard, each partition namespace is described by partition description information. A record field of the media operation type can be added to the partition description information, and the corresponding media operation type can be recorded through the record field. When determining the target media type, the partition description information of the partition namespace can be traversed to find the candidate partition namespace whose media operation type is the target media operation type, and the media operation type of the selected candidate partition namespace is the target media operation type. That is, the candidate partition namespace can provide the quality of service required for the data to be written.
[0091] For example, Figure 2 is a schematic diagram of partition description information provided by an embodiment of this specification, such as Figure 2 As shown, the partition description information includes an attribute field and a description field. The attribute field is used to record the attribute information of the partition namespace, and the description field is used to describe the corresponding meaning of the attribute field. Figure 2 The attribute fields shown include a ZT (Zone Type) field and a record field of the media operation type. The ZT field can define the access type of the partition namespace. The ZT field is 0x2, which means that the partition namespace needs to be written in sequence. The description field corresponding to the ZT field is: defines the rules for writing and reading the partition namespace; the record field of the media operation type is used to record the corresponding media operation type. The media operation type is SLC, which means writing 1 bit of data in 1 memory storage unit (cell). The description field corresponding to the record field of the media operation type is: defines the writing working mode of the partition namespace.
[0092] In an embodiment of the present specification, each partition namespace is described by partition description information. A record field of the media operation type can be added to the partition description information. The corresponding media operation type can be recorded through the record field. After determining the corresponding target media operation type according to the data attributes of the data to be written, the partition description information of the partition namespace can be traversed to filter out the target partition namespace of the target media operation type. By simply searching the partition description information, the target partition namespace that can provide the service quality required for the data to be written can be filtered out. The search process is simple and convenient, which ensures the efficiency of determining the target partition namespace.
[0093] In an optional implementation of this embodiment, when there are at least two candidate partition namespaces, they can be classified and stored based on data types, that is, the data write request also carries the data type of the data to be written. In this case, the candidate partition namespace is used as the target partition namespace. The specific implementation process can be as follows:
[0094] When there are at least two candidate partition namespaces, the candidate partition namespace corresponding to the data type in the at least two candidate partition namespaces is used as the target partition namespace.
[0095] It should be noted that the storage device is divided into at least two partition namespaces, and the media operation types can be divided into four categories. Therefore, there may be multiple partition namespaces in the at least two partition namespaces corresponding to the same media operation type, that is, by traversing the partition description information of at least two partition namespaces, more than one candidate partition namespace may be determined. Therefore, when there are at least two candidate partition namespaces, further division can be performed based on the data type of the data to be written.
[0096] In the embodiment of the specification, the data write request may also carry the data type of the data to be written. When there are at least two candidate partition namespaces, the candidate partition namespace corresponding to the data type in at least two candidate partition namespaces is used as the target partition namespace. That is, when there are multiple partition namespaces corresponding to the same media operation type, the multiple partition namespaces correspond to different data types, so that the data to be written with the same quality of service requirements can be classified and stored, so that the data with similar retention periods in the data with the same quality of service requirements can be stored together, thereby reducing garbage collection and benefiting from write amplification.
[0097] In an optional implementation of this embodiment, the state machine of the partition namespace may include multiple states. The partition namespace can work normally and write data only when it is in an open state. Therefore, before traversing the partition description information of the partition namespace, the following may also be included:
[0098] Sending a region open command to the partition namespace in the initial state, wherein the region open command is used to instruct the partition namespace in the initial state to switch to the open state, and the region open command carries the first medium operation type;
[0099] A first medium operation type is added to the partition description information of the partition namespace in the open state.
[0100] It should be noted that at least two partition namespaces of the storage device may be in an initial state initially, and then a region open command may be sent to the partition namespace in the initial state, and the region open command may instruct the partition namespace in the initial state to switch to an open state, and the partition namespace in the open state may work normally and write data. In specific implementation, a media operation type field (SLC / MLC / TLC or QLC) may be added to the region open command to indicate the write operation mode of the partition namespace in the open state.
[0101] In the embodiment of the present specification, when a partition namespace receives a region open command, the partition namespace enters an open state. The region open command specifies the media operation type of the partition namespace, and the media operation type can be recorded in the partition description information of the partition namespace to indicate the mode in which the partition namespace will write data. In this way, when the partition namespace is converted to an open state, the media operation type of the partition namespace can be specified, thereby adding information about the media operation type to each partition namespace. When writing data, the corresponding target partition namespace can be selected from each partition namespace based on the service quality requirements of the data to be written, thereby ensuring that the allocated partition namespace matches the service quality requirements of the data to be written.
[0102] Step 108: Write the data to be written into the target partition namespace according to the write operation mode corresponding to the target medium operation type.
[0103] It should be noted that different media operation types correspond to different write working modes. After determining the target media operation type, the data to be written can be written into the target partition namespace according to the write working mode corresponding to the target media operation type.
[0104] For example, the target media operation type is SLC, and the corresponding write operation mode is to write 1 bit of data in 1 memory storage unit (cell). At this time, 1 bit of data can be written in 1 memory storage unit (cell) in the target partition namespace until the data to be written is written into the target partition namespace.
[0105] In an optional implementation of this embodiment, the actual available capacity of the partition namespace is different under different media operation types, so whether the capacity of the target partition namespace is full can be tracked based on the media operation type. That is, after searching the corresponding target partition namespace from the partition namespace of the storage device according to the target media operation type, the following may also be included:
[0106] Determine the storage capacity of the target partition namespace according to the target medium operation type;
[0107] Determine the current occupied capacity of the target partition namespace, and determine the capacity difference between the current occupied capacity and the storage capacity;
[0108] When the size of the data to be written is smaller than the capacity difference, the operation steps of writing the data to be written into the target partition namespace are executed according to the write operation mode corresponding to the target medium operation type.
[0109] It should be noted that the same partition namespace uses only 1 / 3 of the capacity in TLC mode in SLC mode. Therefore, once a partition namespace is set to SLC mode, it means that the partition namespace will lose 2 / 3 of its capacity, so the available capacity of the partition namespace will become smaller, and the storage engine needs to track this capacity change.
[0110] In actual applications, the storage capacity of the target partition namespace can be determined first according to the target media operation type, and then the current occupied capacity of the target partition namespace can be determined, and the capacity difference between the current occupied capacity and the storage capacity can be determined. The capacity difference indicates how much capacity of the target partition namespace currently has remaining for data writing. When the size of the data to be written is smaller than the capacity difference, it means that the current remaining capacity of the target partition namespace can meet the writing of the data to be written. At this time, the write working mode corresponding to the target media operation type can be executed to write the data to be written into the target partition namespace. When the size of the data to be written exceeds the capacity difference, it means that the current remaining capacity of the target partition namespace does not meet the writing of the data to be written, that is, writing the data to be written will cause the total amount of data to be greater than the available capacity, and thus data writing cannot be performed.
[0111] In the embodiments of the present specification, different media operation types correspond to different capacities, which means that the available capacity of the partition namespace may change after the partition namespace is opened with different media operation types. Therefore, the storage engine needs to continuously track the changes in the available capacity of the partition namespace under different media operation types to ensure that the total amount of data in the partition namespace will not be greater than the available capacity, thereby ensuring that the total amount of data in the storage device will not be greater than the capacity of the storage device.
[0112] In an optional implementation of this embodiment, after a partition namespace is full, the written data can be erased, that is, after determining the capacity difference between the current occupied capacity and the storage capacity, the following may also be included:
[0113] When the capacity difference is less than the capacity threshold, the state of the target partition namespace is changed from open to full.
[0114] In the case that the data written in the target partition namespace is invalid, an erase command is sent to the target partition namespace, wherein the erase command is used to erase the data written in the target partition namespace and convert the target partition namespace to an initial state.
[0115] It should be noted that when the capacity difference is less than the capacity threshold, it means that the capacity of the target partition namespace is full and no more data can be written. Therefore, the storage engine can convert the state of the target partition namespace from open to full and no longer write data to the target partition namespace. Afterwards, when the data on the target partition namespace is invalid, the data written in the target partition namespace can be erased through the erase command to return to the initial state.
[0116] For example, Figure 3 is a state machine diagram of a partition namespace provided by an embodiment of this specification, such as Figure 3 As shown, the partition namespace is initially in the initial state (empty). When a partition namespace receives a zone open command, it enters the open state (open). At this time, it determines under which media operation type (SLC / MLC / TLC / QLC) the partition namespace will be written. When a partition namespace is full, it enters the full storage state (Full). When the data on the partition namespace is invalid, you can use the erase command to erase the data and return to the initial state (empty). If a media error occurs during the above operation process, the partition namespace will be converted to a read-only state (read only). If the data on the partition namespace is invalid, the partition namespace will enter the offline state (offline).
[0117] In the embodiment of this specification, when the capacity difference is less than the capacity threshold, it means that the capacity of the target partition namespace is full and no other data can be written. At this time, the state of the target partition namespace can be converted from an open state to a full storage state, and no data is written to it, which ensures that the total amount of data in the partition namespace will not be greater than the available capacity and the success rate of data writing is guaranteed. In addition, when the data written in the target partition namespace is invalid, the data written in the target partition namespace can be erased, and the target partition namespace can be converted to the initial state for the next opening and the next round of data writing, thereby improving the reuse rate of the partition namespace.
[0118] In an optional implementation of this embodiment, after erasing the data written in the target partition namespace, the target partition namespace may be opened again, that is, after sending an erase command to the target partition namespace, the following may also be included:
[0119] A region open command is sent to the target partition namespace in the initial state, wherein the region open command carries an update media operation type, and the update media operation type is different from the target media operation type.
[0120] It should be noted that after erasing the data written in the target partition namespace, the capacity of the target partition namespace is available. At this time, the area open command can be sent to the target partition namespace in the initial state again to convert the target partition namespace from the initial state to the open state and rewrite data.
[0121] In actual applications, the area opening command carries an update media operation type, and the update media operation type is different from the target media operation type. That is to say, each time a partition namespace is reopened, the media operation type of the partition namespace can be changed. The media operation type can be sent to the storage device through the area opening command, and the partition description information in the storage device records the media operation type.
[0122] In the embodiments of the present specification, each time a partition namespace is reopened, the media operation type of the partition namespace can be changed, thereby improving the flexibility of setting the media operation type of the partition namespace.
[0123] In an optional implementation of this embodiment, after sending the zone opening command to the target partition namespace in the initial state, the following may also be included:
[0124] The life cycle of the target partition namespace is determined based on the target media operation type and the update media operation type.
[0125] It should be noted that the life cycle can refer to the medium service life of the partition namespace in the storage device, that is, PEC. PEC is different under different media operation types. For example, PEC is higher in SLC mode and lower in TLC mode. When a partition namespace works alternately in SLC and TLC modes, it is necessary to comprehensively consider the average value of the impact of erase operations under different media operation types on the life of the NAND block.
[0126] In the embodiments of the present specification, the life cycle of the target partition namespace can be determined in combination with the target media operation type and the update media operation type, that is, the media service life is comprehensively determined based on the various media operation types of the partition namespace, thereby improving the accuracy of determining the media service life.
[0127] An embodiment of the present specification provides a data writing method, which can set a corresponding media operation type for a partition namespace. Different media operation types correspond to different writing working modes. When writing data in different writing working modes, the corresponding service quality is different. The data attribute in the data writing request is related to the media operation type. The media operation type can represent the service quality, that is, the data attribute of the data to be written can represent the demand for service quality. In this way, the partition namespace can provide different service qualities. When writing data, according to the service quality requirement of the data to be written, a partition namespace that can meet the service quality requirement can be selected for data writing. The allocated partition namespace matches the service quality requirement of the data to be written, which improves the data writing performance, thereby providing a better cost-effectiveness for the service of the storage device.
[0128] Corresponding to the above method embodiment, this specification also provides a data writing device embodiment, Figure 4 FIG. 1 shows a schematic diagram of a data writing device provided by an embodiment of the present specification. Figure 4 As shown, the device comprises:
[0129] The receiving module 402 is configured to receive a data writing request, wherein the data writing request carries the data to be written and data attributes of the data to be written related to the medium operation type;
[0130] The determination module 404 is configured to determine a corresponding target medium operation type according to a data attribute of the data to be written;
[0131] The search module 406 is configured to search for a corresponding target partition namespace from the partition namespace of the storage device according to the target medium operation type, wherein the partition namespace is provided with a corresponding medium operation type, and different medium operation types correspond to different write operation modes;
[0132] The writing module 408 is configured to write the data to be written into the target partition namespace according to the writing working mode corresponding to the target medium operation type.
[0133] Optionally, the partition description information of the partition namespace includes the media operation type; the search module 406 is further configured to:
[0134] The partition description information of the partition namespace is traversed to determine a candidate partition namespace whose media operation type is the target media operation type in the partition namespace, and the candidate partition namespace is used as the target partition namespace.
[0135] Optionally, the data write request also carries the data type of the data to be written; the search module 406 is further configured to:
[0136] When there are at least two candidate partition namespaces, the candidate partition namespace corresponding to the data type in the at least two candidate partition namespaces is used as the target partition namespace.
[0137] Optionally, the device further comprises an adding module configured to:
[0138] Sending a region open command to the partition namespace in the initial state, wherein the region open command is used to instruct the partition namespace in the initial state to switch to the open state, and the region open command carries the first medium operation type;
[0139] A first medium operation type is added to the partition description information of the partition namespace in the open state.
[0140] Optionally, the device further includes an execution module configured to:
[0141] Determine the storage capacity of the target partition namespace according to the target medium operation type;
[0142] Determine the current occupied capacity of the target partition namespace, and determine the capacity difference between the current occupied capacity and the storage capacity;
[0143] When the size of the data to be written is smaller than the capacity difference, the writing module 408 is executed.
[0144] Optionally, the execution module is further configured to:
[0145] When the capacity difference is less than the capacity threshold, the state of the target partition namespace is changed from open to full.
[0146] In the case that the data written in the target partition namespace is invalid, an erase command is sent to the target partition namespace, wherein the erase command is used to erase the data written in the target partition namespace and convert the target partition namespace to an initial state.
[0147] Optionally, the execution module is further configured to:
[0148] A region open command is sent to the target partition namespace in the initial state, wherein the region open command carries an update media operation type, and the update media operation type is different from the target media operation type.
[0149] Optionally, the execution module is further configured to:
[0150] The life cycle of the target partition namespace is determined based on the target media operation type and the update media operation type.
[0151] Optionally, the media operation types include single-layer storage, double-layer storage, triple-layer storage and quad-layer storage, the service quality of single-layer storage is better than double-layer storage, the service quality of double-layer storage is better than triple-layer storage, and the service quality of triple-layer storage is better than quad-layer storage.
[0152] An embodiment of the present specification provides a data writing device, which can set a corresponding media operation type for a partition namespace. Different media operation types correspond to different writing working modes. When writing data in different writing working modes, the corresponding service quality is different. The data attribute in the data writing request is related to the media operation type. The media operation type can represent the service quality, that is, the data attribute of the data to be written can represent the demand for service quality. In this way, the partition namespace can provide different service qualities. When writing data, according to the service quality requirement of the data to be written, a partition namespace that can meet the service quality requirement can be selected for data writing. The allocated partition namespace matches the service quality requirement of the data to be written, which improves the data writing performance, thereby providing a better cost-effectiveness for the service of the storage device.
[0153] The above is a schematic scheme of a data writing device of this embodiment. It should be noted that the technical scheme of the data writing device and the technical scheme of the above data writing method belong to the same concept, and the details of the technical scheme of the data writing device that are not described in detail can all be referred to the description of the technical scheme of the above data writing method.
[0154] Figure 5 The block diagram of a computing device according to an embodiment of the present specification is shown. The components of the computing device 500 include but are not limited to a memory 510 and a processor 520. The processor 520 is connected to the memory 510 via a bus 530, and the database 550 is used to store data.
[0155] The computing device 500 also includes an access device 540 that enables the computing device 500 to communicate via one or more networks 560. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 540 may include one or more of any type of network interface (e.g., a network interface card (NIC)) whether wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a World Wide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.
[0156] In one embodiment of the present specification, the above components of the computing device 500 and Figure 5 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 5 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0157] The computing device 500 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or PC. The computing device 500 may also be a mobile or stationary server.
[0158] The processor 520 is used to execute the following computer executable instructions to implement the following method:
[0159] receiving a data write request, wherein the data write request carries data to be written and data attributes of the data to be written related to a medium operation type;
[0160] Determine the corresponding target medium operation type according to the data attribute of the data to be written;
[0161] According to the target medium operation type, searching for a corresponding target partition namespace from the partition namespace of the storage device, wherein the partition namespace is provided with a corresponding medium operation type, and different medium operation types correspond to different write working modes;
[0162] According to the write working mode corresponding to the target media operation type, the data to be written is written into the target partition namespace.
[0163] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the above data writing method belong to the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the technical scheme of the above data writing method.
[0164] An embodiment of the present specification also provides a computer-readable storage medium storing computer instructions, which implement the steps of the data writing method when executed by a processor.
[0165] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the above data writing method belong to the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the technical scheme of the above data writing method.
[0166] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0167] Computer instructions include computer program codes, which may be in source code form, object code form, executable files, or some intermediate form, etc. Computer readable media may include: any entity or device capable of carrying computer program codes, recording media, USB flash drives, mobile hard disks, magnetic disks, optical disks, computer memories, read-only memories (ROM), random access memories (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc.
[0168] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of this specification are not limited by the order of the actions described, because according to the embodiments of this specification, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of this specification.
[0169] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0170] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not describe all the details in detail, nor do they limit the invention to only the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of this specification, so that technicians in the relevant technical field can well understand and use this specification. This specification is only limited by the claims and their full scope and equivalents.
Claims
1. A data writing method, comprising: receiving a data write request, wherein the data write request carries data to be written, a data type of the data to be written, and data attributes of the data to be written related to a medium operation type; Determining a corresponding target medium operation type according to data attributes of the data to be written; According to the target medium operation type, searching for a corresponding target partition namespace from the partition namespace of the storage device, wherein the partition namespace is provided with a corresponding medium operation type, and different medium operation types correspond to different write working modes, searching for a corresponding target partition namespace from the partition namespace of the storage device according to the target medium operation type comprises: traversing the partition description information of the partition namespace, determining a candidate partition namespace in the partition namespace whose medium operation type is the target medium operation type, and in the case where there are at least two candidate partition namespaces, using a candidate partition namespace corresponding to the data type in the at least two candidate partition namespaces as the target partition namespace; the partition description information of the partition namespace includes the medium operation type; According to the write operation mode corresponding to the target medium operation type, the data to be written is written into the target partition namespace.
2. The data writing method according to claim 1, before traversing the partition description information of the partition namespace, further comprising: Sending a region open command to the partition namespace in the initial state, wherein the region open command is used to instruct the partition namespace in the initial state to switch to an open state, and the region open command carries a first medium operation type; The first medium operation type is added to the partition description information of the partition namespace in the open state.
3. The data writing method according to any one of claims 1 to 2, after searching the corresponding target partition namespace from the partition namespace of the storage device according to the target medium operation type, further comprising: Determining the storage capacity of the target partition namespace according to the target medium operation type; Determine a current occupied capacity of the target partition namespace, and determine a capacity difference between the current occupied capacity and the storage capacity; In the case where the size of the data to be written is smaller than the capacity difference, the operation step of writing the data to be written into the target partition namespace in the write operation mode corresponding to the target medium operation type is executed.
4. The data writing method according to claim 3, after determining the capacity difference between the current occupied capacity and the storage capacity, further comprising: When the capacity difference is less than the capacity threshold, converting the state of the target partition namespace from an open state to a full state; In a case where the data written in the target partition namespace is invalid, an erase command is sent to the target partition namespace, wherein the erase command is used to erase the data written in the target partition namespace and convert the target partition namespace into an initial state.
5. The data writing method according to claim 4, after sending the erase command to the target partition namespace, further comprising: An area open command is sent to a target partition namespace in an initial state, wherein the area open command carries an update media operation type, and the update media operation type is different from the target media operation type.
6. The data writing method according to claim 5, after sending the area opening command to the target partition namespace in the initial state, further comprising: The life cycle of the target partition namespace is determined in combination with the target media operation type and the update media operation type.
7. According to the data writing method according to any one of claims 1-2, the media operation types include single-layer storage, double-layer storage, triple-layer storage and quad-layer storage, the service quality of the single-layer storage is better than that of the double-layer storage, the service quality of the double-layer storage is better than that of the triple-layer storage, and the service quality of the triple-layer storage is better than that of the quad-layer storage.
8. A data writing device, comprising: A receiving module, configured to receive a data writing request, wherein the data writing request carries the data to be written, the data type of the data to be written, and data attributes of the data to be written related to the medium operation type; A determination module, configured to determine a corresponding target medium operation type according to a data attribute of the data to be written; A search module is configured to search for a corresponding target partition namespace from a partition namespace of a storage device according to the target medium operation type, wherein the partition namespace is provided with a corresponding medium operation type, and different medium operation types correspond to different write operation modes, and the search module is further configured to: traverse the partition description information of the partition namespace, determine a candidate partition namespace in the partition namespace whose medium operation type is the target medium operation type, and when there are at least two candidate partition namespaces, use a candidate partition namespace corresponding to the data type in the at least two candidate partition namespaces as the target partition namespace; the partition description information of the partition namespace includes the medium operation type; The writing module is configured to write the data to be written into the target partition namespace according to the writing working mode corresponding to the target medium operation type.
9. A computing device comprising: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the following method: receiving a data write request, wherein the data write request carries data to be written, a data type of the data to be written, and data attributes of the data to be written related to a medium operation type; Determining a corresponding target medium operation type according to data attributes of the data to be written; According to the target medium operation type, searching for a corresponding target partition namespace from the partition namespace of the storage device, wherein the partition namespace is provided with a corresponding medium operation type, and different medium operation types correspond to different write working modes, searching for a corresponding target partition namespace from the partition namespace of the storage device according to the target medium operation type comprises: traversing the partition description information of the partition namespace, determining a candidate partition namespace in the partition namespace whose medium operation type is the target medium operation type, and in the case where there are at least two candidate partition namespaces, using a candidate partition namespace corresponding to the data type in the at least two candidate partition namespaces as the target partition namespace; the partition description information of the partition namespace includes the medium operation type; According to the write operation mode corresponding to the target medium operation type, the data to be written is written into the target partition namespace.
10. A computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions, when executed by a processor, implement the steps of the data writing method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Memory system
CN113138713A
Flash memory, storage medium conversion method and computing device
CN113821158A