CN111880732A - Flash memory data refreshing method and device - Google Patents

Flash memory data refreshing method and device Download PDF

Info

Publication number
CN111880732A
CN111880732A CN202010701408.7A CN202010701408A CN111880732A CN 111880732 A CN111880732 A CN 111880732A CN 202010701408 A CN202010701408 A CN 202010701408A CN 111880732 A CN111880732 A CN 111880732A
Authority
CN
China
Prior art keywords
flash memory
memory block
refreshed
terminal equipment
state
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010701408.7A
Other languages
Chinese (zh)
Inventor
冯斌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN202010701408.7A priority Critical patent/CN111880732A/en
Publication of CN111880732A publication Critical patent/CN111880732A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0614Improving the reliability of storage systems
    • G06F3/0619Improving the reliability of storage systems in relation to data integrity, e.g. data losses, bit errors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/064Management of blocks

Abstract

The embodiment of the invention discloses a flash memory data refreshing method and device, relates to the technical field of flash memory refreshing, and is used for solving the problem that a flash memory data refreshing mechanism in the prior art may cause the data storage duration of partial flash memory blocks to exceed the reliable storage duration. The method comprises the following steps: acquiring the data storage time length of each flash memory block of the terminal equipment; judging whether a flash memory block to be refreshed exists or not, wherein the flash memory block to be refreshed is a flash memory block with the data storage time length larger than the threshold time length; if the flash memory block to be refreshed exists, judging whether the state of the terminal equipment meets a preset condition; and under the condition that the state of the terminal equipment is determined to meet the preset condition, refreshing the data stored in the flash memory block to be refreshed. The embodiment of the invention is used for refreshing the data stored in the flash memory.

Description

Flash memory data refreshing method and device
Technical Field
The embodiment of the invention relates to the technical field of flash memory refreshing, in particular to a flash memory data refreshing method and device.
Background
With the popularization of electronic devices, electronic devices are indispensable in the lives of people. In general, a storage medium in the electronic device is a Flash memory (Flash memory) in a nonvolatile memory, and a user can store data such as a photograph, a document, and personal information by using the Flash memory in the electronic device.
With the increasing demand for storage capacity, a single flash memory block can store more and more data bits. However, the time for the flash memory block to store data is shortened due to the fact that the number of data bits stored in the flash memory block is increased, and if the data stored in the flash memory block is not refreshed in time, the data can be lost or damaged, and hidden danger and inconvenience of data loss are brought to users. In the prior art, a passively triggered refresh mechanism is generally adopted to refresh the data stored in the flash memory block. That is, the controller of the electronic device determines whether the data stored in each flash memory block needs to be refreshed according to the state of the flash memory block, the wear-out state of the flash memory block, and the preset refresh algorithm, and refreshes the data stored in a certain flash memory block when it is determined that the data stored in the flash memory block needs to be refreshed. In the prior art, the flash memory data refresh mechanism can only effectively refresh the data in all flash memory blocks under the condition that the controller normally operates and the refresh algorithm adopted by the refresh mechanism is reasonable, and once the controller fails or the refresh algorithm adopted by the refresh mechanism is unreasonable, the problem that part of the data stored in the flash memory blocks cannot be refreshed exists. If the data stored in some flash memory blocks is not refreshed for a long time, the data storage duration of the part of flash memory blocks may exceed the reliable storage duration, thereby causing the data stored in the part of flash memory blocks to be lost or damaged.
Disclosure of Invention
The embodiment of the invention provides a method and a device for collecting wake-up logs, which are used for solving the problem that a flash memory data refreshing mechanism in the prior art may cause the data storage duration of partial flash memory blocks to exceed the reliable storage duration.
In order to solve the above technical problem, the embodiment of the present invention is implemented as follows:
in a first aspect, an embodiment of the present invention provides a flash memory data refreshing method, including:
acquiring the data storage time length of each flash memory block of the terminal equipment;
judging whether a flash memory block to be refreshed exists or not, wherein the flash memory block to be refreshed is a flash memory block with the data storage time length larger than a threshold time length;
if the flash memory block to be refreshed exists, judging whether the state of the terminal equipment meets a preset condition;
and under the condition that the state of the terminal equipment is determined to meet the preset condition, refreshing the data stored in the flash memory block to be refreshed.
In a second aspect, a flash memory data refreshing apparatus is provided, including:
the acquisition unit is used for acquiring the data storage time length of each flash memory block of the terminal equipment;
the processing unit is used for judging whether a flash memory block to be refreshed exists or not, wherein the flash memory block to be refreshed is a flash memory block with the data storage time length larger than the threshold time length;
the processing unit is further used for judging whether the state of the terminal equipment meets a preset condition or not under the condition that the flash memory block to be refreshed is determined;
and the refreshing unit is used for refreshing the data stored in the flash memory block to be refreshed under the condition that the state of the terminal equipment is determined to meet the preset condition.
In a third aspect, a terminal device is provided, including: a processor, a memory and a computer program stored on said memory and executable on said processor, said computer program, when executed by said processor, implementing the flash data refresh method according to the first aspect.
In a fourth aspect, a computer-readable storage medium is provided, comprising: the computer-readable storage medium has stored thereon a computer program which, when executed by a processor, implements the flash memory data refresh method according to the first aspect.
The flash memory data refreshing method provided by the embodiment of the invention firstly obtains the data storage time length of each flash memory block of the terminal equipment, then judges whether the flash memory block to be refreshed exists, the data storage time length of which is greater than the threshold time length, judges whether the state of the terminal equipment meets the preset condition if the flash memory block to be refreshed exists, and refreshes the data stored in the flash memory block to be refreshed under the condition that the state of the terminal equipment meets the preset condition. Compared with the prior art that a passively triggered refresh mechanism is adopted to refresh the data stored in the flash memory blocks, the flash memory data refresh method provided by the embodiment of the invention can refresh the data stored in the flash memory blocks to be refreshed, the data storage time length of which is greater than the threshold time length, based on the data storage time length of each flash memory block and the state of the terminal equipment.
Drawings
FIG. 1 is a first flowchart illustrating a method for refreshing flash memory data according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a second step of a flash memory data refreshing method according to an embodiment of the present invention;
fig. 3 is a flowchart illustrating a third step of the flash memory data refreshing method according to an embodiment of the present invention;
FIG. 4 is a flowchart illustrating a fourth step of a method for refreshing flash memory data according to an embodiment of the present invention;
FIG. 5 is a flowchart illustrating a fifth step of a method for refreshing flash memory data according to an embodiment of the present invention;
FIG. 6 is a schematic structural diagram of a flash memory data refreshing apparatus according to an embodiment of the present invention;
fig. 7 is a schematic diagram of a hardware structure of a terminal device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the embodiments of the present invention, words such as "exemplary" or "for example" are used to mean serving as examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "e.g.," an embodiment of the present invention is not necessarily to be construed as preferred or advantageous over other embodiments or designs. Rather, use of the word "exemplary" or "such as" is intended to present concepts related in a concrete fashion. Further, in the description of the embodiments of the present invention, "a plurality" means two or more unless otherwise specified.
The term "and/or" herein is merely an association describing an associated object, meaning that three relationships may exist, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone.
The terminal equipment in the embodiment of the invention can be intelligent peripheral equipment, mobile terminal equipment or non-mobile terminal equipment. The mobile terminal device may be a terminal device, a tablet computer, a notebook computer, a palm computer, a vehicle-mounted terminal device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, a usb disk, or a Personal Digital Assistant (PDA), etc.; the non-mobile terminal device may be a Personal Computer (PC), a Television (TV), a teller machine, a self-service machine, or the like, and the embodiment of the present invention is not particularly limited.
The embodiment of the invention provides a flash memory data refreshing method, and an execution main body of the flash memory data refreshing method can be any one of the terminal equipment. Specifically, referring to fig. 1, the flash data refresh method includes the following steps S101 to S104:
s101, acquiring the data storage time length of each flash memory block of the terminal equipment.
The data storage time length of the flash memory block in the embodiment of the invention refers to the time length from the current time to the time of storing data into the flash memory block or the time length from the current time to the time of refreshing the data stored in the flash memory block last time. If the data stored in the flash memory block is not refreshed after being stored in the flash memory block, the data storage time length of the flash memory block is the time length from the current time to the time of storing the data in the flash memory block, and if the data stored in the flash memory block is refreshed after being stored in the flash memory block, the data storage time length of the flash memory block is the time length from the current time to the last time of refreshing the data stored in the flash memory block.
Specifically, the timer corresponding to the flash memory block may be started when data is stored in the flash memory block, and the timer is cleared after the data stored in the flash memory block is refreshed, and when the data storage time length of a certain flash memory block needs to be obtained, the data storage time length of the flash memory block may be obtained by reading the value of the corresponding timer.
S102, judging whether a flash memory block to be refreshed exists or not.
And the flash memory block to be refreshed is a flash memory block with the data storage time length being greater than the threshold time length.
That is, it is determined whether there is a flash block whose data storage time length is greater than a threshold time length.
For example, a timer may be set for each flash block, the timer is started when the input is stored in the flash block, the timer is cleared after the data in the flash block is refreshed, and whether the flash block to be refreshed exists is determined by determining whether the timer has timed out.
It should be noted that, in the embodiment of the present invention, all flash memory blocks may be the same type of flash memory block, for example: all three-Level (TLC) flash memory blocks, or all four-Level (Quad Level Cell, QLC) flash memory blocks, or all Single-Level (SLC) flash memory blocks, or all Multi-Level (MLC) flash memory blocks. When all flash memory blocks may be the same type of flash memory block, the threshold time lengths corresponding to all flash memory blocks may be the same. The terminal device may also include flash blocks of the same type, for example: when the terminal equipment comprises the flash memory blocks of the same type, the threshold time lengths corresponding to the flash memory blocks of the same type are the same, and the threshold time lengths corresponding to the flash memory blocks of different types are different.
Optionally, the threshold time length is a product of a theoretical reliable storage time length of each flash memory block and a preset value;
the preset value is greater than 0 and less than or equal to 1.
For example, when the flash block to be refreshed is a TLC flash block, the theoretical reliable storage time of the TLC flash block is 5 years, and the preset value is 70%, the threshold time length may be 5 × 70% — 3.5 years.
For example, when the flash memory block to be refreshed is a QLC flash memory block, the theoretical reliable storage time length of the TLC flash memory block is 3 years, and the preset value is 90%, the threshold time length may be 3 × 90% — 2.7 years.
In the step S102, if it is determined that there is a flash block to be refreshed, the following step S103 is executed, and if it is determined that there is no flash block to be refreshed, the flash data refreshing method provided in the embodiment of the present invention is ended, and it is determined again whether there is a flash block to be refreshed after a preset time length.
S103, judging whether the state of the terminal equipment meets a preset condition or not.
Namely, the current state of the terminal equipment is obtained, and whether the current state of the terminal equipment is suitable for refreshing the data stored in the flash memory block to be refreshed or not is judged.
For example, after it is determined that there is a flash memory block to be refreshed, the state of the terminal device may be detected in real time to determine whether the state of the terminal device meets a preset condition.
In the step S103, if it is determined that the state of the terminal device satisfies the preset condition, the following step S104 is executed, and if it is determined that the state of the terminal device does not satisfy the preset condition, the state of the terminal device continues to be detected.
And S104, refreshing the data stored in the flash memory block to be refreshed.
Specifically, the refreshing the data stored in the flash memory block to be refreshed includes: firstly, reading the data stored in the flash memory block to be refreshed, then deleting the data stored in the flash memory block to be refreshed, and finally rewriting the read data into the flash memory block to be refreshed.
As an optional implementation manner of the embodiment of the present invention, the method further includes:
and marking the flash memory block to be refreshed through the target identification under the condition that the flash memory block to be refreshed exists.
If it is determined that the flash memory block to be refreshed exists, the flash memory block to be refreshed is marked by the target identifier, then step S104 (refreshing the data stored in the flash memory block to be refreshed when it is determined that the state of the terminal device satisfies the preset condition) may be:
and under the condition that the state of the terminal equipment is determined to meet the preset condition, refreshing the data stored in the flash memory block with the target identifier, and deleting the target identifier after the refreshing is finished.
The flash memory blocks to be refreshed are marked through the target identification, so that the flash memory blocks to be refreshed can be quickly determined when the data stored in the flash memory blocks to be refreshed are refreshed, and the refreshing efficiency of the flash memory blocks to be refreshed is further improved.
The flash memory data refreshing method provided by the embodiment of the invention firstly obtains the data storage time length of each flash memory block of the terminal equipment, then judges whether the flash memory block to be refreshed exists, the data storage time length of which is greater than the threshold time length, judges whether the state of the terminal equipment meets the preset condition if the flash memory block to be refreshed exists, and refreshes the data stored in the flash memory block to be refreshed under the condition that the state of the terminal equipment meets the preset condition. Compared with the prior art that a passively triggered refresh mechanism is adopted to refresh the data stored in the flash memory blocks, the flash memory data refresh method provided by the embodiment of the invention can refresh the data stored in the flash memory blocks to be refreshed, the data storage time length of which is greater than the threshold time length, based on the data storage time length of each flash memory block and the state of the terminal equipment.
As an optional implementation manner of the embodiment of the present invention, referring to fig. 2, the step S103 (determining whether the state of the terminal device satisfies a preset condition) includes:
s201, judging whether the terminal equipment is in a charging state.
Illustratively, the terminal device can be determined whether to be in a charging state by information interaction with the power management module, or the terminal device can be determined whether to be in a charging state by reading the battery voltage and determining whether to be in a charging state according to the battery voltage.
In the step S201, if it is determined that the terminal device is in the charging state, it is determined that the state of the terminal device satisfies the preset condition, and step S104 is executed; and if the terminal equipment is determined to be in the non-charging state, determining that the state of the terminal equipment does not meet the preset condition, and continuously monitoring whether the terminal equipment enters the charging state.
Because a large amount of electric energy of the terminal device is consumed for refreshing the data in the flash memory block, if the data in the flash memory block is refreshed in a non-charging state, the power supply of the terminal device is very likely to be exhausted, and the terminal device is further shut down. The embodiment refreshes the data stored in the flash memory block to be refreshed only when the terminal device is determined to be in the charging state, so that the embodiment can avoid the power supply exhaustion of the terminal device caused by the refreshing of the data in the flash memory block.
As an optional implementation manner of the embodiment of the present invention, referring to fig. 3, the step S103 (determining whether the state of the terminal device satisfies a preset condition) includes:
s301, judging whether the terminal equipment is in a standby state.
Specifically, whether the terminal device is in the standby state can be judged by detecting whether the terminal device has the user input. The user input may be touch input, voice input, peripheral input, a specific gesture, and the like.
In the step S301, if it is determined that the terminal device is in the standby state, it is determined that the state of the terminal device satisfies the preset condition, and step S104 is executed; and if the terminal equipment is determined to be in the non-standby state, determining that the state of the terminal equipment does not meet the preset condition, and continuously monitoring whether the terminal equipment enters the standby state.
Because resources such as a memory and a processor of the terminal device are occupied by refreshing the data in the flash memory block, if the data in the flash memory block is refreshed when the user operates the terminal device, the performance of the terminal device may be affected by occupying too many resources of the terminal device. The embodiment refreshes the data stored in the flash memory block to be refreshed only when the terminal device is determined to be in the standby state, so that the embodiment can avoid performance degradation of the terminal device caused by refreshing the data in the flash memory block.
As an optional implementation manner of the embodiment of the present invention, referring to fig. 4, the step S103 (determining whether the state of the terminal device satisfies a preset condition) includes:
s401, judging whether the terminal equipment is in a charging state.
S402, judging whether the terminal equipment is in a standby state.
In the above steps S401 and S402, if it is determined that the terminal device is in the charging state and it is determined that the terminal device is in the standby state, it is determined that the state of the terminal device satisfies the preset condition, and step S104 is executed; and if the terminal equipment is determined to be in a non-charging state and/or the terminal equipment is determined to be in a non-standby state, determining that the state of the terminal equipment does not meet the preset condition, and continuously monitoring whether the terminal equipment meets the preset condition.
The embodiment refreshes the data stored in the flash memory block to be refreshed only when the terminal equipment is determined to be in the charging state and the standby state, so that the embodiment can not only avoid the power supply exhaustion of the terminal equipment caused by the data in the flash memory block being refreshed, but also avoid the performance reduction of the terminal equipment caused by the data in the flash memory block being refreshed.
As an alternative implementation manner of the embodiment of the present invention, referring to fig. 5, the step S104 (refreshing the data stored in the flash memory block to be refreshed) includes:
s501, obtaining the time length of the expiration of each flash memory block to be refreshed.
The time length of the expiration of any flash block to be refreshed is the difference value between the data storage time length of the flash block and the threshold time length.
Illustratively, the data storage time length of a certain flash block to be refreshed is T1, and the threshold time length is T2, then the expiration time length of the flash block to be refreshed is T1-T2.
And S502, sorting the flash memory blocks to be refreshed in a descending order according to the time length of the expiration.
That is, for a flash block to be refreshed, the longer the expiration time length is, the earlier the partial order of the flash block to be refreshed in the sorting result is.
S503, refreshing the data stored in the flash memory block to be refreshed according to the descending sorting result.
For a flash block to be refreshed, the longer the timeout period, the greater the risk of data corruption or loss. In the embodiment, the expiration time length of each flash memory block to be refreshed is obtained first, the flash memory blocks to be refreshed are sorted in a descending order according to the expiration time length, and the data stored in the flash memory blocks to be refreshed are refreshed according to the sorting result in the descending order under the condition that the state of the terminal device is determined to meet the preset condition.
Based on the same inventive concept, as an implementation of the foregoing method, an embodiment of the present invention further provides a flash memory data refresh device for executing the flash memory data refresh method provided in the foregoing method embodiment, where this embodiment corresponds to the foregoing method embodiment, and for convenience of reading, details in the foregoing method embodiment are not repeated one by one in this embodiment, but it should be clear that the flash memory data refresh device in this embodiment can correspondingly implement all the contents in the foregoing method embodiment.
Fig. 6 is a schematic structural diagram of a flash memory data refreshing apparatus according to an embodiment of the present invention, and referring to fig. 6, a flash memory data refreshing apparatus 600 according to an embodiment of the present invention includes:
an obtaining unit 61, configured to obtain a data storage time length of each flash memory block of the terminal device;
the processing unit 62 is configured to determine whether a to-be-refreshed flash memory block exists, where the to-be-refreshed flash memory block is a flash memory block whose data storage time length is greater than a threshold time length;
the processing unit 62 is further configured to, when it is determined that the flash memory block to be refreshed exists, determine whether the state of the terminal device meets a preset condition;
and the refreshing unit 63 is configured to refresh the data stored in the flash memory block to be refreshed under the condition that it is determined that the state of the terminal device satisfies the preset condition.
As an optional implementation manner of the embodiment of the present invention, the processing unit 62 is specifically configured to determine whether the terminal device is in a charging state; and if the terminal equipment is in the charging state, determining that the state of the terminal equipment meets a preset condition.
As an optional implementation manner of the embodiment of the present invention, the processing unit 62 is specifically configured to determine whether the terminal device is in a standby state; and if the terminal equipment is in a standby state, determining that the state of the terminal equipment meets a preset condition.
As an optional implementation manner of the embodiment of the present invention, the processing unit 62 is specifically configured to determine whether the terminal device is in a charging state and whether the terminal device is in a standby state; and if the terminal equipment is in a charging state and the terminal equipment is in a standby state, determining that the state of the terminal equipment meets a preset condition.
As an optional implementation manner of the embodiment of the present invention, the threshold time length is a product of a theoretical reliable storage time length of each flash memory block and a preset value;
the preset value is greater than 0 and less than or equal to 1.
As an optional implementation manner of the embodiment of the present invention, the processing unit 62 is further configured to mark, by using a target identifier, a flash memory block to be refreshed when it is determined that the flash memory block to be refreshed exists;
the refreshing unit 63 is specifically configured to, when it is determined that the state of the terminal device satisfies the preset condition, refresh data stored in the flash memory block having the target identifier, and delete the target identifier after the refresh is completed.
As an optional implementation manner of the embodiment of the present invention, the refresh unit 63 is specifically configured to obtain an expiration time length of each to-be-refreshed flash memory block, where the expiration time length of any to-be-refreshed flash memory block is a difference between a data storage time length of the flash memory block and the threshold time length; sorting the flash memory blocks to be refreshed in a descending order according to the length of the timeout period; and under the condition that the state of the terminal equipment is determined to meet the preset condition, refreshing the data stored in the flash memory block to be refreshed according to the descending order sorting result.
The flash memory data refreshing device provided by the embodiment of the invention comprises an acquisition unit, a processing unit and a refreshing unit. The processing unit can judge whether a flash memory block to be refreshed exists, the data storage time length of which is greater than a threshold time length, and judge whether the state of the terminal equipment meets a preset condition under the condition that the flash memory block to be refreshed exists; the refreshing unit may refresh the data stored in the flash memory block to be refreshed, when it is determined that the state of the terminal device satisfies the preset condition. Compared with the prior art that a passively triggered refresh mechanism is adopted to refresh the data stored in the flash memory blocks, the flash memory data refresh device provided by the embodiment of the invention can refresh the data stored in the flash memory blocks to be refreshed, the data storage time length of which is greater than the threshold time length, based on the data storage time length of each flash memory block and the state of the terminal equipment.
Fig. 7 is a schematic diagram of a hardware structure of a terminal device for implementing various embodiments of the present invention, as shown in fig. 7, the terminal device 700 includes, but is not limited to: radio Frequency (RF) circuitry 1010, memory 1020, input unit 1030, display unit 1040, sensor 1050, audio circuitry 1060, wireless fidelity (WiFi) module 1070, processor 1080, and power source 1090. The radio frequency circuit 1010 includes a receiver 1010 and a transmitter 1012. Those skilled in the art will appreciate that the terminal device configuration shown in fig. 7 does not constitute a limitation of the terminal device and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
RF circuit 1010 may be used for receiving and transmitting signals during information transmission and reception or during a call, and in particular, for processing downlink information of a base station after receiving the downlink information to processor 1080; in addition, the data for designing uplink is transmitted to the base station. In general, the RF circuitry 1010 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like. In addition, the RF circuitry 1010 may also communicate with networks and other devices via wireless communications. The wireless communication may use any communication standard or protocol, including but not limited to global system for mobile communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Message Service (SMS), etc.
The memory 1020 can be used for storing software programs and modules, and the processor 1080 executes various functional applications and data processing of the terminal device by operating the software programs and modules stored in the memory 1020. The memory 1020 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the terminal device, and the like. Further, the memory 1020 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The input unit 1030 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the terminal device. Specifically, the input unit 1030 may include a touch panel 1031 and other input devices 1032. The touch panel 1031, also referred to as a touch screen, may collect touch operations by a user (e.g., operations by a user on or near the touch panel 1031 using any suitable object or accessory such as a finger, a stylus, etc.) and drive corresponding connection devices according to a preset program. Alternatively, the touch panel 1031 may include two parts, a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 1080, and can receive and execute commands sent by the processor 1080. In addition, the touch panel 1031 may be implemented by various methods such as resistive, capacitive, infrared, and surface acoustic wave. The input unit 1030 may include other input devices 1032 in addition to the touch panel 1031. In particular, other input devices 1032 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a track ball, a mouse, a joystick, or the like.
The display unit 1040 may be used to display information input by a user or information provided to the user and various menus of the terminal device. The display unit 1040 may include a display panel 1041, and optionally, the display panel 1041 may be configured in the form of a Liquid Crystal Display (LCD), an organic light-Emitting diode (OLED), or the like. Further, the touch panel 1031 can cover the display panel 1041, and when the touch panel 1031 detects a touch operation on or near the touch panel 1031, the touch operation is transmitted to the processor 1080 to determine a touch event, and then the processor 1080 provides a corresponding visual output on the display panel 1041 according to the touch event. Although in fig. 7, touch panel 1031 and display panel 1041 are two separate components to implement input and output functions of the terminal device, in some embodiments, touch panel 1031 and display panel 1041 may be integrated to implement input and output functions of the terminal device.
The terminal device may also include at least one sensor 1050, such as a light sensor, motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor that adjusts the brightness of the display panel 1041 according to the brightness of ambient light, and a proximity sensor that turns off the display panel 1041 and/or the backlight when the terminal device moves to the ear. As one of the motion sensors, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally, three axes), detect the magnitude and direction of gravity when stationary, and can be used for applications (such as horizontal and vertical screen switching, related games, magnetometer attitude calibration) for recognizing the attitude of the terminal device, and related functions (such as pedometer and tapping) for vibration recognition; as for other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which can be configured in the terminal device, detailed description is omitted here. In the embodiment of the present invention, the terminal device may include an acceleration sensor, a depth sensor, a distance sensor, or the like.
Audio circuitry 1060, speaker 1061, microphone 1062 may provide an audio interface between the user and the terminal device. The audio circuit 1060 can transmit the electrical signal converted from the received audio data to the speaker 1061, and the electrical signal is converted into a sound signal by the speaker 1061 and output; on the other hand, the microphone 1062 converts the collected sound signal into an electrical signal, which is received by the audio circuit 1060 and converted into audio data, which is then processed by the audio data output processor 1080 and then transmitted to, for example, another terminal device via the RF circuit 1010, or output to the memory 1020 for further processing.
WiFi belongs to short-distance wireless transmission technology, and the terminal device can help the user send and receive e-mail, browse web pages, access streaming media, etc. through the WiFi module 1070, which provides the user with wireless broadband internet access. Although fig. 7 shows the WiFi module 1070, it is understood that it does not belong to the essential constitution of the terminal device, and may be omitted entirely as needed within the scope not changing the essence of the invention.
The processor 1080 is a control center of the terminal device, connects various parts of the whole terminal device by using various interfaces and lines, and executes various functions of the terminal device and processes data by operating or executing software programs and/or modules stored in the memory 1020 and calling data stored in the memory 1020, thereby monitoring the whole terminal device. Optionally, processor 1080 may include one or more processing units; preferably, the processor 1080 may integrate an application processor, which handles primarily the operating system, user interfaces, applications, etc., and a modem processor, which handles primarily the wireless communications. It is to be appreciated that the modem processor described above may not be integrated into processor 1080.
The terminal device also includes a power supply 1090 (e.g., a battery) for powering the various components, which may preferably be logically coupled to the processor 1080 via a power management system that may be configured to manage charging, discharging, and power consumption. Although not shown, the terminal device may further include a camera, a bluetooth module, and the like, which are not described herein.
In the embodiment of the present invention, the processor 1080 is configured to obtain a data storage time length of each flash memory block of the terminal device, determine whether a flash memory block to be refreshed exists, and determine whether a state of the terminal device meets a preset condition under a condition that the flash memory block to be refreshed exists; the flash memory block to be refreshed is a flash memory block with the data storage time length being greater than the threshold time length;
and a memory 1020, configured to refresh the data stored in the flash memory block to be refreshed when the processor 1080 determines that the state of the terminal device satisfies the preset condition.
An embodiment of the present invention further provides a terminal device, where the terminal device may include: the processor, the memory and the computer program stored in the memory and capable of running on the processor, when executed by the processor, the method for refreshing the flash memory data provided by the above method embodiments can be implemented, and the same technical effect can be achieved.
An embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the method for refreshing flash memory data provided in the foregoing method embodiment is implemented.
The first device, the second device, and the storage medium provided in the embodiments of the present invention may achieve the same technical effects as the flash memory data refreshing method provided in the above embodiments of the method, and for avoiding repetition, the technical effects are not described herein again.
The computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
While the present invention has been described with reference to the embodiments shown in the drawings, the present invention is not limited to the embodiments, which are illustrative and not restrictive, and it will be apparent to those skilled in the art that various changes and modifications can be made therein without departing from the spirit and scope of the invention as defined in the appended claims.

Claims (10)

1. A method for refreshing flash memory data, comprising:
acquiring the data storage time length of each flash memory block of the terminal equipment;
judging whether a flash memory block to be refreshed exists or not, wherein the flash memory block to be refreshed is a flash memory block with the data storage time length larger than a threshold time length;
if the flash memory block to be refreshed exists, judging whether the state of the terminal equipment meets a preset condition;
and under the condition that the state of the terminal equipment is determined to meet the preset condition, refreshing the data stored in the flash memory block to be refreshed.
2. The method according to claim 1, wherein the determining whether the state of the terminal device satisfies a preset condition includes:
judging whether the terminal equipment is in a charging state or not;
and if the terminal equipment is in the charging state, determining that the state of the terminal equipment meets a preset condition.
3. The method according to claim 1, wherein the determining whether the state of the terminal device satisfies a preset condition includes:
judging whether the terminal equipment is in a standby state or not;
and if the terminal equipment is in a standby state, determining that the state of the terminal equipment meets a preset condition.
4. The method according to claim 1, wherein the determining whether the state of the terminal device satisfies a preset condition includes:
judging whether the terminal equipment is in a charging state or not and whether the terminal equipment is in a standby state or not;
and if the terminal equipment is in a charging state and the terminal equipment is in a standby state, determining that the state of the terminal equipment meets a preset condition.
5. The method according to any one of claims 1 to 4, wherein the threshold time length is a product of a theoretical reliable storage time length of each flash memory block and a preset value;
the preset value is greater than 0 and less than or equal to 1.
6. The method according to any one of claims 1-4, further comprising:
under the condition that the flash memory block to be refreshed exists, marking the flash memory block to be refreshed through a target identifier;
under the condition that the state of the terminal equipment is determined to meet the preset condition, refreshing the data stored in the flash memory block to be refreshed, wherein the refreshing comprises the following steps:
and under the condition that the state of the terminal equipment is determined to meet the preset condition, refreshing the data stored in the flash memory block with the target identifier, and deleting the target identifier after the refreshing is finished.
7. The method according to any one of claims 1 to 4, wherein the refreshing the data stored in the flash memory block to be refreshed in the case that the state of the terminal device is determined to meet the preset condition comprises:
acquiring the time length of the expiry time of each flash memory block to be refreshed, wherein the time length of the expiry time of any flash memory block to be refreshed is the difference value between the data storage time length of the flash memory block and the threshold time length;
sorting the flash memory blocks to be refreshed in a descending order according to the time length of the expiration;
and under the condition that the state of the terminal equipment is determined to meet the preset condition, refreshing the data stored in the flash memory block to be refreshed according to the descending order sorting result.
8. A flash memory data refresh apparatus, comprising:
the acquisition unit is used for acquiring the data storage time length of each flash memory block of the terminal equipment;
the processing unit is used for judging whether a flash memory block to be refreshed exists or not, wherein the flash memory block to be refreshed is a flash memory block with the data storage time length larger than the threshold time length;
the processing unit is further used for judging whether the state of the terminal equipment meets a preset condition or not under the condition that the flash memory block to be refreshed is determined;
and the refreshing unit is used for refreshing the data stored in the flash memory block to be refreshed under the condition that the state of the terminal equipment is determined to meet the preset condition.
9. A terminal device, comprising: processor, memory and computer program stored on the memory and executable on the processor, which computer program, when executed by the processor, implements the flash data refresh method of any of claims 1 to 7.
10. A computer-readable storage medium, comprising: the computer-readable storage medium has stored thereon a computer program which, when executed by a processor, implements the flash memory data refresh method of any of claims 1 to 7.
CN202010701408.7A 2020-07-18 2020-07-18 Flash memory data refreshing method and device Pending CN111880732A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010701408.7A CN111880732A (en) 2020-07-18 2020-07-18 Flash memory data refreshing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010701408.7A CN111880732A (en) 2020-07-18 2020-07-18 Flash memory data refreshing method and device

Publications (1)

Publication Number Publication Date
CN111880732A true CN111880732A (en) 2020-11-03

Family

ID=73154563

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010701408.7A Pending CN111880732A (en) 2020-07-18 2020-07-18 Flash memory data refreshing method and device

Country Status (1)

Country Link
CN (1) CN111880732A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010067098A (en) * 2008-09-11 2010-03-25 Sony Corp Information processor, information processing method, and information processing program
CN105280215A (en) * 2014-06-09 2016-01-27 华为技术有限公司 Refreshing method for dynamic random access memory (DRAM), equipment and system
CN106598484A (en) * 2016-11-17 2017-04-26 华为技术有限公司 Data storage method, flash memory chip and storage device
CN108369818A (en) * 2016-03-09 2018-08-03 华为技术有限公司 A kind of method for refreshing and device of flash memory device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010067098A (en) * 2008-09-11 2010-03-25 Sony Corp Information processor, information processing method, and information processing program
CN105280215A (en) * 2014-06-09 2016-01-27 华为技术有限公司 Refreshing method for dynamic random access memory (DRAM), equipment and system
CN108231109A (en) * 2014-06-09 2018-06-29 华为技术有限公司 Method for refreshing, equipment and the system of dynamic random access memory DRAM
CN108369818A (en) * 2016-03-09 2018-08-03 华为技术有限公司 A kind of method for refreshing and device of flash memory device
CN106598484A (en) * 2016-11-17 2017-04-26 华为技术有限公司 Data storage method, flash memory chip and storage device

Similar Documents

Publication Publication Date Title
CN106786962B (en) Charging control method and device and terminal
CN107194224B (en) Unlocking control method and related product
CN108135033B (en) Bluetooth connection method and mobile terminal
CN107025399B (en) Unlocking control method and related product
CN107172267B (en) Fingerprint identification control method and related product
CN107122649B (en) Unlocking control method, mobile terminal and computer readable storage medium
CN106845422B (en) Fingerprint identification module, fingerprint identification method and mobile terminal
CN108322599B (en) Network access method and mobile terminal
US20190257887A1 (en) Method and device for ascertaining required charging time
CN107193472B (en) Unlocking control method and related product
CN109739394B (en) SAR value processing method and mobile terminal
CN109195191B (en) Cell reselection control method and terminal
CN105812250A (en) Control method and device for pushing message to wearable device and mobile terminal
CN108388335B (en) Method for controlling mobile terminal and mobile terminal
CN107194223B (en) Fingerprint identification area display method and related product
CN111008090B (en) Battery electric quantity control method and device, storage medium and terminal equipment
CN107066090B (en) Method for controlling fingerprint identification module and mobile terminal
EP2998843A1 (en) Intelligent terminal and method for displaying input operation interface thereof
CN107197086B (en) Unlocking control method and related product
CN108304709B (en) Face unlocking method and related product
CN111880988B (en) Voiceprint wake-up log collection method and device
CN103034319B (en) A kind of the method for display and control, control device and terminal are carried out to terminal
CN106817751B (en) Data sending method and mobile terminal
CN111966206B (en) Power saving control method and device for fingerprint sensor and mobile terminal
CN111880732A (en) Flash memory data refreshing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination