Flash memory particle capacity calculation method and device, equipment and storage medium

By determining the number of free good and bad blocks in the flash memory particles and fine-tuning the voltage stability, the problem of quickly and accurately calculating the capacity of the flash memory particles is solved, ensuring that the calculation results match the actual conditions of the flash memory particles.

CN120704986APending Publication Date: 2025-09-26SHENZHEN MAIDEYOU SEMICON CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510802863.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-16
Publication Date
2025-09-26

AI Technical Summary

Technical Problem

In the prior art, how to quickly and accurately calculate the capacity of flash memory particles is an urgent problem to be solved, especially determining the remaining capacity of flash memory particles so that users can reasonably arrange data storage.

Method used

By determining the free good blocks of the flash memory particles, calculating the storage space size of each free good block, and combining the number of bad blocks, the capacity is dynamically adjusted using the quantitative relationship between the number of bad blocks and the free good blocks, and fine-tuning is performed considering voltage stability to ultimately accurately calculate the remaining capacity of the flash memory particles.

Benefits of technology

It achieves fast and accurate calculation of the remaining capacity of flash memory particles, ensures that the calculation results are consistent with the current status of the flash memory particles, and improves the accuracy and efficiency of capacity calculation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120704986A_ABST
    Figure CN120704986A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a flash memory particle capacity calculation method and device, equipment and a storage medium, and is applied to electronic equipment which comprises flash memory particles. The method comprises the following steps: determining idle available good blocks of the flash memory particles to obtain a plurality of idle available good blocks; determining the storage space size of each idle available good block in the plurality of idle available good blocks to obtain a plurality of storage space sizes; determining the number of bad blocks in the flash memory particles; and determining the residual capacity of the flash memory particles according to the number of the bad blocks, the plurality of idle and available good blocks and the sizes of the plurality of storage spaces. By adopting the embodiment of the invention, the particle capacity of the flash memory can be quickly and accurately calculated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of electronic technology or storage technology, and specifically to a method, device, equipment and storage medium for calculating the capacity of flash memory particles. Background Art

[0002] The capacity of a flash memory particle can be understood as the maximum amount of data it can store. For example, the capacity of a flash memory particle is 64GB. This capacity can be understood as being determined by the number of storage units inside the flash memory particle and the number of data bits that each unit can store.

[0003] In practical applications, knowing the remaining capacity of flash memory particles can help users clearly understand how much storage space is available and thus arrange data storage reasonably. Therefore, the problem of how to quickly and accurately calculate the capacity of flash memory particles needs to be solved urgently. Summary of the Invention

[0004] The embodiments of the present application provide a method, apparatus, device, and storage medium for calculating the capacity of a flash memory particle, which can quickly and accurately calculate the capacity of a flash memory particle.

[0005] In a first aspect, an embodiment of the present application provides a method for calculating the capacity of a flash memory chip, which is applied to an electronic device, wherein the electronic device includes a flash memory chip; the method includes:

[0006] Determine the idle good blocks of the flash memory particles to obtain a plurality of idle good blocks;

[0007] Determine the storage space size of each of the plurality of free and available good blocks to obtain a plurality of storage space sizes;

[0008] Determining the number of bad blocks in the flash memory particle;

[0009] The remaining capacity of the flash memory particle is determined according to the number of bad blocks, the plurality of free good blocks, and the plurality of storage space sizes.

[0010] In a second aspect, an embodiment of the present application provides a device for calculating the capacity of a flash memory particle, which is applied to an electronic device, wherein the electronic device includes a flash memory particle; the device includes: a first determining unit and a second determining unit, wherein:

[0011] The first determining unit is configured to determine the free and available good blocks of the flash memory particles to obtain a plurality of free and available good blocks; determine the storage space size of each of the plurality of free and available good blocks to obtain a plurality of storage space sizes;

[0012] The second determining unit is configured to determine the number of bad blocks in the flash memory particle; and determine the remaining capacity of the flash memory particle according to the number of bad blocks, the plurality of free good blocks, and the plurality of storage space sizes.

[0013] In a third aspect, an embodiment of the present application provides an electronic device comprising a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the program comprises instructions for executing the steps in the first aspect of the embodiment of the present application.

[0014] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the above-mentioned computer-readable storage medium stores a computer program for electronic data exchange, wherein the above-mentioned computer program enables a computer to execute some or all of the steps described in the first aspect of the embodiment of the present application.

[0015] In a fifth aspect, embodiments of the present application provide a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium storing a computer program, wherein the computer program is operable to cause a computer to perform some or all of the steps described in the first aspect of the embodiments of the present application. The computer program product may be a software installation package.

[0016] The implementation of the embodiments of this application has the following beneficial effects:

[0017] It can be seen that the flash memory particle capacity calculation method, device, equipment and storage medium described in the embodiments of the present application are applied to electronic equipment, which includes flash memory particles, determines the free and available good blocks of the flash memory particles, obtains multiple free and available good blocks, determines the storage space size of each free and available good block in the multiple free and available good blocks, obtains multiple storage space sizes, determines the number of bad blocks in the flash memory particles, and determines the remaining capacity of the flash memory particles based on the number of bad blocks, the multiple free and available good blocks and the multiple storage space sizes. The multiple storage space sizes roughly reflect the remaining capacity of the flash memory particles to a certain extent, and the quantitative relationship between the number of bad blocks and the multiple free and available good blocks also dynamically disturbs the change of the remaining capacity. Therefore, the remaining capacity of the flash memory particles can be accurately determined based on the number of bad blocks, the multiple free and available good blocks and the multiple storage space sizes, so that the remaining capacity of the flash memory particles conforms to the current status of the flash memory particles. In this way, the capacity of the flash memory particles can be calculated quickly and accurately. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0019] Figure 1 This is a flow chart of a method for calculating the capacity of a flash memory chip provided in an embodiment of the present application;

[0020] Figure 2 This is a schematic structural diagram of an electronic device provided in an embodiment of the present application;

[0021] Figure 3 is a structural diagram of another electronic device provided in an embodiment of the present application;

[0022] Figure 4 This is a block diagram of the functional units of a device for calculating the capacity of flash memory particles provided in an embodiment of the present application. DETAILED DESCRIPTION

[0023] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0024] The terms "first," "second," and the like in the specification and claims of this application and the accompanying drawings are used to distinguish between different objects, not to describe a particular order. Furthermore, the terms "including," "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or elements is not limited to the listed steps or elements but may optionally include steps or elements not listed, or may optionally include other steps or elements inherent to the process, method, product, or apparatus.

[0025] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0026] In the embodiments of the present application, the electronic devices involved may be devices including flash memory particles, and the electronic devices may include various handheld devices with wireless communication functions, vehicle-mounted devices (driving recorders, in-car cameras, vehicle-mounted speakers, etc.), servers, smart hard drives, wearable devices (smart glasses, smart bracelets, Internet of Things devices (such as smart refrigerators, smart washing machines, smart TVs), smart watches, etc.), computing devices or other processing devices connected to wireless modems, as well as various forms of user equipment (UE), mobile stations (MS), terminal devices, etc. The electronic devices may also be other storage devices.

[0027] In the embodiment of the present application, the blocks of the flash memory particles may include good blocks and bad blocks. A good block is a flash memory block that can be read or written normally, and can be referred to as a good storage block. A bad block is a flash memory block in the flash memory particle that cannot be read or written normally, and can be referred to as a bad storage block.

[0028] The following is a detailed introduction to the embodiments of the present application.

[0029] See also Figure 1 , Figure 1 This is a flow chart of a method for calculating the capacity of a flash memory particle provided in an embodiment of the present application, which is applied to an electronic device including flash memory particles. The method for calculating the capacity of a flash memory particle includes:

[0030] 101. Determine the idle good blocks of the flash memory particles to obtain multiple idle good blocks.

[0031] In the embodiment of the present application, the idle available good block may specifically refer to a block that is not allocated to any data storage task and is not marked as a bad block.

[0032] In the embodiment of the present application, the flash memory particles may be monitored to determine the idle good blocks of the flash memory particles, and obtain a plurality of idle good blocks.

[0033] Among them, such as Figure 2 As shown, the electronic device may include flash memory particles.

[0034] 102. Determine the storage space size of each of the plurality of free and available good blocks to obtain a plurality of storage space sizes.

[0035] In a specific implementation, since the position and corresponding attributes of each free and available good block are known, the storage space size of each free and available good block among the multiple free and available good blocks can be determined to obtain multiple storage space sizes.

[0036] 103. Determine the number of bad blocks in the flash memory particle.

[0037] In a specific implementation, since the number of storage blocks in the flash memory particles is known, the number of bad blocks can also be continuously updated during use, thereby determining the number of bad blocks in the flash memory particles.

[0038] 104. Determine the remaining capacity of the flash memory particle according to the number of bad blocks, the multiple free good blocks, and the multiple storage space sizes.

[0039] In a specific implementation, as the number of bad blocks continues to increase, the number of good blocks decreases accordingly, and the available capacity of the flash memory particles decreases accordingly.

[0040] In a specific implementation, the sizes of multiple storage spaces roughly reflect the remaining capacity of the flash memory particles to a certain extent, and the quantitative relationship between the number of bad blocks and multiple free good blocks also dynamically disturbs the change of the remaining capacity. Therefore, the remaining capacity of the flash memory particles can be accurately determined based on the number of bad blocks, multiple free good blocks and multiple storage space sizes, so that the remaining capacity of the flash memory particles is consistent with the current status of the flash memory particles.

[0041] Optionally, the above step 104, determining the remaining capacity of the flash memory particles according to the number of bad blocks, the plurality of free good blocks, and the plurality of storage space sizes, may be implemented as follows:

[0042] Determine the sum of the multiple storage space sizes to obtain a first storage space size;

[0043] Determine a first quantity ratio according to the quantity of the bad blocks and the plurality of idle good blocks;

[0044] determining a first adjustment parameter corresponding to the first quantity ratio;

[0045] The size of the first storage space is adjusted according to the first adjustment parameter to obtain the remaining capacity.

[0046] In a specific implementation, the sum of multiple storage space sizes can be determined, that is, the multiple storage space sizes are added together to obtain a first storage space size, and then a first quantity ratio is determined based on the number of bad blocks and multiple free good blocks, that is, the first number of free good blocks is determined, and the first quantity ratio = number of bad blocks / first quantity.

[0047] In specific implementations, the ratio between the number of available good blocks (the first number) and the number of bad blocks will, to a certain extent, affect the write amplification effect of the flash memory, and thus affect the capacity utilization. When there are a large number of bad blocks, the controller of the flash memory particles may need to frequently perform data transfer and block erase operations when writing data to avoid bad blocks and find available good blocks. This write amplification phenomenon can cause the actual amount of data written to be far greater than the amount of data the user needs to store, reducing the actual utilization of the flash memory particles and, to a certain extent, reducing the available capacity.

[0048] Next, a mapping relationship between a preset quantity ratio and an adjustment parameter can be pre-stored, and then, a first adjustment parameter corresponding to the first quantity ratio can be determined based on the mapping relationship, wherein the value range of the adjustment parameter can be pre-set or system-defined, for example, the value range of the adjustment parameter is -0.1 to 0.1, and finally, the first storage space size can be adjusted according to the first adjustment parameter to obtain the remaining capacity, that is, the remaining capacity = (1 + first adjustment parameter) × the first storage space size, thereby firstly using a plurality of free available good blocks to preliminarily determine the reference remaining capacity, and then using the quantitative relationship between the number of bad blocks and the plurality of free available good blocks to dynamically optimize the capacity, so that the remaining capacity depth is consistent with the actual utilization rate of the flash memory particles, that is, the remaining capacity of the flash memory particles is consistent with the current status of the flash memory particles, thereby quickly and accurately calculating the flash memory particle capacity.

[0049] Optionally, the above step of adjusting the size of the first storage space according to the first adjustment parameter to obtain the remaining capacity may be implemented as follows:

[0050] determining a reference remaining capacity according to the first adjustment parameter and the size of the first storage space;

[0051] Obtaining the operating voltage of the flash memory particles in a preset time period to obtain multiple operating voltages;

[0052] determining a first stability evaluation parameter according to the multiple operating voltages;

[0053] determining a first fine-tuning parameter according to the first stability evaluation parameter;

[0054] Fine-tuning the reference remaining capacity is performed according to the first fine-tuning parameter to obtain the remaining capacity.

[0055] In practice, the voltage stability of flash memory chips plays a crucial role in ensuring the proper functioning and effective utilization of their capacity. Stable voltage is the foundation for accurate read and write operations and reliable data storage. For example, when the voltage is unstable, the charge state within the flash memory chips may change, affecting the correct storage and access of data, and thus affecting its actual usable capacity.

[0056] For example, when voltage instability causes read and write errors in flash memory, the system spends more time and resources on error correction and data recovery. This not only reduces overall system performance but can also prevent some data from being recovered in a timely manner or even unrecoverable, making the storage cells occupied by that data unusable and indirectly affecting the actual available capacity of the flash memory.

[0057] The preset time period may be pre-set or set by system default.

[0058] In an embodiment of the present application, a reference remaining capacity can be determined based on the first adjustment parameter and the first storage space size, where the reference remaining capacity = (1 + the first adjustment parameter) × the first storage space size. Then, the operating voltage of the flash memory particles in a preset time period can be obtained to obtain multiple operating voltages. The multiple operating voltages reflect the operating stability of the flash memory particles to a certain extent.

[0059] Furthermore, a first stability evaluation parameter can be determined based on multiple operating voltages, and a mapping relationship between a preset stability evaluation parameter and a fine-tuning parameter can be pre-stored. Then, a first fine-tuning parameter corresponding to the first stability evaluation parameter can be determined based on the mapping relationship. The value range of the first fine-tuning parameter can be pre-set or system default. For example, the value range of the first fine-tuning parameter can be -0.01 to 0.01. Finally, the reference remaining capacity can be fine-tuned according to the first fine-tuning parameter to obtain the remaining capacity, that is, the remaining capacity = (1 + first fine-tuning parameter) × reference remaining capacity. On the one hand, the reference remaining capacity is preliminarily determined using multiple idle good blocks, and then the capacity is dynamically optimized using the quantitative relationship between the number of bad blocks and the multiple idle good blocks, so that the reference remaining capacity depth is consistent with the actual utilization rate of the flash memory particles. On the other hand, the reference remaining capacity can be further deeply fine-tuned based on the working stability of the flash memory particles, so that the remaining capacity of the flash memory particles is consistent with the current status of the flash memory particles, thereby quickly and accurately calculating the flash memory particle capacity.

[0060] Optionally, each of the multiple operating voltages corresponds to a sampling moment; the above step of determining the first stability evaluation parameter based on the multiple operating voltages can be implemented as follows:

[0061] Perform fitting based on the multiple operating voltages and a sampling moment corresponding to each operating voltage in the multiple operating voltages to obtain a first fitting straight line and a first fitting curve segment;

[0062] Obtaining the absolute value of the slope of the first fitting straight line to obtain a first absolute value;

[0063] Obtaining a mean of the first fitting curve segment to obtain a first mean;

[0064] Obtaining a first sampling quantity corresponding to the first absolute value;

[0065] Sampling the first fitting curve segment according to the first sampling quantity to obtain a plurality of sampling points;

[0066] Performing a mean square error operation on the plurality of sampling points to obtain a first mean square error;

[0067] The first stability evaluation parameter is determined according to the first mean, the first absolute value, and the first mean square error.

[0068] In a specific implementation, each of the multiple operating voltages corresponds to a sampling moment. Specifically, the operating voltage of the flash memory chip can be collected at a preset time interval to obtain multiple operating voltages. The preset time interval can be pre-set or system default. Each operating voltage corresponds to a sampling moment.

[0069] Then, fitting can be performed based on multiple working voltages and a sampling moment corresponding to each of the multiple working voltages to obtain a first fitting straight line and a first fitting curve segment, that is, multiple working voltages and a sampling moment corresponding to each of the multiple working voltages can be regarded as multiple coordinate points, each coordinate point corresponds to a working voltage and a sampling moment, and multiple coordinate points exist in a specified coordinate system, the horizontal axis of the specified coordinate system is time, and the vertical axis is voltage, that is, a straight line fitting is performed based on multiple coordinate points to obtain a first fitting straight line, and a curve fitting is performed based on multiple coordinate points to obtain a first fitting curve segment corresponding to a preset time period.

[0070] Furthermore, the slope of the first fitting line can be obtained, and the absolute value of the slope can be taken to obtain a first absolute value. The first absolute value reflects, to a certain extent, the future operational stability (long-term stability) of the flash memory particles. Accordingly, the mean of the first fitting curve segment can be obtained to obtain a first mean value, which reflects the average voltage environment of the flash memory particles. A mapping relationship between a preset absolute value and a sampling number can also be pre-stored, and then, based on this mapping relationship, the first sampling number corresponding to the first absolute value is determined. The larger the absolute value, the larger the sampling number, and conversely, the smaller the absolute value, the smaller the sampling number.

[0071] Next, the first fitting curve segment can be sampled according to the first sampling quantity to obtain multiple sampling points, and then a mean square error calculation can be performed based on the multiple sampling points to obtain a first mean square error. The first mean square error reflects the working stability of the flash memory particles within a preset time period (the stability of the current time period). Then, the first stability evaluation parameter is determined based on the first mean, the first absolute value and the first mean square error. In this way, the future working stability of the flash memory particles, the average voltage environment of the flash memory particles and the working stability of the flash memory particles within the preset time period can be used to accurately evaluate the actual stability of the flash memory particles at the current moment, which helps to ensure the accuracy of the determination of the working stability of the flash memory particles.

[0072] Optionally, the above step of determining the first stability evaluation parameter according to the first mean, the first absolute value, and the first mean square error may be implemented as follows:

[0073] determining a first reference stability evaluation parameter corresponding to the first absolute value;

[0074] determining a second reference stability evaluation parameter corresponding to the first mean square error;

[0075] Obtaining a first weight pair corresponding to the first mean, the first weight pair including a first weight and a second weight, the sum of the first weight and the second weight being 1; the first reference stability evaluation parameter corresponding to the first weight, and the second reference stability evaluation parameter corresponding to the second weight;

[0076] A weighted operation is performed based on the first reference stability evaluation parameter, the second reference stability evaluation parameter, the first weight, and the second weight to obtain the first stability evaluation parameter.

[0077] In a specific implementation, a first mapping relationship between a preset absolute value and a stability evaluation parameter can be pre-stored, and a first reference stability evaluation parameter corresponding to the first absolute value can be determined based on the first mapping relationship. Accordingly, a second mapping relationship between a preset mean square error and a stability evaluation parameter can be pre-stored, and a second reference stability evaluation parameter corresponding to the first mean square error can be determined based on the second mapping relationship.

[0078] Among them, the first reference stability evaluation parameter and the second reference stability evaluation parameter are both evaluated using percentage values.

[0079] Then, the mapping relationship between the preset mean and the weight pair can be pre-stored. The weight pair can include 2 weights, the sum of the 2 weights is 1, and the 2 weights correspond to the stability evaluation parameters of 2 dimensions respectively. Based on the mapping relationship, the first weight pair corresponding to the first mean can be determined. The first weight pair includes the first weight and the second weight, the sum of the first weight and the second weight is 1, the first reference stability evaluation parameter corresponds to the first weight, and the second reference stability evaluation parameter corresponds to the second weight.

[0080] Finally, a weighted operation can be performed based on the first reference stability evaluation parameter, the second reference stability evaluation parameter, the first weight, and the second weight to obtain the first stability evaluation parameter, the first stability evaluation parameter = the first reference stability evaluation parameter × the first weight + the second reference stability evaluation parameter × the second weight. In this way, on the one hand, the future working stability of the flash memory particles and the working stability of the flash memory particles within a preset time period are evaluated. On the other hand, the average voltage environment of the flash memory particles is used to accurately evaluate the weights corresponding to the working stability of the two dimensions. Then, weighting is performed based on the weights and the working stability of the two dimensions to comprehensively evaluate the working stability at the current moment, which helps to ensure the accuracy of the determination of the working stability of the flash memory particles.

[0081] Optionally, the above step of determining the first adjustment parameter corresponding to the first quantity ratio may be implemented as follows:

[0082] Obtaining a first attribute parameter of the flash memory particle;

[0083] Determine an adjustment parameter set corresponding to the first attribute parameter, the adjustment parameter set including a plurality of adjustment parameters, each adjustment parameter corresponding to a quantity ratio;

[0084] determining an absolute value of a difference between a quantity ratio corresponding to each adjustment parameter in the plurality of adjustment parameters and the first quantity ratio to obtain a plurality of absolute values;

[0085] Determine a minimum value among the multiple absolute values, and obtain an adjustment parameter corresponding to the minimum value to obtain the first adjustment parameter.

[0086] In specific implementations, the proportional relationship between the number of available good blocks (the first number) and the number of bad blocks will, to a certain extent, affect the write amplification effect of the flash memory and thus its capacity utilization. When there are a large number of bad blocks, the controller of the flash memory particles may need to frequently perform data transfers and block erase operations when writing data to avoid bad blocks and find available good blocks. This write amplification phenomenon can cause the actual amount of data written to be far greater than the amount of data the user needs to store, reducing the actual utilization of the flash memory particles and, to a certain extent, reducing the available capacity.

[0087] The first attribute parameter of the flash memory particle may include at least one of the following: the model of the flash memory particle, the material of the flash memory particle, the structure of the flash memory particle, etc., which are not limited here. The first attribute parameter of the flash memory particle reflects the characteristics of the flash memory particle to a certain extent. A mapping relationship between preset attribute parameters of the flash memory particle and an adjustment parameter set can be pre-stored. The adjustment parameter set includes multiple adjustment parameters, each adjustment parameter corresponding to a quantity ratio. Based on this mapping relationship, the adjustment parameter set corresponding to the first attribute parameter can be determined. The adjustment parameter set corresponding to the first attribute parameter includes multiple adjustment parameters, each adjustment parameter corresponding to a quantity ratio.

[0088] Next, the absolute value of the difference between the quantity ratio corresponding to each adjustment parameter in the multiple adjustment parameters and the first quantity ratio can be determined to obtain multiple absolute values, and then the minimum value among the multiple absolute values ​​can be determined, and the adjustment parameter corresponding to the minimum value can be obtained to obtain the first adjustment parameter. On the one hand, the corresponding adjustment parameter set can be adapted based on the characteristics of the flash memory particles. On the other hand, since different quantity ratios reflect the current status of the flash memory particles, the adjustment parameters corresponding to their current status can be further locked, which helps to dynamically optimize the capacity by utilizing the quantitative relationship between the number of bad blocks and multiple idle good blocks, so that the remaining capacity depth is consistent with the actual utilization rate of the flash memory particles, that is, the remaining capacity of the flash memory particles is consistent with the current status of the flash memory particles, thereby quickly and accurately calculating the capacity of the flash memory particles.

[0089] It can be seen that the method for calculating the capacity of flash memory particles described in the embodiment of the present application is applied to electronic devices, which include flash memory particles. The free and available good blocks of the flash memory particles are determined to obtain multiple free and available good blocks. The storage space size of each free and available good block in the multiple free and available good blocks is determined to obtain multiple storage space sizes. The number of bad blocks in the flash memory particles is determined. The remaining capacity of the flash memory particles is determined based on the number of bad blocks, the multiple free and available good blocks and the multiple storage space sizes. The multiple storage space sizes roughly reflect the remaining capacity of the flash memory particles to a certain extent, and the quantitative relationship between the number of bad blocks and the multiple free and available good blocks also dynamically disturbs the change of the remaining capacity. Therefore, the remaining capacity of the flash memory particles can be accurately determined based on the number of bad blocks, the multiple free and available good blocks and the multiple storage space sizes, so that the remaining capacity of the flash memory particles conforms to the current status of the flash memory particles. In this way, the capacity of the flash memory particles can be calculated quickly and accurately.

[0090] In accordance with the above embodiment, please refer to Figure 3 , Figure 3This is a structural diagram of another electronic device provided in an embodiment of the present application. The electronic device includes a processor, a memory, a communication interface, and one or more programs. The one or more programs are stored in the memory and are configured to be executed by the processor. In the embodiment of the present application, the electronic device includes flash memory particles, and the program includes instructions for performing the following steps:

[0091] Determine the idle good blocks of the flash memory particles to obtain a plurality of idle good blocks;

[0092] Determine the storage space size of each of the plurality of free and available good blocks to obtain a plurality of storage space sizes;

[0093] Determining the number of bad blocks in the flash memory particle;

[0094] The remaining capacity of the flash memory particle is determined according to the number of bad blocks, the plurality of free good blocks, and the plurality of storage space sizes.

[0095] Optionally, in determining the remaining capacity of the flash memory particles according to the number of bad blocks, the plurality of free good blocks, and the plurality of storage space sizes, the program includes instructions for executing the following steps:

[0096] Determine the sum of the multiple storage space sizes to obtain a first storage space size;

[0097] Determine a first quantity ratio according to the quantity of the bad blocks and the plurality of idle good blocks;

[0098] determining a first adjustment parameter corresponding to the first quantity ratio;

[0099] The size of the first storage space is adjusted according to the first adjustment parameter to obtain the remaining capacity.

[0100] Optionally, in terms of adjusting the size of the first storage space according to the first adjustment parameter to obtain the remaining capacity, the program includes instructions for executing the following steps:

[0101] determining a reference remaining capacity according to the first adjustment parameter and the size of the first storage space;

[0102] Obtaining the operating voltage of the flash memory particles in a preset time period to obtain multiple operating voltages;

[0103] determining a first stability evaluation parameter according to the multiple operating voltages;

[0104] determining a first fine-tuning parameter according to the first stability evaluation parameter;

[0105] Fine-tuning the reference remaining capacity is performed according to the first fine-tuning parameter to obtain the remaining capacity.

[0106] Optionally, each of the multiple operating voltages corresponds to a sampling moment; and in determining the first stability evaluation parameter based on the multiple operating voltages, the program includes instructions for executing the following steps:

[0107] Perform fitting based on the multiple operating voltages and a sampling moment corresponding to each operating voltage in the multiple operating voltages to obtain a first fitting straight line and a first fitting curve segment;

[0108] Obtaining the absolute value of the slope of the first fitting straight line to obtain a first absolute value;

[0109] Obtaining a mean of the first fitting curve segment to obtain a first mean;

[0110] Obtaining a first sampling quantity corresponding to the first absolute value;

[0111] Sampling the first fitting curve segment according to the first sampling quantity to obtain a plurality of sampling points;

[0112] Performing a mean square error operation on the plurality of sampling points to obtain a first mean square error;

[0113] The first stability evaluation parameter is determined according to the first mean, the first absolute value, and the first mean square error.

[0114] Optionally, in determining the first stability evaluation parameter according to the first mean, the first absolute value, and the first mean square error, the program includes instructions for executing the following steps:

[0115] determining a first reference stability evaluation parameter corresponding to the first absolute value;

[0116] determining a second reference stability evaluation parameter corresponding to the first mean square error;

[0117] Obtaining a first weight pair corresponding to the first mean, the first weight pair including a first weight and a second weight, the sum of the first weight and the second weight being 1; the first reference stability evaluation parameter corresponding to the first weight, and the second reference stability evaluation parameter corresponding to the second weight;

[0118] A weighted operation is performed based on the first reference stability evaluation parameter, the second reference stability evaluation parameter, the first weight, and the second weight to obtain the first stability evaluation parameter.

[0119] Optionally, in determining the first adjustment parameter corresponding to the first quantity ratio, the program includes instructions for executing the following steps:

[0120] Obtaining a first attribute parameter of the flash memory particle;

[0121] Determine an adjustment parameter set corresponding to the first attribute parameter, the adjustment parameter set including a plurality of adjustment parameters, each adjustment parameter corresponding to a quantity ratio;

[0122] determining an absolute value of a difference between a quantity ratio corresponding to each adjustment parameter in the plurality of adjustment parameters and the first quantity ratio to obtain a plurality of absolute values;

[0123] Determine a minimum value among the multiple absolute values, and obtain an adjustment parameter corresponding to the minimum value to obtain the first adjustment parameter.

[0124] It can be seen that the electronic device described in the embodiment of the present application includes flash memory particles, determines the free and available good blocks of the flash memory particles, obtains multiple free and available good blocks, determines the storage space size of each free and available good block in the multiple free and available good blocks, obtains multiple storage space sizes, determines the number of bad blocks in the flash memory particles, and determines the remaining capacity of the flash memory particles based on the number of bad blocks, the multiple free and available good blocks and the multiple storage space sizes. The multiple storage space sizes roughly reflect the remaining capacity of the flash memory particles to a certain extent, and the quantitative relationship between the number of bad blocks and the multiple free and available good blocks also dynamically disturbs the change of the remaining capacity. Therefore, the remaining capacity of the flash memory particles can be accurately determined based on the number of bad blocks, the multiple free and available good blocks and the multiple storage space sizes, so that the remaining capacity of the flash memory particles conforms to the current status of the flash memory particles. In this way, the capacity of the flash memory particles can be calculated quickly and accurately.

[0125] Figure 4 This is a block diagram of the functional units of a flash memory particle capacity calculation device 400 involved in an embodiment of the present application. The flash memory particle capacity calculation device 400 is applied to an electronic device, the electronic device includes flash memory particles, and the flash memory particle capacity calculation device 400 includes: a first determination unit 401 and a second determination unit 402, wherein,

[0126] The first determining unit 401 is configured to determine the free and available good blocks of the flash memory particles to obtain a plurality of free and available good blocks; determine the storage space size of each of the plurality of free and available good blocks to obtain a plurality of storage space sizes;

[0127] The second determining unit 402 is configured to determine the number of bad blocks in the flash memory particle; and determine the remaining capacity of the flash memory particle according to the number of bad blocks, the plurality of free good blocks, and the plurality of storage space sizes.

[0128] Optionally, in determining the remaining capacity of the flash memory particle according to the number of bad blocks, the plurality of free good blocks, and the plurality of storage space sizes, the second determining unit 402 is specifically configured to:

[0129] Determine the sum of the multiple storage space sizes to obtain a first storage space size;

[0130] Determine a first quantity ratio according to the quantity of the bad blocks and the plurality of idle good blocks;

[0131] determining a first adjustment parameter corresponding to the first quantity ratio;

[0132] The size of the first storage space is adjusted according to the first adjustment parameter to obtain the remaining capacity.

[0133] Optionally, in adjusting the size of the first storage space according to the first adjustment parameter to obtain the remaining capacity, the second determining unit 402 is specifically configured to:

[0134] determining a reference remaining capacity according to the first adjustment parameter and the size of the first storage space;

[0135] Obtaining the operating voltage of the flash memory particles in a preset time period to obtain multiple operating voltages;

[0136] determining a first stability evaluation parameter according to the multiple operating voltages;

[0137] determining a first fine-tuning parameter according to the first stability evaluation parameter;

[0138] Fine-tuning the reference remaining capacity is performed according to the first fine-tuning parameter to obtain the remaining capacity.

[0139] Optionally, each of the multiple operating voltages corresponds to a sampling moment; in determining the first stability evaluation parameter based on the multiple operating voltages, the second determining unit 402 is specifically configured to:

[0140] Perform fitting based on the multiple operating voltages and a sampling moment corresponding to each operating voltage in the multiple operating voltages to obtain a first fitting straight line and a first fitting curve segment;

[0141] Obtaining the absolute value of the slope of the first fitting straight line to obtain a first absolute value;

[0142] Obtaining a mean of the first fitting curve segment to obtain a first mean;

[0143] Obtaining a first sampling quantity corresponding to the first absolute value;

[0144] Sampling the first fitting curve segment according to the first sampling quantity to obtain a plurality of sampling points;

[0145] Performing a mean square error operation on the plurality of sampling points to obtain a first mean square error;

[0146] The first stability evaluation parameter is determined according to the first mean, the first absolute value, and the first mean square error.

[0147] Optionally, in determining the first stability evaluation parameter according to the first mean, the first absolute value, and the first mean square error, the second determining unit 402 is specifically configured to:

[0148] determining a first reference stability evaluation parameter corresponding to the first absolute value;

[0149] determining a second reference stability evaluation parameter corresponding to the first mean square error;

[0150] Obtaining a first weight pair corresponding to the first mean, the first weight pair including a first weight and a second weight, the sum of the first weight and the second weight being 1; the first reference stability evaluation parameter corresponding to the first weight, and the second reference stability evaluation parameter corresponding to the second weight;

[0151] A weighted operation is performed based on the first reference stability evaluation parameter, the second reference stability evaluation parameter, the first weight, and the second weight to obtain the first stability evaluation parameter.

[0152] Optionally, in determining the first adjustment parameter corresponding to the first quantity ratio, the second determining unit 402 is specifically configured to:

[0153] Obtaining a first attribute parameter of the flash memory particle;

[0154] Determine an adjustment parameter set corresponding to the first attribute parameter, the adjustment parameter set including a plurality of adjustment parameters, each adjustment parameter corresponding to a quantity ratio;

[0155] determining an absolute value of a difference between a quantity ratio corresponding to each adjustment parameter in the plurality of adjustment parameters and the first quantity ratio to obtain a plurality of absolute values;

[0156] Determine a minimum value among the multiple absolute values, and obtain an adjustment parameter corresponding to the minimum value to obtain the first adjustment parameter.

[0157] It can be seen that the flash memory particle capacity calculation device described in the embodiment of the present application is applied to electronic equipment, which includes flash memory particles, determines the free and available good blocks of the flash memory particles, obtains multiple free and available good blocks, determines the storage space size of each free and available good block in the multiple free and available good blocks, obtains multiple storage space sizes, determines the number of bad blocks in the flash memory particles, and determines the remaining capacity of the flash memory particles based on the number of bad blocks, the multiple free and available good blocks and the multiple storage space sizes. The multiple storage space sizes roughly reflect the remaining capacity of the flash memory particles to a certain extent, and the quantitative relationship between the number of bad blocks and the multiple free and available good blocks also dynamically disturbs the change of the remaining capacity. Therefore, the remaining capacity of the flash memory particles can be accurately determined based on the number of bad blocks, the multiple free and available good blocks and the multiple storage space sizes, so that the remaining capacity of the flash memory particles conforms to the current status of the flash memory particles. In this way, the capacity of the flash memory particles can be calculated quickly and accurately.

[0158] It can be understood that the functions of each program module of the flash memory particle capacity calculation device of this embodiment can be specifically implemented according to the method in the above method embodiment. The specific implementation process can refer to the relevant description of the above method embodiment and will not be repeated here.

[0159] An embodiment of the present application also provides a computer storage medium, wherein the computer storage medium stores a computer program for electronic data exchange, and the computer program enables a computer to execute part or all of the steps of any method described in the above method embodiments.

[0160] The present application also provides a computer program product comprising a non-transitory computer-readable storage medium storing a computer program, wherein the computer program is operable to cause a computer to execute some or all of the steps of any of the methods described in the above method embodiments. The computer program product may be a software installation package.

[0161] It should be noted that for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.

[0162] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0163] In the several embodiments provided in this application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the above-mentioned units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.

[0164] The units described above as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0165] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0166] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory, including a number of instructions for enabling a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the above-mentioned methods of each embodiment of the present application. The aforementioned memory includes: various media that can store program codes, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0167] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable memory, which may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0168] The above is a detailed introduction to the embodiments of the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of ​​the present application. At the same time, for those skilled in the art, according to the idea of ​​the present application, there may be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A method for calculating the capacity of a flash memory particle, characterized in that: Applied to electronic equipment, the electronic equipment includes flash memory particles; the method includes: Determine the idle good blocks of the flash memory particles to obtain a plurality of idle good blocks; Determine the storage space size of each of the plurality of free and available good blocks to obtain a plurality of storage space sizes; Determining the number of bad blocks in the flash memory particle; The remaining capacity of the flash memory particle is determined according to the number of bad blocks, the plurality of free good blocks, and the plurality of storage space sizes.

2. The method according to claim 1, characterized in that The determining the remaining capacity of the flash memory particles according to the number of bad blocks, the plurality of free good blocks, and the plurality of storage space sizes includes: Determine the sum of the multiple storage space sizes to obtain a first storage space size; Determine a first quantity ratio according to the quantity of the bad blocks and the plurality of idle good blocks; determining a first adjustment parameter corresponding to the first quantity ratio; The size of the first storage space is adjusted according to the first adjustment parameter to obtain the remaining capacity.

3. The method according to claim 2, characterized in that The adjusting the size of the first storage space according to the first adjustment parameter to obtain the remaining capacity includes: determining a reference remaining capacity according to the first adjustment parameter and the size of the first storage space; Obtaining the operating voltage of the flash memory particles in a preset time period to obtain multiple operating voltages; determining a first stability evaluation parameter according to the multiple operating voltages; determining a first fine-tuning parameter according to the first stability evaluation parameter; Fine-tuning the reference remaining capacity is performed according to the first fine-tuning parameter to obtain the remaining capacity.

4. The method according to claim 3, characterized in that Each of the multiple operating voltages corresponds to a sampling moment; and determining the first stability evaluation parameter according to the multiple operating voltages includes: Perform fitting based on the multiple operating voltages and a sampling moment corresponding to each operating voltage in the multiple operating voltages to obtain a first fitting straight line and a first fitting curve segment; Obtaining the absolute value of the slope of the first fitting straight line to obtain a first absolute value; Obtaining a mean of the first fitting curve segment to obtain a first mean; Obtaining a first sampling quantity corresponding to the first absolute value; Sampling the first fitting curve segment according to the first sampling quantity to obtain a plurality of sampling points; Performing a mean square error operation on the plurality of sampling points to obtain a first mean square error; The first stability evaluation parameter is determined according to the first mean, the first absolute value, and the first mean square error.

5. The method according to claim 4, characterized in that The determining the first stability evaluation parameter according to the first mean, the first absolute value, and the first mean square error includes: determining a first reference stability evaluation parameter corresponding to the first absolute value; determining a second reference stability evaluation parameter corresponding to the first mean square error; Obtaining a first weight pair corresponding to the first mean, the first weight pair including a first weight and a second weight, the sum of the first weight and the second weight being 1; the first reference stability evaluation parameter corresponding to the first weight, and the second reference stability evaluation parameter corresponding to the second weight; A weighted operation is performed based on the first reference stability evaluation parameter, the second reference stability evaluation parameter, the first weight, and the second weight to obtain the first stability evaluation parameter.

6. The method according to any one of claims 2 to 5, characterized in that: The determining of a first adjustment parameter corresponding to the first quantity ratio includes: Obtaining a first attribute parameter of the flash memory particle; Determine an adjustment parameter set corresponding to the first attribute parameter, the adjustment parameter set including a plurality of adjustment parameters, each adjustment parameter corresponding to a quantity ratio; determining an absolute value of a difference between a quantity ratio corresponding to each adjustment parameter in the plurality of adjustment parameters and the first quantity ratio to obtain a plurality of absolute values; Determine a minimum value among the multiple absolute values, and obtain an adjustment parameter corresponding to the minimum value to obtain the first adjustment parameter.

7. A device for calculating the capacity of a flash memory particle, characterized in that: Applied to electronic equipment, the electronic equipment includes flash memory particles; the device includes: a first determining unit and a second determining unit, wherein, The first determining unit is configured to determine the free and available good blocks of the flash memory particles to obtain a plurality of free and available good blocks; determine the storage space size of each of the plurality of free and available good blocks to obtain a plurality of storage space sizes; The second determining unit is configured to determine the number of bad blocks in the flash memory particle; and determine the remaining capacity of the flash memory particle according to the number of bad blocks, the plurality of free good blocks, and the plurality of storage space sizes.

8. The device according to claim 7, characterized in that In determining the remaining capacity of the flash memory particle according to the number of bad blocks, the plurality of free good blocks, and the plurality of storage space sizes, the second determining unit is specifically configured to: Determine the sum of the multiple storage space sizes to obtain a first storage space size; Determine a first quantity ratio according to the quantity of the bad blocks and the plurality of idle good blocks; determining a first adjustment parameter corresponding to the first quantity ratio; The size of the first storage space is adjusted according to the first adjustment parameter to obtain the remaining capacity.

9. An electronic device, characterized in that: The method comprises a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the programs include instructions for executing the steps in the method according to any one of claims 1 to 6.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method according to any one of claims 1 to 6.