CN1595523A - A disk storage method - Google Patents

A disk storage method Download PDF

Info

Publication number
CN1595523A
CN1595523A CN 03156793 CN03156793A CN1595523A CN 1595523 A CN1595523 A CN 1595523A CN 03156793 CN03156793 CN 03156793 CN 03156793 A CN03156793 A CN 03156793A CN 1595523 A CN1595523 A CN 1595523A
Authority
CN
China
Prior art keywords
sector
storage
data
current
beginning flag
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
Application number
CN 03156793
Other languages
Chinese (zh)
Other versions
CN1331147C (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.)
Lenovo Beijing Ltd
Original Assignee
Lenovo Beijing Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Lenovo Beijing Ltd filed Critical Lenovo Beijing Ltd
Priority to CNB031567932A priority Critical patent/CN1331147C/en
Publication of CN1595523A publication Critical patent/CN1595523A/en
Application granted granted Critical
Publication of CN1331147C publication Critical patent/CN1331147C/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Signal Processing For Digital Recording And Reproducing (AREA)

Abstract

The invention relates to a disc storage method, which is composed of dividing the memory area into more than one block, the position where the starting position of the current stored data deviating one or more blocks from the original stored data being considered to be the current deviation position, and storing the data from the current deviation position. According to the method, the sector where all the initiation flags are stored is considered to be the starting position when storing data in the disc. Changing the data storage starting position of the disc guarantees the disc storage operations not always to be in the same sector. By this means, the disc storage can be accessed isostaticly and the durability of the disc can be extended effectively. In addition, when reading data, the data storage starting position is located by searching the initiation flag sector. Then the data is read. By this means, data reading accuracy is guaranteed.

Description

A kind of disk storage method
Technical field
The present invention relates to computer application field, be meant a kind of disk storage method especially.
Background technology
At present, hard disk is one of main storage medium of computing machine.Under common operating position, the serviceable life of hard disk is generally all more than 3 years.If when hard disk is used for frequent memory device, for example an embedded Linux system adopts hard disk as storage medium, for realizing system's ease for use, needs design system to shut down at any time.For guaranteeing the reliability of system, promptly at any time system can not destroyed, whole linux system is started with read-only mode, but some need to preserve about the configurations of using, therefore store these data by the direct memory access hard disk sector and the mode of carrying out double copies.If directly hard disk sector is carried out data storage, then can cause being stored in the same area of hard disk at every turn, will carry out write operation repeatedly to the same sector of hard disk at short notice, like this, increase the probability of hard disk magnetic track physical damage greatly, shortened the serviceable life of hard disk greatly.In addition, same existence frequently writes the problem of same sector for floppy disk.Therefore, how to prevent, will become the effective prolongation disk matter of utmost importance in serviceable life the writing repeatedly of disk same position.
Summary of the invention
In view of this, fundamental purpose of the present invention is to provide a kind of disk storage method, realizes the balanced memory access to disk, thereby effectively prolongs the serviceable life of disk.
In order to achieve the above object, the invention provides a kind of disk storage method, the method includes the steps of:
A, storage area is divided into more than one;
B, the former relatively data storage location of current data storage reference position are offset one or more as current deviation post;
C, begin to carry out data storage with described current deviation post.
Described step B further may further comprise the steps: B11, search are used for the beginning flag sector of identification data storage reference position, with the position of the relative storage area initial sector skew in beginning flag sector as former deviation post; B12, current data storage reference position are offset one or more again on described former deviation post basis.
Further comprise before the described step B12: the beginning flag of storing in the deletion beginning flag sector.
If carry out data storage in the sequential storage mode, then current data storage reference position is offset a piece again on former deviation post basis.
If carry out data storage with storage mode at random, then current data storage reference position is offset k piece again on former deviation post basis, and k is the positive integer at random that system generates at random.
Described step B further comprises step B21: search is used for the beginning flag sector of identification data storage reference position, find the piece at data storage end position place according to the data length of storing in the initial sector, with the position of the relative storage area initial sector skew of this piece as current deviation post.
Further comprise after the described step B21: the beginning flag of storing in the deletion beginning flag sector.
When carrying out data storage for the first time, described beginning flag sector is positioned at the initial sector of storage area.
When carrying out data storage for the first time, described beginning flag sector is arranged in first sector of the 1st piece of storage area, and 1 is the positive integer at random that system generates at random.
Further comprise before the described step C: judge whether current deviation post has surpassed the end sector position of storage area, if make that current deviation post is zero, then execution in step C; Otherwise, direct execution in step C.
Described step C further may further comprise the steps: C1, storage be during data, judge the current data memory location whether exceeded storage area finish sector position and current deviation post with, if, report an error to system, finish the current data Stored Procedure, otherwise, execution in step C2; C2, judge whether the current data memory location has exceeded storage area and finished sector position, if the actual current data memory location of order is the poor of current data memory location and storage area, execution in step C3 then, otherwise, direct execution in step C3; C3, judge whether to finish current data storage, if, beginning flag is stored in first sector of first piece after the deviation post, finish the current data Stored Procedure, otherwise, execution in step C1 returned.
Further comprise step D after the described step C: the data that read storage.
Described step D further may further comprise the steps: D1, search are used for the beginning flag sector of identification data storage reference position, read beginning flag and the current data length that reads stored in the beginning flag sector; D2, when reading the data of storage, judge that current data reads the position and whether exceeded storage area and finish sector position, if, it is that current data reads the poor of position and storage area that the actual current data of order reads the position, execution in step D3 then, otherwise, direct execution in step D3; D3, judge whether to finish current data and read, if, finish current data and read flow process, otherwise, execution in step D1 returned.
Described beginning flag sector storage is useful on the sector identification string of sign beginning flag and the length of current storage data.
Described steps A comprises: storage area is divided into 20 to 200 pieces.
According to the proposed method, reference position with the sector that stores beginning flag during as storage data in disk, data storage reference position by continuous change disk, assurance can be always in same sector to the storage operation of disk, realization is to the balanced memory access of disk, thereby effectively prolongs the serviceable life of disk.In addition, during reading of data,, find the reference position of storage data, then data are read by search beginning flag sector, thus the correctness of assurance data read.
Description of drawings
Fig. 1 is frequent memory area configuration synoptic diagram among the present invention;
Fig. 2 is access process synoptic diagram among the present invention;
Fig. 3 is memorying data flow journey figure among the present invention;
Fig. 4 is reading of data flow process figure among the present invention.
Embodiment
For making the purpose, technical solutions and advantages of the present invention clearer, the present invention is described in further detail below in conjunction with accompanying drawing.
The invention provides a kind of method to the balanced memory access of disk, reference position with the sector that stores beginning flag during as storage data in disk, data storage reference position by continuous change disk, assurance can be always in same sector to the storage operation of disk, thereby effectively prolongs the serviceable life of disk.In addition, during reading of data,, find the reference position of storage data, then data are read by search beginning flag sector, thus the correctness of assurance data read.
Owing in each possible sector, store data at random, search efficiency in the time of can causing reading is low excessively, therefore adopt the zone that to store data to carry out block division method among the present invention, the size of a piece is set, each storage saltus step is a unit with the piece that is provided with all, like this, the beginning flag sector will appear at the position of the integral multiple of piece; Correspondingly, during reading of data, just can search the beginning flag sector very soon.For example, the size that each piece is set is 100 sectors, and during the storage data, the position of beginning flag sector is just 1,2,3 ... Deng the integral multiple position of piece, promptly 100,200,300 ... integral multiple position Deng 100 sectors; Correspondingly, during reading of data, only need 1,2,3 ... just search for Deng the integral multiple position of piece and can find the beginning flag sector.
Fig. 1 is frequent memory area configuration synoptic diagram among the present invention, as shown in Figure 1, DBeginPos is the initial sector position of storage area, DEndPos is the end sector position of storage area, between the DBeginPos to DEndPos storage area (DSize), DSize is divided into n piece (Block), and n is a positive integer.According to the position of last stored data, DBeginPos skew JumpBlock carries out data storage relatively, and JumpBlock is m Block, and m is the positive integer from 0 to n.By continuous change JumpBlock, realize constantly changing the data storage location of disk.The reference position of first Block of current storage data is the beginning flag sector, and promptly the position of DBeginPos skew JumpBlock is the beginning flag sector relatively.NowPos is the current accessed position, and the size of storage data is DataSize.
In the present invention, the setting of the size of each piece is very important, and the quantitaes of piecemeal is divided into several writing alternately with a storage area.For example, be DSize if the branch block size is set, then each data storage location is the reference position of DSize, and promptly DBeginPos does not reach the purpose that changes data in magnetic disk storage reference position this moment at all; Be the size of each sector if the branch block size is set, then during reading of data,, can spend the plenty of time, cause reading efficiency to descend because search beginning flag sector need be searched for each sector.Usually, divide the size decision of block size, DSize can be divided into 20 to 200 pieces by the storage area of the frequent degree of storing data and setting, for example, DSize is 8000 sectors, and the size that each piece then is set is 80 sectors, and this DSize is divided into 100 pieces.
The mode of storage data comprises sequential storage and stores dual mode at random.Sequential storage is meant that the reference position of double storage data is continuous, and promptly last storage data are since m Block, and then current storage data are since m+1 Block.Storage is meant that the reference position of double storage data can skip k Block at random at random, promptly lastly stores data since m Block, and then current storage data are since m+k Block, and k is a random variation.
If in the position of DSize, store data continuously, then NowPos is exactly actual access location, but because the reference position of storage data can constantly change, the position of therefore each storage data is not always in the reference position of DSize, like this, in the time of can occurring data storage to the DEndPos of DSize, current data storage also finishes, and the DBeginPos that need jump to DSize this moment continues the storage data.
Fig. 2 is access process synoptic diagram among the present invention, as shown in Figure 2, NowPos is actual to be former current accessed position, be that data are carried out the continuous position NowPos in when storage, if NowPos has exceeded the DEndPos of DSize, be the DEndPos of NowPos more than or equal to DSize, then Shi Ji current accessed position should be the poor of NowPos and DSize, be about to the head that the current accessed position moves to DSize, the deviation post of the actual relative DBeginPos in current accessed position equals the deviation post of the relative DEndPos of NowPos.During the storage data, store after being equivalent to move to DBeginPos in the data that DEndPos stores later; Correspondingly, during reading of data, also do not finish current data and read, then be back to the DBeginPos place and continue reading of data if read to the DEndPos place.
Fig. 3 is memorying data flow journey figure among the present invention, as shown in Figure 3, with the sequential storage data instance, stores may further comprise the steps of data procedures:
Step 301: find the beginning flag sector by the search beginning flag, obtain the former JumpBlock of last stored data.If by last time reading of data obtained JumpBlock, then do not need to search for again beginning flag in the step 301.When storing data for the first time, can carry out data storage from the reference position of DSize, the DBeginPos that is about to DSize is as the beginning flag sector; Also can from DSize, choose a Block randomly arbitrarily and begin to carry out data storage, be about to choose first sector of Block as the beginning flag sector.
Step 302~step 303: after searching beginning flag, this beginning flag is removed, and on the basis of former JumpBlock, increased a Block, as current JumpBlock.
Step 304: whether judge current JumpBlock less than DEndPos, if, execution in step 306; Otherwise, execution in step 305.Step 304 is that the DEndPos whether the storage data reference position to relative DBeginPos skew JumpBlock has exceeded DSize judges.
Step 305: make that current JumpBlock is 0, if promptly relatively the position of DBeginPos skew JumpBlock exceeded the DEndPos of DSize, the reference position of then current storage data is the DBeginPos of DSize.
Step 306: carry out data storage.
Step 307: judge former NowPos whether less than DendPos and JumpBlock and, if, execution in step 308; Otherwise, execution in step 312.Step 307 is in the process that prevents this data storage, and the data of current storage cover the data stored, and what promptly this DataSize that stores can not be greater than Dsize and 1 is poor.
Step 308: whether judge former NowPos less than DEndPos, if, execution in step 310; Otherwise, execution in step 309.Whether step 308 is current stored data bit to be put judge above DEndPos.
Step 309: make that actual NowPos is the poor of former NowPos and Dsize.
Step 310: judge whether to finish this data storage, if, execution in step 311; Otherwise, return execution in step 306.
Step 311: first sector that is offset current JumpBlock position at relative DBeginPos writes beginning flag, this sector is the beginning flag sector, also store the size of sector identification string, storage data etc. in the beginning flag sector, finish this data storage.
Step 312: report an error to system.
Fig. 4 is reading of data flow process figure among the present invention, and as shown in Figure 4, the reading of data process may further comprise the steps:
Step 401~step 404: find the beginning flag sector by the search beginning flag, obtain the JumpBlock of last stored data; Read the data of storing in the beginning flag sector then, obtain the size of last stored data, begin reading of data from JumpBlock.Can search for the beginning flag sector in several ways, for example mode such as sequential search, binary search.
Step 405: whether judge former NowPos less than DEndPos, if, execution in step 407; Otherwise, execution in step 406.Step 405 is whether current reading of data position have been surpassed DEndPos judge.
Step 406: make that actual NowPos is the poor of former NowPos and Dsize.
Step 407: judge whether to finish this data read, if finish this data read; Otherwise, return execution in step 405.
Described above is the method that the reference position of reference position relative last time of the data storage of current data storage is offset, in the practical application, the end position of reference position relative last time of the data storage of current data storage is offset, after the search beginning flag finds the beginning flag sector, read the data length of storing in the beginning flag sector, search the end position of data storage last time then according to data length, the position of the end position place Block of above secondary data storage is as former JumpBlock, if be sequential storage, then on the basis of JumpBlock, increase a Block, if be storage at random, then on the basis of JumpBlock, increase k Block, k is a random number, carry out data storage then, follow-up data storage and data read process and above-mentioned data storage and data read process are basic identical, do not repeat them here.
For example an embedded Linux system adopts hard disk as storage medium, for realizing system's ease for use, needs design system to shut down at any time.For guaranteeing the reliability of system, promptly at any time system can not destroyed, whole linux system is started with read-only mode, but some need to preserve about the configurations of using, therefore store these data by the direct memory access hard disk sector and the mode of carrying out double copies.If directly hard disk sector is carried out data storage, then can cause being stored in the same area of hard disk at every turn, increase the probability that hard disc physical damages greatly, the storage means that just can adopt the present invention to propose this moment, hard disk is adopted balanced access mode, in certain storage space of hard disk, with the data storage that need store at every turn in different reference positions, thereby effectively prolong serviceable life of disk.
In a word, the above is preferred embodiment of the present invention only, is not to be used to limit protection scope of the present invention.

Claims (15)

1, a kind of disk storage method is characterized in that the method includes the steps of:
A, storage area is divided into more than one;
B, the former relatively data storage location of current data storage reference position are offset one or more as current deviation post;
C, begin to carry out data storage with described current deviation post.
2, method according to claim 1 is characterized in that, described step B further may further comprise the steps:
B11, search are used for the beginning flag sector of identification data storage reference position, with the position of the relative storage area initial sector skew in beginning flag sector as former deviation post;
B12, current data storage reference position are offset one or more again on described former deviation post basis.
3, method according to claim 2 is characterized in that, further comprises before the described step B12: the beginning flag of storing in the deletion beginning flag sector.
4, method according to claim 2 is characterized in that, if carry out data storage in the sequential storage mode, then current data storage reference position is offset a piece again on former deviation post basis.
5, method according to claim 2 is characterized in that, if carry out data storage with storage mode at random, then current data storage reference position is offset k piece again on former deviation post basis, and k is the positive integer at random that system generates at random.
6, method according to claim 1 is characterized in that, described step B further comprises:
B21, search are used for the beginning flag sector of identification data storage reference position, find the piece at data storage end position place according to the data length of storing in the initial sector, with the position of the relative storage area initial sector skew of this piece as current deviation post.
7, method according to claim 6 is characterized in that, further comprises after the described step B21: the beginning flag of storing in the deletion beginning flag sector.
According to claim 2 or 6 described methods, it is characterized in that 8, when carrying out data storage for the first time, described beginning flag sector is positioned at the initial sector of storage area.
According to claim 2 or 6 described methods, it is characterized in that 9, when carrying out data storage for the first time, described beginning flag sector is arranged in first sector of the 1st piece of storage area, 1 is the positive integer at random that system generates at random.
10, method according to claim 1 is characterized in that, further comprises before the described step C: judge whether current deviation post has surpassed the end sector position of storage area, if make that current deviation post is zero, then execution in step C; Otherwise, direct execution in step C.
11, method according to claim 1 is characterized in that, described step C further may further comprise the steps:
C1, storage be during data, judge the current data memory location whether exceeded storage area finish sector position and current deviation post with, if, report an error to system, end current data Stored Procedure, otherwise, execution in step C2;
C2, judge whether the current data memory location has exceeded storage area and finished sector position, if the actual current data memory location of order is the poor of current data memory location and storage area, execution in step C3 then, otherwise, direct execution in step C3;
C3, judge whether to finish current data storage, if, beginning flag is stored in first sector of first piece after the deviation post, finish the current data Stored Procedure, otherwise, execution in step C1 returned.
12, according to claim 2 or 6 described methods, it is characterized in that, further comprise after the described step C:
D, read the data of storage.
13, method according to claim 12 is characterized in that, described step D further may further comprise the steps:
D1, search are used for the beginning flag sector of identification data storage reference position, read beginning flag and the current data length that reads stored in the beginning flag sector;
D2, when reading the data of storage, judge that current data reads the position and whether exceeded storage area and finish sector position, if, it is that current data reads the poor of position and storage area that the actual current data of order reads the position, execution in step D3 then, otherwise, direct execution in step D3;
D3, judge whether to finish current data and read, if, finish current data and read flow process, otherwise, execution in step D1 returned.
According to claim 2,6 or 13 described methods, it is characterized in that 14, described beginning flag sector storage is useful on the sector identification string of sign beginning flag and the length of current storage data.
15, method according to claim 1 is characterized in that, described steps A comprises: storage area is divided into 20 to 200 pieces.
CNB031567932A 2003-09-12 2003-09-12 A disk storage method Expired - Fee Related CN1331147C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB031567932A CN1331147C (en) 2003-09-12 2003-09-12 A disk storage method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB031567932A CN1331147C (en) 2003-09-12 2003-09-12 A disk storage method

Publications (2)

Publication Number Publication Date
CN1595523A true CN1595523A (en) 2005-03-16
CN1331147C CN1331147C (en) 2007-08-08

Family

ID=34660083

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB031567932A Expired - Fee Related CN1331147C (en) 2003-09-12 2003-09-12 A disk storage method

Country Status (1)

Country Link
CN (1) CN1331147C (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102651674A (en) * 2012-03-30 2012-08-29 北京经纬恒润科技有限公司 Data transmission method of reflective memory network
CN105068917A (en) * 2015-08-11 2015-11-18 浪潮(北京)电子信息产业有限公司 Input/output I/O characteristic analysis method and system
CN111158606A (en) * 2019-12-31 2020-05-15 广州鼎甲计算机科技有限公司 Storage method, storage device, computer equipment and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100544175B1 (en) * 1999-05-08 2006-01-23 삼성전자주식회사 Recording medium storing linking type information and method for processing defective area
KR100896145B1 (en) * 2001-08-02 2009-05-12 파나소닉 주식회사 Information recording medium, information recording method, information recording apparatus, information reproduction method, and information reproduction apparatus

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102651674A (en) * 2012-03-30 2012-08-29 北京经纬恒润科技有限公司 Data transmission method of reflective memory network
CN102651674B (en) * 2012-03-30 2015-06-24 北京经纬恒润科技有限公司 Data transmission method of reflective memory network
CN105068917A (en) * 2015-08-11 2015-11-18 浪潮(北京)电子信息产业有限公司 Input/output I/O characteristic analysis method and system
CN105068917B (en) * 2015-08-11 2018-02-02 浪潮(北京)电子信息产业有限公司 A kind of input and output IO characteristic analysis methods and system
CN111158606A (en) * 2019-12-31 2020-05-15 广州鼎甲计算机科技有限公司 Storage method, storage device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN1331147C (en) 2007-08-08

Similar Documents

Publication Publication Date Title
CN1110050C (en) CD-ROM recording
JP5184462B2 (en) Method of storing data in flash memory in a manner independent of DBMS using page-differential
US8572312B2 (en) Data de-duplication and solid state memory device
CN1818886A (en) Detection and recovery of dropped writes in storage devices
CN112395212B (en) Method and system for reducing garbage recovery and write amplification of key value separation storage system
KR20070003577A (en) File system having inverted hierarchical structure
CN1198226A (en) Memory system
CN106201774B (en) NAND FLASH storage chip data storage structure analysis method
CN1815629A (en) Dirty block recovery method for flash memory device
CN1281562A (en) Improved flash file system
CN102024034A (en) Fragment processing method for high-definition media-oriented embedded file system
WO2006027771A2 (en) Measuring fragmentation on direct access storage devices and defragmentation thereof
CN104049908A (en) Dynamic granule-based intermediate storage
CN107221351B (en) Optimization processing method of error correcting code in solid-state disk system and application thereof
US6772305B2 (en) Data reading and protection
JP2017084338A (en) Methods and systems for improving flash memory flushing
CN1518000A (en) Method for managing data in flash storage medium
US10776265B2 (en) Data storage devices and data processing methods
KR20140069659A (en) File System For Flash Memory
CN111274212A (en) Cold and hot index identification and classification management method in data deduplication system
CN1595523A (en) A disk storage method
CN101034416A (en) Method for file seek track using file allocation table and system frame thereof
CN111610936B (en) Object storage platform, object aggregation method and device and server
CN113253932A (en) Read-write control method and system for distributed storage system
CN1472742A (en) Method for recording data on compact disc by good recording blocks to replace defected blocks

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20070808

Termination date: 20200912