CN109960463B - Disk management method, device and storage medium - Google Patents

Disk management method, device and storage medium Download PDF

Info

Publication number
CN109960463B
CN109960463B CN201711437202.2A CN201711437202A CN109960463B CN 109960463 B CN109960463 B CN 109960463B CN 201711437202 A CN201711437202 A CN 201711437202A CN 109960463 B CN109960463 B CN 109960463B
Authority
CN
China
Prior art keywords
disk
data
recovered
area
writing
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
CN201711437202.2A
Other languages
Chinese (zh)
Other versions
CN109960463A (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.)
ZTE Corp
Original Assignee
ZTE Corp
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 ZTE Corp filed Critical ZTE Corp
Priority to CN201711437202.2A priority Critical patent/CN109960463B/en
Publication of CN109960463A publication Critical patent/CN109960463A/en
Application granted granted Critical
Publication of CN109960463B publication Critical patent/CN109960463B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/061Improving I/O performance
    • G06F3/0611Improving I/O performance in relation to response time
    • 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/0629Configuration or reconfiguration of 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/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0674Disk device
    • G06F3/0676Magnetic disk device

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Signal Processing For Digital Recording And Reproducing (AREA)

Abstract

The embodiment of the invention discloses a disk management method, a device and a storage medium, wherein the method comprises the following steps: determining a cleaning initial position of a disk and a writing initial position of data written into the disk; counting the data volume of data in a to-be-recovered area, wherein the to-be-recovered area is an area between the cleaning starting position and the writing starting position; and when the data volume meets a set quantity threshold value, carrying out recovery processing on the region to be recovered, and recording the end position of the region to be recovered after the recovery processing as an updated cleaning start position. By the technical scheme of the embodiment of the invention, the problem of disordered operation of the disk block can be solved, and the back-and-forth jumping of the magnetic head can be effectively avoided.

Description

Disk management method, device and storage medium
Technical Field
The present invention relates to disk management technologies, and in particular, to a disk management method, device, and storage medium.
Background
For a traditional mechanical magnetic disk, the read-write operation depends on the mechanical rotation of a disk and the movement of a magnetic head to position data positions, and for random operations such as random read-write, the magnetic head needs to continuously adjust the position of a magnetic track so as to read and write data at different positions, so that the movement of the magnetic head is very frequent, and the efficiency of data read-write is seriously affected, therefore, a solution for changing the random operation of the magnetic disk into sequential operation appears.
When random operation is converted into sequential operation on a disk, the problem that the space of the disk is occupied by too much ineffectiveness is caused, and a common disk recycling mode is as follows: organizing all blocks on a disk in a linked list form or a bit (bit) form, and when a disk block can be recovered, putting the recovered disk block into an available linked list or setting the corresponding bit to be 1; when data is required to apply for a disk block, one bit is directly applied from an available linked list or the corresponding bit is set to be 0. The operation on the disk blocks is disordered or partially ordered, so that the problem of frequent back-and-forth jumping of the magnetic head in the disk recovery process cannot be avoided, and the data reading and writing efficiency is further reduced.
Disclosure of Invention
In view of the above, embodiments of the present invention are directed to a method, an apparatus, and a storage medium for managing a disk, which solve the problem of out-of-order operation of disk blocks and effectively avoid the jumping of a magnetic head.
In order to achieve the above purpose, the technical solution of the embodiment of the present invention is realized as follows:
the embodiment of the invention provides a disk management method, which comprises the following steps:
determining a cleaning initial position of a disk and a writing initial position of data written into the disk;
counting the data volume of data in a to-be-recovered area, wherein the to-be-recovered area is an area between the cleaning starting position and the writing starting position;
and when the data volume meets a set quantity threshold value, carrying out recovery processing on the region to be recovered, and recording the end position of the region to be recovered after the recovery processing as an updated cleaning start position.
In the above scheme, the to-be-recovered area includes a plurality of sub-storage spaces;
the recycling treatment of the area to be recycled comprises the following steps:
sequentially detecting the states of the data in the plurality of sub-storage spaces;
and if the state of the data of the currently detected sub-storage space is an invalid state, recovering the currently detected sub-storage space, and recording the end position of the target sub-storage space after recovery processing as an updated cleaning start position until the recovery of the to-be-recovered area is completed.
In the above scheme, the method further comprises: reading the data into a memory if one part of the currently detected state of the data of the sub-storage space is an invalid state and the other part of the currently detected state of the data of the sub-storage space is an valid state;
sequentially writing the data which run in the memory and are in the valid state from the writing initial position, and recording the end position of the written data in the valid state as the updated writing initial position;
and recovering the target sub-storage space, and recording the end position of the target sub-storage space after recovery as an updated cleaning start position until the recovery of the to-be-recovered area is completed.
In the above scheme, the method further comprises: and when the data volume meets a set number threshold and the effective data volume of the data in the area to be recovered is greater than a set effective data threshold, not performing recovery processing on the area to be recovered.
In the foregoing solution, before determining the cleaning start position of the disk and the write start position of the data written in the disk, the method further includes:
determining the number of disks and the size of a memory corresponding to a preset application;
and determining the size of the disk space to be subjected to disk management according to the number of the disks and the size of the memory.
In the foregoing solution, before determining the cleaning start position of the disk and the write start position of the data written in the disk, the method further includes:
and when the write-in operation of the data is detected, sequentially writing the data from the write-in initial position of the disk, and recording the end position of the written data as the updated write-in initial position.
In the foregoing solution, before sequentially writing the data from the write start position of the disk, the method includes:
when the disk space positioned in the disk outer lane is detected to be not occupied, determining the starting position of the disk space of the disk outer lane as an initial writing starting position;
and determining the starting position of the disk space of the disk outer lane as an initial cleaning starting position.
An embodiment of the present invention further provides a disk management apparatus, where the apparatus includes:
the determining module is used for determining the cleaning starting position of the disk and the writing starting position of data written into the disk;
the counting module is used for counting the data volume of data in a to-be-recovered area, wherein the to-be-recovered area is an area between the cleaning starting position and the writing starting position;
and the recovery module is used for performing recovery processing on the to-be-recovered area when the data volume meets a set quantity threshold value, and recording the end position of the to-be-recovered area after the recovery processing as an updated cleaning start position.
An embodiment of the present invention further provides a disk management apparatus, where the apparatus includes: a processor and a memory for storing a computer program capable of running on the processor;
the processor is used for realizing the disk management method when running the computer program.
The embodiment of the invention also provides a storage medium which stores a computer program, and the computer program is executed by a processor to realize the disk management method.
Through the technical scheme of the embodiment of the invention, the following beneficial effects can be achieved:
the recovery area to be recovered between the two positions can be rapidly determined by writing the recorded data into the initial position of the disk and the initial position of the disk to be cleaned, and then the data volume in the recovery area to be treated is judged.
Drawings
FIG. 1 is a schematic diagram of an initial position marker for data writing and disk cleaning according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a disk management method according to an embodiment of the present invention;
fig. 3 is a schematic diagram of a processing procedure of block recovery according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a disk management apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of another disk management apparatus according to an embodiment of the present invention.
Detailed Description
The technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used herein, the term "and/or" includes any and all combinations of one or more of the associated listed items.
Before further detailed description of the present invention, terms and expressions referred to in the embodiments of the present invention are described, and the terms and expressions referred to in the embodiments of the present invention are applicable to the following explanations.
1) The disk space refers to a storage area allocated to a certain application program in a disk, where the storage area may be composed of allocated capacity located on one disk or multiple disks, where the correspondingly allocated capacity on each disk is regarded as a disk space, and the size of the allocated capacity of each disk space is related to the size of memory occupied by the application program and the number of disks, for example, if the size of memory occupied by the application program is N megabits (mbits) and the number of disks occupied is S, then the allocated capacity of each disk in the S disks is [ (a × N)/S ] × 1Mbit, where a is a positive number greater than 1, that is, the capacity of one disk space is [ (a × N)/S ] × 1 Mbit.
The disk management method of the embodiment of the invention manages by taking the disk space as a unit, and writes data and cleans the disk by taking the disk space as a unit for cyclic use.
2) A disk block (block) refers to a storage area of 1Mbit or more in size in a disk, and one disk space includes a plurality of blocks.
Here, a disk block is a sub-storage space in the embodiment of the present invention.
3) A to-be-recycled area, which refers to an area between a cleaning start position (marked with start) and a writing start position (marked with end), the start point of the to-be-recycled area is the cleaning start position, and the end point is the writing start position; as shown in fig. 1, after blocks 1 to 4 in the disk space write data, the to-be-recovered area is an area from start0 (representing an initial position before recovery processing, i.e., a clean start position) to end1 (representing an end position after data is written, i.e., a write start position), i.e., blocks 1 to 4; when a part of blocks 1 to 4 (such as blocks 1 and 2 in fig. 1) is recovered, the region to be recovered at this time is a region from start1 (which represents the end position after recovery processing, i.e., the new cleaning start position) to end1, i.e., blocks 3 and 4. Here, the above-mentioned to-be-reclaimed area belongs to a part in the disk space.
Here, end0 represents the position of the disk space when no data is written, and the position indicated by end changes after data is written, for example, after data is written from block1 to block4, the writing start position moves from the current position marked by end0 to the end position of block4 (i.e. the position pointed by end 1), as shown in fig. 1, and thus it can be seen that the writing start position changes from the position indicated by end0 to the position pointed by end 1. When data needs to be written, data is written starting from the position pointed to by end 1.
It should be noted that end refers to a write start position of data written in the disk space, and a position pointed by end changes with each data write operation, and in order to describe the change of the position pointed by end in one data operation in a distinguishing manner, two distinguishing marks, end0 and end1, are introduced, where end0 refers to a position of the disk space when data is not written in the disk space, and end1 refers to an end position of the disk space after data is written in the disk space; when data is written to the disk space, the position indicated by end0 at the write start position becomes the position pointed to by end 1. Similarly, start refers to a cleaning start position of data cleaning, and a position pointed by start changes with each data cleaning operation, so as to facilitate distinguishing and describing the position change of a start identifier in one cleaning operation, start0 and start1 are introduced, where start0 refers to an initial position before disk space recovery processing, and start1 refers to an end position after disk space recovery processing; when the disk space is reclaimed, the position indicated by the start0 at the cleaning start position becomes the position indicated by the start 1.
4) The outer track of the disk refers to the outer ring of the disk or a track close to the outer ring of the disk, wherein the track refers to: if the head is held in a position, the head traces a circular path on the disk surface, called a track, as the disk rotates.
Referring to fig. 2, a schematic flow chart of a disk management method according to an embodiment of the present invention is provided, where the disk management method is applied to a disk management device, and in practical application, the device may be implemented as an electronic device with a disk, such as a notebook computer, a desktop computer, and the like, where the method includes:
step 201: determining a cleaning starting position of a disk and a writing starting position of data written into the disk.
Here, the cleaning start position refers to a start position at each cleaning operation of the disk. The cleaning starting position of the disk before the first cleaning operation can be preset, and the cleaning starting position of the disk after the cleaning operation is updated to the end position of the previous cleaning operation in real time. For example, as shown in FIG. 1, when the disk is not written with any data, then the clean start position may be the start position block1 where data is written first; when the disk is cleaned and the cleaning end position is block2, then the cleaning start position becomes the end position of block 2. It should be noted that the cleaning start position changes with the end position after each disk cleaning.
In practical applications, the cleaning start position may be marked by using an identifier or a position variable, such as the start mark in fig. 1.
In an alternative embodiment, step 201 is preceded by: and when the write-in operation of the data is detected, sequentially writing the data from the write-in initial position of the disk, and recording the end position of the written data as the updated write-in initial position.
Since the writing start position will change after the data is written into the disk, the area to be recovered is accurately positioned in order to update and record the change of the writing start position, and therefore, each time the data is written into the disk, the end position where the data is written is updated and recorded as the updated writing start position, so that the updated writing start position can be used as a new start storage position during the subsequent data writing, and the sequential storage during the data writing is ensured.
For example, in an actual application process, the writing start position may be marked by using an identifier or a position variable. For example, as shown in fig. 1, the writing start position is marked with end, when an instruction for writing certain data is received, the processor searches the end mark from the disk, after the end mark is found, writes the data into block1 corresponding to the end mark, until the data is written into block4, the data is written into the end, and then moves the end mark to the end position after the data is written into, that is, the end position of block 4.
In an optional embodiment, before sequentially writing the data from the write start position of the disk, the method further includes: when the disk space positioned in the disk outer lane is detected to be not occupied, determining the starting position of the disk space of the disk outer lane as an initial writing starting position; and determining the starting position of the disk space of the disk outer lane as an initial cleaning starting position.
In the method, the space of the outer circle of the disk can be preferentially selected to avoid using the space of the inner circle of the disk in the practical application process because the addressing of the magnetic head of the disk can be reduced and the access speed is improved by using the space of the outer circle of the disk.
In an optional embodiment, step 201 further includes: determining the number of disks and the size of a memory corresponding to a preset application; and determining the size of the disk space to be subjected to disk management according to the number of the disks and the size of the memory.
Here, the preset application refers to a specific application program, and assuming that the size of the memory allocated to the application program on the disk is represented by N and the number of the allocated disks is represented by S, then, in the disk, 1) when S is 1, a disk space with a size of (a × N) × 1Mbit is allocated to the application program in the disk; 2) when S is greater than or equal to 2, a disk space with a size of [ (a × N)/S ] × 1Mbit can be allocated to the application program in the S disks respectively; alternatively, in one of the S disks, a disk space of a size of a × N is allocated to the application. After the size of the disk space is determined, for step 201, the method specifically includes: and sequentially writing the data into the disk space in the disk according to the writing initial position, and recording the end position of the written data as the updated writing initial position.
It should be noted that, since some buffered data may be generated during the process of using the application program, here, when allocating the disk space, a part of redundant space is allocated for subsequent buffered data, and therefore, a may be a positive integer greater than or equal to 2.
The disk space for storing data is respectively allocated for different application programs, and the allocated disk space is sequentially written in according to the set sequence, and when disk recovery is needed, recovery processing is only performed on the allocated disk space, that is, the disk management method provided by the embodiment of the invention uses the disk space as an object for management, so that the disk management efficiency can be effectively improved, and the cyclic utilization of the disk space is facilitated.
Step 202: and counting the data volume of data in an area to be recovered, wherein the area to be recovered is an area between the cleaning starting position and the writing starting position.
After determining the cleaning start position of the disk and the writing start position of the data written in the disk, determining an area between the cleaning start position and the writing start position of the data written in the disk as a to-be-recycled area, then counting the data volume of the data in the to-be-recycled area so as to judge the data volume, judging whether the data volume meets a set quantity threshold value, and executing step 203 when the data volume meets the set quantity threshold value.
Here, the number threshold may be 50% to 70%, and may be set according to actual conditions during actual application.
For example, assume that the size of the allocated disk space is [ a × N ] × 1Mbit, i.e., the disk space can store data with a data amount of [ a × N ] × 1 Mbit; and the data size of the to-be-recovered area is [ (end-start) × block _ size ] × 1Mbit, wherein block _ size is the capacity of the sub-storage space, and when each block _ size is set to 1M, the data size of the to-be-recovered area is [ end-start ] × 1Mbit, and the unit is M bits. As can be seen from the above, the data size of the to-be-recovered area is [ end-start ] × 1Mbit, the capacity of the disk space is [ a × N ] × 1Mbit, and when [ end-start ] × 1Mbit is greater than or equal to [ (a × N) × 50% ] × 1Mbit, step 203 is executed.
Step 203: and when the data volume meets a set quantity threshold value, carrying out recovery processing on the region to be recovered, and recording the end position of the region to be recovered after the recovery processing as an updated cleaning start position.
Here, the region to be reclaimed includes a plurality of sub-storage spaces, and the sub-storage space is one block in the disk.
In the embodiment of the invention, the sub-storage space is a basic unit for cleaning a disk, so that the sub-storage space in the to-be-recovered area is recovered as a unit when the to-be-recovered area is recovered.
For step 203, because the states of the data in the to-be-recovered area are different, the recovery modes of the to-be-recovered area are different, where the states of the data are divided into an effective state and an invalid state, and according to whether the states of the data are effective or invalid, the recovery of the to-be-recovered area can be divided into two modes, namely directly and indirectly recovering the sub-storage space in the to-be-recovered area, which are specifically as follows:
mode 1: and directly recycling the target sub-storage space.
In an optional embodiment, the to-be-recovered area includes a plurality of sub-storage spaces; step 203, comprising:
sequentially detecting the states of the data in the plurality of sub-storage spaces;
and if the state of the data of the currently detected sub-storage space is an invalid state, recovering the currently detected sub-storage space, and recording the end position of the target sub-storage space after recovery processing as an updated cleaning start position until the recovery of the to-be-recovered area is completed.
For example, as shown in fig. 1, when all the data of block1 are in an invalid state, block1 is recovered, and the end position of block1 after recovery processing is recorded as an updated cleaning start position; when all the data of block2 are in an invalid state, block2 is recovered, and the end position of block2 after recovery processing is recorded as the cleaning start position after update.
Here, the invalid state mainly includes the following two types: 1) the data sets the valid time, and the time stored in the disk exceeds the valid time; 2) data marked for deletion.
For the data of the application program, the state of the application program can be marked as a valid state, the valid period of the valid state has an infinite period, and when the user uninstalls, reinstalls or updates the application program, the corresponding data of the application program is marked as an invalid state for recycling. The state of the data created by using the application program can be marked as a valid state, the valid state has a valid period of a specific period, and when the specific period is exceeded, the state is changed to an invalid state for recycling. It should be noted that, when the user uninstalls or reinstalls the application, the data formed by using the application will also be marked as invalid, or, in order to avoid the data formed by using the application being cleaned up due to reinstalling the application, the valid state of the formed data may be maintained, but the valid period thereof may be shortened, when the user reinstalls the application within the modified valid period, the valid period may be restored to the time period before the shortening, and when the user does not reinstall the application within the modified valid period, the formed data may be marked as invalid for cleaning up.
Mode 2: and indirectly recycling the target sub-storage space.
In an alternative embodiment, step 204 includes: reading the data into a memory if one part of the currently detected state of the data of the sub-storage space is an invalid state and the other part of the currently detected state of the data of the sub-storage space is an valid state; sequentially writing the data which run in the memory and are in the valid state from the writing initial position, and recording the end position of the written data in the valid state as the updated writing initial position; and recovering the target sub-storage space, and recording the end position of the target sub-storage space after recovery as an updated cleaning start position until the recovery of the to-be-recovered area is completed.
For example, as shown in fig. 3, assuming that the last position of block2 is a cleaning start position and the last position of block4 is a writing start position, when a part of the data of block3 is in an active state and a part of the data is in an inactive state, where a diagonal dotted line part is data in the active state and a horizontal dotted line part is data in the inactive state, the processor reads all the data in block3 into the memory, writes the active data in the memory into block5 according to the writing start position, and writes the end position of the data in the active state after being written into block5 as an updated writing start position; and recovering the block3, and recording the end position of the block3 after recovery processing as the updated cleaning start position.
Here, the last bit position refers to the last bit of a block; the writing end position refers to an edge position of the space in the disk occupied by the data after the data is written into the disk, for example, the position indicated by the updated end mark in fig. 3, that is, the position indicated by the end1 mark, and the cleaning end position refers to a position where the block is recovered.
In an alternative embodiment, the two recovery methods are recovery performed when the data amount satisfies a set number threshold, and in addition, in order to avoid too frequent recovery, even if the data amount satisfies the set number threshold, and the valid data amount of the data in the region to be recovered is greater than the set valid data threshold, the region to be recovered is not subjected to recovery processing. And when the effective data amount is smaller than a set effective data threshold value, carrying out recovery processing on the region to be recovered.
For example, in the region to be reclaimed, containing both valid data and invalid data, a variable is usedInuseNum records the size of valid data in each block, so the total amount of valid data in the interval from start to end can be represented by a formula
Figure BDA0001526027210000091
Calculation when
Figure BDA0001526027210000092
When the data is larger than or equal to the preset effective data threshold value, the recovery processing is not carried out on the area to be recovered, so that the times of recovery sorting can be controlled, and a large amount of reading-rewriting operation is avoided. When in use
Figure BDA0001526027210000101
And when the data is smaller than the effective data threshold value, carrying out recovery processing on the region to be recovered. Wherein the valid data threshold may be [ t × (end-start)]X 1Mbit, where t is a value between 0.5 and 1, and generally may be 0.9, and in the actual application process, t may also be set according to the actual situation.
In summary, by recording the initial position of writing data into the disk and the initial position of cleaning the disk, the area between the two positions can be quickly determined as the to-be-recovered area, and then the data state in the sub-storage space in the to-be-recovered area is detected, and the sub-storage space is recovered according to the detected data state until the area between the two positions is recovered, and the data writing and the disk cleaning are performed sequentially, so that the problem of disordered operation of the disk block is solved, and the back-and-forth jump of the disk head is effectively avoided.
In order to implement the above-mentioned disk management method, an embodiment of the present invention further provides a disk management apparatus, please refer to fig. 4, where the apparatus includes:
a determining module 401, configured to determine a cleaning start position of a disk and a write start position of data written in the disk;
a counting module 402, configured to count a data amount of data in a to-be-recovered area, where the to-be-recovered area is an area between the cleaning start position and the writing start position;
a recycling module 403, configured to, when the data amount meets a set number threshold, perform recycling processing on the to-be-recycled area, and record an end position of the to-be-recycled area after the recycling processing as an updated cleaning start position.
Here, the to-be-reclaimed area includes a plurality of sub-storage spaces; the recycling module 403 is specifically configured to:
sequentially detecting the states of the data in the plurality of sub-storage spaces;
and if the state of the data of the currently detected sub-storage space is an invalid state, recovering the currently detected sub-storage space, and recording the end position of the target sub-storage space after recovery processing as an updated cleaning start position until the recovery of the to-be-recovered area is completed.
Here, the recycling module 403 is further configured to:
reading the data into a memory if one part of the currently detected state of the data of the sub-storage space is an invalid state and the other part of the currently detected state of the data of the sub-storage space is an valid state;
sequentially writing the data which run in the memory and are in the valid state from the writing initial position, and recording the end position of the written data in the valid state as the updated writing initial position;
and recovering the target sub-storage space, and recording the end position of the target sub-storage space after recovery as an updated cleaning start position until the recovery of the to-be-recovered area is completed.
Here, the apparatus further includes: a processing module 404; wherein the content of the first and second substances,
a processing module 404, configured to not perform recycling processing on the to-be-recycled area when the data amount meets a set number threshold and an effective data amount of the data in the to-be-recycled area is greater than a set effective data threshold.
Here, the determining module 401 is further configured to determine the number of disks and the size of a memory corresponding to a preset application before determining a cleaning start position of a disk and a writing start position of data written in the disk;
and determining the size of the disk space to be subjected to disk management according to the number of the disks and the size of the memory.
Here, the apparatus further includes: a write module 405; wherein the content of the first and second substances,
a writing module 405, configured to, before determining a cleaning start position of a disk and a writing start position of data written in the disk, when a writing operation of the data is detected, sequentially write the data from the writing start position of the disk, and record an end position after the data is written as an updated writing start position.
Here, the determining module 401 is further configured to, before the data is sequentially written from the writing start position of the disk, determine, as an initial writing start position, a start position of the disk space of the outer lane of the disk when it is detected that the disk space located in the outer lane of the disk is not occupied;
and determining the starting position of the disk space of the disk outer lane as an initial cleaning starting position.
Referring to fig. 5, which is a schematic structural diagram of a disk management device according to an embodiment of the present invention, the disk management device 500 may be a smart phone, a tablet computer, a palm computer, an e-reader, and other devices, and may include: at least one processor 510, memory 520, at least one network interface 530, and at least one user interface 540. The various components in disk management device 500 are coupled together by a bus system 550. It will be appreciated that the bus system 550 is used to effect connections between these components-the communication bus system 550 includes a power bus, a control bus, and a status signal bus, in addition to a data bus. For clarity of illustration, however, the various buses are designated as bus system 550 in fig. 5.
The user interface 540 may be a display, a mouse, a keyboard, or the like, wherein the display may be a touch screen display.
The memory 520 may be either volatile memory or nonvolatile memory, and may include both volatile and nonvolatile memory, and the memory 520 described in embodiments of the invention is intended to include, without being limited to, these and any other suitable types of memory.
The memory 520 in the embodiment of the present invention is used to store various types of data to support the operation of the disk management apparatus 500. Examples of such data include: any computer program for operating on disk management device 500, such as operating system 521 and application programs 522.
The operating system 521 includes various system programs, such as a framework layer, a core library layer, a driver layer, and the like, for implementing various basic services and processing hardware-based tasks. The application 522 may include various applications, and a program for implementing the disk management method provided in the embodiment of the present invention may be included in the application 522 as a functional module, or may be provided as an application specifically used for the disk management method.
The disk management method provided by the embodiment of the present invention may be applied to the processor 510, or implemented by the processor 510, implemented in a pure hardware manner, or implemented in a combination of software and hardware.
For a purely hardware implementation, processor 510 may be an integrated circuit chip having signal processing capabilities. In the implementation process, each step of the disk management method provided in the embodiment of the present invention may be implemented by an Integrated Logic Circuit of hardware in the processor 510, for example, in an exemplary embodiment, the disk management apparatus 500 may be implemented by a hardware decoding processor built in the hardware management apparatus for implementing the disk management method provided in the embodiment of the present invention, for example, an Application Specific Integrated Circuit (ASIC), a Complex Programmable Logic Device (CPLD), a Field Programmable Gate Array (FPGA), and the like.
For the embodiment combining software and hardware, the processor 510 may be a general-purpose processor and a software module. The software module may be located in a storage medium located in the memory 520, where the storage medium stores a computer program capable of running on the processor 510, and the processor 510, when reading and running the computer program in the memory 520, performs the disk management method provided by the embodiment of the present invention.
An embodiment of the present invention further provides a storage medium, which stores a computer program, where the computer program is used to implement the disk management method provided in any embodiment of the present invention when executed by a processor, for example, the disk management method in the embodiment shown in fig. 2; storage media includes volatile Random Access Memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), Digital Versatile Disks (DVD), or other media that can be accessed.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, and improvement made within the spirit and scope of the present invention are included in the protection scope of the present invention.

Claims (10)

1. A disk management method, comprising:
determining a cleaning initial position of a disk and a writing initial position of data written into the disk;
counting the data volume of data in a to-be-recovered area, wherein the to-be-recovered area is an area between the cleaning starting position and the writing starting position;
and when the data volume meets a set quantity threshold value, carrying out recovery processing on the region to be recovered, and recording the end position of the region to be recovered after the recovery processing as an updated cleaning start position.
2. The method of claim 1, wherein the area to be reclaimed comprises a plurality of sub-storage spaces;
the recycling treatment of the area to be recycled comprises the following steps:
sequentially detecting the states of the data in the plurality of sub-storage spaces;
and if the state of the data of the currently detected sub-storage space is an invalid state, recovering the currently detected sub-storage space, and recording the end position of the target sub-storage space after recovery processing as an updated cleaning start position until the recovery of the to-be-recovered area is completed.
3. The method of claim 2, further comprising:
reading the data into a memory if one part of the currently detected state of the data of the sub-storage space is an invalid state and the other part of the currently detected state of the data of the sub-storage space is an valid state;
sequentially writing the data which run in the memory and are in the valid state from the writing initial position, and recording the end position of the written data in the valid state as the updated writing initial position;
and recovering the target sub-storage space, and recording the end position of the target sub-storage space after recovery as an updated cleaning start position until the recovery of the to-be-recovered area is completed.
4. The method of claim 1, further comprising:
and when the data volume meets a set number threshold and the effective data volume of the data in the area to be recovered is greater than a set effective data threshold, not performing recovery processing on the area to be recovered.
5. The method of claim 1, wherein before determining the cleaning start position of the disk and the writing start position of the data written to the disk, further comprising:
determining the number of disks and the size of a memory corresponding to a preset application;
and determining the size of the disk space to be subjected to disk management according to the number of the disks and the size of the memory.
6. The method of claim 1, wherein before determining the cleaning start position of the disk and the writing start position of the data written to the disk, further comprising:
and when the write-in operation of the data is detected, sequentially writing the data from the write-in initial position of the disk, and recording the end position of the written data as the updated write-in initial position.
7. The method of claim 6, wherein before the sequentially writing the data from the write start location of the disk, further comprising:
when the disk space positioned in the disk outer lane is detected to be not occupied, determining the starting position of the disk space of the disk outer lane as an initial writing starting position;
and determining the starting position of the disk space of the disk outer lane as an initial cleaning starting position.
8. A disk management apparatus, comprising:
the determining module is used for determining the cleaning starting position of the disk and the writing starting position of data written into the disk;
the counting module is used for counting the data volume of data in a to-be-recovered area, wherein the to-be-recovered area is an area between the cleaning starting position and the writing starting position;
and the recovery module is used for performing recovery processing on the to-be-recovered area when the data volume meets a set quantity threshold value, and recording the end position of the to-be-recovered area after the recovery processing as an updated cleaning start position.
9. A disk management apparatus, comprising: a processor and a memory for storing a computer program capable of running on the processor;
wherein the processor is configured to implement the disk management method according to any one of claims 1 to 7 when the computer program is executed.
10. A storage medium storing a computer program which, when executed by a processor, implements the disk management method according to any one of claims 1 to 7.
CN201711437202.2A 2017-12-26 2017-12-26 Disk management method, device and storage medium Active CN109960463B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711437202.2A CN109960463B (en) 2017-12-26 2017-12-26 Disk management method, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711437202.2A CN109960463B (en) 2017-12-26 2017-12-26 Disk management method, device and storage medium

Publications (2)

Publication Number Publication Date
CN109960463A CN109960463A (en) 2019-07-02
CN109960463B true CN109960463B (en) 2021-11-02

Family

ID=67022644

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711437202.2A Active CN109960463B (en) 2017-12-26 2017-12-26 Disk management method, device and storage medium

Country Status (1)

Country Link
CN (1) CN109960463B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110908601B (en) * 2019-10-31 2021-07-16 联想(北京)有限公司 Processing method and device and electronic equipment
CN117591041A (en) * 2024-01-19 2024-02-23 科来网络技术股份有限公司 Data writing method and device, mechanical hard disk and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102779180A (en) * 2012-06-29 2012-11-14 华为技术有限公司 Operation processing method of data storage system and data storage system
CN103544045A (en) * 2013-10-16 2014-01-29 南京大学镇江高新技术研究院 HDFS-based virtual machine image storage system and construction method thereof

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2011064003A1 (en) * 2009-11-27 2011-06-03 International Business Machines Corporation System and method for optimized reclamation processing in a virtual tape library system
CN102073464A (en) * 2011-01-14 2011-05-25 南开大学 Method for creating allocation-on-demand incremental volume
US9268709B2 (en) * 2012-10-18 2016-02-23 Marvell International Ltd. Storage controllers and storage control methods
CN103577338B (en) * 2013-11-14 2016-06-29 华为技术有限公司 A kind of method reclaiming junk data and storage device
CN105159616A (en) * 2015-09-11 2015-12-16 浪潮(北京)电子信息产业有限公司 Disk space management method and device
CN106997277B (en) * 2017-03-03 2019-12-13 北京中存超为科技有限公司 method and device for efficiently utilizing recycled storage space

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102779180A (en) * 2012-06-29 2012-11-14 华为技术有限公司 Operation processing method of data storage system and data storage system
CN103544045A (en) * 2013-10-16 2014-01-29 南京大学镇江高新技术研究院 HDFS-based virtual machine image storage system and construction method thereof

Also Published As

Publication number Publication date
CN109960463A (en) 2019-07-02

Similar Documents

Publication Publication Date Title
TWI425357B (en) Method for performing block management, and associated memory device and controller thereof
TWI416513B (en) A system and method for managing adjacent track interference in a hard disk drive
CN103019888B (en) Backup method and device
TWI446345B (en) Method for performing block management, and associated memory device and controller thereof
CN109656486B (en) Configuration method of solid state disk, data storage method, solid state disk and storage controller
US8886884B2 (en) System and method for increasing read and write speeds of hybrid storage unit
KR20150035560A (en) Optimized context drop for a solid state drive(ssd)
CN102483714A (en) Restore Index Page
CN110674056B (en) Garbage recovery method and device
JP2017079053A (en) Methods and systems for improving storage journaling
TWI501081B (en) Wear leveling with marching strategy
KR20100065786A (en) Cache synchronization method and system for fast power-off
US20080320210A1 (en) Data management systems, methods and computer program products using a phase-change random access memory for selective data maintenance
CN111930301A (en) Garbage recycling optimization method and device, storage medium and electronic equipment
US20130304972A1 (en) Control device, storage device, and storage control method
CN109960463B (en) Disk management method, device and storage medium
TWI450271B (en) Method for managing a plurality of blocks of a flash memory, and associated memory device and controller thereof
KR102530583B1 (en) Storage device and memory system
CN106844491B (en) Temporary data writing and reading method and device
CN107145301B (en) Data access method and device based on hybrid disk
JP2007148965A (en) Error block management method and device for flash disk device
CN102160038A (en) Method and an apparatus to manage non-volatile disl cache
CN107688442B (en) Virtual block management method for solid state disk
KR20170132483A (en) Method of operating memory device
US9146858B2 (en) Control device, storage device, and storage control method

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