WO2012079432A1 - Snapshot method and solid state drive - Google Patents

Snapshot method and solid state drive Download PDF

Info

Publication number
WO2012079432A1
WO2012079432A1 PCT/CN2011/081609 CN2011081609W WO2012079432A1 WO 2012079432 A1 WO2012079432 A1 WO 2012079432A1 CN 2011081609 W CN2011081609 W CN 2011081609W WO 2012079432 A1 WO2012079432 A1 WO 2012079432A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
snapshot
area
storage
storage medium
Prior art date
Application number
PCT/CN2011/081609
Other languages
French (fr)
Chinese (zh)
Inventor
罗姣林
柯乔
杨继涛
张琴
Original Assignee
成都市华为赛门铁克科技有限公司
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 成都市华为赛门铁克科技有限公司 filed Critical 成都市华为赛门铁克科技有限公司
Publication of WO2012079432A1 publication Critical patent/WO2012079432A1/en

Links

Classifications

    • 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/1415Saving, restoring, recovering or retrying at system level
    • G06F11/1435Saving, restoring, recovering or retrying at system level using file system or storage system metadata
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2201/00Indexing scheme relating to error detection, to error correction, and to monitoring
    • G06F2201/84Using snapshots, i.e. a logical point-in-time copy of the data

Definitions

  • the present invention relates to the field of storage technologies, and in particular, to a snapshot method and a solid state hard disk. Background technique
  • SSD Solid State Disk
  • the storage unit mostly uses a non-volatile flash memory (Flash) chip, or a synchronous dynamic random access memory (Synchronous Dynamic Random Access Memory;
  • SSD does not have mechanical rotating device, and has the advantages of high read/write performance, strong seismic resistance, and low power consumption. It is widely used in military, vehicle, industrial control, video surveillance, network monitoring, network terminals, power, medical, aviation, navigation equipment, etc. field. Due to the SSD's outstanding input and output (Input Output; referred to as: 10) processing power, it is often used in the middle and high-end storage areas.
  • Input Output input and output
  • Snapshot A fully available copy of a specified data set, including the corresponding data at a certain point in time (for example: copy start)
  • the snapshot can be a copy or a copy of the represented data.
  • the role of the snapshot is to enable online data recovery.
  • snapshots can be used for timely data recovery. Restoring data to the state at which the snapshot was generated at a point in time.
  • There are many ways to implement snapshots such as write-and-copy, split mirror snapshots, and so on.
  • the current snapshot technology is based on the storage system level of the network. Snapshot technology can be used to improve data reliability on the storage server of the storage system. Online data recovery can be performed by using snapshots. For example, when the storage server has an application failure or file corruption, it can be performed. Data recovery, will count According to the state of the point in time when the snapshot is restored.
  • a snapshot method and a solid state hard disk provided in the embodiments of the present invention achieve the technical effects of improving the reliability and virus defense capability of the storage medium and enhancing the data protection capability of the storage medium.
  • a snapshot method including:
  • the data modification request includes new data to be written; obtaining an address of the storage unit that needs to be modified in the data storage area of the storage medium carried in the data modification request, and obtaining the modification from the data storage area Raw data, backing up the original data to a snapshot area of the storage medium to obtain snapshot incremental data; reading data on the block containing the original data into a cache, modifying the original data, erasing the storage medium Data on the block, rewriting the data on the modified block; or
  • a snapshot method including:
  • the data modification request includes new data to be written; obtaining an address of the storage unit that needs to be modified in the data storage area of the storage medium carried in the data modification request, and obtaining the modification from the data storage area Raw data, backing up the original data to a snapshot area of the storage medium to obtain snapshot incremental data; reading data on the block containing the original data into a cache, modifying the original data, erasing the storage medium The data on the block is rewritten to the modified data on the block.
  • a solid state hard disk comprising: an interface connected to an external device, a controller connected to the interface, and a storage medium connected to the controller, wherein the controller comprises: Receive module and snapshot module;
  • a receiving module configured to receive a data modification request, where the data modification request includes new data to be written
  • a snapshot module configured to: according to the address of the storage unit that needs to be modified in the data storage area of the storage medium carried in the data modification request received by the receiving module, obtain the original data to be modified from the data storage area, and The original data is backed up to the snapshot area of the storage medium to obtain snapshot incremental data; or, the new data in the data modification request received by the receiving module is written to the snapshot area of the storage medium. , get snapshot incremental data;
  • a data modification module configured to: when the snapshot module backs up the original data to a snapshot area of the storage medium, and obtain snapshot incremental data, read data on the block including the original data into a cache, and modify the Describe the original data, erase the data on the block on the storage medium, and rewrite the data on the modified block.
  • the snapshot method and the solid state hard disk provided in the embodiment of the present invention receive a data modification request, where the data modification request includes new data to be written; and the storage that needs to be modified in the data storage area of the storage medium carried in the data modification request
  • An address of the unit obtaining original data to be modified from the data storage area, backing up the original data to a snapshot area of the storage medium, obtaining snapshot incremental data, and using the original data of the data storage area Modifying to the new data in the data modification request, or writing the new data in the data modification request to a snapshot area of the storage medium to obtain snapshot incremental data, which may be on a storage medium
  • Snapshots are used to protect and recover data. Because the snapshot area is transparent to the upper layer and cannot be accessed, virus injection can be prevented. This improves the reliability and virus defense of the storage medium. If the critical data is snapshotted to the snapshot area, it can be protected. The security of key data improves data protection.
  • FIG. 1 is a flowchart of a first embodiment of a snapshot method according to the present invention.
  • FIG. 2 is a schematic diagram of storage unit division of an SSD in a first embodiment of a snapshot method according to the present invention
  • FIG. 3 is a flowchart of a second embodiment of a snapshot method according to the present invention
  • FIG. 4 is a schematic diagram of an initial state of a storage unit of an SSD in a second embodiment of the snapshot method of the present invention
  • FIG. 5 is a schematic diagram of a snapshot of a storage unit of an SSD in a second embodiment of the snapshot method of the present invention
  • FIG. 6 is a schematic diagram of a snapshot area of an SSD in a second embodiment of the snapshot method according to the second embodiment of the present invention
  • FIG. 8 is a schematic diagram of a snapshot area mapping table of the SSD in the second embodiment of the present invention. a flow chart of three embodiments;
  • FIG. 9 is a schematic diagram of a redundant area mapping table of an SSD according to an embodiment of the present invention.
  • FIG. 10 is a schematic structural view of a first embodiment of a solid state drive according to the present invention.
  • FIG. 11 is a schematic structural view of a second embodiment of a solid state drive according to the present invention.
  • the technical solutions in the present invention will be clearly and completely described in conjunction with the drawings in the present invention. It is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
  • FIG. 1 is a flowchart of a first embodiment of a snapshot method according to the present invention. As shown in FIG. 1, the snapshot method includes:
  • Step 11 Receive a data modification request, where the data modification request includes new data to be written; the storage unit of the storage medium may be divided into a data storage area and a snapshot area in advance, and generally, the data storage area is used to store the original data. , the snapshot area is used to store the number of snapshot increments of the original data According to; or. After the storage medium receives the data modification request, the snapshot can be started;
  • the data modification request may include an address or a logical number of a storage unit that needs to be modified in the data storage area, and new data to be written.
  • Step 12 Obtain original data to be modified from the data storage area according to an address of a storage unit that needs to be modified in a data storage area of the storage medium carried in the data modification request, and back up the original data to the storage medium.
  • the snapshot area, the snapshot increment data is obtained, the data on the block containing the original data is read into the buffer, the original data is modified, the data on the block on the storage medium is erased, and the modified data is modified.
  • the data on the block is rewritten; or the new data in the data modification request is written to the snapshot area of the storage medium to obtain snapshot incremental data.
  • the foregoing steps 11 and 12 can be performed by a controller inside the storage medium.
  • the controller can back up the original data in the storage unit that needs to be modified to the snapshot area of the storage medium or write the modified new data.
  • data protection and recovery can be implemented. Because the snapshot area is transparent to the upper layer and cannot be accessed, virus injection can be prevented, and the reliability and virus defense capability of the storage medium can be improved. If key data is snapshotted to the snapshot area, the key can be protected. Data security improves data protection.
  • the storage medium in the embodiment of the present invention may be a plurality of types, and the storage medium is an SSD as an example.
  • FIG. 2 is a schematic diagram of the storage unit division of the SSD in the first embodiment of the snapshot method according to the present invention.
  • the storage unit is divided into a data storage area 21 and a snapshot area 22 according to a certain rule.
  • the data storage area 21 stores original data
  • the snapshot area 22 stores snapshot incremental data.
  • step 12 may include the following situations:
  • Case 1 According to the address of the storage unit in the data storage area of the storage medium carried in the data modification request, the original data to be modified is obtained from the data storage area, and the original data is backed up to the storage medium.
  • the snapshot area the snapshot increment data is obtained; the data on the block containing the original data is read into the cache, the original data is modified, the data on the block on the storage medium is erased, and the modified block is The data on it is rewritten.
  • the data on the block containing the original data in the data storage area must be read into the cache, the original data is modified, and the data storage area is erased.
  • the data on the block is rewritten into the data storage area by the modified data on the block.
  • Case 2 writing the new data in the data modification request to a snapshot area of the storage medium to obtain snapshot incremental data.
  • the snapshot area is blank and can be written directly without erasing.
  • FIG. 3 is a flowchart of a second embodiment of a snapshot method according to the present invention. As shown in FIG. 3, the method includes:
  • Step 301 Receive a data modification request, where the data modification request includes new data to be written.
  • Step 302 According to the data storage area of the storage medium carried in the data modification request, the address of the storage unit that needs to be modified, from the data. Obtaining the original data to be modified in the storage area, backing up the original data to the snapshot area of the storage medium, and obtaining snapshot incremental data; reading the data on the block containing the original data into the cache, and modifying The original data, erasing data on the block on the storage medium, and rewriting the modified data on the block;
  • Step 303 Record a mapping relationship between the location of the snapshot data of the original data in the storage unit of the snapshot area and the location of the new data in the storage unit of the data storage area, that is, the first mapping relationship;
  • the storage medium may include a snapshot area mapping table, and the mapping relationship between the data storage area and the snapshot area may be recorded in the snapshot area mapping table.
  • the snapshot area mapping table can record the location of the snapshot data of the original data in the storage unit of the snapshot area (for example: the address or number of the storage unit of a snapshot area, etc.) and the new data.
  • the mapping relationship between the locations of the storage units of the data storage area is the first mapping relationship.
  • the snapshot area mapping table stores a snapshot corresponding to the storage unit.
  • the address or number of the storage unit where the incremental data is located, when the data storage area is stored When there is no snapshot increment data in the snapshot area, the area setting corresponding to the storage unit in the snapshot area mapping table may be empty, for example: It can be represented by "N/A".
  • the location of the storage unit in the snapshot area according to the snapshot incremental data of the original data and the new data in the storage unit of the data storage area The mapping relationship between the locations is the first mapping relationship, and the snapshot incremental data of the original data that needs to be restored in the data storage area is obtained from the snapshot area.
  • Step 304 If the snapshot area is full, and the data storage area has snapshot incremental data that needs to be backed up to the snapshot area, issue a notification that the snapshot area is full or delete the earliest storage into the snapshot area. Snapshot incremental data.
  • FIG. 4 is a schematic diagram of an initial state of a storage unit of an SSD in a second embodiment of the snapshot method of the present invention.
  • the data storage area may be assumed.
  • the logical number of the storage unit is "0-N”
  • the logical number of the storage unit in the snapshot area is "0-M”
  • the data storage area has the data ' ⁇ - ⁇ ”
  • the initial state of each storage unit in the snapshot area can be empty. ( ⁇ / ⁇ ), that is, no data is saved.
  • FIG. 5 is a schematic diagram of a snapshot of a storage unit of an SSD in a second embodiment of the snapshot method according to the present invention.
  • a snapshot is started at a certain time, and the original data of the modified data storage area may be in the snapshot after the moment. The area is backed up and the new data is modified directly in the data store.
  • the data modification request includes the storage unit "3" to be modified and the modified new data 'OxDF", as shown in FIG. 5, the storage unit of the data storage area can be obtained: The original data 'OxDD' in 3" needs to be modified to the new data "OxDF".
  • FIG. 6 is a schematic diagram of a storage unit snapshot of an SSD in a second embodiment of the snapshot method of the present invention.
  • the original data "OxDD” is first backed up to the storage unit ' ⁇ ' of the snapshot area, and then the data storage area is used.
  • the original data "OxDD” in the storage unit "3” is modified to the new data "OxDF”.
  • the mapping between the logical block address (I_BA) and the physical block address (PBA) of the SSD is different from the traditional hard disk, and the mapping can be customized.
  • the implementation of the snapshot mapping relationship is not limited to an algorithm.
  • the embodiment of the present invention only enumerates an example, and adds a mapping of the first-level snapshot area to the data storage area, that is, the snapshot area mapping table, and the data in the snapshot area mapping table.
  • the mapping relationship between the storage area and the location of each storage unit of the snapshot area If a storage unit in the data storage area does not have original data backup or new data write in the snapshot area to form snapshot incremental data, the corresponding area of the storage unit in the snapshot area mapping table may be set to null (N/A). If the storage unit has snapshot incremental data in the snapshot area, the corresponding area in the snapshot area mapping table may be set to the storage unit where the corresponding snapshot incremental data is located.
  • FIG. 7 is a schematic diagram of a snapshot area mapping table of an SSD in a second embodiment of the snapshot method of the present invention.
  • the original data 'OxDD' in the storage unit "3" of the data storage area is backed up to the storage of the snapshot area.
  • the area corresponding to the storage unit "3" of the data storage area in the snapshot area mapping table is set as the storage unit "0" of the snapshot area.
  • the original data "OxDD" is stored in the storage unit ' ⁇ ' of the snapshot area, and the mapping relationship is recorded in the snapshot area mapping table.
  • the "OxDD” can be read from the storage area ' ⁇ ' of the snapshot area from the snapshot area according to the snapshot area mapping table, and restored to the storage unit "3" of the data storage area.
  • the original data in the storage unit that needs to be modified may be backed up to the snapshot area of the storage medium or the modified new data is written into the snapshot area, and data protection and recovery may be implemented; the snapshot area is transparent to the upper layer and cannot be accessed. It can prevent virus injection, improve the reliability of storage media and virus defense. If you snapshot critical data to the snapshot area, you can protect the security of key data and improve data protection.
  • FIG. 8 is a flowchart of a third embodiment of a snapshot method according to the present invention. As shown in FIG. 8, the method includes: Step 801: Receive a data modification request, where the data modification request includes new data to be written. Step 802: Write the new data in the data modification request to a snapshot area of the storage medium, to obtain a snapshot increase. Quantity data
  • Step 803 Record a mapping relationship between the location of the storage unit of the new data and the location of the original data in the storage unit of the data storage area, that is, the second mapping relationship;
  • the storage area may include a snapshot area mapping table, and the mapping relationship between the data storage area and the snapshot area may be recorded in the snapshot area mapping table.
  • the mapping relationship between the snapshot increment data of the new data in the snapshot area mapping table and the location of the storage unit of the original data in the data storage area may be recorded.
  • the snapshot area mapping table stores the address or number of the storage unit where the snapshot incremental data corresponding to the storage unit is located, if a storage unit of the data storage area There is no snapshot delta data in the snapshot area.
  • the area setting corresponding to the storage unit in the snapshot area mapping table can be empty. For example: It can be represented by "N/A".
  • the location of the storage unit in the snapshot area according to the snapshot incremental data of the new data and the original data in the storage unit of the data storage area The mapping relationship between the locations is the second mapping relationship, and the original data in the storage unit that needs to be restored in the snapshot area is obtained from the data storage area.
  • the original data 'OxDD' in the storage unit "3" of the data storage area can be kept unchanged, but the new data "OxDF” is written into the snapshot area, and the mapping relationship is recorded in the snapshot area mapping table, which is normal.
  • “OxDF” is obtained from the snapshot area according to the mapping relationship.
  • snapshot restoration is required, "OxDD" can be obtained from the data storage area.
  • Step 804 If the snapshot area is full, and the data storage area has snapshot incremental data that needs to be backed up to the snapshot area, issue a notification that the snapshot area is full; or delete the earliest stored snapshot.
  • the snapshot increment data for the zone.
  • Delete the oldest snapshot area The incremental data of the snapshot is saved, or the user is notified that the snapshot area is full and cannot be stored. You can set it according to the specific application scenario.
  • the original data in the storage unit that needs to be modified may be backed up to the snapshot area of the storage medium or the modified new data is written into the snapshot area, and data protection and recovery may be implemented; the snapshot area is transparent to the upper layer and cannot be accessed. It can prevent virus injection, improve the reliability of storage media and virus defense. If you snapshot critical data to the snapshot area, you can protect the security of key data and improve data protection.
  • the new data in the modification request may be written to the snapshot area of the storage medium to obtain the snapshot incremental data, so that the snapshot is directly performed on the storage medium to implement data protection and recovery; Unreachable, it can prevent virus injection, improve the reliability of storage media and virus defense. If you snapshot critical data to the snapshot area, you can protect the security of key data and improve data protection.
  • the snapshot area of the storage medium may be a redundant area.
  • the storage unit of the storage medium may include a data storage area and a redundant area.
  • the data storage area is used to store original data, and redundant.
  • the remaining area is generally used to improve the performance of the storage medium, and can be used to store system information, and may also include bad block reserved blocks, blank blocks, and the like.
  • the data storage area stores the original data, and the blank blocks of the redundant area are in the unused storage unit, which can be used to store the snapshot incremental data.
  • the snapshot method may further include:
  • the mapping relationship between the location of the snapshot data of the original data and the location of the storage unit of the new data in the data storage area is recorded and set.
  • the state of the storage unit in the redundant area storing the original data is a snapshot state; for case 2, the snapshot incremental data of the new data is recorded at the location of the storage unit of the redundant area and the original data
  • the redundant area mapping table can record the status of each storage unit in the redundant area, and redundant The mapping relationship between each storage unit of the remaining area and the data storage area. If a storage unit of the data storage area does not have original data backup or new data write in the redundant area to form snapshot incremental data, the blank may be used. If the storage unit has snapshot incremental data in the redundant area, The state of the corresponding regional setting of the storage unit in the redundant area mapping table may be set as a snapshot, and the address logical number of the storage unit of the redundant area where the corresponding snapshot incremental data is located is recorded.
  • FIG. 9 is a schematic diagram of a redundant area mapping table of an SSD according to an embodiment of the present invention. As shown in FIG.
  • the redundant area replaces the snapshot area to implement the above snapshot method, which can store snapshot incremental data and system information, realize redundancy of redundant areas, and protect data security while balancing system performance.
  • the solid state drive includes: an interface 101 connected to an external device, a controller 102 connected to the interface 101, and a storage connected to the controller 102.
  • Medium 103 The solid state drive includes: an interface 101 connected to an external device, a controller 102 connected to the interface 101, and a storage connected to the controller 102.
  • Medium 103 The solid state drive includes: an interface 101 connected to an external device, a controller 102 connected to the interface 101, and a storage connected to the controller 102.
  • Medium 103 medium 103.
  • the controller 102 includes: a receiving module 1020 and a snapshot module 1021;
  • the receiving module 1020 is configured to receive a data modification request, where the data modification request includes new data to be written;
  • the snapshot module 1021 is configured to: according to the address of the storage unit that needs to be modified in the data storage area of the storage medium 103 carried in the data modification request received by the receiving module 1020, the slave data The original data to be modified is obtained in the storage area, and the original data is backed up to the snapshot area of the storage medium 103 to obtain snapshot incremental data. Alternatively, the data modification request received by the receiving module 1020 is used. The new data is written to the snapshot area of the storage medium 103 to obtain snapshot incremental data;
  • the data modification module 1022 is configured to: when the snapshot module 1021 backs up the original data to the snapshot area of the storage medium 103, and obtain the snapshot incremental data, read the data on the block block including the original data into the cache, and modify the original Data, erasing data on the block on the storage medium, and rewriting the data on the modified block.
  • the original data in the storage unit that needs to be modified may be backed up to the snapshot area of the storage medium or the modified new data is written into the snapshot area, and data protection and recovery may be implemented; the snapshot area is transparent to the upper layer and cannot be accessed. It can prevent virus injection, improve the reliability of the storage shield and virus defense capability. If the key data is snapshotted to the snapshot area, it can protect the security of key data and improve the data protection capability. Further, through the internal control of the solid state drive. The snapshot function enables the snapshot function to be performed inside the storage medium without any external device, thereby saving the processing resources of the SSD externally.
  • the storage medium 103 may include: a data storage area 1031 and a snapshot area 1032; if the data storage area 1031 is used to store the new data, the snapshot area 1032 is configured to store snapshot incremental data of the original data; The storage area 1031 is configured to store the original data, and the snapshot area 1032 is configured to store snapshot incremental data of the new data.
  • the slave interface 101 of the controller 102 can receive a data repair request sent by the external device, and the data modification request can include the storage unit that needs to be modified and the modified new data.
  • the receiving module 1020 requests the data modification according to the data.
  • the original data and the modified new data that need to be modified may be obtained, and the snapshot module 1021 backs up the original data in the storage unit that needs to be modified in the data storage area 1031 of the storage medium 103 to the snapshot area 1032 of the storage medium 103 to obtain the original data.
  • the snapshot increment data, and then the original data in the data storage area 1031 can be modified to new data.
  • the snapshot module 1021 writes the received new data into the snapshot area 1032 to obtain new data.
  • the snapshot increments the data and keeps the original data of the data storage area 1031 unchanged.
  • the snapshot module can back up the original data that needs to be modified in the data storage area to the snapshot area, or write new data into the snapshot area, thereby storing in the solid state hard disk. Snapshots are directly performed on the media to implement data protection. Because the snapshot area is transparent to the upper layer and cannot be accessed, virus injection can be prevented, and the reliability and virus defense capability of the storage medium can be improved. If key data is snapshotted to the snapshot area, the key can be protected. Data security improves data protection.
  • FIG. 11 is a schematic structural diagram of a second embodiment of a solid state drive according to the present invention.
  • the controller of the solid state drive may further include: a snapshot area mapping module 1024. And when the data modification module 1022 modifies the original data of the data storage area to the new data in the data modification request, recording snapshot incremental data of the original data in the snapshot area.
  • the snapshot area mapping module 1024 is further configured to: when the snapshot module 1021 describes the data modification request New data is written to the snapshot area of the storage medium, and when snapshot incremental data is obtained, the snapshot incremental data of the new data is recorded in the location of the storage unit of the snapshot area and the original data is in the data storage.
  • the controller 102 may further include: a snapshot recovery module 1025, configured to: if the data modification module 1022 modifies the original data of the data storage area into new data in the data modification request, when needed When the snapshot is restored, the snapshot incremental data of the original data that needs to be restored in the data storage area is obtained from the snapshot area according to the first mapping relationship; the snapshot recovery module 1025 is further configured to: if the snapshot module 1021 The new data in the data modification request is written to the snapshot area of the storage medium to obtain snapshot incremental data. When snapshot recovery is required, according to the second mapping relationship, from the data storage area. Obtaining the original data of the snapshot delta data in the storage unit in the snapshot area that needs to be restored.
  • a snapshot recovery module 1025 configured to: if the data modification module 1022 modifies the original data of the data storage area into new data in the data modification request, when needed When the snapshot is restored, the snapshot incremental data of the original data that needs to be restored in the data storage area is obtained from the snapshot area according to the first mapping relationship
  • the snapshot module 1021 of the controller is further configured to: if the snapshot area 1032 is full, and the data storage area 1031 has snapshot incremental data that needs to be backed up to the snapshot area 1032, issue a notification that the snapshot area 1032 is full; or delete the earliest save Snapshot delta data into snapshot area 1032.
  • the snapshot module may back up the original data that needs to be modified to the snapshot area, and then modify the original data of the storage unit to new data, or
  • the new data is written into the snapshot area, and the original data of the data storage area is kept unchanged, so that the snapshot is directly performed on the SSD storage medium to implement data protection;
  • the snapshot recovery module can perform snapshot recovery according to the mapping relationship of the data storage area snapshot area;
  • the snapshot area is transparent to the upper layer and cannot be accessed. Therefore, virus injection can be prevented, and the reliability of the storage medium and the virus defense capability can be improved. If key data is snapshotted to the snapshot area, the security of key data can be protected and the data protection capability can be improved.
  • the snapshot area 1032 may also be a redundant area.
  • the storage medium 103 may include a data storage area and a redundant area.
  • the redundant area is generally used to improve the performance of the storage medium, and may be used to store system information, and may also include bad Blocks retain blocks, blank blocks, and so on.
  • the data storage area stores the original data
  • the blank blocks of the redundant area are in the unused storage unit, which can be used to store the snapshot incremental data.
  • the receiving module 1020 is configured to receive a data modification request, where the data modification request includes new data to be written, where the snapshot area of the storage medium is a redundant area;
  • the snapshot module 1021 is configured to obtain, according to the address of the storage unit that needs to be modified in the data storage area of the storage medium 103 carried in the data modification request received by the receiving module 1020, and obtain the original data that needs to be modified from the data storage area, Backing up the original data to the redundant area of the storage medium 103 to obtain snapshot incremental data; or, for writing new data in the data modification request received by the receiving module 1020 to the storage medium 103
  • the redundant area the snapshot incremental data is obtained;
  • the data modification module 1022 is configured to: when the snapshot module 1021 backs up the original data to the redundant area of the storage medium 103, and obtains the snapshot incremental data, the original data storage area
  • the data is modified to the new data in the data modification request.
  • the redundant area replaces the snapshot area to implement the above snapshot method. It can store snapshot incremental data and system information, and realize redundancy of redundant areas, which can protect data security while balancing system performance.
  • the controller of the SSD may further include: a redundancy area mapping module, configured to: when the data modification module 1022 modifies the original data of the data storage area, when the snapshot area of the storage medium is a redundant area When the new data in the request is modified for the data, recording snapshot incremental data of the original data in a location of a storage unit of the redundant area and the new data in a storage unit of the data storage area a first mapping relationship between the locations, and setting a state of the storage unit in the redundant area for storing the original data to a snapshot state; the redundant area mapping module is further configured to: when the snapshot module 1021 sets the data Writing the new data in the modification request to the redundant area of the storage medium, and when the snapshot incremental data is obtained, recording the location and location of the snapshot incremental data of the new data in the storage unit of the redundant area Determining, in a second mapping relationship between the locations of the original data in the storage unit of the data storage area, and setting a state of the storage unit in the redundant area for storing the new data as a snapshot .
  • the snapshot recovery module 1025 is configured to modify the original data of the data storage area to be new in the data modification request, when the snapshot area of the storage medium is a redundant area. Data, when snapshot recovery is required, obtaining snapshot incremental data of the original data that needs to be restored in the data storage area from the redundant area according to the first mapping relationship; the snapshot recovery module 1025 is further configured to: The snapshot module 1021 writes the new data in the data modification request to the redundant area of the storage medium to obtain snapshot incremental data. When the snapshot recovery is required, according to the second mapping relationship, The original data of the snapshot delta data in the storage unit that needs to be restored in the redundant area is obtained from the data storage area.
  • the snapshot area of the storage medium is a redundant area
  • the storage space of the redundant area is limited, and other data cannot be stored after being filled, so the snapshot module 1021 of the controller is also used for the redundant area.
  • Full and there is snapshot incremental data that needs to be backed up to the redundant area in the data storage area, and the notification that the redundant area is full is issued; or the data stored in the redundant area is deleted first, and the data can be fast. According to the incremental data, it may not be snapshot incremental data, but other expired data.
  • the redundant area replaces the snapshot area to implement the above snapshot method, which can store snapshot incremental data and system information, realize redundancy of redundant areas, and protect data security while balancing system performance.
  • the data modification request includes new data to be written; obtaining an address of the storage unit that needs to be modified in the data storage area of the storage medium carried in the data modification request, and obtaining the modification from the data storage area Raw data, backing up the original data to a snapshot area of the storage medium, obtaining snapshot incremental data, reading data on a block containing the original data into a cache, modifying the original data, and erasing Rewriting the data on the modified block, except for the data on the block on the storage medium;
  • the difference from the previous method embodiment is that the embodiment may not include "or, the new data in the data modification request is written to the snapshot area of the storage medium to obtain snapshot incremental data”. step.
  • the solid state hard disk includes: an interface connected to an external device, a controller connected to the interface, and a storage medium connected to the controller.
  • the controller includes: a receiving module and a snapshot module;
  • a receiving module configured to receive a data modification request, where the data modification request includes new data to be written
  • a snapshot module configured to acquire, according to an address of a storage unit that needs to be modified in a data storage area of the storage medium carried in the data modification request received by the receiving module, to obtain original data that needs to be modified from the data storage area, The original data is backed up to the snapshot area of the storage medium to obtain snapshot incremental data;
  • a data modification module configured to: when the snapshot module backs up the original data to the snapshot area of the storage medium, and obtain the snapshot incremental data, read the data on the block block containing the original data into the cache, and repair The original data is changed, the data on the block on the storage medium is erased, and the modified data on the block is rewritten.
  • the snapshot module of this embodiment may not include "or, the new data in the data modification request is written to the snapshot area of the storage medium, and the snapshot is increased.
  • the action of the quantity data may be included; and the foregoing storage medium includes: FLASH, ROM,
  • RAM random access memory

Abstract

Provided are a snapshot method and solid state drive. The snapshot method comprises: receiving a data change request, wherein the data change request comprises new data (11) to be written; according to the address of a storage unit to be changed in a data storage area of a storage medium carried in the data change request, acquiring raw data to be changed from the data storage area and backing up the raw data to a snapshot area of the storage medium to obtain snapshot incremental data, and reading the data in the block including the raw data in a cache, changing the raw data and clearing up the data in the block on the storage medium, and rewriting the changed data in the block; or writing the new data in the data change request to the snapshot area in the storage medium to obtain the snapshot incremental data (12). The method allows direct snapshot on the storage medium to realize data protection and recovery. The snapshot area is transparent to an upper layer and is inaccessible, thereby preventing virus injection and improving the reliability and anti-virus capability of the storage medium.

Description

快照方法和固态硬盘  Snapshot method and solid state drive
本申请要求于 10年 12月 14日提交中国专利局、 申请号为  This application is required to be submitted to the Chinese Patent Office on December 14, 2010. The application number is
201010601955.4、 发明名称为 "快照方法和固态硬盘" 的中国专利申请的优 先权, 其全部内容通过引用结合在本申请中。 技术领域 201010601955.4, the priority of the Chinese patent application entitled "Snapshot Method and Solid State Drive", the entire contents of which are hereby incorporated by reference. Technical field
本发明涉及存储技术领域, 特别涉及一种快照方法和固态硬盘。 背景技术  The present invention relates to the field of storage technologies, and in particular, to a snapshot method and a solid state hard disk. Background technique
固态硬盘 ( Solid State Disk; 简称: SSD ) 由控制单元与存储单元组 成。 存储单元多采用非易失性的闪存 (Flash ) 芯片, 或者采用同步动态随 机存耳又存储器 ( Synchronous Dynamic Random Access Memory; 简称: Solid State Disk (SSD) consists of a control unit and a storage unit. The storage unit mostly uses a non-volatile flash memory (Flash) chip, or a synchronous dynamic random access memory (Synchronous Dynamic Random Access Memory;
SDRAM ) 。 SSD不具有机械转动装置, 具有读写性能高、 抗震能力强、 电 源开销小等优势, 广泛应用于军事、 车载、 工控、 视频监控、 网络监控、 网络终端、 电力、 医疗、 航空、 导航设备等领域。 由于 SSD突出的输入输 出 (Input Output; 简称: 10 )处理能力, 经常应用于中高端存储领域。 SDRAM). SSD does not have mechanical rotating device, and has the advantages of high read/write performance, strong seismic resistance, and low power consumption. It is widely used in military, vehicle, industrial control, video surveillance, network monitoring, network terminals, power, medical, aviation, navigation equipment, etc. field. Due to the SSD's outstanding input and output (Input Output; referred to as: 10) processing power, it is often used in the middle and high-end storage areas.
存^"网络行业协会 ( Storage Networking Industry Association; 简称: SNIA )对快照 (Snapshot ) 的定义是: 关于指定数据集合的一个完全可用 拷贝, 该拷贝包括相应数据在某个时间点 (例如: 拷贝开始的时间点) 的 映像。 快照可以是所表示的数据的一个副本或复制品。 快照的作用是能够 进行在线数据恢复, 当存储设备发生应用故障或者文件损坏时, 可以利用 快照进行及时数据恢复, 将数据恢复成快照产生时间点的状态。 快照实现 的方法有艮多种, 例如: 即写即拷 、 分割镜像快照等。  Storage Networking Industry Association (SNIA) defines Snapshot as: A fully available copy of a specified data set, including the corresponding data at a certain point in time (for example: copy start) The snapshot can be a copy or a copy of the represented data. The role of the snapshot is to enable online data recovery. When the storage device has an application failure or file corruption, snapshots can be used for timely data recovery. Restoring data to the state at which the snapshot was generated at a point in time. There are many ways to implement snapshots, such as write-and-copy, split mirror snapshots, and so on.
目前的快照技术基于网络的存储系统级别的 , 在存储系统的存储服务 器上可以采用快照技术提升数据可靠性, 利用快照可以进行在线数据恢复, 例如: 当存储服务器发生应用故障或文件损坏时可以进行数据恢复, 将数 据恢复成快照产生时间点的状态。 发明人在实现本发明的过程中发现现有 技术没有基于 SSD的快照技术, 造成 SSD的可靠性低, 病毒攻击防御功 能差, 数据保护能力弱。 发明内容 The current snapshot technology is based on the storage system level of the network. Snapshot technology can be used to improve data reliability on the storage server of the storage system. Online data recovery can be performed by using snapshots. For example, when the storage server has an application failure or file corruption, it can be performed. Data recovery, will count According to the state of the point in time when the snapshot is restored. The inventor found that the prior art does not have an SSD-based snapshot technology in the process of implementing the present invention, resulting in low reliability of the SSD, poor virus attack defense function, and weak data protection capability. Summary of the invention
本发明实施例中提供的一种快照方法和固态硬盘, 达到了提高存储介 质的可靠性和病毒防御能力, 增强存储介质的数据保护能力的技术效果。  A snapshot method and a solid state hard disk provided in the embodiments of the present invention achieve the technical effects of improving the reliability and virus defense capability of the storage medium and enhancing the data protection capability of the storage medium.
为实现上述目的, 本发明实施例中提供了如下技术方案:  To achieve the above objective, the following technical solutions are provided in the embodiments of the present invention:
一种快照方法, 包括:  A snapshot method, including:
接收数据修改请求, 所述数据修改请求包括待写入的新数据; 根据数据修改请求中携带的存储介质的数据存储区中需要修改的存储 单元的地址, 从所述数据存储区中获取需要修改的原数据, 将所述原数据 备份到所述存储介质的快照区, 得到快照增量数据; 将包含所述原数据的 块上的数据读入緩存, 修改所述原数据, 擦除存储介质上所述块上的数据, 将修改后的所述块上的数据重新写入; 或者,  Receiving a data modification request, the data modification request includes new data to be written; obtaining an address of the storage unit that needs to be modified in the data storage area of the storage medium carried in the data modification request, and obtaining the modification from the data storage area Raw data, backing up the original data to a snapshot area of the storage medium to obtain snapshot incremental data; reading data on the block containing the original data into a cache, modifying the original data, erasing the storage medium Data on the block, rewriting the data on the modified block; or
将所述数据修改请求中的所述新数据写入到所述存储介质的快照区, 得到快照增量数据。  Writing the new data in the data modification request to a snapshot area of the storage medium to obtain snapshot incremental data.
一种快照方法, 包括:  A snapshot method, including:
接收数据修改请求, 所述数据修改请求包括待写入的新数据; 根据数据修改请求中携带的存储介质的数据存储区中需要修改的存储 单元的地址, 从所述数据存储区中获取需要修改的原数据, 将所述原数据 备份到所述存储介质的快照区, 得到快照增量数据; 将包含所述原数据的 块上的数据读入緩存, 修改所述原数据, 擦除存储介质上所述块上的数据, 将修改后的所述块上的数据重新写入。  Receiving a data modification request, the data modification request includes new data to be written; obtaining an address of the storage unit that needs to be modified in the data storage area of the storage medium carried in the data modification request, and obtaining the modification from the data storage area Raw data, backing up the original data to a snapshot area of the storage medium to obtain snapshot incremental data; reading data on the block containing the original data into a cache, modifying the original data, erasing the storage medium The data on the block is rewritten to the modified data on the block.
一种固态硬盘, 包括: 与外部设备连接的接口、 与所述接口连接的控 制器和与所述控制器连接的存储介廣, 其特征在于, 所述控制器包括: 接 收模块和快照模块; A solid state hard disk, comprising: an interface connected to an external device, a controller connected to the interface, and a storage medium connected to the controller, wherein the controller comprises: Receive module and snapshot module;
接收模块, 用于接收数据修改请求, 所述数据修改请求包括待写入的 新数据;  a receiving module, configured to receive a data modification request, where the data modification request includes new data to be written;
快照模块, 用于根据所述接收模块接收的所迷数据修改请求中携带的 存储介质的数据存储区中需要修改的存储单元的地址, 从所述数据存储区 中获取需要修改的原数据, 将所述原数据备份到所述存储介质的快照区, 得到快照增量数据; 或者, 用于将所述接收模块接收的所述数据修改请求 中的新数据写入到所述存储介质的快照区, 得到快照增量数据;  a snapshot module, configured to: according to the address of the storage unit that needs to be modified in the data storage area of the storage medium carried in the data modification request received by the receiving module, obtain the original data to be modified from the data storage area, and The original data is backed up to the snapshot area of the storage medium to obtain snapshot incremental data; or, the new data in the data modification request received by the receiving module is written to the snapshot area of the storage medium. , get snapshot incremental data;
数据修改模块, 用于当所述快照模块将所述原数据备份到所述存储介 质的快照区, 得到快照增量数据时, 将包含所述原数据的块上的数据读入 緩存, 修改所述原数据, 擦除存储介廣上所述块上的数据, 将修改后的所 述块上的数据重新写入。  a data modification module, configured to: when the snapshot module backs up the original data to a snapshot area of the storage medium, and obtain snapshot incremental data, read data on the block including the original data into a cache, and modify the Describe the original data, erase the data on the block on the storage medium, and rewrite the data on the modified block.
本发明实施例中提供的快照方法和固态硬盘, 通过接收数据修改请求, 所述数据修改请求包括待写入的新数据; 根据数据修改请求中携带的存储 介质的数据存储区中需要修改的存储单元的地址, 从所述数据存储区中获 取需要修改的原数据, 将所述原数据备份到所述存储介质的快照区, 得到 快照增量数据, 将所述数据存储区的所述原数据修改为所述数据修改请求 中的所述新数据, 或者, 将所述数据修改请求中的所述新数据写入到所述 存储介质的快照区, 得到快照增量数据, 可以在存储介质上直接进行快照, 实现数据的保护与恢复; 由于快照区对上层透明、 无法访问, 可以防止病 毒注入, 从而可以提高存储介质的可靠性和病毒防御能力, 如果将关键数 据快照到快照区, 可以保护关键数据的安全, 提高了数据保护能力。 附图说明  The snapshot method and the solid state hard disk provided in the embodiment of the present invention receive a data modification request, where the data modification request includes new data to be written; and the storage that needs to be modified in the data storage area of the storage medium carried in the data modification request An address of the unit, obtaining original data to be modified from the data storage area, backing up the original data to a snapshot area of the storage medium, obtaining snapshot incremental data, and using the original data of the data storage area Modifying to the new data in the data modification request, or writing the new data in the data modification request to a snapshot area of the storage medium to obtain snapshot incremental data, which may be on a storage medium Snapshots are used to protect and recover data. Because the snapshot area is transparent to the upper layer and cannot be accessed, virus injection can be prevented. This improves the reliability and virus defense of the storage medium. If the critical data is snapshotted to the snapshot area, it can be protected. The security of key data improves data protection. DRAWINGS
为了更清楚地说明本发明或现有技术中的技术方案, 下面将对实施例 或现有技术描述中所需要使用的附图作简单地介绍, 显而易见地, 下面描 述中的附图仅仅是本发明的一些实施例, 对于本领域普通技术人员来讲, 在不付出创造性劳动的前提下, 还可以根据这些附图获得其他的附图。 In order to more clearly illustrate the present invention or the technical solutions in the prior art, the drawings to be used in the embodiments or the description of the prior art will be briefly described below, and obviously, the following description will be made. The drawings are only some of the embodiments of the present invention, and those skilled in the art can obtain other drawings based on these drawings without any creative work.
图 1为本发明快照方法第一实施例的流程图;  1 is a flowchart of a first embodiment of a snapshot method according to the present invention;
图 2为本发明快照方法第一实施例中 SSD的存储单元划分的示意图; 图 3为本发明快照方法第二实施例的流程图;  2 is a schematic diagram of storage unit division of an SSD in a first embodiment of a snapshot method according to the present invention; FIG. 3 is a flowchart of a second embodiment of a snapshot method according to the present invention;
图 4为本发明快照方法第二实施例中 SSD的存储单元初始状态的示意 图;  4 is a schematic diagram of an initial state of a storage unit of an SSD in a second embodiment of the snapshot method of the present invention;
图 5为本发明快照方法第二实施例中 SSD的存储单元启动快照的示意 图;  FIG. 5 is a schematic diagram of a snapshot of a storage unit of an SSD in a second embodiment of the snapshot method of the present invention; FIG.
图 6为本发明快照方法第二实施例中 SSD的存储单元快照后的示意图; 图 7为本发明快照方法第二实施例中 SSD的快照区映射表的示意图; 图 8为本发明快照方法第三实施例的流程图;  FIG. 6 is a schematic diagram of a snapshot area of an SSD in a second embodiment of the snapshot method according to the second embodiment of the present invention; FIG. 8 is a schematic diagram of a snapshot area mapping table of the SSD in the second embodiment of the present invention; a flow chart of three embodiments;
图 9为本发明实施例中 SSD的冗余区映射表的示意图;  9 is a schematic diagram of a redundant area mapping table of an SSD according to an embodiment of the present invention;
图 10为本发明固态硬盘第一实施例的结构示意图;  10 is a schematic structural view of a first embodiment of a solid state drive according to the present invention;
图 11为本发明固态硬盘第二实施例的结构示意图。 具体实施方式 下面将结合本发明中的附图, 对本发明中的技术方案进行清楚、 完整 地描述, 显然, 所描述的实施例仅是本发明一部分实施例, 而不是全部的 实施例。 基于本发明中的实施例, 本领域普通技术人员在没有做出创造性 劳动的前提下所获得的所有其他实施例, 都属于本发明保护的范围。  11 is a schematic structural view of a second embodiment of a solid state drive according to the present invention. The technical solutions in the present invention will be clearly and completely described in conjunction with the drawings in the present invention. It is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
图 1为本发明快照方法第一实施例的流程图, 如图 1所示, 该快照方法 包括:  FIG. 1 is a flowchart of a first embodiment of a snapshot method according to the present invention. As shown in FIG. 1, the snapshot method includes:
步骤 11、 接收数据修改请求, 所述数据修改请求包括待写入的新数据; 可以预先将存储介质的存储单元划分为数据存储区与快照区, 一般情 况下, 数据存储区用于存储原数据, 快照区用于存储原数据的快照增量数 据; 或者。 当存储介质接收到数据修改请求后, 可以启动快照; Step 11: Receive a data modification request, where the data modification request includes new data to be written; the storage unit of the storage medium may be divided into a data storage area and a snapshot area in advance, and generally, the data storage area is used to store the original data. , the snapshot area is used to store the number of snapshot increments of the original data According to; or. After the storage medium receives the data modification request, the snapshot can be started;
其中, 数据修改请求中可以包括数据存储区中需要修改的存储单元的 地址或逻辑编号, 以及待写入的新数据。  The data modification request may include an address or a logical number of a storage unit that needs to be modified in the data storage area, and new data to be written.
步驟 12、 根据数据修改请求中携带的存储介质的数据存储区中需要修 改的存储单元的地址, 从所述数据存储区中获取需要修改的原数据, 将所 述原数据备份到所述存储介质的快照区, 得到快照增量数据, 将包含所述 原数据的块(Block )上的数据读入緩存, 修改所述原数据, 擦除存储介质 上所述块上的数据, 将修改后的所述块上的数据重新写入; 或者, 将所述 数据修改请求中的所述新数据写入到所述存储介质的快照区, 得到快照增 量数据。  Step 12: Obtain original data to be modified from the data storage area according to an address of a storage unit that needs to be modified in a data storage area of the storage medium carried in the data modification request, and back up the original data to the storage medium. The snapshot area, the snapshot increment data is obtained, the data on the block containing the original data is read into the buffer, the original data is modified, the data on the block on the storage medium is erased, and the modified data is modified. The data on the block is rewritten; or the new data in the data modification request is written to the snapshot area of the storage medium to obtain snapshot incremental data.
上述的步骤 11和步骤 12可以通过存储介质内部的控制器来执行, 本实 施例中, 控制器可以将需要修改的存储单元中的原数据备份到存储介质的 快照区或将修改的新数据写入快照区, 可以实现数据保护与恢复; 由于快 照区对上层透明、 无法访问, 可以防止病毒注入, 提高了存储介质的可靠 性和病毒防御能力, 如果将关键数据快照到快照区, 可以保护关键数据的 安全, 提高了数据保护能力。  The foregoing steps 11 and 12 can be performed by a controller inside the storage medium. In this embodiment, the controller can back up the original data in the storage unit that needs to be modified to the snapshot area of the storage medium or write the modified new data. In the snapshot area, data protection and recovery can be implemented. Because the snapshot area is transparent to the upper layer and cannot be accessed, virus injection can be prevented, and the reliability and virus defense capability of the storage medium can be improved. If key data is snapshotted to the snapshot area, the key can be protected. Data security improves data protection.
其中, 本发明实施例中的存储介质可以为多种, 以存储介质为 SSD为 例, 图 2为本发明快照方法第一实施例中 SSD的存储单元划分的示意图, 如 图 2所示, SSD按照一定规则将存储单元划分为数据存储区 21和快照区 22, 一般情况下, 数据存储区 21存储原数据, 而快照区 22则存储快照增量数据。  The storage medium in the embodiment of the present invention may be a plurality of types, and the storage medium is an SSD as an example. FIG. 2 is a schematic diagram of the storage unit division of the SSD in the first embodiment of the snapshot method according to the present invention. The storage unit is divided into a data storage area 21 and a snapshot area 22 according to a certain rule. In general, the data storage area 21 stores original data, and the snapshot area 22 stores snapshot incremental data.
其中, 步骤 12可以包括以下情况:  Wherein, step 12 may include the following situations:
情况一、 根据数据修改请求中携带的存储介质的数据存储区中需要修 改的存储单元的地址, 从所述数据存储区中获取需要修改的原数据, 将所 述原数据备份到所述存储介质的快照区, 得到快照增量数据; 将包含所述 原数据的块上的数据读入緩存, 修改所述原数据, 擦除存储介质上所述块 上的数据, 将修改后的所述块上的数据重新写入。 对于固态硬盘来说, 在这种情况下, 因为需要修改的原数据, 必须将 数据存储区中包含所述原数据的块上的数据读入緩存, 修改所述原数据, 擦除数据存储区上所述块上的数据 , 将修改后的所述块上的数据重新写入 数据存储区。 情况二、 将所述数据修改婧求中的所述新数据写入到所述存 储介质的快照区, 得到快照增量数据。 Case 1: According to the address of the storage unit in the data storage area of the storage medium carried in the data modification request, the original data to be modified is obtained from the data storage area, and the original data is backed up to the storage medium. The snapshot area, the snapshot increment data is obtained; the data on the block containing the original data is read into the cache, the original data is modified, the data on the block on the storage medium is erased, and the modified block is The data on it is rewritten. For a solid state drive, in this case, because the original data needs to be modified, the data on the block containing the original data in the data storage area must be read into the cache, the original data is modified, and the data storage area is erased. The data on the block is rewritten into the data storage area by the modified data on the block. Case 2: writing the new data in the data modification request to a snapshot area of the storage medium to obtain snapshot incremental data.
对于固态硬盘来说, 在这种情况下, 对于快照区来说, 快照区是空白 的, 可以直接写入而无需擦除的动作。  For SSDs, in this case, for the snapshot area, the snapshot area is blank and can be written directly without erasing.
下面介绍情况一对应的具体实施例, 如下:  The following describes a specific embodiment of the case one, as follows:
图 3为本发明快照方法第二实施例的流程图, 如图 3所示, 该方法 包括:  FIG. 3 is a flowchart of a second embodiment of a snapshot method according to the present invention. As shown in FIG. 3, the method includes:
步驟 301、接收数据修改请求,所述数据修改请求包括待写入的新数据; 步骤 302、根据数据修改请求中携带的存储介质的数据存储区中需要修 改的存储单元的地址, 从所述数据存储区中获取需要修改的原数据, 将所 述原数据备份到所述存储介质的快照区, 得到快照增量数据; 将包含所述 原数据的块(Block )上的数据读入緩存, 修改所述原数据, 擦除存储介质 上所述块上的数据, 将修改后的所述块上的数据重新写入;  Step 301: Receive a data modification request, where the data modification request includes new data to be written. Step 302: According to the data storage area of the storage medium carried in the data modification request, the address of the storage unit that needs to be modified, from the data. Obtaining the original data to be modified in the storage area, backing up the original data to the snapshot area of the storage medium, and obtaining snapshot incremental data; reading the data on the block containing the original data into the cache, and modifying The original data, erasing data on the block on the storage medium, and rewriting the modified data on the block;
步骤 303、记录所述原数据的快照增量数据在所述快照区的存储单元的 位置与所述新数据在所述数据存储区的存储单元的位置之间的映射关系即 第一映射关系;  Step 303: Record a mapping relationship between the location of the snapshot data of the original data in the storage unit of the snapshot area and the location of the new data in the storage unit of the data storage area, that is, the first mapping relationship;
例如: 存储介质中可以包括快照区映射表, 在快照区映射表中可以记 录数据存储区与快照区的映射关系。 在情况一下, 快照区映射表中可以记 录原数据的快照增量数据在快照区的存储单元的位置 (例如: 某个快照区 的存储单元的地址或编号等表示位置的信息) 与新数据在数据存储区的存 储单元的位置之间的映射关系即第一映射关系; 当数据存储区某个存储单 元在快照区存在快照增量数据时, 快照区映射表中存储与该存储单元对应 的快照增量数据所在的存储单元的地址或者编号, 当数据存储区某个存储 单元在快照区没有快照增量数据时, 快照区映射表中该存储单元对应的区 域设置可以为空, 例如: 可以用 "N/A" 表示。 For example, the storage medium may include a snapshot area mapping table, and the mapping relationship between the data storage area and the snapshot area may be recorded in the snapshot area mapping table. In the case, the snapshot area mapping table can record the location of the snapshot data of the original data in the storage unit of the snapshot area (for example: the address or number of the storage unit of a snapshot area, etc.) and the new data. The mapping relationship between the locations of the storage units of the data storage area is the first mapping relationship. When a storage unit of the data storage area has snapshot incremental data in the snapshot area, the snapshot area mapping table stores a snapshot corresponding to the storage unit. The address or number of the storage unit where the incremental data is located, when the data storage area is stored When there is no snapshot increment data in the snapshot area, the area setting corresponding to the storage unit in the snapshot area mapping table may be empty, for example: It can be represented by "N/A".
在本实施例的情况下, 当需要进行快照恢复时, 根据所述原数据的快 照增量数据在所述快照区的存储单元的位置与所迷新数据在所述数据存储 区的存储单元的位置之间的映射关系即第一映射关系, 从所述快照区中获 取所述数据存储区中需要恢复的原数据的快照增量数据。  In the case of the embodiment, when the snapshot recovery is required, the location of the storage unit in the snapshot area according to the snapshot incremental data of the original data and the new data in the storage unit of the data storage area The mapping relationship between the locations is the first mapping relationship, and the snapshot incremental data of the original data that needs to be restored in the data storage area is obtained from the snapshot area.
步骤 304、 若所述快照区已满, 且所述数据存储区存在需要备份到所述 快照区的快照增量数据时, 发出所述快照区已满的通知或删除最早存入所 述快照区的快照增量数据。  Step 304: If the snapshot area is full, and the data storage area has snapshot incremental data that needs to be backed up to the snapshot area, issue a notification that the snapshot area is full or delete the earliest storage into the snapshot area. Snapshot incremental data.
快照区存储满后, 可采用多种方法进行处理, 例如: 删除快照区最早 存入的快照增量数据, 或者通知用户快照区已满, 无法再进行存储等, 根 据具体应用场景可以具体设定。  After the snapshot area is full, you can use various methods to process the data. For example, you can delete the snapshot data that is stored in the snapshot area, or notify the user that the snapshot area is full. .
图 4为本发明快照方法第二实施例中 SSD的存储单元初始状态的示意 图, 如图 4所示, 预先将该 SSD的存储单元划分为数据存储区和快照区后, 可以假设数据存储区的存储单元的逻辑编号为 "0-N" , 快照区的存储单元 的逻辑编号为 "0-M" ; 数据存储区存有数据 'ΌχΑΑ-ΟχΧΥ", 快照区各个存 储单元的初始状态可以为空 (Ν/Α ) , 即未存任何数据。  4 is a schematic diagram of an initial state of a storage unit of an SSD in a second embodiment of the snapshot method of the present invention. As shown in FIG. 4, after the storage unit of the SSD is divided into a data storage area and a snapshot area in advance, the data storage area may be assumed. The logical number of the storage unit is "0-N", the logical number of the storage unit in the snapshot area is "0-M"; the data storage area has the data 'ΌχΑΑ-ΟχΧΥ", and the initial state of each storage unit in the snapshot area can be empty. (Ν/Α), that is, no data is saved.
图 5为本发明快照方法第二实施例中 SSD的存储单元启动快照的示意 图, 如图 5所示, 假设在某一时刻启动快照, 在该时刻后修改的数据存储区 的原数据可以在快照区进行备份, 新数据在数据存储区则直接修改。 示例 性地, 如果 SSD接收到数据修改倚求, 数据修改请求中包括需要修改的存 储单元 "3"和修改的新数据' OxDF", 如图 5, 则可以得到: 数据存储区的存储 单元" 3"中的原数据' OxDD"需要修改为新数据" OxDF "。 图 6为本发明快照方 法第二实施例中 SSD的存储单元快照后的示意图, 如图 6所示, 先将原数据 "OxDD"备份到快照区的存储单元' Ό", 然后将数据存储区的存储单元" 3"中的 原数据 "OxDD"修改为新数据" OxDF "。 由于 SSD存在均衡与回收等多种策略, SSD的逻辑块地址 ( logical block address; 简称: I_BA ) 与物理块地址( physical block address; 简 称: PBA ) 的映射关系有别传统硬盘, 可以自定义映射关系, 快照映射关 系的实现也不局限于某种算法, 本发明实施例仅列举一种实例, 对数据存 储区增设一级快照区的映射, 即快照区映射表, 快照区映射表中可以数据 存储区与快照区的各个存储单元的位置之间的映射关系。 若数据存储区的 某个存储单元在快照区无原数据备份或新数据写入等形成快照增量数据, 可以将该存储单元在快照区映射表中对应的区域设置为空(N/A ) , 若该存 储单元在快照区存在快照增量数据, 则可以将该存储单元在快照区映射表 中对应的区域设置为对应的快照增量数据所在的存储单元。 图 7为本发明快 照方法第二实施例中 SSD的快照区映射表的示意图, 如图 7所示, 将数据存 储区的存储单元" 3"中的原数据' OxDD"备份到快照区的存储单元 "0"时,将快 照区映射表中数据存储区的存储单元" 3"对应的区域设置为快照区的存储单 元" 0"。 FIG. 5 is a schematic diagram of a snapshot of a storage unit of an SSD in a second embodiment of the snapshot method according to the present invention. As shown in FIG. 5, it is assumed that a snapshot is started at a certain time, and the original data of the modified data storage area may be in the snapshot after the moment. The area is backed up and the new data is modified directly in the data store. Exemplarily, if the SSD receives the data modification request, the data modification request includes the storage unit "3" to be modified and the modified new data 'OxDF", as shown in FIG. 5, the storage unit of the data storage area can be obtained: The original data 'OxDD' in 3" needs to be modified to the new data "OxDF". 6 is a schematic diagram of a storage unit snapshot of an SSD in a second embodiment of the snapshot method of the present invention. As shown in FIG. 6, the original data "OxDD" is first backed up to the storage unit 'Ό' of the snapshot area, and then the data storage area is used. The original data "OxDD" in the storage unit "3" is modified to the new data "OxDF". The mapping between the logical block address (I_BA) and the physical block address (PBA) of the SSD is different from the traditional hard disk, and the mapping can be customized. The implementation of the snapshot mapping relationship is not limited to an algorithm. The embodiment of the present invention only enumerates an example, and adds a mapping of the first-level snapshot area to the data storage area, that is, the snapshot area mapping table, and the data in the snapshot area mapping table. The mapping relationship between the storage area and the location of each storage unit of the snapshot area. If a storage unit in the data storage area does not have original data backup or new data write in the snapshot area to form snapshot incremental data, the corresponding area of the storage unit in the snapshot area mapping table may be set to null (N/A). If the storage unit has snapshot incremental data in the snapshot area, the corresponding area in the snapshot area mapping table may be set to the storage unit where the corresponding snapshot incremental data is located. 7 is a schematic diagram of a snapshot area mapping table of an SSD in a second embodiment of the snapshot method of the present invention. As shown in FIG. 7, the original data 'OxDD' in the storage unit "3" of the data storage area is backed up to the storage of the snapshot area. When the unit is "0", the area corresponding to the storage unit "3" of the data storage area in the snapshot area mapping table is set as the storage unit "0" of the snapshot area.
由于,当数据存储区的存储单元由' OxDD"变为' OxDF"后,原数据 "OxDD" 被保存于快照区域的存储单元' Ό"内, 快照区映射表中记录了该映射关系, 当需要进行快照恢复时,可以根据快照区映射表从快照区将 "OxDD"由快照 区的存储单元' Ό"内读出, 恢复到数据存储区的存储单元" 3"。  Since, when the storage unit of the data storage area is changed from 'OxDD' to 'OxDF', the original data "OxDD" is stored in the storage unit 'Ό' of the snapshot area, and the mapping relationship is recorded in the snapshot area mapping table. When snapshot recovery is required, the "OxDD" can be read from the storage area 'Ό' of the snapshot area from the snapshot area according to the snapshot area mapping table, and restored to the storage unit "3" of the data storage area.
本实施例中, 可以将需要修改的存储单元中的原数据备份到存储介质 的快照区或将修改的新数据写入快照区, 可以实现数据保护与恢复; 由于 快照区对上层透明、 无法访问, 可以防止病毒注入, 提高了存储介质的可 靠性和病毒防御能力, 如果将关键数据快照到快照区, 可以保护关键数据 的安全, 提高了数据保护能力。  In this embodiment, the original data in the storage unit that needs to be modified may be backed up to the snapshot area of the storage medium or the modified new data is written into the snapshot area, and data protection and recovery may be implemented; the snapshot area is transparent to the upper layer and cannot be accessed. It can prevent virus injection, improve the reliability of storage media and virus defense. If you snapshot critical data to the snapshot area, you can protect the security of key data and improve data protection.
下面介绍情况二对应的具体实施例, 如下:  The following describes the specific embodiment corresponding to Case 2, as follows:
图 8为本发明快照方法第三实施例的流程图, 如图 8所示, 该方法 包括: 步驟 801、接收数据修改请求,所述数据修改请求包括待写入的新数据; 步骤 802、将所述数据修改请求中的所述新数据写入到所述存储介质的 快照区, 得到快照增量数据; FIG. 8 is a flowchart of a third embodiment of a snapshot method according to the present invention. As shown in FIG. 8, the method includes: Step 801: Receive a data modification request, where the data modification request includes new data to be written. Step 802: Write the new data in the data modification request to a snapshot area of the storage medium, to obtain a snapshot increase. Quantity data
步驟 803、记录所述新数据的快照增量数据在所述快照区的存储单元的 位置与所述原数据在所述数据存储区的存储单元的位置之间的映射关系即 第二映射关系;  Step 803: Record a mapping relationship between the location of the storage unit of the new data and the location of the original data in the storage unit of the data storage area, that is, the second mapping relationship;
例如: 存储介质中可以包括快照区映射表, 在快照区映射表中可以记 录数据存储区与快照区的映射关系。 在情况二下, 快照区映射表中可以记 录新数据的快照增量数据在快照区的存储单元的位置与原数据在数据存储 区的存储单元的位置之间的映射关系即第二映射关系。 如果数据存储区某 个存储单元在快照区存在快照增量数据, 快照区映射表中存储与该存储单 元对应的快照增量数据所在的存储单元的地址或者编号, 如果数据存储区 某个存储单元在快照区没有快照增量数据, 快照区映射表中该存储单元对 应的区域设置可以为空, 例如: 可以用 "N/A" 表示。  For example, the storage area may include a snapshot area mapping table, and the mapping relationship between the data storage area and the snapshot area may be recorded in the snapshot area mapping table. In the second case, the mapping relationship between the snapshot increment data of the new data in the snapshot area mapping table and the location of the storage unit of the original data in the data storage area, that is, the second mapping relationship, may be recorded. If a storage unit of the data storage area has snapshot incremental data in the snapshot area, the snapshot area mapping table stores the address or number of the storage unit where the snapshot incremental data corresponding to the storage unit is located, if a storage unit of the data storage area There is no snapshot delta data in the snapshot area. The area setting corresponding to the storage unit in the snapshot area mapping table can be empty. For example: It can be represented by "N/A".
在本实施例的情况下, 当需要进行快照恢复时, 根据所述新数据的快 照增量数据在所述快照区的存储单元的位置与所述原数据在所述数据存储 区的存储单元的位置之间的映射关系即第二映射关系, 从所述数据存储区 中获取所述快照区中需要恢复的存储单元中的原数据。  In the case of the embodiment, when snapshot recovery is required, the location of the storage unit in the snapshot area according to the snapshot incremental data of the new data and the original data in the storage unit of the data storage area The mapping relationship between the locations is the second mapping relationship, and the original data in the storage unit that needs to be restored in the snapshot area is obtained from the data storage area.
如图 5所示, 可以保持数据存储区的存储单元" 3"中原数据' OxDD"不变, 而是将新数据 "OxDF"写入快照区, 并在快照区映射表中记录映射关系, 正 常读取时, 根据映射关系从快照区获取 "OxDF", 需要进行快照还原时, 可 以则从数据存储区获取' OxDD"。  As shown in FIG. 5, the original data 'OxDD' in the storage unit "3" of the data storage area can be kept unchanged, but the new data "OxDF" is written into the snapshot area, and the mapping relationship is recorded in the snapshot area mapping table, which is normal. When reading, "OxDF" is obtained from the snapshot area according to the mapping relationship. When snapshot restoration is required, "OxDD" can be obtained from the data storage area.
步骤 804、 若所述快照区已满, 且所述数据存储区存在需要备份到所述 快照区的快照增量数据时, 发出所述快照区已满的通知; 或删除最早存入 所述快照区的快照增量数据。  Step 804: If the snapshot area is full, and the data storage area has snapshot incremental data that needs to be backed up to the snapshot area, issue a notification that the snapshot area is full; or delete the earliest stored snapshot. The snapshot increment data for the zone.
快照区存储满后, 可釆用多种方法进行处理, 例如: 删除快照区最早 存入的快照增量数据, 或者通知用户快照区已满, 无法再进行存储等, 根 据具体应用场景可以具体设定。 After the snapshot area is full, you can use a variety of methods to process it, for example: Delete the oldest snapshot area The incremental data of the snapshot is saved, or the user is notified that the snapshot area is full and cannot be stored. You can set it according to the specific application scenario.
本实施例中, 可以将需要修改的存储单元中的原数据备份到存储介质 的快照区或将修改的新数据写入快照区, 可以实现数据保护与恢复; 由于 快照区对上层透明、 无法访问, 可以防止病毒注入, 提高了存储介质的可 靠性和病毒防御能力, 如果将关键数据快照到快照区, 可以保护关键数据 的安全, 提高了数据保护能力。  In this embodiment, the original data in the storage unit that needs to be modified may be backed up to the snapshot area of the storage medium or the modified new data is written into the snapshot area, and data protection and recovery may be implemented; the snapshot area is transparent to the upper layer and cannot be accessed. It can prevent virus injection, improve the reliability of storage media and virus defense. If you snapshot critical data to the snapshot area, you can protect the security of key data and improve data protection.
本实施例中, 可以将修改请求中的新数据写入到存储介质的快照区, 得到快照增量数据, 从而在存储介质上直接进行快照, 实现数据保护与恢 复; 由于快照区对上层透明、 无法访问, 可以防止病毒注入, 提高了存储 介质的可靠性和病毒防御能力, 如果将关键数据快照到快照区, 可以保护 关键数据的安全, 提高了数据保护能力。  In this embodiment, the new data in the modification request may be written to the snapshot area of the storage medium to obtain the snapshot incremental data, so that the snapshot is directly performed on the storage medium to implement data protection and recovery; Unreachable, it can prevent virus injection, improve the reliability of storage media and virus defense. If you snapshot critical data to the snapshot area, you can protect the security of key data and improve data protection.
上述所有实施例中, 存储介质的快照区可以为冗余区, 相应地, 存储 介质的存储单元中可以包括数据存储区与冗余区, 一般情况下, 数据存储 区用于存储原数据, 冗余区一般用来提升存储介质的性能, 可用于存放系 统信息, 还可以包括坏块保留块、 空白块等。 一般情况下, 数据存储区存 储原数据, 而冗余区的空白块即处于未使用状态的存储单元, 则可以用于 存储快照增量数据。  In all the above embodiments, the snapshot area of the storage medium may be a redundant area. Correspondingly, the storage unit of the storage medium may include a data storage area and a redundant area. Generally, the data storage area is used to store original data, and redundant. The remaining area is generally used to improve the performance of the storage medium, and can be used to store system information, and may also include bad block reserved blocks, blank blocks, and the like. In general, the data storage area stores the original data, and the blank blocks of the redundant area are in the unused storage unit, which can be used to store the snapshot incremental data.
相应地, 该快照方法还可以包括:  Correspondingly, the snapshot method may further include:
对于情况一, 记录所述原数据的快照增量数据在所述冗余区的存储单 元的位置与所述新数据在所述数据存储区的存储单元的位置之间的映射关 系, 并设置用于存储所述原数据的冗余区中的存储单元的状态为快照状态; 对于情况二, 记录所述新数据的快照增量数据在所述冗余区的存储单 元的位置与所述原数据在所述数据存储区的存储单元的位置之间的映射关 系, 并设置用于存储所述新数据的冗余区中的存储单元的状态为快照状态。  For the first case, the mapping relationship between the location of the snapshot data of the original data and the location of the storage unit of the new data in the data storage area is recorded and set. The state of the storage unit in the redundant area storing the original data is a snapshot state; for case 2, the snapshot incremental data of the new data is recorded at the location of the storage unit of the redundant area and the original data A mapping relationship between locations of the storage units of the data storage area, and setting a state of the storage unit in the redundant area for storing the new data to a snapshot state.
其中, 冗余区映射表中可以记录冗余区各个存储单元的状态, 以及冗 余区的各个存储单元与数据存储区的映射关系。 若数据存储区的某个存储 单元在冗余区无原数据备份或新数据写入等形成快照增量数据, 可以将该 blank ) , 若该存储单元在冗余区存在快照增量数据, 则可以将该存储单元 在冗余区映射表中对应的区域设置的状态可以设置为快照 (snap ) , 并且 记录对应的快照增量数据所在的冗余区的存储单元的地址逻辑编号。 图 9为 本发明实施例中 SSD的冗余区映射表的示意图, 如图 9所示, 将数据存储区 的存储单元 "3" 中的原数据 "OxDD" 备份到冗余区的存储单元 "0" 时, 将冗余区映射表中数据存储区的存储单元 "3" 对应的区域的状态记录为Wherein, the redundant area mapping table can record the status of each storage unit in the redundant area, and redundant The mapping relationship between each storage unit of the remaining area and the data storage area. If a storage unit of the data storage area does not have original data backup or new data write in the redundant area to form snapshot incremental data, the blank may be used. If the storage unit has snapshot incremental data in the redundant area, The state of the corresponding regional setting of the storage unit in the redundant area mapping table may be set as a snapshot, and the address logical number of the storage unit of the redundant area where the corresponding snapshot incremental data is located is recorded. FIG. 9 is a schematic diagram of a redundant area mapping table of an SSD according to an embodiment of the present invention. As shown in FIG. 9, the original data "OxDD" in the storage unit "3" of the data storage area is backed up to a storage unit of the redundant area. When 0", the status of the area corresponding to the storage unit "3" of the data storage area in the redundant area mapping table is recorded as
"snap" , 将 "3" 对应的冗余区的存储单元记录为 "0" 。 "snap", the storage unit of the redundant area corresponding to "3" is recorded as "0".
由于, 当数据存储区的存储单元由 "OxDD" 变为 "OxDF" 后, 原数据 Because, when the storage unit of the data storage area changes from "OxDD" to "OxDF", the original data
"OxDD" 被保存于冗余区域的存储单元 "0" 内, 冗余区映射表中记录了 该映射关系和该存储单元的状态, 当需要进行快照恢复时, 可以根据冗余 区映射表从冗余区将 "OxDD" 由冗余区的 snap状态的存储单元 "0" 内读 出, 恢复到数据存储区的存储单元 "3" 。 "OxDD" is stored in the storage unit "0" of the redundant area. The mapping relationship and the state of the storage unit are recorded in the redundant area mapping table. When snapshot recovery is required, the redundant area mapping table can be used. The redundant area reads "OxDD" from the memory location "0" of the snap state of the redundant area, and restores to the memory location "3" of the data storage area.
冗余区代替快照区实现上述快照的方法, 既可以存储快照增量数据又 可以存储系统信息, 实现了冗余区的复用, 可以在均衡系统性能的同时保 护数据安全。  The redundant area replaces the snapshot area to implement the above snapshot method, which can store snapshot incremental data and system information, realize redundancy of redundant areas, and protect data security while balancing system performance.
图 10为本发明固态硬盘第一实施例的结构示意图, 如图 10所示, 该固 态硬盘包括: 与外部设备连接的接口 101、 与接口 101连接的控制器 102和 与控制器 102连接的存储介质 103。  10 is a schematic structural diagram of a first embodiment of a solid state drive according to the present invention. As shown in FIG. 10, the solid state drive includes: an interface 101 connected to an external device, a controller 102 connected to the interface 101, and a storage connected to the controller 102. Medium 103.
其中, 控制器 102包括: 接收模块 1020和快照模块 1021 ;  The controller 102 includes: a receiving module 1020 and a snapshot module 1021;
接收模块 1020, 用于接收数据修改请求, 所述数据修改请求包括待写 入的新数据;  The receiving module 1020 is configured to receive a data modification request, where the data modification request includes new data to be written;
快照模块 1021 , 用于根据所述接收模块 1020接收的所述数据修改请求 中携带的存储介质 103的数据存储区中需要修改的存储单元的地址,从数据 存储区中获取需要修改的原数据,将所述原数据备份到所述存储介质 103的 快照区, 得到快照增量数据; 或者, 用于将所述接收模块 1020接收的所述 数据修改请求中的新数据写入到存储介质 103的快照区, 得到快照增量数 据; The snapshot module 1021 is configured to: according to the address of the storage unit that needs to be modified in the data storage area of the storage medium 103 carried in the data modification request received by the receiving module 1020, the slave data The original data to be modified is obtained in the storage area, and the original data is backed up to the snapshot area of the storage medium 103 to obtain snapshot incremental data. Alternatively, the data modification request received by the receiving module 1020 is used. The new data is written to the snapshot area of the storage medium 103 to obtain snapshot incremental data;
数据修改模块 1022, 用于当快照模块 1021将原数据备份到存储介质 103的快照区, 得到快照增量数据时, 将包含所述原数据的块 Block上的数 据读入緩存, 修改所述原数据, 擦除存储介质上所述块上的数据, 将修改 后的所述块上的数据重新写入。  The data modification module 1022 is configured to: when the snapshot module 1021 backs up the original data to the snapshot area of the storage medium 103, and obtain the snapshot incremental data, read the data on the block block including the original data into the cache, and modify the original Data, erasing data on the block on the storage medium, and rewriting the data on the modified block.
本实施例中, 可以将需要修改的存储单元中的原数据备份到存储介质 的快照区或将修改的新数据写入快照区, 可以实现数据保护与恢复; 由于 快照区对上层透明、 无法访问, 可以防止病毒注入, 提高了存储介盾的可 靠性和病毒防御能力, 如果将关键数据快照到快照区, 可以保护关键数据 的安全, 提高了数据保护能力, 进一步地, 通过固态硬盘内部的控制器实 现快照功能, 可以不借助任何外部设备在存储介质内部完成快照功能, 从 而可以节省固态硬盘外部处理单独的处理资源。  In this embodiment, the original data in the storage unit that needs to be modified may be backed up to the snapshot area of the storage medium or the modified new data is written into the snapshot area, and data protection and recovery may be implemented; the snapshot area is transparent to the upper layer and cannot be accessed. It can prevent virus injection, improve the reliability of the storage shield and virus defense capability. If the key data is snapshotted to the snapshot area, it can protect the security of key data and improve the data protection capability. Further, through the internal control of the solid state drive. The snapshot function enables the snapshot function to be performed inside the storage medium without any external device, thereby saving the processing resources of the SSD externally.
进一步地, 存储介质 103可以包括: 数据存储区 1031与快照区 1032; 若数据存储区 1031用于存储所述新数据, 则快照区 1032用于存储所述原数 据的快照增量数据; 若数据存储区 1031用于存储所述原数据, 则快照区 1032用于存储所述新数据的快照增量数据。  Further, the storage medium 103 may include: a data storage area 1031 and a snapshot area 1032; if the data storage area 1031 is used to store the new data, the snapshot area 1032 is configured to store snapshot incremental data of the original data; The storage area 1031 is configured to store the original data, and the snapshot area 1032 is configured to store snapshot incremental data of the new data.
示例性地, 控制器 102的从接口 101可以接收到外部设备发送的数据修 文请求, 数据修改请求可以包括需要修改的存储单元和修改的新数据, 若 已经启动快照, 接收模块 1020根据数据修改请求可以获取需要修改的原数 据和修改的新数据, 则快照模块 1021将存储介质 103的数据存储区 1031中 需要修改的存储单元中的原数据备份到存储介盾 103的快照区 1032,得到原 数据的快照增量数据, 然后可以将数据存储区 1031中的原数据修改为新数 据。 或者快照模块 1021将接收到的新数据写入快照区 1032, 得到新数据的 快照增量数据, 并保持数据存储区 1031的原数据不变。 Exemplarily, the slave interface 101 of the controller 102 can receive a data repair request sent by the external device, and the data modification request can include the storage unit that needs to be modified and the modified new data. If the snapshot has been started, the receiving module 1020 requests the data modification according to the data. The original data and the modified new data that need to be modified may be obtained, and the snapshot module 1021 backs up the original data in the storage unit that needs to be modified in the data storage area 1031 of the storage medium 103 to the snapshot area 1032 of the storage medium 103 to obtain the original data. The snapshot increment data, and then the original data in the data storage area 1031 can be modified to new data. Or the snapshot module 1021 writes the received new data into the snapshot area 1032 to obtain new data. The snapshot increments the data and keeps the original data of the data storage area 1031 unchanged.
本实施例接收模块获取需要修改的原数据和修改的新数据后, 快照模 块可以将数据存储区中需要修改的原数据备份到快照区 , 或者将新数据写 入快照区, 从而在固态硬盘存储介质上直接进行快照, 实现数据保护; 由 于快照区对上层透明、 无法访问, 因此可以防止病毒注入, 提高了存储介 质的可靠性和病毒防御能力, 如果将关键数据快照到快照区, 可以保护关 键数据的安全, 提高了数据保护能力。  After the receiving module obtains the original data and the modified new data that needs to be modified, the snapshot module can back up the original data that needs to be modified in the data storage area to the snapshot area, or write new data into the snapshot area, thereby storing in the solid state hard disk. Snapshots are directly performed on the media to implement data protection. Because the snapshot area is transparent to the upper layer and cannot be accessed, virus injection can be prevented, and the reliability and virus defense capability of the storage medium can be improved. If key data is snapshotted to the snapshot area, the key can be protected. Data security improves data protection.
图 11为本发明固态硬盘第二实施例的结构示意图, 如图 1 1所示, 在本 发明固态硬盘第一实施例的基础上, 该固态硬盘的控制器还可以包括: 快 照区映射模块 1024, 用于当数据修改模块 1022将所述数据存储区的所述原 数据修改为所述数据修改请求中的所述新数据时, 记录所述原数据的快照 增量数据在所述快照区的存储单元的位置与所述新数据在所述数据存储区 的存储单元的位置之间的第一映射关系; 快照区映射模块 1024还用于当快 照模块 1021将所述数据修改请求中的所述新数据写入到所述存储介质的快 照区, 得到快照增量数据时, 记录所述新数据的快照增量数据在所述快照 区的存储单元的位置与所述原数据在所述数据存储区的存储单元的位置之 间的第二映射关系。  FIG. 11 is a schematic structural diagram of a second embodiment of a solid state drive according to the present invention. As shown in FIG. 11 , the controller of the solid state drive may further include: a snapshot area mapping module 1024. And when the data modification module 1022 modifies the original data of the data storage area to the new data in the data modification request, recording snapshot incremental data of the original data in the snapshot area. a first mapping relationship between a location of the storage unit and a location of the new data in a storage unit of the data storage area; the snapshot area mapping module 1024 is further configured to: when the snapshot module 1021 describes the data modification request New data is written to the snapshot area of the storage medium, and when snapshot incremental data is obtained, the snapshot incremental data of the new data is recorded in the location of the storage unit of the snapshot area and the original data is in the data storage. A second mapping relationship between the locations of the storage units of the zone.
进一步地, 控制器 102还可以包括: 快照恢复模块 1025, 用于若所述数 据修改模块 1022将所述数据存储区的所述原数据修改为所述数据修改请求 中的新数据, 当需要进行快照恢复时, 根据所述第一映射关系, 从所述快 照区中获取所述数据存储区中需要恢复的原数据的快照增量数据; 快照恢 复模块 1025还用于若所述快照模块 1021将所述数据修改请求中的所述新 数据写入到所述存储介质的快照区, 得到快照增量数据, 当需要进行快照 恢复时, 根据所述第二映射关系, 从所述数据存储区中获取所述快照区中 需要恢复的存储单元中的快照增量数据的原数据。  Further, the controller 102 may further include: a snapshot recovery module 1025, configured to: if the data modification module 1022 modifies the original data of the data storage area into new data in the data modification request, when needed When the snapshot is restored, the snapshot incremental data of the original data that needs to be restored in the data storage area is obtained from the snapshot area according to the first mapping relationship; the snapshot recovery module 1025 is further configured to: if the snapshot module 1021 The new data in the data modification request is written to the snapshot area of the storage medium to obtain snapshot incremental data. When snapshot recovery is required, according to the second mapping relationship, from the data storage area. Obtaining the original data of the snapshot delta data in the storage unit in the snapshot area that needs to be restored.
此外, 快照区 1032的存储空间是有限的, 存满后就不能再存其他的数 据, 因此控制器的快照模块 1021还用于若快照区 1032已满, 且数据存储区 1031存在需要备份到快照区 1032的快照增量数据,发出快照区 1032已满的 通知; 或删除最早存入快照区 1032的快照增量数据。 In addition, the storage space of the snapshot area 1032 is limited, and other numbers cannot be saved after being filled. Therefore, the snapshot module 1021 of the controller is further configured to: if the snapshot area 1032 is full, and the data storage area 1031 has snapshot incremental data that needs to be backed up to the snapshot area 1032, issue a notification that the snapshot area 1032 is full; or delete the earliest save Snapshot delta data into snapshot area 1032.
本实施例获取数据存储区中需要修改的原数据和修改的新数据后, 快 照模块可以将需要修改的原数据备份到快照区, 然后再该存储单元的原数 据修改为新数据, 也可以将新数据写入快照区, 保持数据存储区的原数据 不变, 从而在固态硬盘存储介质上直接进行快照, 实现数据保护; 快照恢 复模块可以根据数据存储区域快照区的映射关系进行快照恢复; 由于快照 区对上层透明、 无法访问, 因此可以防止病毒注入, 提高了存储介质的可 靠性和病毒防御能力, 如果将关键数据快照到快照区, 可以保护关键数据 的安全, 提高了数据保护能力。  After the original data and the modified new data that need to be modified in the data storage area are obtained, the snapshot module may back up the original data that needs to be modified to the snapshot area, and then modify the original data of the storage unit to new data, or The new data is written into the snapshot area, and the original data of the data storage area is kept unchanged, so that the snapshot is directly performed on the SSD storage medium to implement data protection; the snapshot recovery module can perform snapshot recovery according to the mapping relationship of the data storage area snapshot area; The snapshot area is transparent to the upper layer and cannot be accessed. Therefore, virus injection can be prevented, and the reliability of the storage medium and the virus defense capability can be improved. If key data is snapshotted to the snapshot area, the security of key data can be protected and the data protection capability can be improved.
其中, 快照区 1032还可以为冗余区, 相应地, 存储介质 103可以包括数 据存储区与冗余区, 冗余区一般用来提升存储介质的性能, 可用于存放系 统信息, 还可以包括坏块保留块、 空白块等。 一般情况下, 数据存储区存 储原数据, 而冗余区的空白块即处于未使用状态的存储单元, 则可以用于 存储快照增量数据。  The snapshot area 1032 may also be a redundant area. Correspondingly, the storage medium 103 may include a data storage area and a redundant area. The redundant area is generally used to improve the performance of the storage medium, and may be used to store system information, and may also include bad Blocks retain blocks, blank blocks, and so on. In general, the data storage area stores the original data, and the blank blocks of the redundant area are in the unused storage unit, which can be used to store the snapshot incremental data.
其中, 当上述存储介质的快照区为冗余区时, 接收模块 1020, 用于接 收数据修改请求, 所述数据修改请求包括待写入的新数据;  The receiving module 1020 is configured to receive a data modification request, where the data modification request includes new data to be written, where the snapshot area of the storage medium is a redundant area;
快照模块 1021, 用于根据所述接收模块 1020接收的所述数据修改请求 中携带的存储介质 103的数据存储区中需要修改的存储单元的地址,从数据 存储区中获取需要修改的原数据,将所述原数据备份到所述存储介质 103的 冗余区, 得到快照增量数据; 或者, 用于将所述接收模块 1020接收的所述 数据修改请求中的新数据写入到存储介质 103的冗余区, 得到快照增量数 据;数据修改模块 1022,用于当快照模块 1021将原数据备份到存储介质 103 的冗余区, 得到快照增量数据时, 将数据存储区的所述原数据修改为所述 数据修改请求中的所述新数据。 冗余区代替快照区实现上述快照的方法, 既可以存储快照增量数据又 可以存储系统信息, 实现了冗余区的复用, 可以在均衡系统性能的同时保 护数据安全。 The snapshot module 1021 is configured to obtain, according to the address of the storage unit that needs to be modified in the data storage area of the storage medium 103 carried in the data modification request received by the receiving module 1020, and obtain the original data that needs to be modified from the data storage area, Backing up the original data to the redundant area of the storage medium 103 to obtain snapshot incremental data; or, for writing new data in the data modification request received by the receiving module 1020 to the storage medium 103 The redundant area, the snapshot incremental data is obtained; the data modification module 1022 is configured to: when the snapshot module 1021 backs up the original data to the redundant area of the storage medium 103, and obtains the snapshot incremental data, the original data storage area The data is modified to the new data in the data modification request. The redundant area replaces the snapshot area to implement the above snapshot method. It can store snapshot incremental data and system information, and realize redundancy of redundant areas, which can protect data security while balancing system performance.
其中, 当上述存储介质的快照区为冗余区时, 该固态硬盘的控制器还 可以包括: 冗余区映射模块, 用于当数据修改模块 1022将所述数据存储区 的所述原数据修改为所述数据修改请求中的所述新数据时, 记录所述原数 据的快照增量数据在所述冗余区的存储单元的位置与所述新数据在所述数 据存储区的存储单元的位置之间的第一映射关系, 并设置用于存储所述原 数据的冗余区中的存储单元的状态为快照状态; 所述冗余区映射模块还用 于当快照模块 1021将所述数据修改请求中的所述新数据写入到所述存储介 质的冗余区, 得到快照增量数据时, 记录所述新数据的快照增量数据在所 述冗余区的存储单元的位置与所述原数据在所述数据存储区的存储单元的 位置之间的第二映射关系, 并设置用于存储所述新数据的冗余区中的存储 单元的状态为快照状态。  The controller of the SSD may further include: a redundancy area mapping module, configured to: when the data modification module 1022 modifies the original data of the data storage area, when the snapshot area of the storage medium is a redundant area When the new data in the request is modified for the data, recording snapshot incremental data of the original data in a location of a storage unit of the redundant area and the new data in a storage unit of the data storage area a first mapping relationship between the locations, and setting a state of the storage unit in the redundant area for storing the original data to a snapshot state; the redundant area mapping module is further configured to: when the snapshot module 1021 sets the data Writing the new data in the modification request to the redundant area of the storage medium, and when the snapshot incremental data is obtained, recording the location and location of the snapshot incremental data of the new data in the storage unit of the redundant area Determining, in a second mapping relationship between the locations of the original data in the storage unit of the data storage area, and setting a state of the storage unit in the redundant area for storing the new data as a snapshot .
其中, 当上述存储介质的快照区为冗余区时, 快照恢复模块 1025, 用 于若所述数据修改模块 1022将所述数据存储区的所述原数据修改为所述数 据修改请求中的新数据, 当需要进行快照恢复时, 根据所述第一映射关系, 从所述冗余区中获取所述数据存储区中需要恢复的原数据的快照增量数 据; 快照恢复模块 1025还用于若所述快照模块 1021将所述数据修改请求中 的所述新数据写入到所述存储介质的冗余区, 得到快照增量数据, 当需要 进行快照恢复时, 根据所述第二映射关系, 从所迷数据存储区中获取所述 冗余区中需要恢复的存储单元中的快照增量数据的原数据。  The snapshot recovery module 1025 is configured to modify the original data of the data storage area to be new in the data modification request, when the snapshot area of the storage medium is a redundant area. Data, when snapshot recovery is required, obtaining snapshot incremental data of the original data that needs to be restored in the data storage area from the redundant area according to the first mapping relationship; the snapshot recovery module 1025 is further configured to: The snapshot module 1021 writes the new data in the data modification request to the redundant area of the storage medium to obtain snapshot incremental data. When the snapshot recovery is required, according to the second mapping relationship, The original data of the snapshot delta data in the storage unit that needs to be restored in the redundant area is obtained from the data storage area.
其中, 当上述存储介质的快照区为冗余区时, 冗余区的存储空间是有 限的, 存满后就不能再存其他的数据, 因此控制器的快照模块 1021还用于 若冗余区已满, 且数据存储区存在需要备份到冗余区的快照增量数据, 发 出冗余区已满的通知; 或删除最早存入冗余区的数据, 其中数据可以为快 照增量数据, 也可以不是快照增量数据, 而是其他的过期数据。 When the snapshot area of the storage medium is a redundant area, the storage space of the redundant area is limited, and other data cannot be stored after being filled, so the snapshot module 1021 of the controller is also used for the redundant area. Full, and there is snapshot incremental data that needs to be backed up to the redundant area in the data storage area, and the notification that the redundant area is full is issued; or the data stored in the redundant area is deleted first, and the data can be fast. According to the incremental data, it may not be snapshot incremental data, but other expired data.
冗余区代替快照区实现上述快照的方法, 既可以存储快照增量数据又 可以存储系统信息, 实现了冗余区的复用, 可以在均衡系统性能的同时保 护数据安全。  The redundant area replaces the snapshot area to implement the above snapshot method, which can store snapshot incremental data and system information, realize redundancy of redundant areas, and protect data security while balancing system performance.
下面介绍一下本发明快照方法的另一个实施例, 在本实施例中, 可以 包括以下步骤:  Another embodiment of the snapshot method of the present invention is described below. In this embodiment, the following steps may be included:
接收数据修改请求, 所述数据修改请求包括待写入的新数据; 根据数据修改请求中携带的存储介质的数据存储区中需要修改的存储 单元的地址, 从所述数据存储区中获取需要修改的原数据, 将所述原数据 备份到所述存储介质的快照区, 得到快照增量数据, 将包含所述原数据的 块(Block ) 上的数据读入緩存, 修改所述原数据, 擦除存储介质上所述块 上的数据, 将修改后的所述块上的数据重新写入;  Receiving a data modification request, the data modification request includes new data to be written; obtaining an address of the storage unit that needs to be modified in the data storage area of the storage medium carried in the data modification request, and obtaining the modification from the data storage area Raw data, backing up the original data to a snapshot area of the storage medium, obtaining snapshot incremental data, reading data on a block containing the original data into a cache, modifying the original data, and erasing Rewriting the data on the modified block, except for the data on the block on the storage medium;
与前面的方法实施例不同之处在于, 本实施例可以不包含 "或者, 将 所述数据修改请求中的所述新数据写入到所述存储介质的快照区, 得到快 照增量数据" 的步驟。  The difference from the previous method embodiment is that the embodiment may not include "or, the new data in the data modification request is written to the snapshot area of the storage medium to obtain snapshot incremental data". step.
下面介绍一下本发明固态硬盘的另一个实施例, 该固态硬盘包括: 与 外部设备连接的接口、 与接口连接的控制器和与控制器连接的存储介质。  Next, another embodiment of the solid state hard disk of the present invention will be described. The solid state hard disk includes: an interface connected to an external device, a controller connected to the interface, and a storage medium connected to the controller.
其中, 控制器包括: 接收模块和快照模块;  The controller includes: a receiving module and a snapshot module;
接收模块, 用于接收数据修改请求, 所述数据修改请求包括待写入的 新数据;  a receiving module, configured to receive a data modification request, where the data modification request includes new data to be written;
快照模块, 用于根据所述接收模块接收的所迷数据修改请求中携带的 存储介质的数据存储区中需要修改的存储单元的地址, 从数据存储区中获 取需要修改的原数据, 将所述原数据备份到所述存储介质的快照区, 得到 快照增量数据;  a snapshot module, configured to acquire, according to an address of a storage unit that needs to be modified in a data storage area of the storage medium carried in the data modification request received by the receiving module, to obtain original data that needs to be modified from the data storage area, The original data is backed up to the snapshot area of the storage medium to obtain snapshot incremental data;
数据修改模块, 用于当快照模块将原数据备份到存储介质的快照区, 得到快照增量数据时, 将包含所述原数据的块 Block上的数据读入緩存, 修 改所述原数据, 擦除存储介质上所述块上的数据, 将修改后的所述块上的 数据重新写入。 a data modification module, configured to: when the snapshot module backs up the original data to the snapshot area of the storage medium, and obtain the snapshot incremental data, read the data on the block block containing the original data into the cache, and repair The original data is changed, the data on the block on the storage medium is erased, and the modified data on the block is rewritten.
与前面的固态硬盘实施例不同之处在于, 本实施例的快照模块可以不 包含 "或者, 将所述数据修改请求中的所述新数据写入到所述存储介质的 快照区, 得到快照增量数据" 的动作。 本领域普通技术人员可以理解: 实 现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完 成, 前述的程序可以存储于一计算机可读取存储介质中, 该程序在执行时, 执行包括上述方法实施例的步骤; 而前述的存储介质包括: FLASH , ROM , The difference from the previous SSD embodiment is that the snapshot module of this embodiment may not include "or, the new data in the data modification request is written to the snapshot area of the storage medium, and the snapshot is increased. The action of the quantity data. A person skilled in the art can understand that all or part of the steps of implementing the above method embodiments may be completed by using hardware related to program instructions, and the foregoing program may be stored in a computer readable storage medium, and the program is executed when executed. The steps of the foregoing method embodiments are included; and the foregoing storage medium includes: FLASH, ROM,
RAM或者其他非易失性介质等各种可以存储程序代码的介质。 A variety of media that can store program code, such as RAM or other non-volatile media.
最后应说明的是: 以上实施例仅用以说明本发明的技术方案, 而非对 其限制; 尽管参照前述实施例对本发明进行了详细的说明, 本领域的普通 技术人员应当理解: 其依然可以对前述各实施例所记载的技术方案进行修 改, 或者对其中部分技术特征进行等同替换; 而这些修改或者替换, 并不 使相应技术方案的本质脱离本发明各实施例技术方案的范围。  It should be noted that the above embodiments are only for explaining the technical solutions of the present invention, and are not intended to be limiting; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those skilled in the art that: The technical solutions described in the foregoing embodiments are modified, or some of the technical features are equivalently replaced; and the modifications or substitutions do not deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

权利要求 Rights request
1、 一种快照方法, 其特征在于, 包括: A snapshot method, comprising:
接收数据修改请求, 所述数据修改请求包括待写入的新数据; 根据数据修改请求中携带的存储介质的数据存储区中需要修改的存储 单元的地址, 从所述数据存储区中获取需要修改的原数据, 将所述原数据 备份到所述存储介质的快照区, 得到快照增量数据, 将包含所述原数据的 块上的数据读入緩存, 修改所述原数据, 擦除存储介质上所述块上的数据, 将修改后的所述块上的数据重新写入; 或者,  Receiving a data modification request, the data modification request includes new data to be written; obtaining an address of the storage unit that needs to be modified in the data storage area of the storage medium carried in the data modification request, and obtaining the modification from the data storage area Raw data, backing up the original data to a snapshot area of the storage medium, obtaining snapshot incremental data, reading data on the block containing the original data into a cache, modifying the original data, erasing the storage medium Data on the block, rewriting the data on the modified block; or
将所述数据修改请求中的所述新数据写入到所述存储介质的快照区, 得到快照增量数据。  Writing the new data in the data modification request to a snapshot area of the storage medium to obtain snapshot incremental data.
2、 根据权利要求 1所述的快照方法, 其特征在于, 还包括:  2. The snapshot method according to claim 1, further comprising:
当将所述数据存储区的所述原数据修改为所述数据修改请求中的所述 新数据时, 记录所述快照增量数据在所述快照区的存储单元的位置与所述 新数据在所述数据存储区的存储单元的位置之间的第一映射关系;  When the original data of the data storage area is modified to the new data in the data modification request, recording the location of the snapshot incremental data in the storage unit of the snapshot area with the new data a first mapping relationship between locations of the storage units of the data storage area;
当将所述数据修改请求中的所述新数据写入到所述存储介质的快照 区, 得到快照增量数据时, 记录所述快照增量数据在所述快照区的存储单 元的位置与所述原数据在所述数据存储区的存储单元的位置之间的第二映 射关系。  When the new data in the data modification request is written to the snapshot area of the storage medium to obtain snapshot incremental data, the location and location of the storage unit of the snapshot incremental data in the snapshot area are recorded. Describe a second mapping relationship between the original data and the location of the storage unit of the data storage area.
3、 根据权利要求 2所述的快照方法, 其特征在于, 还包括:  3. The snapshot method according to claim 2, further comprising:
若将所述数据存储区的所述原数据修改为所述数据修改请求中的新数 据, 当需要进行快照恢复时, 根据所述第一映射关系, 从所述快照区中获 取所述数据存储区中需要恢复的原数据的快照增量数据;  If the original data of the data storage area is modified to the new data in the data modification request, when the snapshot recovery is required, the data storage is obtained from the snapshot area according to the first mapping relationship. Snapshot incremental data of the original data that needs to be restored in the zone;
若将所述数据修改请求中的所述新数据写入到所述存储介质的快照 区, 得到快照增量数据, 根据所述第二映射关系, 从所述数据存储区中获 取所述快照区中需要恢复的存储单元中的快照增量数据的原数据。  If the new data in the data modification request is written to the snapshot area of the storage medium, the snapshot incremental data is obtained, and the snapshot area is obtained from the data storage area according to the second mapping relationship. The original data of the snapshot delta data in the storage unit that needs to be restored.
18 18
更正页 (细则第 91条) 4、 根据权利要求 1所述的快照方法, 其特征在于, 还包括: Correction page (Article 91) 4. The snapshot method according to claim 1, further comprising:
预先将存储介质分为数据存储区和快照区, 其中, 所述数据存储区用 于存储所述新数据, 所述快照区用于存储所述原数据的快照增量数据; 或 者,  Separating the storage medium into a data storage area and a snapshot area, wherein the data storage area is used to store the new data, and the snapshot area is used to store snapshot incremental data of the original data; or
所述数据存储区用于存储所述原数据, 所述快照区用于存储所述新数 据的快照增量数据。  The data storage area is configured to store the original data, and the snapshot area is configured to store snapshot incremental data of the new data.
5、 根据权利要求 1-4任一所述的快照方法, 其特征在于, 还包括: 若所述快照区已满, 且所述数据存储区存在需要备份到所述快照区的 快照增量数据时, 发出所述快照区已满的通知; 或删除最早存入所述快照 区的快照增量数据。  The snapshot method according to any one of claims 1 to 4, further comprising: if the snapshot area is full, and the data storage area has snapshot incremental data that needs to be backed up to the snapshot area. At the same time, the notification that the snapshot area is full is issued; or the snapshot increment data that is first stored in the snapshot area is deleted.
6、 一种快照方法, 其特征在于, 包括: , 接收数据修改请求, 所述数据修改请求包括待写入的新数据; 根据数据修改请求中携带的存储介质的数据存储区中需要修改的存储 单元的地址, 从所述数据存储区中获取需要修改的原数据, 将所述原数据 备份到所述存储介质的快照区, 得到快照增量数据, 将包含所述原数据的 块上的数据读入緩存, 修改所述原数据, 擦除存储介质上所述块上的数据, 将修改后的所述块上的数据重新写入。  A snapshot method, comprising: receiving a data modification request, the data modification request including new data to be written; and storing the data to be modified according to a storage medium of the storage medium carried in the data modification request The address of the unit, the original data to be modified is obtained from the data storage area, the original data is backed up to the snapshot area of the storage medium, and the snapshot incremental data is obtained, and the data on the block containing the original data is obtained. Reading in the cache, modifying the original data, erasing the data on the block on the storage medium, and rewriting the modified data on the block.
1、 根据权利要求 6所述的快照方法, 其特征在于, 还包括:  The snapshot method according to claim 6, further comprising:
记录所述快照增量数据在所述快照区的存储单元的位置与所述新数据 在所述数据存储区的存储单元的位置之间的第一映射关系。  Recording, in a first mapping relationship between the location of the storage unit of the snapshot increment data and the location of the new data in the storage unit of the data storage area.
8、 根据权利要求 6所述的快照方法, 其特征在于, 还包括:  8. The snapshot method according to claim 6, further comprising:
当需要进行快照恢复时, 根据所述第一映射关系, 从所述快照区中获 取所述数据存储区中需要恢复的原数据的快照增量数据。  When snapshot recovery is required, snapshot increment data of the original data that needs to be restored in the data storage area is obtained from the snapshot area according to the first mapping relationship.
9、 一种固态硬盘, 包括: 与外部设备连接的接口、 与所述接口连接的 控制器和与所述控制器连接的存储介质, 其特征在于, 所述控制器包括: 接收模块, 用于接收数据修改请求, 所述数据修改请求包括待写入的  A solid state hard disk, comprising: an interface connected to an external device, a controller connected to the interface, and a storage medium connected to the controller, wherein the controller comprises: a receiving module, configured to: Receiving a data modification request, the data modification request including a to-be-written
19 19
更正页 (细则第 91条) 新数据; Correction page (Article 91) New data;
快照模块, 用于根据所述接收模块接收的所述数据修改请求中携带的 存储介质的数据存储区中需要^^改的存储单元的地址, 从所述数据存储区 中获取需要修改的原数据, 将所述原数据备份到所述存储介质的快照区, 得到快照增量数据; 或者, 用于将所述接收模块接收的所述数据修改请求 中的新数据写入到所述存储介质的快照区, 得到快照增量数据;  a snapshot module, configured to acquire, according to an address of a storage unit that needs to be changed in a data storage area of the storage medium carried in the data modification request received by the receiving module, to obtain original data to be modified from the data storage area Backing up the original data to a snapshot area of the storage medium to obtain snapshot incremental data; or, for writing new data in the data modification request received by the receiving module to the storage medium Snapshot area, get snapshot incremental data;
数据修改模块, 用于当所述快照模块将所述原数据备份到所述存储介 盾的快照区, 得到快照增量数据时, 将包含所述原数据的块上的数据读入 緩存, 修改所述原数据, 擦除存储介质上所述块上的数据, 将修改后的所 述块上的数据重新写入。  a data modification module, configured to: when the snapshot module backs up the original data to a snapshot area of the storage medium shield, and obtain snapshot incremental data, read data on the block that includes the original data into a cache, and modify The original data erases data on the block on the storage medium, and rewrites the modified data on the block.
10、根据权利要求 9所述的固态硬盘,其特征在于,所述存储介质包括: 所述数据存储区和所述快照区;  The solid state hard disk according to claim 9, wherein the storage medium comprises: the data storage area and the snapshot area;
其中, 所述数据存储区用于存储所述新数据, 所述快照区用于存储所 述原数据的快照增量数据; 或者,  The data storage area is configured to store the new data, and the snapshot area is configured to store snapshot incremental data of the original data; or
所述数据存储区用于存储所述原数据, 所述快照区用于存储所述新数 据的快照增量数据。  The data storage area is configured to store the original data, and the snapshot area is configured to store snapshot incremental data of the new data.
1 1、 根据权利要求 9或 10所述的固态硬盘, 其特征在于, 所述存储介质 还包括:  The solid state hard disk according to claim 9 or 10, wherein the storage medium further comprises:
快照区映射模块, 用于当所述数据修改模块将所述数据存储区的所述 原数据修改为所述数据修改请求中的所述新数据时, 记录所述原数据的快 照增量数据在所述快照区的存储单元的位置与所述新数据在所述数据存储 区的存储单元的位置之间的第一映射关系;  a snapshot area mapping module, configured to: when the data modification module modifies the original data of the data storage area to the new data in the data modification request, record snapshot incremental data of the original data a first mapping relationship between a location of the storage unit of the snapshot area and a location of the new data in a storage unit of the data storage area;
所述快照区映射模块还用于当所述快照模块将所述数据修改倚求中的 所述新数据写入到所述存储介质的快照区, 得到快照增量数据时, 记录所 述新数据的快照增量数据在所述快照区的存储单元的位置与所述原数据在 所述数据存储区的存储单元的位置之间的第二映射关系。  The snapshot area mapping module is further configured to: when the snapshot module writes the new data in the data modification dependency to a snapshot area of the storage medium, and obtain snapshot incremental data, record the new data. The snapshot incremental data has a second mapping relationship between the location of the storage unit of the snapshot area and the location of the original data in the storage unit of the data storage area.
20 20
更正页 (细则第 91条) 12、 根据权利要求 11所述的固态硬盘, 其特征在于, 所述控制器还包 括: Correction page (Article 91) The solid state hard disk according to claim 11, wherein the controller further comprises:
快照恢复模块, 用于若所述数据修改模块将所述数据存储区的所述原 数据修改为所述数据修改请求中的新数据, 当需要进行快照恢复时, 根据 所述第一映射关系, 从所述快照区中获取所述数据存储区中需要恢复的原 数据的快照增量数据;  a snapshot recovery module, configured to: if the data modification module modifies the original data of the data storage area to the new data in the data modification request, when the snapshot recovery is required, according to the first mapping relationship, Obtaining snapshot incremental data of the original data that needs to be restored in the data storage area from the snapshot area;
所述快照恢复模块还用于若所述快照模块将所述数据修改请求中的所 述新数据写入到所述存储介质的快照区, 得到快照增量数据, 当需要进行 快照恢复时, 根据所述第二映射关系, 从所述数据存储区中获取所述快照 区中需要恢复的存储单元中的快照增量数据的原数据。  The snapshot recovery module is further configured to: if the snapshot module writes the new data in the data modification request to a snapshot area of the storage medium, obtain snapshot incremental data, when snapshot recovery is required, according to And the second mapping relationship, the original data of the snapshot incremental data in the storage unit that needs to be restored in the snapshot area is obtained from the data storage area.
13、 根据权利要求 9-12任一所述的固态硬盘, 其特征在于, 所述快照 模块还用于若所述快照区已满, 且所述数据存储区存在需要备份到所述快 照区的快照增量数据时, 发出所述快照区已满的通知; 或删除最早存入所 述快照区的快照增量数据。  The solid state hard disk according to any one of claims 9 to 12, wherein the snapshot module is further configured to: if the snapshot area is full, and the data storage area needs to be backed up to the snapshot area When the snapshot is incremented, the notification that the snapshot area is full is issued; or the snapshot increment data that is first stored in the snapshot area is deleted.
更正页 则第 91条) Correction page then Article 91)
PCT/CN2011/081609 2010-12-14 2011-11-01 Snapshot method and solid state drive WO2012079432A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN 201010601955 CN102033793A (en) 2010-12-14 2010-12-14 Snapshot method and solid-state hard disk
CN201010601955.4 2010-12-14

Publications (1)

Publication Number Publication Date
WO2012079432A1 true WO2012079432A1 (en) 2012-06-21

Family

ID=43886724

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2011/081609 WO2012079432A1 (en) 2010-12-14 2011-11-01 Snapshot method and solid state drive

Country Status (2)

Country Link
CN (1) CN102033793A (en)
WO (1) WO2012079432A1 (en)

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102033793A (en) * 2010-12-14 2011-04-27 成都市华为赛门铁克科技有限公司 Snapshot method and solid-state hard disk
CN102591790B (en) * 2011-12-30 2015-11-25 记忆科技(深圳)有限公司 Data based on solid state hard disc store snapshot implementing method and solid state hard disc
US8793451B2 (en) * 2012-03-29 2014-07-29 International Business Machines Corporation Snapshot content metadata for application consistent backups
CN102693173A (en) * 2012-05-15 2012-09-26 记忆科技(深圳)有限公司 File processing method based on snapshot and solid state disk with snapshot function
CN103761159B (en) * 2014-01-23 2017-05-24 天津中科蓝鲸信息技术有限公司 Method and system for processing incremental snapshot
CN104375904A (en) * 2014-10-30 2015-02-25 浪潮电子信息产业股份有限公司 Disaster recovery backup method based on snapshot differentiation data transmission
CN107506311B (en) * 2017-08-30 2020-10-20 苏州浪潮智能科技有限公司 Method and device for flashing FTL (flash translation layer) table of solid state disk
CN109189546B (en) * 2018-07-11 2021-04-06 新华三云计算技术有限公司 Method and device for making online snapshot of virtual machine
CN110516479B (en) * 2019-08-16 2021-08-10 济南浪潮数据技术有限公司 Data writing method and related device
CN114063890A (en) * 2020-08-05 2022-02-18 宇瞻科技股份有限公司 Data backup method and storage device
CN113254265B (en) * 2021-05-10 2023-03-14 苏州库瀚信息科技有限公司 Snapshot implementation method and storage system based on solid state disk
CN117311911B (en) * 2023-11-29 2024-02-23 苏州元脑智能科技有限公司 Virtual machine snapshot method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6434681B1 (en) * 1999-12-02 2002-08-13 Emc Corporation Snapshot copy facility for a data storage system permitting continued host read/write access
US6594744B1 (en) * 2000-12-11 2003-07-15 Lsi Logic Corporation Managing a snapshot volume or one or more checkpoint volumes with multiple point-in-time images in a single repository
CN101201774A (en) * 2006-12-15 2008-06-18 英业达股份有限公司 Method for snapshot of magnetic disc
TW201020760A (en) * 2008-11-18 2010-06-01 Lsi Corp System and method for recovering solid state drive data
CN102033793A (en) * 2010-12-14 2011-04-27 成都市华为赛门铁克科技有限公司 Snapshot method and solid-state hard disk

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101477483B (en) * 2008-12-31 2011-02-02 成都市华为赛门铁克科技有限公司 Snap processing method and apparatus based on non-volatile memory medium
CN101819543A (en) * 2010-02-01 2010-09-01 成都市华为赛门铁克科技有限公司 Snapshot data processing method, system and storage device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6434681B1 (en) * 1999-12-02 2002-08-13 Emc Corporation Snapshot copy facility for a data storage system permitting continued host read/write access
US6594744B1 (en) * 2000-12-11 2003-07-15 Lsi Logic Corporation Managing a snapshot volume or one or more checkpoint volumes with multiple point-in-time images in a single repository
CN101201774A (en) * 2006-12-15 2008-06-18 英业达股份有限公司 Method for snapshot of magnetic disc
TW201020760A (en) * 2008-11-18 2010-06-01 Lsi Corp System and method for recovering solid state drive data
CN102033793A (en) * 2010-12-14 2011-04-27 成都市华为赛门铁克科技有限公司 Snapshot method and solid-state hard disk

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
ZHANG HUIJIAN: "Snapshot Technique of the Network Storage", TIDAL WAVE OF TECHNOLOGY, vol. 3, June 2009 (2009-06-01), pages 22,27 *

Also Published As

Publication number Publication date
CN102033793A (en) 2011-04-27

Similar Documents

Publication Publication Date Title
WO2012079432A1 (en) Snapshot method and solid state drive
US9767017B2 (en) Memory device with volatile and non-volatile media
US10817421B2 (en) Persistent data structures
US10649898B2 (en) Memory system, memory controller for memory system, operation method of memory controller, and operation method of user device including memory device
US10009438B2 (en) Transaction log acceleration
US9047178B2 (en) Auto-commit memory synchronization
US20190102262A1 (en) Automated continuous checkpointing
US8725934B2 (en) Methods and appratuses for atomic storage operations
US7783956B2 (en) Data recorder
US9218278B2 (en) Auto-commit memory
US7752492B1 (en) Responding to a failure of a storage system
TW201619971A (en) Green nand SSD application and driver
US8205049B1 (en) Transmitting file system access requests to multiple file systems
US10049036B2 (en) Reliable distributed messaging using non-volatile system memory
US8010543B1 (en) Protecting a file system on an object addressable storage system
US20090216973A1 (en) Computer system, storage subsystem, and data management method
WO2015020811A1 (en) Persistent data structures
US9767015B1 (en) Enhanced operating system integrity using non-volatile system memory
CN106776147B (en) Differential data backup method and differential data backup device
US9760480B1 (en) Enhanced logging using non-volatile system memory
US10521148B2 (en) Data storage device backup
US9990150B2 (en) Method to provide transactional semantics for updates to data structures stored in a non-volatile memory
US10452286B2 (en) Leveraging continuous replication to copy snapshot backup image
US8095804B1 (en) Storing deleted data in a file system snapshot
US10089220B1 (en) Saving state information resulting from non-idempotent operations in non-volatile system memory

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 11849567

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 11849567

Country of ref document: EP

Kind code of ref document: A1