CN109343796B - Data processing method and device - Google Patents

Data processing method and device Download PDF

Info

Publication number
CN109343796B
CN109343796B CN201811105669.1A CN201811105669A CN109343796B CN 109343796 B CN109343796 B CN 109343796B CN 201811105669 A CN201811105669 A CN 201811105669A CN 109343796 B CN109343796 B CN 109343796B
Authority
CN
China
Prior art keywords
physical block
data
effective physical
determining
effective
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.)
Active
Application number
CN201811105669.1A
Other languages
Chinese (zh)
Other versions
CN109343796A (en
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.)
New H3C Technologies Co Ltd
Original Assignee
New H3C Technologies Co 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 New H3C Technologies Co Ltd filed Critical New H3C Technologies Co Ltd
Priority to CN201811105669.1A priority Critical patent/CN109343796B/en
Publication of CN109343796A publication Critical patent/CN109343796A/en
Application granted granted Critical
Publication of CN109343796B publication Critical patent/CN109343796B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • 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/0674Disk device
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • 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/062Securing storage systems
    • 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
    • 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/0644Management of space entities, e.g. partitions, extents, pools

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • General Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • Health & Medical Sciences (AREA)
  • Databases & Information Systems (AREA)
  • Signal Processing For Digital Recording And Reproducing (AREA)

Abstract

The application provides a data processing method and a device, wherein the method comprises the following steps: acquiring an effective physical block of the solid state disk which is full of data; reading first data from a first designated sector of the effective physical block, determining damaged data in the first data, and determining first state information of the effective physical block according to the quantity of the damaged data; and if the first state information represents that the effective physical block is really abnormal, performing garbage collection on the effective physical block. Through the technical scheme, the garbage can be timely recycled for the effective physical blocks, the stability of the effective physical blocks is guaranteed, and the safety of data storage is improved.

Description

Data processing method and device
Technical Field
The present application relates to the field of communications technologies, and in particular, to a data processing method and apparatus.
Background
The SSD (Solid State Drives) is a novel hard disk, and has the characteristics of high speed, high shock resistance, high safety, good stability, high integration, ultra-large capacity, high read/write speed, small read/write delay, low power consumption, and non-volatile storage medium, so that it is widely applied to various fields of life, such as consumer electronics, military equipment, monitoring security, network, server, handheld device, and industrial control.
During the use of an SSD, data may be written into a Block (physical Block, also called data Block) until the physical Block is full, and then data is written into the next physical Block, and so on. Further, in the use process of the SSD, in order to ensure that there is an available physical block, garbage collection may be performed on the valid physical block for a physical block (i.e. an effective physical block) which is already full of data, so that the effective physical block becomes a free physical block, and thus, data may be written into the free physical block again.
In order to select a part of valid physical blocks from a large number of valid physical blocks and perform garbage collection on the part of valid physical blocks, the following method can be adopted: after the physical block becomes an effective physical block, the effective data in the effective physical block is less and the state is more and more unstable along with the time, so that the data writing time of each effective physical block is determined, and the garbage collection is carried out on the effective physical block with long data writing time.
However, due to uncertainty of environmental factors such as temperature variation, humidity variation, external radiation, vibration, etc., even if the time for becoming an effective physical block is short, the state of the effective physical block may be unstable, and if the effective physical block is not garbage-collected, the security of data in the effective physical block may be low.
Disclosure of Invention
The application provides a data processing method, which is applied to a storage device and comprises the following steps:
acquiring an effective physical block of a solid state disk of the storage device, which is full of data;
reading first data from a first designated sector of the effective physical block, determining damaged data in the first data, and determining first state information of the effective physical block according to the quantity of the damaged data;
and if the first state information represents that the effective physical block is really abnormal, performing garbage collection on the effective physical block.
The application provides a data processing device, is applied to storage equipment, the device includes:
the acquisition module is used for acquiring effective physical blocks of the solid state disk of the storage device, which are full of data;
a reading module, configured to read first data from a first designated sector of the valid physical block;
a determining module for determining corrupted data in the first data;
determining first state information of the effective physical block according to the quantity of the damaged data;
and the processing module is used for performing garbage collection on the effective physical block when the first state information represents that the effective physical block is really abnormal.
Based on the technical scheme, in the embodiment of the application, the current stability of the effective physical block can be determined, when the effective physical block is unstable, garbage recovery is timely performed on the effective physical block, the stability of the effective physical block is ensured, and the safety of data storage is improved, so that the performance stability and the data safety of the SSD can be ensured. Even if there are unstable factors (such as temperature change, humidity change, external radiation, vibrations etc.) in the external world, also can protect effective physical block, reduce the possibility that data lost, guarantee data safety, weaken the risk that data lost, guarantee the safety and stability of effective physical block, can prolong solid state hard disk's life.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments of the present application or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in the present application, and other drawings can be obtained by those skilled in the art according to the drawings of the embodiments of the present application.
FIG. 1 is a flow diagram of a data processing method in one embodiment of the present application;
FIG. 2 is a schematic structural diagram of a solid state disk according to an embodiment of the present application;
FIG. 3 is a block diagram of a physical block in one embodiment of the present application;
FIG. 4 is a flow chart of a data processing method in another embodiment of the present application;
FIG. 5 is a block diagram of a data processing apparatus according to an embodiment of the present application;
fig. 6 is a hardware configuration diagram of a storage device according to an embodiment of the present application.
Detailed Description
The terminology used in the embodiments of the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this application and the claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein is meant to encompass any and all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used in the embodiments of the present application to describe various information, the information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present application. Depending on the context, moreover, the word "if" as used may be interpreted as "at … …" or "when … …" or "in response to a determination".
The embodiment of the application provides a data processing method, which can be applied to a storage device, wherein the storage device can be a device for storing data by adopting a Solid State Disk (SSD). The solid state disk may be composed of a large number of blocks (physical blocks, which may also be referred to as data blocks), and the following description will take the physical blocks as an example.
The solid state disk can be a novel hard disk, the storage medium of the solid state disk can comprise a Flash (Flash) medium (such as a NAND Flash medium), and a plurality of storage units form a storage array, and a control unit and some additional functional devices are added to form a solid state disk. The solid state disk has the characteristics of high speed, high shock resistance and safety, good stability, high integration level, super-large capacity, high reading and writing speed, small reading and writing delay, low power consumption, non-volatile storage medium and the like, thereby being widely applied to various fields of life.
In one example, a solid state disk may include a large number of physical blocks, and the process of storing data using the solid state disk is a process of continuously writing data into a physical block until the physical block is full, and then writing data into a next physical block, and so on. The solid state disk may include the following types of physical blocks:
the first physical block in an idle state (FREE state), that is, a physical block which has invalid data and is not currently used, that is, the physical block does not store valid data, and new data can be written in the physical block, but the physical block has invalid data, and the new data can be written in the physical block only after the invalid data is erased.
The second physical block in the ERASE state (ERASE state) is a physical block that has been erased, and has no data written thereto, that is, all data in the physical block has been erased, and no new data has been written thereto after the data ERASE is completed, that is, new data can be written thereto. For example, for a physical block in an idle state, after erasing data in the physical block, the physical block in an erased state is obtained.
The third physical block in the programming state (PROGRAM state), i.e. the physical block which is not full of data and is not empty, is the physical block currently in use, i.e. data is being written into the physical block, but the data has not yet filled this physical block. For example, for a physical block in an erased state, when data is written using this physical block, the physical block may be a physical block in a programmed state.
And fourthly, a physical block in a use state (USED state), namely, a physical block which is already full of data, wherein some data in the physical block is valid data, some data may be invalid data, the physical block is already full of data, new data cannot be written, the new data can be written only after the data in the physical block is erased, and the performance of the physical block is relatively stable. For example, for a physical block in a programmed state, after the physical block is fully written with data, the physical block may be a physical block in a used state.
Fifthly, the physical block in the migration state (GC state), that is, the physical block that needs to be garbage-recovered (valid data is moved), needs to perform garbage recovery on the valid data in the physical block, that is, the valid data is migrated from the physical block, and the garbage recovery process is not limited. For example, for a physical block in a use state, if garbage collection needs to be performed on the physical block, the physical block may be a physical block in a migration state. Further, after garbage collection is performed on valid data in a physical block, if the physical block can be used normally, the physical block may become a physical block in an idle state, and if the physical block cannot be used normally, the physical block may become a physical block in a damaged state.
Sixth, a physical block in a damaged state (BAD state), i.e., a physical block that has not been normally used, is a physical block that has been damaged. Wherein, the damage cause may include: the data is damaged before leaving the factory, the service life reaches the limit, the erasing times reach the threshold, and the data writing times exceed the threshold, which is not limited.
Seventh, a physical block in a migration damaged state (GC BAD state), that is, a damaged physical block that needs to be garbage-recovered (valid data is moved), needs to be garbage-recovered for valid data in the physical block, that is, valid data is migrated from the physical block, and the process is not limited. Moreover, after the garbage collection is performed on the valid data in the physical block, the physical block cannot be used normally, and therefore, the physical block may be a physical block in a migration damaged state. For example, for a physical block in a programmed state, in the data writing process of the physical block, if data writing fails, since valid data is already written in the physical block, the valid data in the physical block needs to be moved out, and since the physical block is damaged, after the valid data is moved out, the physical block is not used any more.
In summary, at any time when the solid state disk is used, the physical blocks in the above various states exist, and the physical blocks in the various states are also converted to each other, so that the state conversion process is not limited.
As can be seen from the above, the physical block in the idle state/erase state can be written with data, and after the data is written into the physical block in the idle state/erase state, until the physical block is full, the physical block becomes the physical block in the use state, and the physical block in the use state cannot be written with data. Obviously, during the data writing process, the number of idle state/erase state physical blocks is reduced, and the number of use state physical blocks is increased, so a mechanism is needed to ensure that there are idle state/erase state physical blocks, and the mechanism is garbage collection.
The implementation process of garbage recycling can be as follows: for a physical block in a use state, valid data may exist, or valid data and invalid data may exist, so that valid data may be migrated from the physical block (i.e., to another physical block) without migrating invalid data from the physical block, and after the migration is completed, an erase operation may be performed on the physical block, so that data no longer exists in the physical block.
Further, after garbage collection is performed on a physical block, if the physical block can also be used normally, the physical block may be converted into a physical block in an idle state, and data may be written into the physical block.
In one example, a solid state disk may include a large number of physical blocks in use, and it is necessary to select a part of the physical blocks from the physical blocks and perform garbage collection on the part of the physical blocks. To select a part of the physical blocks from the physical blocks, the following method may be adopted: in a certain period, traversing all the physical blocks in the using state once to obtain the data writing time of each physical block, selecting the physical block with the longest data writing time, and performing garbage collection on the physical block. In the next cycle, the above operations are repeated, and so on, that is, in each cycle, the physical block with the longest data writing time is selected for garbage collection.
However, due to uncertainties of environmental factors, such as temperature variation, humidity variation, external radiation, vibration, and the like, even if the data writing time of a physical block is short, the state of the physical block may be unstable, and if the physical block is not timely garbage-collected, the security of data in the physical block may be low.
In view of the above discovery, an embodiment of the present application provides a data processing method, which may be applied to a storage device, where the storage device may employ a solid state disk to store data. Referring to fig. 1, a schematic flow chart of a data processing method proposed in an embodiment of the present application is shown, where the method may include:
step 101, obtaining a valid physical block of the solid state disk, which is already full of data.
For the sake of convenience of distinction, the physical block in the use state may be referred to as a valid physical block, the valid physical block is already full of data, and some data in the valid physical block is valid data and some data may be invalid data. The valid physical block can not write new data any more, the new data can be written only after the data of the valid physical block is erased, and the performance of the valid physical block is relatively stable.
Referring to fig. 2, a schematic structural diagram of a solid state disk is shown, where the solid state disk may include multiple channels, where multiple core units (which may be referred to as Die) exist under each channel, multiple plane units (which may be referred to as Palne) exist under each core unit, multiple physical blocks are distributed under each plane unit, and effective physical blocks exist among the physical blocks, that is, multiple effective physical blocks are distributed under different plane units.
In this embodiment, acquiring the valid physical block of the solid state disk that is already fully written with data may include: the method comprises the steps of determining a first plane unit where a valid physical block acquired last time is located, determining a second plane unit different from the first plane unit, and acquiring the valid physical block which is full of data from the second plane unit. For example, if the first plane unit in which the valid physical block acquired last time is located is plane unit 1, a second plane unit different from plane unit 1, such as plane unit 2, is determined, and the valid physical block is acquired from plane unit 2.
In an example, all plane units of the solid state disk may be sorted, such as the plane unit 1, the plane unit 2 …, and the plane unit 8, in one polling period, the first effective physical block 11 of the plane unit 1 is obtained, and subsequent processing is performed on the effective physical block 11; after the processing of the effective physical block 11 is completed, acquiring a first effective physical block 21 of the plane unit 2, and performing subsequent processing on the effective physical block 21; by analogy, the first effective physical block 81 of the plane unit 8 is obtained, and the subsequent processing is performed on the effective physical block 81; after the processing of the effective physical block 81 is completed, acquiring a second effective physical block 12 of the plane unit 1, and performing subsequent processing on the effective physical block 12; and repeating the steps until all the effective physical blocks of the solid state disk are obtained, finishing the processing of the current polling period, waiting for the next polling period.
Step 102, reading first data from a first designated sector of the effective physical block, determining damaged data in the first data, and determining first state information of the effective physical block according to the quantity of the damaged data. Wherein the first state information characterizes whether the valid physical block is truly abnormal or whether the valid physical block is not abnormal.
In one example, the first designated sector can include, but is not limited to: the first sector of the valid physical block or the last sector of the valid physical block. Of course, the first designated sector may also be other sectors of the valid physical block, such as the second sector of the valid physical block, and so on, without limitation.
Referring to fig. 3, a schematic diagram of a physical block structure is shown, where each physical block may include a plurality of sectors (e.g., sectors), a Sector is a minimum data unit of the solid state disk, and a process of writing data into the physical block is to write data into each Sector of the physical block. After all sectors of the physical block are written with data, the physical block is fully written with data, and the physical block becomes an effective physical block, at this time, the data in all sectors of the effective physical block are effective data, and all sectors are effective sectors. In the subsequent process, the user may delete the valid data in the valid sector, so that the valid sector becomes an invalid sector, and the data in the valid sector becomes invalid data. Due to the characteristics of the solid state disk, when deleting the valid data in the valid sector, the valid data is not deleted, but an invalid flag bit is set for the valid sector to indicate that the valid sector becomes an invalid sector and the data in the valid sector becomes invalid data.
Obviously, as time goes on, the number of valid sectors in the valid physical block is smaller and smaller, and the number of invalid sectors is larger and larger, that is, the number of invalid sectors is larger for the valid physical block with longer data writing time, so that garbage collection can be performed for the valid physical block with long data writing time. However, in some cases, even if the data writing time of the valid physical block is relatively short, the data stability of the valid physical block is relatively poor; or, even if the data writing time of the valid physical block is relatively long, the data stability of the valid physical block is relatively good. Therefore, in this embodiment, the data stability of the valid physical block may be directly analyzed, and the first state information of the valid physical block may be determined based on the data stability of the valid physical block.
In practical applications, when the data stability of the effective physical block is poor, the data stability of each sector of the effective physical block is poor, and when the data stability of the effective physical block is good, the data stability of each sector of the effective physical block is good, so that the data stability of one sector of the effective physical block can be determined, and the data stability of the sector is the data stability of the effective physical block.
Based on this, all data (for the sake of convenience of distinction, these data are referred to as first data) can be read from one sector of the valid physical block (this sector may be set empirically), the defective data in the first data is determined, and the first status information of the valid physical block is determined according to the amount of the defective data. If the first state information represents that the effective physical block is really abnormal, the data stability of the sector is poor, namely the data stability of the effective physical block is poor; if the first state information represents that the effective physical block is not abnormal, the data stability of the sector is relatively good, namely the data stability of the effective physical block is relatively good.
Among them, among all sectors of the effective physical block, the stability of the edge sectors (the first sector and the last sector of the effective physical block) is the worst, i.e., the data of the edge sectors is easily damaged, and thus, the first state information of the effective physical block can be determined using the data of the edge sectors. That is, when all the first data is read from one sector of the valid physical block, all the first data may be read from the first sector of the valid physical block or all the first data may be read from the last sector of the valid physical block.
In this case, there may be partial damaged data for all the first data read from the sector, and the determination manner of the damaged data is not limited. For example, there are 4000 data in a sector, 1100 for the 1 st data, 0110 for the 2 nd data, and so on. However, the first data (first data) read from the sector is 1111, the second data (first data) read from the sector is 0110, and so on, and thus the first data 1111 is the corrupted data and the second data 0110 is not the corrupted data.
Determining the first state information of the valid physical block according to the amount of the damaged data may include:
in a first mode, if the quantity of the damaged data is greater than a preset quantity threshold, it can be determined that the effective physical block represented by the first state information is really abnormal; if the amount of the damaged data is not greater than the preset amount threshold, it may be determined that the first status information indicates that the valid physical block is not abnormal.
For example, the preset number threshold, such as 90, may be configured empirically, and is not limited. Assuming that 4000 first data are read from the sector, 200 first data among the 4000 first data are damaged data, and since the number 200 of the damaged data is greater than the preset number threshold 90, it may be determined that the first state information indicates that the valid physical block is a true exception. Or, if there are 30 damaged data in the 4000 first data, since the quantity 30 of the damaged data is smaller than the preset quantity threshold 90, it may be determined that the first state information indicates that the valid physical block is not abnormal.
Determining the proportion between the quantity of the damaged data and the quantity of the first data; if the ratio is larger than a preset ratio threshold, determining that the effective physical block represented by the first state information is really abnormal; and if the proportion is not larger than the preset proportion threshold value, determining that the effective physical block represented by the first state information is not abnormal.
For example, the preset ratio threshold may be empirically configured, such as 2%, without limitation. Assuming that 4000 first data are read from the sector and 200 of the 4000 first data are defective data, it is determined that a ratio of the number of defective data 200 to the number of first data 4000 is 5%, and it is determined that the first state information represents that the valid physical block is truly abnormal since the ratio of 5% is greater than a preset ratio threshold of 2%.
In the above embodiment, when the damaged data is more, it is determined that the first state information indicates that the valid physical block is truly abnormal, and when the damaged data is less, it is determined that the first state information indicates that the valid physical block is not abnormal, because: when the damaged data is less, the damaged data can be repaired based on an algorithm (such as a redundant data algorithm, a check algorithm and the like), so that whether the first state information represents the effective physical block is abnormal is determined; when the damaged data is more, the damaged data cannot be repaired based on an algorithm (such as a redundant data algorithm, a check algorithm, and the like), that is, the data in the effective physical block is at risk of being lost, and therefore it is determined that the effective physical block represented by the first state information is really abnormal.
And 103, if the first state information represents that the effective physical block is really abnormal, performing garbage collection on the effective physical block. If the first state information represents that the effective physical block is not abnormal, the step 101 is returned to, the next effective physical block is obtained, and then the steps 101 to 103 are repeatedly executed.
Wherein, the effective physical block is a physical block in a use state; garbage collection of valid physical blocks may include, but is not limited to: the use state of the effective physical block is converted into a migration state, and garbage collection is performed on the converted effective physical block, wherein the garbage collection mode refers to the above embodiment. After the usage state of the valid physical block is converted into the migration state, the process may return to step 101 to obtain the next valid physical block.
Based on the technical scheme, in the embodiment of the application, the current stability of the effective physical block can be determined, when the effective physical block is unstable, garbage recovery is timely performed on the effective physical block, the stability of the effective physical block is ensured, and the safety of data storage is improved, so that the performance stability and the data safety of the SSD can be ensured. Even if there are unstable factors (such as temperature change, humidity change, external radiation, vibrations etc.) in the external world, also can protect effective physical block, reduce the possibility that data lost, guarantee data safety, weaken the risk that data lost, guarantee the safety and stability of effective physical block, can prolong solid state hard disk's life.
The embodiment of the application also provides another data processing method which can be applied to storage equipment and adopts a solid state disk to store data. Referring to fig. 4, a schematic flow chart of the method may include:
step 401, obtaining a valid physical block of the solid state disk, which is already full of data.
Step 402, reading first data from a first designated sector of a valid physical block, determining damaged data in the first data, and determining first state information of the valid physical block according to the quantity of the damaged data.
The first state information represents that the effective physical block is really abnormal, or the first state information represents that the effective physical block is suspected to be abnormal, or the first state information represents that the effective physical block is not abnormal.
And step 403, if the first state information represents that the effective physical block is really abnormal, performing garbage collection on the effective physical block. If the first state information represents that the valid physical block is not abnormal, the process returns to step 401 to obtain the next valid physical block, and then steps 401 to 403 are repeatedly executed.
The implementation flows of steps 401 to 403 may refer to steps 101 to 103, which are not repeated herein, but the difference is that the first state information may indicate that the valid physical block is truly abnormal and that the valid physical block is not abnormal, and may also indicate that the valid physical block is suspected to be abnormal.
In step 404, if the first status information indicates that the valid physical block is suspected to be abnormal, the second data is read from a second designated sector (any sector different from the first designated sector) of the valid physical block, and the damaged data in the second data is determined. Step 404 may be implemented as seen in step 102, except that data is read from the second designated sector of the valid physical block instead of the first designated sector.
In one example, the second designated sector may be any sector of the valid physical block as long as it is different from the first designated sector. For example, if the first designated sector is the first sector, the second designated sector may be the last sector of the valid physical block; the second designated sector may be the first sector of the valid physical block if the first designated sector is the last sector. Of course, the second designated sector may also be other sectors of the valid physical block, such as the penultimate sector of the valid physical block, and the like, without limitation.
In one example, if the first status information indicates that the valid physical block is truly abnormal, the first status information indicates that the valid physical block is not abnormal, and the first status information indicates that the valid physical block is suspected to be abnormal, the determining the first status information of the valid physical block according to the amount of the damaged data may include, but is not limited to:
in a first mode, if the number is larger than a first number threshold, it is determined that the effective physical block represented by the first state information is really abnormal; if the number is larger than the second number threshold and not larger than the first number threshold, determining that the effective physical block represented by the first state information is suspected to be abnormal; if the number is not greater than the second number threshold, it is determined that the first state information characterizes that the valid physical block is not anomalous.
For example, the first quantity threshold and the second quantity threshold may be empirically configured, and the first quantity threshold is greater than the second quantity threshold, such as the first quantity threshold is 90 and the second quantity threshold is 70, and the first quantity threshold and the second quantity threshold are not limited. Assuming that 4000 first data are read from the sector, 200 first data among the 4000 first data are defective data, and since the number 200 of defective data is greater than the first number threshold 90, it may be determined that the first state information indicates that the valid physical block is a true exception.
The second mode is that the proportion between the quantity of the damaged data and the quantity of the first data can be determined firstly; further, if the ratio is greater than the first ratio threshold, it may be determined that the first state information indicates that the valid physical block is truly abnormal; if the ratio is greater than the second ratio threshold and not greater than the first ratio threshold, it can be determined that the first state information represents that the valid physical block is suspected to be abnormal; if the ratio is not greater than the second ratio threshold, it may be determined that the first status information indicates that the valid physical block is not anomalous.
For example, the first ratio threshold and the second ratio threshold may be empirically configured, and the first ratio threshold may be greater than the second ratio threshold, such as 2% for the first ratio threshold and 1% for the second ratio threshold, which are not limited. Further, assuming that 4000 first data are read from the sector, and 200 first data among the 4000 first data are damaged data, a ratio of the number of damaged data 200 to the number of first data 4000 may be determined to be 5%, and since the ratio of 5% is greater than the first ratio threshold of 2%, it is determined that the first status information represents that the valid physical block is truly abnormal.
Step 405, determining second state information of the effective physical block according to the quantity of the damaged data in the second data; the second state information represents that the effective physical block is really abnormal, or the second state information represents that the effective physical block is suspected to be abnormal, or the second state information represents that the effective physical block is not abnormal.
The manner of determining the second state information of the effective physical block may refer to the manner of determining the first state information of the effective physical block, that is, refer to step 404, and is not repeated here.
And 406, if the second state information indicates that the effective physical block is really abnormal or indicates that the effective physical block is suspected to be abnormal, performing garbage collection on the effective physical block. If the second state information represents that the valid physical block is not abnormal, the process returns to step 401 to obtain the next valid physical block.
The garbage collection of the valid physical blocks may include, but is not limited to: and converting the use state of the effective physical block into a migration state, and performing garbage recovery on the converted effective physical block. After the usage status of the valid physical block is converted into the migration status, the process returns to step 401 to obtain the next valid physical block.
Based on the same application concept as the method, an embodiment of the present application further provides a data processing apparatus, which is applied to a storage device, as shown in fig. 5, and is a structural diagram of the apparatus, where the apparatus specifically includes:
an obtaining module 51, configured to obtain valid physical blocks of a solid state disk of a storage device that have been fully written with data; a reading module 52, configured to read first data from a first designated sector of the valid physical block;
a determining module 53, configured to determine corrupted data in the first data;
determining first state information of the effective physical block according to the quantity of the damaged data;
the processing module 54 is configured to, when the first state information indicates that the valid physical block is really abnormal, perform garbage collection on the valid physical block.
The reading module 52 is further configured to, when the first status information indicates that the valid physical block is suspected to be abnormal, read second data from a second specified sector of the valid physical block;
the determining module 53 is further configured to determine damaged data in the second data, and determine second state information of the valid physical block according to the amount of the damaged data in the second data;
the processing module 54 is further configured to, when the second state information indicates that the valid physical block is really abnormal or suspected to be abnormal, perform garbage collection on the valid physical block.
In an example, the determining module 53 is specifically configured to, when determining the first status information of the valid physical block according to the amount of the damaged data:
if the number is larger than a first number threshold, determining that the effective physical block represented by the first state information is really abnormal; if the number is larger than a second number threshold and not larger than a first number threshold, determining that the effective physical block represented by the first state information is suspected to be abnormal; or if the ratio of the quantity of the damaged data to the quantity of the first data is greater than a first ratio threshold, determining that the effective physical block characterized by the first state information is really abnormal; and if the ratio is larger than a second ratio threshold and not larger than a first ratio threshold, determining that the effective physical block represented by the first state information is suspected to be abnormal.
In one example, the valid physical block is a physical block in use; the processing module 54 is specifically configured to, when performing garbage collection on the effective physical block: converting the use state of the effective physical block into a migration state; and carrying out garbage recovery on the converted effective physical blocks.
In an example, the obtaining module 51, when obtaining a valid physical block of the solid state disk of the storage device that is already full of data, is specifically configured to:
determining a first plane unit where the last obtained effective physical block is located; the solid state disk comprises a plurality of plane units, and each plane unit comprises a plurality of effective physical blocks;
determining a second planar unit different from the first planar unit;
obtaining a valid physical block from the second plane unit that has been filled with data.
In terms of hardware, a schematic diagram of a hardware architecture provided in the embodiment of the present application may specifically refer to fig. 6, and may include: a machine-readable storage medium and a processor, wherein:
a machine-readable storage medium: the instruction code is stored.
A processor: the data processing operations disclosed in the above examples of the present application are implemented by communicating with a machine-readable storage medium, reading and executing the instruction code stored in the machine-readable storage medium.
Here, a machine-readable storage medium may be any electronic, magnetic, optical, or other physical storage device that can contain or store information such as executable instructions, data, and so forth. For example, the machine-readable storage medium may be: a RAM (random Access Memory), a volatile Memory, a non-volatile Memory, a flash Memory, a storage drive (e.g., a hard drive), a solid state drive, any type of storage disk (e.g., an optical disk, a dvd, etc.), or similar storage medium, or a combination thereof.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. A typical implementation device is a computer, which may take the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email messaging device, game console, tablet computer, wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing the present application.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
Furthermore, these computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (9)

1. A data processing method, applied to a storage device, the method comprising:
acquiring an effective physical block of a solid state disk of the storage device, which is full of data;
reading first data from a first designated sector of the effective physical block, determining damaged data in the first data, and determining first state information of the effective physical block according to the quantity of the damaged data;
if the first state information represents that the effective physical block is really abnormal, performing garbage collection on the effective physical block;
if the first state information represents that the effective physical block is suspected to be abnormal, reading second data from a second specified sector of the effective physical block, determining damaged data in the second data, and determining second state information of the effective physical block according to the quantity of the damaged data in the second data;
and if the second state information represents that the effective physical block is really abnormal or suspected to be abnormal, performing garbage collection on the effective physical block.
2. The method of claim 1,
the first designated sector is a first sector or a last sector;
if the first designated sector is the first sector, the second designated sector is the last sector;
the second designated sector is the first sector if the first designated sector is the last sector.
3. The method of claim 1,
determining first state information of the valid physical block according to the amount of the damaged data, including:
if the number is larger than a first number threshold, determining that the effective physical block represented by the first state information is really abnormal; if the number is larger than a second number threshold and not larger than a first number threshold, determining that the effective physical block represented by the first state information is suspected to be abnormal; or if the ratio of the quantity of the damaged data to the quantity of the first data is greater than a first ratio threshold, determining that the effective physical block characterized by the first state information is really abnormal; and if the ratio is larger than a second ratio threshold and not larger than a first ratio threshold, determining that the effective physical block represented by the first state information is suspected to be abnormal.
4. The method of claim 1, wherein the valid physical block is a physical block in use; the garbage collection of the effective physical block comprises:
converting the use state of the effective physical block into a migration state;
and carrying out garbage recovery on the converted effective physical blocks.
5. The method of claim 1,
acquiring valid physical blocks of the solid state disk of the storage device, which are already full of data, including:
determining a first plane unit where the last obtained effective physical block is located; the solid state disk comprises a plurality of plane units, and each plane unit comprises a plurality of effective physical blocks;
determining a second planar unit different from the first planar unit;
obtaining a valid physical block from the second plane unit that has been filled with data.
6. A data processing apparatus, for use in a storage device, the apparatus comprising:
the acquisition module is used for acquiring effective physical blocks of the solid state disk of the storage device, which are full of data;
a reading module, configured to read first data from a first designated sector of the valid physical block;
a determining module for determining corrupted data in the first data;
determining first state information of the effective physical block according to the quantity of the damaged data;
the processing module is used for performing garbage collection on the effective physical block when the first state information represents that the effective physical block is really abnormal;
the reading module is further configured to read second data from a second designated sector of the valid physical block when the first status information indicates that the valid physical block is suspected to be abnormal;
the determining module is further configured to determine corrupted data in the second data, and determine second state information of the valid physical block according to the amount of the corrupted data in the second data;
the processing module is further configured to perform garbage collection on the effective physical block when the second state information indicates that the effective physical block is really abnormal or suspected to be abnormal.
7. The apparatus according to claim 6, wherein the determining module, when determining the first status information of the valid physical block according to the amount of the corrupted data, is specifically configured to:
if the number is larger than a first number threshold, determining that the effective physical block represented by the first state information is really abnormal; if the number is larger than a second number threshold and not larger than a first number threshold, determining that the effective physical block represented by the first state information is suspected to be abnormal; or if the ratio of the quantity of the damaged data to the quantity of the first data is greater than a first ratio threshold, determining that the effective physical block characterized by the first state information is really abnormal; and if the ratio is larger than a second ratio threshold and not larger than a first ratio threshold, determining that the effective physical block represented by the first state information is suspected to be abnormal.
8. The apparatus of claim 6, wherein the valid physical block is a physical block in use; the processing module is specifically configured to, when performing garbage collection on the effective physical block:
converting the use state of the effective physical block into a migration state;
and carrying out garbage recovery on the converted effective physical blocks.
9. The apparatus according to claim 6, wherein the obtaining module, when obtaining the valid physical blocks of the solid state disk of the storage device that have been fully written with data, is specifically configured to:
determining a first plane unit where the last obtained effective physical block is located; the solid state disk comprises a plurality of plane units, and each plane unit comprises a plurality of effective physical blocks;
determining a second planar unit different from the first planar unit;
obtaining a valid physical block from the second plane unit that has been filled with data.
CN201811105669.1A 2018-09-21 2018-09-21 Data processing method and device Active CN109343796B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811105669.1A CN109343796B (en) 2018-09-21 2018-09-21 Data processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811105669.1A CN109343796B (en) 2018-09-21 2018-09-21 Data processing method and device

Publications (2)

Publication Number Publication Date
CN109343796A CN109343796A (en) 2019-02-15
CN109343796B true CN109343796B (en) 2022-03-01

Family

ID=65306092

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811105669.1A Active CN109343796B (en) 2018-09-21 2018-09-21 Data processing method and device

Country Status (1)

Country Link
CN (1) CN109343796B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112051964A (en) * 2019-06-06 2020-12-08 阿里巴巴集团控股有限公司 Data processing method and device
CN112783656B (en) * 2021-01-29 2024-04-30 杭州网易智企科技有限公司 Memory management method, medium, device and computing equipment
CN113190179B (en) * 2021-05-26 2022-02-11 北京自由猫科技有限公司 Method for prolonging service life of mechanical hard disk, storage device and system
CN114356211B (en) * 2021-11-19 2023-08-29 苏州浪潮智能科技有限公司 Storage space processing method and device, electronic equipment and storage medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101477492A (en) * 2009-01-21 2009-07-08 华中科技大学 Circulating rewriting flash memory equalization method used for solid state disk
CN102799535A (en) * 2012-06-29 2012-11-28 记忆科技(深圳)有限公司 Solid-state disk and data processing method thereof
CN103336744A (en) * 2013-06-20 2013-10-02 华中科技大学 Garbage recovery method for solid-state storage device and system for garbage recovery method
CN106776095A (en) * 2016-12-22 2017-05-31 湖南国科微电子股份有限公司 SSD solid state hard disc data reliability intelligent detecting methods and detection means
CN106990926A (en) * 2017-06-14 2017-07-28 郑州云海信息技术有限公司 A kind of processing method of solid state hard disc abrasion equilibrium
CN107092563A (en) * 2017-04-20 2017-08-25 紫光华山信息技术有限公司 A kind of rubbish recovering method and device
CN107844432A (en) * 2017-11-22 2018-03-27 深圳忆联信息系统有限公司 A kind of method and solid state hard disc of solid state hard disc dynamic garbage reclamation
CN108415853A (en) * 2018-03-15 2018-08-17 深圳市江波龙电子有限公司 A kind of method, apparatus and storage device of garbage reclamation

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080301448A1 (en) * 2007-06-01 2008-12-04 Microsoft Corporation Security Against Corruption for Networked Storage

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101477492A (en) * 2009-01-21 2009-07-08 华中科技大学 Circulating rewriting flash memory equalization method used for solid state disk
CN102799535A (en) * 2012-06-29 2012-11-28 记忆科技(深圳)有限公司 Solid-state disk and data processing method thereof
CN103336744A (en) * 2013-06-20 2013-10-02 华中科技大学 Garbage recovery method for solid-state storage device and system for garbage recovery method
CN106776095A (en) * 2016-12-22 2017-05-31 湖南国科微电子股份有限公司 SSD solid state hard disc data reliability intelligent detecting methods and detection means
CN107092563A (en) * 2017-04-20 2017-08-25 紫光华山信息技术有限公司 A kind of rubbish recovering method and device
CN106990926A (en) * 2017-06-14 2017-07-28 郑州云海信息技术有限公司 A kind of processing method of solid state hard disc abrasion equilibrium
CN107844432A (en) * 2017-11-22 2018-03-27 深圳忆联信息系统有限公司 A kind of method and solid state hard disc of solid state hard disc dynamic garbage reclamation
CN108415853A (en) * 2018-03-15 2018-08-17 深圳市江波龙电子有限公司 A kind of method, apparatus and storage device of garbage reclamation

Also Published As

Publication number Publication date
CN109343796A (en) 2019-02-15

Similar Documents

Publication Publication Date Title
CN109343796B (en) Data processing method and device
CN107368429B (en) Data storage device, memory controller, data management method thereof and data block management method
CN107608908B (en) Wear leveling method for data storage device
US9489303B2 (en) Techniques for controlling recycling of blocks of memory
US9063844B2 (en) Non-volatile memory management system with time measure mechanism and method of operation thereof
CN108897492B (en) Data writing method and device
KR100974954B1 (en) Read-time Wear-Leveling Method in Storage System using Flash Memory Device
CN108874309B (en) Method and device for managing physical blocks in solid state disk
US10096357B2 (en) Data storage device and data writing method thereof
EP2921963B1 (en) Memory recycling method and device
TWI505088B (en) Method, non-transistory computer readable medium and apparatus for writing data to different portions of memory based on write frequency
Luojie et al. An improved analytic expression for write amplification in NAND flash
US20180101303A1 (en) Data Storage Device and Data Writing Method Thereof
CN114237984A (en) Recovery method and system of Trim data under abnormal power failure and solid state disk
CN105955672B (en) Solid-state storage system and method for flexibly controlling wear leveling
CN111435403B (en) Wear balancing method and device for flash memory system
CN105868046B (en) The method of management, write-in and loading firmware code in storage device
CN113419682B (en) Data processing method and device and computer flash memory equipment
CN106021124B (en) A kind of storage method and storage system of data
JP2011227802A (en) Data recording device
CN111324284B (en) Memory device
KR100817204B1 (en) Method and apparatus for mapping flash memory
CN103389943A (en) Control device, storage device, and storage control method
CN108572924B (en) Request processing method of 3D MLC flash memory device
CN105892935A (en) Disk Apparatus And Method For Transferring And Storing Management Information

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
GR01 Patent grant
GR01 Patent grant