CN106155596A - Method for writing data and device - Google Patents

Method for writing data and device Download PDF

Info

Publication number
CN106155596A
CN106155596A CN201610626559.4A CN201610626559A CN106155596A CN 106155596 A CN106155596 A CN 106155596A CN 201610626559 A CN201610626559 A CN 201610626559A CN 106155596 A CN106155596 A CN 106155596A
Authority
CN
China
Prior art keywords
data
storage device
described storage
backup
write
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201610626559.4A
Other languages
Chinese (zh)
Other versions
CN106155596B (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.)
Shenzhen Excelsecu Data Technology Co Ltd
Original Assignee
Shenzhen Excelsecu Data Technology Co 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 Shenzhen Excelsecu Data Technology Co Ltd filed Critical Shenzhen Excelsecu Data Technology Co Ltd
Priority to CN201610626559.4A priority Critical patent/CN106155596B/en
Publication of CN106155596A publication Critical patent/CN106155596A/en
Application granted granted Critical
Publication of CN106155596B publication Critical patent/CN106155596B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0614Improving the reliability of storage systems
    • G06F3/0619Improving the reliability of storage systems in relation to data integrity, e.g. data losses, bit errors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1458Management of the backup or restore process
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data

Abstract

The present invention is applicable to the communications field, it is provided that a kind of method for writing data and device.Described method includes: on a storage device during electricity, it is judged that backed up and marked whether set;When backup completes labelling set, the data of the backup area of described storage device are write the target area of described storage device;When backup completes the non-set of labelling and receives data write request, read the data of the target area of described storage device, and the data of the target area of the described storage device read are compared with data to be written;Choose whether that being written into data writes described storage device according to comparative result.The integrity of the data of write target area can be improved by said method.

Description

Method for writing data and device
Technical field
The embodiment of the present invention belongs to the communications field, particularly relates to a kind of method for writing data and device.
Background technology
In the daily life of user, it may be necessary to the various storage devices extra data of storage, such as, by smart card or USBKey stores data.But smart card on the market or USBKey are when being stored in data, are directly data to be stored in smart card Or the target area of the memory element of USBKey.And if data being stored in the target of the memory element of smart card or USBKey Power-off occurring during region, then the target area of memory element may be caused to produce abnormal result, such as data are muddled things up, Even smart card or USBKey can be caused to scrap because of the entanglement of internal data structure.
Summary of the invention
Embodiments provide a kind of method for writing data and device, it is intended to solve existing method for writing data and exist Occur during power-off, to cause target area to produce abnormal result, even can cause intelligence because of the entanglement of internal data structure The problem that energy card or USBKey scrap.
The embodiment of the present invention is achieved in that a kind of method for writing data, and described method includes:
On a storage device during electricity, it is judged that backed up and marked whether set;
When backup completes labelling set, the data of the backup area of described storage device are write described storage device Target area;
When backup completes the non-set of labelling and receives data write request, read the target area of described storage device Data, and the data of the target area of the described storage device read are compared with data to be written;
Choose whether that being written into data writes described storage device according to comparative result.
The another object of the embodiment of the present invention is to provide a kind of data transfer apparatus, and described device includes:
Back up flag state judging unit, when electricity on a storage device, it is judged that backed up and marked whether Set;
Target region data writing unit, for when backup completes labelling set, by the backup area of described storage device Data write described storage device target area;
Data comparing unit to be written, for when backup completes the non-set of labelling and receives data write request, reads Take the data of the target area of described storage device, and by the data of the target area of described storage device read and data to be written Relatively;
Data write selects unit, for choosing whether that being written into the data described storage of write sets according to comparative result Standby.
In embodiments of the present invention, due to after electricity on a storage device, according to the number having backed up labelling and target area Choose whether to be written into data write storage device according to the comparative result with data to be written, therefore, it is to avoid at target area weight Make carbon copies into data to be written, thus ensure integrity and the accuracy of the data of target area.
Accompanying drawing explanation
Fig. 1 is the flow chart of a kind of method for writing data that first embodiment of the invention provides;
Fig. 2 is the target area communication schematic diagram with backup area of first embodiment of the invention offer;
Fig. 3 is the PC terminal communication schematic diagram with smart card of first embodiment of the invention offer;
Fig. 4 is mobile terminal and bluetooth shield or the communication schematic diagram of card shield of first embodiment of the invention offer;
Fig. 5 is the PC terminal communication schematic diagram with USBKey of first embodiment of the invention offer;
Fig. 6 is the structure chart of a kind of data transfer apparatus that second embodiment of the invention provides.
Detailed description of the invention
In order to make the purpose of the present invention, technical scheme and advantage clearer, below in conjunction with drawings and Examples, right The present invention is further elaborated.Should be appreciated that specific embodiment described herein only in order to explain the present invention, and It is not used in the restriction present invention.
In the embodiment of the present invention, on a storage device during electricity, it is judged that backed up and marked whether set, completed in backup During labelling set, the data of the backup area of described storage device are write the target area of described storage device, completes in backup The non-set of labelling and when receiving data write request, reads the data of the target area of described storage device, and the institute that will read The data of the target area stating storage device compare with data to be written, choose whether to be written into data write according to comparative result Described storage device.
In order to technical solutions according to the invention are described, illustrate below by specific embodiment.
Embodiment one:
Fig. 1 shows the flow chart of a kind of method for writing data that first embodiment of the invention provides, and details are as follows:
Step S11, on a storage device during electricity, it is judged that backed up and marked whether set.
Can be stored in the backup information log of backup area as in figure 2 it is shown, backed up labelling.This backup information is remembered The content of record table is except including that backup completes labelling, it is also possible to include data block address and size of data, the verification of target area Positions etc., wherein check bit is for verifying the integrity having backed up labelling, data block address and size of data.
Storage device includes: contact or contact type intelligent card, Bluetooth intelligent card or bluetooth shield, USBKey etc..At this In inventive embodiments, storage device includes backup area and target area.
On a storage device during electricity (such as storage device and mobile terminal or PC terminal called), when data need from mobile whole When end or PC terminal transmission are to storage device, in order to ensure to write the integrity of the data of target area, storage device needs to judge (wherein, the abnormal write including that power-off causes of write is abnormal, and system is collapsed suddenly and caused extremely whether data write before powering on Write abnormal etc.) judge, specifically, it is judged that backed up and marked whether set, such as, when backup completes to be designated When 1, represent that backup completes labelling set, when backup completes to be designated 0, represent that backup completes the non-set of labelling.Such as Fig. 3 institute Show, it is provided that PC terminal and the communication schematic diagram of smart card, assist with 7816 smart cards between card reader and card (i.e. smart card) View carries out communication.Fig. 4 provides mobile terminal and bluetooth shield or the communication schematic diagram of card shield.Fig. 5 provide PC terminal with The communication schematic diagram of USBKey.
Step S12, when backup completes labelling set, deposits described in the data write of the backup area of described storage device The target area of storage equipment.
When backup completes labelling set, show that data have been completely written to the backup area of storage device, now, even if When the data of backup area are write target area, there is the Deviant Behavioies such as power-off, also again can read from backup area after again powering on Fetch data write target area, thus ensures the integrity of the data of target area.
Wherein, described step S12 includes:
A1, when backup completes labelling set, it is judged that whether the target area of described storage device exists and described storage The data that the data of the backup area of equipment are identical.
A2, the number not identical with the data of the backup area of described storage device in the target area of described storage device According to time, the data of the backup area of described storage device are write the target area of described storage device.
In above-mentioned A1~A2, when the data that target area is not identical with backup area, show that target area is not the most deposited The data of backup area now, then are write target area by the data of storage backup area storage, it is ensured that the data of target area complete Property.Certainly, when there are the data identical with backup area in target area, no longer the data of backup area are write target area, owing to subtracting Lack the write-once operation of storage device, be thus advantageous to improve the service life of storage device.
It is pointed out that in the target area that the data of the backup area of described storage device are write described storage device Time, can be directly by the target area of the data write storage device of the backup area of storage device, it is also possible in above-mentioned A1 and A2, First judge whether the target area of described storage device exists the data identical with the data of the backup area of described storage device, then root It is judged that result chooses whether that the data of the backup area by described storage device write the target area of described storage device.
Alternatively, described A2 or directly by the target area of the data write storage device of the backup area of storage device it After include:
Backup is completed labelling and is updated to non-SM set mode from SM set mode.Further, described, backup is completed Labelling after SM set mode is updated to non-SM set mode, including:
Delete the data of the backup area of described storage device.After the data of backup area being write target area, in order to Save the memory space of backup area, it is simple to data update and backup next time, need to delete the backup area written into storage device Data.
In above-mentioned steps, it is updated to non-SM set mode owing to first backup to be completed labelling from SM set mode, then deletes standby The data in part district rather than first delete the data of backup area and backup is completed labelling be again updated to non-set shape from SM set mode State, therefore, it is possible to avoid the occurrence of delete backup area data after but backup is not completed labelling and is updated to from SM set mode Power-off occurs during non-SM set mode, the data of backup area can not be write when next time powers on the situation of target area, thus enter one Step ensures the integrity of the data of target area.
Step S13, when backup completes the non-set of labelling and receives data write request, reads described storage device The data of target area, and the data of the target area of the described storage device read are compared with data to be written.
Here data to be written refer to will the data of write storage device, when storage device receives data write please When asking, data to be written can be obtained from data write request.
Specifically, one by one the data of the target area of the storage device of reading are compared with data to be written, certainly, in order to carry High data compare speed, after comparing a character, then can extract the character of same intervals in target area and data to be written Compare.
According to comparative result, step S14, chooses whether that being written into data writes described storage device.
Alternatively, described step S14 specifically includes:
B1, when the data of target area of the described storage device read are identical with data to be written, refuse described data Write request.Specifically, when refusing data write request, refusal is written into the target area of data write storage device.
B2, when the data of target area of the described storage device read are different from data to be written, by described to be written Data write the backup area of described storage device, and backup complete flag update after the end of the write for SM set mode.
B3, the data of the backup area of described storage device are write the target area of described storage device.
B4, write described storage device target area after, backup is completed labelling and is updated to not from SM set mode SM set mode, then delete the data of the backup area of described storage device.
In above-mentioned B1~B4, when the data of target area are identical with data to be written, show that target area is to be written written into this Enter data, in order to avoid repeatedly writing, improve the life-span of storage device, data write request will be refused.Data when target area Time different from data to be written, show that target area does not writes this data to be written, then in order to ensure the complete of the data of target area Property, need the data of backup area are write target area.
Alternatively, after described step S14, including:
C1, reception data write request.Wherein, this data write request carries data to be written.
C2, described data to be written are write the backup area of described storage device, and after the end of the write backup is completed Flag update is SM set mode.
C3, the data of the backup area of described storage device are write the target area of described storage device.
C4, write described storage device target area after, backup is completed labelling and is updated to not from SM set mode SM set mode, then delete the data of the backup area of described storage device.
When after powering on not being write data first, when writing data into storage device, first can write storage device Backup region, will update the backup mark of backup information log, finally after the backup region being completely written to storage device Again by the target area of the data write storage device in the backup region of write storage device.If needing update all target area The data in territory, then need not read the data of original target area, directly needing the data updated to be written to storage device Backup region in.
In first embodiment of the invention, on a storage device during electricity, it is judged that backed up and marked whether set, in backup When completing labelling set, the data of the backup area of described storage device are write the target area of described storage device, in backup When completing the non-set of labelling and receive data write request, read the data of the target area of described storage device, and will read The data of target area of described storage device compare with data to be written, choose whether to be written into data according to comparative result Write described storage device.Due to after electricity on a storage device, according to having backed up the data of labelling and target area with to be written The comparative result entering data chooses whether to be written into data write storage device, therefore, it is to avoid be repeatedly written in target area and treat Write data, thus ensure integrity and the accuracy of the data of target area.
Should be understood that in embodiments of the present invention, the size of the sequence number of above-mentioned each process is not meant to the elder generation of execution sequence After, the execution sequence of each process should determine with its function and internal logic, and should be to the implementation process structure of the embodiment of the present invention Become any restriction.
Embodiment two:
Fig. 5 shows the structure chart of a kind of data transfer apparatus that second embodiment of the invention provides, these data write dress Put and can be applicable in various storage device, such as, be applied to contact or contact type intelligent card, Bluetooth intelligent card or bluetooth Shield, USBKey.For convenience of description, illustrate only the part relevant to the embodiment of the present invention.
This data transfer apparatus includes: backed up flag state judging unit 61, target region data writing unit 62, treated Write data comparing unit 63, data write select unit 64.Wherein:
Back up flag state judging unit 61, when electricity on a storage device, it is judged that backed up and marked whether Set.
On a storage device during electricity (such as storage device and mobile terminal or PC terminal called), when data need from mobile whole When end or PC terminal transmission are to storage device, in order to ensure to write the integrity of the data of target area, storage device needs to judge (wherein, the abnormal write including that power-off causes of write is abnormal, and system is collapsed suddenly and caused extremely whether data write before powering on Write abnormal etc.) judge.
Target region data writing unit 62, for when backup completes labelling set, by the backup of described storage device The data in district write the target area of described storage device.
When backup completes labelling set, show that data have been completely written to the backup area of storage device, now, even if When the data of backup area are write target area, there is the Deviant Behavioies such as power-off, also again can read from backup area after again powering on Fetch data write target area, thus ensures the integrity of the data of target area.
Data comparing unit 63 to be written, is used for when backup completes the non-set of labelling and receives data write request, Read the data of the target area of described storage device, and by the data of the target area of described storage device read and number to be written According to comparing.
Here data to be written refer to will the data of write storage device, when storage device receives data write please When asking, data to be written can be obtained from data write request.
Specifically, one by one the data of the target area of the storage device of reading are compared with data to be written, certainly, in order to carry High data compare speed, after comparing a character, then can extract the character of same intervals in target area and data to be written Compare.
Data write selects unit 64, for choosing whether that being written into the data described storage of write sets according to comparative result Standby.
Alternatively, the write of described data selects unit 64 to include:
Data write request refusal module, the data for the target area in the described storage device read and number to be written According to time identical, refuse described data write request.
Backup area Data write. module, the data for the target area in the described storage device read and data to be written Time different, described data to be written write the backup area of described storage device, and after the end of the write backup is completed labelling It is updated to SM set mode.
First object district Data write. module, sets for the data of the backup area of described storage device are write described storage Standby target area.
Back up flag update module, for after writing the target area of described storage device, backup has been completed mark Note is updated to non-SM set mode from SM set mode, then deletes the data of the backup area of described storage device.
Above-mentioned data write request refusal module, backup area Data write. module, first object district Data write. module, standby Part completes in flag update module, when the data of target area are identical with data to be written, shows that target area is to be written written into this Enter data, in order to avoid repeatedly writing, improve the life-span of storage device, data write request will be refused.Data when target area Time different from data to be written, show that target area does not writes this data to be written, then in order to ensure the complete of the data of target area Property, need the data of backup area are write target area.
Alternatively, above-mentioned target region data writing unit 62 includes:
Data Comparison module, for when backup completes labelling set, it is judged that the target area of described storage device Whether there are the data identical with the data of the backup area of described storage device.
Second target region data writing module, for not setting with described storage in the target area of described storage device During the identical data of the data of standby backup area, the data of the backup area of described storage device are write the mesh of described storage device Mark district.
In above-mentioned data Comparison module and the second target region data writing module, when target area not and backs up During the identical data in district, show that target area does not the most store the data of backup area storage, now, then the data of backup area are write Target area, it is ensured that the integrity of the data of target area.Certainly, when there are the data identical with backup area in target area, no longer The data of backup area are write target area, operates owing to decreasing the write-once of storage device, be thus advantageous to improve storage The service life of equipment.
It is pointed out that in the target area that the data of the backup area of described storage device are write described storage device Time, can be directly by the target area of the data write storage device of the backup area of storage device, it is also possible to first judge described storage Whether the target area of equipment exists the data identical with the data of the backup area of described storage device, selects further according to judged result Whether by the target area of the data described storage device of write of the backup area of described storage device.
Alternatively, described data transfer apparatus includes:
First to have backed up flag update be non-set unit, is updated to from SM set mode for backup is completed labelling Non-SM set mode.
Alternatively, described data transfer apparatus includes:
Backup area data deletion unit, for deleting the data of the backup area of described storage device.When by backup area After data write target area, in order to save the memory space of backup area, it is simple to data update and backup next time, need to delete Data written into the backup area of storage device.
First has backed up flag update in non-set unit and backup area data deletion unit, owing to first will back up Become labelling to be updated to non-SM set mode from SM set mode, then delete the data of backup area rather than first delete the number of backup area Being updated to non-SM set mode according to again backup being completed labelling from SM set mode, deleting backup area therefore, it is possible to avoid the occurrence of After data but backup is not completed labelling and when SM set mode is updated to non-SM set mode, power-off occurs, when powering on next time The data of backup area can not be write the situation of target area, thus be further ensured that the integrity of the data of target area.
Alternatively, described data transfer apparatus includes:
Data write request receives unit, is used for receiving data write request.Wherein, this data write request carries to be written Enter data.
Back up flag update for set unit, for described data to be written are write the standby of described storage device Part district, and after the end of the write backup is completed flag update for SM set mode.
The data transfer unit of backup area, for writing described storage device by the data of the backup area of described storage device Target area.
Second to have backed up flag update be non-set unit, for after writing the target area of described storage device, Backup is completed labelling and is updated to non-SM set mode from SM set mode, then delete the data of the backup area of described storage device.
When after powering on not being write data first, when writing data into storage device, first can write storage device Backup region, will update the backup mark of backup information log, finally after the backup region being completely written to storage device Again by the target area of the data write storage device in the backup region of write storage device.If needing update all target area The data in territory, then need not read the data of original target area, directly needing the data updated to be written to storage device Backup region in.
In second embodiment of the invention, due to after electricity on a storage device, according to having backed up labelling and target area Data choose whether to be written into data write storage device, therefore, it is to avoid in target area with the comparative result of data to be written It is repeatedly written data to be written, thus ensures integrity and the accuracy of the data of target area.
Those of ordinary skill in the art are it is to be appreciated that combine the list of each example that the embodiments described herein describes Unit and algorithm steps, it is possible to being implemented in combination in of electronic hardware or computer software and electronic hardware.These functions are actually Perform with hardware or software mode, depend on application-specific and the design constraint of technical scheme.Professional and technical personnel Each specifically should being used for can be used different methods to realize described function, but this realization is it is not considered that exceed The scope of the present invention.
Those skilled in the art is it can be understood that arrive, for convenience and simplicity of description, the system of foregoing description, The specific works process of device and unit, is referred to the corresponding process in preceding method embodiment, does not repeats them here.
In several embodiments provided herein, it should be understood that disclosed system, apparatus and method, permissible Realize by another way.Such as, device embodiment described above is only schematically, such as, and described unit Dividing, be only a kind of logic function and divide, actual can have other dividing mode, the most multiple unit or assembly when realizing Can in conjunction with or be desirably integrated into another system, or some features can be ignored, or does not performs.Another point, shown or The coupling each other discussed or direct-coupling or communication connection can be the indirect couplings by some interfaces, device or unit Close or communication connection, can be electrical, machinery or other form.
The described unit illustrated as separating component can be or may not be physically separate, shows as unit The parts shown can be or may not be physical location, i.e. may be located at a place, or can also be distributed to multiple On NE.Some or all of unit therein can be selected according to the actual needs to realize the mesh of the present embodiment scheme 's.
It addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, it is also possible to It is that unit is individually physically present, it is also possible to two or more unit are integrated in a unit.
If described function is using the form realization of SFU software functional unit and as independent production marketing or use, permissible It is stored in a computer read/write memory medium.Based on such understanding, technical scheme is the most in other words The part contributing prior art or the part of this technical scheme can embody with the form of software product, this meter Calculation machine software product is stored in a storage medium, including some instructions with so that a computer equipment (can be individual People's computer, server, or the network equipment etc.) perform all or part of step of method described in each embodiment of the present invention. And aforesaid storage medium includes: USB flash disk, portable hard drive, read only memory (ROM, Read-Only Memory), random access memory are deposited The various media that can store program code such as reservoir (RAM, Random Access Memory), magnetic disc or CD.
The above, the only detailed description of the invention of the present invention, but protection scope of the present invention is not limited thereto, and any Those familiar with the art, in the technical scope that the invention discloses, can readily occur in change or replace, should contain Cover within protection scope of the present invention.Therefore, protection scope of the present invention should described be as the criterion with scope of the claims.

Claims (12)

1. a method for writing data, it is characterised in that described method includes:
On a storage device during electricity, it is judged that backed up and marked whether set;
When backup completes labelling set, the data of the backup area of described storage device are write the target of described storage device District;
When backup completes the non-set of labelling and receives data write request, read the number of the target area of described storage device According to, and the data of the target area of the described storage device read are compared with data to be written;
Choose whether that being written into data writes described storage device according to comparative result.
Method the most according to claim 1, it is characterised in that described choose whether to be written into data according to comparative result Write described storage device, specifically include:
When the data of the target area of the described storage device read are identical with data to be written, refusing the write of described data please Ask;
When the data of the target area of the described storage device read are different from data to be written, described data to be written are write The backup area of described storage device, and after the end of the write backup is completed flag update for SM set mode;
The data of the backup area of described storage device are write the target area of described storage device;
After writing the target area of described storage device, backup is completed labelling and is updated to non-set shape from SM set mode State, then delete the data of the backup area of described storage device.
Method the most according to claim 1 and 2, it is characterised in that described when backup completes labelling set, by described The data of the backup area of storage device write the target area of described storage device, specifically include:
When backup completes labelling set, it is judged that it is standby whether the target area of described storage device exists with described storage device The data that the data in part district are identical;
During not identical with the data of the backup area of described storage device in the target area of described storage device data, will The data of the backup area of described storage device write the target area of described storage device.
Method the most according to claim 3, it is characterised in that write in the described data by the backup area of described storage device After entering the target area of described storage device, including:
Backup is completed labelling and is updated to non-SM set mode from SM set mode.
Method the most according to claim 4, it is characterised in that backup is completed labelling from the renewal of SM set mode described After non-SM set mode, including:
Delete the data of the backup area of described storage device.
Method the most according to claim 1, it is characterised in that choose whether to be written into number according to comparative result described After writing described storage device, including:
Receive data write request;
Described data to be written are write the backup area of described storage device, and after the end of the write backup is completed flag update For SM set mode;
The data of the backup area of described storage device are write the target area of described storage device;
After writing the target area of described storage device, backup is completed labelling and is updated to non-set shape from SM set mode State, then delete the data of the backup area of described storage device.
7. a data transfer apparatus, it is characterised in that described device includes:
Back up flag state judging unit, when electricity on a storage device, it is judged that backed up and marked whether set;
Target region data writing unit, for when backup completes labelling set, by the number of the backup area of described storage device According to the target area writing described storage device;
Data comparing unit to be written, for when backup completes the non-set of labelling and receives data write request, reads institute State the data of the target area of storage device, and by the data of the target area of described storage device read and data ratio to be written Relatively;
Data write selects unit, for choosing whether that being written into data writes described storage device according to comparative result.
Device the most according to claim 7, it is characterised in that the write of described data selects unit to include:
Data write request refusal module, for data and the data phase to be written of the target area in the described storage device read Meanwhile, described data write request is refused;
Backup area Data write. module, the data for the target area in the described storage device read are different from data to be written Time, described data to be written are write the backup area of described storage device, and after the end of the write backup is completed flag update For SM set mode;
First object district Data write. module, for writing described storage device by the data of the backup area of described storage device Target area;
Backed up flag update module, for write described storage device target area after, backup is completed labelling from SM set mode is updated to non-SM set mode, then deletes the data of the backup area of described storage device.
9. according to the device described in claim 7 or 8, it is characterised in that described target region data writing unit includes:
Data Comparison module, for when backup completes labelling set, it is judged that whether the target area of described storage device There are the data identical with the data of the backup area of described storage device;
Second target region data writing module, in the target area of described storage device not with described storage device During the identical data of the data of backup area, the data of the backup area of described storage device are write the target of described storage device District.
Device the most according to claim 9, it is characterised in that described device includes:
First to have backed up flag update be non-set unit, is updated to not put from SM set mode for backup is completed labelling Position state.
11. devices according to claim 10, it is characterised in that described device includes:
Backup area data deletion unit, for deleting the data of the backup area of described storage device.
12. devices according to claim 7, it is characterised in that described device includes:
Data write request receives unit, is used for receiving data write request;
Back up flag update for set unit, for described data to be written being write the backup of described storage device District, and after the end of the write backup is completed flag update for SM set mode;
The data transfer unit of backup area, for writing the mesh of described storage device by the data of the backup area of described storage device Mark district;
Second to have backed up flag update be non-set unit, for after writing the target area of described storage device, by standby Part completes labelling and is updated to non-SM set mode from SM set mode, then deletes the data of the backup area of described storage device.
CN201610626559.4A 2016-08-03 2016-08-03 Data writing method and device Active CN106155596B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610626559.4A CN106155596B (en) 2016-08-03 2016-08-03 Data writing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610626559.4A CN106155596B (en) 2016-08-03 2016-08-03 Data writing method and device

Publications (2)

Publication Number Publication Date
CN106155596A true CN106155596A (en) 2016-11-23
CN106155596B CN106155596B (en) 2020-01-17

Family

ID=57328655

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610626559.4A Active CN106155596B (en) 2016-08-03 2016-08-03 Data writing method and device

Country Status (1)

Country Link
CN (1) CN106155596B (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108108118A (en) * 2016-11-24 2018-06-01 大心电子股份有限公司 Method for writing data and storage control
CN109254929A (en) * 2018-09-05 2019-01-22 北京智芯微电子科技有限公司 Realize the method that chip is reliably written in data
CN109254879A (en) * 2018-09-27 2019-01-22 南方电网科学研究院有限责任公司 A kind of data processing method, system, device and readable storage medium storing program for executing
CN109542665A (en) * 2017-09-21 2019-03-29 阿里巴巴集团控股有限公司 Power loss recovery method, method for writing data and device
CN110278716A (en) * 2018-01-18 2019-09-24 三菱电机株式会社 PLC, network unit, CPU element and data transferring method
CN111694767A (en) * 2019-05-16 2020-09-22 时擎智能科技(上海)有限公司 Accumulation buffer memory device
CN112328290A (en) * 2020-12-04 2021-02-05 第一拖拉机股份有限公司 Remote updating method and system for agricultural machinery data acquisition terminal program
CN112559450A (en) * 2019-09-10 2021-03-26 阿里巴巴集团控股有限公司 File access method and device, electronic equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103176920A (en) * 2013-03-26 2013-06-26 杭州华三通信技术有限公司 Nor flash power down protection method and Nor flash power down protection device
CN103730155A (en) * 2012-10-10 2014-04-16 华为技术有限公司 Data writing method and data writing device
CN103914407A (en) * 2012-12-30 2014-07-09 航天信息股份有限公司 Secure digital memory (SD) card power down protection and restoring method and SD card with power down protection function

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103730155A (en) * 2012-10-10 2014-04-16 华为技术有限公司 Data writing method and data writing device
CN103914407A (en) * 2012-12-30 2014-07-09 航天信息股份有限公司 Secure digital memory (SD) card power down protection and restoring method and SD card with power down protection function
CN103176920A (en) * 2013-03-26 2013-06-26 杭州华三通信技术有限公司 Nor flash power down protection method and Nor flash power down protection device

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108108118A (en) * 2016-11-24 2018-06-01 大心电子股份有限公司 Method for writing data and storage control
CN109542665A (en) * 2017-09-21 2019-03-29 阿里巴巴集团控股有限公司 Power loss recovery method, method for writing data and device
CN110278716A (en) * 2018-01-18 2019-09-24 三菱电机株式会社 PLC, network unit, CPU element and data transferring method
CN110278716B (en) * 2018-01-18 2020-10-27 三菱电机株式会社 PLC, network unit, CPU unit, and data transfer method
CN109254929A (en) * 2018-09-05 2019-01-22 北京智芯微电子科技有限公司 Realize the method that chip is reliably written in data
CN109254929B (en) * 2018-09-05 2020-09-08 北京智芯微电子科技有限公司 Method for realizing reliable data writing into chip
CN109254879A (en) * 2018-09-27 2019-01-22 南方电网科学研究院有限责任公司 A kind of data processing method, system, device and readable storage medium storing program for executing
CN111694767A (en) * 2019-05-16 2020-09-22 时擎智能科技(上海)有限公司 Accumulation buffer memory device
CN112559450A (en) * 2019-09-10 2021-03-26 阿里巴巴集团控股有限公司 File access method and device, electronic equipment and storage medium
CN112559450B (en) * 2019-09-10 2022-04-29 阿里巴巴集团控股有限公司 File access method and device, electronic equipment and storage medium
CN112328290A (en) * 2020-12-04 2021-02-05 第一拖拉机股份有限公司 Remote updating method and system for agricultural machinery data acquisition terminal program
CN112328290B (en) * 2020-12-04 2023-08-22 第一拖拉机股份有限公司 Remote updating method and system for agricultural machinery data acquisition terminal program

Also Published As

Publication number Publication date
CN106155596B (en) 2020-01-17

Similar Documents

Publication Publication Date Title
CN106155596A (en) Method for writing data and device
CN103034592B (en) Data processing method and device
CN104573093B (en) A kind of method and apparatus for managing file directory
CN101673192B (en) Method for time-sequence data processing, device and system therefor
CN103092687B (en) A kind of application program management apparatus and method
CN104766206A (en) NFC payment method and device based on mobile terminal
CN109496292A (en) A kind of disk management method, disk management device and electronic equipment
CN107391308A (en) Data processing method and device, terminal and computer-readable recording medium
CN103218416A (en) Method, device and system for loading database
CN103019891A (en) Method and system for restoring deleted file
CN106022101A (en) Application management method and terminal
CN103049708A (en) Audit configuration method and audit configuration system for database
CN105744523A (en) WIFI connection method and mobile terminal
CN102142010A (en) Method and equipment for inputting data to multimedia service database on embedded equipment
CN104050014A (en) Efficient storage management method based on virtualization platform
CN105573872A (en) Hardware maintenance method and device of data storage system
CN106055372A (en) Method and device for uninstalling application
CN103577246A (en) Method and device for preventing virtual machine from escaping
CN105786650A (en) Data management method and device
CN107426801A (en) A kind of control method of smart card, device, terminal device and smart card
CN205563583U (en) System for hard disk data are destroyed in batches, bad way is kept apart and validation data remains
CN109766313A (en) Geological project data processing method, device and computer equipment
CN105700971A (en) Data backup method and device
CN109213639A (en) A kind of storage and disaster tolerance method and device
CN105808556A (en) Operating method for database and database engine

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant