Method and apparatus for determining flash translation layer (ftl) algorithm
Patent Information
- Application Number
- CN202211608167.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-14
- Publication Date
- 2026-10-20
- Estimated Expiration
- 2042-12-14
AI Technical Summary
这种方式下,在固态硬盘所使用的FTL算法与固态硬盘后续所执行的读写任务不匹配时,会严重影响硬盘的读写性能
[0062]其中,第二方面至第八方面中任一种实现方式所带来的技术效果可参见第一方面中不同实现方式所带来的技术效果,此处不再赘述。
Smart Images

Figure CN116303120B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of storage device technology, and in particular to a method and apparatus for determining the Flash Translation Layer (FTL) algorithm. Background Technology
[0002] Currently, computer devices send read and write tasks to solid-state drives (SSDs) using logical block addresses (LBAs) determined by the drive's capacity, while SSDs use physical addresses when reading and writing data. The mapping table between logical and physical addresses is managed using a flash translation layer (FTL) algorithm.
[0003] In related technologies, solid-state drives (SSDs) store only one FTL (Framework Time Logging) algorithm. Upon initial boot, the SSD generates a mapping table based on this FTL algorithm. Subsequently, the SSD maintains this mapping table between logical and physical addresses using the same FTL algorithm. However, this approach can severely impact read and write performance if the FTL algorithm used by the SSD is incompatible with the read / write tasks it performs. Summary of the Invention
[0004] This application provides a method and apparatus for determining the Flash Translation Layer (FTL) algorithm, which can automatically select the FTL algorithm that matches the read / write task being performed from multiple FTL algorithms in a solid-state drive, thereby helping to improve the read / write performance of the solid-state drive.
[0005] To achieve the above objectives, the embodiments of this application adopt the following technical solutions: In a first aspect, a method for determining a Flash Translation Layer (FTL) algorithm is provided for a solid-state drive (SSD). The SSD stores multiple FTL algorithms, including a first FTL algorithm. The method includes: determining address mapping information based on the first FTL algorithm over a period of time, the address mapping information being used to indicate the correspondence between logical addresses and physical addresses of the SSD during read / write tasks; determining a second FTL algorithm from the multiple FTL algorithms; wherein the performance of processing read / write tasks based on the second FTL algorithm over a period of time is higher than the performance of processing read / write tasks based on the first FTL algorithm over a period of time; and controlling the SSD to enable the target address mapping information determined based on the second FTL algorithm.
[0006] In this scheme, the solid-state drive (SSD) pre-stores multiple FTL algorithms, including a first FTL algorithm. For a given period, the SSD determines address mapping information based on the first FTL algorithm to indicate the correspondence between logical and physical addresses during read / write tasks. Then, the SSD determines a second FTL algorithm from the multiple FTL algorithms and uses the target address mapping information determined by the second FTL algorithm to indicate the correspondence between logical and physical addresses during subsequent read / write tasks. Since the read / write tasks processed by the SSD over a long period are typically of the same type, and the performance of processing read / write tasks based on the second FTL algorithm is higher than that based on the first FTL algorithm, using the target address mapping information determined by the second FTL algorithm helps improve read / write efficiency during subsequent read / write tasks, thereby improving the overall read / write performance of the SSD.
[0007] Furthermore, the performance of the second FTL algorithm in processing read and write tasks over a period of time is higher than that of the first FTL algorithm, indicating that the second FTL algorithm is a better match for solid-state drives (SSDs) for read and write tasks over a period of time. Using the second FTL algorithm, which is better matched to the read and write tasks over this period of time, can also help improve the lifespan of SSDs.
[0008] In one possible implementation, the target read / write type is determined based on the read / write status of multiple read / write tasks processed by the first FTL algorithm over a period of time; and based on the target read / write type, a second FTL algorithm is determined from multiple FTL algorithms.
[0009] This implementation provides a specific method for determining the second FTL algorithm. In this method, the solid-state drive (SSD) automatically determines the second FTL algorithm from multiple FTL algorithms based on multiple read / write tasks processed using the first FTL algorithm over a period of time. In this way, the SSD can automatically update the FTL algorithm it uses without user intervention, which helps to improve the convenience of FTL algorithm updates.
[0010] Furthermore, different read / write tasks of different types utilize address mapping information in different ways. For example, for a read task, only the address mapping information needs to be queried to determine the physical address corresponding to the logical address carried by the read task. However, for a write task, not only is the address mapping information queried to determine the physical location corresponding to the logical address carried by the write task, but sometimes the address mapping information also needs to be modified. Therefore, the solid-state drive (SSD) determines the target read / write type based on the read / write status of multiple read / write tasks, and then selects a second FTL algorithm from multiple FTL algorithms based on the target read / write type. This helps improve the matching degree between the second FTL algorithm and the read / write types of read / write tasks within a certain period, thereby improving the read / write efficiency when processing read / write tasks within a subsequent period based on the second FTL algorithm.
[0011] In another possible implementation, the target read / write type includes read tasks and write tasks.
[0012] This implementation provides a method for dividing the target read / write type into two categories: read tasks and write tasks. Multiple FTL algorithms only need to include the FTL algorithm matching the read task and the FTL algorithm matching the write task, which helps reduce the number of FTL algorithms that the solid-state drive needs to store, thereby reducing the storage space occupied by the FTL algorithms. Furthermore, it helps shorten the time required to traverse multiple FTL algorithms, thus improving the speed of determining the second FTL algorithm that matches the target read / write type from multiple FTL algorithms.
[0013] In another possible implementation, if the target read / write type is a write task, the second FTL algorithm includes the DFTL algorithm; if the target read / write type is a read task, the second FTL algorithm includes the BAN algorithm.
[0014] In another possible implementation, the target read / write types include sequential read tasks, sequential write tasks, random write tasks, and random read tasks.
[0015] This implementation provides a method for classifying target read / write types. By dividing the target read / write types into four types—sequential read tasks, sequential write tasks, random write tasks, and random read tasks—the accuracy of read / write type classification is improved, thereby increasing the precision of the read / write types. This helps to improve the matching degree between the determined second FTL algorithm and the target read / write types, and thus helps to significantly improve the performance of reading / write tasks processed by the second FTL algorithm over a period of time.
[0016] In another possible implementation, if the target read / write type is a sequential read task or a random read task, the second FTL algorithm includes the BAN algorithm; if the target read / write type is a sequential write task, the second FTL algorithm includes the FAST algorithm; and if the target read / write type is a random write task, the second FTL algorithm includes the DFTL algorithm.
[0017] Another possible implementation involves determining the target read / write type based on the read / write status of the read / write tasks, including: determining the target read / write type based on the proportion of read tasks among multiple read / write tasks.
[0018] In this implementation, the target read / write type is determined solely based on the proportion of read tasks among multiple read / write tasks. Since the proportion of read tasks among multiple read / write tasks can characterize the ratio of write tasks to read tasks over a period of time, determining the target read / write type based on the proportion of read tasks not only ensures the accuracy of the determination result but also helps to simplify the determination process, thereby increasing the speed at which the determination result is obtained.
[0019] Another possible implementation involves determining the target read / write type based on the proportion of read tasks among multiple read / write tasks. This includes determining the target read / write type based on the proportion of read tasks among multiple read / write tasks and the fluctuation of the proportion of read tasks within a target time period.
[0020] In this implementation, the fluctuation of the proportion of read tasks within the target time period reflects the distribution of read tasks across different sub-time periods. Therefore, by analyzing the fluctuation of read tasks within the target time period, the proportion of read tasks in different time periods can be determined. For example, a large fluctuation in the proportion of read tasks indicates a significant difference in the proportion of read tasks across different time periods; conversely, a small fluctuation indicates a smaller difference in the number of read tasks across different time periods. Based on this, if the proportion of read tasks fluctuates significantly within the target time period, and the proportion of read tasks is small in most time periods, with only a few periods showing a large proportion, it indicates that the read / write tasks processed by the SSD during that period were write tasks. Therefore, by combining the proportion of read tasks with their fluctuation, the read / write type of the read / write tasks processed by the SSD for most of the time can be analyzed. This allows for the determination of the target read / write type based on the read / write type of the tasks executed by the SSD for most of the time, thus helping to ensure the read / write performance of the SSD for most of the time.
[0021] In another possible implementation, the target read / write type is determined based on the proportion of read tasks among multiple read / write tasks and the fluctuation of the proportion of read tasks within the target time period. This includes: if the proportion of read tasks among multiple read / write tasks is greater than or equal to a first threshold and the fluctuation ratio of the proportion of read tasks within the target time period is less than or equal to a second threshold, the target read / write type is determined to be a read task.
[0022] This implementation provides a specific method for determining the target read / write type. This method determines the target read / write type based on the relationship between the proportion of read tasks and a first threshold, and the relationship between the fluctuation ratio of the read task proportion and a second threshold. The determination process is simple and convenient, which helps improve the accuracy and efficiency of the determination results.
[0023] Another possible implementation involves determining the target read / write type based on the read / write status of the read / write tasks, including determining the target read / write type based on the proportion of write tasks among multiple read / write tasks.
[0024] In this implementation, the target read / write type is determined solely based on the proportion of write tasks among multiple read / write tasks. Since the proportion of write tasks among multiple read / write tasks can characterize the ratio of read tasks to write tasks over a period of time, determining the target read / write type based on the proportion of write tasks not only ensures the accuracy of the determination result but also helps to simplify the determination process, thereby increasing the speed at which the determination result is obtained.
[0025] Another possible implementation involves determining the target read / write type based on the proportion of write tasks among multiple read / write tasks. This includes determining the target read / write type based on the proportion of write tasks among multiple read / write tasks and the fluctuation of the proportion of write tasks within the target time period.
[0026] In this implementation, the fluctuation of the write task percentage within the target time period reflects the distribution of write tasks across different sub-time periods. Therefore, by analyzing the fluctuation of write tasks within the target time period, the percentage of write tasks in different time periods can be determined. For example, a large fluctuation in the write task percentage indicates a significant difference in the percentage across different time periods; conversely, a small fluctuation indicates a smaller difference in the number of write tasks across different time periods. Based on this, if the write task percentage fluctuates significantly within the target time period, and the percentage is small in most time periods, with only a few periods showing a large percentage, it indicates that the SSD is primarily processing read tasks. Therefore, by combining the write task percentage with its fluctuation, the read / write type of the read / write tasks processed by the SSD for most of the time can be analyzed. This allows for the determination of the target read / write type based on the read / write type of the tasks executed by the SSD most of the time, thus helping to ensure the read / write performance of the SSD most of the time.
[0027] In another possible implementation, the target read / write type is determined based on the proportion of write tasks among multiple read / write tasks and the fluctuation of the proportion of write tasks within the target time period. This includes: if the proportion of write tasks among multiple read / write tasks is greater than or equal to a third threshold and the fluctuation ratio of the proportion of write tasks is less than or equal to a fourth threshold, the target read / write type is determined to be a write task.
[0028] This implementation provides a specific method for determining the target read / write type. This method determines the target read / write type based on the relationship between the proportion of write tasks and a third threshold, and the relationship between the fluctuation ratio of the write task proportion and a fourth threshold. The judgment process is simple and convenient, which helps improve the accuracy and efficiency of the determination results.
[0029] Another possible implementation involves determining the target read / write type based on the read / write status of the read / write tasks, including: determining the target read / write type based on the proportion of read tasks and the proportion of write tasks among multiple read / write tasks.
[0030] In this implementation, the target read / write type is determined by analyzing the proportion of read tasks and the proportion of write tasks among multiple read / write tasks. This allows for a more comprehensive analysis of the proportion of read tasks and the proportion of write tasks among multiple read / write tasks, which helps improve the accuracy of the determined target read / write type.
[0031] In another possible implementation, the target read / write type is determined based on the proportion of read tasks and the proportion of write tasks among multiple read / write tasks. This includes determining the target read / write type based on the proportion of read tasks and the fluctuation of the proportion of read tasks within a target time period, and the proportion of write tasks and the fluctuation of the proportion of write tasks within a target time period.
[0032] In this implementation, the target read / write type is determined by analyzing the proportion of read tasks, the fluctuation of the proportion of read tasks within the target time period, the proportion of write tasks, and the fluctuation of the proportion of write tasks within the target time period. This allows for a more comprehensive analysis of the proportion of read tasks, the distribution of read tasks in different sub-time periods within the target time period, and the proportion of write tasks, thus improving the accuracy of the determined target read / write type.
[0033] In another possible implementation, the target read / write type is determined based on the read / write status of the read / write task, including: determining the target read / write type based on at least one of the following: the proportion of random read tasks, the proportion of sequential read tasks, the proportion of random write tasks, and the proportion of sequential write tasks among multiple read / write tasks.
[0034] In this implementation, since the proportion can represent the quantity of random read tasks, random write tasks, sequential read tasks, and sequential write tasks within a certain period of time, determining the target read / write type by using at least one of the following: the proportion of random read tasks, the proportion of sequential read tasks, the proportion of random write tasks, and the proportion of sequential write tasks among multiple read / write tasks. This not only ensures the accuracy of the determination result but also helps to simplify the determination process, thereby improving the speed at which the determination result is obtained.
[0035] In another possible implementation, the target read / write type is determined based on at least one of the following: the proportion of random read tasks, the proportion of sequential read tasks, the proportion of random write tasks, and the proportion of sequential write tasks among multiple read / write tasks. This includes: determining the target read / write type based on at least one of the following: the proportion of random read tasks and the fluctuation of that proportion within a target time period; the proportion of sequential read tasks and the fluctuation of that proportion within a target time period; the proportion of random write tasks and the fluctuation of that proportion within a target time period; and the proportion of sequential write tasks and the fluctuation of that proportion within a target time period. In this implementation, the fluctuation of the percentage within the target time period reflects the distribution of the number of random read tasks, random write tasks, sequential read tasks, and sequential write tasks in different sub-time periods of the target time period. Therefore, by combining the percentage and the fluctuation of the percentage within the target time period, the target read / write type can be determined. This allows analysis of the read / write types of the read / write tasks processed by the SSD for most of the time within a certain period. Thus, the target read / write type can be determined based on the read / write types of the read / write tasks executed by the SSD for most of the time, thereby helping to ensure the read / write performance of the SSD for most of the time.
[0036] In another possible implementation, the target read / write type is determined based on the proportion of random read tasks among multiple read / write tasks and the fluctuation of the proportion of random read tasks within the target time period. This includes: if the proportion of random read tasks among multiple read / write tasks is greater than or equal to the fifth threshold, and the fluctuation ratio of the proportion of random read tasks within the target time period is less than or equal to the sixth threshold, the target read / write type is determined to be a random read task.
[0037] In this implementation, the target read / write type is determined by the relationship between the proportion of random read tasks and the fifth threshold, and the relationship between the fluctuation ratio of the proportion of random read tasks and the sixth threshold. The judgment process is simple and convenient, which helps to improve the accuracy and efficiency of the determination results.
[0038] In another possible implementation, the target read / write type is determined based on the proportion of sequential read tasks among multiple read / write tasks and the fluctuation of the proportion of sequential read tasks within the target time period. This includes: if the proportion of sequential read tasks among multiple read / write tasks is greater than or equal to the seventh threshold, and the fluctuation ratio of the proportion of sequential read tasks within the target time period is less than or equal to the eighth threshold, the target read / write type is determined to be a sequential read task.
[0039] In this implementation, the target read / write type is determined by the relationship between the proportion of sequential read tasks and the seventh threshold, and the relationship between the fluctuation ratio of the proportion of sequential read tasks and the eighth threshold. The judgment process is simple and convenient, which helps to improve the accuracy and efficiency of the determination results.
[0040] In another possible implementation, the target read / write type is determined based on the proportion of random write tasks among multiple read / write tasks and the fluctuation of the proportion of random write tasks within the target time period. This includes: if the proportion of random write tasks among multiple read / write tasks is greater than or equal to the ninth threshold, and the fluctuation ratio of the proportion of random write tasks within the target time period is less than or equal to the tenth threshold, the target read / write type is determined to be a random write task.
[0041] In this implementation, the target read / write type is determined by the relationship between the proportion of random write tasks and the ninth threshold, and the relationship between the fluctuation ratio of the proportion of random write tasks and the tenth threshold. The judgment process is simple and convenient, which helps to improve the accuracy and efficiency of the determination results.
[0042] In another possible implementation, the target read / write type is determined based on the proportion of sequential write tasks among multiple read / write tasks and the fluctuation of the proportion of sequential write tasks within the target time period. This includes: if the proportion of sequential write tasks among multiple read / write tasks is greater than or equal to the eleventh threshold, and the fluctuation ratio of the proportion of sequential write tasks within the target time period is less than or equal to the twelfth threshold, the target read / write type is determined to be a sequential write task.
[0043] In this implementation, the target read / write type is determined by the relationship between the proportion of sequential write tasks and the eleventh threshold, as well as the relationship between the fluctuation ratio of the proportion of sequential write tasks and the twelfth threshold. The judgment process is simple and convenient, which helps to improve the accuracy and efficiency of the determination results.
[0044] In another possible implementation, determining the second FTL algorithm from multiple FTL algorithms includes: determining the second FTL algorithm from multiple FTL algorithms based on a received target instruction; wherein the target instruction indicates the second FTL algorithm.
[0045] This implementation provides a specific method for determining the second FTL algorithm. In this method, the solid-state drive (SSD) can determine the second FTL algorithm from multiple FTL algorithms based on a received target instruction indicating the second FTL algorithm. Thus, the user can update the FTL algorithm used by the SSD by sending an instruction indicating the FTL algorithm to the SSD. Based on this, if the user finds that the read / write tasks performed by the SSD over a period of time do not match the first FTL algorithm currently used by the SSD, they can control the SSD to use the FTL algorithm that matches the read / write tasks performed over that period by sending a target instruction indicating the second FTL algorithm, thereby improving the SSD's performance.
[0046] In another possible implementation, the target instruction includes an identifier of the second FTL algorithm; determining the second FTL algorithm from multiple FTL algorithms based on the received target instruction includes: determining the second FTL algorithm from multiple FTL algorithms based on the identifier of the second FTL algorithm.
[0047] In this implementation, the target instruction includes the identifier of the second FTL algorithm. In this way, after receiving the target instruction, the solid-state drive can directly determine the second FTL algorithm from multiple FTL algorithms based on the identifier of the second FTL algorithm, which helps to improve the accuracy and speed of the determined second FTL algorithm.
[0048] In another possible implementation, the target instruction includes an identifier of the target read / write type; based on the received target instruction, a second FTL algorithm is determined from multiple FTL algorithms, including: determining the second FTL algorithm from multiple FTL algorithms based on the identifier of the target read / write type.
[0049] In this implementation, the target instruction includes an identifier for the target read / write type. After receiving the target instruction, the solid-state drive (SSD) can select the FTL algorithm that matches the target read / write type from multiple FTL algorithms as the second FTL algorithm. In this way, the user does not need to know the FTL algorithm that matches different read / write types. They only need to send the target instruction that indicates the read / write type to the SSD to control the SSD to enable the FTL algorithm that matches the read / write tasks executed within a certain period of time, which helps to improve user convenience and user experience.
[0050] In another possible implementation, the method further includes: when the solid-state drive restarts, generating a mapping table between the target logical address and the target physical address of the solid-state drive based on the second FTL algorithm; wherein the mapping table includes target address mapping information, the target logical address is the logical address of the target solid-state drive where data has been written, and the target physical address is the physical address of the solid-state drive where data has been written.
[0051] This implementation provides a specific method for controlling the SSD to enable the second FTL algorithm. In this method, upon SSD restart, a mapping relationship between the used logical addresses and physical addresses of the SSD is generated based on the second FTL algorithm. Thus, upon receiving a read / write task, the target address mapping information determined by the second FTL algorithm can be activated, thereby improving lookup speed, shortening lookup time, and consequently reducing the execution time of read / write tasks, ultimately improving the read / write performance of the SSD.
[0052] In another possible implementation, the method also includes: if the number of read / write tasks received in the most recent time period is less than or equal to a preset value, then restart the solid-state drive.
[0053] In this implementation, the solid-state drive (SSD) is restarted when the number of read / write tasks received in the most recent time period is less than or equal to a preset value. This allows the SSD to restart during the window period when it is waiting for read / write tasks, which helps to reduce the impact on the read / write tasks that the SSD is about to perform when updating the FTL algorithm.
[0054] Secondly, an apparatus for determining a flash translation layer (FTL) algorithm is provided. This apparatus includes: functional units for executing any one of the methods provided in the first aspect, wherein the actions performed by each functional unit are implemented in hardware or by executing corresponding software via hardware. For example, the apparatus for determining the FTL algorithm may include: a processing unit, a determining unit, and a control unit; the processing unit is used to determine address mapping information based on a first FTL algorithm over a period of time, the address mapping information being used to indicate the correspondence between logical addresses and physical addresses of the solid-state drive during read / write tasks; the determining unit is used to determine a second FTL algorithm from multiple FTL algorithms; wherein the performance of processing read / write tasks based on the second FTL algorithm over a period of time is higher than the performance of processing read / write tasks based on the first FTL algorithm over a period of time; and the control unit is used to control the solid-state drive to enable the target address mapping information determined based on the second FTL algorithm.
[0055] Thirdly, a solid-state drive (SSD) is provided, comprising a controller chip and a flash memory chip. The flash memory chip is used for storing data. The controller chip is used to determine address mapping information based on a first FTL algorithm over a period of time. The address mapping information is used to indicate the correspondence between the logical addresses and physical addresses of the SSD during read / write tasks. The controller chip is also used to determine a second FTL algorithm from multiple FTL algorithms. The performance of processing read / write tasks based on the second FTL algorithm over a period of time is higher than the performance of processing read / write tasks based on the first FTL algorithm over a period of time. The controller chip is also used to control the SSD to enable the target address mapping information determined based on the second FTL algorithm.
[0056] It should be noted that, in the third aspect, the control chip can also be used to execute any of the possible implementations in the first aspect described above.
[0057] Fourthly, a computer device is provided, comprising: the solid-state drive described in the third aspect.
[0058] Fifthly, a computer device is provided, comprising: a processor and a memory, the processor being connected to the memory. The memory is used to store computer execution instructions, and the processor executes the computer execution instructions stored in the memory, thereby implementing any of the methods provided in the first aspect.
[0059] In a sixth aspect, a chip is provided, comprising: a processor and an interface circuit; the interface circuit is used to receive code instructions and transmit them to the processor; the processor is used to execute the code instructions to perform any of the methods provided in the first aspect above.
[0060] In a seventh aspect, a computer-readable storage medium is provided, storing computer-executable instructions that, when executed on a computer, cause the computer to perform any of the methods provided in the first aspect.
[0061] Eighthly, a computer program product is provided, including computer execution instructions that, when executed on a computer, cause the computer to perform any of the methods provided in the first aspect above.
[0062] The technical effects of any of the implementation methods in aspects two through eight can be found in the technical effects of different implementation methods in aspect one, and will not be repeated here. Attached Figure Description
[0063] Figure 1 A system architecture diagram of a computer device provided in this application embodiment; Figure 2 This is a schematic diagram of the structure of a solid-state drive provided in an embodiment of this application; Figure 3 A flowchart for determining an FTL algorithm is provided as an embodiment of this application; Figure 4 A flowchart illustrating another algorithm for determining FTL provided in this application embodiment; Figure 5 A flowchart illustrating another algorithm for determining FTL provided in this application embodiment; Figure 6 A flowchart illustrating another algorithm for determining FTL provided in this application embodiment; Figure 7 A flowchart illustrating another algorithm for determining FTL provided in this application embodiment; Figure 8 This is a schematic diagram of an apparatus for determining an FTL algorithm provided in an embodiment of this application. Detailed Implementation
[0064] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
[0065] In the description of this application, unless otherwise stated, " / " indicates that the objects before and after are in an "or" relationship. For example, A / B can mean A or B. "And / or" in this application is merely a description of the relationship between the related objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist simultaneously, and B exists alone. A and B can be singular or plural.
[0066] Furthermore, in the description of this application, unless otherwise stated, "multiple" means two or more. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of a single item or a plurality of items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.
[0067] Furthermore, to facilitate a clear description of the technical solutions in the embodiments of this application, the terms "first" and "second" are used in the embodiments of this application to distinguish identical or similar items with substantially the same function and effect. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and that "first" and "second" are not necessarily different. Meanwhile, in the embodiments of this application, the terms "exemplary" or "for example" are used to indicate that something is being used as an example, illustration, or description. Any embodiment or design scheme described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Specifically, the use of terms such as "exemplary" or "for example" is intended to present related concepts in a concrete manner for ease of understanding.
[0068] First, the application scenarios of the embodiments of this application will be introduced by way of example.
[0069] Currently, computer devices send read and write tasks to solid-state drives (SSDs) using logical block addresses (LBAs) determined by the drive's capacity, while SSDs use physical addresses when reading and writing data. The mapping table between logical and physical addresses is managed using a flash translation layer (FTL) algorithm.
[0070] In related technologies, solid-state drives (SSDs) store only one FTL algorithm. When an SSD boots for the first time, it generates a mapping table based on this FTL algorithm. Subsequently, the SSD continuously maintains the mapping table between logical addresses and physical addresses based on this FTL algorithm.
[0071] Because different FTL algorithms generate mapping tables with different structures, the time required for different FTL algorithms to query the physical address corresponding to a logical address varies significantly. For example, some FTL algorithms generate only one mapping table, and the physical address corresponding to a logical address can be determined by querying this single table. Other FTL algorithms generate mapping tables that include an index table and an address table, requiring the combination of both to determine the physical address. Still other FTL algorithms generate mapping tables that include a sub-table and a master table; if the sub-table fails to find the physical address corresponding to the logical address, the master table must be consulted for the corresponding physical location. This, in turn, leads to significant differences in the execution time of read and write tasks based on different FTL algorithms. The execution time of read and write tasks is a crucial indicator of the read and write performance of solid-state drives (SSDs).
[0072] Therefore, based on the methods in related technologies, when the fixed FTL algorithm used by the solid-state drive (SSD) does not match the read / write type of the read / write tasks performed by the SSD, it will seriously affect the read / write performance of the SSD.
[0073] In view of this, embodiments of this application propose a method for determining an FTL algorithm. The multiple FTL algorithms include a first FTL algorithm. The solid-state drive (SSD) determines address mapping information based on the first FTL algorithm over a period of time to indicate the correspondence between the SSD's logical and physical addresses during read / write tasks. Then, the SSD determines a second FTL algorithm from the multiple FTL algorithms and uses the target address mapping information determined based on the second FTL algorithm to indicate the correspondence between the SSD's logical and physical addresses during read / write tasks in the subsequent period. Since the read / write tasks processed by the SSD over a relatively long period are usually of the same type, and the performance of processing read / write tasks based on the second FTL algorithm is higher than that based on the first FTL algorithm, using the target address mapping information determined by the second FTL algorithm helps improve read / write efficiency during subsequent read / write tasks, thereby improving the SSD's read / write performance.
[0074] Furthermore, the performance of the second FTL algorithm in processing read and write tasks over a period of time is higher than that of the first FTL algorithm, indicating that the second FTL algorithm is a better match for solid-state drives (SSDs) for read and write tasks over a period of time. Using the second FTL algorithm, which is better matched to the read and write tasks over this period of time, can also help improve the lifespan of SSDs.
[0075] Secondly, the system architecture of the embodiments of this application will be described by way of example.
[0076] like Figure 1 Figure (a) shows a system architecture diagram of a first computer device provided in an embodiment of this application. The first computer device includes a central processing unit (CPU) and a solid-state drive (SSD). The CPU is used to receive read / write tasks sent by a second computer device and send the received read / write tasks to the SSD. The SSD is used to store data, receive read / write tasks sent by the CPU, and execute the read / write tasks based on the FTL algorithm.
[0077] Optionally, the first computer device and the second computer device can be connected via a wired network or a wireless network, or they can be connected via a communication bus.
[0078] like Figure 1Figure (b) shows a system architecture diagram of another first computer device provided in an embodiment of this application. The computer device includes a CPU and a storage device. The storage device includes a redundant array of independent disks (RAID) composed of multiple solid-state drives (SSDs) and a RAID card. The CPU receives read / write tasks sent by the second computer device and forwards these tasks to the RAID card. The RAID card then forwards the received read / write tasks to the SSDs indicated by the read / write tasks. The SSDs are used to store data and receive read / write tasks from the RAID card, executing these tasks based on the FTL algorithm.
[0079] It needs to be explained that, Figure 1 The principle of the solid-state drive shown in (a) performing this read / write task based on the FTL algorithm is similar to... Figure 1 The solid-state drive shown in (b) follows the same principle as the FTL algorithm in performing this read / write task.
[0080] like Figure 2 As shown in (a) in the figure, it is Figure 1 The diagrams (a) and (b) show a structural schematic of a solid-state drive (SSD). The SSD includes a hard disk controller, a flash memory controller, flash memory chips, and memory chips.
[0081] The system comprises several components: a flash memory chip for storing data indicated by read / write tasks, multiple FTL algorithms, and a mapping table; the mapping table includes address mapping information indicating the correspondence between logical and physical addresses of the solid-state drive (SSD); a memory chip for caching the mapping table; a hard drive controller for receiving read / write tasks and executing them based on the FTL algorithms; and a flash memory controller for reading data from the flash memory chip, writing data to the flash memory chip, and writing the mapping table from the memory chip to the flash memory chip.
[0082] When the solid-state drive (SSD) is first powered on, the SSD controller runs an FTL (Flash Flow Translation) algorithm in the flash memory chip and generates a mapping table based on this algorithm. The SSD controller then stores this mapping table in the memory chip and instructs the flash memory controller to write the mapping table from the memory chip to the flash memory chip.
[0083] When the solid-state drive is powered off, the flash memory controller writes the data in the memory chip back to the flash memory chip.
[0084] When a solid-state drive (SSD) is powered on for the first time, the flash memory controller writes the mapping table from the flash memory chip into the memory chip so that the SSD controller can look up the mapping table from the memory chip after receiving a read or write task.
[0085] The hard disk controller receives read / write tasks from the CPU and, based on the running FTL algorithm, looks up the physical address corresponding to the logical address indicated by the read / write task from the mapping table in the memory chip. When the read / write task is specifically a read task, the hard disk controller sends the found physical address to the flash memory controller, which then reads the data from the flash memory chip according to the physical address. When the read / write task is specifically a write task, the hard disk controller sends the physical address and the data to be written to the flash memory controller, which then writes the data to the flash memory chip according to the physical address.
[0086] like Figure 2 As shown in (b) in the figure, Figure 1 The diagrams (a) and (b) above show another structural schematic of the solid-state drive. This solid-state drive includes a controller, flash memory chips, and memory chips. For details regarding the flash memory chips and memory chips, please refer to the descriptions of the flash memory chips and memory chips in the above embodiments; they will not be repeated here.
[0087] The controller receives read / write tasks from the CPU and, based on the FTL algorithm, queries the mapping table in the memory chip to find the physical address corresponding to the logical address indicated by the read / write task. When the read / write task is a read task, the controller reads data from the flash memory chip according to the physical address. When the read / write task is a write task, the controller writes the data to be written to the physical location indicated by the physical address.
[0088] It needs to be explained that, Figure 2 The controller shown in (b) can be considered as Figure 2 The controller shown in (a) is a controller obtained by integrating the hard disk controller and the flash memory controller.
[0089] Optionally, the flash memory chip can be non-volatile memory (NVM), such as NOR flash, NAND flash, etc.
[0090] Optionally, the memory chip can be random access memory (RAM), such as dynamic random access memory (DRAM) or static random access memory (SRAM).
[0091] It should be noted that the system architecture and application scenarios described in the embodiments of this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided in the embodiments of this application. As those skilled in the art will know, with the evolution of system architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0092] For ease of understanding, the method for determining the FTL algorithm provided in this application is described below with reference to the accompanying drawings. This method is applicable to... Figure 1 (a), (b) and Figure 2 The solid-state drives shown in (a) and (b) are solid-state drives.
[0093] It should be noted that this method can be derived from... Figure 2 The hard disk controller shown in (a) can perform this action, or it can be performed by... Figure 2 The controller shown in (b) is executed.
[0094] The following describes an example of the method being executed by a hard disk controller.
[0095] The following embodiments of this application will be divided into five parts to provide an exemplary description of the scheme for determining the FTL algorithm.
[0096] Part One, Combination Figure 3 This paper describes the process of determining the second FTL algorithm from multiple FTL algorithms and controlling the solid-state drive to enable the second FTL algorithm.
[0097] Part Two, Combining Figure 4 This section introduces a specific implementation of the method described in Part 1 for determining the second FTL algorithm from multiple FTL algorithms. Specifically, it describes the process by which the hard disk controller determines the second FTL algorithm based on the received target instructions.
[0098] Part Three, Combining Figure 5 This section introduces another specific implementation of the method described in Part 1 for determining the second FTL algorithm from multiple FTL algorithms. Specifically, it involves the hard disk controller determining the second FTL algorithm based on the read and write status of multiple read and write tasks processed using the first FTL algorithm over a period of time.
[0099] Part Four, Combining Figure 6 The third part introduces a specific implementation method, in which the read and write types of read and write tasks processed within a certain period of time are divided into read tasks and write tasks.
[0100] Part Five, Combining Figure 7The third part introduces another specific implementation method, in which the read and write tasks processed within a certain period of time are divided into random read tasks, random write tasks, sequential read tasks, and sequential write tasks.
[0101] Figure 3 This is a flowchart illustrating a method for determining an FTL algorithm according to an exemplary embodiment. Exemplarily, the method includes steps S301-S303.
[0102] In some embodiments, the flash memory chip of the solid-state drive stores multiple FTL algorithms, including a first FTL algorithm and a second FTL algorithm.
[0103] S301: The hard disk controller determines the address mapping information based on the first FTL algorithm over a period of time. The address mapping information is used to indicate the correspondence between the logical address and the physical address of the solid-state drive during the processing of read and write tasks.
[0104] In some embodiments, after the solid-state drive (SSD) is powered on, the SSD controller enables the first FTL algorithm in the flash memory chip and stores the first mapping table generated based on the first FTL algorithm in the memory chip. Subsequently, when the SSD controller receives read / write tasks within a certain period, it determines the physical address corresponding to the logical address in the read / write task received within that period based on the address mapping information in the first mapping table.
[0105] It should be noted that the embodiments of this application do not limit the specific duration of a period of time. For example, it can be 24 hours, 48 hours, etc.
[0106] S302: The hard disk controller determines the second FTL algorithm from multiple FTL algorithms.
[0107] Among them, the performance of the hard disk controller in performing read and write tasks for a period of time based on the second FTL algorithm is higher than that of the hard disk controller in performing read and write tasks for a period of time based on the first FTL algorithm.
[0108] Alternatively, it can be argued that the read / write efficiency (or read / write duration) of the hard disk controller when performing read / write tasks based on the second FTL algorithm over a period of time is higher than the read / write efficiency (or read / write duration) of the hard disk controller when performing read / write tasks based on the first FTL algorithm over a period of time.
[0109] In some embodiments, the hard disk controller determines a second FTL algorithm from a plurality of FTL algorithms based on a received target instruction, wherein the target instruction indicates the second FTL algorithm. Specific implementation details of this embodiment will be described in subsequent embodiments; please refer to Part II of the embodiments of this application for details. Figure 4 The embodiments shown are not described in detail here.
[0110] In other embodiments, the hard disk controller determines a second FTL algorithm from multiple FTL algorithms based on the read / write data of multiple read / write tasks processed using the first FTL algorithm over a period of time. Specific implementation details of this embodiment will be described in subsequent embodiments; please refer to Part III of the embodiments of this application for details. Figure 5 The embodiments shown are not described in detail here.
[0111] For example, the hard disk controller determines a second FTL algorithm from multiple FTL algorithms according to a preset cycle, based on the read and write status of multiple read and write tasks processed by the first FTL algorithm within a certain period before the start time of each execution cycle.
[0112] It should be noted that the specific duration of the preset period is not limited in the embodiments of this application. For example, the preset period can be 24 hours, 48 hours, etc.
[0113] It should be noted that, based on the type of the second FTL algorithm and the read / write types of multiple read / write tasks over a period of time, it can be determined whether the read / write performance of the hard disk controller when executing multiple read / write tasks based on the second FTL algorithm over a period of time is higher than that of the hard disk controller when executing multiple read / write tasks based on the first FTL algorithm over a period of time. In other words, it is not necessary to actually compare the read / write performance of the hard disk controller when executing multiple read / write tasks based on the second FTL algorithm over a period of time with that of the hard disk controller when executing multiple read / write tasks based on the first FTL algorithm over a period of time.
[0114] S303: The hard disk controller enables the target address mapping information determined based on the second FTL algorithm.
[0115] The phrase "the hard disk controller enables the target address mapping information determined by the second FTL algorithm" means that the hard disk controller executes the received read / write tasks based on the target address mapping information determined by the second FTL algorithm.
[0116] Optionally, the method further includes: if the number of read / write tasks received in the most recent time period is less than or equal to a preset value, then restarting the solid-state drive.
[0117] In some embodiments, if the hard disk controller detects that the number of read / write tasks received in the recent time period is low, less than or equal to a preset value, the hard disk controller will restart the solid-state drive to restore the hard disk.
[0118] It should be noted that the specific duration of the most recent time period is not limited in the embodiments of this application. For example, it can be 10 minutes, 20 minutes, 30 minutes, etc. The specific duration can be dynamically determined according to the actual situation.
[0119] It should be noted that the specific value of the preset value is not limited in the embodiments of this application, and the preset value can be dynamically determined according to the actual situation.
[0120] Optionally, the method further includes: generating a mapping table between the target logical address of the solid-state drive and the target physical address of the solid-state drive based on the second FTL algorithm when the solid-state drive restarts.
[0121] The mapping table includes target address mapping information, where the target logical address is the logical address of the data already written to the target solid-state drive, and the target physical address is the physical address of the data already written to the solid-state drive.
[0122] In some embodiments, when the solid-state drive (SSD) restarts, the SSD controller generates a mapping table between target logical addresses and target physical addresses based on a second FTL algorithm stored in the flash memory chip, and updates the old mapping table in the memory chip with the newly generated mapping table. Afterward, the SSD controller instructs the flash memory controller to write the updated mapping table back to the flash memory chip.
[0123] Optionally, the method further includes: if the FTL algorithm corresponding to the historical mapping table of the flash memory chip is different from the second FTL algorithm, then based on the second FTL algorithm, a mapping table between the target logical address of the solid-state drive and the target physical address of the solid-state drive is generated.
[0124] In some embodiments, by determining whether the FTL algorithm corresponding to the historical mapping table stored in the flash memory chip is the same as the second FTL algorithm, and generating a new mapping table based on the second FTL algorithm when they are different, it helps to avoid repeatedly generating mapping tables with the same structure.
[0125] Optionally, S303 specifically includes: the hard disk controller executing the received target read / write task based on the target address mapping information determined by the second FTL algorithm.
[0126] Among them, the read and write performance of the hard disk controller when performing target read and write tasks based on the target address mapping information determined by the second FTL algorithm is higher than that of the hard disk controller when performing target read and write tasks based on the first FTL algorithm.
[0127] The read / write type of the target read / write task is the same as the target read / write type determined in the following embodiments.
[0128] In some embodiments, a first computer device receives a target read / write task sent by a second computer device and sends the target read / write task to the hard disk controller of the solid-state drive.
[0129] In some embodiments, the target read / write task is specifically a read task, and therefore includes the logical address 1 of the data to be read. In other embodiments, the target read / write task is specifically a write task, and therefore includes the data to be written and the logical address 2 to which the data to be written is to be written.
[0130] If the target read / write task is specifically a read task, the hard disk controller queries the mapping table generated based on the second FTL algorithm to find the physical address 1 corresponding to the logical address 1 in the target address mapping information 1. Then, the hard disk controller sends the physical address 1 to the flash memory controller and instructs the flash memory controller to read the data stored at physical address 1 from the flash memory chip.
[0131] If the target read / write task is specifically a write task, the hard disk controller queries the mapping table generated based on the second FTL algorithm to find the physical address 2 corresponding to the logical address 2 in the target address mapping information 2. Then, the hard disk controller sends the physical address 2 and the data to be written carried by the write task to the flash memory controller, and instructs the flash memory controller to write the data to be written to the flash memory chip according to the physical address 2.
[0132] In the above embodiments, the solid-state drive (SSD) pre-stores multiple FTL algorithms, including a first FTL algorithm. The SSD determines address mapping information based on the first FTL algorithm over a period of time to indicate the correspondence between the SSD's logical and physical addresses during read / write tasks. Then, the SSD determines a second FTL algorithm from the multiple FTL algorithms and uses the target address mapping information determined by the second FTL algorithm to indicate the correspondence between the SSD's logical and physical addresses during subsequent read / write tasks. Since the read / write tasks processed by the SSD over a relatively long period are usually of the same type, and the performance of processing read / write tasks based on the second FTL algorithm is higher than that based on the first FTL algorithm, using the target address mapping information determined by the second FTL algorithm helps improve read / write efficiency during subsequent read / write tasks, thereby improving the SSD's read / write performance.
[0133] Furthermore, the performance of the second FTL algorithm in processing read and write tasks over a period of time is higher than that of the first FTL algorithm, indicating that the second FTL algorithm is a better match for solid-state drives (SSDs) for read and write tasks over a period of time. Using the second FTL algorithm, which is better matched to the read and write tasks over this period of time, can also help improve the lifespan of SSDs.
[0134] The above is the first part of the embodiments of this application. The following, in conjunction with... Figure 4 This section introduces the second part of the embodiments of this application. Specifically, it describes a specific implementation of S302.
[0135] Figure 4 This is a flowchart illustrating a method for determining an FTL algorithm according to an exemplary embodiment. Exemplarily, the method includes steps S401-S403.
[0136] S401: See S301 above.
[0137] S402: The hard disk controller determines a second FTL algorithm from multiple FTL algorithms based on the received target instruction.
[0138] The target instruction specifies the second FTL algorithm.
[0139] In some embodiments, a user sends a target instruction to a first computer device via a computer device, for example, via a second computer device, or via a computer device other than the first and second computer devices. After receiving the target instruction, the CPU of the first computer device sends it to the hard disk controller. Upon receiving the target instruction, the hard disk controller determines a second FTL algorithm from among multiple FTL algorithms based on the content of the target instruction.
[0140] Optionally, the target instruction includes an identifier for the second FTL algorithm.
[0141] S402 specifically includes: determining the second FTL algorithm from multiple FTL algorithms based on the identifier of the second FTL algorithm.
[0142] The identifier for each FTL algorithm corresponds one-to-one with the FTL algorithm itself; that is, different FTL algorithms have different identifiers. For example, the identifier can be the name of the FTL algorithm, such as the BAN algorithm, DFTL algorithm, or FAST algorithm.
[0143] In some embodiments, after receiving the target instruction, the hard disk controller identifies the algorithm with the identifier among multiple FTL algorithms as the second FTL algorithm.
[0144] Optionally, the target instruction includes an identifier of the target read / write type. The target read / write type is determined by multiple read / write tasks processed according to the first FTL algorithm.
[0145] In this embodiment, the target read / write type can be determined manually, or it can be determined by the user through the computer device. This application embodiment does not limit this.
[0146] S402 specifically includes: determining a second FTL algorithm from multiple FTL algorithms based on the identifier of the target read / write type.
[0147] The identifier for each read / write type corresponds one-to-one with the read / write type; that is, different read / write types have different identifiers. For example, the identifier can be the name of the read / write type, such as read task, write task, sequential read task, random read task, etc.
[0148] In some embodiments, the memory chip or flash memory chip pre-stores multiple correspondences between multiple read / write types and multiple FTL algorithms. For example, write tasks correspond to FTL algorithms, read tasks correspond to BAN algorithms, etc. After receiving the target instruction, the hard disk controller determines the target correspondence from the multiple correspondences. The target correspondence includes the identifier of the target read / write type, and determines the FTL algorithm in the target correspondence as the second FTL algorithm.
[0149] S403: See S303 above.
[0150] In the above embodiments, the solid-state drive (SSD) can determine a second FTL algorithm from multiple FTL algorithms based on a received target instruction indicating the second FTL algorithm. Thus, the user can update the FTL algorithm used by the SSD by sending an instruction indicating the FTL algorithm to the SSD. Based on this, if the user finds that the read / write tasks performed by the SSD over a period of time do not match the first FTL algorithm currently used by the SSD, they can send a target instruction indicating the second FTL algorithm to the SSD to control the SSD to use an FTL algorithm that matches the read / write tasks performed over a period of time, thereby improving the performance of the SSD.
[0151] The above is the second part of the embodiments of this application. The following, in conjunction with... Figure 5 This section introduces the third part of the embodiments of this application. Specifically, it describes another specific implementation of S301.
[0152] Figure 5 This is a flowchart illustrating a method for determining an FTL algorithm according to an exemplary embodiment. Exemplarily, the method includes steps S501-S503.
[0153] S501: See S301 above.
[0154] S502: The hard disk controller determines the second FTL algorithm from multiple FTL algorithms based on the read and write status of multiple read and write tasks processed by the first FTL algorithm over a period of time.
[0155] Optionally, read / write status includes read / write type, read / write ratio of different read / write types, etc.
[0156] In one classification method, read / write types include read tasks and write tasks. In another classification method, read / write types include sequential read tasks, sequential write tasks, random write tasks, and random read tasks.
[0157] Optionally, S502 specifically includes the following S502a-S502b.
[0158] S502a: Determine the target read / write type based on the read / write status of multiple read / write tasks processed by the first FTL algorithm over a period of time.
[0159] In some embodiments, the hard disk controller determines the target read / write type based on the proportion of different read / write types in multiple read / write tasks. The specific implementation of this embodiment will be described in detail in subsequent embodiments, specifically referring to S602 and S702, and will not be elaborated upon here.
[0160] In other embodiments, the hard disk controller determines the target read / write type based on the proportion of different read / write types in multiple read / write tasks, and the fluctuation of the proportion of different read / write types within a target time period. The specific implementation of this embodiment will be described in detail in subsequent embodiments, specifically referring to S602 and S702, and will not be elaborated upon here.
[0161] Optionally, the target read / write task can be either a read task or a write task. By dividing the target read / write type into two types, read and write tasks, multiple FTL algorithms only need to include the FTL algorithm matching the read task and the FTL algorithm matching the write task. This helps reduce the number of FTL algorithms that the solid-state drive needs to store, thereby reducing the storage space occupied by the FTL algorithms. Furthermore, it helps shorten the time required to traverse multiple FTL algorithms, thus improving the speed of determining the second FTL algorithm matching the target read / write type from multiple FTL algorithms.
[0162] Optionally, the target read / write type can be a random read task, a random write task, a sequential read task, or a sequential write task. By classifying the target read / write type into four types—sequential read tasks, sequential write tasks, random write tasks, and random read tasks—the accuracy of the read / write type classification is improved, thereby increasing the precision of the read / write type classification. This helps to improve the matching degree between the determined second FTL algorithm and the target read / write type, and thus helps to significantly improve the performance of the second FTL algorithm in processing read / write tasks over a period of time.
[0163] S502b: Determines the second FTL algorithm from multiple FTL algorithms based on the target read / write type.
[0164] In some embodiments, the memory chip or flash memory chip pre-stores multiple correspondences between multiple read / write types and multiple FTL algorithms, such as the correspondence between write tasks and FTL algorithms, the correspondence between read tasks and BAN algorithms, etc. After determining the target read / write type, the hard disk controller determines the target correspondence from the multiple correspondences. The target correspondence includes the target read / write type, and the FTL algorithm in the target correspondence is determined as the second FTL algorithm.
[0165] Optionally, if the target read / write type is a write task, then the DFTL algorithm is selected as the second FTL algorithm from multiple FTL algorithms. If the target read / write type is a read task, then the BAN algorithm is selected as the second FTL algorithm from multiple FTL algorithms.
[0166] Optionally, if the target read / write type is a random read task or a sequential read task, then the BAN algorithm is selected as the second FTL algorithm from multiple FTL algorithms. If the target read / write type is a random write task, then the DFTL algorithm is selected as the second FTL algorithm from multiple FTL algorithms. If the target read / write type is a sequential write task, then the FAST algorithm is selected as the second FTL algorithm from multiple FTL algorithms.
[0167] S503: See S303 above.
[0168] In the above embodiments, the solid-state drive automatically determines the second FTL algorithm from multiple FTL algorithms based on multiple read and write tasks processed by the first FTL algorithm within a certain period of time. In this way, the solid-state drive can automatically update the FTL algorithm it uses without user intervention, which helps to improve the convenience of FTL algorithm updates.
[0169] The above is the third part of the embodiments of this application. The following, in conjunction with... Figure 6 This section introduces the fourth part of the embodiments of this application. Specifically, it describes a specific implementation of S502.
[0170] It should be noted that in this implementation, the read / write tasks include both read tasks and write tasks.
[0171] Figure 6 This is a flowchart illustrating a method for determining an FTL algorithm according to an exemplary embodiment. Exemplarily, the method includes steps S601-S604.
[0172] S601: See S501 above.
[0173] S602: The hard disk controller determines the target read / write type based on the proportion of read tasks in multiple read / write tasks and / or the proportion of write tasks in multiple read / write tasks.
[0174] The following describes various implementation methods of S602 through methods 1 to 3.
[0175] Method 1: Determine the target read / write type based on the proportion of read tasks among multiple read / write tasks.
[0176] In some embodiments, the hard disk controller can determine the target read / write type based solely on the proportion of read tasks among multiple read / write tasks. Since the proportion of read tasks among multiple read / write tasks can characterize the ratio of read tasks to write tasks over a period of time, determining the target read / write type based on the proportion of read tasks not only ensures the accuracy of the determination result but also helps to simplify the determination process, thereby improving the speed at which the determination result is obtained.
[0177] For example, if the proportion of read tasks in multiple read / write tasks is greater than a threshold 'a', it indicates that there are more read tasks than write tasks. Based on this, the target read / write type can be determined as a read task. If the proportion of read tasks is less than the threshold 'a', it indicates that there are fewer read tasks than write tasks. Based on this, the target read / write type can be determined as a write task.
[0178] In one example, the threshold 'a' can be 50%. Since read and write tasks are categorized into read tasks and write tasks, setting the threshold 'a' to 50% is accurate for each read and write task in multiple read and write tasks, as the read and write type of each task is either a read task or a write task.
[0179] In another example, the threshold 'a' can also be greater than 50%, for example, 60%, 65%, etc. If the current application scenario primarily requires ensuring the read and write performance of the SSD when performing write tasks, the threshold 'a' can be set to be greater than 50% to increase the metric for determining the target read / write type as a read task, thereby increasing the probability that the target type is determined as a write task, which in turn helps to ensure the read and write performance of the SSD when performing write tasks.
[0180] In other embodiments, the hard disk controller may determine the target read / write type based on the proportion of read tasks among multiple read / write tasks and the fluctuation of the proportion of read tasks within a target time period.
[0181] The duration of the target time period is less than or equal to the duration of a period of time.
[0182] For example, when a hard disk controller determines the target read / write type based on multiple read / write tasks within a certain period, the target time period can be that period. For instance, if the current time is 16:00 on October 10, 2022, and the multiple read / write tasks within a certain period specifically refer to multiple read / write tasks within a 24-hour period, i.e., multiple read / write tasks between 16:00 on October 10, 2022 and 16:00 on October 9, 2022, then the target time period is the 24 hours between 16:00 on October 10, 2022 and 16:00 on October 9, 2022.
[0183] Since the fluctuation of the proportion of read tasks within the target time period can reflect the distribution of read tasks in different sub-time periods of the target time period, the fluctuation of read tasks within the target time period can be used to analyze the proportion of read tasks in different time periods within the target time period. For example, if the proportion of read tasks fluctuates greatly within the target time period, it indicates that the proportion of read tasks varies greatly in different time periods. Conversely, if the proportion of read tasks fluctuates little within the target time period, it indicates that the number of read tasks varies little in different time periods.
[0184] Therefore, if the proportion of read tasks fluctuates significantly within the target time period, and the proportion of read tasks is relatively small for most of the time periods, with a large proportion only in a few specific periods, it indicates that the read / write tasks processed by the SSD most of the time are write tasks. Thus, by combining the proportion of read tasks with their fluctuations, we can analyze the read / write type of the read / write tasks processed by the SSD most of the time. This allows us to determine the target read / write type based on the read / write type of the tasks executed by the SSD most of the time, thereby helping to ensure the read / write performance of the SSD most of the time.
[0185] In one example, if the proportion of read tasks in multiple read / write tasks is greater than or equal to the first threshold, and the fluctuation ratio of the proportion of read tasks within the target time period is less than or equal to the second threshold, the target read / write type is determined to be a read task.
[0186] In another example, if the proportion of read tasks among multiple read and write tasks is less than the first threshold, and the fluctuation ratio of the proportion of read tasks within the target time period is greater than the second threshold, the target read and write type is determined to be a write task.
[0187] In another example, if the proportion of read tasks among multiple read and write tasks is less than the first threshold, and the fluctuation ratio of the proportion of read tasks within the target time period is less than or equal to the second threshold, the target read and write type is determined to be a write task.
[0188] In another example, if the proportion of read tasks in multiple read and write tasks is greater than or equal to the first threshold, and the fluctuation ratio of the proportion of read tasks within the target time period is greater than the second threshold, the target read and write type is determined to be a write task.
[0189] In some embodiments, the target time period can be divided into multiple sub-time periods, and the fluctuation ratio of the proportion of read tasks within the target time period can be determined by the difference between the proportions of any two sub-time periods.
[0190] For example, let A be the proportion of read tasks among multiple read and write tasks. Divide the target time period into time period 1, time period 2, and time period 3. In time period 1, the proportion of read tasks is A1; in time period 2, the proportion of read tasks is A2; and in time period 3, the proportion of read tasks is A3. If the difference between A and A1 (1), the difference between A and A2 (2), and the difference between A and A3 (3) are all less than or equal to a second threshold, then the fluctuation of the proportion of read tasks within the target time period is less than or equal to the second threshold. Otherwise, the fluctuation of the proportion of read tasks within the target time period is greater than the second threshold.
[0191] It should be noted that the durations of different sub-time periods may be equal or unequal, and this application embodiment does not impose any restrictions on this.
[0192] It should be noted that the specific values of the first threshold and the second threshold are not limited in the embodiments of this application.
[0193] For example, the first threshold could be 70%, etc., and the second threshold could be 10%, etc.
[0194] Based on this, if the proportion of read tasks in multiple read and write tasks is greater than or equal to 70%, and the fluctuation ratio of the proportion of read tasks within the target time period is less than or equal to 10%, then the target read and write type is determined to be a read task.
[0195] In Method 1, the target read / write type is determined solely based on the proportion of read tasks among multiple read / write tasks. Since the proportion of read tasks among multiple read / write tasks can characterize the ratio of read tasks to write tasks over a period of time, determining the target read / write type based on the proportion of read tasks not only ensures the accuracy of the determination result but also helps to simplify the determination process, thereby increasing the speed at which the determination result is obtained.
[0196] Method 2: Determine the target read / write type based on the proportion of write tasks among multiple read / write tasks.
[0197] In some embodiments, the hard disk controller may determine the target read / write type based solely on the proportion of write tasks among multiple read / write tasks.
[0198] In other embodiments, the hard disk controller may determine the target read / write type based on the proportion of write tasks among multiple read / write tasks and the fluctuation of the proportion of write tasks within a target time period.
[0199] In one example, if the proportion of write tasks in multiple read / write tasks is greater than or equal to the third threshold, and the fluctuation ratio of the proportion of write tasks is less than or equal to the fourth threshold, the target read / write type is determined to be a write task.
[0200] In another example, if the proportion of write tasks in multiple read / write tasks is less than the third threshold and the fluctuation ratio of the proportion of write tasks is greater than the fourth threshold, the target read / write type is determined to be a read task.
[0201] In another example, if the proportion of write tasks in multiple read / write tasks is greater than or equal to the third threshold, and the fluctuation ratio of the proportion of write tasks is greater than the fourth threshold, the target read / write type is determined to be a read task.
[0202] In another example, if the proportion of write tasks among multiple read and write tasks is less than the third threshold, and the fluctuation ratio of the proportion of write tasks is less than or equal to the fourth threshold, the target read and write type is determined to be a read task.
[0203] It should be noted that the first threshold and the third threshold can be the same or different, and this application embodiment does not impose any restrictions on this. Furthermore, this application embodiment does not impose any restrictions on whether the second threshold and the fourth threshold are the same.
[0204] It should be noted that the implementation principle of method 2 is the same as that of method 1. Therefore, for the implementation process and related explanations of method 2, please refer to the implementation process and related explanations of method 1 above. It will not be elaborated here.
[0205] In Method 2, the target read / write type is determined solely based on the proportion of write tasks among multiple read / write tasks. Since the proportion of write tasks among multiple read / write tasks can characterize the ratio of write tasks to read tasks over a period of time, determining the target read / write type by the proportion of write tasks not only ensures the accuracy of the determination result but also helps to simplify the determination process, thereby increasing the speed at which the determination result is obtained.
[0206] Method 3: Determine the target read / write type based on the proportion of read tasks and the proportion of write tasks among multiple read / write tasks.
[0207] In some embodiments, the hard disk controller may determine the target read / write type based solely on the proportion of read tasks and the proportion of write tasks among multiple read / write tasks.
[0208] Optionally, if the proportion of read tasks and the proportion of write tasks are both less than threshold b, and the proportion of write tasks is greater than threshold c, the target read / write type is determined to be a write task.
[0209] Since the FTL algorithm has a greater impact on the read and write efficiency of write tasks than read tasks, setting the proportion of both read and write tasks to be less than threshold b and the proportion of write tasks to be greater than threshold c, and determining the target read and write type as write tasks, helps to improve the read and write efficiency of solid-state drives when performing write tasks, thereby helping to improve the overall read and write performance of solid-state drives.
[0210] It should be noted that the specific values of threshold b and threshold c are not limited in the embodiments of this application. For example, threshold b can be 60% and threshold c can be 50%.
[0211] In other embodiments, the hard disk controller can determine the target read / write type based on the proportion of read tasks among multiple tasks, the fluctuation of the proportion of read tasks within a target time period, and the proportion of write tasks.
[0212] In some other embodiments, the hard disk controller can determine the target read / write type based on the proportion of read tasks, the proportion of write tasks, and the fluctuation of the proportion of write tasks within a target time period.
[0213] In some other embodiments, the hard disk controller can determine the target read / write type based on the proportion of read tasks among multiple read / write tasks, the fluctuation of the proportion of read tasks within a target time period, the proportion of write tasks, and the fluctuation of the proportion of write tasks within a target time period.
[0214] It should be noted that the implementation principle of method 3 is the same as that of method 1. Therefore, for the implementation process and related explanations of method 3, please refer to the implementation process and related explanations of method 1 above. It will not be elaborated here.
[0215] In Method 3, the target read / write type is determined by analyzing the proportion of read tasks and the proportion of write tasks among multiple read / write tasks. This allows for a more comprehensive analysis of the proportion of read tasks and the proportion of write tasks among multiple read / write tasks, which helps improve the accuracy of the determined target read / write type.
[0216] S603: The hard disk controller determines a second FTL algorithm from multiple FTL algorithms based on the target read / write type.
[0217] It should be noted that the implementation principle of S603 is the same as that of S502b. Therefore, the implementation process and related explanations of S603 can be found in the implementation process and related explanations of S502b mentioned above, and will not be elaborated here.
[0218] S604: See S503 above.
[0219] In the above embodiments, the read / write tasks are divided into read tasks and write tasks. Therefore, multiple FTL algorithms only need to include FTL algorithms matching read tasks and FTL algorithms matching write tasks. This helps reduce the number of FTL algorithms that the solid-state drive needs to store, thereby reducing the storage space occupied by FTL algorithms. Furthermore, it helps shorten the time required to traverse multiple FTL algorithms, thus improving the speed of determining the second FTL algorithm matching the target read / write type from multiple FTL algorithms. Additionally, since the proportion reflects the number of read and write tasks, determining the target read / write type by the proportion of read tasks and / or the proportion of write tasks in multiple read / write tasks not only ensures the accuracy of the determination results but also simplifies the analysis process and improves analysis speed.
[0220] The above is the fourth part of the embodiments of this application. The following, in conjunction with... Figure 7 This section introduces the fifth part of the embodiments of this application. Specifically, it describes another specific implementation of S502.
[0221] It should be noted that in this implementation, the read / write tasks include random read tasks, random write tasks, sequential read tasks, and sequential write tasks.
[0222] Figure 7 This is a flowchart illustrating a method for determining an FTL algorithm according to an exemplary embodiment. Exemplarily, the method includes steps S701-S704.
[0223] S701: See S601 above.
[0224] S702: The hard disk controller determines the target read / write type based on at least one of the following: the proportion of random read tasks in multiple read / write tasks, the proportion of sequential read tasks in multiple read / write tasks, the proportion of random write tasks in multiple read / write tasks, and the proportion of sequential write tasks in multiple read / write tasks.
[0225] The following examples illustrate various implementations of S702 using methods a to d.
[0226] It should be noted that the implementation of S702 is not limited to the following methods a to d. Other combinations of the proportion of random read tasks, the proportion of sequential read tasks, the proportion of random write tasks, and the proportion of sequential write tasks in multiple read and write tasks are also applicable to the embodiments of this application. Since the implementation principle of other combinations is the same as that of the following methods a to d, the embodiments of this application will not repeat them.
[0227] Method a: Determine the target read / write type based on the proportion of random read tasks among multiple read / write tasks.
[0228] In some embodiments, the hard disk controller determines the target read / write type based solely on the proportion of random read tasks among multiple read / write tasks.
[0229] In other embodiments, the hard disk controller determines the target read / write type based on the proportion of random read tasks among multiple read / write tasks and the fluctuation of the proportion of random read tasks within a target time period.
[0230] For example, if the proportion of random read tasks in multiple read and write tasks is greater than or equal to the fifth threshold, and the fluctuation ratio of the proportion of random read tasks within the target time period is less than or equal to the sixth threshold, the target read and write type is determined to be a random read task.
[0231] It should be noted that the implementation principle of the above method a is the same as that of method 1 in S602. Therefore, for the implementation process and related explanations of the above method a, please refer to the implementation process and related explanations of method 1 in S602. It will not be elaborated here.
[0232] It should be noted that determining the target read / write type based on the proportion of sequential read tasks, random write tasks, or sequential write tasks within multiple read / write tasks is the same principle as method a above, and will not be repeated here. The following only explains the differences: Based on the proportion of sequential read tasks among multiple read and write tasks and the fluctuation of the proportion of sequential read tasks within the target time period, the target read and write type is determined, including: if the proportion of sequential read tasks among multiple read and write tasks is greater than or equal to the seventh threshold, and the fluctuation ratio of the proportion of sequential read tasks within the target time period is less than or equal to the eighth threshold, the target read and write type is determined to be a sequential read task.
[0233] Based on the proportion of random write tasks among multiple read and write tasks and the fluctuation of the proportion of random write tasks within the target time period, the target read and write type is determined, including: if the proportion of random write tasks among multiple read and write tasks is greater than or equal to the ninth threshold, and the fluctuation ratio of the proportion of random write tasks within the target time period is less than or equal to the tenth threshold, the target read and write type is determined to be random write task.
[0234] Based on the proportion of sequential write tasks among multiple read and write tasks and the fluctuation of the proportion of sequential write tasks within the target time period, the target read and write type is determined, including: if the proportion of sequential write tasks among multiple read and write tasks is greater than or equal to the eleventh threshold, and the fluctuation ratio of the proportion of sequential write tasks within the target time period is less than or equal to the twelfth threshold, the target read and write type is determined to be a sequential write task.
[0235] Method b: Determine the target read / write type based on the proportion of random read tasks and the proportion of random write tasks among multiple read / write tasks.
[0236] In some embodiments, the hard disk controller may determine the target read / write type based solely on the proportion of random read tasks and the proportion of random write tasks among multiple read / write tasks.
[0237] In other embodiments, the hard disk controller can determine the target read / write type based on the proportion of random read tasks among multiple read / write tasks and the fluctuation of the proportion of random read tasks within a target time period, the proportion of random write tasks among multiple read / write tasks and the fluctuation of the proportion of random write tasks within a target time period.
[0238] It should be noted that the implementation principle of method b above is the same as that of method 3 in S602. Therefore, for the implementation process and related explanations of method b above, please refer to the implementation process and related explanations of method 3 in S602 above. It will not be elaborated here.
[0239] Method c: Determine the target read / write type based on the proportion of sequential read tasks and the proportion of sequential write tasks among multiple read / write tasks.
[0240] In some embodiments, the hard disk controller may determine the target read / write type based solely on the proportion of sequential read tasks and the proportion of sequential write tasks among multiple read / write tasks.
[0241] In other embodiments, the hard disk controller can determine the target read / write type based on the proportion of sequential read tasks among multiple read / write tasks and the fluctuation of the proportion of sequential read tasks within a target time period, the proportion of sequential write tasks among multiple read / write tasks and the fluctuation of the proportion of sequential write tasks within a target time period.
[0242] It should be noted that the implementation principle of the above method c is the same as that of the implementation principle of method 3 in S602. Therefore, for the implementation process and related explanations of the above method c, please refer to the implementation process and related explanations of the above method 3 in S602. It will not be elaborated here.
[0243] Method d: Determine the target read / write type based on the proportion of random read tasks, the proportion of sequential read tasks, the proportion of random write tasks, and the proportion of sequential write tasks among multiple read / write tasks.
[0244] In some embodiments, the hard disk controller may determine the target read / write type based solely on the proportion of random read tasks, the proportion of sequential read tasks, the proportion of random write tasks, and the proportion of sequential write tasks among multiple read / write tasks.
[0245] In other embodiments, the hard disk controller can determine the target read / write type based on the proportion of random read tasks and the fluctuation of the proportion of random read tasks within a target time period, the proportion of sequential read tasks and the fluctuation of the proportion of sequential read tasks within a target time period, the proportion of random write tasks and the fluctuation of the proportion of random write tasks within a target time period, and the proportion of sequential write tasks and the fluctuation of the proportion of sequential write tasks within a target time period.
[0246] It should be noted that the implementation principle of the above method d is the same as that of method 3 in S601. Therefore, for the implementation process and related explanations of the above method d, please refer to the implementation process and related explanations of method 3 in S601. It will not be elaborated here.
[0247] S703-S704: See S603-S604 above.
[0248] In the above embodiments, dividing read / write tasks into sequential read tasks, sequential write tasks, random write tasks, and random read tasks improves the accuracy of read / write type classification. This helps improve the precision of the determined target read / write type, and consequently, helps improve the matching accuracy between the determined second FTL algorithm and the target read / write type. This results in a more significant improvement in the read / write performance of the solid-state drive when performing multiple read / write tasks over a period of time. Furthermore, since the proportion reflects the number of read and write tasks, determining the target read / write type using at least one of the following: the proportion of random read tasks, the proportion of sequential read tasks, the proportion of random write tasks, and the proportion of sequential write tasks among multiple read / write tasks. This not only ensures the accuracy of the determination results but also simplifies the analysis process and improves analysis speed.
[0249] The foregoing mainly describes the solutions provided by the embodiments of this application from a methodological perspective. To achieve the above functions, the apparatus for determining the FTL algorithm includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should readily recognize that, based on the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0250] This application embodiment can, based on the above method, exemplarily divide the apparatus for determining the FTL algorithm into functional modules. For example, the apparatus for determining the FTL algorithm may include functional modules corresponding to each functional division, or two or more functions may be integrated into one processing module. The integrated module can be implemented in hardware or as a software functional module. It should be noted that the module division in this application embodiment is illustrative and only represents one logical functional division; in actual implementation, there may be other division methods.
[0251] For example, Figure 8 A possible structural diagram of the apparatus for determining the FTL algorithm (denoted as FTL algorithm determination apparatus 800) involved in the above embodiments is shown. The FTL algorithm determination apparatus 800 includes a processing unit 801, a determining unit 802, and a control unit 803. The processing unit 801 determines address mapping information based on a first FTL algorithm over a period of time. The address mapping information is used to indicate the correspondence between the logical addresses and physical addresses of the solid-state drive during read / write task processing. For example, Figure 3 S301 as shown, Figure 4 S401 as shown, Figure 5 S501 shown in the figure, Figure 6 S601 shown, and Figure 7 S701 is shown. The determining unit 802 is used to determine a second FTL algorithm from multiple FTL algorithms; wherein the performance of processing read / write tasks over a period of time based on the second FTL algorithm is higher than the performance of processing read / write tasks over a period of time based on the first FTL algorithm. For example, Figure 3 S302 as shown, Figure 4 S402 as shown, Figure 5 S502 shown in the figure, Figure 6 S602-S603 shown, and Figure 7The S702-S703 shown are examples. Control unit 803 is used to control the solid-state drive to enable the target address mapping information determined based on the second FTL algorithm. For example, Figure 3 S303 as shown, Figure 4 S403 as shown, Figure 5 S503 shown in the figure, Figure 6 The S604 shown, and Figure 7 The S704 shown.
[0252] Optionally, the determining unit 802 is specifically used to: determine a second FTL algorithm from multiple FTL algorithms based on multiple read / write tasks processed by the first FTL algorithm within a certain period of time.
[0253] Optionally, the determining unit 802 is specifically used to: determine the target read / write type based on the read / write status of multiple read / write tasks; and determine a second FTL algorithm from multiple FTL algorithms based on the target read / write type.
[0254] Optionally, the target read / write type includes read tasks and write tasks; wherein, if the target read / write type is a write task, the second FTL algorithm includes the DFTL algorithm; if the target read / write type is a read task, the second FTL algorithm includes the BAN algorithm.
[0255] Optionally, the target read / write type includes sequential read task, sequential write task, random write task, and random read task; wherein, if the target read / write type is a sequential read task or a random read task, the second FTL algorithm includes the BAN algorithm; if the target read / write type is a sequential write task, the second FTL algorithm includes the FAST algorithm; and if the target read / write type is a random write task, the second FTL algorithm includes the DFTL algorithm.
[0256] Optionally, the determining unit 802 is specifically used to: determine the target read / write type based on the proportion of read tasks in multiple read / write tasks, and / or the proportion of write tasks in multiple read / write tasks.
[0257] Optionally, the determining unit 802 is specifically used to: determine the target read / write type based on the proportion of read tasks among multiple read / write tasks and the fluctuation of the proportion of read tasks within a target time period, and / or the proportion of write tasks among multiple read / write tasks and the fluctuation of the proportion of write tasks within a target time period.
[0258] Optionally, the determining unit 802 is specifically used to: determine the target read / write type as a read task if the proportion of read tasks in multiple read / write tasks is greater than or equal to a first threshold and the fluctuation ratio of the proportion of read tasks in the target time period is less than or equal to a second threshold.
[0259] Optionally, the determining unit 802 is specifically used to: determine the target read / write type as a write task if the proportion of write tasks in multiple read / write tasks is greater than or equal to the third threshold, and the fluctuation ratio of the proportion of write tasks in the target time period is less than or equal to the fourth threshold.
[0260] Optionally, the determining unit 802 is specifically used to: determine the target read / write type based on at least one of the following: the proportion of random read tasks in multiple read / write tasks, the proportion of sequential read tasks in multiple read / write tasks, the proportion of random write tasks in multiple read / write tasks, and the proportion of sequential write tasks in multiple read / write tasks.
[0261] Optionally, the determining unit 802 is specifically used to: determine the target read / write type based on at least one of the following: the proportion of random read tasks and the fluctuation of the proportion of random read tasks within a target time period; the proportion of sequential read tasks and the fluctuation of the proportion of sequential read tasks within a target time period; the proportion of random write tasks and the fluctuation of the proportion of random write tasks within a target time period; and the proportion of sequential write tasks and the fluctuation of the proportion of sequential write tasks within a target time period.
[0262] Optionally, the determining unit 802 is specifically used to: determine the target read / write type as a random read task if the proportion of random read tasks in multiple read / write tasks is greater than or equal to the fifth threshold, and the fluctuation ratio of the proportion of random read tasks in the target time period is less than or equal to the sixth threshold.
[0263] Optionally, the determining unit 802 is specifically used to: determine the target read / write type based on the proportion of sequential read tasks in multiple read / write tasks and the fluctuation of the proportion of sequential read tasks within the target time period, including: if the proportion of sequential read tasks in multiple read / write tasks is greater than or equal to the seventh threshold, and the fluctuation ratio of the proportion of sequential read tasks within the target time period is less than or equal to the eighth threshold, the target read / write type is determined to be a sequential read task.
[0264] Optionally, the determining unit 802 is specifically used to: determine the target read / write type based on the proportion of random write tasks in multiple read / write tasks and the fluctuation of the proportion of random write tasks in the target time period, including: if the proportion of random write tasks in multiple read / write tasks is greater than or equal to the ninth threshold, and the fluctuation ratio of the proportion of random write tasks in the target time period is less than or equal to the tenth threshold, the target read / write type is determined to be a random write task.
[0265] Optionally, the determining unit 802 is specifically used to: determine the target read / write type based on the proportion of sequential write tasks in multiple read / write tasks and the fluctuation of the proportion of sequential write tasks in the target time period, including: if the proportion of sequential write tasks in multiple read / write tasks is greater than or equal to the eleventh threshold, and the fluctuation ratio of the proportion of sequential write tasks in the target time period is less than or equal to the twelfth threshold, the target read / write type is determined to be a sequential write task.
[0266] Optionally, the determining unit 802 is specifically used to: determine a second FTL algorithm from a plurality of FTL algorithms based on the received target instruction; wherein the target instruction indicates the second FTL algorithm.
[0267] Optionally, the determining unit 802 is specifically used for: the target instruction includes an identifier of the second FTL algorithm, and based on the identifier of the second FTL algorithm, determining the second FTL algorithm from multiple FTL algorithms.
[0268] Optionally, the determining unit 802 is specifically used for: the target instruction includes an identifier of the target read / write type, and based on the identifier of the target read / write type, a second FTL algorithm is determined from multiple FTL algorithms; the target read / write type is the read / write type determined by multiple read / write tasks processed according to the first FTL algorithm.
[0269] Optionally, the control unit 803 is further configured to: generate a mapping table between the target logical address and the target physical address of the solid-state drive based on the second FTL algorithm when the solid-state drive restarts; wherein the mapping table includes target address mapping information, the target logical address is the logical address of the target solid-state drive where data has been written, and the target physical address is the physical address of the solid-state drive where data has been written.
[0270] Optionally, the control unit 803 is also configured to: restart the solid-state drive if the number of read / write tasks received in the most recent time period is less than or equal to a preset value.
[0271] For a detailed description of the above-mentioned optional methods, please refer to the foregoing method embodiments, which will not be repeated here. Furthermore, the explanation of any of the above-provided apparatus 800 for determining the FTL algorithm and the description of its beneficial effects can be found in the corresponding method embodiments described above, and will not be repeated here.
[0272] This application also provides a computer device, which includes a processor and a memory. The processor is connected to the memory, and the memory stores computer execution instructions. When the processor executes the computer execution instructions, it implements the data processing method described in the above embodiments. This application does not limit the specific form of the computer device. For example, the computer device can be a terminal device or a network device. The terminal device can be referred to as: terminal, user equipment (UE), terminal device, access terminal, user unit, user station, mobile station, remote station, remote terminal, mobile device, user terminal, wireless communication device, user agent, or user equipment, etc. The terminal device can specifically be a mobile phone, augmented reality (AR) device, virtual reality (VR) device, tablet computer, laptop computer, ultra-mobile personal computer (UMPC), netbook, personal digital assistant (PDA), etc. The network device can specifically be a server, etc. The server can be a single physical or logical server, or two or more physical or logical servers sharing different responsibilities and cooperating to achieve the various functions of the server.
[0273] This application also provides a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to perform the methods executed by any of the computer devices described above.
[0274] For explanations of the relevant content and descriptions of the beneficial effects in any of the computer-readable storage media provided above, please refer to the corresponding embodiments described above, which will not be repeated here.
[0275] This application also provides a chip. The chip integrates control circuitry for implementing the functions of the aforementioned computer device and one or more ports. Optionally, the functions supported by the chip can be referred to above, and will not be repeated here. Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium. The aforementioned storage medium can be a read-only memory, random access memory, etc. The aforementioned processing unit or processor can be a central processing unit, a general-purpose processor, an application-specific integrated circuit (ASIC), a microprocessor (digital signal processor, DSP), a field-programmable gate array (FPGA), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof.
[0276] This application also provides a computer program product containing instructions that, when executed on a computer, cause the computer to perform any of the methods described in the above embodiments. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this application is generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium accessible to a computer or may include one or more data storage devices such as servers or data centers that can be integrated with the medium. The available medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., SSD), etc.
[0277] It should be noted that the devices for storing computer instructions or computer programs provided in the embodiments of this application, such as but not limited to the memory, computer-readable storage medium and communication chip, are all non-transitory.
[0278] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented using software programs, implementation can be, in whole or in part, in the form of a computer program product. This computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this application is generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device containing one or more servers, data centers, etc., that can be integrated with the medium. The available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state disks, SSDs).
[0279] Although this application has been described herein in conjunction with various embodiments, those skilled in the art, by reviewing the accompanying drawings, disclosure, and appended claims, will understand and implement other variations of the disclosed embodiments in carrying out the claimed application. In the claims, the word "comprising" does not exclude other components or steps, and "a" or "an" does not exclude multiple instances. A single processor or other unit can implement several functions listed in the claims. While different dependent claims may recite certain measures, this does not mean that these measures cannot be combined to produce good results.
[0280] Although this application has been described in conjunction with specific features and embodiments, it is obvious that various modifications and combinations can be made thereto without departing from the spirit and scope of this application. Accordingly, this specification and drawings are merely exemplary illustrations of this application as defined by the appended claims, and are considered to cover any and all modifications, variations, combinations, or equivalents within the scope of this application. Clearly, those skilled in the art can make various alterations and modifications to this application without departing from the spirit and scope of this application. Thus, if such modifications and modifications of this application fall within the scope of the claims of this application and their equivalents, this application is also intended to include such modifications and modifications.
Claims
1. A method for determining the Flash Memory Translation Layer (FTL) algorithm, characterized in that, For use in a solid-state drive, the solid-state drive storing multiple FTL algorithms, the multiple FTL algorithms including a first FTL algorithm; the method includes: Address mapping information is determined based on the first FTL algorithm over a period of time. The address mapping information is used to indicate the correspondence between the logical address and the physical address of the solid-state drive during the processing of read and write tasks. The target read / write type is determined based on the read / write status of multiple read / write tasks processed by the first FTL algorithm within the specified time period. Based on the target read / write type, a second FTL algorithm is determined from the plurality of FTL algorithms; wherein, the performance of processing read / write tasks within the time period based on the second FTL algorithm is higher than the performance of processing read / write tasks within the time period based on the first FTL algorithm; When the solid-state drive (SSD) restarts, a mapping table between the target logical address and the target physical address of the SSD is generated based on the second FTL algorithm; wherein, the mapping table includes the target address mapping information, the target logical address is the logical address of the target SSD where data has been written, and the target physical address is the physical address of the SSD where data has been written; Control the solid-state drive to enable the target address mapping information determined based on the second FTL algorithm; Specifically, determining the target read / write type based on the read / write status of multiple read / write tasks processed by the first FTL algorithm within the specified time period includes: determining the target read / write type based on the proportion of read tasks among the multiple read / write tasks, and / or the proportion of write tasks among the multiple read / write tasks.
2. The method according to claim 1, characterized in that, The target read / write types include read tasks and write tasks; Wherein, if the target read / write type is a write task, the second FTL algorithm includes the DFTL algorithm; if the target read / write type is a read task, the second FTL algorithm includes the BAN algorithm.
3. The method according to claim 1, characterized in that, The target read / write types include sequential read tasks, sequential write tasks, random write tasks, and random read tasks; Wherein, if the target read / write type is a sequential read task or a random read task, the second FTL algorithm includes the BAN algorithm; if the target read / write type is a sequential write task, the second FTL algorithm includes the FAST algorithm; if the target read / write type is a random write task, the second FTL algorithm includes the DFTL algorithm.
4. The method according to claim 1, characterized in that, Determining the target read / write type based on the proportion of read tasks among the multiple read / write tasks, and / or the proportion of write tasks among the multiple read / write tasks, includes: The target read / write type is determined based on the proportion of read tasks among the multiple read / write tasks and the fluctuation of the proportion of read tasks within the target time period, and / or the proportion of write tasks among the multiple read / write tasks and the fluctuation of the proportion of write tasks within the target time period.
5. The method according to claim 4, characterized in that, The step of determining the target read / write type based on the proportion of read tasks among the multiple read / write tasks and the fluctuation of the proportion of read tasks within the target time period includes: if the proportion of read tasks among the multiple read / write tasks is greater than or equal to a first threshold, and the fluctuation ratio of the proportion of read tasks within the target time period is less than or equal to a second threshold, then the target read / write type is determined to be a read task; or, The step of determining the target read / write type based on the proportion of write tasks among the multiple read / write tasks and the fluctuation of the proportion of write tasks within the target time period includes: if the proportion of write tasks among the multiple read / write tasks is greater than or equal to a third threshold, and the fluctuation ratio of the proportion of write tasks within the target time period is less than or equal to a fourth threshold, then the target read / write type is determined to be a write task.
6. The method according to claim 4, characterized in that, Based on the read / write status of multiple read / write tasks processed by the first FTL algorithm within the specified time period, the target read / write type is determined, including: The target read / write type is determined based on at least one of the following: the proportion of random read tasks, the proportion of sequential read tasks, the proportion of random write tasks, and the proportion of sequential write tasks among the multiple read / write tasks.
7. The method according to claim 6, characterized in that, The step of determining the target read / write type based on at least one of the following: the proportion of random read tasks, the proportion of sequential read tasks, the proportion of random write tasks, and the proportion of sequential write tasks among the multiple read / write tasks, includes: The target read / write type is determined based on at least one of the following: the proportion of random read tasks and the fluctuation of the proportion of random read tasks within the target time period; the proportion of sequential read tasks and the fluctuation of the proportion of sequential read tasks within the target time period; the proportion of random write tasks and the fluctuation of the proportion of random write tasks within the target time period; and the proportion of sequential write tasks and the fluctuation of the proportion of sequential write tasks within the target time period.
8. The method according to claim 7, characterized in that, The step of determining the target read / write type based on the proportion of random read tasks among the multiple read / write tasks and the fluctuation of the proportion of random read tasks within the target time period includes: if the proportion of random read tasks among the multiple read / write tasks is greater than or equal to a fifth threshold, and the fluctuation ratio of the proportion of random read tasks within the target time period is less than or equal to a sixth threshold, then the target read / write type is determined to be a random read task. Alternatively, the method of determining the target read / write type based on the proportion of sequential read tasks among the multiple read / write tasks and the fluctuation of the proportion of sequential read tasks within the target time period includes: if the proportion of sequential read tasks among the multiple read / write tasks is greater than or equal to a seventh threshold, and the fluctuation ratio of the proportion of sequential read tasks within the target time period is less than or equal to an eighth threshold, then the target read / write type is determined to be a sequential read task. Alternatively, the method of determining the target read / write type based on the proportion of random write tasks among the multiple read / write tasks and the fluctuation of the proportion of random write tasks within the target time period includes: if the proportion of random write tasks among the multiple read / write tasks is greater than or equal to a ninth threshold, and the fluctuation ratio of the proportion of random write tasks within the target time period is less than or equal to a tenth threshold, then the target read / write type is determined to be a random write task. Alternatively, determining the target read / write type based on the proportion of sequential write tasks among the multiple read / write tasks and the fluctuation of the proportion of sequential write tasks within the target time period includes: if the proportion of sequential write tasks among the multiple read / write tasks is greater than or equal to the eleventh threshold, and the fluctuation ratio of the proportion of sequential write tasks within the target time period is less than or equal to the twelfth threshold, then determining the target read / write type as a sequential write task.
9. The method according to claim 1, characterized in that, The method for determining a second FTL algorithm from the plurality of FTL algorithms further includes: Based on the received target instruction, the second FTL algorithm is determined from the plurality of FTL algorithms; wherein the target instruction indicates the second FTL algorithm.
10. The method according to claim 9, characterized in that, Based on the received target instruction, the second FTL algorithm is determined from the plurality of FTL algorithms, including: The target instruction includes an identifier of the second FTL algorithm; based on the identifier of the second FTL algorithm, the second FTL algorithm is determined from the plurality of FTL algorithms; or The target instruction includes an identifier of the target read / write type. Based on the identifier of the target read / write type, the second FTL algorithm is determined from the plurality of FTL algorithms. The target read / write type is the read / write type determined by the plurality of read / write tasks processed according to the first FTL algorithm.
11. The method according to any one of claims 1-10, characterized in that, The method further includes: If the number of read / write tasks received in the recent time period is less than or equal to a preset value, then the solid-state drive will be restarted.
12. A computer device, characterized in that, include: processor; The processor is connected to a memory for storing computer execution instructions, and the processor executes the computer execution instructions stored in the memory to enable the computer device to implement the method as described in any one of claims 1-11.
13. A computer-readable storage medium, characterized in that, Used to store computer instructions that, when executed on a computer, cause the computer to perform the method as described in any one of claims 1-11.
14. A computer program product, characterized in that, The computer program product includes computer execution instructions that, when executed on a computer, cause the computer to perform the method as described in any one of claims 1-11.
Citation Information
Patent Citations
Data storage method of flash memory equipment and flash memory equipment
CN110471861A
Data processing method and device
CN112988066A
Flash memory control devices that support multiple memory mapping schemes and methods of operating same
US20060179212A1