CN1719419A - Renewing method of document data - Google Patents
Renewing method of document data Download PDFInfo
- Publication number
- CN1719419A CN1719419A CN 200410063739 CN200410063739A CN1719419A CN 1719419 A CN1719419 A CN 1719419A CN 200410063739 CN200410063739 CN 200410063739 CN 200410063739 A CN200410063739 A CN 200410063739A CN 1719419 A CN1719419 A CN 1719419A
- Authority
- CN
- China
- Prior art keywords
- blocks
- logical blocks
- physical blocks
- mapping
- data
- 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.)
- Pending
Links
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The present invention relates to a file data updating method and its electronic system for updating data of a file. The file is existed in said electronic system, including at least a file logical block, every file logical block is correspondent to first entity block, and used for storing file logical block data. The file contains the data region to be updated, said data region is formed from at least an update logical block, the said update logical block can be correspondent to first entity block. Said invention also provides the concrete steps of said file data updating method.
Description
Technical field
The present invention relates to a kind of renewing method of document data, and be particularly related to a kind of in order to the renewing method of document data of file hierarchy power-off protection to be provided.
Background technology
Please refer to Figure 1A, it shows traditional is the configuration diagram of the electronic system of base (sector-based) with the block.In Figure 1A, electronic system 10 comprises an application program 11, a file configuration table (file allocation table, FAT) subsystem 12, a disk driver 13 and a disc storage device 14.When electronic system 10 belonged to the system of mobile phone, disc storage device 14 was generally flash memory.The characteristic of flash memory is, must do the action of wiping (erase) earlier when wanting electronic system 10 that data are write flash memory, and the size of the erase unit of once wiping (erase unit) for example is 8Kbytes or 64Kbytes.File configuration table subsystem 12 can be divided into several logical blocks (logic sector) with the storage area, with the minimum storage unit as data storing.The size of each logical blocks for example is 512byte.If the data that electronic system 10 desires store are less than a logical blocks, these data promptly are assigned to the storage area of a logical blocks.
In addition, application program 11 is that the application programming interfaces that utilize file configuration table subsystem 12 to be provided come the data in the accessing disk storage device 14, to carry out file processing.For example, electronic system 10 can be set up, revise, reads and close file via application program 11.
Generally speaking, file configuration table subsystem 12 can define several logical blocks, and disk driver 13 can be written into the pairing data of these a little logical blocks in several physical blocks of disc storage device 14.Wherein, each logical blocks is physical blocks of mapping, and electronic system 10 comprises a mapping table (not shown) in addition, with the enantiomorphic relationship between record logical blocks and the physical blocks.When traditional application program 11 change files, it can write direct the more new data in the file in the physical blocks that originally has legacy data, perhaps writes blank physical blocks earlier.The former is called direct mapping (directmapping) file update mode, and the latter is called indirect mapping (indirect mapping) file update mode.
In direct mapping (direct mapping) file update mode, shown in Figure 1B, the data of supposing a file are corresponding to logical blocks 12 (1)~12 (N), and disk driver 13 is with the pairing data of logical blocks 12 (1)~12 (N), be stored in the physical blocks 14 (1)~14 (N), shown in the solid arrow of Figure 1B in man-to-man mode.At this moment, logical blocks 12 (1)~12 (N) be mapping in physical blocks 14 (1)~14 (N), the block information of each physical blocks all can write down the logical blocks number of its institute's mapping in file configuration table subsystem 12 and the block state of physical blocks (sector status).The logical blocks number of physical blocks 14 (1)~14 (N) writes down the number of the logical blocks 12 (1)~12 (N) of its mapping respectively, because physical blocks 14 (1)~14 (N) all has data, the state of historical facts or anecdotes tagma piece 14 (1)~14 (N) is all block effective status (VALID).
When the data of user's updating file, if more new data (being new data) is corresponding to logical blocks 12 (1)~12 (3), disk driver 13 can be deleted physical blocks 14 (1) stored legacy datas earlier, write logical blocks 12 (1) pairing new datas again in physical blocks 14 (1), shown in the dotted arrow of Figure 1B.Then, disk driver 13 can be deleted physical blocks 14 (2) stored legacy datas earlier, writes logical blocks 12 (2) pairing new datas again in physical blocks 14 (2), shown in the dotted arrow of Figure 1B.Then, disk driver 13 can be deleted physical blocks 14 (3) stored legacy datas earlier, writes logical blocks 12 (3) pairing new datas again in physical blocks 14 (3), shown in the dotted arrow of Figure 1B.That is to say, disk driver 13 can be directly to deleting legacy data in regular turn corresponding to the physical blocks of the logical blocks institute mapping of new data and writing the action of new data.
Because disk driver 13 must be deleted the legacy data in the physical blocks earlier, again new data is write, therefore, if when disk driver 13 sudden power during the legacy data in delete entity block 14 (2) just, will cause and have only the data of physical blocks 14 (1) to finish renewal, and the data in the physical blocks 14 (3) remain old, in addition, legacy data in the physical blocks 14 (2) is no longer complete because of deletion, and because logical blocks 12 (2) pairing new datas are to be temporary in the memory buffer (not shown), so the outage of system can cause the new data of logical blocks 12 (2) to lose.In brief, if utilizing direct mapping (direct mapping) file update mode to carry out in the process of Data Update, system's sudden power not only can cause new legacy data to mix, and the loss of data also may take place and no longer complete.
In indirect mapping (indirect mapping) file update mode, shown in Fig. 1 C, the data of supposing a file are corresponding to logical blocks 12 (1)~12 (N), and disk driver 13 is with the pairing data of logical blocks 12 (1)~12 (N), be stored in the physical blocks 14 (1)~14 (N), shown in the solid arrow of Fig. 1 C in man-to-man mode.At this moment, which physical blocks which logical blocks mapping mapping table 15 can write down to, and for example mapping table 15 record logical blocks 12 (1)~12 (N) is that mapping is in physical blocks 14 (1)~14 (N).In addition, the state of physical blocks 14 (1)~14 (N) is all the block effective status.
As user during by the data of application program 11 updating files, if more new data (being new data) is corresponding to logical blocks 12 (1)~12 (3), at first, the physical blocks that disk driver 13 can be obtained a block state earlier in disc storage device 14 be space state (AVAIABLE), for example, physical blocks 14 (N+1).Then, disk driver 13 can be written into logical blocks 12 (1) pairing new datas in the physical blocks 14 (N+1), and mapping table 15 will write down the enantiomorphic relationship of logical blocks 12 (1) and physical blocks 14 (N+1).But physical blocks 14 (1) or mapping are in logical blocks 12 (1) and have legacy data, and be not deleted.In other words, the physical blocks 14 (1) that has legacy data this moment is that mapping simultaneously is in logical blocks 12 (1) with the physical blocks 14 (N+1) that has new data.
Then, disk driver 13 can be deleted the script mapping in physical blocks 14 (1) the stored legacy datas of logical blocks 12 (1), mapping table 15 will be deleted the enantiomorphic relationship of logical blocks 12 (1) and physical blocks 14 (1), presentation-entity block 14 (1) becomes blank physical blocks, and its block state is changed to space state.At this moment, logical blocks 12 (1) only mapping in the physical blocks 14 (N+1) that has new data.
Then, the physical blocks that disk driver 13 can be obtained a block state in disc storage device 14 be space state (AVAIABLE), for example, physical blocks 14 (N+2).Disk driver 13 is written in logical blocks 12 (2) stored new datas in the physical blocks 14 (N+2), and mapping table 15 will write down the enantiomorphic relationship of logical blocks 12 (2) and physical blocks 14 (N+2).But physical blocks 14 (2) still has mapping in logical blocks 12 (2) and there is legacy data, and is not deleted.In other words, the physical blocks 14 (2) that has legacy data this moment is that mapping simultaneously is in logical blocks 12 (2) with the physical blocks 14 (N+2) that has new data.
Then, disk driver 13 can be deleted the script mapping in physical blocks 14 (2) the stored legacy datas of logical blocks 12 (2), mapping table 15 will be deleted the enantiomorphic relationship of logical blocks 12 (2) and physical blocks 14 (2), presentation-entity block 14 (2) becomes blank physical blocks, and its block state is changed to space state.At this moment, logical blocks 12 (2) only mapping in the physical blocks 14 (N+2) that has new data.
Then, the physical blocks that disk driver 13 can be obtained a block state in disc storage device 14 be space state (AVAIABLE), for example, physical blocks 14 (N+3).Disk driver 13 is written in logical blocks 12 (3) stored new datas in the physical blocks 14 (N+3), and mapping table 15 will write down the enantiomorphic relationship of logical blocks 12 (3) and physical blocks 14 (N+3).But physical blocks 14 (3) still has mapping in logical blocks 12 (3) and there is legacy data, and is not deleted.In other words, the physical blocks 14 (3) that has legacy data this moment is that mapping simultaneously is in logical blocks 12 (3) with the physical blocks 14 (N+3) that has new data.
Then, disk driver 13 can be deleted the script mapping in physical blocks 14 (3) the stored legacy datas of logical blocks 12 (3), mapping table 15 will be deleted the enantiomorphic relationship of logical blocks 12 (3) and physical blocks 14 (3), presentation-entity block 14 (3) becomes blank physical blocks, and its block state is changed to space state.At this moment, logical blocks 12 (3) only mapping in the physical blocks 14 (N+3) that has new data.
That is to say, disk driver 13 meeting elder generations more new data write in the blank physical blocks, therefore delete legacy data again, cut off the power supply suddenly, so still possess complete legacy data in physical blocks 14 (3) if write in the process of physical blocks 14 (N+3) at new data more.But the problem that new legacy data mixes still can take place in this moment, and promptly logical blocks 12 (1) has had new data with the physical blocks of 12 (2) institutes mapping, and the physical blocks of logical blocks 12 (3) institutes mapping then remains deposits legacy data.
In the mode that first kind of file shown in Figure 1B upgrades, be subject to the characteristic of flash memory, the data of each physical blocks just can be written into after need being wiped free of earlier once more.That is to say that data updated can't directly be written in the physical blocks of logical blocks institute mapping.If when in new data is write the process of disc storage device 14 by disk driver 13, running into outage, because the update mode of taking each physical blocks to wipe earlier to write again traditionally one by one, cause having only the data updated of part to be written in the disc storage device 14, cause the legacy data of file to lose and the incomplete phenomenon of new data.In the mode that second kind of file shown in Fig. 1 C upgrades, if when in new data is write the process of disc storage device 14 by disk driver 13, running into outage, owing to take to write earlier the update mode of new data traditionally in the legacy data of blank physical blocks and back deletion original entity block, might cause only finishing partial data and upgrade, and the phenomenon that new legacy data mixes takes place.
Summary of the invention
In view of this, purpose of the present invention is providing a kind of renewing method of document data exactly.Its according to physical blocks just whether in the existence of the state of validation (BEINGVALIDATED); decide the action of the recovery file data after the outage; really avoid the data of file to produce new and old problem of mixing, and reach the purpose of file hierarchy power-off protection.
According to purpose of the present invention, a kind of renewing method of document data is proposed, be applied to be used for upgrading the data of a file in the electronic system.Electronic system comprises at least one logical blocks and at least one physical blocks, each logical blocks be mapping in a physical blocks, the physical blocks of its mapping is the data that are used for depositing logical blocks.File is to leave in the electronic system, and comprises at least one file logical blocks, and each file logical blocks be mapping in one first physical blocks, be used for depositing the data of file logical blocks.File comprises a data area that is about to be updated, and the data area is to upgrade logical blocks by at least one to be constituted, but and the renewal logical blocks is that mapping is in one first physical blocks.In the method, at first, in step a, obtain second physical blocks of a blank, and with the renewal logical blocks of its mapping in the data area.Then, enter among the step b, the more new data that upgrades logical blocks is write second physical blocks.Then, enter among the step c, repeat above-mentioned step a and b, the more new data that upgrades logical blocks up to all of data area is second physical blocks that writes its mapping.Then, enter in the steps d, all second physical blocks of upgrading the mappings of logical blocks institute just are set at state at validation.
According to a further object of the present invention, a kind of renewing method of document data is proposed, be applied in the electronic system, be used for upgrading the data of a file.Electronic system comprises at least one logical blocks and at least one physical blocks, each logical blocks be mapping in a physical blocks, the physical blocks of its mapping is the data that are used for depositing logical blocks.File is to leave in the electronic system, and comprises at least one file logical blocks, and each file logical blocks be mapping in one first physical blocks, be used for depositing the data of file logical blocks.File comprises a data area that is about to be updated, and the data area is to upgrade logical blocks by at least one to be constituted, but and the renewal logical blocks is that mapping is in one first physical blocks.In the method, at first, in step a, obtain second physical blocks of a blank, and with the renewal logical blocks of its mapping in the data area.Then, enter among the step b, the more new data that upgrades logical blocks is write second physical blocks.Then, enter among the step c, repeat above-mentioned step a and b, the more new data that upgrades logical blocks up to all of data area is second physical blocks that writes its mapping.Then, enter in the steps d, at least one second physical blocks of upgrading second physical blocks of logical blocks institute mapping just is set at state at validation.
According to another object of the present invention, propose a kind of electronic system, comprise at least one logical blocks, at least one physical blocks, at least one file, a blank physical blocks and obtain module, a writing module, one first judge module and one first setting state module.Each logical blocks be mapping in a physical blocks, the physical blocks of its mapping is the data that are used for depositing logical blocks.Each file comprises at least one file logical blocks, and each file logical blocks be mapping in one first physical blocks, be used for depositing the data of file logical blocks.File comprises a data area that is about to be updated, and the data area is to upgrade logical blocks by at least one to be constituted, but and the renewal logical blocks is that mapping is in one first physical blocks.Blank physical blocks obtains second physical blocks that module is used for obtaining a blank, and with the renewal logical blocks of its mapping in the data area.The more new data that writing module is used for upgrading logical blocks writes second physical blocks.First judge module is used for more new data that all of judgment data zone upgrade logical blocks and whether all writes second physical blocks of its mapping, and the first setting state module is used for all second physical blocks of upgrading the mappings of logical blocks institute just are set at state at validation.
According to another purpose of the present invention, propose a kind of electronic system, comprise at least one logical blocks, at least one physical blocks, at least one file, a blank physical blocks and obtain module, a writing module, one first judge module and one first setting state module.Each logical blocks be mapping in a physical blocks, the physical blocks of its mapping is the data that are used for depositing logical blocks.Each file comprises at least one file logical blocks, and each file logical blocks be mapping in one first physical blocks, be used for depositing the data of file logical blocks.File comprises a data area that is about to be updated, and the data area is to upgrade logical blocks by at least one to be constituted, but and the renewal logical blocks is that mapping is in one first physical blocks.Blank physical blocks obtains second physical blocks that module is used for obtaining a blank, and with the renewal logical blocks of its mapping in the data area.The more new data that writing module is used for upgrading logical blocks writes second physical blocks.First judge module is used for more new data that all of judgment data zone upgrade logical blocks and whether all writes second physical blocks of its mapping, and at least one second physical blocks that the first setting state module is used for upgrading second physical blocks of logical blocks institute mapping just is set at the state at validation.
According to a more purpose of the present invention, a kind of restore data method for updating is proposed, be applied to an electronic system, electronic system comprises at least one logical blocks, at least one physical blocks and at least one second physical blocks, each logical blocks be mapping in a physical blocks, the physical blocks of its mapping is the data that are used for depositing logical blocks.File system is left in the electronic system, and comprises at least one file logical blocks, and each file logical blocks be mapping in one first physical blocks, be used for depositing the data of file logical blocks.File comprises a data area that is about to be updated, and the data area is to upgrade logical blocks by at least one to be constituted.But upgrade logical blocks and be mapping in one first physical blocks, the second physical blocks mapping one is upgraded logical blocks in the data area.In the method, at first, judge to upgrade whether any one second physical blocks is arranged in second physical blocks of logical blocks institute mapping is for just at the state of validation.Wherein, when judged result for certainly the time, carry out one and finish more new technological process.When judged result when negating, carry out one and upgrade the data deletion flow process.
For above-mentioned purpose of the present invention, feature and advantage can be become apparent, a preferred embodiment cited below particularly, and conjunction with figs. are described in detail below:
Description of drawings
It is the configuration diagram of the electronic system of base with the block that Figure 1A shows traditional.
The synoptic diagram of the state when Figure 1B shows the file update mode of carrying out direct mapping between the file configuration table subsystem of Figure 1A and the disk driver.
The synoptic diagram of the state when Fig. 1 C shows the file update mode of carrying out indirect mapping between the file configuration table subsystem of Figure 1A and the disk driver.
Fig. 2 shows the calcspar according to the electronic system of preferred embodiment of the present invention.
Fig. 3 shows the process flow diagram according to the renewing method of document data of preferred embodiment of the present invention.
Fig. 4 shows the process flow diagram according to the restore data update method of preferred embodiment one of the present invention.
Fig. 5 shows the more synoptic diagram of new technological process of finishing of Fig. 4.
Fig. 6 shows the synoptic diagram of the renewal data deletion flow process of Fig. 4.
Accompanying drawing formula label declaration
10,20: electronic system
11: application program
12: the file configuration table subsystem
12 (1)~12 (N), 25 (1)~25 (N): logical blocks
14 (1)~14 (N+3), 26 (1)~26 (N+3): physical blocks
13: disk driver
14: the disc storage device
15: the mapping table
21: blank physical blocks obtains module 21
22: writing module
23: the first judge modules
24: the first setting state modules
27: removing module
28: the second setting state modules
29: the second judge modules
Embodiment
Please be simultaneously with reference to the 2nd~3 figure, Fig. 2 shows the calcspar according to the electronic system of preferred embodiment of the present invention, and Fig. 3 shows the process flow diagram according to the renewing method of document data in the electronic system that is applied to Fig. 2 of preferred embodiment of the present invention.As shown in Figure 2, electronic system 20 comprises a blank physical blocks and obtains module 21, a writing module 22, one first judge module 23, one first setting state module 24, a removing module 27, the second setting state module 28 and second judge module 29, at least one file, at least one logical blocks, at least one physical blocks.In electronic system 20, each logical blocks be mapping in a physical blocks, the physical blocks of its mapping is the data that are used for depositing logical blocks.Each file comprises at least one file logical blocks, and each file logical blocks be mapping in one first physical blocks, first physical blocks of All Files logical blocks institute mapping is used for depositing the data of these a little file logical blocks.
As shown in Figure 2, the data of supposing a file are corresponding to logical blocks 25 (1)~25 (N), and logical blocks 25 (1)~25 (N) is that mapping is in physical blocks 26 (1)~26 (N).Before the data of file were updated, logical blocks 25 (1)~25 (N) was above-mentioned defined file logical blocks, and physical blocks 26 (1)~26 (N) is for there being first physical blocks of data.When the data of this file were desired to be updated, this file comprised a data area that is about to be updated, and the data area is to upgrade logical blocks by at least one to be constituted, but and the renewal logical blocks is that mapping is in one first physical blocks.Suppose that the data area that is about to be updated is made of logical blocks 25 (1)~25 (3), then logical blocks 25 (1)~25 (3) is above-mentioned defined renewal logical blocks, and logical blocks 25 (1)~25 (3) mappings are in physical blocks 26 (1)~26 (3).
In Fig. 3, at first, in step 31, when the data of file will be updated, blank physical blocks obtains second physical blocks that module 21 is used for obtaining a blank, and with the renewal logical blocks of the second physical blocks mapping in the data area of being got.Because the block state of the second blank physical blocks is the state of blank (AVAIABLE) or the state of having deleted (DELETED), blank physical blocks obtains module 21 in order to be the second blank physical blocks according to the physical blocks that is in blank state or deleted state in the physical blocks.Then, enter in the step 32, the more new data that writing module 22 is used for upgrading logical blocks writes in second physical blocks that is removed.Then, enter in the step 33, repeat above-mentioned step 31 and 32, the more new data that upgrades logical blocks up to all of first judge module, 23 judgment data zones all has been written in second physical blocks of its mapping.
To be that logical blocks 25 (1)~25 (3) is an example below, further specify step 31~33 to upgrade logical blocks.At first, blank physical blocks obtains module 21 and obtains blank physical blocks 26 (N+1) earlier, and in having the more logical blocks 25 (1) (step 31) of new data, writing module 22 writes blank physical blocks 26 (N+1) (step 32) with the more new data of logical blocks 25 (1) with physical blocks 26 (N+1) mapping of blank.Then, blank physical blocks obtains module 21 and obtains blank physical blocks 26 (N+2), and in having the more logical blocks 25 (2) (step 31) of new data, writing module 22 is used for the more new data of logical blocks 25 (2) is write blank physical blocks 26 (N+2) (step 32) with physical blocks 26 (N+2) mapping of blank.Then, blank physical blocks obtains module 21 and obtains blank physical blocks 26 (N+3), and in having the more logical blocks 25 (3) (step 31) of new data, writing module 22 is used for the more new data of logical blocks 25 (3) is write blank physical blocks 26 (N+3) (step 32) with physical blocks 26 (N+3) mapping of blank.
In order to determine that all more new datas that upgrade logical blocks all are written in second physical blocks of its mapping, electronic system 20 is second physical blocks (step 33) that whether all write its mapping with the more new data of all renewal logical blocks in first judge module, 23 judgment data zones.After the data of one second physical blocks were updated, the block state of the block information of this second physical blocks will be for writing the state of (WRITTEN), and have the number of the renewal logical blocks of institute's mapping in the block information of this second physical blocks.So first judge module 23 will make a decision according to the block information of second physical blocks.When 23 judgements of first judge module have the state of several second physical blocks is the state that writes, and these second physical blocks mappings represent that to the number of all renewal logical blocks the more new data of file has been written in these second physical blocks.
After the more new data that all that treat first judge module, 23 judgment data zones are upgraded logical blocks all has been written in second physical blocks of its mapping, enter in the step 34, the first setting state module 24 is used for all second physical blocks of upgrading the mappings of logical blocks institute just are set at the state of validation (BEINGVALIDATED), and the data of expression file have been updated in physical blocks and have finished.In other embodiments, the first setting state module 24 is used for that all are upgraded at least one second physical blocks in second physical blocks of logical blocks institute mappings and just is set at state at validation.
Because the data area only comprises logical blocks 25 (1)~25 (3), so whether first judge module 23 all writes the more new data of the logical blocks 25 (1)~25 (3) in judgment data zone the physical blocks 26 (N+1)~26 (N+3) of its mapping.When the more new data of the logical blocks 25 (1)~25 (3) in first judge module, 23 judgment data zones has all write in the physical blocks 26 (N+1)~26 (N+3) of its mapping, promptly first judge module 23 judges that the state of physical blocks 26 (N+1)~26 (N+3) is the state that writes, and when the block information of physical blocks 26 (N+1)~26 (N+3) had the number of logical blocks 25 (1)~25 (3) of mapping, the first setting state module 24 just all was set at state at validation with the physical blocks 26 (N+1)~26 (N+3) of all logical blocks 25 (1)~25 (3) institutes mappings.Or the first setting state module 24 just is set at state at validation with at least one physical blocks in the physical blocks 26 (N+1)~26 (N+3) of all logical blocks 25 (1)~25 (3) institutes mappings.On the contrary, when the more new data of the logical blocks 25 (1)~25 (3) in first judge module, 23 judgment data zones does not write in the physical blocks 26 (N+1)~26 (N+3) of its mapping fully, the data of expression file are not also upgraded fully, and then the first setting state module 24 will be not can just not be set at state at validation to any one physical blocks of the physical blocks 26 (N+1)~26 (N+3) of logical blocks 25 (1)~25 (3) institutes mapping.
Treat that all at least one second physical blocks of upgrading second physical blocks of logical blocks institute mapping are set to just behind validation, enter in the step 35, removing module 27 is used for deleting the data of mapping in first physical blocks of the renewal logical blocks of data area, and first physical blocks is set at deleted state or blank state.Because physical blocks 26 (1)~26 (3) mappings are to logical blocks 25 (1)~25 (3), so removing module 27 is deleted the data of mappings in the physical blocks 26 (1)~26 (3) of the logical blocks 25 (1)~25 (3) of data area, and physical blocks 26 (1)~26 (3) all is set at deleted state or blank state.After treating that data in the physical blocks 26 (1)~26 (3) are deleted, enter in the step 36, second physical blocks that the second setting state module 28 is used for all are upgraded the mappings of logical blocks institute is set at the effectively state of (VALID).Look like in other words, the second setting state module 28 is set at effective state with the physical blocks 26 (N+1)~26 (N+3) of logical blocks 25 (1)~25 (3) institutes mapping.
What need illustrate is, the obtained blank physical blocks of the step 31 of Fig. 3 can be any one blank physical blocks, and physical blocks 26 (N+1)-26 (N+3) only is the usefulness that illustrates as an example.
Please refer to Fig. 4, it shows the process flow diagram according to the restore data method for updating of preferred embodiment of the present invention.The restore data method for updating of present embodiment is applied on the electronic system 20 of Fig. 2, and electronic system more comprises one second judge module 29 and at least one second physical blocks, and each second physical blocks is the renewal logical blocks of mapping in the data area.
If carry out cutting off the power supply suddenly in the process of Data Update, when electronic system restores electricity, just can utilize this restore data update method to carry out the recovery of Data Update afterwards in electronic system.
As shown in Figure 4, at first, in step 41, when electronic system 20 is sent a telegram in reply after outage and recovered normal operation, second judge module 29 will judge that whether any one second physical blocks is arranged in second physical blocks of upgrading the mapping of logical blocks institute is for just at the state of validation.At this moment, second judge module 29 will check whether the block state of all physical blocks 26 (1)~26 (N+3) just has the state at validation.When at least one physical blocks is arranged in the physical blocks 26 (N+1)~26 (N+3) of second judge module, 29 decision logic blocks, 25 (1)~25 (3) institutes mapping is during for the state at validation just, enters in the step 42, carries out one and finishes more new technological process.When the block state of any physical blocks of the physical blocks 26 (N+1)~26 (N+3) of second judge module, 29 decision logic blocks, 25 (1)~25 (3) institutes mapping is not just during the state at validation, the data of expression file are not upgraded before outage and are finished, then enter in the step 43, carry out one and upgrade the data deletion flow process.
Please refer to Fig. 5, it shows the more synoptic diagram of new technological process of finishing of Fig. 4.At least one physical blocks is arranged in the physical blocks 26 (N+1)~26 (N+3) of logical blocks 25 (1)~25 (3) institutes mapping is for just at the state of validation because second judge module 29 is judged, be that the renewing method of document data of presentation graphs 3 has proceeded to step 34 and completing steps 34, so electronic system only need execution in step 35 and 36 just can finish the renewal of whole file data.
As shown in Figure 5, at first, in step 51, removing module 27 is used for deleting the data of mapping in first physical blocks of the renewal logical blocks of data area, and first physical blocks is set at deleted state or blank state.Because physical blocks 26 (1)~26 (3) mappings are to logical blocks 25 (1)~25 (3), so removing module 27 is deleted the data of mappings in the physical blocks 26 (1)~26 (3) of the logical blocks 25 (1)~25 (3) of data area, and physical blocks 26 (1)~26 (3) all is set at deleted state or blank state.After treating that data in the physical blocks 26 (1)~26 (3) are deleted, enter in the step 52, second physical blocks that the second setting state module 28 is used for all are upgraded the mappings of logical blocks institute is set at the effectively state of (VALID).Look like in other words, the second setting state module 28 is set at effective state with the physical blocks 26 (N+i)~26 (N+3) of logical blocks 25 (1)~25 (3) institutes mapping.
Please refer to Fig. 6, it shows the synoptic diagram of the renewal data deletion flow process of Fig. 4.Since second judge module 29 do not judge have in the physical blocks 26 (N+1)~26 (N+3) of logical blocks 25 (1)~25 (3) institutes mapping any one physical blocks be for just at the state of validation, promptly the renewing method of document data of the presentation graphs 3 more new data that all do not upgraded logical blocks as yet writes second physical blocks of its mapping.Because more new data is before writing to second physical blocks, be temporarily to leave in the memory buffer, the more new data that the sudden power of system can cause being temporarily stored in the memory buffer disappears, and electronic system is still possessed complete legacy data, therefore electronic system is after restoring electricity, can carry out one and upgrade the data deletion flow process, leave the more new data of mapping in second physical blocks of upgrading logical blocks in, promptly delete incomplete more new data with deletion.
As shown in Figure 6, upgrade the data deletion flow process and only have a step, in step 61, removing module 27 can be deleted the data of mapping in second physical blocks of upgrading logical blocks.Suppose to have only mapping that the more new data of logical blocks of depositing in 25 (1)~25 (2) is arranged in the physical blocks 26 (N+1)~26 (N+2) of logical blocks 25 (1)~25 (2), but mapping does not deposit the more new data of logical blocks 25 (3) in the physical blocks 26 (N+3) of logical blocks 25 (3), the then data of removing module 27 meeting delete entity blocks 26 (N+1)~26 (N+2), and the second setting state module, 28 meetings be deleted state or blank state with the block setting state of physical blocks 26 (N+1)~26 (N+2).
In sum, electronic system of the present invention is when recovery after power cut moves, only need to judge that whether arbitrary second physical blocks in second physical blocks of all renewal logical blocks institute mappings is just at the state of validation, if do not have, expression outage preceding document is not finished renewal as yet fully, and must be with the data deletion of all second physical blocks.If at least one second physical blocks in second physical blocks of all renewal logical blocks institute mappings is just when the state of validation, promptly application program has been finished the renewal of the data of file before the expression outage, thus electronic system 20 only must proceed outage according to the flow process of Fig. 5 before uncompleted action get final product.Therefore, the recovery of outage action can be guaranteed the correctness of the data of file, avoids the data of file to produce new and old problem of mixing.
Right be familiar with the technology that this skill person can also understand present embodiment and be not confined to this, for example, electronic system 20 can be personal digital assistant or mobile phone, logical blocks 25 (1)~25 (N) is to be divided out from the storage area by the file configuration table subsystem, and physical blocks 26 (1)~26 (N) is divided out in disc storage device (as flash memory) by disk driver.Present embodiment is that a newly-increased file upgrades the interface letter formula (WriteFileComplete) of finishing between file configuration table subsystem and disk driver, its role is to when the file configuration table subsystem utilize writing of disk driver finish interface letter formula (WriteSectors) finish one by one upgrade all and belong to a plurality of logical blocks of same file after, finished all logical blocks in order to the notice disk driver and upgraded.At this moment, the novel entities block of the logical blocks institute mapping that disk driver can be updated these is set at effective state, and with the data deletion of the old physical blocks of institute's mapping, finishes the renewal of the data of file.Run into when outage before if finish interface letter formula (WriteSectors) writing of file configuration table subsystem calls disk driver; all have upgraded or do not upgraded the data of all physical blocks finish all can be deleted; then the logical blocks of file still mapping to its complete old physical blocks; avoid the data of file to produce new and old problem of mixing, reach the purpose of file hierarchy power-off protection.
The disclosed renewing method of document data of the above embodiment of the present invention; its according to physical blocks just whether in the existence of the state of validation; decide the action of the recovery file data after the outage; really avoid the data of file to produce new and old problem of mixing, and reach the purpose of file hierarchy power-off protection.
In sum; though the present invention discloses as above with a preferred embodiment; right its is not in order to limit the present invention; anyly have the knack of this skill person; without departing from the spirit and scope of the present invention; when can being used for a variety of modifications and variations, so protection scope of the present invention is as the criterion when looking accompanying the claim person of defining.
Claims (18)
1. a renewing method of document data is applied to be used for upgrading the data of a file in the electronic system, and this electronic system comprises:
At least one logical blocks; And
At least one physical blocks, wherein, each this logical blocks be mapping in a physical blocks, the physical blocks of its mapping is the data that are used for depositing this logical blocks;
Wherein, this document is to leave in this electronic system, and comprise at least one file logical blocks, and each this document logical blocks is that mapping is in one first physical blocks, be used for depositing the data of this document logical blocks, this document comprises a data area that is about to be updated, and this data area is to upgrade logical blocks by at least one to be constituted, but and this renewal logical blocks is that mapping is in one first physical blocks;
This method comprises:
Step a: obtain second physical blocks of a blank, and with the renewal logical blocks of its mapping in this data area;
Step b: the more new data that will upgrade logical blocks writes this second physical blocks;
Step c: repeating step a and b, the more new data that upgrades logical blocks up to all of this data area is second physical blocks that writes its mapping; And
Steps d: second physical blocks of all these renewal logical blocks institute mappings just is set at state at validation.
2. the method for claim 1, after steps d, other comprises step: the data of deletion mapping in first physical blocks of the renewal logical blocks of this data area, and this first physical blocks is set at deleted state.
3. the method for claim 1, after steps d, other comprises step:
Second physical blocks of all these renewal logical blocks institute mappings is set at effective state.
4. a renewing method of document data is applied in the electronic system, is used for upgrading the data of a file, and this electronic system comprises:
At least one logical blocks; And
At least one physical blocks, wherein, each this logical blocks be mapping in a physical blocks, the physical blocks of its mapping is the data that are used for depositing this logical blocks;
Wherein, this document is to leave in this electronic system, and comprise at least one file logical blocks, and each this document logical blocks is that mapping is in one first physical blocks, be used for depositing the data of this document logical blocks, this document comprises a data area that is about to be updated, and this data area is to upgrade logical blocks by at least one to be constituted, but and this renewal logical blocks is that mapping is in one first physical blocks;
This method comprises:
Step a: obtain second physical blocks of a blank, and with the renewal logical blocks of its mapping in this data area;
Step b: the more new data that will upgrade logical blocks writes this second physical blocks;
Step c: repeating step a and b, the more new data that upgrades logical blocks up to all of this data area all writes second physical blocks of its mapping; And
Steps d: at least one second physical blocks that will upgrade second physical blocks of logical blocks institute mapping just is set at the state at validation.
5. method as claimed in claim 4, after steps d, other comprises step:
Delete the data of mapping in first physical blocks of the renewal logical blocks of this data area, and this first physical blocks is set at deleted state.
6. method as claimed in claim 4, after steps d, other comprises step:
Second physical blocks of all these renewal logical blocks institute mappings is set at effective state.
7. electronic system comprises:
At least one logical blocks; And
At least one physical blocks, wherein, each this logical blocks be mapping in a physical blocks, the physical blocks of its mapping is the data that are used for depositing this logical blocks;
At least one file, each this document comprises at least one file logical blocks, and each this document logical blocks is that mapping is in one first physical blocks, be used for depositing the data of this document logical blocks, this document comprises a data area that is about to be updated, this data area is to upgrade logical blocks by at least one to be constituted, but and this renewal logical blocks is that mapping is in one first physical blocks;
One blank physical blocks obtains module, is used for obtaining second physical blocks of a blank, and with the renewal logical blocks of its mapping in this data area;
One writing module is used for the more new data of this renewal logical blocks is write this second physical blocks;
Whether the more new data that one first judge module, all that are used for judging this data area upgrade logical blocks all writes second physical blocks of its mapping; And
One first setting state module is used for second physical blocks with all these renewal logical blocks institute mappings just to be set at state at validation.
8. system as claimed in claim 7, other comprises:
One removing module is used for deleting the data of mapping in first physical blocks of the renewal logical blocks of this data area, and this first physical blocks is set at deleted state.
9. system as claimed in claim 7, other comprises:
One second setting state module is used for second physical blocks of all these renewal logical blocks institute mappings is set at effective state.
10. system as claimed in claim 7, other comprises:
One second judge module is used for judging that whether any one second physical blocks is arranged in second physical blocks of this renewal logical blocks institute mapping is for just at the state of validation.
11. an electronic system comprises:
At least one logical blocks; And
At least one physical blocks, wherein each this logical blocks be mapping in a physical blocks, the physical blocks of its mapping is the data that are used for depositing this logical blocks;
At least one file, each this document comprises at least one file logical blocks, and each this document logical blocks is that mapping is in one first physical blocks, be used for depositing the data of this document logical blocks, this document comprises a data area that is about to be updated, this data area is to upgrade logical blocks by at least one to be constituted, but and this renewal logical blocks is that mapping is in one first physical blocks;
One blank physical blocks obtains module, is used for obtaining second physical blocks of a blank, and with the renewal logical blocks of its mapping in this data area;
One writing module is used for the more new data of this renewal logical blocks is write this second physical blocks; One
Whether the more new data that one judge module, all that are used for judging this data area upgrade logical blocks all writes second physical blocks of its mapping; And
One first setting state module is used at least one second physical blocks in second physical blocks of this renewal logical blocks institute mapping just is set at state at validation.
12. system as claimed in claim 11, other comprises:
One removing module is used for deleting the data of mapping in first physical blocks of the renewal logical blocks of this data area, and this first physical blocks is set at deleted state.
13. system as claimed in claim 11, other comprises:
One second setting state module is used for second physical blocks of all these renewal logical blocks institute mappings is set at effective state.
14. system as claimed in claim 11, other comprises:
Second judge module is used for judging that whether any one second physical blocks is arranged in second physical blocks of this renewal logical blocks institute mapping is for just at the state of validation.
15. a restore data method for updating is applied to an electronic system, this electronic system comprises:
At least one logical blocks; And
At least one physical blocks, wherein, this logical blocks be mapping in a physical blocks, the physical blocks of its mapping is the data that are used for depositing this logical blocks;
At least one file, each this document comprises at least one file logical blocks, and each this document logical blocks is that mapping is in one first physical blocks, be used for depositing the data of this document logical blocks, this document comprises a data area that is about to be updated, this data area is to upgrade logical blocks by at least one to be constituted, but and this renewal logical blocks is that mapping is in one first physical blocks;
At least one second physical blocks, mapping renewal logical blocks in this data area;
This method comprises:
Judge that whether any one second physical blocks is arranged in second physical blocks of this renewal logical blocks institute mapping is for just at the state of validation;
Wherein, when judged result for certainly the time, carry out one and finish more new technological process, and when judged result when negating, carry out a renewal data deletion flow process.
16. method as claimed in claim 15, wherein, this finishes more that new technological process comprises:
Delete the data of mapping in first physical blocks of the renewal logical blocks of this data area, and this first physical blocks is set at deleted state.
17. method as claimed in claim 16, wherein, this finishes more that new technological process comprises in addition:
Second physical blocks of all these renewal logical blocks institute mappings is set at effective state.
18. method as claimed in claim 15 wherein, is upgraded the data deletion flow process and is comprised:
The deletion mapping is upgraded the data of second physical blocks of logical blocks in this.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN 200410063739 CN1719419A (en) | 2004-07-07 | 2004-07-07 | Renewing method of document data |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN 200410063739 CN1719419A (en) | 2004-07-07 | 2004-07-07 | Renewing method of document data |
Publications (1)
Publication Number | Publication Date |
---|---|
CN1719419A true CN1719419A (en) | 2006-01-11 |
Family
ID=35931259
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN 200410063739 Pending CN1719419A (en) | 2004-07-07 | 2004-07-07 | Renewing method of document data |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN1719419A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101281492B (en) * | 2007-04-04 | 2011-02-02 | 扬智科技股份有限公司 | Method for recovering comparison table of flash memory |
CN102063381B (en) * | 2009-11-13 | 2013-01-02 | 群联电子股份有限公司 | Data writing method for flash memory, and controller and storage system thereof |
CN107025291A (en) * | 2017-04-14 | 2017-08-08 | 新华三技术有限公司 | The Improvement and device of data |
-
2004
- 2004-07-07 CN CN 200410063739 patent/CN1719419A/en active Pending
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101281492B (en) * | 2007-04-04 | 2011-02-02 | 扬智科技股份有限公司 | Method for recovering comparison table of flash memory |
CN102063381B (en) * | 2009-11-13 | 2013-01-02 | 群联电子股份有限公司 | Data writing method for flash memory, and controller and storage system thereof |
CN107025291A (en) * | 2017-04-14 | 2017-08-08 | 新华三技术有限公司 | The Improvement and device of data |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN1540672A (en) | Power management block for use in non-volatile memory system | |
CN1499530A (en) | Method and device for effectively allowing failure sequency writing processing in ono-volatile memory system | |
US8402202B2 (en) | Input/output control method and apparatus optimized for flash memory | |
CN1632765A (en) | A flash memory file system management method | |
CN1722109A (en) | The storage system of increment merging method and this method of use | |
CN1389790A (en) | Flash storage management method | |
CN1902599A (en) | Management of non-volatile memory systems having large erase blocks | |
EP1576478A2 (en) | Method and apparatus for grouping pages within a block | |
CN1701390A (en) | Tracking the most frequently erased blocks in non-volatile memory systems | |
CN1705936A (en) | Method and apparatus for splitting a logical block | |
CN1222951C (en) | Real-time processing method for flash storage | |
CN1719422A (en) | Virtual access method of storage document data | |
CN1822230A (en) | Method for realizing memory file system based on NAND Flash | |
KR100746198B1 (en) | Apparatus and method for storing data, and readable recording medium thereof | |
CN1549133A (en) | Parallel double-track using method for quick flashing storage | |
CN1635580A (en) | Flash memory medium data writing method | |
CN1447242A (en) | Control device suitable to quick flash memory card and its construction methods | |
CN1687899A (en) | Method, system and module for dynamic downloading of applied programe to user identification | |
CN1242418C (en) | Information storage device | |
CN1991777A (en) | Data prepackage system and method for mirror document | |
CN1719419A (en) | Renewing method of document data | |
CN1447243A (en) | Calculation method executed in quick flash memory fast and not caused abnormal power breakdown as well as its control system | |
CN1221888C (en) | Information processing device and program | |
CN1228718C (en) | Method of preventing overwrite of MAC address of peripheral terminal in DMI data | |
CN111338562A (en) | Data storage device and data processing method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C02 | Deemed withdrawal of patent application after publication (patent law 2001) | ||
WD01 | Invention patent application deemed withdrawn after publication |