A programming method, apparatus, computer device, and storage medium
By introducing four active target physical block types into the storage device and dynamically matching programming methods based on data characteristics, the problem of mismatch between data characteristics and physical block performance in traditional storage devices is solved, thereby improving the overall performance of the storage device and the flexibility of data storage.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN UNIV
- Filing Date
- 2025-06-13
- Publication Date
- 2026-04-14
AI Technical Summary
Traditional storage devices employ fixed-direction programming methods, which result in inflexible matching of data characteristics with the performance of the target physical block, leading to performance degradation.
Four active target physical block types are introduced. The active target physical block type is determined based on data characteristics. The matching physical block is selected for data writing and programmed. The physical block type is re-evaluated and adjusted during data reading to ensure matching.
It improves the overall performance of storage devices by dynamically adapting data characteristics and physical block performance, thereby enhancing the flexibility and efficiency of data storage.
Smart Images

Figure CN120949992B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of storage device technology, and more specifically to a programming method, apparatus, computer equipment, and storage medium. Background Technology
[0002] With the rapid development of big data, cloud computing, and the Internet of Things, the demand for data storage from enterprises and individuals is constantly increasing. Thanks to advancements in storage media technology, storage devices can store more data per medium. The emergence of these high-density storage media has significantly increased the storage density of storage devices, enabling them to provide greater storage capacity at a lower cost to meet the ever-growing storage demands. However, this increased storage density not only leads to increased read / write latency but also introduces coupling interference problems during access operations, resulting in reduced data reliability.
[0003] Traditional storage devices employ a fixed-direction programming method. However, this unidirectional programming sequence makes the matching of data characteristics with the performance of the target physical block inflexible, potentially leading to errors and performance degradation. In summary, the emergence of high-density storage media has brought new opportunities to the storage market, but it also comes with some technical challenges and limitations. Summary of the Invention
[0004] In view of this, the present invention provides a programming method, apparatus, computer device and storage medium to solve the problem that traditional storage devices based on fixed-direction programming methods suffer from inflexible matching of data characteristics with the performance of target physical blocks.
[0005] In a first aspect, the present invention provides a programming method, the method comprising:
[0006] When the storage device is used for the first time, the active target physical block corresponding to the programming type is determined. The storage device includes four types of active target physical blocks. For a storage medium that can store n bits of data, the first type is an active target physical block programmed from the 1st data position to the n / 2nd data position, the second type is an active target physical block programmed from the n / 2+1th data position to the nth data position, the third type is an active target physical block programmed from the nth data position to the n / 2+1th data position, and the fourth type is an active target physical block programmed from the n / 2th data position to the 1st data position.
[0007] When writing data to a storage device, the corresponding active target physical block category is determined based on the data characteristics, and the corresponding target physical block is identified and data programming is performed.
[0008] When reading data from a storage device, the data characteristics are re-evaluated and the target physical block category is determined. If the newly determined target physical block category does not match the current target physical block category, a data migration operation is performed.
[0009] This invention introduces a new programming method into storage devices, classifying them into four active target physical block types. The active target physical block type is determined based on data characteristics. For data writing, the active target physical block type that matches the data characteristics is selected and programmed to ensure that the data characteristics and target physical block performance match. For data reading, the target physical block type is redefined to ensure that the data characteristics and target physical block performance always match, thereby improving the overall performance of the storage device.
[0010] In one optional implementation, determining the active target physical block corresponding to the programming type includes:
[0011] For new storage devices, all physical blocks are blank physical blocks. By default, the first physical block is regarded as the first type of active target physical block, and the second physical block is regarded as the third type of active target physical block.
[0012] When the storage medium needs to be programmed from the n / 2+1th data position to the nth data position, it is necessary to first program the 1st data position to the n / 2nd data position. Then, after the programming operation is performed on the first type of active target physical block, the physical block becomes the first type and the second type of active target physical block.
[0013] When the storage medium needs to be programmed from the n / 2th data position to the 1st data position, it is necessary to first program the nth data position to the n / 2+1th data position. Then, after the third type of active target physical block is programmed, the physical block becomes a third and fourth type of active target physical block.
[0014] This invention simplifies the initialization process by setting the active target physical block type corresponding to the physical block by default, and adjusts the type of the active target physical block according to the programming direction and data location, thereby improving the efficiency of programming operations.
[0015] In one alternative implementation, the method further includes:
[0016] When the storage location corresponding to the first type of active target physical block or the third type of active target physical block is exhausted, a new free physical block is allocated as the new active target physical block.
[0017] When the storage location corresponding to the second type of active target physical block is exhausted, the programmed first type of active target physical block is allocated as the new second type of active target physical block.
[0018] When the storage location corresponding to the fourth type of active target physical block is exhausted, the programmed third type of active target physical block is allocated as the new fourth type of active target physical block.
[0019] This invention ensures sufficient space for data processing by allocating new free physical blocks when the first or third type of active target physical blocks are exhausted, and by reusing other programmed physical blocks when the second or fourth type of active target physical blocks are exhausted, thus making efficient use of storage space.
[0020] In an alternative implementation, after determining the active target physical block corresponding to the programming type, the method further includes:
[0021] Determine if the read popularity score of the data to be programmed is higher than 4;
[0022] Determine if the write popularity score of the data to be programmed is higher than 4;
[0023] The popularity score is calculated using the following formula:
[0024]
[0025] Calculate the popularity score using the following formula:
[0026]
[0027] Among them, H i Freq is the heat score for data block i. i T represents the historical access frequency of data block i. now T is the current timestamp. i,last R is the time when data block i was last accessed. i R is the number of reads for data block i. i Used to measure read activity, W i W represents the number of writes to data block i. i Used to measure write activity, A i A is the reciprocal of the average access interval of data block i. The more concentrated the access, the higher A becomes. i The larger the value, the more weighting coefficients α, β, and γ are adjusted according to the actual system requirements.
[0028] This invention distinguishes between hot and cold data by calculating the read / write heat score of the data block to be programmed, so as to allocate resources to cold and hot data respectively according to the judgment result.
[0029] In one alternative implementation, the method further includes:
[0030] When the read popularity score of the data to be programmed is higher than four and the write popularity score is not higher than four, it is stored in the fourth type of active target physical block;
[0031] When both the read popularity score and write popularity score of the data to be programmed are higher than four, it is stored in the first type of active target physical block;
[0032] When the write popularity score of the data to be programmed is higher than four and the read popularity score is not higher than four, it is stored in the third type of active target physical block;
[0033] When the read / write heat score of the data to be programmed is not higher than four, it is stored in the second type of active target physical block.
[0034] This invention allocates matching active target physical blocks based on the read / write popularity score of the data to be programmed, thereby dynamically adapting to data characteristics and maximizing resource utilization.
[0035] In one optional implementation, when reading data from the storage device, the data characteristics are re-evaluated and the target physical block category is determined. If the newly determined target physical block category does not match the current target physical block category, a data relocation operation is performed, including:
[0036] When reading data from a storage device, the characteristics of the data being read are re-evaluated, and a new category of active physical target blocks is determined.
[0037] If the new physical block category does not match the current physical block category, the data will be moved to the new active target physical block to make its data characteristics and location performance match.
[0038] This invention re-evaluates the characteristics of the read data and redetermines the active physical target block category to ensure dynamic adaptation between data characteristics and active target physical block category. When the physical block category does not match, the data is moved to ensure that the data characteristics and the performance of the location are consistent.
[0039] In a second aspect, the present invention provides a programming apparatus, the apparatus comprising:
[0040] The active target physical block determination module is used to determine the active target physical block corresponding to the programming type when the storage device is used for the first time. The storage device includes four types of active target physical blocks. For a storage medium that can store n bits of data, the first type is an active target physical block programmed from the 1st data position to the n / 2nd data position, the second type is an active target physical block programmed from the n / 2+1th data position to the nth data position, the third type is an active target physical block programmed from the nth data position to the n / 2+1th data position, and the fourth type is an active target physical block programmed from the n / 2th data position to the 1st data position.
[0041] The data programming module determines the corresponding active target physical block category based on the data characteristics when writing data to the storage device, identifies the corresponding target physical block, and performs data programming.
[0042] The data migration module is used to re-evaluate data characteristics and determine the target physical block category when reading data from the storage device. If the newly determined target physical block category does not match the current target physical block category, a data migration operation is performed.
[0043] Thirdly, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the computer instructions to perform the programming method of the first aspect or any corresponding embodiment described above.
[0044] Fourthly, the present invention provides a computer-readable storage medium storing computer instructions for causing a computer to perform the programming method of the first aspect or any corresponding embodiment thereof.
[0045] Fifthly, the present invention provides a computer program product, including computer instructions for causing a computer to execute the programming method described in the first aspect or any corresponding embodiment thereof. Attached Figure Description
[0046] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0047] Figure 1 This is a flowchart illustrating a programming method according to an embodiment of the present invention;
[0048] Figure 2 This is a schematic diagram of four data feature types and their corresponding target physical block locations according to embodiments of the present invention;
[0049] Figure 3 This is a structural block diagram of a programming apparatus according to an embodiment of the present invention;
[0050] Figure 4 This is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. Detailed Implementation
[0051] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0052] Traditional storage devices employ a single, fixed programming method, containing only two types of target physical blocks: active target physical blocks and blank target physical blocks. Active target physical blocks are those currently being programmed, while blank target physical blocks are those not yet used for data storage. When data is written to the storage device, it can only be stored in active target physical blocks. The programming order of active target physical blocks is sequential and alternating: first, bits 1 to m of storage medium t are programmed; then bits 1 to m of storage medium t+1 are programmed; then bits m+1 to n of storage medium a are programmed, and so on, thus reducing programming interference between adjacent storage media. When an active target physical block is filled with data, a new physical block is selected from the blank physical blocks as the new active target physical block.
[0053] However, since the advantages of the first and last few positions in the storage medium are different, the traditional sequential programming method for storage devices will likely result in a mismatch between data characteristics and the advantages of the storage location, leading to inflexible data storage.
[0054] This invention provides a programming method that introduces a new programming approach. Based on the programming direction and location, the active target physical blocks of the storage device are divided into four types. The target physical block type is determined according to data characteristics, thereby increasing the flexibility of data storage and improving the overall performance of the storage device.
[0055] According to an embodiment of the present invention, a programming method embodiment is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0056] This embodiment provides a programming method. Figure 1 This is a flowchart of a programming method according to an embodiment of the present invention, such as... Figure 1 As shown, the process includes the following steps:
[0057] Step S101: When the storage device is used for the first time, determine the active target physical block corresponding to the programming type.
[0058] In this embodiment of the invention, the storage device includes four types of active target physical blocks. For a storage medium that can store n bits of data, the classification of active target physical block types includes: a first type having active target physical blocks that can be programmed from the 1st to the n / 2nd data position; a second type having active target physical blocks that can be programmed from the n / 2+1th to the nth data position; a third type having active target physical blocks that can be programmed from the nth to the n / 2+1th data position; and a fourth type having active target physical blocks that can be programmed from the n / 2th to the 1st data position.
[0059] For a new storage device, where all physical blocks are blank, determine the active target physical blocks corresponding to the four programming types.
[0060] Step S102: When writing data to the storage device, determine the corresponding active target physical block category based on the data characteristics, determine the corresponding target physical block, and perform data programming.
[0061] In this embodiment of the invention, when writing data to a storage device, the corresponding active target physical block type is determined based on data characteristics. Specifically, the data characteristics include hot read / hot write, cold read / cold write, cold read / hot write, and hot read / cold write. Based on the data characteristics, the corresponding active target physical block category is determined: hot read / hot write corresponds to the first type of active target physical block, cold read / cold write corresponds to the second type, cold read / hot write corresponds to the third type, and hot read / cold write corresponds to the fourth type. The programming direction and location are then determined, and data programming is performed.
[0062] For example, when a request with an operation value of 1 is received, it represents a write request, indicating that data needs to be written. Based on the data characteristics, the corresponding active target physical block is determined. After the active target physical block is determined, the data is programmed into that physical block using voltage pulses.
[0063] Step S103: When reading data from the storage device, the data characteristics are re-evaluated and the target physical block category is determined. If the newly determined target physical block category does not match the target physical block category, a data migration operation is performed.
[0064] In this embodiment of the invention, when reading data from a storage device, the data characteristics are re-evaluated based on read / write heat scores to determine the target physical block category. When the target physical block category changes, i.e., the newly determined target physical block category does not match the current target physical block category, a data migration operation is triggered, and the data is programmed into the new target physical block via voltage pulses.
[0065] For example, when a request with an operation value of 0 is received, it represents a read request, and a read operation is performed to obtain the read / write popularity score of the data being read, thereby re-determining its feature type and redetermining the target physical block based on the current feature type. If the target physical block does not match the target physical block where the currently read data is located, the data is read out, the data in the original target physical block is invalidated, and the data is reprogrammed into the new target physical block via voltage pulses.
[0066] The programming method provided in this embodiment introduces a new programming approach to the storage device, classifies it into four types of active target physical blocks, determines the active target physical block type based on data characteristics, selects the active target physical block type that matches the data characteristics for data writing, and performs programming to ensure that the data characteristics and target physical block performance match. For data reading, the target physical block category is redefined to ensure that the data characteristics and target physical block performance always match, thereby improving the overall performance of the storage device.
[0067] This embodiment provides a programming method, which includes the following steps:
[0068] Step S201: When the storage device is used for the first time, determine the active target physical block corresponding to the programming type.
[0069] Specifically, determining the active target physical block corresponding to the programming type in step S201 above includes:
[0070] In step S2011, for the new storage device, all physical blocks are blank physical blocks. By default, the first physical block is designated as the first type of active target physical block, and the second physical block is designated as the third type of active target physical block.
[0071] In step S2012, when the storage medium needs to be programmed from the n / 2+1th data position to the nth data position, it is necessary to first program the 1st data position to the n / 2nd data position. Then, after the programming operation is performed on the first type of active target physical block, the physical block becomes the first type and the second type of active target physical block.
[0072] In step S2013, when the storage medium needs to be programmed from the n / 2th data position to the 1st data position, it is necessary to first program the nth data position to the n / 2+1th data position. Then, after the third type of active target physical block is programmed, the physical block becomes a third and fourth type of active target physical block.
[0073] In this embodiment of the invention, for a new storage device, physical blocks are initialized, all physical blocks are blank physical blocks, the first physical block is marked as a first type of active target physical block, and the second physical block is marked as a third type of active target physical block.
[0074] When programming the data from bit n / 2+1 to bit n, the data from bit 1 to bit n / 2 must be programmed first. After the programming operation is performed on the first type of active target physical block, the block state is changed, and the physical block becomes the first type and the second type of active target physical block.
[0075] When programming data from bit n / 2 to bit 1 is required, the data from bit n to bit n / 2+1 must be programmed first. After the third type of active target physical block is programmed, a block state transition is performed, and the physical block becomes a third and fourth type of active target physical block.
[0076] Specifically, the four data feature types, their corresponding target physical block locations, and the programming directions for different target physical blocks are as follows: Figure 2 As shown, the programming direction for the first and second types of target physical blocks is from left to right, while the programming direction for the third and fourth types of target physical blocks is from right to left.
[0077] By setting the default active target physical block type for the physical block, the initialization process is simplified. The type of the active target physical block is adjusted according to the programming direction and data location, thereby improving the efficiency of programming operations.
[0078] In some alternative implementations, the method further includes:
[0079] Step S2014: When the storage location corresponding to the first or third type of active target physical block is exhausted, allocate a new free physical block as the new active target physical block.
[0080] Step S2015: When the storage location corresponding to the second type of active target physical block is exhausted, allocate the programmed first type of active target physical block as the new second type of active target physical block.
[0081] Step S2016: When the storage location corresponding to the fourth type of active target physical block is exhausted, the programmed third type of active target physical block is allocated as the new fourth type of active target physical block.
[0082] In this embodiment of the invention, when the offset pointer of the target physical block is at the maximum capacity of the physical block, it indicates that the target physical block in the physical block has been used up.
[0083] When the storage locations of active target physical blocks are exhausted, new blocks need to be allocated from free physical blocks to achieve dynamic management of physical block resources, ensure continuous storage operations, and avoid data write failures due to physical block resource exhaustion.
[0084] By allocating new free physical blocks when the first or third type of active target physical blocks are exhausted, sufficient space is ensured to process data. When the second or fourth type of active target physical blocks are exhausted, other programmed physical blocks are reused, thus making efficient use of storage space.
[0085] Step S202: When writing data to the storage device, determine the corresponding active target physical block category based on the data characteristics, determine the corresponding target physical block, and perform data programming.
[0086] Specifically, in step S202 above, determining the corresponding active target physical block type based on data characteristics includes:
[0087] Step S2021: Determine whether the read popularity score of the data to be programmed is higher than four.
[0088] Step S2022: Determine whether the write popularity score of the data to be programmed is higher than four.
[0089] Specifically, the formula for determining the popularity score is:
[0090]
[0091] The formula for determining popularity score is:
[0092]
[0093] Among them, H i Freq is the heat score for data block i. i T represents the historical access frequency of data block i. now T is the current timestamp. i,last R is the time when data block i was last accessed. i R is the number of reads for data block i. i Used to measure read activity, W i W represents the number of writes to data block i. i Used to measure write activity, A i A is the reciprocal of the average access interval of data block i. The more concentrated the access, the higher A becomes. i The larger the value, the more weighting coefficients α, β, and γ are adjusted according to the actual system requirements.
[0094] In this embodiment of the invention, the number of times each piece of data is read and written is recorded in a specific physical block. A data popularity threshold of four is set; data with a popularity score exceeding four is considered hot data, and data with a score below four is considered cold data. That is, if the data read popularity score exceeds four, it is considered hot read data; if the data read popularity score is below four, it is considered cold read data. Similarly, if the data write popularity score exceeds four, it is considered hot write data; if the data write popularity score is below four, it is considered cold write data.
[0095] By statistically analyzing the read / write popularity score of the data to be programmed, hot data and cold data can be distinguished, so that resources can be allocated to cold data and hot data respectively based on the judgment results.
[0096] Step S2023: When the read heat score of the data to be programmed is higher than four and the write heat score is not higher than four, it is stored in the fourth type of active target physical block.
[0097] Step S2024: When both the read heat score and write heat score of the data to be programmed are higher than four, store it in the first type of active target physical block.
[0098] Step S2025: When the write heat score of the data to be programmed is higher than four and the read heat score is not higher than four, it is stored in the third type of active target physical block.
[0099] Step S2026: When the read / write heat score of the data to be programmed is not higher than four, it is stored in the second type of active target physical block.
[0100] In this embodiment of the invention, if the data read heat score exceeds four and the write heat score does not exceed four, read operations are frequent and write operations are reduced, i.e., hot read and cold write characteristics, corresponding to the fourth type of target physical block, and it is stored in the fourth type of active target physical block. If both the data read heat score and write heat score exceed four, both read and write operations are frequent, i.e., hot write read and write characteristics, corresponding to the first type of target physical block, and it is stored in the first type of active target physical block. If the data write heat score exceeds four and the read heat score does not exceed four, read operations are few and write operations are frequent, i.e., cold read and hot write characteristics, corresponding to the third type of target physical block, and it is stored in the third type of active target physical block. If neither the data read heat score nor the write heat score exceeds four, both read and write operations are few, i.e., cold read and cold write characteristics, and it is stored in the second type of active target physical block.
[0101] Specifically, when the conditions are met, the data is written into the corresponding physical block via voltage pulses.
[0102] By allocating matching active target physical blocks based on the read / write popularity score of the data to be programmed, the system can dynamically adapt to data characteristics and maximize resource utilization.
[0103] Step S203: When reading data from the storage device, the data characteristics are re-evaluated and the target physical block category is determined. If the newly determined target physical block category does not match the target physical block category, a data migration operation is performed.
[0104] Specifically, step S203 includes:
[0105] Step S2031: When reading data from the storage device, re-evaluate the characteristics of the data being read and redetermine the new active physical target block category.
[0106] Step S2032: If the new physical block category does not match the current physical block category, the data is moved to the new active target physical block so that its data characteristics and location performance are compatible.
[0107] In this embodiment of the invention, when the storage device reads data, it automatically triggers a real-time feature evaluation of the data and redetermines a new category of active physical target blocks based on the mapping relationship between various target physical blocks and their corresponding data features.
[0108] Determine whether the new target physical block is consistent with the physical block where the data is currently located. If they are consistent, it is a match; if they are inconsistent, it is a mismatch. Move the data to the new active target physical block so that its data characteristics and location performance are consistent.
[0109] The programming method provided in this embodiment re-evaluates the characteristics of the read data and redetermines the active physical target block category to ensure dynamic adaptation between the data characteristics and the active target physical block category. When the physical block category does not match, the data is moved to ensure that the data characteristics and the performance of the location are consistent.
[0110] This embodiment also provides a programming device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0111] This embodiment provides a programming device, such as Figure 3 As shown, it includes:
[0112] The active target physical block determination module 301 is used to determine the active target physical block corresponding to the programming type when the storage device is used for the first time. The storage device includes four types of active target physical blocks. For a storage medium that can store n bits of data, the first type is an active target physical block programmed from the 1st data position to the n / 2nd data position, the second type is an active target physical block programmed from the n / 2+1th data position to the nth data position, the third type is an active target physical block programmed from the nth data position to the n / 2+1th data position, and the fourth type is an active target physical block programmed from the n / 2th data position to the 1st data position.
[0113] The data programming module 302 is used to determine the corresponding active target physical block category based on the data characteristics when writing data to the storage device, and to determine the corresponding target physical block and perform data programming.
[0114] The data migration module 303 is used to re-evaluate the data characteristics and determine the target physical block category when reading data from the storage device. If the newly determined target physical block category does not match the current target physical block category, a data migration operation is performed.
[0115] In some optional implementations, the active target physical block determination module 301 includes:
[0116] The first determining unit is used to determine, for a new storage device, if all physical blocks are blank physical blocks, the first physical block is designated as the first type of active target physical block and the second physical block is designated as the third type of active target physical block by default.
[0117] The second determining unit is used when the storage medium needs to program the data position from the n / 2+1th bit to the nth bit, and it is necessary to program the data position from the 1st bit to the n / 2th bit first. Then, after the first type of active target physical block is programmed, the physical block is a first type and a second type of active target physical block.
[0118] The third determining unit is used when the storage medium needs to program the data position from the n / 2th bit to the 1st bit, and first needs to program the data position from the nth bit to the n / 2+1th bit. Then, after the third type of active target physical block is programmed, the physical block is a third type and a fourth type of active target physical block.
[0119] In some alternative embodiments, the device further includes:
[0120] The first allocation module is used to allocate a new free physical block as a new active target physical block when the storage location corresponding to the first type of active target physical block or the third type of active target physical block is exhausted.
[0121] The second allocation module is used to allocate the programmed first type of active target physical block as a new second type of active target physical block when the storage location corresponding to the second type of active target physical block is exhausted.
[0122] The third allocation module is used to allocate the programmed third type of active target physical block as a new fourth type of active target physical block when the storage location corresponding to the fourth type of active target physical block is exhausted.
[0123] In some alternative embodiments, the device further includes:
[0124] The first judgment module is used to determine whether the read popularity score of the data to be programmed is higher than four.
[0125] The second judgment module is used to determine whether the write popularity score of the data to be programmed is higher than four.
[0126] In some alternative embodiments, the device further includes:
[0127] The first data storage module is used to store the data to be programmed into the fourth type of active target physical block when the read heat score is higher than four and the write heat score is not higher than four.
[0128] The second data storage module is used to store the data to be programmed into the first type of active target physical block when both the read heat score and write heat score are higher than four.
[0129] The third data storage module is used to store the data to be programmed into the third type of active target physical block when the write heat score is higher than four and the read heat score is not higher than four.
[0130] The fourth data storage module is used to store the data to be programmed into the second type of active target physical block when the read and write heat scores are not higher than four.
[0131] In some alternative implementations, the data transfer module 303 includes:
[0132] The data feature evaluation unit is used to re-evaluate the features of the data being read when reading data from the storage device, and to redetermine the new active physical target block category.
[0133] The data movement unit is used to move the data to a new active target physical block if the new physical block category does not match the current physical block category, so that the data characteristics and the performance of the location are compatible.
[0134] Further functional descriptions of the above modules and units are the same as those in the corresponding embodiments described above, and will not be repeated here.
[0135] In this embodiment, the programming device is presented in the form of a functional unit. Here, a unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that execute one or more software or fixed programs, and / or other devices that can provide the above functions.
[0136] This invention also provides a computer device having the above-described features. Figure 3 The programming device shown.
[0137] Please see Figure 4 , Figure 4 This is a schematic diagram of the structure of a computer device provided in an optional embodiment of the present invention, such as... Figure 4As shown, the computer device includes one or more processors 10, memory 20, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components communicate with each other via different buses and can be mounted on a common motherboard or otherwise installed as needed. The processors can process instructions executed within the computer device, including instructions stored in or on memory to display graphical information of a GUI on external input / output devices (such as display devices coupled to the interfaces). In some alternative implementations, multiple processors and / or multiple buses can be used with multiple memories and multiple memory modules, if desired. Similarly, multiple computer devices can be connected, each providing some of the necessary operations (e.g., as a server array, a group of blade servers, or a multiprocessor system). Figure 4 Take a processor 10 as an example.
[0138] Processor 10 may be a central processing unit, a network processor, or a combination thereof. Processor 10 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The programmable logic device may be a complex programmable logic device (CAMP), a field-programmable gate array (FPGA), a general-purpose array logic (GDA), or any combination thereof.
[0139] The memory 20 stores instructions executable by at least one processor 10 to cause at least one processor 10 to perform the method shown in the above embodiments.
[0140] The memory 20 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the computer device. Furthermore, the memory 20 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some alternative embodiments, the memory 20 may optionally include memory remotely located relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0141] The memory 20 may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as flash memory, hard disk or solid-state drive; the memory 20 may also include a combination of the above types of memory.
[0142] The computer device also includes an input device 30 and an output device 40. The processor 10, memory 20, input device 30, and output device 40 can be connected via a bus or other means. Figure 4 Taking the example of a connection between China and Israel via a bus.
[0143] Input device 30 can receive input numerical or character information, and generate key signal inputs related to user settings and function control of the computer device, such as a touch screen. Output device 40 may include a display device, etc.
[0144] This invention also provides a computer-readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as computer code that can be recorded on a storage medium, or implemented as computer code downloaded via a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code, which, when accessed and executed by the computer, processor, or hardware, implements the methods shown in the above embodiments.
[0145] A portion of this invention can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to the invention through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled program, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.
[0146] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope of this application.
Claims
1. A programming method, characterized in that, The method includes: When the storage device is used for the first time, the active target physical block corresponding to the programming type is determined. The storage device includes four types of active target physical blocks. For a storage medium that can store n bits of data, the first type is an active target physical block programmed from the 1st data position to the n / 2nd data position, the second type is an active target physical block programmed from the n / 2+1th data position to the nth data position, the third type is an active target physical block programmed from the nth data position to the n / 2+1th data position, and the fourth type is an active target physical block programmed from the n / 2th data position to the 1st data position. When writing data to a storage device, the corresponding active target physical block category is determined based on the data characteristics, and the corresponding target physical block is identified and data programming is performed. When reading data from a storage device, the data characteristics are re-evaluated and the target physical block category is determined. If the newly determined target physical block category does not match the current target physical block category, a data migration operation is performed.
2. The method according to claim 1, characterized in that, The determination of the active target physical block corresponding to the programming type includes: For new storage devices, all physical blocks are blank physical blocks. By default, the first physical block is regarded as the first type of active target physical block, and the second physical block is regarded as the third type of active target physical block. When the storage medium needs to be programmed from the n / 2+1th data position to the nth data position, it is necessary to first program the 1st data position to the n / 2nd data position. Then, after the programming operation is performed on the first type of active target physical block, the physical block becomes the first type and the second type of active target physical block. When the storage medium needs to be programmed from the n / 2th data position to the 1st data position, it is necessary to first program the nth data position to the n / 2+1th data position. Then, after the third type of active target physical block is programmed, the physical block becomes a third and fourth type of active target physical block.
3. The method according to claim 2, characterized in that, The method further includes: When the storage location corresponding to the first type of active target physical block or the third type of active target physical block is exhausted, a new free physical block is allocated as the new active target physical block. When the storage location corresponding to the second type of active target physical block is exhausted, the programmed first type of active target physical block is allocated as the new second type of active target physical block. When the storage location corresponding to the fourth type of active target physical block is exhausted, the programmed third type of active target physical block is allocated as the new fourth type of active target physical block.
4. The method according to claim 1, characterized in that, After determining the active target physical block corresponding to the programming type, the method further includes: Determine if the read popularity score of the data to be programmed is higher than four; Determine if the write popularity score of the data to be programmed is higher than four. The popularity score is calculated using the following formula: Calculate the popularity score using the following formula: Among them, H i Freq is the heat score for data block i. i T represents the historical access frequency of data block i. now T is the current timestamp. i,last R is the time when data block i was last accessed. i R is the number of reads for data block i. i Used to measure read activity, W i W represents the number of writes to data block i. i Used to measure write activity, A i A is the reciprocal of the average access interval of data block i. The more concentrated the access, the higher A becomes. i The larger the value, the more weighting coefficients α, β, and γ are adjusted according to the actual system requirements.
5. The method according to claim 4, characterized in that, The method further includes: When the read popularity score of the data to be programmed is higher than four and the write popularity score is not higher than four, it is stored in the fourth type of active target physical block; When both the read popularity score and write popularity score of the data to be programmed are higher than four, it is stored in the first type of active target physical block; When the write popularity score of the data to be programmed is higher than four and the read popularity score is not higher than four, it is stored in the third type of active target physical block; When the read / write heat score of the data to be programmed is not higher than four, it is stored in the second type of active target physical block.
6. The method according to claim 1, characterized in that, When reading data from the storage device, the data characteristics are re-evaluated and the target physical block category is determined. If the newly determined target physical block category does not match the current target physical block category, a data relocation operation is performed, including: When reading data from a storage device, the characteristics of the data being read are re-evaluated, and a new category of active physical target blocks is determined. If the new physical block category does not match the current physical block category, the data will be moved to the new active target physical block to make its data characteristics and location performance match.
7. A programming device, characterized in that, The device includes: The active target physical block determination module is used to determine the active target physical block corresponding to the programming type when the storage device is used for the first time. The storage device includes four types of active target physical blocks. For a storage medium that can store n bits of data, the first type is an active target physical block programmed from the 1st data position to the n / 2nd data position, the second type is an active target physical block programmed from the n / 2+1th data position to the nth data position, the third type is an active target physical block programmed from the nth data position to the n / 2+1th data position, and the fourth type is an active target physical block programmed from the n / 2th data position to the 1st data position. The data programming module determines the corresponding active target physical block category based on the data characteristics when writing data to the storage device, identifies the corresponding target physical block, and performs data programming. The data migration module is used to re-evaluate data characteristics and determine the target physical block category when reading data from the storage device. If the newly determined target physical block category does not match the current target physical block category, a data migration operation is performed.
8. A computer device, characterized in that, include: A memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the computer instructions to perform the programming method of any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to perform the programming method according to any one of claims 1 to 6.
10. A computer program product, characterized in that, It includes computer instructions for causing a computer to perform the programming method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Data processing method and device and storage medium
CN117931070A
Solid-state disk space allocation method and device, electronic equipment and storage medium
CN118259839A