Data storage device and method of storing data
By identifying and moving data in the storage device and transferring it from one erase unit to another erase unit with the same life cycle, the problem of recycling time extension and write amplification caused by mixed data storage in the storage device is solved, and the further development is achieved. Efficient data storage and management.
Patent Information
- Application Number
- CN202411457405.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-17
- Publication Date
- 2025-02-11
AI Technical Summary
In the storage device, the mixed storage of different data will cause the recycling time of the rewritten unit to increase the migration of garbage collected data, and lead to write amplification.
By identifying that the data stored in the first erase unit will be moved, the second erase unit is identified as the destination of the first data, and the first data is moved from the first erase unit to the second erase unit, Ensure that the data life cycle stored in the second erase unit is the same as the data life cycle in the first erase unit.
Reduces the recycling time of the rewritten unit, reduces the data migration of garbage collection, and reduces write amplification.
Smart Images

Figure CN119415030A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of storage, and more particularly, to a data storage device and a method for storing data. Background Art
[0002] Recently, storage devices (such as solid state drives (SSD), non-volatile memory express (NVMe), embedded multi-media cards (eMMC), universal flash memory (UFS), etc.) have been widely used. During the use of storage devices, different data are usually mixed and stored in the erase unit, which will lead to a longer recovery time of the erase unit, aggravate the data migration of garbage collection (GC), and cause the write amplification to increase. Summary of the invention
[0003] An object of the present disclosure is to provide a data storage device and a method for storing data.
[0004] According to one aspect of the present disclosure, a method for storing data includes: based on identifying that first data stored in a first erase unit is to be moved, identifying a second erase unit as a destination of the first data; and moving the first data from the first erase unit to the second erase unit, wherein a life cycle of the second data stored in the second erase unit is the same as a life cycle of the first data stored in the first erase unit.
[0005] Optionally, the method also includes: storing the first data in a first erase unit, wherein the step of storing the first data in the first erase unit includes: allocating an initial erase unit to the first data; setting a switch flag of the initial erase unit to a first value or a second value different from the first value, wherein the first value indicates that the storage space of the initial erase unit is sufficient to accommodate the first data, and the second value indicates that the storage space of the initial erase unit is insufficient to accommodate the first data; based on the switch flag having a first value, storing the first data in the initial erase unit and identifying the initial erase unit as a first erase unit; and based on the switch flag having a second value, storing the first data in a replacement erase unit and identifying the replacement erase unit as a first erase unit, wherein the replacement erase unit is different from the initial erase unit and the replacement erase unit includes storage space sufficient to accommodate the first data.
[0006] Optionally, the step of storing the first data in the replacement erasing unit includes: switching the state of the initial erasing unit from an open state to a closed state; switching the state of the replacement erasing unit from an empty state or a closed state to an open state; and storing the first data in the replacement erasing unit.
[0007] Optionally, the method also includes: monitoring valid data of the erasure unit in the closed state; and based on identifying that there is no valid data in the erasure unit in the closed state, recovering the data in the erasure unit in the closed state and switching the state of the erasure unit in the closed state to an empty state.
[0008] Optionally, the method further includes: giving priority to recycling erasing units in a closed state.
[0009] Optionally, both the initial erasure unit and the replacement erasure unit store data having the same life cycle as that of the first data.
[0010] Optionally, the first data includes a log-structured merge tree file, and wherein the life cycle of the log-structured merge tree file is determined based on one or more of a heat classification, a level-based feature, and a file type of the log-structured merge tree file.
[0011] Optionally, the file types of the log-structured merge tree file include a sorted string table file, a write-ahead log file, and other files, and the sorted string table file, the write-ahead log file, and other files are stored in different erase units, and wherein the life cycle of the sorted string table file is determined as one of multiple life cycles based on at least one of a heat classification and a level-based feature of the log-structured merge tree file.
[0012] Optionally, the first erase unit and the second erase unit correspond to a recovery unit in a flexible data placement solid state drive, and wherein the method further comprises: performing a write operation of the recovery unit using a recovery unit handle corresponding to the recovery unit, and wherein the recovery unit handle is set to a persistent isolation type.
[0013] According to one aspect of the present disclosure, a data storage device includes: a storage device, including a first erase unit and a second erase unit, the first erase unit and the second erase unit are configured to store data; at least one processor, and at least one memory, storing one or more instructions, wherein the one or more instructions, when executed by the at least one processor, are configured to cause the data storage device to: based on identifying that first data stored in the first erase unit is to be moved, identify the second erase unit as a destination of the first data; and move the first data from the first erase unit to the second erase unit, and wherein the life cycle of the second data stored in the second erase unit is the same as the life cycle of the first data stored in the first erase unit.
[0014] Optionally, the one or more instructions, when executed by the at least one processor, are also configured to cause the data storage device to: assign an initial erase unit to the first data; set a switch flag of the initial erase unit to a first value or a second value different from the first value, wherein the first value indicates that the storage space of the initial erase unit is sufficient to accommodate the first data, and the second value indicates that the storage space of the initial erase unit is insufficient to accommodate the first data; based on the switch flag having the first value, store the first data in the initial erase unit and identify the initial erase unit as the first erase unit; and based on the switch flag having the second value, store the first data in a replacement erase unit and identify the replacement erase unit as the first erase unit, wherein the replacement erase unit is different from the initial erase unit and the replacement erase unit includes storage space sufficient to accommodate the first data.
[0015] Optionally, the one or more instructions, when executed by the at least one processor, are configured to cause the data storage device to: switch the state of the initial erase unit from an on state to a off state; switch the state of the replacement erase unit from an empty state or a off state to an on state; and store the first data in the replacement erase unit.
[0016] Optionally, the one or more instructions, when executed by the at least one processor, are also configured to cause the data storage device to: monitor valid data in the erase unit in a closed state; and based on identifying that there is no valid data in the erase unit in a closed state, recycle the data in the erase unit in a closed state, and switch the state of the erase unit in a closed state to an empty state.
[0017] Optionally, when the one or more instructions are executed by the at least one processor, they are further configured to cause the data storage device to prioritize the erasing and writing units in a closed state as objects for recycling.
[0018] Optionally, both the initial erasure unit and the replacement erasure unit store data having the same life cycle as that of the first data.
[0019] Optionally, the first data includes a log-structured merge tree file, and wherein the life cycle of the log-structured merge tree file is determined based on one or more of a heat classification, a level-based feature, and a file type of the log-structured merge tree file.
[0020] Optionally, the file types of the log-structured merge tree file include a sorted string table file, a write-ahead log file, and other files, and the sorted string table file, the write-ahead log file, and other files are stored in different erase units, and wherein the life cycle of the sorted string table file is determined as one of multiple life cycles based on at least one of a heat classification and a level-based feature of the log-structured merge tree file.
[0021] Optionally, the first erase unit and the second erase unit correspond to recovery units in a flexible data placement solid state drive, and the one or more instructions, when executed by the at least one processor, are also configured to cause the data storage device to: perform a write operation of the recovery unit using a recovery unit handle corresponding to the recovery unit, wherein the recovery unit handle is set to a persistent isolation type.
[0022] According to one aspect of the present disclosure, a non-temporary computer-readable medium having instructions stored therein is provided, wherein the instructions, when executed by at least one processor, cause the at least one processor to perform a method for storing data, the method comprising: based on identifying that first data stored in a first erase unit is to be moved, identifying a second erase unit as a destination for the first data; and moving the first data from the first erase unit to the second erase unit, wherein a life cycle of the second data stored in the second erase unit is the same as a life cycle of the first data stored in the first erase unit.
[0023] Optionally, the method also includes: storing the first data in a first erase unit, wherein the step of storing the first data in the first erase unit includes: allocating an initial erase unit to the first data; setting a switch flag of the initial erase unit to a first value or a second value different from the first value, wherein the first value indicates that the storage space of the initial erase unit is sufficient to accommodate the first data, and the second value indicates that the storage space of the initial erase unit is insufficient to accommodate the first data; based on the switch flag having a first value, storing the first data in the initial erase unit and identifying the initial erase unit as a first erase unit; and based on the switch flag having a second value, storing the first data in a replacement erase unit and identifying the replacement erase unit as a first erase unit, wherein the replacement erase unit is different from the initial erase unit and the replacement erase unit includes storage space sufficient to accommodate the first data. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The above and other objects and features of specific embodiments of the present disclosure will become more apparent from the following description in conjunction with the accompanying drawings.
[0025] Figure 1 is a block diagram illustrating a data storage device according to one or more embodiments of the present disclosure.
[0026] Figure 2 is a flowchart illustrating a data storage method executed by a processor according to one or more embodiments of the present disclosure.
[0027] Figure 3 A flow chart illustrating a method of storing first data in an erasing unit according to one or more embodiments of the present disclosure.
[0028] Figure 4 A flow chart showing a data storage method executed by a processor according to one or more embodiments of the present disclosure.
[0029] Figure 5 A schematic block diagram of a data storage system according to one or more embodiments of the present disclosure is shown.
[0030] Figure 6 A schematic block diagram of a recovery unit handle (RUH) dispenser is shown in accordance with one or more embodiments of the present disclosure.
[0031] Figure 7 A flow chart illustrating the operation of a RUH dispenser according to one or more embodiments of the present disclosure.
[0032] Figure 8 A schematic diagram showing a RUH dispenser and controller according to one or more embodiments of the present disclosure.
[0033] Fig. 9 A flow chart illustrating the operation of an RU switch and a controller according to one or more embodiments of the present disclosure.
[0034] Fig.10 A schematic diagram illustrating an RU monitor and controller according to one or more embodiments of the present disclosure.
[0035] Fig.11 A flow chart illustrating the operation of an RU monitor and controller according to one or more embodiments of the present disclosure.
[0036] Fig.12 A schematic diagram showing a data storage method according to one or more embodiments of the present disclosure. DETAILED DESCRIPTION
[0037] The following specific embodiments are provided to help the reader obtain a comprehensive understanding of the method, device and / or system described herein. However, after understanding the disclosure of the application, various changes, modifications and equivalents of the method, device and / or system described herein will be clear. For example, the order of operations described herein is only an example, and is not limited to those orders set forth herein, but can be changed as it will be clear after understanding the disclosure of the application, except for the operations that must occur in a specific order. In addition, for increased clarity and conciseness, the description of features known after understanding the disclosure of the application can be omitted.
[0038] The features described herein can be implemented in different forms and should not be construed as being limited to the examples described herein. Rather, the examples described herein have been provided to illustrate only some of the many possible ways to implement the methods, devices, and / or systems described herein that will be clear after understanding the disclosure of the present application.
[0039] Throughout the specification, when a component is described as being "connected to" or "coupled to" another component, the component may be directly "connected to" or "coupled to" the other component, or there may be one or more other components between them. Conversely, when an element is described as being "directly connected to" or "directly coupled to" another element, there may be no other elements between them. Similarly, similar expressions (e.g., "between" versus "immediately between" and "adjacent to" versus "immediately adjacent to") should also be interpreted in the same manner. As used herein, the term "and / or" includes any one of the relevant listed items or any combination of any two or more of the relevant listed items.
[0040] Although terms such as "first", "second" and "third" may be used to describe various components, components, regions, layers or parts herein, these components, components, regions, layers or parts are not limited by these terms. Instead, these terms are only used to distinguish one component, component, region, layer or part from another component, component, region, layer or part. Therefore, without departing from the teachings of the examples described herein, the first component, first component, first region, first layer or first part referred to in the examples may also be referred to as the second component, second component, second region, second layer or second part.
[0041] The terms used herein are only used to describe various examples and will not be used to limit the disclosure. Unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. The terms "comprise", "include" and "have" indicate the presence of the stated features, quantities, operations, components, elements and / or combinations thereof, but do not exclude the presence or addition of one or more other features, quantities, operations, components, elements and / or combinations thereof.
[0042] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as those generally understood by those skilled in the art based on the understanding of the disclosure of the present application and the present disclosure. Unless explicitly defined as such herein, terms (such as those defined in general dictionaries) should be interpreted as having a meaning consistent with their meaning in the context of the relevant field and the disclosure of the present application, and should not be interpreted in an idealized or overly formal way. The use of the term "may" with respect to an example or embodiment herein (e.g., with respect to what an example or embodiment may include or implement) indicates that there is at least one example or embodiment that includes or implements such a feature, and all examples are not limited thereto.
[0043] As used herein, terms such as "unit", "module", "member" and "block" may be embodied in hardware or software. As used herein, multiple "units", "modules", "members" and "blocks" may be implemented as a single component, or a single "unit", "module", "member", "block" may include multiple components.
[0044] As used herein, “at least one of a, b, or c” and “at least one of a, b, and c” means “only a,” “only b,” “only c,” “both a and b,” “both a and c,” “both b and c,” and “all a, b, and c.”
[0045] Hereinafter, examples will be described in detail with reference to the accompanying drawings.
[0046] Figure 1 is a block diagram illustrating a data storage device according to one or more embodiments.
[0047] Reference Figure 1 , the data storage apparatus 100 may include a storage device 110 and a processor 120. The data storage apparatus 100 may be connected to an external memory and / or communicate with an external device. Figure 1 The data storage device 100 shown may include components associated with the current example. Therefore, it will be clear to those skilled in the art that the data storage device 100 may also include components other than Figure 1 Other common components besides those shown in .
[0048] Here, the data storage device 100 may be any storage device that can perform data storage. As an example only, the data storage device 100 may include a solid state drive (SSD).
[0049] In addition, the data storage device 100 may be implemented in various types of devices such as a personal computer (PC), a server device, a mobile device, an embedded device, etc. In detail, the data storage device 100 may be included in a smart phone, a tablet device, an augmented reality (AR) device, an Internet of Things (IoT) device, an autonomous driving vehicle, a robotic device, or a medical device that can store data, but is not limited thereto.
[0050] The storage device 110 may include a plurality of erase units for storing data. For example, the plurality of erase units may be used to store various data processed in the data storage device 100. As an example only, the storage device 110 may be a zone SSD (Zone SSD), a multi-stream SSD (Multi-stream SSD), a flexible data placement (FDP) SSD, etc.
[0051] The processor 120 may control the overall functions of the data storage device 100. For example, the processor 120 may generally control the data storage device 100 by executing a program stored in the storage device 110. The processor 120 may be implemented as a central processing unit (CPU), a graphics processing unit (GPU), or an application processor (AP) included in the data storage device 100, but the present disclosure is not limited thereto. The processor 120 may be implemented as one or more processors.
[0052] Here, the processor 120 may control the operation of storing data of the data storage device 100. For example, when the instructions are executed in the processor, the processor 120 may be configured to: in response to first data stored in a first erasing unit being to be moved, determine the destination to which the first data is to be moved as a second erasing unit, wherein the life cycle of the second data stored in the second erasing unit is the same as the life cycle of the first data stored in the first erasing unit; and move the first data from the first erasing unit to the second erasing unit.
[0053] That is, the data storage device 100 can move or store data considering the life cycle of the data, so that the data stored in the same erase unit has the same or similar life cycle, thereby reducing the recycling time of the erase unit, reducing data migration of garbage collection, and reducing write amplification.
[0054] In the following, reference will be made to Figures 2 to 5 An example of a data storage method performed by the processor 120 is described.
[0055] Figure 2 is a flowchart illustrating a method of storing data executed by a processor according to one or more embodiments of the present disclosure.
[0056] Reference Figure 2In operation S210, the processor may identify the second erasing unit as a destination to which the first data is to be moved based on identifying that the first data stored in the first erasing unit is to be moved. In one embodiment, the life cycle of the second data stored in the second erasing unit is the same as the life cycle of the first data stored in the first erasing unit.
[0057] The life cycle of the second data being the same as the life cycle of the first data may indicate that the life cycle of the second data and the life cycle of the first data have the same or similar life cycle range or value.
[0058] The data (e.g., the first data and the second data) may be any type of data. In a non-limiting example, the data may include a log structure merge tree (LSM-Tree) file. LSM-Tree is a level-based data structure and is widely used in many key-value (KV) stores including RocksDB, LevelDB, and Cassandra. LSM-Tree uses an append-only write structure to eliminate random write operations to the storage device, which makes the write efficiency super high.
[0059] In an example embodiment, the first data may include a log-structured merge tree file, and the life cycle of the log-structured merge tree file is determined based on one or more of a heat classification, a level-based feature, and a file type of the log-structured merge tree file. The life cycle of the first data may be determined based on one or more of a heat classification, a level-based feature, and a file type of the log-structured merge tree file via any method (e.g., a simulation method, a modeling method, etc.).
[0060] In one embodiment, the file types of the log structure merge tree file may include a sorted string table (SST) file, a write-ahead log (WAL) file, and other files. In one or more embodiments, the sorted string table file, the write-ahead log file, and the other files may be stored in different erase units. Generally, there is a large difference between the life cycle of the sorted string table file, the life cycle of the write-ahead log file, and the life cycle of the other files. Therefore, by storing the sorted string table file, the write-ahead log file, and the other files in different erase units, it is possible to ensure that the same file type is stored in each corresponding erase unit, making it easier to ensure that the life cycle of the data in the same erase unit is the same, thereby shortening the recovery cycle of the erase unit, and thus reducing the relocation of garbage collection.
[0061] In addition, the life cycle of the sorted string table file is determined as one of multiple life cycles based on at least one of the heat classification and level-based features of the log structure merge tree file. For example, LSM-Tree provides heat classification and level-based features for SST files. At least one of the heat classification and level-based features can be used to determine the life cycle of the SST file. In one example, the life cycle of the SST file can be divided into hint values: WLTH_SHORT, WLTH_MEDIUM, and WLTH_LONG based on the heat classification and level-based features of the log structure merge tree file. WLTH_SHORT can indicate a relatively short life cycle, WLTH_MEDIUM can indicate a relatively medium life cycle, and WLTH_LONG can indicate a relatively long life cycle. That is, data (e.g., the life cycle of data) can be distinguished by file type (e.g., suffix) and hint value. However, the above examples are only exemplary, and the life cycle of the SST file can be divided into two or four or more hint values based on at least one of the heat classification and level-based features of the log structure merge tree file. Because the existing LSM-Tree concept can be utilized.
[0062] In addition, the erase unit (e.g., the first erase unit and the second erase unit) may be any type of erase unit. In a non-limiting example, the first erase unit and the second erase unit may correspond to a reclaim unit (RU) in a flexible data placement (FDP) solid state drive (SSD), and the write operation of the reclaim unit is performed by a reclaim unit handle (RUH) corresponding to the reclaim unit, and the reclaim unit handle is set to a persistent isolation type. Figure 5 The FDP SSD is described in more detail.
[0063] In operation S220, the processor may move the first data from the first erasure unit to the second erasure unit.
[0064] That is, in response to recognizing that the first data stored in the first erase unit is to be moved, the processor may move the first data from the first erase unit to the second erase unit, wherein the second erase unit stores data having the same life cycle as the first data. Therefore, it can be ensured that data having a given life cycle can only be mixed with data having the same life cycle no matter how it is moved, thereby ensuring that the data in a given erase unit has the same life cycle, thereby reducing the recycling time of the erase unit, reducing the data migration of garbage collection, and reducing write amplification.
[0065] Figure 3A flow chart illustrating a method of storing first data in an erasing unit according to one or more embodiments of the present disclosure.
[0066] Reference Figure 3 In operation S310, the processor may allocate an initial erasing unit to the first data. The processor may allocate the initial erasing unit to the first data in any predetermined allocation strategy.
[0067] In operation S320, the processor may set the switch flag of the initial erase unit to a first value or a second value different from the first value. The first value may indicate that the storage space of the initial erase unit is sufficient to accommodate the first data, and the second value may indicate that the storage space of the initial erase unit is insufficient to accommodate the first data.
[0068] That is, the processor may determine whether the storage space of the initial erasing unit allocated to the first data is sufficient to accommodate the first data. When the storage space of the initial erasing unit is sufficient to accommodate the first data, the processor may set the switch flag of the initial erasing unit to a first value. When the storage space of the initial erasing unit is insufficient to accommodate the first data, the processor may set the switch flag of the initial erasing unit to a second value. The storage space of the initial erasing unit may indicate the actual remaining storage space of the initial erasing unit.
[0069] In operation S330, in response to a switch flag of the initial erasing unit having a first value, first data is stored in the initial erasing unit as a first erasing unit.
[0070] In operation S340, in response to the switch flag of the initial erasing unit having a second value, data is stored in a replacement erasing unit different from the initial erasing unit as the first erasing unit. The storage space of the replacement erasing unit is sufficient to accommodate the first data.
[0071] In an example embodiment, the processor may switch the state of the erase unit having the second value from the open state to the closed state, and switch the state of the replacement erase unit from the empty state or the closed state to the open state. Thereafter, the processor may store the first data in the replacement erase unit.
[0072] In addition, in one or more embodiments, the initial erase unit may be configured to store data having a life cycle that is the same as the life cycle of the first data, and the replacement erase unit may be configured to store data having a life cycle that is the same as the life cycle of the first data. Since the initial erase unit and / or the replacement erase unit are configured to store data having a life cycle that is the same as the life cycle of the first data, it is ensured that the data within a given erase unit has the same life cycle.
[0073] According to one or more embodiments, when the storage space of an initial erase unit allocated to first data is insufficient to accommodate the first data, another erase unit (e.g., a replacement erase unit) with storage space sufficient to accommodate the first data is reallocated to the first data so that the first data is not stored across different erase units, thereby solving the problem of extending the recovery period of data stored across different erase units.
[0074] Figure 4 A flowchart showing a method of storing data executed by a processor according to one or more embodiments of the present disclosure is shown.
[0075] In operation S410, the processor may monitor valid data of an erasing unit in a closed state.
[0076] The processor can monitor the valid data of the erase unit in the closed state in various ways. In a non-limiting example, the processor can add the erase unit in the closed state to the monitoring linked list to maintain the list of erase units in the closed state and maintain the valid data bitmap of the erase unit.
[0077] In operation S420, in response to the absence of valid data in the erasing unit in the off state, the processor may recycle data in the erasing unit in the off state and switch the state of the erasing unit in the off state to an empty state.
[0078] Usually, even if there is no more valid data in the erase unit in the closed state, the device will not actively recycle it because there is still space left in the erase unit in the closed state. In contrast, according to one or more embodiments of the present disclosure, by monitoring the valid data of the erase unit in the closed state, the processor can actively recycle the erase unit without valid data in the closed state, thereby better ensuring space utilization.
[0079] In addition, in one or more embodiments, the processor may also set the erase unit in the closed state as a priority recycling object to further ensure space utilization. For example, the processor may set the garbage collection strategy to set the erase unit in the closed state as a priority recycling object.
[0080] Figure 5 A schematic block diagram of a system for storing data according to one or more embodiments of the present disclosure is shown.
[0081] Reference Figure 5, a system storing data may include a data storage device (e.g., an FDP SSD). FDP SSD is a new SSD product for solving the write amplification problem. The erase unit becomes a recycling unit. Users can only perform write operations through the recycling unit handle. Its write properties include: ① The host determines the RUH where the data will go (selects the placement ID (PID)); and ② The controller places the data on the corresponding RU according to the RUH mapped by the PID selected by the user. In addition, there are two types of isolation for RU, initial isolation and permanent isolation. For initial isolation, user data (e.g., GC data) is moved to other RUs that can contain other data of the same type of RUH. For permanent isolation, user data (e.g., GC data) is moved to different RUs that contain other data of the same RUH.
[0082] In addition, the LSM-Tree application can be run on the data storage system. The data storage system can also include multiple modules implemented by the processor. In one or more embodiments, the multiple modules can include a RUH distributor, a RU switcher, and a RU monitor.
[0083] The RUH allocator can filter files (e.g., file data of LSM-Tree applications) by type and / or life cycle. For example, the RUH allocator can classify files by type into sorted string table (SST) files, write-ahead log (WAL) files, and other files. For another example, the RUH allocator can classify files by life cycle. In one example, the RUH allocator can divide the life cycle of a file or data into files with different hint (Hint) values: WLTH_SHORT, WLTH_MEDIUM, and WLTH_LONG. WLTH_SHORT can indicate a relatively short life cycle, WLTH_MEDIUM can indicate a medium life cycle, and WLTH_LONG can indicate a relatively long life cycle.
[0084] In addition, the RUH allocator may allocate reclaim units for storing files of the LSM-Tree application by allocating placement IDs (PIDs) of the reclaim units for storing files of the LSM-Tree application.
[0085] In addition, the RUH allocator can assign a switch flag (SFlag) to the recycling unit used to store the files of the LSM-Tree application. Figure 6 and Figure 7 The RUH distributor is described in more detail.
[0086] The RU switcher can determine whether to trigger RU switching and RU state transition (e.g., RU state transition from on to off) by using the SFlag of the allocated recycling unit. The RU switcher can send a notification switch to the controller based on the SFlag of the allocated recycling unit. The controller can control the write operation based on the notification switch. Figure 8 and Fig. 9 The RU switch and controller are described in more detail.
[0087] The RU monitor can monitor the RU in the shutdown state so as to timely recover the data in the RU in the shutdown state. The RU monitor can send a reset notification to the controller based on the monitoring result. The controller can control the reset operation of the RU based on the reset notification. Fig.10 and Fig.11 The RU monitor and controller are described in more detail.
[0088] Figure 6 A schematic block diagram of a RUH distributor according to one or more embodiments of the present disclosure is shown.
[0089] Figure 7 A flow chart illustrating the operation of a RUH dispenser according to one or more embodiments of the present disclosure.
[0090] Reference Figure 6 , the RUH allocator may include a file type filter and an SST hint filter.
[0091] Reference Figure 7 , the RUH allocator may obtain a file (eg, an LST-Tree file) in operation S710.
[0092] The RUH allocator (eg, a file type filter) may determine the type of the LST-Tree file. For example, the file type filter may classify the file into a sorted string table (SST) file, a write-ahead log (WAL) file, and other files by type.
[0093] The RUH allocator may determine whether the LST-Tree file is an SST file in operation S720.
[0094] In response to determining that the LST-Tree file is an SST file in operation S720, the RUH allocator (e.g., SST hint filter) may determine the lifecycle of the SST file. For example, in operation S731, the RUH allocator may divide the lifecycle of the SST file into having a hint value of "short", where "short" may indicate a relatively short lifecycle. In operation S732, the RUH allocator may divide the lifecycle of the SST file into having a hint value of "medium", where "medium" may indicate a medium lifecycle. In operation S733, the RUH allocator may divide the lifecycle of the SST file into having a hint value of "long", where "long" may indicate a relatively long lifecycle.
[0095] In operation S740, the RUH allocator may allocate a placement ID (PID) and set the RUH to the persistent isolation type. For example, the RUH allocator may set RUH0 - RUH4 to the persistent isolation type. By setting the RUH to the persistent isolation type, it can be ensured that the file data of the current lifecycle can only be mixed with the file data having the same hint value regardless of how it moves. Therefore, it can be ensured that the data within one RUH has the same hint value, thereby shortening the RUH recycling period and reducing GC relocations.
[0096] The RUH allocator may record the data size written to each RUH. In operation S750, the RUH allocator may determine whether the used RUH space is sufficient to accommodate the current SST file. For example, the RUH allocator may calculate the remaining space of the RUH pointed to by the current RUH through the formula "SFlag = (ruh_$(type)_size % ru_size < sst_size? 1 : 0)" to determine whether the used RUH space is sufficient to accommodate the current SST file, where ru_size represents the size of the RUH, ruh_$(type)_size represents the used size of the RUH, ruh_$(type)_size % ru_size represents the unused size of the RUH, and sst_size represents the size of the SST file. This can ensure that the same SST file is not stored across RUs, solving the problem of the extended RUH recycling period for cross-RU file storage.
[0097] When the unused size of the RUH is less than the size of the SST file, SFlag may be set to 0 in operation S760. When the unused size of the RUH is greater than or equal to the size of the SST file, SFlag may be set to 1.
[0098] The RUH allocator can bind the PID (e.g., PID0 to PID4) to the life cycle of the file (e.g., the prompt value). By binding, files with different prompt values can be written using different RUHs. In addition, the value of SFlag is calculated by the formula and sent to the device end at the same time as the PID.
[0099] In response to determining in operation S710 that the LST-Tree file is not an SST file, the RUH allocator may determine in operation S770 whether the LST-Tree file is a WAL file.
[0100] According to the determination result in operation S770, the RUH allocator may allocate a placement ID (PID) and set the RUH to a persistent isolation type in operation S780. In operation S790, the RUH allocator may set SFlag to 0.
[0101] Figure 8 A schematic diagram showing a RUH dispenser and controller according to one or more embodiments of the present disclosure. Fig. 9 A flow chart illustrating the operation of an RU switch and a controller according to one or more embodiments of the present disclosure.
[0102] RU switch can be used as an additional component of FTL on the device side. Figure 8 , the RU switch may include event triggering functions (e.g., SFlag judgment) and state switching of RU switching.
[0103] Reference Fig. 9 In operation S910, the RU switch may determine whether the value of SFlag is 1. In other words, the value of SFlag may be set as an event trigger function or trigger condition for RU switching. The state of RU switching may include one or more of an open state, an empty state, and a closed state.
[0104] In operation S920, when the value of Sflag is 1, the RU switcher may send a switching event to the controller. The controller of the FDP may modify the RUH to reference a different RU. For example, the controller may be implemented by a processor. In response to the switching event, the controller switches the RUH corresponding to the current PID to point to an RU in an empty state. The RU in the empty state may come from an empty RU pool.
[0105] In operation S930, the RU switch may convert the state of the new RU from an empty state to an on state.
[0106] In operation S940, the controller may start writing. For example, when Sflag is 0, the controller finds the RUH according to the assigned PID and writes data directly to the RU.
[0107] Furthermore, in operation S950, the RU switch may convert the state of the old RU from the on state to the off state, and then add the RU in the off state to the monitoring link list of the RU monitor.
[0108] Fig.10 A schematic diagram illustrating an RU monitor and controller according to one or more embodiments of the present disclosure. Fig.11 A flow chart illustrating the operation of an RU monitor and controller according to one or more embodiments of the present disclosure.
[0109] Even if there is no more valid data in the RU in the closed state, the device will not actively recycle the RU in the closed state, because the RU in the closed state may still have space left. In order to ensure space utilization, the RU monitor according to one or more embodiments actively recycles the RU without valid data in the closed state. At the same time, the garbage collection strategy takes the RU in the closed state as the object of priority recycling.
[0110] In one example, the RU monitor may include all RUs in the closed state in the monitoring. For example, the RU monitor may maintain a list of RUs in the closed state and maintain a RU valid data bitmap. In addition, the RU monitor may actively send a reset event. For example, when there is no valid data in the closed state, the controller is triggered to reset the RU. After recycling, the RU state becomes an empty state and is no longer monitored.
[0111] Reference Fig.10 and Fig.11 In operation S1110, the RU monitor may set a RU valid data bitmap. In one example, the RU bitmap may be set after deleting the SST file in the RU.
[0112] In operation S1120, the RU monitor may determine whether all data on the RU is invalid. For example, the RU monitor may determine whether all data on the RU is invalid based on the RU valid data bitmap.
[0113] When it is determined in operation S1120 that not all data on the RU are invalid, it may return to operation S1110.
[0114] When it is determined in operation S1120 that all data on the RU are invalid, the RU monitor may send a reset event to the controller in operation S1130.
[0115] In operation S1140, the controller may reset the RU in response to the reset event.
[0116] In operation S1150, the RU switch may convert the state of the reset RU from the off state to the empty state.
[0117] Fig.12A schematic diagram showing a method of storing data according to one or more embodiments of the present disclosure.
[0118] Reference Fig.12 In operation ①, SST files are stored according to their different life cycles. For example, SST file SST04 with a short life cycle can be stored in the first RU, SST files SST11 and SST12 with a medium life cycle can be stored in the second RU, and SST files SST21, SST files SST22, and SST files SST23 with a long life cycle can be stored in the third RU.
[0119] In operation ②, the SST file is stored in the same RU. In other words, a single SST file is not stored across RUs. Therefore, LSM-Tree files with different life cycles are not mixed on the RU, and the same file is not stored on multiple RUs, thus reducing the recycling time of the recycling unit.
[0120] In operation ③, the RU will be switched for insufficient space. For example, SST file SST21, SST file SST22, and SST file SST23 may have been stored in the fourth RU pointed to by RUH2. When the fourth RU is allocated for storing SST file SST04, since the remaining storage space of the fourth RU pointed to by RUH2 is insufficient to store SST file SST04, RUH2 is modified to reference the first RU to store SST file SST04.
[0121] In operation ④, the closed RU will be recycled early. Since RUH2 that references the fourth RU is modified to reference the first RU in operation ③, the fourth RU can be switched from the open state to the closed state. The RU in the closed state will be recycled early, so the RU recycling time is reduced, the GC data movement is reduced, and the write amplification is reduced. For example, the RU resources are recycled in advance to reduce the probability of triggering GC. In addition, the RU in the closed state improves the GC recycling process.
[0122] In operation ⑤, files with different life cycles are not mixed after GC migration. For example, a valid SST file SST with a long life cycle can be mixed with SST files SST21, SST files SST22, and SST files SST23 with a long life cycle.
[0123] The method for storing data according to one or more embodiments of the present disclosure can ensure that data in the current life cycle can only be mixed with data in the same life cycle no matter how it is moved, thereby ensuring that data in the same erase unit has the same life cycle, thereby reducing the recycling time of the erase unit, reducing data migration for garbage collection, and reducing write amplification.
[0124] According to the method for storing data of one or more embodiments of the present disclosure, by storing the sorted string table file, the pre-written log file and the remaining files in different erase units, it can be ensured that the file type in the same erase unit is single, and it is easier to achieve the same life cycle of the data in the same erase unit, thereby shortening the recycling cycle of the erase unit and reducing the relocation of garbage collection.
[0125] According to the method for storing data in one or more embodiments of the present disclosure, when the storage space of the erase unit allocated to the first data is insufficient to accommodate the first data, another erase unit with storage space sufficient to accommodate the first data is reallocated to the first data, so that the first data will not be stored across the erase units, thereby solving the problem of extending the recovery period of the data stored across the erase units.
[0126] According to the method for storing data of one or more embodiments of the present disclosure, by monitoring the valid data of the erasing unit in the closed state, the erasing unit without valid data in the closed state can be actively recovered, thereby better ensuring space utilization.
[0127] According to the method for storing data in one or more embodiments of the present disclosure, the erasing unit in the closed state may be set as a priority recycling object to further ensure space utilization.
[0128] According to the method for storing data in one or more embodiments of the present disclosure, by setting RUH to a persistent isolation type, it can be ensured that file data in the current life cycle can only be mixed with file data with the same hint value no matter how it is moved. Therefore, it can be ensured that data within an RU has the same hint value, thereby shortening the RU recycling cycle and reducing GC relocation.
[0129] According to one or more example embodiments, the processor described above may be implemented using hardware, a combination of hardware and software, or a non-transitory storage medium storing executable software for performing its functions.
[0130] The hardware may be implemented using processing circuitry such as, but not limited to, one or more processors, one or more central processing units (CPUs), one or more controllers, one or more arithmetic logic units (ALUs), one or more digital signal processors (DSPs), one or more microcomputers, one or more field programmable gate arrays (FPGAs), one or more systems on a chip (SoCs), one or more programmable logic units (PLUs), one or more microprocessors, one or more application specific integrated circuits (ASICs), or any other device capable of responding to and executing instructions in a defined manner.
[0131] Software may include computer programs, program codes, instructions, or some combination thereof that are used to independently or collectively instruct or configure hardware devices to operate as desired. Computer programs and / or program codes may include programs or computer-readable instructions, software components, software modules, data files, data structures, etc. that can be implemented by one or more hardware devices (such as, one or more of the hardware devices mentioned above). Examples of program code include both machine code generated by a compiler and high-level program code executed using an interpreter.
[0132] For example, when the hardware device is a computer processing device (e.g., one or more processors, CPUs, controllers, ALUs, DSPs, microcomputers, microprocessors, etc.), the computer processing device may be configured to execute a program code that performs arithmetic, logic, and input / output operations according to the program code. Once the program code is loaded into the computer processing device, the computer processing device may be programmed to execute the program code, thereby converting the computer processing device into a special-purpose computer processing device. In a more specific example, when the program code is loaded into the processor, the processor becomes programmed to execute the program code and operations corresponding thereto, thereby converting the processor into a special-purpose processor. In another example, the hardware device may be an integrated circuit (e.g., ASIC) customized as a special-purpose processing circuit.
[0133] A hardware device (such as a computer processing device) can run an operating system (OS) and one or more software applications running on the OS. In response to the execution of the software, the computer processing device can also access, store, manipulate, process and create data. For the sake of simplicity, one or more example embodiments may be exemplified as a computer processing device, however, those skilled in the art will understand that the hardware device may include multiple processing elements and multiple types of processing elements. For example, the hardware device may include multiple processors or a processor and a controller. In addition, other processing configurations are feasible, such as parallel processors.
[0134] The software and / or data may be implemented permanently or temporarily in any type of storage medium (storage medium includes, but is not limited to, any machine, component, physical or virtual device or computer storage medium or device capable of providing instructions or data to a hardware device, or capable of providing instructions or data to be interpreted by a hardware device). The software may also be distributed on networked computer systems so that the software is stored and executed in a distributed manner. Specifically, for example, the software and data may be stored by one or more computer-readable recording media including tangible or non-transitory computer-readable storage media as discussed herein.
[0135] For example, according to one or more example embodiments of the present disclosure, a computer-readable storage medium storing a computer program is provided, wherein when the computer program is executed by a processor, at least the following method of storing data is implemented: based on identifying that the first data stored in the first erasing unit is to be moved, the second erasing unit is identified as the destination of the first data; and the first data is moved from the first erasing unit to the second erasing unit, wherein the life cycle of the second data stored in the second erasing unit is the same as the life cycle of the first data stored in the first erasing unit. In addition, other methods of the present disclosure can also be similarly implemented by a computer-readable storage medium storing a computer program.
[0136] The storage medium may also include: one or more storage devices in the unit and / or device according to one or more example embodiments. One or more storage devices may be tangible or non-temporary computer-readable storage media (such as random access memory (RAM), read-only memory (ROM), permanent mass storage device (such as disk drive) and / or any other similar data storage structure capable of storing and recording data). One or more storage devices may be configured to store computer programs, program codes, instructions, or some combinations thereof for one or more operating systems and / or for implementing the example embodiments described herein. A drive mechanism may also be used to load a computer program, program code, instruction, or some combination thereof from a separate computer-readable storage medium to one or more storage devices and / or one or more computer processing devices. Such a separate computer-readable storage medium may include a universal serial bus (USB) flash drive, a memory stick, a Blu-ray / DVD / CD-ROM drive, a memory card, and / or other similar computer-readable storage media. A computer program, program code, instruction, or some combination thereof may be loaded from a remote data storage device to one or more storage devices and / or one or more computer processing devices via a network interface rather than via a computer-readable storage medium. In addition, the computer program, program code, instructions, or some combination thereof may be loaded from a remote computing system over a network into one or more storage devices and / or one or more processors, wherein the remote computing system is configured to transmit and / or distribute the computer program, program code, instructions, or some combination thereof over a network. The remote computing system may transmit and / or distribute the computer program, program code, instructions, or some combination thereof via a wired interface, an air interface, and / or any other similar medium.
[0137] One or more hardware devices, storage media, computer programs, program codes, instructions, or some combination thereof may be specially designed and constructed for the purposes of the example embodiments, or they may be known devices altered and / or modified for the purposes of the example embodiments.
[0138] The foregoing is one or more descriptions of example embodiments and should not be construed as limiting the disclosure as a whole. Although some example embodiments have been described, it will be readily appreciated by those skilled in the art that many modifications may be made in the example embodiments without substantially departing from the novel teachings and advantages of the example embodiments conceived by the present disclosure. Therefore, all such modifications are intended to be included within the scope of the example embodiments conceived by the present disclosure as defined in the claims. Therefore, it will be understood that the foregoing description is an illustration of various example embodiments and should not be construed as being limited to the specific example embodiments disclosed, and modifications to the disclosed example embodiments as well as other example embodiments are intended to be included within the scope of the appended claims.
Claims
1. A method for storing data, the method comprising: identifying the second erase unit as a destination of the first data based on identifying that the first data stored in the first erase unit is to be moved; and Moving the first data from the first erasing unit to the second erasing unit, The life cycle of the second data stored in the second erasing unit is the same as the life cycle of the first data stored in the first erasing unit.
2. The method of claim 1, further comprising: The first data is stored in the first erasable unit, wherein the step of storing the first data in the first erasable unit comprises: Allocating an initial erasing unit to the first data; Setting the switch flag of the initial erasing unit to a first value or a second value different from the first value, wherein the first value indicates that the storage space of the initial erasing unit is sufficient to accommodate the first data, and the second value indicates that the storage space of the initial erasing unit is insufficient to accommodate the first data; Based on the switch flag having the first value, storing the first data in the initial erasure unit and identifying the initial erasure unit as a first erasure unit; and Based on the switch flag having a second value, the first data is stored in the replacement erase unit and the replacement erase unit is identified as a first erase unit, wherein the replacement erase unit is different from the initial erase unit and includes storage space sufficient to accommodate the first data.
3. The method of claim 2, wherein: The step of storing the first data in the replacement erasing unit comprises: Switching the state of the initial erase unit from an on state to a off state; Switching the state of the replacement erase unit from an empty state or a closed state to an open state; and The first data is stored in the replacement erasing unit.
4. The method of claim 3, further comprising: Monitor the valid data of the erase unit in the closed state; and Based on the recognition that there is no valid data in the erasing unit in the closed state, the data in the erasing unit in the closed state is recovered, and the state of the erasing unit in the closed state is switched to an empty state.
5. The method of claim 3, further comprising: The erasable and programmable units in the closed state are prioritized for recycling.
6. The method of claim 2, wherein: Both the initial erasure unit and the replacement erasure unit store data having the same life cycle as that of the first data.
7. The method according to claim 1, in, The first data includes a log-structured merge tree file, and The life cycle of the log-structured merge tree file is determined based on one or more of a heat classification, a level-based feature, and a file type of the log-structured merge tree file.
8. The method according to claim 7, in, The file type of the log structure merge tree file includes a sorted string table file, a write-ahead log file, and other files, and the sorted string table file, the write-ahead log file, and other files are stored in different erase units, and The life cycle of the sorted string table file is determined as one of the multiple life cycles based on at least one of the heat classification and the level-based features of the log structure merge tree file.
9. The method according to claim 1, in, The first erase unit and the second erase unit correspond to a recovery unit in the flexible data placement solid state drive, and The method further comprises: using a recycling unit handle corresponding to the recycling unit to perform a write operation on the recycling unit, and Among them, the recovery unit handle is set to persistent isolation type.
10. A data storage device, comprising: A storage device, comprising a first erasing unit and a second erasing unit, wherein the first erasing unit and the second erasing unit are configured to store data; at least one processor, and at least one memory storing one or more instructions, Wherein, the one or more instructions, when executed by the at least one processor, are configured to cause the data storage device to: Based on identifying that the first data stored in the first erasure unit is to be moved, identifying the second erasure unit as a destination of the first data; and The first data is moved from the first erasing unit to the second erasing unit, and The life cycle of the second data stored in the second erasing unit is the same as the life cycle of the first data stored in the first erasing unit.
11. A non-transitory computer readable medium having instructions stored therein, the instructions, when executed by at least one processor, causing the at least one processor to perform a method of storing data, the method comprising: identifying the second erase unit as a destination of the first data based on identifying that the first data stored in the first erase unit is to be moved; and Moving the first data from the first erasing unit to the second erasing unit, The life cycle of the second data stored in the second erasing unit is the same as the life cycle of the first data stored in the first erasing unit.