Snapshot restoration method and device, electronic equipment and storage medium

Through sharded data group copying technology, the problem of excessive copy times during snapshot restoration is solved, the startup speed of the fast-start product is improved, and the system startup is achieved faster.

CN119248562APending Publication Date: 2025-01-03HANGZHOU EZVIZ SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310757498.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-25
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

The prior art requires page-by-page disassembly when restoring snapshots, resulting in the larger the data in the snapshot, the more copies, and the longer the time it takes, resulting in the slower the startup speed of the fast-start product.

Method used

By obtaining the destination snapshot to be restored and its destination address and shard number, the shard data group is determined, and the initial destination address and length are requested from the memory for each shard data group as the copy address, and the shard numbering order is the shard data group. Copy data to reduce the number of copies and time.

Benefits of technology

It improves the startup speed of the fast-start product, reduces the snapshot restore time, and enhances the system's fast-start capability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119248562A_ABST
    Figure CN119248562A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a snapshot restoration method and device, electronic equipment and a storage medium, and relates to the technical field of data processing. The method comprises the steps of obtaining a to-be-restored target snapshot, a destination address corresponding to each piece of fragment data in the target snapshot and a fragment number of each piece of fragment data; determining fragment data groups with continuous fragment numbers of the fragment data and continuous destination addresses of the fragment data from the fragment data; and for each fragmented data group, requesting a copy address starting from the destination address of the fragmented data with the smallest fragmented number in the fragmented data group and having the length equal to the sum of the lengths of all the fragmented data in the fragmented data group from the memory, and for each fragmented data group, copying each fragmented data group in the fragmented data group to the copy address. By applying the scheme provided by the embodiment of the invention, the number of times of copying the snapshots and the time for restoring the snapshots during restoring the snapshots are reduced, and the starting speed of the system is increased.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of data processing, and in particular to a snapshot restoration method, device, electronic device and storage medium. Background Art

[0002] A snapshot is a shot or record of data or system status at a certain moment. Snapshots are usually used for database backup and recovery, file system backup and recovery, virtual machine backup and recovery, etc. In life, many quick-start products, such as smart door locks, smart doorbells, smart cat eyes, battery cameras, etc., enter a dormant state when there is no external trigger event. When there is an external trigger, such as a battery camera detecting a pedestrian passing by, a user performing an operation in the product APP, etc., the product system will quickly restore the system and then respond to the external trigger event.

[0003] When the system enters the hibernation state, a snapshot is taken of the system. The product's operating system saves the data in the memory stick to a non-volatile storage device, which can retain the state of the system before it enters the hibernation state for a long time without the need for power supply. This process does not involve a copying process. When the quick-start product is started, it actually restores the snapshot, that is, all the data in the snapshot is copied to the specified memory address. In the prior art, when restoring the snapshot, the snapshot needs to be disassembled by page, and usually only 4Kb of data can be copied each time. Therefore, the larger the data in the snapshot, the more times it needs to be copied, the longer it takes to restore the snapshot, and the longer the startup time, which leads to a slower startup speed. Therefore, there is an urgent need for a method to increase the startup speed of quick-start products. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a snapshot restoration method, device, electronic device and storage medium to improve the startup speed of the quick start product. The specific technical solution is as follows:

[0005] In a first aspect, an embodiment of the present application provides a snapshot restoration method, the method comprising:

[0006] Obtaining a target snapshot to be restored and a destination address corresponding to each shard data in the target snapshot and a shard number of each shard data, where the shard number of each shard data is a storage order in which each shard data is stored in a non-volatile storage device;

[0007] Determine each shard data group from each shard data, wherein the shard numbers of each shard data in the shard data group are continuous and the destination addresses corresponding to each shard data are continuous;

[0008] For each of the shard data groups, request a copy address starting from an initial destination address and having a length equal to a first copy length from the memory, wherein the initial destination address is the destination address of the shard data with the smallest shard number in the shard data group, and the first copy length is the sum of the lengths of all the shard data in the shard data group;

[0009] For each of the shard data groups, each shard data in the shard data group is copied to the copy address in the order of each shard number.

[0010] In a possible implementation, determining each shard data group from each shard data includes:

[0011] Determine whether the destination address of the to-be-copied shard data is continuous with the destination address of the adjacent shard data, wherein the to-be-copied shard data is any shard data in the target snapshot, and the adjacent shard data is the next shard data whose number is adjacent to the to-be-copied shard data;

[0012] If yes, take the adjacent shard data as new shard data to be copied and return to execute the step of determining whether the destination address of the shard data to be copied is continuous with the destination address of the adjacent shard data, until the destination address of the shard data to be copied is not continuous with the destination address of the adjacent shard data;

[0013] The slice data to be copied are divided into the same slice data group.

[0014] In a possible implementation manner, the length of each of the slice data is a preset length, and the determining whether the destination address of the to-be-copied slice data is continuous with the destination address of the adjacent slice data includes:

[0015] If the destination address of the adjacent slice data is offset by the preset length relative to the destination address of the to-be-copied slice data, it is determined that the destination address of the to-be-copied slice data is continuous with the destination address of the adjacent slice data.

[0016] In a possible implementation manner, the length of each of the slice data is a preset length; and the method further includes:

[0017] If the destination address of the to-be-copied shard data is continuous with the destination address of the adjacent shard data, the second copy length is incremented by the preset length, wherein the second copy length is initially the preset length; the first copy length is the second copy length when the destination address of the to-be-copied shard data is discontinuous with the destination address of the adjacent shard data.

[0018] In a possible implementation, the method further includes:

[0019] If all the shard data in the target snapshot to be restored have not been copied, the adjacent shard data whose destination address is not continuous with the shard data to be copied is used as new shard data to be copied, and the step of determining whether the destination address of the shard data to be copied is continuous with the destination address of the adjacent shard data is performed;

[0020] If all the shard data in the target snapshot to be restored have been copied, the system is started.

[0021] In a second aspect, an embodiment of the present application provides a fast start method for a battery monitoring device, which is applied to the battery monitoring device, wherein the battery monitoring device includes a non-volatile storage device and a memory, and the non-volatile storage medium stores a system memory hibernation snapshot of the battery monitoring device, and the method includes:

[0022] In response to a power-on instruction, obtaining a system memory hibernation snapshot to be restored and a destination address corresponding to each shard data in the system memory hibernation snapshot and a shard number of each shard data, wherein the shard number of each shard data is a storage order in which each shard data is stored in the non-volatile storage device;

[0023] Determine each shard data group from each shard data, wherein the shard numbers of each shard data in the shard data group are continuous and the destination addresses corresponding to each shard data are continuous;

[0024] For each of the shard data groups, request a copy address starting from an initial destination address and having a length of a first copy length from the memory, wherein the initial destination address is the destination address of the shard data with the smallest shard number in the shard data group, and the first copy length is the sum of the lengths of all the shard data in the shard data group;

[0025] For each of the shard data groups, copy each shard data in the shard data group to the copy address in the order of the shard numbers;

[0026] When all the shard data in the system memory dormant snapshot to be restored have been copied, the system of the battery monitoring device is started.

[0027] In a third aspect, an embodiment of the present application provides a snapshot restoration device, the device comprising:

[0028] A shard data acquisition module, used to acquire a target snapshot to be restored and a destination address corresponding to each shard data in the target snapshot and a shard number of each shard data, where the shard number of each shard data is a storage order in which each shard data is stored in a non-volatile storage device;

[0029] A shard data group determination module, used to determine each shard data group from each shard data, wherein the shard numbers of each shard data in the shard data group are continuous and the destination addresses corresponding to each shard data are continuous;

[0030] a copy address request module, configured to request, for each of the shard data groups, from the memory a copy address starting with an initial destination address and having a length of a first copy length, wherein the initial destination address is a destination address of the shard data with the smallest shard number in the shard data group, and the first copy length is the sum of the lengths of all the shard data in the shard data group;

[0031] A shard data group copy module, for each shard data group, copies each shard data in the shard data group to the copy address in the order of each shard number;

[0032] In a possible implementation, the fragmentation data group determination module includes:

[0033] A judgment submodule, used to judge whether the destination address of the to-be-copied shard data is continuous with the destination address of the adjacent shard data, wherein the to-be-copied shard data is any of the shard data in the target snapshot, and the adjacent shard data is the next shard data whose number is adjacent to the to-be-copied shard data;

[0034] The return execution submodule is used for returning the adjacent slice data as new slice data to be copied to execute the step of determining whether the destination address of the slice data to be copied is continuous with the destination address of the adjacent slice data when the destination address of the slice data to be copied is continuous with the destination address of the adjacent slice data, until the destination address of the slice data to be copied is not continuous with the destination address of the adjacent slice data;

[0035] A shard data division submodule, used for dividing each of the shard data to be copied into the same shard data group;

[0036] In a possible implementation manner, the length of each of the shard data is a preset length, and the judgment submodule is specifically configured to determine that the destination address of the shard data to be copied is continuous with the destination address of the adjacent shard data if the destination address of the adjacent shard data is offset by the preset length relative to the destination address of the shard data to be copied;

[0037] In a possible implementation, the device further includes:

[0038] a length increasing module, configured to add the preset length to the second copy length when the destination address of the to-be-copied shard data is continuous with the destination address of the adjacent shard data, wherein the second copy length is initially the preset length; and the first copy length is the second copy length when the destination address of the to-be-copied shard data is not continuous with the destination address of the adjacent shard data;

[0039] In a possible implementation, the device further includes:

[0040] an execution module, configured to, when all the shard data in the target snapshot to be restored have not been copied, use the adjacent shard data whose destination address is not continuous with the shard data to be copied as new shard data to be copied, and execute the step of determining whether the destination address of the shard data to be copied is continuous with the destination address of the adjacent shard data;

[0041] The first startup module is used to start the system when all the shard data in the target snapshot to be restored have been copied.

[0042] In a fourth aspect, an embodiment of the present application provides a fast start device for a battery monitoring device, which is applied to the battery monitoring device, wherein the battery monitoring device includes a non-volatile storage device and a memory, and the non-volatile storage medium stores a system memory hibernation snapshot of the battery monitoring device, and the device includes:

[0043] an acquisition module, configured to acquire, in response to a power-on instruction, a system memory hibernation snapshot to be restored and a destination address corresponding to each shard data in the system memory hibernation snapshot and a shard number of each shard data, wherein the shard number of each shard data is a storage order in which each shard data is stored in the non-volatile storage device;

[0044] A determination module, used to determine each shard data group from each shard data, wherein the shard numbers of each shard data in the shard data group are continuous and the destination addresses corresponding to each shard data are continuous;

[0045] a request module, configured to request, for each of the shard data groups, from the memory a copy address starting with an initial destination address and having a length of a first copy length, wherein the initial destination address is a destination address of the shard data with the smallest shard number in the shard data group, and the first copy length is a sum of lengths of all shard data in the shard data group;

[0046] A copy module, for copying each of the shard data groups to the copy address in the order of the shard numbers;

[0047] The second startup module is used to start the system of the battery monitoring device when all the shard data in the system memory dormant snapshot to be restored have been copied.

[0048] In a fifth aspect, an embodiment of the present application provides an electronic device, including:

[0049] Memory, used to store computer programs;

[0050] The processor is used to implement any snapshot restoration method described in the present application when executing a program stored in the memory.

[0051] In a sixth aspect, an embodiment of the present application provides an electronic device, including:

[0052] Memory, used to store computer programs;

[0053] The processor is used to implement any quick start method for a battery monitoring device described in the present application when executing a program stored in the memory.

[0054] In a seventh aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the snapshot restoration method described in any one of the present application is implemented.

[0055] In an eighth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the quick start method for a battery monitoring device described in any one of the present application is implemented.

[0056] The snapshot restoration method provided by the embodiment of the present application obtains the target snapshot to be restored and the destination address corresponding to each shard data in the target snapshot and the shard number of each shard data; determines each shard data group from each shard data, wherein the shard numbers of each shard data in the shard data group are continuous and the destination addresses corresponding to each shard data are continuous; for each shard data group, requests the memory to copy the address starting with the initial destination address and having a length of the first copy length, wherein the initial destination address is the destination address of the shard data with the smallest shard number in the shard data group, and the first copy length is the sum of the lengths of all shard data in the shard data group; for each shard data group, copies each shard data group in the shard data group to the copy address. It can be seen that the present application copies each shard data in the shard data group with continuous shard numbers and continuous destination addresses of each shard data to the copy address in sequence according to the order of each shard number by requesting the memory to copy the address starting with the initial destination address and having a length of the first copy length, thereby reducing the number of snapshot copies and the time of snapshot restoration during snapshot restoration, and improving the speed of system startup.

[0057] Of course, implementing any product or method of the present application does not necessarily require achieving all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other embodiments can also be obtained based on these drawings.

[0059] Figure 1 An example diagram of the storage medium partition layout of an existing embedded device;

[0060] Figure 2a Flowchart for hibernation of existing Linux system;

[0061] Figure 2b Flowchart for waking up an existing Linux system;

[0062] Figure 3 It is a flow chart of the image restoration solution in the prior art;

[0063] Figure 4 A schematic diagram of a snapshot restoration method provided in an embodiment of the present application;

[0064] Figure 5 for Figure 4 A detailed schematic diagram of step S12 in FIG.

[0065] Figure 6 An example diagram of a snapshot restoration method provided in an embodiment of the present application;

[0066] Figure 7 A schematic diagram of a quick start method for a battery monitoring device provided in an embodiment of the present application;

[0067] Figure 8 A schematic diagram of the structure of a snapshot restoration device provided in an embodiment of the present application;

[0068] Fig. 9 A schematic diagram of the structure of a quick start device for a battery monitoring device provided in an embodiment of the present application;

[0069] Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0070] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field based on the present application belong to the scope of protection of the present application.

[0071] First, the professional terms in the embodiments of the present application are explained:

[0072] Linux system: The full name is GNU / Linux, which is a free to use and free to spread Unix-like operating system. It is a POSIX-based multi-user, multi-tasking operating system that supports multi-threading and multi-CPU.

[0073] Boot partition: A partition on a computer's hard disk, usually used to store boot programs and operating system kernel files. In the Linux operating system, the Boot partition is a separate partition mounted in the / Boot directory.

[0074] ENV partition: A partition used to store environment variables in embedded systems.

[0075] OS: The full English name is Operating System, abbreviated as OS, which means operating system.

[0076] APP partition: system application partition.

[0077] SWP partition: The full name is swap partition, which is the partition used for swap space in the Linux operating system.

[0078] CFG partition: A partition used to store network configuration, startup parameters, device serial number and other data in some specific embedded systems or devices.

[0079] DDR: The full name of DDR is Double Date Rate, which means double rate synchronous dynamic random access memory.

[0080] Hibernate: Turn off the computer while preserving its state. When hibernating, the operating system saves the contents of RAM to a non-volatile storage device that can retain the state for a long time without power. After resuming, the computer is exactly the same as before entering hibernation.

[0081] RAM: The full name of RAM is Random-Access Memory, which is a memory stick, usually used as a temporary data storage medium for the operating system or other running programs.

[0082] With the development of science and technology, more and more quick-start products have entered people's lives, such as smart door locks, smart doorbells, smart cat eyes, and battery cameras, making life smarter and more portable. Embedded systems play a very important role in quick-start products, responsible for various functions and operations of quick-start products.

[0083] The embedded device storage media partition layout is as follows Figure 1 As shown in the figure, the ENV partition is a partition used to store environment variables in an embedded system, and the CFG partition is a partition used to store network configuration, startup parameters, device serial number and other data in some specific embedded systems or devices. When the embedded device is powered on, the Boot program boots the OS. After the OS is successfully executed, the APP partition is mounted, and then the main business program of the device is run. If the embedded device supports the sleep function, there is also a SWP partition in the embedded device. In the prior art, the flowchart of the Linux system sleep and wakeup is as follows: Figure 2a and 2b As shown, Figure 2a This is a flowchart of Linux system hibernation. Figure 2b This is a flowchart for waking up the Linux system. When the system business processing is completed, when the shutdown command is received, the operating system will select fast sleep or shutdown according to the type of shutdown command. If it is fast sleep, a snapshot of the content in the system RAM is made and saved to a non-volatile storage device, that is, the system snapshot is saved and the power is cut off; the next time the computer is turned on, the Boot program will judge the validity of the system snapshot in the SWP partition. If it is valid, the snapshot is read from the SWP partition to the system memory, and the system snapshot is quickly restored to start the device system. If the snapshot is invalid, the OS is directly loaded to start the system.

[0084] The existing technology for restoring snapshots is as follows: Figure 3 As shown in the figure, when restoring a snapshot, each time the data of the memory page size (usually 4Kb) in the SWP partition is restored to the memory address pointed to by the meta segment page until the restoration is completed. It can be seen that the larger the data in the snapshot, the more times it needs to be copied, the longer it takes to restore the snapshot, and the longer the startup time, which leads to a slower startup speed. Therefore, there is an urgent need for a method to improve the startup speed of fast-start products.

[0085] In order to improve the startup speed of the quick-start product, the first aspect of the embodiment of the present application first provides a snapshot restoration method, which can be applied to an electronic device. In a specific embodiment, the electronic device can be an electronic product with an embedded system, or a server that performs online control of the quick-start product, both of which are within the protection scope of the present application.

[0086] See also Figure 4, an embodiment of the present application provides a snapshot restoration method, the method comprising:

[0087] Step S11, obtaining the target snapshot to be restored and the destination address corresponding to each shard data in the target snapshot and the shard number of each shard data, where the shard number of each shard data is the storage order in which each shard data is stored in the non-volatile storage device;

[0088] Among them, the non-volatile storage medium can still maintain data information when the system is shut down or there is no power supply. The non-volatile storage medium in this application can be any type of non-volatile memory, specifically, it can be flash memory, flash memory, disk storage, etc.

[0089] The destination address corresponding to each shard data refers to the address corresponding to each storage unit in the DDR of each shard data in the target snapshot after the target snapshot is copied to the DDR. The shard number of each shard data refers to the order in which each shard data in the target snapshot is stored when the target snapshot is saved in the non-volatile storage device. It can be understood that the shard number in this application only represents an identification, and is not a specific number such as "1, 2, 3..." or "a, b, c...".

[0090] In an embodiment of the present application, the destination addresses of each shard data may be continuous or discontinuous. Specifically, address continuity means that the addresses corresponding to two adjacent storage units in the memory are continuous. By way of example, in an embodiment of the present application, the storage space of each storage unit is equal, that is, 4Kb. Assuming that the address of the first storage unit in the memory is 0x1000, and data from 0 to 4095b are stored in the storage unit, the address of the storage unit adjacent to the storage unit should be 0x1001, and data from 4096 to 8191b are stored in the storage unit.

[0091] Step S12, determining each shard data group from each shard data, wherein the shard numbers of each shard data in the shard data group are continuous and the destination addresses corresponding to each shard data are continuous;

[0092] To determine each shard data group from each shard data, the destination address of the shard data and the destination address of the next shard data of the shard data can be judged for each shard data, wherein the next shard data of the shard data is recorded as the shard data adjacent to the shard number of the shard data, and then the shard data with continuous destination addresses are merged into one shard data group. In the embodiment of the present application, there is no need to first judge whether the destination addresses of every two adjacent shard data in all the shard data are continuous. It is only necessary to judge whether the destination address of each shard data and the adjacent shard data are continuous until the destination addresses of two adjacent shard data are discontinuous, and the shard data with continuous shard numbers and continuous destination addresses of the shard data are divided into one shard data group. For example, assume that there are 5 shard data respectively recorded as shard data 1-5. After judgment, the destination address of shard data 1 is not continuous with the destination address of shard data 2, then shard data 1 is determined as shard data group 1, and then it is judged that the destination addresses of shard data 2 and shard data 3 are continuous, and the destination addresses of shard data 2 and shard data 3 are not continuous, then shard data 2 and shard data 3 are merged into shard data group 2, and then it is judged that the destination addresses of shard data 4 and shard data 5 are continuous, then shard data 4 and shard data 5 are merged into shard data group 3.

[0093] Alternatively, in all the shard data of the target snapshot, the shard data with adjacent shard data numbers and continuous shard data destination addresses are merged into a shard data group to obtain multiple shard data groups. In the embodiment of the present application, for all adjacent shard data in the target snapshot, it is determined whether the destination addresses of the shard addresses of every two adjacent shard data are continuous, and then the shard data with continuous shard numbers and continuous shard data destination addresses are divided into one shard data group. Exemplarily, assuming that there are 5 shard data respectively recorded as shard data 1-5, after determination, the destination address of shard data 1 is not continuous with the destination addresses of other shard data, the destination addresses of shard data 2 and shard data 3 are continuous, and the destination addresses of shard data 4 and shard data 5 are continuous, then it is determined that shard data 1 constitutes shard data group 1, shard data 2 and shard data 3 are merged into shard data group 2, and shard data 4 and shard data 5 are merged into shard data group 3.

[0094] Among them, there is at least one shard data group in which the number of shard data is greater than 2.

[0095] Step S13, for each shard data group, requesting a copy address starting with an initial destination address and having a length equal to a first copy length from the memory, wherein the initial destination address is the destination address of the shard data with the smallest shard number in the shard data group, and the first copy length is the sum of the lengths of all shard data in the shard data group;

[0096] The copy length refers to the data length involved in data copying, and the first copy length is the sum of the lengths of all shard data in the shard data group. The number of shard data included in each shard data group is not fixed, that is, the first copy length of each shard data group is not the same. When copying data, if the copy length is too small, multiple copies may be required, and if the copy length is too large, memory overflow or data corruption may occur.

[0097] The initial destination address is the destination address of the fragment data with the smallest fragment number in the fragment data group. The smallest fragment number only means that the fragment data in the current fragment data group are stored in the first order, not the specific fragment number. Figure 3 For example, Figure 3 The "page_2(M-1)", "page_2M-1", "page_2M", "page_2M+1", "page_2M+2", and "page_2M+3" in the table represent different shard data stored in sequence. If a shard data group is composed of "page_2(M-1)", "page_2M-1", and "page_2M", the initial destination address is the destination address of "page_2(M-1)"; if a shard data group is composed of "page_2M+1", "page_2M+1", and "page_2M+2", the initial destination address is the destination address of "page_2M+1".

[0098] In the present application, the length of the destination address of each shard data is a preset length, which is equal to the size of each shard data. For example, when a shard data of size 4Kb is copied to DDR, the destination address of the shard data in DDR is 4001Kb-8000Kb.

[0099] The copy address requested from the memory with the initial destination address as the starting point and the length as the first copy length refers to the address of the fragment data whose destination address in the fragment data group is the sum of the lengths of all the fragment data in the fragment data group, and the fragment data in the fragment data group is stored in the non-volatile storage medium with the earliest order as the initial destination address. For example, assuming that the fragment data in a certain fragment data group are stored in the order of fragment data 2 and fragment data 3, the lengths of fragment data 2 and 3 are both 4Kb, the destination address of fragment data 2 is address x, and the destination address of fragment data 3 is y, then the copy address requested from the memory with address x as the starting destination address and address y as the ending destination address, wherein the length of the copy address is 8Kb.

[0100] Step S14: for each shard data group, copy each shard data in the shard data group to the copy address in the order of each shard number.

[0101] Copying each slice data in the slice data group to the copy address in the order of each slice number means that for each slice data of the same slice data, the slice data is stored in the DDR according to the storage sequence of the slice data in the non-volatile storage medium. For example, assuming that the order in which each slice data in the slice data group 3 is stored in the non-volatile storage medium is: slice data 4, slice data 5, slice data 6, then in the DDR, the slice data in the slice data group is also stored in the order of: slice data 4, slice data 5, slice data 6.

[0102] In a specific embodiment, as shown in the following table, the table contains all data in a target snapshot instance, and the size of the target snapshot is 17276928 BYTE.

[0103] Table 1

[0104]

[0105] In the prior art, when restoring a snapshot, only 4Kb of data, i.e., 4096BYTE data, can be copied each time. When copying a target snapshot consisting of 17276928BYTE (16872Kb) of data, the target snapshot includes 16872 / 4=4218 shards of data, i.e., it needs to be copied 4218 times. In the present application, adjacent data with continuous destination addresses are moved at one time. For example, "1" and "4538368" in the above table mean that the fragment data group numbered "1" includes 4538368 BYTE data, that is, 4432Kb of data. Since the size of each fragment data in the present application is 4Kb, the "1" and "4538368" in the above table actually mean that the fragment data group numbered "1" includes 4432 / 4=1108 fragment data, that is, there are 11 fragment data groups with adjacent fragment numbers and continuous destination addresses in the fragment data group numbered "1". 08 slice data, when the slice data group is copied, 1108 slice data can be copied at one time; the "5" and "4096" in the above table mean that the slice data group numbered "5" includes 4096 BYTE data, that is, 4Kb of data. Since the size of each slice data in the present application is 4Kb, the "5" and "4096" in the above table actually mean that the slice data group numbered "5" includes 4 / 4=1 slice data, that is, there is no slice data with adjacent slice data numbers and continuous destination addresses in the slice data group numbered "5". In the embodiment of the present application, for the entire target snapshot, it is not necessary to copy each shard data once. It is only necessary to divide the shard data with adjacent shard data numbers and continuous destination addresses into the same shard data group for copying. In this way, 17276928 BYTE (16872Kb) of data only needs to be copied 83 times, which greatly reduces the number of copies compared to 4218 times.

[0106] By adopting the method of the embodiment of the present application, by requesting a copy address starting with an initial destination address and having a length of a first copy length from the memory, each shard data in a shard data group with consecutive shard numbers and consecutive destination addresses of each shard data is copied to the copy address in the order of each shard number, thereby reducing the number of snapshot copies and the snapshot restoration time during snapshot restoration and improving the system startup speed.

[0107] Figure 5 for Figure 4 A detailed schematic diagram of step S12 in FIG. Figure 5 In a possible implementation, the above step S12 may specifically include the following steps:

[0108] Step S121, determining whether the destination address of the to-be-copied shard data is continuous with the destination address of the adjacent shard data, wherein the to-be-copied shard data is any shard data in the target snapshot, and the adjacent shard data is the next shard data whose number is adjacent to the to-be-copied shard data;

[0109] Since the memory layout of the Linux system is discontinuous on the RAM, when performing snapshot restoration, the snapshot cannot be copied to the memory at one time, but the snapshot needs to be disassembled by page and then copied to the corresponding memory address. Therefore, when performing snapshot restoration, it is necessary to first determine the storage address of each shard data in the target snapshot in the DDR. In the present application, when the shard data in the non-volatile storage medium is copied to the DDR, it is copied according to the order of each shard data in the target snapshot in the non-volatile storage medium. For example, each shard data in the target snapshot is stored in the non-volatile storage medium in the order of: shard data 1, shard data 2, shard data 3. When performing snapshot restoration, first copy shard data 1 to DDR, then copy shard data 2 to DDR, and finally copy shard data 3 to DDR.

[0110] The shard data to be copied is any shard data in the target snapshot, which means that when a shard data in the target snapshot is copied, the shard data is the shard data to be copied. For example, when shard data 1 is copied, the shard data to be copied is shard data 1, and when shard data 2 is copied, the shard data to be copied is shard data 2.

[0111] The adjacent shard data is the next shard data whose number is adjacent to the shard data to be copied. Specifically, it means that the storage order of the shard data to be copied and the adjacent shard data in the non-volatile storage medium is adjacent. Exemplarily, the shard data in the target snapshot are stored in the non-volatile storage medium in the order of: shard data 1, shard data 2, and shard data 3. When shard data 1 is stored, the shard data to be copied is shard data 1, and the adjacent shard data is shard data 2. When shard data 2 is stored, the shard data to be copied is shard data 2, and the adjacent shard data is shard data 3.

[0112] Step S122: If yes, the adjacent shard data is used as the new shard data to be copied and returned to execute the step of determining whether the destination address of the shard data to be copied is continuous with the destination address of the adjacent shard data, until the destination address of the shard data to be copied is not continuous with the destination address of the adjacent shard data;

[0113] If the destination address of the shard data to be copied is continuous with the destination address of the adjacent shard data, the adjacent shard data is used as the new shard data to be copied, and it is further determined whether the destination addresses of the shard data to be copied and the adjacent shard data are continuous. It can be understood that the adjacent shard data at this time is the shard data adjacent to the new shard data to be copied. Exemplarily, each shard data in the target snapshot is stored in the non-volatile storage medium according to: shard data 1, shard data 2, and shard data 3. When storing shard data 1, shard data 1 is used as the shard data to be copied, and shard data 2 is used as the adjacent shard data. After determining that the destination addresses of shard data 1 and shard data 2 are continuous, shard data 2 is used as the new shard data to be copied, and shard data 3 is used as the adjacent shard data.

[0114] Step S123, dividing each of the to-be-copied fragment data into the same fragment data group.

[0115] Classifying each to-be-copied shard data into the same shard data group means classifying each shard data with consecutive shard numbers and consecutive destination addresses into the same shard data group. Exemplarily, after judging that, in shard data 1-5, the destination addresses of shard data 1 and shard data 2 are consecutive, the destination addresses of shard data 3, shard data 4 and shard data 5 are consecutive, and the destination addresses of shard data 2 and shard data 3 are not consecutive, shard data 1 and shard data are classified into shard data group 1, and shard data 3, shard data 4 and shard data 5 are classified into shard data group 2. Specifically, when it is determined that the destination addresses of the shard data to be copied are continuous with those of the adjacent shard data, the shard data to be copied and the adjacent shard data are divided into shard data groups. Alternatively, when it is determined that the destination addresses of the shard data to be copied are continuous with those of the adjacent shard data, specific identifiers of the adjacent shard data with continuous destination addresses are recorded, until the destination address of the copied shard data is discontinuous with that of the adjacent shard data, at which time the recorded shard data are divided into the same shard data group. Exemplarily, each shard data in the target snapshot is stored in the non-volatile storage medium in the order of: shard data 1, shard data 2, shard data 3, and shard data 4. If it is determined that the destination addresses of shard data 2 and shard data 1 are continuous, a specific identifier of shard data 1 and 2 is recorded. If it is further determined that the destination addresses of shard data 3 and shard data 2 are continuous, the specific identifier of shard data 3 is recorded together with a specific identifier of shard data 3 and shard data 1 and 2. When it is determined that the destination addresses of shard data 4 and shard data 3 are not continuous, the recorded shard data 1, shard data 2, and shard data 3 are divided into shard data group 1.

[0116] In another embodiment, each shard data to be copied may be divided into a plurality of the same shard data groups. For example, each shard data in the target snapshot is stored in the non-volatile storage medium according to: shard data 1, shard data 2, shard data 3, and shard data 4. If it is determined that the destination addresses of shard data 1 and shard data 2 are continuous, the destination addresses of shard data 2 and shard data 3 are continuous, and the destination addresses of shard data 3 and shard data 4 are continuous, then shard data 1, shard data 2, shard data 3, and shard data 4 may all be divided into shard data group x, or shard data 1 and shard data 2 may be divided into shard data group y, and shard data 3 and shard data 4 may be divided into shard data group z.

[0117] By adopting the method of the embodiment of the present application, by judging whether the destination address of the shard data to be copied is continuous with the destination address of the adjacent shard data, and when the destination address of the shard data to be copied is continuous with the destination address of the adjacent shard data, the adjacent shard data is returned as the new shard data to be copied to execute the step of judging whether the destination address of the shard data to be copied is continuous with the destination address of the adjacent shard data, thereby dividing the shard data with adjacent shard numbers and continuous destination addresses into the same shard data group, so that the shard data with adjacent shard numbers and continuous destination addresses can be copied once subsequently, without the need to copy each shard data multiple times, thereby reducing the number of copies of the shard data of the target snapshot and the time for snapshot restoration.

[0118] In a possible implementation, the length of each fragment data is a preset length, and the above step S121 may specifically include:

[0119] If the destination address of the adjacent slice data is offset by the preset length relative to the destination address of the to-be-copied slice data, it is determined that the destination address of the to-be-copied slice data is continuous with the destination address of the adjacent slice data.

[0120] Storage units are usually laid out according to certain rules. In the present application, storage units are divided according to preset rules, so that the destination addresses of each storage unit are offset according to the preset rules. Specifically, if the preset rule is to divide by bytes, the destination addresses of two adjacent storage units will be offset by a byte length; if the preset rule is to divide by a preset length, the destination addresses of two adjacent storage units will be offset by a preset length. Conversely, if the two destination addresses are offset by a preset length, the two destination addresses are continuous.

[0121] By adopting the method of the embodiment of the present application, it is determined that the destination address of the adjacent shard data is offset by a preset length with respect to the destination address of the shard data to be copied, so as to determine that the destination addresses of the shard data to be copied and the adjacent shard data are continuous, thereby improving the speed of dividing the shard data with adjacent numbers and continuous destination addresses into the same shard data group.

[0122] In a possible implementation, the length of each of the slice data is a preset length; and the method further includes:

[0123] If the fragment data to be copied is, the second copy length is added to the preset length, wherein the second copy length is initially the preset length; the first copy length is the second copy length when the destination address of the fragment data to be copied is not continuous with the destination address of the adjacent fragment data.

[0124] In the present application, the length of each shard data is a preset length. When the first copy is performed or the destination address of the shard data to be copied is not continuous with the destination address of the adjacent shard data, and the adjacent shard data is copied as the new shard data to be copied, the second copy length is the preset length. When the destination address of the shard data to be copied is continuous with the destination address of the adjacent shard data, and the adjacent shard data is copied as the new shard data to be copied, a preset length is added to the second copy length. For example, assuming that the shard data in a certain shard data group are stored in the order of: shard data 1, shard data 2, shard data 3, and the length of each shard data is 4Kb, when shard data 1 is copied, the second copy length is 4Kb. When the destination addresses of shard data 1 and shard data 2 are continuous, the second copy length is added to the preset length, that is, the second copy length is 8Kb.

[0125] When the destination address of the to-be-copied fragment data is not continuous with the destination address of the adjacent fragment data, the second copy length is equal to the first copy length. For example, in the above example, if the destination addresses of fragment data 2 and fragment data 3 are not continuous, the second copy length is 8Kb, and the sum of the lengths of all fragment data in the fragment data group composed of fragment data 1 and fragment data 2 is also 8Kb, that is, the first copy length is 8Kb.

[0126] By adopting the method of the embodiment of the present application, the second copy length is increased when the destination address of the to-be-copied shard data is continuous with the destination address of the adjacent shard data, so as to avoid as much as possible the problem of reduced copy speed caused by multiple copies when the second copy length is too small, and also reduce the problem of data corruption or memory overflow caused by too long a second copy length.

[0127] In a possible implementation, the method further includes:

[0128] If all the shard data in the target snapshot to be restored have not been copied, the adjacent shard data whose destination address is not continuous with the shard data to be copied is used as the new shard data to be copied, and the step of determining whether the destination address of the shard data to be copied is continuous with the destination address of the adjacent shard data is performed;

[0129] If all shard data in the target snapshot to be restored has been copied, start the system.

[0130] The adjacent shard data that is not continuous with the destination address of the shard data to be copied refers to the last shard data to be copied in the shard data group that has been copied. After each copy, it can be determined whether all the shard data in the target snapshot have been copied. If there are still shard data that have not been copied in the target snapshot, the shard data adjacent to the shard data to be copied at the end of the sequence in the shard data group that has been copied last time is used as the new shard data to be copied, and it is continued to be determined whether the destination addresses of the shard data to be copied and the adjacent shard data are continuous. Exemplarily, the destination addresses of shard data 1 and shard data 2 are continuous, and the destination addresses of shard data 2 and shard data 3 are not continuous. Shard data 1 and shard data 2 are divided into shard data group 1, and after shard data group 1 is copied to DDR, it is determined that there are still shard data 3 and shard data 4 in the target snapshot that have not been copied. Then, shard data 3 is used as the new shard data to be copied, and it is continued to be determined whether the destination address of shard data 3 is continuous with the destination address of the adjacent shard data 4.

[0131] By adopting the method of the embodiment of the present application, each time the copy is completed, it is determined whether all the shard data in the target snapshot has been copied, so that when the copy is not completed, the destination address of the adjacent shard data and the destination address of the shard data to be copied are continuously detected, and the system is started when the copy is completed to ensure the integrity of the target snapshot restoration so that the system can start normally.

[0132] In order to illustrate the method of the embodiment of the present application, the following is described in conjunction with specific embodiments. Figure 6 , Figure 6An example diagram of the snapshot restoration method provided for the implementation of the present application, first, when the device is powered on, it is detected that the target snapshot is stored in the non-volatile storage medium, then the shard data in the snapshot is started to be moved, which is equivalent to copying the shard data in the above text, and then it is detected whether the target snapshot has been moved. If all the shard data in the target snapshot have been moved, the device system is started, which is equivalent to starting the system if all the shard data in the target snapshot to be restored have been copied in the above text; if it is detected that the target snapshot has not been moved, it is detected whether the destination address of the current page is adjacent to the destination address of the next page, which is equivalent to if all the shard data in the target snapshot to be restored have not been copied in the above text, then the adjacent shard data to be copied that are not continuous with the destination address of the shard data to be copied are moved. The shard data is used as the new shard data to be copied, and the step of determining whether the destination address of the shard data to be copied is continuous with the destination address of the adjacent shard data is performed. Detecting whether the destination address of the current page is adjacent to the destination address of the next page is equivalent to step S121 in the above text; if they are adjacent, the transport length is increased and the next page is returned as the new current page to perform the step of detecting whether the destination address of the current page is adjacent to the destination address of the next page, which is equivalent to adding the preset length to the second copy length in the above text. The transport length is equivalent to the second copy length in the above text. If the destination address of the current page is not adjacent to the destination address of the next page, the data of the length after the current accumulation is transported, and the step of detecting whether the target snapshot has been transported is continued. It is equivalent to step S122 and step S123 in the above text.

[0133] In a second aspect of the present application, a fast start method for a battery monitoring device is provided, which is applied to the battery monitoring device, wherein the battery monitoring device includes a non-volatile storage device and a memory, and the non-volatile storage medium stores a system memory hibernation snapshot of the battery monitoring device, such as Figure 7 As shown, the method includes:

[0134] Step S71, in response to the power-on instruction, obtaining the system memory hibernation snapshot to be restored and the destination address corresponding to each shard data in the system memory hibernation snapshot and the shard number of each shard data, where the shard number of each shard data is the storage order in which each shard data is stored in the non-volatile storage device;

[0135] The system memory hibernation snapshot to be restored is the target snapshot to be restored. It is understandable that only when a power-on instruction is received, the battery monitoring device can respond to the power-on instruction and obtain the system memory hibernation snapshot to be restored.

[0136] Step S72, determining each fragment data group from each fragment data, wherein the fragment numbers of each fragment data in the fragment data group are continuous and the destination addresses corresponding to each fragment data are continuous;

[0137] Step S73, for each shard data group, requesting a copy address starting with the initial destination address and having a length equal to the first copy length from the memory, wherein the initial destination address is the destination address of the shard data with the smallest shard number in the shard data group, and the first copy length is the sum of the lengths of all shard data in the shard data group;

[0138] Step S74, for each shard data group, copy each shard data in the shard data group to the copy address in the order of each shard number;

[0139] Step S75 , when all the shard data in the system memory dormant snapshot to be restored have been copied, the system of the battery monitoring device is started.

[0140] By adopting the method of the embodiment of the present application, by requesting a copy address starting with an initial destination address and having a length of a first copy length from the memory, each shard data in a shard data group with consecutive shard numbers and consecutive destination addresses of each shard data is copied to the copy address in the order of each shard number, thereby reducing the number of snapshot copies when restoring the system memory hibernation snapshot and the time for restoring the system memory hibernation snapshot, and improving the system startup speed of the battery monitoring device.

[0141] Corresponding to the above method embodiment, the third aspect of the present application provides a snapshot restoration device, such as Figure 8 As shown, the device comprises:

[0142] The shard data acquisition module 801 is used to acquire the target snapshot to be restored and the destination address corresponding to each shard data in the target snapshot and the shard number of each shard data, where the shard number of each shard data is the storage order in which each shard data is stored in the non-volatile storage device;

[0143] A fragment data group determination module 802 is used to determine each fragment data group from each fragment data, wherein the fragment numbers of each fragment data in the fragment data group are continuous and the destination addresses corresponding to each fragment data are continuous;

[0144] The copy address request module 803 is used to request, for each of the shard data groups, a copy address starting with an initial destination address and having a length of a first copy length from the memory, wherein the initial destination address is the destination address of the shard data with the smallest shard number in the shard data group, and the first copy length is the sum of the lengths of all the shard data in the shard data group;

[0145] A shard data group copying module 804 is used for copying each shard data in the shard data group to the copy address in the order of the shard numbers for each shard data group;

[0146] By adopting the embodiment of the present application, by requesting a copy address starting with an initial destination address and having a length of the first copy length from the memory, each shard data in a shard data group with consecutive shard numbers and consecutive destination addresses of each shard data is copied to the copy address in the order of each shard number, thereby reducing the number of snapshot copies and the snapshot restoration time during snapshot restoration and improving the system startup speed.

[0147] In a possible implementation, the fragment data group determination module 802 includes:

[0148] A judgment submodule, used to judge whether the destination address of the to-be-copied shard data is continuous with the destination address of the adjacent shard data, wherein the to-be-copied shard data is any of the shard data in the target snapshot, and the adjacent shard data is the next shard data whose number is adjacent to the to-be-copied shard data;

[0149] The return execution submodule is used for returning the adjacent slice data as new slice data to be copied to execute the step of determining whether the destination address of the slice data to be copied is continuous with the destination address of the adjacent slice data when the destination address of the slice data to be copied is continuous with the destination address of the adjacent slice data, until the destination address of the slice data to be copied is not continuous with the destination address of the adjacent slice data;

[0150] A shard data division submodule, used for dividing each of the shard data to be copied into the same shard data group;

[0151] In a possible implementation manner, the length of each of the shard data is a preset length, and the judgment submodule is specifically configured to determine that the destination address of the shard data to be copied is continuous with the destination address of the adjacent shard data if the destination address of the adjacent shard data is offset by the preset length relative to the destination address of the shard data to be copied;

[0152] In a possible implementation, the device further includes:

[0153] a length increasing module, configured to add the preset length to the second copy length when the destination address of the to-be-copied shard data is continuous with the destination address of the adjacent shard data, wherein the second copy length is initially the preset length; and the first copy length is the second copy length when the destination address of the to-be-copied shard data is not continuous with the destination address of the adjacent shard data;

[0154] In a possible implementation, the device further includes:

[0155] an execution module, configured to, when all the shard data in the target snapshot to be restored have not been copied, use adjacent shard data that is discontinuous with the destination address of the shard data to be copied as new shard data to be copied, and execute a step of determining whether the destination address of the shard data to be copied is continuous with the destination address of the adjacent shard data;

[0156] The startup module is used to start the system when all the shard data in the target snapshot to be restored have been copied.

[0157] Corresponding to the above method embodiment, a fourth aspect of the embodiment of the present application provides a fast start device for a battery monitoring device, which is applied to the battery monitoring device. The battery monitoring device includes a non-volatile storage device and a memory. The non-volatile storage medium stores a system memory hibernation snapshot of the battery monitoring device, such as Fig. 9 As shown, the device comprises:

[0158] The acquisition module 901 is used to obtain, in response to the power-on instruction, the system memory hibernation snapshot to be restored and the destination address corresponding to each shard data in the system memory hibernation snapshot and the shard number of each shard data, where the shard number of each shard data is the storage order in which each shard data is stored in the non-volatile storage device;

[0159] A determination module 902 is used to determine each shard data group from each shard data, wherein the shard numbers of each shard data in the shard data group are continuous and the destination addresses corresponding to each shard data are continuous;

[0160] The request module 903 is used to request, for each shard data group, a copy address starting from an initial destination address and having a length of a first copy length from the memory, wherein the initial destination address is the destination address of the shard data with the smallest shard number in the shard data group, and the first copy length is the sum of the lengths of all shard data in the shard data group;

[0161] A copy module 904 is used for copying each of the shard data groups to a copy address in the order of the shard numbers.

[0162] The second starting module 905 is used to start the system of the battery monitoring device when all the shard data in the system memory dormant snapshot to be restored have been copied.

[0163] like Fig.10 As shown, the embodiment of the present application also provides an electronic device, including:

[0164] Memory 1001, used for storing computer programs;

[0165] The processor 1002 is used to implement the following steps when executing the program stored in the memory:

[0166] Obtaining a target snapshot to be restored and a destination address corresponding to each shard data in the target snapshot and a shard number of each shard data, where the shard number of each shard data is a storage order in which each shard data is stored in a non-volatile storage device;

[0167] Determine each shard data group from each shard data, wherein the shard numbers of each shard data in the shard data group are continuous and the destination addresses corresponding to each shard data are continuous;

[0168] For each of the shard data groups, request a copy address starting from an initial destination address and having a length equal to a first copy length from the memory, wherein the initial destination address is the destination address of the shard data with the smallest shard number in the shard data group, and the first copy length is the sum of the lengths of all the shard data in the shard data group;

[0169] For each of the shard data groups, each shard data in the shard data group is copied to the copy address in the order of each shard number.

[0170] The present application also provides an electronic device, including:

[0171] Memory, used to store computer programs;

[0172] The processor is used to execute the program stored in the memory, and implements the following steps:

[0173] In response to a power-on instruction, obtaining a system memory hibernation snapshot to be restored and a destination address corresponding to each shard data in the system memory hibernation snapshot and a shard number of each shard data, wherein the shard number of each shard data is a storage order in which each shard data is stored in the non-volatile storage device;

[0174] Determine each shard data group from each shard data, wherein the shard numbers of each shard data in the shard data group are continuous and the destination addresses corresponding to each shard data are continuous;

[0175] For each of the shard data groups, request a copy address starting from an initial destination address and having a length of a first copy length from the memory, wherein the initial destination address is the destination address of the shard data with the smallest shard number in the shard data group, and the first copy length is the sum of the lengths of all the shard data in the shard data group;

[0176] For each of the shard data groups, copy each shard data in the shard data group to the copy address in the order of the shard numbers;

[0177] When all the shard data in the system memory dormant snapshot to be restored have been copied, the system of the battery monitoring device is started.

[0178] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0179] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0180] In another embodiment provided in the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned snapshot restoration methods are implemented.

[0181] In another embodiment provided in the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of the quick start method for a battery monitoring device are implemented.

[0182] In another embodiment provided by the present application, a computer program product including instructions is also provided, and when the computer is run on the computer, the computer executes the steps of any snapshot restoration method in the above embodiments.

[0183] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, data center, etc. that contains one or more available media integrated. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), etc.

[0184] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0185] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0186] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims

1. A snapshot restoration method, characterized in that: The method comprises: Obtaining a target snapshot to be restored and a destination address corresponding to each shard data in the target snapshot and a shard number of each shard data, where the shard number of each shard data is a storage order in which each shard data is stored in a non-volatile storage device; Determine each shard data group from each shard data, wherein the shard numbers of each shard data in the shard data group are continuous and the destination addresses corresponding to each shard data are continuous; For each of the shard data groups, request a copy address starting from an initial destination address and having a length equal to a first copy length from the memory, wherein the initial destination address is the destination address of the shard data with the smallest shard number in the shard data group, and the first copy length is the sum of the lengths of all the shard data in the shard data group; For each of the shard data groups, each shard data in the shard data group is copied to the copy address in the order of each shard number.

2. The method according to claim 1, characterized in that The step of determining each shard data group from each shard data comprises: Determine whether the destination address of the to-be-copied shard data is continuous with the destination address of the adjacent shard data, wherein the to-be-copied shard data is any shard data in the target snapshot, and the adjacent shard data is the next shard data whose number is adjacent to the to-be-copied shard data; If yes, take the adjacent shard data as new shard data to be copied and return to execute the step of determining whether the destination address of the shard data to be copied is continuous with the destination address of the adjacent shard data, until the destination address of the shard data to be copied is not continuous with the destination address of the adjacent shard data; The slice data to be copied are divided into the same slice data group.

3. The method according to claim 2, characterized in that The length of each of the slice data is a preset length, and the determining whether the destination address of the to-be-copied slice data is continuous with the destination address of the adjacent slice data includes: If the destination address of the adjacent slice data is offset by the preset length relative to the destination address of the to-be-copied slice data, it is determined that the destination address of the to-be-copied slice data is continuous with the destination address of the adjacent slice data.

4. The method according to claim 2, characterized in that: The length of each of the slice data is a preset length; The method further comprises: If the destination address of the to-be-copied shard data is continuous with the destination address of the adjacent shard data, the second copy length is incremented by the preset length, wherein the second copy length is initially the preset length; the first copy length is the second copy length when the destination address of the to-be-copied shard data is discontinuous with the destination address of the adjacent shard data.

5. The method according to claim 2, characterized in that: The method further comprises: If all the shard data in the target snapshot to be restored have not been copied, the adjacent shard data whose destination address is not continuous with the shard data to be copied is used as new shard data to be copied, and the step of determining whether the destination address of the shard data to be copied is continuous with the destination address of the adjacent shard data is performed; If all the shard data in the target snapshot to be restored have been copied, the system is started.

6. A quick start method for a battery monitoring device, characterized in that: Applied to a battery monitoring device, the battery monitoring device includes a non-volatile storage device and a memory, the non-volatile storage medium stores a system memory hibernation snapshot of the battery monitoring device, and the method includes: In response to a power-on instruction, obtaining a system memory hibernation snapshot to be restored and a destination address corresponding to each shard data in the system memory hibernation snapshot and a shard number of each shard data, wherein the shard number of each shard data is a storage order in which each shard data is stored in the non-volatile storage device; Determine each shard data group from each shard data, wherein the shard numbers of each shard data in the shard data group are continuous and the destination addresses corresponding to each shard data are continuous; For each of the shard data groups, request a copy address starting from an initial destination address and having a length of a first copy length from the memory, wherein the initial destination address is the destination address of the shard data with the smallest shard number in the shard data group, and the first copy length is the sum of the lengths of all the shard data in the shard data group; For each of the shard data groups, copy each shard data in the shard data group to the copy address in the order of the shard numbers; When all the shard data in the system memory dormant snapshot to be restored have been copied, the system of the battery monitoring device is started.

7. A snapshot restoration device, characterized in that: The device comprises: A shard data acquisition module, used to acquire a target snapshot to be restored and a destination address corresponding to each shard data in the target snapshot and a shard number of each shard data, where the shard number of each shard data is a storage order in which each shard data is stored in a non-volatile storage device; A shard data group determination module, used to determine each shard data group from each shard data, wherein the shard numbers of each shard data in the shard data group are continuous and the destination addresses corresponding to each shard data are continuous; a copy address request module, configured to request, for each of the shard data groups, from the memory a copy address starting with an initial destination address and having a length of a first copy length, wherein the initial destination address is a destination address of the shard data with the smallest shard number in the shard data group, and the first copy length is the sum of the lengths of all the shard data in the shard data group; The shard data group copy module is used for copying each shard data in the shard data group to the copy address in the order of the shard numbers for each shard data group.

8. The device according to claim 7, characterized in that The shard data determination module includes: A judgment submodule, used to judge whether the destination address of the to-be-copied shard data is continuous with the destination address of the adjacent shard data, wherein the to-be-copied shard data is any of the shard data in the target snapshot, and the adjacent shard data is the next shard data whose number is adjacent to the to-be-copied shard data; The return execution submodule is used for returning the adjacent slice data as new slice data to be copied to execute the step of determining whether the destination address of the slice data to be copied is continuous with the destination address of the adjacent slice data when the destination address of the slice data to be copied is continuous with the destination address of the adjacent slice data, until the destination address of the slice data to be copied is not continuous with the destination address of the adjacent slice data; The shard data division submodule is used to divide each of the shard data to be copied into the same shard data group.

9. The device according to claim 8, characterized in that The length of each of the shard data is a preset length, and the judgment submodule is specifically used to determine that the destination address of the shard data to be copied is continuous with the destination address of the adjacent shard data if the destination address of the adjacent shard data is offset by the preset length relative to the destination address of the shard data to be copied; The device also includes: a length increasing module, configured to add the preset length to the second copy length when the destination address of the to-be-copied shard data is continuous with the destination address of the adjacent shard data, wherein the second copy length is initially the preset length; and the first copy length is the second copy length when the destination address of the to-be-copied shard data is not continuous with the destination address of the adjacent shard data; The device also includes: an execution module, configured to, when all the shard data in the target snapshot to be restored have not been copied, use the adjacent shard data whose destination address is not continuous with the shard data to be copied as new shard data to be copied, and execute the step of determining whether the destination address of the shard data to be copied is continuous with the destination address of the adjacent shard data; The first startup module is used to start the system when all the shard data in the target snapshot to be restored have been copied.

10. A quick start device for a battery monitoring device, characterized in that: Applied to a battery monitoring device, the battery monitoring device includes a non-volatile storage device and a memory, the non-volatile storage medium stores a system memory hibernation snapshot of the battery monitoring device, and the device includes: an acquisition module, configured to acquire, in response to a power-on instruction, a system memory hibernation snapshot to be restored and a destination address corresponding to each shard data in the system memory hibernation snapshot and a shard number of each shard data, wherein the shard number of each shard data is a storage order in which each shard data is stored in the non-volatile storage device; A determination module, used to determine each shard data group from each shard data, wherein the shard numbers of each shard data in the shard data group are continuous and the destination addresses corresponding to each shard data are continuous; a request module, configured to request, for each of the shard data groups, from the memory a copy address starting with an initial destination address and having a length of a first copy length, wherein the initial destination address is a destination address of the shard data with the smallest shard number in the shard data group, and the first copy length is a sum of lengths of all shard data in the shard data group; A copy module, for copying each of the shard data groups to the copy address in the order of the shard numbers; The second startup module is used to start the system of the battery monitoring device when all the shard data in the system memory dormant snapshot to be restored have been copied.

11. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, for implementing the method described in any one of claims 1 to 5 or claim 6 when executing a program stored in a memory.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in any one of claims 1 to 5 or claim 6 is implemented.