Data fragmentation degree analysis method and device, equipment and storage medium
By identifying the logical intervals of the logical address range in a preset table and counting the total number of mapping relationships, and calculating the return code, the problem of low efficiency in data fragmentation analysis in existing technologies is solved, and efficient data fragmentation assessment is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN SHICHUANGYI ELECTRONICS CO LTD
- Filing Date
- 2025-12-30
- Publication Date
- 2026-04-17
AI Technical Summary
Existing technologies for analyzing data fragmentation are inefficient and cannot effectively assess the degree of data fragmentation.
By receiving fragmentation analysis instructions, the system confirms that the logical address range falls within the logical intervals in the preset table, counts the total number of mapping relationships between the logical interval sets corresponding to each entity interval, and calculates the report code to assess the degree of data fragmentation.
It improves the efficiency of data fragmentation analysis, reduces the number of reads of the logical mapping table, and enhances the efficiency and accuracy of the analysis.
Smart Images

Figure CN121879679A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data fragmentation analysis technology, and in particular to a data fragmentation analysis method, apparatus, device and storage medium. Background Technology
[0002] In recent years, many chip manufacturers, platform providers, and protocol development associations related to storage device technology have collaborated to propose numerous solutions to the data fragmentation problem, enabling embedded platforms to maintain high read performance after prolonged operation and improving the end-user experience. However, current data fragmentation analysis solutions are relatively inefficient. Summary of the Invention
[0003] The purpose of this application is to provide a method, apparatus, device, and storage medium for analyzing data fragmentation, thereby improving the efficiency of data fragmentation analysis.
[0004] This application discloses a method for analyzing the degree of data fragmentation, the method comprising the following steps: Receive fragmentation analysis instructions, wherein the fragmentation analysis instructions include a range of logical addresses; Confirm the logical intervals in the preset table where the logical addresses in the logical address range are located to obtain the logical interval set; According to the preset table, count the number of times each entity interval corresponds to the logical interval set and obtain the total number of mapping relationships; Calculate the reward code based on the total number of mapping relationships.
[0005] Optionally, in the step of confirming that the logical address in the logical address range falls within the logical interval of the preset table, and obtaining the logical interval set: The preset table is read into the static random access memory, and the preset table is kept resident in the static random access memory.
[0006] Optionally, before the step of confirming the logical address in the logical address range and determining the logical interval set in the preset table, the method further includes: Divide the global entity address range into multiple entity ranges; Divide the global logical address range into multiple logical intervals; Create a preset table, which includes multiple entity intervals, multiple logical intervals, and an identifier indicating whether there is a mutual mapping. The entity intervals include multiple consecutive entity addresses, and the logical intervals include multiple consecutive logical addresses. Each entity interval corresponds to all logical intervals, and each logical interval corresponds to an identifier indicating whether there is a mutual mapping. When updating the logical mapping table, update the mutual mapping identifier in the preset table.
[0007] Optionally, before the step of confirming the logical address in the logical address range and determining the logical interval set in the preset table, the method further includes: Divide the global entity address range into multiple entity ranges; Divide the global logical address range into multiple logical intervals; Create a preset table, which includes multiple entity ranges, multiple logical ranges, and an identifier indicating whether there is a mapping between them. The entity ranges include multiple consecutive entity addresses, and the logical ranges include multiple consecutive logical addresses. Each logical range corresponds to all the entity ranges, and each entity range corresponds to an identifier indicating whether there is a mapping between them. When updating the logical mapping table, update the mutual mapping identifier in the preset table.
[0008] Optionally, the step of calculating the reward code based on the total number of mapping relationships includes: Calculate the entity dispersion based on the total number of mapping relationships; Calculate candidate level values based on entity dispersion and the number of entity intervals in the preset table; Calculate the reward code based on the candidate level value; In the step of calculating the entity dispersion based on the total number of mapping relationships, the entity dispersion is equal to the total number of mapping relationships divided by a constant L.
[0009] Optionally, in the step of calculating candidate level values based on entity dispersion and the number of entity intervals in the preset table: When the entity dispersion is equal to 0, the candidate level value is equal to 0; When the number of entity intervals is greater than or equal to the first preset value, the candidate level value is equal to the entity dispersion. When the number of entity intervals is less than a first preset value and the entity dispersion is greater than 0, the candidate level value is equal to the entity dispersion + 1.
[0010] Optionally, the step of calculating the reward code based on the candidate level value includes: Establish a mapping table between candidate level values and reward codes, and define it as a feedback table; Based on the candidate level value, the corresponding reward code is found in the feedback table.
[0011] This application also discloses a flash memory device, which includes an interface, a data fragmentation analysis module, and multiple flash memory modules. The interface is used to connect to external devices; The flash memory module is used to store a preset table; The data fragmentation analysis module is used to receive fragmentation analysis instructions, confirm the logical address in the logical address range of the fragmentation analysis instructions and the logical interval in the preset table, obtain the logical interval set, and according to the preset table, count the number of times each entity interval is mapped to the logical interval set, obtain the total number of mapping relationships, and calculate the report code based on the total number of mapping relationships.
[0012] This application also discloses an electronic device, the electronic device comprising: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, which enables the at least one processor to perform a data fragmentation analysis method.
[0013] This application also discloses a computer-readable storage medium storing a computer program that, when executed by a processor, implements a method for analyzing the degree of data fragmentation.
[0014] Compared to existing methods that analyze data fragmentation by reading logical mapping tables, the present application's method first identifies the logical intervals in a preset table within the logical address range, thus obtaining a set of logical intervals. Then, based on the preset table, it counts the number of times each entity interval maps to the set of logical intervals, obtaining the total number of mapping relationships. The total number of mapping relationships is used to calculate a return code, with different return codes corresponding to different degrees of data fragmentation, thereby enabling efficient analysis of data fragmentation. Attached Figure Description
[0015] The accompanying drawings, which form part of the specification, are used to provide a further understanding of the embodiments of this application and illustrate the implementation methods of this application, together with the textual description, to explain the principles of this application. Obviously, the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any creative effort. In the drawings: Figure 1 This is a schematic diagram of a data fragmentation analysis method according to an embodiment of this application; Figure 2 This is a schematic diagram of a first type of preset table according to an embodiment of this application; Figure 3 This is a schematic diagram of a second type of preset table according to an embodiment of this application; Figure 4This is a schematic diagram of the formula for the candidate rank values in this application; Figure 5 This is a schematic diagram of a flash memory device according to an embodiment of this application; Figure 6 This is a schematic diagram of an electronic device according to an embodiment of this application.
[0016] Among them, 10 is an electronic device; 11 is a memory; 12 is a processor; 13 is a display; 14 is a network interface; 20 is a flash memory device; 21 is an interface; 22 is a data fragmentation analysis module; and 23 is a flash memory module. Detailed Implementation
[0017] It should be understood that the terminology, specific structural and functional details used herein are merely for describing particular embodiments and are representative. However, this application may be implemented in many alternative forms and should not be construed as being limited to the embodiments set forth herein.
[0018] In the description of this application, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating relative importance or implying the number of technical features indicated. Therefore, unless otherwise stated, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature; "multiple" means two or more. The term "comprising" and any variations thereof mean non-exclusive inclusion, where one or more other features, integers, steps, operations, units, components, and / or combinations thereof may be present or added.
[0019] In addition, terms such as “center,” “horizontal,” “up,” “down,” “left,” “right,” “vertical,” “horizontal,” “top,” “bottom,” “inner,” and “outer” that indicate orientation or positional relationship are based on the orientation or relative positional relationship shown in the accompanying drawings. They are only for the purpose of simplifying the description of this application and do not indicate that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this application.
[0020] Furthermore, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to fixed connections, detachable connections, or integral connections; they can refer to mechanical connections or electrical connections; they can refer to direct connections or indirect connections through an intermediate medium, or internal connections between two components. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances.
[0021] The present application will now be described in detail with reference to the accompanying drawings and optional embodiments.
[0022] This invention provides a method for analyzing data fragmentation. The execution subject of this method includes, but is not limited to, at least one of the following electronic devices 10 that can be configured to execute the method provided in this application: a client, a mobile terminal, etc. The mobile terminal includes, but is not limited to, a single server, a server cluster, a cloud server, or a cloud server cluster.
[0023] Figure 1 This is a schematic diagram of a data fragmentation analysis method according to an embodiment of this application, as shown below. Figure 1 As shown, this application discloses a method for analyzing the degree of data fragmentation, the method comprising the following steps: S1: Receive fragmentation analysis instruction, wherein the fragmentation analysis instruction includes a logical address range; The logical address range includes multiple logical addresses.
[0024] S2: Confirm the logical interval in the preset table where the logical address in the logical address range is located, and obtain the logical interval set; For example, when multiple logical addresses in the logical address range of the fragmentation analysis instruction appear in a logical interval, the logical interval set only includes a subset of logical intervals.
[0025] When multiple logical addresses in the logical address range of the fragmentation analysis instruction appear in multiple logical intervals, the logical interval set includes multiple logical interval subsets.
[0026] S3: Based on the preset table, count the number of times each entity interval corresponds to the logical interval set and obtain the total number of mapping relationships; For example, if at least one logical interval in the logical interval set has data stored in the entity interval, then it is considered that there is a corresponding mapping between the entity interval and the logical interval set.
[0027] For example, if the set of logical intervals is (third logical interval, fourth logical interval), and the data in the third logical interval is mapped to the logical address in the third logical interval or to the logical address in the fourth logical interval, then it is considered that there is a corresponding mapping between the logical interval and the set of logical intervals.
[0028] The number of mutual mappings indicates that there exists at least one logical interval corresponding to data stored in the entity interval within the logical interval set.
[0029] For example, if data in the third entity interval is mapped to a logical address in the third logical interval or to a logical address in the fourth logical interval, then the number of mappings is 1. Similarly, if data in the sixth entity interval is mapped to a logical address in the third logical interval or to a logical address in the fourth logical interval, then the number of mappings is also 1. Therefore, the total number of mapping relationships is 2.
[0030] Furthermore, it is understandable that within a single entity interval, regardless of whether there are mutual mappings with several subsets of logical intervals in the logical interval set, the number of mutual mappings is always 1. For example, taking a logical address range in the fragmentation analysis instruction that simultaneously appears in both the second and third logical intervals, the logical interval set is (second logical interval, third logical interval). Then, it is necessary to calculate whether each entity interval contains data corresponding to both the second and third logical intervals. For instance, if the first entity interval contains data corresponding to both the second and third logical intervals, the number of mutual mappings is recorded as 1. If the first entity interval contains only data corresponding to either the second or third logical interval, the number of mutual mappings is also recorded as 1.
[0031] S4: Calculate the reward code based on the total number of mapping relationships.
[0032] The report code is data sent back to, for example, a host device. The host device can obtain the data fragmentation level of the logical address range in the fragmentation analysis instruction through the report code.
[0033] Taking the current algorithm's 4K mode strategy as an example, a 1KB logical mapping table (L2P) can only map to 1MB of logical and physical addresses. Therefore, for a flash memory device 20 with a physical address capacity of 128GB, a 128MB logical mapping table is required. Thus, to analyze fragmentation levels, multiple logical mapping tables must be read, and each time a different range is analyzed, the logical mapping table must be read again. However, the default table in this application is shorter, requiring only a 16k-64k default table to cover flash memory devices 20 with capacities ranging from 128GB to 2TB.
[0034] Compared to existing methods that analyze data fragmentation by reading logical mapping tables, the present application's method first identifies the logical intervals in a preset table within the logical address range, thus obtaining a set of logical intervals. Then, based on the preset table, it counts the number of times each entity interval maps to the set of logical intervals, obtaining the total number of mapping relationships. The total number of mapping relationships is used to calculate a return code, with different return codes corresponding to different degrees of data fragmentation, thereby enabling efficient analysis of data fragmentation.
[0035] Furthermore, in this application, upon receiving the fragmentation analysis instruction, the preset table in the flash memory module 23 is directly read into the static random access memory 11. Since the preset table occupies a small amount of space, it can be stored in the static random access memory 11 indefinitely.
[0036] That is, in step S2: confirming the logical interval in the preset table where the logical address in the logical address range is located, and obtaining the logical interval set: The preset table is read into the static random access memory 11, and the preset table is kept permanently in the static random access memory 11.
[0037] Compared to the solution of reading the logical image table, after reading the logical image table for data fragmentation analysis, the logical image table will be deleted from the static random access memory 11 because the logical image table occupies a large amount of space, and then read again when data fragmentation analysis is needed next time.
[0038] The solution in this application can read the preset table into the static random access memory 11 after the initial reading, and keep the preset table permanently resident in the static random access memory 11, thereby further improving the efficiency of the next data fragmentation degree analysis.
[0039] Figure 2 This is a schematic diagram of a first type of preset table according to an embodiment of this application, as shown below. Figure 2 As shown, step S2: confirming the logical address range within the logical interval of the preset table and obtaining the logical interval set, further includes creating the preset table, specifically: S211: Divide the global entity address range into multiple entity intervals; S212: Divide the global logical address range into multiple logical intervals; S213: Create a preset table, which includes multiple entity intervals, multiple logical intervals, and a mapping identifier. The entity intervals include multiple consecutive entity addresses, and the logical intervals include multiple consecutive logical addresses. Each entity interval corresponds to all logical intervals, and each logical interval corresponds to a mapping identifier. S214: When updating the logical mapping table, update the mutual mapping identifier in the preset table.
[0040] For example, S214: When updating the logical mapping table, the mutual mapping indicator in the preset table is updated. This can be done simultaneously with updating the logical mapping table.
[0041] For example, consider a flash memory device 20 with a storage capacity of 512GB. The size of each physical region is set to 8GB, so the number of physical regions (PR) is M = 512GB / 8GB = 64 (regions / GB); the size of each logical region (LR) is set to 256MB, so the number of logical regions is N = 512GB / 256MB = 2048 (regions / MB); thus, the size of the preset table corresponding to each physical region is 2048 / 8 = 256 bytes, and the total space occupied by the preset table is only 256 x 64 = 16KB.
[0042] In simple terms, each entity interval in the preset table corresponds to all logical intervals. Whether there is a mutual mapping can be indicated by 0 or 1. When there is a mutual mapping, it is marked as 1, and when there is no mutual mapping, it is marked as 0.
[0043] Figure 3 This is a schematic diagram of a second type of preset table according to an embodiment of this application, as shown below. Figure 3 As shown, each logical interval also corresponds to all entity intervals. Specifically: Before step S2: confirming the logical interval in the preset table where the logical address in the logical address range is located, and obtaining the logical interval set, the following is also included: S221: Divide the global entity address range into multiple entity intervals; S222: Divide the global logical address range into multiple logical intervals; S223: Create a preset table, which includes multiple entity intervals, multiple logical intervals, and a mapping identifier. The entity intervals include multiple consecutive entity addresses, and the logical intervals include multiple consecutive logical addresses. Each logical interval corresponds to all entity intervals, and each entity interval corresponds to a mapping identifier. S224: When updating the logical mapping table, update the mutual mapping identifier in the preset table.
[0044] In simple terms, each logical interval in the preset table corresponds to all entity intervals. Whether there is a mutual mapping can be indicated by 0 or 1. When there is a mutual mapping, it is marked as 1, and when there is no mutual mapping, it is marked as 0.
[0045] Instead of having each entity interval correspond to all logical intervals, by having each logical interval correspond to all entity intervals, when performing step S3: according to the preset table, count the number of times each entity interval corresponds to the set of logical intervals to obtain the total number of mapping relationships, it is not necessary to traverse each logical interval corresponding to each entity interval for summarization.
[0046] Instead, it directly locates the logical intervals in the logical interval set, and then calculates whether there is a mutual mapping indicator for the entity intervals corresponding to each logical interval. The 1s in the mutual mapping indicator are then summarized, thereby further improving the efficiency of data fragmentation analysis.
[0047] S4: The step of calculating the reward code based on the total number of mapping relationships includes: S41: Calculate the entity dispersion based on the total number of mapping relationships; For example, in some embodiments, the entity discreteness PPD is equal to the total number of mapping relationships P.
[0048] S42: Calculate the candidate level value based on the entity dispersion and the number of entity intervals in the preset table; S43: Calculate the reward code based on the candidate level value; For example, in the step of calculating the entity dispersion based on the total number of mapping relationships, the entity dispersion is equal to the total number of mapping relationships divided by a constant L. That is, the entity dispersion PPD = total number of mapping relationships P / L.
[0049] Figure 4 This is a schematic diagram of the formula for the candidate rank values in this application, as shown below. Figure 4 As shown, in step S42: calculating candidate level values based on entity dispersion and the number of entity intervals in the preset table: When the entity dispersion is equal to 0, the candidate level value is equal to 0; When the number of entity intervals is greater than or equal to the first preset value, the candidate level value is equal to the entity dispersion. When the number of entity intervals is less than a first preset value and the entity dispersion is greater than 0, the candidate level value is equal to the entity dispersion + 1.
[0050] Here, LevelCandidate represents a candidate level value. For example, the first preset value can be 10. When the number of entity intervals is less than 10 and the entity dispersion is not 0, the entity dispersion is increased by one level, because the smaller the number of entity intervals, the greater the entity dispersion represented by the non-zero value of the entity interval.
[0051] S43: The step of calculating the reward code based on the candidate level value includes: S431: Establish a mapping table between candidate level values and reward codes, and define it as a feedback table; S432: Based on the candidate level value, look up the corresponding reward code in the feedback table.
[0052] For example, when the candidate value of the grade is 0, the feedback code in the feedback table is 0x00, and when the candidate value of the grade is greater than 10, the feedback code in the feedback table is 0x0A.
[0053] Figure 5 This is a schematic diagram of a flash memory device according to an embodiment of this application, as shown below. Figure 5 As shown, This application also discloses a flash memory device 20, which includes an interface 21, a data fragmentation analysis module 22, and multiple flash memory modules 23. The interface 21 is used to connect to external devices; The flash memory module 23 is used to store a preset table; The data fragmentation analysis module 22 is used to receive fragmentation analysis instructions, confirm the logical address in the logical address range of the fragmentation analysis instructions and the logical interval in the preset table, obtain the logical interval set, and according to the preset table, count the number of times each entity interval is mapped to the logical interval set, obtain the total number of mapping relationships, and calculate the report code based on the total number of mapping relationships.
[0054] The flash memory device 20 further includes a firmware module connected between the interface 21 and the flash memory module 23 for reading and writing data within the flash memory module 23. The data fragmentation analysis module 22 can be integrated into the firmware module.
[0055] The solution in this application first identifies the logical intervals in the preset table where the logical addresses in the logical address range are located through the data fragmentation degree analysis module 22, thus obtaining a set of logical intervals; then, according to the preset table, it counts the number of times each entity interval maps to the set of logical intervals, thus obtaining the total number of mapping relationships; it calculates the entity dispersion, and then calculates the level candidate value based on the entity dispersion and the number of entity intervals in the preset table, and then calculates the reward code based on the level candidate value. Different reward codes correspond to different degrees of data fragmentation, thus enabling efficient data fragmentation degree analysis.
[0056] Figure 6 This is a schematic diagram of an electronic device according to an embodiment of this application, as shown below. Figure 6 As shown, this application also discloses an electronic device 10, which includes: at least one processor 12; and a memory 11 communicatively connected to the at least one processor 12; wherein the memory 11 stores instructions executable by the at least one processor 12, which are executed by the at least one processor 12 to enable the at least one processor 12 to perform the above-described data fragmentation analysis method.
[0057] Specifically, the electronic device 10 includes, but is not limited to, a memory 11, a processor 12, a display 13, and a network interface 14. The electronic device 10 connects to a network via the network interface 14 to acquire raw test data. The network can be an intranet, the Internet, GSM, WCDMA, 4G, 5G, Bluetooth, Wi-Fi, or other wireless or wired networks.
[0058] The memory 11 includes at least one type of readable medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc.
[0059] In some embodiments, memory 11 may be an internal storage unit of electronic device 10, such as a hard disk or memory of electronic device 10.
[0060] In other embodiments, the memory 11 may also be an external storage device of the electronic device 10, such as a plug-in hard drive, a smart media card (SMC), a secure digital card (SD), a flash card, etc., provided by the electronic device 10. Of course, the memory 11 may also include both internal storage units of the electronic device 10 and its external storage devices.
[0061] In this embodiment, the memory 11 is typically used to store the operating system and various application software installed on the electronic device 10, such as the program code for a data fragmentation analysis method. In addition, the memory 11 can also be used to temporarily store various types of data that have already been output or will be output.
[0062] In some embodiments, processor 12 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. This processor 12 is typically used to control the overall operation of electronic device 10, such as performing data interaction or communication-related control and processing. In this embodiment, processor 12 is used to run program code stored in memory 11 or process data, such as running program code for a data fragmentation analysis method.
[0063] The display 13 may be referred to as a display screen or display unit. In some embodiments, the display 13 may be an LED display, a liquid crystal display, a touch liquid crystal display, or an organic light-emitting diode (OLED) touch screen, etc. The display 13 is used to display information processed in the electronic device 10 and to display a visual working interface, such as displaying the results of data statistics.
[0064] The network interface 14 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface), which is typically used to establish a communication connection between the electronic device 10 and other electronic devices 10.
[0065] Figure 4 Only an electronic device 10 with a test method including a memory 11, a processor 12, a display 13, a network interface 14, and a firmware module is shown. However, it should be understood that it is not required to implement all the components shown, and more or fewer components may be implemented instead.
[0066] Optionally, the electronic device 10 may further include a user interface, which may include a display 13, an input unit such as a keyboard, and optionally a standard wired interface or a wireless interface. Optionally, in some embodiments, the display 13 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an organic light-emitting diode (OLED) touchscreen, etc. The display 13 may also be appropriately referred to as a screen or display unit, used to display information processed in the electronic device 10 and to display a visual user interface.
[0067] The electronic device 10 may include radio frequency (RF) circuits, sensors, and audio circuits, etc., which will not be described in detail here.
[0068] In the above embodiments, when the processor 12 executes the data fragmentation analysis method stored in the memory 11, it can perform the following steps: Receive fragmentation analysis instructions, wherein the fragmentation analysis instructions include a range of logical addresses; Confirm the logical intervals in the preset table where the logical addresses in the logical address range are located to obtain the logical interval set; According to the preset table, count the number of times each entity interval corresponds to the logical interval set and obtain the total number of mapping relationships; Calculate the reward code based on the total number of mapping relationships.
[0069] Furthermore, this invention also proposes a computer-readable medium, which can be non-volatile or volatile. This computer-readable medium can be any one or any combination of several of the following: hard disk, multimedia card, SD card, flash memory card, SMC, read-only memory (ROM), erasable programmable read-only memory (EPROM), portable compact disc read-only memory (CD-ROM), USB memory, etc. The computer-readable medium includes a data storage area and a program storage area. The data storage area stores data created based on the use of blockchain nodes, and the program storage area stores a data fragmentation analysis method. When the data fragmentation analysis method is executed by the processor, it performs the following operations: Receive fragmentation analysis instructions, wherein the fragmentation analysis instructions include a range of logical addresses; Confirm the logical intervals in the preset table where the logical addresses in the logical address range are located to obtain the logical interval set; According to the preset table, count the number of times each entity interval corresponds to the logical interval set and obtain the total number of mapping relationships; Calculate the reward code based on the total number of mapping relationships.
[0070] It should be noted that the inventive concept of this application can form many embodiments, but due to the limited space of the application documents, they cannot all be listed. Therefore, without conflict, the embodiments described above or the technical features can be arbitrarily combined to form new embodiments. After the embodiments or technical features are combined, the original technical effect will be enhanced.
[0071] The above description, in conjunction with specific optional embodiments, provides a further detailed explanation of this application and should not be construed as limiting the specific implementation of this application to these descriptions. For those skilled in the art, various simple deductions or substitutions can be made without departing from the concept of this application, and all such modifications or substitutions should be considered within the scope of protection of this application.
Claims
1. A method of analyzing a degree of data fragmentation, characterized by, The data fragmentation analysis method includes the following steps: Receive fragmentation analysis instructions, wherein the fragmentation analysis instructions include a range of logical addresses; Confirm the logical intervals in the preset table where the logical addresses in the logical address range are located to obtain the logical interval set; According to the preset table, count the number of times each entity interval corresponds to the logical interval set and obtain the total number of mapping relationships; Calculate the reward code based on the total number of mapping relationships.
2. The data fragmentation analysis method according to claim 1, characterized in that, In the step of confirming the logical address within the logical address range and obtaining the logical interval set from the preset table: The preset table is read into the static random access memory, and the preset table is kept resident in the static random access memory.
3. The data fragmentation analysis method according to claim 1, characterized in that, Before the step of confirming the logical address within the logical address range and obtaining the logical interval set in the preset table, the following steps are included: Divide the global entity address range into multiple entity ranges; Divide the global logical address range into multiple logical intervals; Create a preset table, which includes multiple entity intervals, multiple logical intervals, and an identifier indicating whether there is a mutual mapping. The entity intervals include multiple consecutive entity addresses, and the logical intervals include multiple consecutive logical addresses. Each entity interval corresponds to all logical intervals, and each logical interval corresponds to an identifier indicating whether there is a mutual mapping. When updating the logical mapping table, update the mutual mapping identifier in the preset table.
4. The data fragmentation analysis method according to claim 1, characterized in that, Before the step of confirming the logical address within the logical address range and obtaining the logical interval set in the preset table, the following steps are included: Divide the global entity address range into multiple entity ranges; Divide the global logical address range into multiple logical intervals; Create a preset table, which includes multiple entity ranges, multiple logical ranges, and an identifier indicating whether there is a mapping between them. The entity ranges include multiple consecutive entity addresses, and the logical ranges include multiple consecutive logical addresses. Each logical range corresponds to all the entity ranges, and each entity range corresponds to an identifier indicating whether there is a mapping between them. When updating the logical mapping table, update the mutual mapping identifier in the preset table.
5. The data fragmentation analysis method according to claim 1, characterized in that, The step of calculating the reward code based on the total number of mapping relationships includes: Calculate the entity dispersion based on the total number of mapping relationships; Calculate candidate level values based on entity dispersion and the number of entity intervals in the preset table; Calculate the reward code based on the candidate level value; In the step of calculating the entity dispersion based on the total number of mapping relationships, the entity dispersion is equal to the total number of mapping relationships divided by a constant L.
6. The data fragmentation analysis method according to claim 5, characterized in that, In the step of calculating the candidate level value based on the entity dispersion and the number of entity intervals in the preset table: When the entity dispersion is equal to 0, the candidate level value is equal to 0; When the number of entity intervals is greater than or equal to the first preset value, the candidate level value is equal to the entity dispersion. When the number of entity intervals is less than a first preset value and the entity dispersion is greater than 0, the candidate level value is equal to the entity dispersion + 1.
7. The data fragmentation analysis method according to claim 5, characterized in that, The step of calculating the reward code based on the candidate level value includes: Establish a mapping table between candidate level values and reward codes, and define it as a feedback table; Based on the candidate level value, the corresponding reward code is found in the feedback table.
8. A flash memory device, characterized in that, The flash memory device includes an interface, a data fragmentation analysis module, and multiple flash memory modules. The interface is used to connect to external devices; The flash memory module is used to store a preset table; The data fragmentation analysis module is used to receive fragmentation analysis instructions, confirm the logical address in the logical address range of the fragmentation analysis instructions and the logical interval in the preset table, obtain the logical interval set, and according to the preset table, count the number of times each entity interval is mapped to the logical interval set, obtain the total number of mapping relationships, and calculate the report code based on the total number of mapping relationships.
9. An electronic device, characterized in that, The electronic device includes: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the data fragmentation analysis method as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the data fragmentation analysis method as described in any one of claims 1 to 7.