A kind of data block fill method, device, equipment and readable storage medium storing program for executing

文档序号:1755019 发布日期:2019-11-29 浏览:2次 中文

阅读说明:本技术 一种数据块填充方法、装置、设备及可读存储介质 (A kind of data block fill method, device, equipment and readable storage medium storing program for executing ) 是由 吕玉彬 戚勇 于 2019-08-09 设计创作,主要内容包括:本发明公开了一种数据块填充方法、装置、设备及可读存储介质,该方法包括:确定任一存在空白的数据页的数据块为目标数据块;如果所述目标数据块未被写入数据的持续时间达到预设时间段,并且所述目标数据块中空白的数据页的数量大于k,则向所述目标数据块中填充k个数据页的无效数据;其中,k为基于所述目标数据块所属存储设备确定的、所述目标数据块中存在被损坏风险的数据所属数据页的个数。本申请不仅保证了目标数据块中实际有效的数据的可靠性;而且在目标数据块中空白的数据页的数量大于k时仅通过填充k个数据页的无效数据即可达到保证数据可靠性的目的,减少了写入至目标数据块中的无效数据,从而节省了目标数据块中的存储空间。(The invention discloses a kind of data block fill method, device, equipment and readable storage medium storing program for executing, this method comprises: determining that any there are the data block of the data page of blank is target data block;If the duration that the target data block is not written into data reaches preset time period, and the quantity of the data page of blank is greater than k in the target data block, then k number is filled into the target data block according to the invalid data of page;Wherein, k is the number that there is the affiliated data page of data for being damaged risk in target data block determining based on storage equipment belonging to the target data block, described.The application not only ensure that the reliability of actually active data in target data block;And only passes through filling k number when the quantity of the data page of blank is greater than k in target data block and can reach the purpose for guaranteeing data reliability according to the invalid data of page, reduce the invalid data being written into target data block, to save the memory space in target data block.)

1. a kind of data block fill method characterized by comprising

Determine it is any there are the data block of the data page of blank be target data block;

If the duration that the target data block is not written into data reaches preset time period, and the target data block The quantity of the data page of middle blank is greater than k, then k number is filled into the target data block according to the invalid data of page;Wherein, k To there is the data institute for being damaged risk in target data block determine based on storage equipment belonging to the target data block, described Belong to the number of data page.

2. the method according to claim 1, wherein determine it is any there are the data block of the data page of blank be mesh After mark data block, further includes:

If receiving power-off signal, and the quantity of the data page of blank is greater than k in the target data block, then to the mesh It marks and fills k number in data block according to the invalid data of page.

3. according to the method described in claim 2, it is characterized in that, filling k number into the target data block according to the nothing of page Before effect data, further includes:

The pre-stored k number for including invalid data label is obtained according to the invalid data of page.

4. according to the method described in claim 3, it is characterized by further comprising:

Timer is set, and controls the timer and starts to carry out at the time of data are written into the target data block every time Timing;

It is corresponding, judge that the target data block is not written into whether duration of data reaches preset time period, comprising:

Judge that the timer starts to carry out at the time of data are written to the target data block in last time timing to current Whether the timing duration at moment reaches preset time period.

5. according to the method described in claim 4, it is characterized in that, filling k number into the target data block according to the nothing of page After effect data, further includes:

Data write request is received, and data corresponding with the data write request are written into the target data block.

6. a kind of data block filling device characterized by comprising

Determining module is used for: determine it is any there are the data block of the data page of blank be target data block;

First filling module, is used for: if the duration that the target data block is not written into data reaches preset time period, And the quantity of the data page of blank is greater than k in the target data block, then k number is filled into the target data block according to page Invalid data;Wherein, k is to exist in target data block determining based on storage equipment belonging to the target data block, described It is damaged the number of the affiliated data page of data of risk.

7. device according to claim 6, which is characterized in that further include:

Second filling module, be used for: determine it is any there are the data block of the data page of blank be target data block after, if connect Power-off signal is received, and the quantity of the data page of blank is greater than k in the target data block, then into the target data block K number is filled according to the invalid data of page.

8. device according to claim 7, which is characterized in that further include:

Obtain module, be used for: before filling k number in Xiang Suoshu target data block according to the invalid data of page, acquisition is stored in advance Include invalid data label k number according to page invalid data.

9. a kind of data block filling equipment characterized by comprising

Memory, for storing computer program;

Processor realizes the data block fill method as described in any one of claim 1 to 5 when for executing the computer program The step of.

10. a kind of readable storage medium storing program for executing, which is characterized in that be stored with computer program, the meter on the readable storage medium storing program for executing It is realized when calculation machine program is executed by processor as described in any one of claim 1 to 5 the step of data block fill method.

Technical field

The present invention relates to solid state hard disk technical fields, more specifically to a kind of data block fill method, device, set Standby and readable storage medium storing program for executing.

Background technique

The data block of solid state hard disk (block, the unit of solid state hard disk store data inside are the basic units for clashing operation) It is one of the basic unit of storing data, each data block has n (n is greater than 1 integer) a data page (page, solid state hard disk The unit of store data inside is the basic unit of write and read), data page is the minimum unit of read-write.Number in each data block It is sequentially written according to page, if all data pages of some data block are written data, can claim such The state of data block is in off state (close), can if the not every data page of certain data blocks is all written with data To claim these data blocks to be in an open state (open).

But if certain data block is chronically at opening state, will lead to it includes partial data page data it is unstable It is fixed, and then the error bit during ECC (Error Checking and Correction, the error correction procedure of solid state hard disk) Number dramatically increases;In order to avoid such case, the prior art is generally in data block time in the open state longer Shi Zhi It connects and fills out invalid data and fill up data block in the open state, so that the data block reaches closed state, guarantee wherein data Stability.But the invalid data that this mode is disposably filled is excessive, will cause the waste of memory space in data block.

Summary of the invention

The object of the present invention is to provide a kind of data block fill method, device, equipment and readable storage medium storing program for executing, for solving The problem of filling waste memory space existing for the mode of data block in the prior art.

To achieve the goals above, the invention provides the following technical scheme:

A kind of data block fill method, comprising:

Determine it is any there are the data block of the data page of blank be target data block;

If the duration that the target data block is not written into data reaches preset time period, and the number of targets It is greater than k according to the quantity of the data page of blank in block, then fills k number into the target data block according to the invalid data of page;Its In, k is there is the number for being damaged risk in target data block determining based on storage equipment belonging to the target data block, described According to the number of affiliated data page.

Preferably, determine it is any there are the data block of the data page of blank be target data block after, further includes:

If receiving power-off signal, and the quantity of the data page of blank is greater than k in the target data block, then to institute It states and fills k number in target data block according to the invalid data of page.

Preferably, before k number is filled in Xiang Suoshu target data block according to the invalid data of page, further includes:

The pre-stored k number for including invalid data label is obtained according to the invalid data of page.

Preferably, further includes:

Timer is set, and controls the timer and starts at the time of data are written into the target data block every time Carry out timing;

It is corresponding, judge that the target data block is not written into whether duration of data reaches preset time period, wraps It includes:

Judge that the timer starts to carry out timing extremely at the time of data are written to the target data block in last time Whether the timing duration at current time reaches preset time period.

Preferably, after k number is filled in Xiang Suoshu target data block according to the invalid data of page, further includes:

Data write request is received, and data corresponding with the data write request are written into the target data block.

A kind of data block filling device, comprising:

Determining module is used for: determine it is any there are the data block of the data page of blank be target data block;

First filling module, is used for: if the duration that the target data block is not written into data reaches default Between section, and the quantity of the data page of blank is greater than k in the target data block, then k is filled into the target data block The invalid data of data page;Wherein, k is target data block determining based on storage equipment belonging to the target data block, described The middle number that there is the affiliated data page of data for being damaged risk.

Preferably, further includes:

Second filling module, be used for: determine it is any there are the data block of the data page of blank be target data block after, such as Fruit receives power-off signal, and the quantity of the data page of blank is greater than k in the target data block, then to the target data K number is filled in block according to the invalid data of page.

Preferably, further includes:

Module is obtained, is used for: before filling k number in Xiang Suoshu target data block according to the invalid data of page, being obtained preparatory Storage includes the k number of invalid data label according to the invalid data of page.

A kind of data block filling equipment, comprising:

Memory, for storing computer program;

Processor realizes the step of the as above any one data block fill method when for executing the computer program Suddenly.

A kind of readable storage medium storing program for executing is stored with computer program, the computer program quilt on the readable storage medium storing program for executing The step of as above any one data block fill method is realized when processor executes.

The present invention provides a kind of data block fill method, device, equipment and readable storage medium storing program for executing, wherein this method packet Include: determine it is any there are the data block of the data page of blank be target data block;If the target data block is not written into number According to duration reach preset time period, and in the target data block data page of blank quantity be greater than k, then to institute It states and fills k number in target data block according to the invalid data of page;Wherein, k is based on storing equipment belonging to the target data block There is the number for the affiliated data page of data for being damaged risk in determining, the described target data block.Technology disclosed by the invention Scheme, for any one, there are the target data blocks of the data page of blank, if target data block is not written into continuing for data The quantity that time reaches the data page of blank in preset time period and target data block is greater than k, then k is filled into target data block The invalid data of a data page, wherein k is the number that there is the affiliated data page of data for being damaged risk in target data block, To which in this way, so that k number replaces in target data block according to the invalid data of page, effectively data become state not Stable data, thus even if situations such as data of state labile are damaged in target data block, it will not be to number of targets It is impacted according to data actually active in block, to ensure that the reliability of actually active data in target data block;And And it is i.e. reachable according to the invalid data of page only to pass through filling k number when the quantity of the data page of blank is greater than k in target data block To the purpose for guaranteeing the wherein reliability of actually active data, reduce the invalid data being written into target data block, from And save the memory space in target data block.

Detailed description of the invention

In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this The embodiment of invention for those of ordinary skill in the art without creative efforts, can also basis The attached drawing of offer obtains other attached drawings.

Fig. 1 is a kind of flow chart of data block fill method provided in an embodiment of the present invention;

Fig. 2 is a kind of structural schematic diagram of data block filling 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, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other Embodiment shall fall within the protection scope of the present invention.

Referring to Fig. 1, can wrap it illustrates a kind of flow chart of data block fill method provided in an embodiment of the present invention It includes:

S11: determine it is any there are the data block of the data page of blank be target data block.

It should be noted that a kind of executing subject of data block fill method provided in an embodiment of the present invention can be correspondence Data block filling device;Wherein, the data page of any data is not written as in the data page of blank, and there are the data pages of blank Data block be in an open state, the data block of any opening state can be used as target data block, to the target data block Carry out corresponding data stuffing operations.

S12: if the duration that target data block is not written into data reaches preset time period, and target data block The quantity of the data page of middle blank is greater than k, then k number is filled into target data block according to the invalid data (dummy data) of page; Wherein, k be based on belonging to target data block storage equipment determine, in target data block exist be damaged belonging to the data of risk The number of data page.

Inventor has found that when data block is in the opening state of long period, the time nearest apart from current time is written Partial data (being newly written the partial data into data block) into data block has unstability, is easy to appear damage Situations such as, it is assumed that the data page occupied with instable partial data is a for k, if the data block of certain opening state is write Than the m-th data page, then the k number for being ultimately written the data block is a to m according to the data in page, that is, (m-k+1) Data mode in a data page is unstable.Also, with the data (occupied in other words) belonging to instable partial data The number of page is related to storage characteristic (the nand characteristic) of equipment (solid state hard disk etc.) belonging to data block, that is to say, that different deposits The number stored up in equipment with data page shared by instable data in the data block of opening state is different, therefore this implementation It can determine that data block has not in the open mode in storage equipment belonging to target data block in example by modes such as experiments Data page number shared by the data of stability, and determine that the number is the value of k;Preset time period can indicate that t is also with t Characteristic (the retention (error in data caused by SSD time data memory is too long) of nand of equipment is stored as belonging to data block Characteristic) determine, the value of different storage equipment corresponding data block t when executing step S12 is different, therefore in the present embodiment Data block can be determined belonging to target data block in storage equipment by modes such as experiments in opening state and is continued countless When according to write-in, the data moment is written by last time to because caused by unstability last k number according to the corrupted data etc. of page Period between the previous moment of situation is preset time period.

In the present embodiment, determine target data block last time write data to the time interval at current time (simultaneously And any data are not written to target data block in the time interval) and when reaching preset time period, in order to avoid target data block In data situations such as being damaged because of unstability, k number is filled into target data block according to the invalid data of page, as a result, The feelings such as occur damaging according to the data of page even if being ultimately written k number therein caused by being chronically at opening state because of target data block Situations such as condition and k number are damaged according to the invalid data of page will not influence effective actual number in target data block According to;Different from the prior art by target data block being filled up so that target data block becomes closing shape from opening state State, but only need will to have unstable possible k number and be filled according to page with invalid data, to avoid to actual effective While the influence of data, the data volume of filling is reduced.

Technical solution disclosed by the invention, for any one, there are the target data blocks of the data page of blank, if target The quantity that the duration that data block is not written into data reaches the data page of blank in preset time period and target data block is big In k, then k number is filled into target data block according to the invalid data of page, wherein k is to exist to be damaged wind in target data block The number of the affiliated data page of data of danger, thus in this way, so that k number replaces target data according to the invalid data of page Effective data become the data of state labile in block, so that even if the data of state labile are damaged in target data block Bad situations such as, will not impact data actually active in target data block, to ensure that real in target data block The reliability of the effective data in border;Also, only pass through filling k when the quantity of the data page of blank is greater than k in target data block The invalid data of a data page is that can reach the purpose for guaranteeing the wherein reliability of actually active data, reduces write-in to mesh The invalid data in data block is marked, to save the memory space in target data block.

A kind of data block fill method provided in an embodiment of the present invention determines that any there are the data blocks of the data page of blank After target data block, can also include:

If receiving power-off signal, and the quantity of the data page of blank is greater than k in target data block, then to number of targets According to filling k number in block according to the invalid data of page.

Power-off signal is received then to illustrate to need to carry out power-down operation to the system for storing equipment belonging to target data block, by Last k number may also be because of unstability, on again according to the data of page in data block in the open state before power down Electricity after there is mistake, therefore in the present embodiment in receiving power-off signal and target data block the data page of blank quantity When greater than k, it is also desirable to fill k number into target data block according to the invalid data of page, to be further ensured that target data block In actually active data stability.Also, due to needing to grasp in power down to the operation of target data block filling invalid data Complete before realizing, and the invalid data filled in the present embodiment compared with the existing technology in fill under square one it is invalid Data will be lacked, and so as to avoid filling adverse effect caused by power-down operation of invalid data, such as postpone the reality of power-down operation Now etc..

It should be noted that receiving power-off signal and/or target data block is not written into duration of data and reaches Preset time period, when still receiving power-off signal, if the quantity for being performed both by the data page of blank in target data block is greater than K then fills k number according to the operation of the invalid data of page, to guarantee target data in this way into target data block The reliability of data in block.

In addition, the duration that either target data block is not written into data reaches preset time period, still receive Power-off signal, if the duration that target data block is not written into data reaches preset time period, and in target data block The quantity of the data page of blank is not more than k, then target data block filling is completely directly become closed state, thus with The corresponding steps of the application data block fill method combine, and guarantee the stability of data in target data block.

A kind of data block fill method provided in an embodiment of the present invention fills k number into target data block according to the nothing of page Before imitating data, can also include:

The pre-stored k number for including invalid data label is obtained according to the invalid data of page.

In order to which when needing by obtaining data in target data block actually active data can be distinguished and effectively in order to protect The invalid data of data reliability filling is demonstrate,proved, the invalid data of filling to target data block can make pre-stored in the application Include the data of invalid data label, to can quickly navigate to invalid data by invalid data label, and then realizes The differentiation of actually active data and invalid data, specifically, invalid data label can be set according to actual needs, Such as additional character is not specifically limited herein.

A kind of data block fill method provided in an embodiment of the present invention can also include:

Timer is set, and control timer starts to be counted at the time of data are written into target data block every time When;

It is corresponding, judge that target data block is not written into whether duration of data reaches preset time period, can wrap It includes:

Judge that timer starts to carry out at the time of data are written to target data block in last time timing to current time Timing duration whether reach preset time period.

Can be determined by pre-set timer in the present embodiment target data block be not written into data it is lasting when Between section whether reach preset time period, specifically write every time target data block write-in data after by 0 carry out timing, in turn Subsequent step is realized based on duration obtained by timing;Wherein, it realizes that timing realizes that logic is simple using timer, can save ready-made Resource, to improve the realization efficiency of data block fill method.

A kind of data block fill method provided in an embodiment of the present invention fills k number into target data block according to the nothing of page After imitating data, can also include:

Data write request is received, and data corresponding with data write request are written into target data block.

It should be noted that after in order to guarantee that data reliability fills invalid data into target data block, if needed To carry out writing data into target data block, namely if receiving data write request, can directly into target data block k Continue to realize the corresponding write operation of data write request in data page after a invalid data, to realize to target data block Recycling, improves the utilization rate of memory space in data block.

As it can be seen that technical solution disclosed in the present application, corresponding preset time period and k are determined by analysis storage equipment Value, and then receiving power-off signal or target data block is not written into duration of data and reaches preset time period When, if the number of the data page of target data block blank is greater than k, k number is filled into target data block according to the invalid of page Data avoid to have unstability by invalid data substitution valid data because unstability is damage caused by valid data It is bad etc.;And in the case where the number of the data page of the blank of target data block is greater than k, it is only necessary to fill k number evidence thereto The invalid data of page is the reliability that can guarantee wherein data, thus reduce the data volume of the invalid data of filling, it is especially right In the small data quantity scatter write the case where, the utilization rate of target data block can be greatly improved, the introducing of excessive invalid data is reduced, Increase the effective rate of utilization to storage equipment;Also, filling invalid data bring expense during power down is reduced, is shortened The time required to power-down operation, system effectiveness is enhanced, while reducing the probability that capacitor not enough power supply occurs in powered-off fault, increased The stability of adding system, robustness.

The embodiment of the invention also provides a kind of data block filling devices, as shown in Fig. 2, may include:

Determining module 11, is used for: determine it is any there are the data block of the data page of blank be target data block;

First filling module 12, is used for: if the duration that target data block is not written into data reaches preset time Section, and the quantity of the data page of blank is greater than k in target data block, then k number is filled into target data block according to the nothing of page Imitate data;Wherein, k be based on belonging to target data block storage equipment determine, in target data block exist be damaged risk The number of the affiliated data page of data.

A kind of data block filling device provided in an embodiment of the present invention can also include:

Second filling module, be used for: determine it is any there are the data block of the data page of blank be target data block after, such as Fruit receives power-off signal, and the quantity of the data page of blank is greater than k in target data block, then fills into target data block K number according to page invalid data.

A kind of data block filling device provided in an embodiment of the present invention can also include:

Obtain module, be used for: before filling k number into target data block according to the invalid data of page, acquisition is stored in advance Include invalid data label k number according to page invalid data.

A kind of data block filling device provided in an embodiment of the present invention can also include:

Setup module is used for: setting timer, and control timer every time into target data block be written data when Start at quarter to carry out timing;

Corresponding, in the first filling module and the second filling module may include:

Judging unit is used for: judging that timer starts to carry out at the time of data are written to target data block in last time Whether the timing duration at timing to current time reaches preset time period.

A kind of data block filling device provided in an embodiment of the present invention can also include:

Writing module is used for: after filling k number into target data block according to the invalid data of page, data write request is received, And data corresponding with data write request are written into target data block.

The embodiment of the invention also provides a kind of data block filling equipments, may include:

Memory, for storing computer program;

Processor, when for executing computer program realize as above any one of data block fill method the step of.

The embodiment of the invention also provides a kind of readable storage medium storing program for executing, it is stored with computer program on readable storage medium storing program for executing, The step of as above any one data block fill method is realized when computer program is executed by processor.

It should be noted that a kind of data block filling device, equipment and readable storage medium storing program for executing provided in an embodiment of the present invention The explanation of middle relevant portion refers in a kind of data block fill method provided in an embodiment of the present invention corresponding part specifically Bright, details are not described herein.In addition in above-mentioned technical proposal provided in an embodiment of the present invention with correspond to technical solution in the prior art The consistent part of realization principle is simultaneously unspecified, in order to avoid excessively repeat.

The foregoing description of the disclosed embodiments can be realized those skilled in the art or using the present invention.To this A variety of modifications of a little embodiments will be apparent for a person skilled in the art, and the general principles defined herein can Without departing from the spirit or scope of the present invention, to realize in other embodiments.Therefore, the present invention will not be limited It is formed on the embodiments shown herein, and is to fit to consistent with the principles and novel features disclosed in this article widest Range.

10页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种系统间数据迁移的方法、装置、设备及存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类