CN109960463A - A kind of disk management method, device and storage medium - Google Patents
A kind of disk management method, device and storage medium Download PDFInfo
- Publication number
- CN109960463A CN109960463A CN201711437202.2A CN201711437202A CN109960463A CN 109960463 A CN109960463 A CN 109960463A CN 201711437202 A CN201711437202 A CN 201711437202A CN 109960463 A CN109960463 A CN 109960463A
- Authority
- CN
- China
- Prior art keywords
- disk
- data
- recycled
- initial position
- write
- 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.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input 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/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/061—Improving I/O performance
- G06F3/0611—Improving I/O performance in relation to response time
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input 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/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0629—Configuration or reconfiguration of storage systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input 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/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0668—Interfaces specially adapted for storage systems adopting a particular infrastructure
- G06F3/0671—In-line storage system
- G06F3/0673—Single storage device
- G06F3/0674—Disk device
- G06F3/0676—Magnetic 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 kind of disk management method, device and storage mediums, which comprises determines that the write-in initial position of the disk is written in the cleaning initial position of disk and data;The data volume of data in area to be recycled is counted, the area to be recycled is the region between the cleaning initial position and said write initial position;When the data volume meets the amount threshold of setting, the area to be recycled is recycled, and records the end position in the area to be recycled after recovery processing as updated cleaning initial position.Technical solution through the embodiment of the present invention can solve the unordered operational issue of disk block, be effectively prevented from the jump back and forth of magnetic head.
Description
Technical field
The present invention relates to disk management technology more particularly to a kind of disk management methods, device and storage medium.
Background technique
For traditional mechanical disk, read-write operation relies on the mechanical rotation of disc and the movement of magnetic head carrys out location data
Position, for random operation such as random read-write, magnetic head need to constantly adjust the position of magnetic track, to read and write number on different location
According to, it is very frequent so as to cause the movement of magnetic head, the efficiency of reading and writing data is seriously affected, therefore, is occurred the random of disk
Operation is changed to the solution that sequence operates.
When converting random operation to the sequence operation to disk, cause the space of disk by excessive ineffective occupation
Problem, common disk way of recycling is: all pieces on the disk tissues in the form of chain sheet form or the position bit (bit), when having
When disk block can recycle, the disk block of recycling is put into available chained list or is set as 1 for corresponding bit;When having data to
When applying for disk block, applies for one directly from available chained list or be set as 0 for corresponding bit.The above-mentioned operation to disk block
It is unordered, or be partially ordered into, it not can avoid the problem of magnetic head frequently jumps back and forth in disk removal process, into
And reduce the efficiency of reading and writing data.
Summary of the invention
In view of this, solving disk an embodiment of the present invention is intended to provide a kind of disk management method, device and storage medium
The unordered operational issue of block is effectively prevented from the jump back and forth of magnetic head.
In order to achieve the above objectives, the technical solution of the embodiment of the present invention is achieved in that
The embodiment of the invention provides a kind of disk management methods, which comprises
Determine that the write-in initial position of the disk is written in the cleaning initial position of disk and data;
The data volume of data in area to be recycled is counted, the area to be recycled is that the cleaning initial position and said write rise
Region between beginning position;
When the data volume meets the amount threshold of setting, the area to be recycled is recycled, and records back
The end position in treated the area to be recycled is received as updated cleaning initial position.
In above scheme, the area to be recycled includes multiple sub- memory spaces;
It is described that the area to be recycled is recycled, comprising:
Sequentially detect the state of data in the multiple sub- memory space;
If the state of the data of currently detected sub- memory space is all invalid state, to described currently detected
Sub- memory space is recycled, and records the end position of the sub- memory space of the target after recovery processing as updated
Initial position is cleared up, until completing the recycling to the area to be recycled.
In above scheme, further includes: if state a part of the data of currently detected sub- memory space is invalid shape
When state, another part are effective status, the data are read in into memory;
By operation in the memory and be sequentially written for the data of effective status from said write initial position, and
End position after recording the data write-in of the effective status is as updated write-in initial position;
The sub- memory space of the target is recycled, and records the sub- memory space of the target after recovery processing
End position as updated cleaning initial position, until completing the recycling to the area to be recycled.
In above scheme, further includes: when the data volume meets data in the amount threshold of setting and the area to be recycled
Valid data amount be greater than setting valid data threshold value when, the area to be recycled is not recycled.
In above scheme, the write-in initial position of the disk is written in the cleaning initial position of the determining disk and data
Before, further includes:
It determines default using corresponding disk number and memory size;
The size of the disk space of pending disk management is determined according to the disk number and memory size.
In above scheme, the write-in initial position of the disk is written in the cleaning initial position of the determining disk and data
Before, further includes:
When detecting the write operation of data, the data are sequentially written from the write-in initial position of the disk,
And the end position after the data write-in is recorded as updated write-in initial position.
In above scheme, it is described the data are sequentially written from the write-in initial position of the disk before, comprising:
When detecting that the disk space positioned at disk outer ring road is unoccupied, the institute in disk outer ring road is determined
The starting position of disk space is stated as initial write-in initial position;
Determine the starting position of the disk space in disk outer ring road as initial cleaning initial position.
The embodiment of the invention also provides a kind of disk management device, described device includes:
The write-in initial position of the disk is written in determining module, cleaning initial position and data for determining disk;
Statistical module, for counting the data volume of data in area to be recycled, the area to be recycled is the cleaning start bit
Set the region between said write initial position;
Recycling module recycles the area to be recycled when for meeting the amount threshold of setting when the data volume
Processing, and the end position in the area to be recycled after recovery processing is recorded as updated cleaning initial position.
The embodiment of the invention also provides a kind of disk management device, described device includes: processor and for storing energy
The memory of enough computer programs run on a processor;
Wherein, the processor is for realizing above-mentioned disk management method when running the computer program.
The embodiment of the invention also provides a kind of storage mediums, are stored with computer program, and the computer program is located
When managing device execution, above-mentioned disk management method is realized.
Technical solution through the embodiment of the present invention, can have it is following the utility model has the advantages that
The initial position of disk and the initial position of defrag is written by record data, can quickly determine above-mentioned
Area to be recycled between two positions, and then the data volume in the area to be recycled is judged, it is set when the data volume meets
Amount threshold when, which is recycled, and record recovery processing after area to be recycled end position make
For updated cleaning initial position, therefore, the recycling of memory space is ordered progress on disk, is carrying out disk recycling
When, it solves the unordered operational issue of disk recycling, efficiently avoids the frequent jump of the magnetic head of disk.
Detailed description of the invention
Fig. 1 is the schematic diagram of the initial position label of a kind of data write-in provided in an embodiment of the present invention and Disk Cleanup;
Fig. 2 is a kind of flow diagram of disk management method provided in an embodiment of the present invention;
Fig. 3 is a kind for the treatment of process schematic diagram of block recycling provided in an embodiment of the present invention;
Fig. 4 is a kind of structural schematic diagram of disk management device provided in an embodiment of the present invention;
Fig. 5 is the structural schematic diagram of another disk management device provided in an embodiment of the present invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description.
Unless otherwise defined, all technical and scientific terms used herein and belong to technical field of the invention
The normally understood meaning of technical staff is identical.Term as used herein in the specification of the present invention is intended merely to description tool
The purpose of the embodiment of body, it is not intended that in the limitation present invention.Term as used herein "and/or" includes one or more phases
Any and all combinations of the listed item of pass.
Before the present invention will be described in further detail, noun involved in the embodiment of the present invention and term are said
Bright, noun involved in the embodiment of the present invention and term are suitable for following explanation.
1) disk space refers to a memory block in disk for some application assigned, and the memory block can
The capacity distributed on a disk or multiple disks is formed to be, wherein on each disk corresponding distribution capacity
It is considered as a disk space, the memory size and disk that the amount of capacity that each disk space is distributed and application program occupy
Number is related, for example, if the memory size that application program occupies is N megabits (Mbit), and the disk number occupied is S, that
, the capacity that each disk in S disk is distributed is [(a × N)/S] × 1Mbit, wherein a is the positive number greater than 1, i.e.,
The capacity of one disk space is [(a × N)/S] × 1Mbit.
Wherein, the disk management method of the embodiment of the present invention is managed as unit of disk space, the write-in of data
Cleaning with disk is also to be recycled as unit of disk space.
2) disk block (block) refers to that size is the storage region more than or equal to 1Mbit, a disk in disk
Space includes multiple block.
Here, disk block is the sub- memory space in the embodiment of the present invention.
3) area to be recycled refers to that cleaning initial position (being marked with start) and write-in initial position (mark) it with end
Between region, the starting point in the area to be recycled be cleaning initial position, terminal be write-in initial position;As shown in Figure 1, when disk is empty
Between in block1 to block4 write-in data after, area to be recycled be start 0 (indicate recovery processing before initial position,
I.e. clear up initial position) to end1 (indicate data write-in after end position, i.e., write-in initial position) between region, i.e.,
Block1 to block4;After a part (block1 and block2 as shown in figure 1) of block1 into block4 recycles, this
When area to be recycled be start1 (indicate recovery processing after end position, i.e., new cleaning initial position) between end1
Region, i.e. block3 and block4.Here, above-mentioned area to be recycled belongs to a part in disk space.
Here, end0 indicates position when data are not written for disk space, after data are written, position indicated by end
It will change, for example, write-in initial position will mark current from end0 after block1 to block4 is written in data
Position moves to the end position (position pointed by as end1) of block4, as shown in Figure 1, it can be seen that write-in start bit
Setting the position indicated by end0 becomes position pointed by end1.When needing that data are written, then the position pointed by the end1
It sets and starts that data are written.
It should be noted that end refers to the write-in initial position of data write-in disk space, position pointed by end with
Each time data write operation and change, for the ease of distinguishing position pointed by end in data manipulation of description
Variation, introduces two separators of end0 and end1, wherein and end0 refers to position when data are not written for disk space,
End1 refers to the end position after disk space write-in data;After disk space is written in data, initial position is written by end0
Indicated position becomes position pointed by end1.Similarly, start refers to the cleaning initial position of data scrubbing, start institute
The position of direction changes with data scrubbing operation each time, for the ease of distinguishing in cleaning operation of description
The change in location of start mark, introduces start0 and start1, wherein before start 0 refers to disk space recovery processing
Initial position, start1 refer to the end position after disk space recovery processing;After disk space is recycled, cleaning starting
Position position indicated by start0 becomes position pointed by start1.
4) the outer ring road of disk refers to disk outer ring or the magnetic track close to disk outer ring, wherein magnetic track refers to: magnetic
If head is kept in one position, in disk rotation, magnetic head can mark a circular trace, these circular rails in magnetic disk surface
Mark is referred to as magnetic track.
In order to solve because of the unordered operation of disk recycling in traditional scheme, and cause what magnetic disc head frequently jumped back and forth to ask
It inscribes, proposes a solution in the embodiment of the present invention, referring to Fig. 2, being a kind of disk pipe provided in an embodiment of the present invention
The flow diagram of reason method, the disk management method are applied to disk management device, and in practical applications, which can be with
It is embodied as the electronic equipment that such as laptop, desktop computer have disk, which comprises
Step 201: determining that the write-in initial position of the disk is written in the cleaning initial position of disk and data.
Here, it is described cleaning initial position refer to each time to disk progress cleaning operation when initial position.For magnetic
Disk, which carries out the preoperative cleaning initial position of first dressing, to be preset, when the cleaning for carrying out cleaning operation to disk
Initial position real-time update is the end position of a preceding cleaning operation.For example, as shown in Figure 1, appointing when disk is not written
When what data, then, which can be the initial position block1 that most starts to be written data;Work as defrag
Afterwards, when and the end position of defrag is block2, then, cleaning initial position is the end position for becoming block2.
It is worth noting that, cleaning initial position changes with the end position after carrying out Disk Cleanup each time.
In actual application, cleaning initial position can be marked by the way of mark or location variable, such as
Start label in Fig. 1.
In an alternate embodiment of the invention, before step 201 further include:, will be described when detecting the write operation of data
Data are sequentially written from the write-in initial position of the disk, and after recording the end position after data write-in as updating
Write-in initial position.
Since data are after being written disk, said write initial position will change, therefore, in order to update and record
The variation of initial position is written, accurately to position area to be recycled, therefore, each time when data write-in disk, can all update note
End position after recording the data write-in, can be with more when so as to follow-up data write-in as updated write-in initial position
Write-in initial position after new is as new start memory location, it is ensured that sequentially storage when data are written.
For example, in actual application, said write initial position can by the way of mark or location variable into
Line flag.For example, as shown in Figure 1, write-in initial position is marked with end, when the instruction for receiving some data of write-in
When, processor searches end label from disk, after finding, writes data into end and marks corresponding block1, until writing
After block4, data write-in is finished, then, end label is moved into the end position after data write-in, the i.e. stop bits of block4
It sets.
In an alternate embodiment of the invention, it is described the data are sequentially written from the write-in initial position of the disk before,
Further include: when detecting that the disk space positioned at disk outer ring road is unoccupied, determine the institute in disk outer ring road
The starting position of disk space is stated as initial write-in initial position;Determine the disk space in disk outer ring road
Starting position is as initial cleaning initial position.
Here, it is addressed due to using disk outer ring road space that can reduce magnetic disc head, improves access speed, therefore,
In actual application, disk outer ring road space can be preferentially selected, is avoided using cycle space in disk.
In an alternate embodiment of the invention, before step 201 further include: determine default using corresponding disk number and memory
Size;The size of the disk space of pending disk management is determined according to the disk number and memory size.
Here, it presets application and refers to some specific application program, it is assumed that in the application assigned on disk
Deposit size is indicated with N, and the disk number of distribution is indicated with S, then, in disk, 1) when S is 1, it is answered in the disk for this
The disk space for being (a × N) × 1Mbit with program allocated size;It 2), can be in S disk when S is more than or equal to 2
Respectively the application assigned size be [(a × N)/S] × 1Mbit disk space;Alternatively, a certain in S disk
In a disk, the disk space for being a × N for the application assigned size.After the size of disk space determines, for step
201, it specifically includes: the disk space that data are sequentially written in disk according to initial position is written, and record the data and write
End position after entering is as updated write-in initial position.
It should be noted that the data of some cachings can be generated due to during using the application program, here,
When distributing disk space, can a part of redundant space of overabsorption, in case further cache data, therefore, a can choose be greater than or
Positive integer equal to 2.
It distributes the disk space of storing data respectively for different application programs, and institute is sequentially written according to the order of setting
The disk space of distribution is recycled when needing to carry out disk recycling just for the disk space distributed, that is,
It says, disk management method provided by the embodiment of the present invention is managed by object of disk space, can effectively be improved
The efficiency of disk management, is conducive to recycling for disk space.
Step 202: counting the data volume of data in area to be recycled, the area to be recycled is the cleaning initial position and institute
State the region between write-in initial position.
After the write-in initial position of the disk is written in the cleaning initial position and data that determine disk, it will clear up
Beginning position and the region that is written between the write-in initial position of the disk of data be determined as area to be recycled, then count to be recycled
The data volume of data in area judges whether the data volume meets the amount threshold of setting to judge the data volume, when
When meeting the amount threshold of setting, step 203 is executed.
Here, amount threshold can be 50% to 70%, in actual application, can be set according to the actual situation
It is fixed.
For example, it is assumed that the disk space size of distribution is [a × N] × 1Mbit, i.e. disk space can store data volume and be
The data of [a × N] × 1Mbit;And the data volume in area to be recycled is [(end-start) × block_size] × 1Mbit,
In, block_size is the capacity of sub- memory space, and when each block_size is set as 1M, then the data volume in area to be recycled is
[end-start] × 1Mbit, unit are M-bit.From the foregoing, it will be observed that the data volume in area to be recycled is [end-start] × 1Mbit,
The capacity of disk space is that [a × N] × 1Mbit is held as [end-start] × 1Mbit >=[(a × N) × 50%] × 1Mbit
Row step 203.
Step 203: when the data volume meets the amount threshold of setting, the area to be recycled is recycled,
And the end position in the area to be recycled after recovery processing is recorded as updated cleaning initial position.
Here, area to be recycled includes multiple sub- memory spaces, and sub- memory space is a block in disk.
In the embodiment of the present invention, sub- memory space is the basic unit of Disk Cleanup, therefore, to the area to be recycled into
Row recovery processing, treating the sub- memory space in recovery area respectively is that unit is recycled.
For step 203, since the state of the data in area to be recycled is different, mode that recovery area is recycled is treated not
Together, wherein the state of data is divided into effective status and invalid state, and the state according to data is effective status or invalid shape
State, sub- memory space both sides directly or indirectly recycled in area to be recycled can be respectively divided by treating recovery area and carrying out recycling
Formula, described in detail below:
Mode 1: the directly recycling sub- memory space of target.
In an alternate embodiment of the invention, the area to be recycled includes multiple sub- memory spaces;Step 203, comprising:
Sequentially detect the state of data in the multiple sub- memory space;
If the state of the data of currently detected sub- memory space is all invalid state, to described currently detected
Sub- memory space is recycled, and records the end position of the sub- memory space of the target after recovery processing as updated
Initial position is cleared up, until completing the recycling to the area to be recycled.
For example, as shown in Figure 1, recycling block1 when the data of block1 are all invalid state, and remember
The end position of block1 after record recovery processing is as updated cleaning initial position;When the data of block2 are also all nothing
When effect state, block2 is recycled, and records the end position of the block2 after recovery processing as updated cleaning
Initial position.
Here, invalid state mainly includes following two: 1) data are provided with effective time and are stored in the time of disk
Have been over the effective time;2) data deleted are marked as.
For the data of application program itself, state, which can mark, is, and the validity period of effective status has
The corresponding data markers of application program itself are invalid shape when user's unloading, refitting or more new application by the unlimited time limit
State, to be recycled.The data formed for using the application program, state, which can mark, is, and
The validity period of effective status is the specific time limit, is that state becomes invalid state when being more than the definite term, to be recycled
Processing.It should be noted that the data formed using the application program also will be by when user unloads or resets application program
Labeled as invalid state, alternatively, causing to be formed using the application program because of refitting application program in order to avoid user
Data are cleaned, and can keep the effective status of the data of the formation, but shorten its validity period, as user after the modification effective
When having reinstalled the application program in the phase, validity period is reverted into the time limit before shortening, as user after the modification effective
When not reinstalling the application program in the phase, the data markers to the formation are invalid state, to be cleared up.
Mode 2: the recycling sub- memory space of target indirectly.
In an alternate embodiment of the invention, if step 204 includes: state one of the data of currently detected sub- memory space
Be divided into invalid state, another part be effective status when, by the data read in memory;By operation in the memory and
It is sequentially written for the data of effective status from said write initial position, and records the knot after the data write-in of the effective status
Beam position is as updated write-in initial position;The sub- memory space of the target is recycled, and is recorded at recycling
The end position of the sub- memory space of the target after reason is as updated cleaning initial position, until completing to described wait return
Receive the recycling in area.
For example, as shown in Figure 3, it is assumed that the last bit position of block2 is cleaning initial position, the last bit position of block4
It is set to write-in initial position, then, when data a part of block3 is effective status, a part is invalid state, wherein tiltedly
Dotted portion is the data of effective status, and horizontal dotted portion is the data of invalid state, then, processor is by the number in block3
According to reading in memory, according to write-in initial position by the valid data write-in block5 in memory, and by effective status
End position after data write-in block5 is as updated write-in initial position;Block3 is recycled, and is recorded back
The end position of treated block3 is received as updated cleaning initial position.
Here, it should be noted that last bit position refers to the last bit of some block;And what the end position being written referred to
It is the marginal position in space in disk shared by data after writing data into disk, the signified position such as end updated in Fig. 3 label
It sets, i.e. the signified position of end1 label, and the end position cleared up refers to the position after the recovery block, in general, recycling
Some block generally can recycle as a whole the block, i.e., be that a basic unit carries out whole return with block
It receives.
In an alternate embodiment of the invention, above two way of recycling is carried out when data volume meets the amount threshold of setting
Recycling, in addition, there are also a kind of situation, in order to avoid excessively frequent recycling, even if data volume meets the amount threshold of setting, but
When the valid data amount of data is greater than the valid data threshold value of setting in area to be recycled, the area to be recycled is not carried out at recycling
Reason.When valid data amount is less than the valid data threshold value of setting, the area to be recycled is recycled.
For example, both including valid data in area to be recycled, also includes invalid data, remembered using variable InuseNum
The size of valid data in each block is recorded, then, the total amount of valid data can pass through formula in the section start to endIt calculates, whenWhen more than or equal to preset valid data threshold value, recovery area is not treated
It is recycled, in this way, can control the number for carrying out recycling arrangement, avoids generating and largely read-rewrite operation.WhenWhen less than valid data threshold value, the area to be recycled is recycled.Wherein, valid data threshold value
It can be [t × (end-start)] × 1Mbit, wherein the value of t is that some numerical value between 0.5 to 1 generally can be with
Value is 0.9, and in actual application, the value of t can also be set according to the actual situation.
In conclusion the initial position of disk and the initial position of defrag is written by record data, it can be quick
Two positions of determination between region as area to be recycled, and then to the data shape in the sub- memory space in the area to be recycled
State is detected, and is recycled according to the data mode of detection to sub- memory space, until by above-mentioned two position it
Between region recycle complete, the write-in of data and the cleaning of disk sequentially carry out, to solve the unordered of disk block
Operational issue efficiently avoids the jump back and forth of magnetic disc head.
In order to realize above-mentioned disk management method, the embodiment of the invention also provides a kind of disk management devices, please join
Fig. 4 is read, described device includes:
The write-in start bit of the disk is written in determining module 401, cleaning initial position and data for determining disk
It sets;
Statistical module 402, for counting the data volume of data in area to be recycled, the area to be recycled is cleaning starting
Region between position and said write initial position;
Recycling module 403 goes back to the area to be recycled when for meeting the amount threshold of setting when the data volume
Receipts processing, and the end position in the area to be recycled after recovery processing is recorded as updated cleaning initial position.
Here, the area to be recycled includes multiple sub- memory spaces;Recycling module 403, is specifically used for:
Sequentially detect the state of data in the multiple sub- memory space;
If the state of the data of currently detected sub- memory space is all invalid state, to described currently detected
Sub- memory space is recycled, and records the end position of the sub- memory space of the target after recovery processing as updated
Initial position is cleared up, until completing the recycling to the area to be recycled.
Here, recycling module 403 are also used to:
If state a part of the data of currently detected sub- memory space is invalid state, another part is effective shape
When state, the data are read in into memory;
By operation in the memory and be sequentially written for the data of effective status from said write initial position, and
End position after recording the data write-in of the effective status is as updated write-in initial position;
The sub- memory space of the target is recycled, and records the sub- memory space of the target after recovery processing
End position as updated cleaning initial position, until completing the recycling to the area to be recycled.
Here, described device further include: processing module 404;Wherein,
Processing module 404, for meeting data in the amount threshold set and the area to be recycled when the data volume
When valid data amount is greater than the valid data threshold value of setting, the area to be recycled is not recycled.
Here, determining module 401 are also used to that writing for the disk is written in the cleaning initial position and data that determine disk
Before entering initial position, determine default using corresponding disk number and memory size;
The size of the disk space of pending disk management is determined according to the disk number and memory size.
Here, described device further include: writing module 405;Wherein,
Writing module 405, the write-in for the disk to be written in the cleaning initial position and data that determine disk originate
Before position, when detecting the write operation of data, the data are sequentially written from the write-in initial position of the disk,
And the end position after the data write-in is recorded as updated write-in initial position.
Here, determining module 401 are also used to the data it is sequentially being written from the write-in initial position of the disk
Before, when detecting that the disk space positioned at disk outer ring road is unoccupied, determine the magnetic in disk outer ring road
The starting position of disk space is as initial write-in initial position;
Determine the starting position of the disk space in disk outer ring road as initial cleaning initial position.
It is a kind of structural schematic diagram of disk management device provided in an embodiment of the present invention, disk management device refering to Fig. 5
500 can be the equipment such as smart phone, tablet computer, palm PC and electronic reader, and structure may include: at least one
Processor 510, memory 520, at least one network interface 530 and at least one user interface 540.Disk management device 500
In various components be coupled by bus system 550.It is understood that bus system 550 is for realizing between these components
Connection communication bus system 550 except include data/address bus in addition to, further include that power bus, control bus and status signal are total
Line.But for the sake of clear explanation, various buses are all designated as bus system 550 in Fig. 5.
Wherein, user interface 540 can be display, mouse or keyboard etc., wherein the display can be touch screen display
Show device.
Memory 520 can be volatile memory or nonvolatile memory, may also comprise volatile and non-volatile
The memory 520 of both memories, description of the embodiment of the present invention is intended to include but is not limited to these and any other suitable type
Memory.
Memory 520 in the embodiment of the present invention is for storing various types of data to support disk management device 500
Operation.The example of these data includes: any computer program for operating on disk management device 500, is such as operated
System 521 and application program 522.
Wherein, operating system 521 includes various system programs, such as ccf layer, core library layer, driving layer etc., for real
Existing various basic businesses and the hardware based task of processing.Application program 522 may include various application programs, realize this hair
The program for the disk management method that bright embodiment provides may be embodied in as a functional module in application program 522, certainly
Also it can be provided as the application program dedicated for disk management method.
Disk management method provided in an embodiment of the present invention can be applied in processor 510, or real by processor 510
Existing, the mode based on pure hardware is implemented, or is implemented based on the mode that software and hardware combines.
For the embodiment of pure hardware, processor 510 may be a kind of IC chip, the processing with signal
Ability.During realization, each step of disk management method provided in an embodiment of the present invention can be by processor 510
The integrated logic circuit of hardware is completed, such as in the exemplary embodiment, disk management device 500 built-in can have for realizing
The hardware decoding processor of disk management method provided in an embodiment of the present invention is implemented, for example, specific integrated circuit (ASIC,
Application Specific Integrated Circuit), Complex Programmable Logic Devices (CPLD, Complex
Programmable Logic Device), field programmable gate array (FPGA, Field-Programmable Gate
) etc. Array realize.
For the embodiment of software and hardware combining, above-mentioned processor 510 can be general processor and software module
Combination executes completion.Software module can be located in storage medium, which is located at memory 520, wherein storage medium
The computer program that can be run on processor 510 is stored, processor 510 is reading and running the computer in reservoir 520
When program, disk management method provided in an embodiment of the present invention is completed.
The embodiment of the present invention also provides a kind of storage medium, is stored with computer program, and the computer program is processed
The disk management method provided when device executes for realizing any embodiment of the present invention, for example, the magnetic of embodiment as shown in Figure 2
Disk management method;Storage medium includes effumability random access memory (RAM), read-only memory (ROM), electric erasable and programmable
Journey read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM (CD-ROM), digital versatile disc (DVD) or
Other accessed media.
The foregoing is only a preferred embodiment of the present invention, is not intended to limit the scope of the present invention.It is all
Made any modifications, equivalent replacements, and improvements etc. within the spirit and scope of the present invention is all contained in protection model of the invention
Within enclosing.
Claims (10)
1. a kind of disk management method characterized by comprising
Determine that the write-in initial position of the disk is written in the cleaning initial position of disk and data;
The data volume of data in area to be recycled is counted, the area to be recycled is the cleaning initial position and said write start bit
Region between setting;
When the data volume meets the amount threshold of setting, the area to be recycled is recycled, and records at recycling
The end position in the area to be recycled after reason is as updated cleaning initial position.
2. the method according to claim 1, wherein the area to be recycled includes multiple sub- memory spaces;
It is described that the area to be recycled is recycled, comprising:
Sequentially detect the state of data in the multiple sub- memory space;
If the state of the data of currently detected sub- memory space is all invalid state, the currently detected son is deposited
Storage space is recycled, and records the end position of the sub- memory space of the target after recovery processing as updated cleaning
Initial position, until completing the recycling to the area to be recycled.
3. according to the method described in claim 2, it is characterized by further comprising:
If state a part of the data of currently detected sub- memory space is invalid state, another part is effective status
When, the data are read in into memory;
By operation in the memory and be sequentially written for the data of effective status from said write initial position, and record
End position after the data write-in of the effective status is as updated write-in initial position;
The sub- memory space of the target is recycled, and records the knot of the sub- memory space of the target after recovery processing
Beam position is as updated cleaning initial position, until completing the recycling to the area to be recycled.
4. the method according to claim 1, wherein further include:
When the valid data amount that the data volume meets data in the amount threshold of setting and the area to be recycled is greater than setting
When valid data threshold value, the area to be recycled is not recycled.
5. the method according to claim 1, wherein the cleaning initial position of the determining disk and data write-in
Before the write-in initial position of the disk, further includes:
It determines default using corresponding disk number and memory size;
The size of the disk space of pending disk management is determined according to the disk number and memory size.
6. the method according to claim 1, wherein the cleaning initial position of the determining disk and data write-in
Before the write-in initial position of the disk, further includes:
When detecting the write operation of data, the data are sequentially written from the write-in initial position of the disk, and remembers
End position after recording the data write-in is as updated write-in initial position.
7. according to the method described in claim 6, it is characterized in that, it is described by the data from the write-in start bit of the disk
It sets before being sequentially written, further includes:
When detecting that the disk space positioned at disk outer ring road is unoccupied, the magnetic in disk outer ring road is determined
The starting position of disk space is as initial write-in initial position;
Determine the starting position of the disk space in disk outer ring road as initial cleaning initial position.
8. a kind of disk management device characterized by comprising
The write-in initial position of the disk is written in determining module, cleaning initial position and data for determining disk;
Statistical module, for counting the data volume of data in area to be recycled, the area to be recycled be the cleaning initial position and
Region between said write initial position;
Recycling module is recycled the area to be recycled when for meeting the amount threshold of setting when the data volume,
And the end position in the area to be recycled after recovery processing is recorded as updated cleaning initial position.
9. a kind of disk management device characterized by comprising processor and by store can run on a processor based on
The memory of calculation machine program;
Wherein, the processor is for realizing claim 1 to 7 described in any item disks when running the computer program
Management method.
10. a kind of storage medium, which is characterized in that it is stored with computer program, when the computer program is executed by processor,
Realize the described in any item disk management methods of claim 1 to 7.
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 true CN109960463A (en) | 2019-07-02 |
CN109960463B 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) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110908601A (en) * | 2019-10-31 | 2020-03-24 | 联想(北京)有限公司 | 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 (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102073464A (en) * | 2011-01-14 | 2011-05-25 | 南开大学 | Method for creating allocation-on-demand incremental volume |
US20120265954A1 (en) * | 2009-11-27 | 2012-10-18 | International Business Machines Corporation | System and method for optimized reclamation processing in a virtual tape library system |
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 |
US20140115238A1 (en) * | 2012-10-18 | 2014-04-24 | Agency For Science, Technology And Research | Storage controllers and storage control methods |
CN105159616A (en) * | 2015-09-11 | 2015-12-16 | 浪潮(北京)电子信息产业有限公司 | Disk space management method and device |
US20160132429A1 (en) * | 2013-11-14 | 2016-05-12 | Huawei Technologies Co., Ltd. | Method and Storage Device for Collecting Garbage Data |
CN106997277A (en) * | 2017-03-03 | 2017-08-01 | 北京中存超为科技有限公司 | Efficiently utilize the method and device of the memory space reclaimed |
-
2017
- 2017-12-26 CN CN201711437202.2A patent/CN109960463B/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20120265954A1 (en) * | 2009-11-27 | 2012-10-18 | 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 |
CN102779180A (en) * | 2012-06-29 | 2012-11-14 | 华为技术有限公司 | Operation processing method of data storage system and data storage system |
US20140115238A1 (en) * | 2012-10-18 | 2014-04-24 | Agency For Science, Technology And Research | Storage controllers and storage control methods |
CN103544045A (en) * | 2013-10-16 | 2014-01-29 | 南京大学镇江高新技术研究院 | HDFS-based virtual machine image storage system and construction method thereof |
US20160132429A1 (en) * | 2013-11-14 | 2016-05-12 | Huawei Technologies Co., Ltd. | Method and Storage Device for Collecting Garbage Data |
CN105159616A (en) * | 2015-09-11 | 2015-12-16 | 浪潮(北京)电子信息产业有限公司 | Disk space management method and device |
CN106997277A (en) * | 2017-03-03 | 2017-08-01 | 北京中存超为科技有限公司 | Efficiently utilize the method and device of the memory space reclaimed |
Non-Patent Citations (1)
Title |
---|
秦雄军等: "一种基于裸闪存的Key-Value数据库优化方法", 《计算机研究与发展》 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110908601A (en) * | 2019-10-31 | 2020-03-24 | 联想(北京)有限公司 | 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 |
Also Published As
Publication number | Publication date |
---|---|
CN109960463B (en) | 2021-11-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103049397B (en) | A kind of solid state hard disc inner buffer management method based on phase transition storage and system | |
CN106548789B (en) | Method and apparatus for operating stacked tile type magnetic recording equipment | |
US10303600B2 (en) | Method and storage device for collecting garbage data | |
CN103207839B (en) | Cache management method and system that track in the high-speed cache of storage is removed | |
CN104246764B (en) | The method and apparatus for placing record in non-homogeneous access memory using non-homogeneous hash function | |
CN103577336B (en) | A kind of stored data processing method and device | |
US8959281B1 (en) | Data management for a storage device | |
US8886884B2 (en) | System and method for increasing read and write speeds of hybrid storage unit | |
CN110674056B (en) | Garbage recovery method and device | |
CN104484283B (en) | A kind of method for reducing solid state disk write amplification | |
CN102096561B (en) | Hierarchical data storage processing method, device and storage equipment | |
CN103699492A (en) | Method of data collection in a non-volatile memory | |
US20070150645A1 (en) | Method, system and apparatus for power loss recovery to enable fast erase time | |
CN110673789B (en) | Metadata storage management method, device, equipment and storage medium of solid state disk | |
CN112130769B (en) | Mechanical hard disk data processing method, device, equipment and medium | |
TWI450271B (en) | Method for managing a plurality of blocks of a flash memory, and associated memory device and controller thereof | |
CN101751225A (en) | Data access method of hybrid hard drive | |
CN107145301B (en) | Data access method and device based on hybrid disk | |
US20150205538A1 (en) | Storage apparatus and method for selecting storage area where data is written | |
CN109960463A (en) | A kind of disk management method, device and storage medium | |
CN102880553B (en) | The reading/writing method of the outer FLASH file system of a kind of sheet based on MCU | |
CN105068941A (en) | Cache page replacing method and cache page replacing device | |
CN108664217B (en) | Caching method and system for reducing jitter of writing performance of solid-state disk storage system | |
CN107203341A (en) | Date storage method, device and flash chip based on flash memory | |
CN102087632B (en) | Data storage method for flash memory, controller and storage system |
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 |