A mapping table management method, system, device and medium
By combining fixed cache areas and dynamically extended cache areas in the storage device, and using the bidirectional linked list to manage the cache unit, the problem of low random read and write performance caused by small cache space of the map table is solved, and higher read and write performance is achieved.
Patent Information
- Application Number
- CN202411181299.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-27
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2044-08-27
AI Technical Summary
The small cache space of mapping tables in existing storage devices leads to low random read and write performance, and frequent switching of mapping tables increases time-consuming, affecting the random read and write performance.
The combination of fixed cache area and dynamic extended cache area is adopted to cache the mapping table by searching the free cache unit of the fixed cache area and applying a cache unit from the dynamic extended cache area or the tail of the bidirectional linked list when it does not exist. The bidirectional linked list manages the usage time sequence of the cache unit, and the dynamic extended cache area provides additional space when needed.
This improves the hit rate of the mapping table, and thus improves the random read and write performance of the storage device.
Smart Images

Figure CN119166541B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and particularly relates to a mapping table management method, system, device, and medium. Background Art
[0002] In a storage device, a fixed-size memory space is generally allocated as a mapping table cache, and its space is often very small.
[0003] The read and write performance of a storage device is an important indicator, especially the random read and write performance. Among them, the random read performance is directly related to the hit rate of the mapping table. The too small mapping table cache space causes the hit rate to decrease, and frequent table switching is required, resulting in low random read performance. In addition, in order to improve the random write performance of the current storage device, a certain amount of new mapping items are often accumulated in the memory and the mapping table is updated centrally at the end. The relatively small mapping table cache space will bring more mapping table read and write switches, increasing the time consumption and ultimately resulting in low random write performance. Summary of the Invention
[0004] In view of this, the purpose of the embodiments of the present invention is to provide a mapping table management method, system, device, and medium, which can improve the random read and write performance of a storage device.
[0005] In a first aspect, an embodiment of the present invention provides a mapping table management method, which is applied to a storage device. The storage device includes a fixed buffer area and a dynamically expandable buffer area, and the fixed buffer area and the dynamically expandable buffer area are uniformly numbered. The mapping table management method includes:
[0006] Search the first storage unit in the fixed buffer area to obtain a first search result, where the first storage unit represents a cache unit that can be used and has not been used;
[0007] When the first search result indicates the existence of the first storage unit, add the first storage unit to the head of a doubly linked list so that the first storage unit caches the mapping table;
[0008] When the first search result indicates the non-existence of the first storage unit, apply for a second storage unit from the dynamically expandable buffer area or a third storage unit from the tail of the doubly linked list according to the dynamically expandable determination information, where the dynamically expandable determination information represents information for determining whether to apply for a cache unit from the dynamically expandable buffer area;
[0009] Add the second storage unit or the third storage unit to the head of the doubly linked list so that the second storage unit or the third storage unit caches the mapping table.
[0010] In some alternative embodiments, searching the first storage unit of the fixed buffer to obtain a first search result includes:
[0011] Obtaining a bitmap table for recording storage information of the fixed buffer and the dynamic expansion buffer;
[0012] Searching the first storage unit according to the bitmap table to obtain the first search result.
[0013] In some alternative embodiments, applying for a second storage unit from the dynamic expansion buffer or applying for a third storage unit from the tail of the doubly linked list according to the dynamic expansion determination information includes:
[0014] When the dynamic expansion determination information indicates applying for a cache unit from the dynamic expansion buffer, enabling the dynamic expansion buffer;
[0015] Applying for the second storage unit from the dynamic expansion buffer;
[0016] Marking the bitmap table corresponding to the second storage unit as a cache unit that is available and unused;
[0017] Searching the second storage unit according to the bitmap table so that the second storage unit caches the mapping table;
[0018] When the dynamic expansion determination information indicates not applying for a cache unit from the dynamic expansion buffer, disabling the dynamic expansion buffer;
[0019] Applying for the third storage unit from the tail of the doubly linked list.
[0020] In some alternative embodiments, applying for the third storage unit from the tail of the doubly linked list includes:
[0021] Applying for a longest cached unit from the tail of the doubly linked list, where the longest cached unit represents the cache unit with the longest usage time;
[0022] Obtaining the unit number of the longest cached unit;
[0023] Updating the longest cached unit to the head of the doubly linked list according to the unit number so that the longest cached unit becomes the most recently used cache unit, and the longest cached unit represents the third storage unit.
[0024] In some alternative embodiments, after updating the longest cached unit to the head of the doubly linked list according to the unit number, it further includes:
[0025] Obtain the longest mapping table of the longest cache unit, where the longest mapping represents the mapping table stored in the longest cache unit;
[0026] Identify the longest mapping table to obtain an identification result;
[0027] When the identification result indicates that the longest mapping table belongs to a dirty table, write the cache data of the longest mapping table into the flash memory, and delete the longest mapping table after the writing is completed, so that the longest cache unit stores a new mapping table.
[0028] In some alternative embodiments, the first number of the fixed buffer area and the second number of the dynamically extended buffer area are consecutive. When the second storage unit needs to be released, the method further includes:
[0029] Search upward from the tail of the doubly linked list to find the second storage unit with the second number;
[0030] Remove the second storage unit from the doubly linked list;
[0031] Set the bitmap table corresponding to the second storage unit to unusable, so that the second storage unit returns to the dynamically extended buffer area.
[0032] In some alternative embodiments, the method for determining the dynamically extended determination information includes:
[0033] Obtain a random fractional value of a preset default value;
[0034] Compare the logical addresses of two consecutive read operations to obtain a first comparison result;
[0035] When the first comparison result indicates that the logical addresses of two consecutive read operations are not consecutive, increase the random fractional value by a first value;
[0036] When the first comparison result indicates that the logical addresses of two consecutive read operations are consecutive, subtract a second value from the random fractional value;
[0037] Compare the random fractional value with a first threshold and a second threshold respectively to obtain a second comparison result;
[0038] When the second comparison result indicates that the random fractional value is greater than or equal to the first threshold, mark the read operation as a random read operation, and configure the dynamically extended determination information to require applying for a cache unit from the dynamically extended buffer area;
[0039] When the second comparison result indicates that the random fraction value is less than or equal to the second threshold, mark the read operation as a sequential read operation, and configure the dynamic expansion determination information to not require applying for a cache unit from the dynamic expansion buffer.
[0040] In a second aspect, an embodiment of the present invention provides a mapping table management system, including:
[0041] A first module for searching a first storage unit in a fixed buffer to obtain a first search result, where the first storage unit represents an available and unused cache unit;
[0042] A second module for, when the first search result indicates the existence of the first storage unit, adding the first storage unit to the head of a doubly linked list so that the first storage unit caches a mapping table;
[0043] A third module for, when the first search result indicates the non - existence of the first storage unit, applying for a second storage unit from the dynamic expansion buffer or applying for a third storage unit from the tail of the doubly linked list according to dynamic expansion determination information, where the dynamic expansion determination information represents information for determining whether to apply for a cache unit from the dynamic expansion buffer;
[0044] A fourth module for adding the second storage unit or the third storage unit to the head of the doubly linked list so that the second storage unit or the third storage unit caches a mapping table.
[0045] In a third aspect, an embodiment of the present invention provides a computer device, where the computer device includes a processor, a memory, and a computer program stored on the memory and executable by the processor. When the computer program is executed by the processor, the steps of the above - mentioned method are implemented.
[0046] In a fourth aspect, an embodiment of the present invention provides a computer - readable storage medium, in which a program executable by a processor is stored. The program executable by the processor is used to execute the method as described above when executed by the processor.
[0047] The implementation of the embodiments of the present invention has the following beneficial effects: The embodiments of the present invention provide a mapping table management method, including: searching a first storage unit in the fixed buffer to obtain a first search result, where the first storage unit represents a cache unit that can be used and is not used; when the first search result indicates the existence of the first storage unit, adding the first storage unit to the head of a doubly linked list so that the first storage unit caches the mapping table; when the first search result indicates the non-existence of the first storage unit, applying for a second storage unit from the dynamic expansion buffer or a third storage unit from the tail of the doubly linked list according to the dynamic expansion determination information, where the dynamic expansion determination information represents information for determining whether to apply for a cache unit from the dynamic expansion buffer; adding the second storage unit or the third storage unit to the head of the doubly linked list so that the second storage unit or the third storage unit caches the mapping table. By searching for free cache units in the fixed buffer to cache the mapping table, and when there are no free cache units in the fixed buffer, applying for cache units from the dynamic expansion buffer or from the tail of the doubly linked list to cache the mapping table, the cache space of the mapping table is increased, the hit rate of the mapping table is improved, and the read and write performance is further improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 is a step flowchart of a mapping table management method provided by an embodiment of the present invention;
[0049] Figure 2 is a schematic diagram of the numbering of the fixed buffer and the dynamic expansion buffer provided by an embodiment of the present invention;
[0050] Figure 3 is a structural block diagram of a mapping table management system provided by an embodiment of the present invention;
[0051] Figure 4 is a schematic structural block diagram of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0052] The embodiments of the present invention will be described in detail below. The examples of the embodiments are shown in the accompanying drawings, where the same or similar reference numerals represent the same or similar elements or elements with the same or similar functions from beginning to end. The embodiments described below by referring to the accompanying drawings are exemplary and are only used to explain the present invention and should not be construed as a limitation to the present invention.
[0053] In the description of the present invention, it should be understood that for the orientation descriptions, such as the orientations or positional relationships indicated by up, down, front, back, left, right, etc., they are based on the orientations or positional relationships shown in the drawings. It is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation. Therefore, it should not be construed as a limitation to the present invention.
[0054] In the description of the present invention, the meaning of "several" is one or more, the meaning of "multiple" is two or more. Understandings such as "greater than", "less than", "exceeding", etc. do not include the present number, and understandings such as "above", "below", "within", etc. include the present number. If there is a description of "first" and "second", it is only for the purpose of distinguishing technical features, and cannot be understood as indicating or implying relative importance or implicitly indicating the quantity of the indicated technical features or implicitly indicating the sequence relationship of the indicated technical features.
[0055] In the description of the present invention, unless otherwise clearly defined, words such as "set", "installed", "connected", etc. should be understood in a broad sense, and those skilled in the art can reasonably determine the specific meanings of the above words in the present invention in combination with the specific content of the technical solution.
[0056] The embodiments of the present invention provide a mapping table management method, system, device and medium. Among them, a mapping table management method includes: searching the first storage unit of the fixed buffer area to obtain a first search result, where the first storage unit represents a cache unit that can be used and has not been used; in the case where the first search result indicates the existence of the first storage unit, adding the first storage unit to the head of the doubly linked list so that the first storage unit caches the mapping table; in the case where the first search result indicates the non-existence of the first storage unit, applying for a second storage unit from the dynamic expansion buffer area or applying for a third storage unit from the tail of the doubly linked list according to the dynamic expansion determination information, where the dynamic expansion determination information represents the information for determining whether to apply for a cache unit from the dynamic expansion buffer area; adding the second storage unit or the third storage unit to the head of the doubly linked list so that the second storage unit or the third storage unit caches the mapping table. By searching for free cache units in the fixed buffer area to cache the mapping table, and when there are no free cache units in the fixed buffer area, applying for cache units in the dynamic expansion buffer area or applying for cache units from the tail of the doubly linked list to cache the mapping table, thereby increasing the cache space of the mapping table, improving the hit rate of the mapping table, and further improving the read and write performance.
[0057] The allocation method of the embodiments of the present invention will be further elaborated below.
[0058] Refer to Figure 1 , Figure 1The flowchart of a mapping table management method provided by an embodiment of the present invention is applied to a storage device. The storage device includes a fixed buffer and a dynamically expandable buffer, and the fixed buffer and the dynamically expandable buffer are uniformly numbered. The mapping table management method includes but is not limited to the following steps:
[0059] S101, search the first storage unit of the fixed buffer to obtain a first search result, where the first storage unit represents a cache unit that is available and unused;
[0060] S102, when the first search result indicates the existence of the first storage unit, add the first storage unit to the head of the doubly linked list so that the first storage unit caches the mapping table;
[0061] S103, when the first search result indicates the non-existence of the first storage unit, apply for a second storage unit from the dynamically expandable buffer or a third storage unit from the tail of the doubly linked list according to the dynamic expansion determination information, where the dynamic expansion determination information represents information for determining whether to apply for a cache unit from the dynamically expandable buffer;
[0062] S104, add the second storage unit or the third storage unit to the head of the doubly linked list so that the second storage unit or the third storage unit caches the mapping table.
[0063] It should be noted that, as Figure 2As shown, the present application divides the memory of the storage device into two areas, a fixed cache area and a dynamically extended cache area. The dynamically extended cache area can store mapping tables, user data, device system data, etc. The size of each mapping table is fixed. The fixed cache area is divided into N cache units and the dynamically extended cache area is divided into M cache units based on the size of the mapping table. All cache units in the fixed cache area and the dynamically extended cache area are uniformly numbered. The fixed cache area is numbered from 0 to N-1, and the dynamic extended cache area is numbered from N to N+M-1. The fixed cache area and the dynamically extended cache area are distinguished by numbering, so as to facilitate management. The use of the cache area is managed through the mapping table manager. And through the bitmap table, each cache unit is corresponded one by one to whether it can be used, whether it has been used, whether it is a dirty table, etc., without specific limitation. The cache unit in the fixed cache area is always available (that is, it can be used to cache the mapping table), and the cache unit in the dynamically extended cache area is not available by default (that is, the mapping table cannot be cached by default). In addition, the switch signal (i.e., dynamic expansion confirmation information) is used to control whether the dynamic expansion function is used. If used, a cache unit (i.e., a second storage unit) is applied to the dynamic expansion cache area to cache the mapping table. If not used, a cache unit (i.e., a third storage unit) is applied to the end of the bidirectional linked list to cache the mapping table. The time sequence of all used cache units is managed by the bidirectional linked list and the LRU algorithm; if a piece of data has not been accessed in the recent period, then the possibility of it being accessed in the future is also very small. Therefore, when the cache is full, the LRU algorithm will give priority to eliminating the data that has not been accessed for the longest time. The dynamic expansion scheme of the mapping table cache space is implemented. In the random read and write scenario, the amount of user read and write data is small, and there is a lot of idle cache space for user data (i.e., the dynamic expansion cache area). This part of the idle cache mapping table is used to improve the mapping table hit rate, thereby improving the random read and write performance.
[0064] In some optional embodiments, searching the first storage unit of the fixed cache area to obtain the first search result includes: obtaining a bitmap table, wherein the bitmap table is used to record storage information of the fixed cache area and the dynamically extended cache area; and searching the first storage unit according to the bitmap table to obtain the first search result.
[0065] Specifically, the bitmap table records the usage status of each cache unit in the fixed buffer and each cache unit in the dynamically extended buffer. Thus, information such as the logical address, cached data, cache size, and cache time of the corresponding cache unit can be obtained through the bitmap table. The cache size includes the cache unit size and the size of the cached data, and the cache time indicates the cache time of the cached data in the cache unit. When it is necessary to search for unused cache units that can be used in the fixed buffer, the usage information of the cache units in the fixed buffer is obtained through the bitmap table, so as to find the first storage unit that can be used and is unused. The first storage unit is the cache unit in the fixed buffer whose usage status is available and unused. The first storage unit is cached in the mapping table, thereby increasing the storage space of the mapping table and the hit rate of the mapping table when reading and writing data.
[0066] In some optional embodiments, the applying for the second storage unit from the dynamically extended buffer or the third storage unit from the tail of the doubly linked list according to the dynamically extended determination information includes: when the dynamically extended determination information indicates applying for a cache unit from the dynamically extended buffer, enabling the dynamically extended buffer; applying for the second storage unit from the dynamically extended buffer; marking the corresponding bitmap table of the second storage unit as an available and unused cache unit; searching for the second storage unit according to the bitmap table so that the second storage unit caches the mapping table; when the dynamically extended determination information indicates not applying for a cache unit from the dynamically extended buffer, disabling the dynamically extended buffer; and applying for the third storage unit from the tail of the doubly linked list.
[0067] Specifically, the dynamically extended determination information is the information used to determine whether to apply for a cache unit from the dynamically extended buffer. When more cache space is needed to cache the mapping table, it is determined whether to enable the dynamically extended buffer through the dynamically extended determination information. When it is necessary to apply for a cache unit from the dynamically extended buffer, the dynamically extended buffer is enabled. Thus, an unused cache unit in the dynamically extended buffer is found through the bitmap table, and the usage status of this cache unit is marked as available and unused in the bitmap table, which is the second storage unit. According to the address of the second storage unit recorded in the bitmap table, the second storage unit is searched, and after finding the second storage unit, the mapping table is cached in the second storage unit. When it is determined through the dynamically extended determination information not to enable the dynamically extended buffer, the dynamically extended buffer is disabled, and the third storage unit is applied for from the tail of the doubly linked list. The doubly linked list corresponds to cache units for caching the mapping. The head of the doubly linked list corresponds to the most recently used cache unit. Correspondingly, the tail of the doubly linked list is the least recently used cache unit. When a new mapping table needs to be cached, the least recently used cache unit at the tail of the doubly linked list is added to the head of the doubly linked list, thereby caching the new mapping table.
[0068] In some alternative embodiments, applying for the third storage unit from the tail of the doubly linked list includes: applying for a least recently used cache unit from the tail of the doubly linked list, where the least recently used cache unit represents the cache unit with the longest usage time; obtaining the unit number of the least recently used cache unit; and updating the least recently used cache unit to the head of the doubly linked list according to the unit number, so that the least recently used cache unit becomes the most recently used cache unit, and the least recently used cache unit represents the third storage unit.
[0069] Specifically, the cache unit corresponding to the tail of the doubly linked list is the least recently used cache unit. When it is necessary to find a cache unit cache mapping table in the fixed buffer and there is no available and unused cache unit in the fixed buffer, apply for a least recently used cache unit from the tail of the doubly linked list and update the least recently used cache unit to the head of the doubly linked list. That is, the head of the doubly linked list corresponds to the least recently used cache unit, and the least recently used cache unit is updated to the most recently used cache unit. Specifically, update the unit number of the least recently used cache unit to the head of the doubly linked list, so that the least recently used cache unit is updated to the most recently used cache unit, and the least recently used cache unit is the third storage unit.
[0070] In some alternative embodiments, after updating the least recently used cache unit to the head of the doubly linked list according to the unit number, it further includes: obtaining the least recently used mapping table of the least recently used cache unit, where the least recently used mapping represents the mapping table stored in the least recently used cache unit; identifying the least recently used mapping table to obtain an identification result; and in the case where the identification result indicates that the least recently used mapping table belongs to a dirty table, writing the cache data of the least recently used mapping table into the flash memory, and deleting the least recently used mapping table after the writing is completed, so that the least recently used cache unit stores a new mapping table.
[0071] Specifically, after updating the least recently used cache unit to the head of the doubly linked list, obtain the least recently used mapping table cached in the least recently used cache unit and identify the information of the least recently used mapping table; in the case where it is identified that the least recently used mapping table belongs to a dirty table, write the cache data of the least recently used mapping table into the flash memory. The records in the dirty table have been updated, inserted, or deleted, but these changes have not been synchronized to the database or file system. Before storing the new mapping table, it is necessary to first write the data in the dirty mapping table into the flash memory to ensure data persistence and integrity. After writing the dirty mapping table into the flash memory, it is necessary to refresh the cache to clear the dirty table flag and make room for the new mapping table. After the dirty mapping table is successfully written and refreshed, a new mapping table can be created and loaded into the memory.
[0072] In some alternative embodiments, the first number of the fixed buffer and the second number of the dynamically expandable buffer are consecutive. In the case where the second storage unit needs to be released, the method further includes: searching upward from the tail of the doubly linked list to find the second storage unit with the second number;
[0073] removing the second storage unit from the doubly linked list; setting the bitmap table corresponding to the second storage unit to unavailable, so that the second storage unit returns to the dynamically expandable buffer.
[0074] Specifically, when a cache unit of the expandable buffer needs to be released, search upward from the tail of the doubly linked list to find the cache units numbered N to N+M-1, which are the second storage units. Release the memory corresponding to the second storage unit, remove the second storage unit from the doubly linked list, and at the same time set the bitmap table corresponding to the second storage unit to unavailable.
[0075] In some alternative embodiments, the method for determining the dynamically expandable determination information includes: obtaining a random fractional value of a preset default value; comparing the logical addresses of two consecutive read operations to obtain a first comparison result; in the case where the first comparison result indicates that the logical addresses of two consecutive read operations are discontinuous, increasing the random fractional value by a first value; in the case where the first comparison result indicates that the logical addresses of two consecutive read operations are continuous, subtracting a second value from the random fractional value; comparing the random fractional value with a first threshold and a second threshold respectively to obtain a second comparison result; in the case where the second comparison result indicates that the random fractional value is greater than or equal to the first threshold, marking the read operation as a random read operation and configuring the dynamically expandable determination information to require applying for a cache unit from the dynamically expandable buffer; in the case where the second comparison result indicates that the random fractional value is less than or equal to the second threshold, marking the read operation as a sequential read operation and configuring the dynamically expandable determination information to not require applying for a cache unit from the dynamically expandable buffer.
[0076] Specifically, a random read recognition module is provided in the storage device. When it is detected that the current is a random read scenario, the dynamically expandable function is enabled. When it is detected that the current is a sequential read scenario, the dynamically expandable function is disabled. When the storage device enters the update mapping table scenario, the dynamically expandable function is also automatically enabled.
[0077] The preset default value of the specific random score value RAND_VAL is K, and the specific value is set according to requirements and will not be limited here. Determine whether the logical addresses read in the previous and subsequent times are consecutive. If they are not consecutive, the value of RAND_VAL is increased by N (i.e., the first value). If they are consecutive, the value of RAND_VAL is decreased by M (i.e., the second value). If the value of RAND_VAL increases to the first threshold, such as 2*K, it is considered a random read scenario. If the value of RAND_VAL decreases to the second threshold, such as 0, it is considered a sequential read scenario. After confirming the sequential read or random read scenario, RAND_VAL is restored to the preset default value, and then the random score value RAND_VAL is recalculated, that is, loop calculation. After a cycle is completed, the random score value RAND_VAL is restored to the preset default value.
[0078] Implementing the embodiments of the present invention includes the following beneficial effects: The embodiments of the present invention provide a mapping table management method, including: searching a first storage unit in the fixed buffer area to obtain a first search result, where the first storage unit represents a cache unit that can be used and is not used; in the case where the first search result indicates the existence of the first storage unit, adding the first storage unit to the head of a doubly linked list so that the first storage unit caches the mapping table; in the case where the first search result indicates the non-existence of the first storage unit, applying for a second storage unit from the dynamic expansion buffer area or applying for a third storage unit from the tail of the doubly linked list according to the dynamic expansion determination information, where the dynamic expansion determination information represents information for determining whether to apply for a cache unit from the dynamic expansion buffer area; adding the second storage unit or the third storage unit to the head of the doubly linked list so that the second storage unit or the third storage unit caches the mapping table. By searching for free cache units in the fixed buffer area to cache the mapping table, and when there are no free cache units in the fixed buffer area, applying for cache units in the dynamic expansion buffer area or applying for cache units from the tail of the doubly linked list to cache the mapping table, the cache space of the mapping table is increased, the hit rate of the mapping table is improved, and the read and write performance is further improved.
[0079] As Figure 3 shown, in the second aspect, the embodiments of the present invention provide a mapping table management system, including:
[0080] A first module for searching a first storage unit in the fixed buffer area to obtain a first search result, where the first storage unit represents a cache unit that can be used and is not used;
[0081] A second module for, in the case where the first search result indicates the existence of the first storage unit, adding the first storage unit to the head of a doubly linked list so that the first storage unit caches the mapping table;
[0082] A third module, configured to, when the first search result indicates that the first storage unit does not exist, apply for a second storage unit from the dynamic expansion buffer or apply for a third storage unit from the tail of the doubly linked list according to the dynamic expansion determination information, where the dynamic expansion determination information represents information for determining whether to apply for a cache unit from the dynamic expansion buffer;
[0083] A fourth module, configured to add the second storage unit or the third storage unit to the head of the doubly linked list, so that the second storage unit or the third storage unit caches a mapping table.
[0084] It can be seen that the content in the above method embodiments is applicable to the system embodiments of the present invention. The functions specifically implemented by the system embodiments of the present invention are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those of the above method embodiments.
[0085] As Figure 4 shown, in a third aspect, an embodiment of the present invention further provides a computer device, which may be a terminal. The computer device includes a processor, a memory, and a network interface connected through a system bus. The memory may include a non-volatile storage medium and an internal memory. The non-volatile storage medium may store an operating system and a computer program. The computer program includes program instructions, which when executed, may cause the processor to execute any industrial device visualization management method. The processor is used to provide computing and control capabilities to support the operation of the entire computer device. The internal memory provides an environment for the operation of the computer program in the non-volatile storage medium. When the computer program is executed by the processor, it may cause the processor to execute any industrial device visualization management method. The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art can understand that Figure 4 the structure shown in Figure 4More or fewer components as shown, or combine certain components, or have different component arrangements. It should be understood that the processor can be a Central Processing Unit (CPU), and the processor can also be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. Among them, in one embodiment, the above-mentioned processor is used to run a computer program stored in the memory to implement the following steps: search the first storage unit of the fixed buffer to obtain a first search result, and the first storage unit represents a cache unit that can be used and has not been used; in the case where the first search result indicates the existence of the first storage unit, add the first storage unit to the head of the doubly linked list to enable the first storage unit to cache the mapping table; in the case where the first search result indicates the non-existence of the first storage unit, apply for a second storage unit from the dynamic expansion buffer or apply for a third storage unit from the tail of the doubly linked list according to the dynamic expansion determination information, and the dynamic expansion determination information represents information for determining whether to apply for a cache unit from the dynamic expansion buffer; add the second storage unit or the third storage unit to the head of the doubly linked list to enable the second storage unit or the third storage unit to cache the mapping table.
[0086] It can be seen that the content in the above method embodiments is applicable to the device embodiments of the present application. The functions specifically implemented by the device embodiments of the present application are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those of the above method embodiments.
[0087] In addition, the embodiments of the present application also disclose a computer program product or a computer program, and the computer program product or the computer program is stored in a computer-readable storage medium. The processor of the computer device can read the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the above method. Similarly, the content in the above method embodiments is applicable to the storage medium embodiments of the present application. The functions specifically implemented by the storage medium embodiments of the present application are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those of the above method embodiments.
[0088] It will be understood that all or some of the steps and systems disclosed in the above methods may be implemented as software, firmware, hardware, and their appropriate combinations. Some or all of the physical components may be implemented as software executed by a processor, such as a central processing unit, a digital information processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or transitory medium). As is well known to those of ordinary skill in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information, such as computer-readable instructions, data structures, program modules, or other data. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those of ordinary skill in the art that communication media typically embodies computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0089] The embodiments of the present invention have been described in detail above in conjunction with the accompanying drawings. However, the present invention is not limited to the above embodiments, and various changes can be made without departing from the spirit of the present invention within the scope of knowledge possessed by those of ordinary skill in the art.
Claims
1. A mapping table management method, characterized in that, Applied to a storage device, the storage device includes a fixed buffer and a dynamically extended buffer, and the fixed buffer and the dynamically extended buffer are uniformly numbered. The mapping table management method includes: Search the first storage unit in the fixed buffer to obtain a first search result, where the first storage unit represents a cache unit that is available and unused; When the first search result indicates the existence of the first storage unit, add the first storage unit to the head of the doubly linked list so that the first storage unit caches the mapping table; When the first search result indicates the non-existence of the first storage unit, apply for a second storage unit from the dynamically extended buffer or a third storage unit from the tail of the doubly linked list according to the dynamic extension determination information, where the dynamic extension determination information represents information for determining whether to apply for a cache unit from the dynamically extended buffer; among them, the determination method of the dynamic extension determination information includes: modifying a random fractional value according to the logical addresses of two consecutive read operations, and configuring the dynamic extension determination information according to the modified random fractional value; Add the second storage unit or the third storage unit to the head of the doubly linked list so that the second storage unit or the third storage unit caches the mapping table.
2. The method according to claim 1, characterized in that The search for the first storage unit in the fixed buffer to obtain a first search result includes: Obtain a bitmap table, where the bitmap table is used to record the storage information of the fixed buffer and the dynamically extended buffer; Search the first storage unit according to the bitmap table to obtain the first search result.
3. The method according to claim 2, wherein The applying for a second storage unit from the dynamically extended buffer or a third storage unit from the tail of the doubly linked list according to the dynamic extension determination information includes: When the dynamic extension determination information indicates applying for a cache unit from the dynamically extended buffer, enable the dynamically extended buffer; Apply for the second storage unit from the dynamically extended buffer; Mark the bitmap table corresponding to the second storage unit as an available and unused cache unit; Search the second storage unit according to the bitmap table so that the second storage unit caches the mapping table; When the dynamic extension determination information indicates not applying for a cache unit from the dynamically extended buffer, disable the dynamically extended buffer; Apply for the third storage unit from the tail of the doubly linked list.
4. The method according to claim 3, wherein The applying for the third storage unit from the tail of the doubly linked list includes: Apply for a least recently used cache unit from the tail of the doubly linked list, where the least recently used cache unit represents the cache unit with the longest usage time; Obtain the unit number of the least recently used cache unit; Update the least recently used cache unit to the head of the doubly linked list according to the unit number so that the least recently used cache unit becomes the most recently used cache unit, and the least recently used cache unit represents the third storage unit.
5. The method according to claim 4, characterized in that, After updating the least recently used cache unit to the head of the doubly linked list according to the unit number, it further includes: Obtain the least recently used mapping table of the least recently used cache unit, where the least recently used mapping represents the mapping table stored in the least recently used cache unit; Identify the longest mapping table to obtain an identification result; In the case where the identification result indicates that the longest mapping table belongs to a dirty table, write the cached data of the longest mapping table into the flash memory, and delete the longest mapping table after the writing is completed, so that the longest cache unit stores a new mapping table.
6. The method according to claim 2, wherein The first number of the fixed buffer area and the second number of the dynamically extended buffer area are consecutive. In the case where the second storage unit needs to be released, the method further includes: Search upward from the tail of the doubly linked list to find the second storage unit with the second number; Remove the second storage unit from the doubly linked list; Set the bitmap table corresponding to the second storage unit to unusable, so that the second storage unit returns to the dynamically extended buffer area.
7. The method according to claim 1, characterized in that, The method for determining the dynamically extended determination information includes: Obtain a random fractional value of a preset default value; Compare the logical addresses of two consecutive read operations to obtain a first comparison result; In the case where the first comparison result indicates that the logical addresses of two consecutive read operations are not consecutive, increase the random fractional value by a first value; In the case where the first comparison result indicates that the logical addresses of two consecutive read operations are consecutive, subtract a second value from the random fractional value; Compare the random fractional value with a first threshold and a second threshold respectively to obtain a second comparison result; In the case where the second comparison result indicates that the random fractional value is greater than or equal to the first threshold, mark the read operation as a random read operation, and configure the dynamically extended determination information to require applying for a cache unit from the dynamically extended buffer area; In the case where the second comparison result indicates that the random fractional value is less than or equal to the second threshold, mark the read operation as a sequential read operation, and configure the dynamically extended determination information to not require applying for a cache unit from the dynamically extended buffer area.
8. A mapping table management system, characterized in that, It includes: A first module for searching for a first storage unit in the fixed buffer area to obtain a first search result, where the first storage unit represents a cache unit that is available and unused; A second module for, in the case where the first search result indicates the existence of the first storage unit, adding the first storage unit to the head of the doubly linked list, so that the first storage unit caches the mapping table; A third module for, in the case where the first search result indicates the non-existence of the first storage unit, applying for a second storage unit from the dynamically extended buffer area or applying for a third storage unit from the tail of the doubly linked list according to the dynamically extended determination information, where the dynamically extended determination information represents information for determining whether to apply for a cache unit from the dynamically extended buffer area; wherein, the method for determining the dynamically extended determination information includes: modifying a random fractional value according to the logical addresses of two consecutive read operations, and configuring the dynamically extended determination information according to the modified random fractional value; A fourth module for adding the second storage unit or the third storage unit to the head of the doubly linked list, so that the second storage unit or the third storage unit caches the mapping table.
9. A computer device, wherein, The computer device includes a processor, a memory, and a computer program stored on the memory and executable by the processor. When the computer program is executed by the processor, the steps of the method according to any one of claims 1-7 are implemented.
10. A computer-readable storage medium storing a program executable by a processor, characterized in that, The program executable by the processor is used to execute the method according to any one of claims 1-7 when executed by the processor.