Method and device for writing to-be-backed-up data, storage medium and electronic equipment
By using at least two non-volatile memory chips for data backup in a redundant disk array system, the problem of high cost of power failure protection schemes is solved, and low-cost and efficient data backup is achieved.
Patent Information
- Application Number
- CN202411216467.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2024-11-26
AI Technical Summary
In existing technologies, the power-loss protection schemes of redundant disk array systems typically use large-capacity ONFI non-volatile memory for data backup, which results in high costs.
Data backup is performed using at least two secondary non-volatile memories. By selecting the data to be backed up, the data is written to these memories sequentially or simultaneously, which reduces the dependence on ONFI non-volatile memories and reduces the demand for virtual resources.
It reduces the cost of power failure protection solutions while improving the reliability and efficiency of data backup, and avoids data loss caused by the failure of a single memory.
Smart Images

Figure CN119025340A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present application relate to the field of storage technology, and in particular, to a method and device for writing data to be backed up, a storage medium, and an electronic device. Background Art
[0002] Redundant Array of Independent Disks (RAID) technology combines multiple disk devices into a storage array group to improve performance and increase redundancy to protect data. In a RAID system, cache can be used as an intermediary between the system and the disk. When data is written, the system first gives the data to the cache, and then writes the data from the cache to the disk. This method can significantly improve write performance.
[0003] One of the necessary functions in a RAID system is the power-off protection function. The power-off protection function is mainly to protect the data stored in the RAID system cache from being lost in the event of an unexpected power failure or power outage in the system, thereby ensuring the integrity of the data and the reliability of the system. The reason why the power-off protection function is one of the necessary functions in a RAID system is that when the server performs a write operation, the data will first be written to the cache of the RAID system, and then written to the hard disk at an appropriate time. If a power failure occurs during this process, and there is no power-off protection measure, the data in the cache that has not yet been written to the hard disk will be lost, which may lead to the loss of important data and data inconsistency in the RAID system. For this reason, the RAID system needs to have a power-off protection function. When the system unexpectedly loses power, the backup power supply is used to power the RAID system, and the data in the RAID cache is backed up to non-volatile storage, and then the data recovery operation is performed after the system is powered on again, thereby protecting the data in the RAID system from being lost after an unexpected power failure.
[0004] The storage medium of the traditional RAID system is a mechanical hard disk. Due to some characteristics of the mechanical hard disk, the RAID system needs a large-capacity cache to improve the performance of the mechanical hard disk. The cache capacity is usually at the GB level. Therefore, a large amount of data needs to be written to the non-volatile storage during power-off protection. Therefore, the traditional mechanical hard disk RAID system usually chooses ONFI NAND with a larger capacity as non-volatile storage. ONFI NAND has the characteristics of large capacity and high interface speed. However, it also has the characteristics of high development difficulty and high cost. With the improvement of RAID system performance, the storage medium has evolved from hard disk to solid state drive (SSD). The performance of SSD disk is much higher than that of mechanical hard disk. Therefore, SSD RAID system usually does not need a large cache to improve performance. Therefore, the cache capacity in the SSD RAID system is usually only tens of MB. When implementing the power-off protection function of SSDRAID, using large-capacity, high-performance ONFI NAND is costly and complex to implement.
[0005] In the prior art, the power-off protection scheme for the redundant array of disks system usually selects ONFI non-volatile memory with larger capacity for data backup, but the problem of high cost has not been effectively solved. Summary of the invention
[0006] The embodiments of the present application provide a method and device for writing data to be backed up, a storage medium and an electronic device, so as to at least solve the problem that the power-off protection scheme of the redundant array of disks system in the prior art usually selects a large-capacity ONFI non-volatile memory for data backup, which is costly.
[0007] According to one embodiment of the present application, a method for writing data to be backed up is provided, which is applied to a target controller, wherein the target controller is deployed on a redundant array of disks system, wherein the redundant array of disks system includes a first non-volatile memory connected to the target controller, and a volatile memory connected to the target controller for storing the data to be backed up; the target controller is connected to a central processing unit of the redundant array of disks system via the volatile memory; the method includes: obtaining the data to be backed up, wherein the data to be backed up is data that needs to be written to a disk in the redundant array of disks system; writing the data to be backed up into the first non-volatile memory, wherein a first virtual resource required for obtaining the first non-volatile memory is lower than a second virtual resource required for obtaining an ONFI non-volatile memory, wherein the first non-volatile memory includes at least two second non-volatile memories.
[0008] In an exemplary embodiment, obtaining the data to be backed up includes: receiving a first command from the central processor, wherein the first command is used to drive the target controller to back up the data to be backed up; and obtaining the data to be backed up from the volatile memory through the first command.
[0009] In an exemplary embodiment, writing the data to be backed up into the first non-volatile memory includes: selecting the first non-volatile memory through a chip select signal corresponding to the first non-volatile memory; and writing the data to be backed up into the first non-volatile memory through the selection operation.
[0010] In an exemplary embodiment, writing the data to be backed up into the first non-volatile memory through the selection operation includes: when the selection type of the selection operation is the first type, sending a second command to a third non-volatile memory in the first non-volatile memory to write the data to be backed up into the third non-volatile memory, wherein the third non-volatile memory is a memory selected by the selection operation among the at least two second non-volatile memories; sending a third command to the third non-volatile memory to confirm whether the data to be backed up has been written into the third non-volatile memory; and after confirming that the data to be backed up has been written into the third non-volatile memory, In the case of writing to the third non-volatile memory, a second command is sent to a fourth non-volatile memory in the first non-volatile memory to write the data to be backed up into the fourth non-volatile memory, wherein the fourth non-volatile memory is a memory other than the third non-volatile memory in the at least two second non-volatile memories; the third command is sent to the fourth non-volatile memory to confirm whether the data to be backed up has been written into the fourth non-volatile memory; and when it is confirmed that the data to be backed up has been written into the fourth non-volatile memory, it is confirmed that the data to be backed up has been successfully written into the first non-volatile memory.
[0011] In an exemplary embodiment, the data to be backed up is written into the first non-volatile memory through the selection operation, comprising: when the selection type of the selection operation is the second type, a second command is sent to the at least two second non-volatile memories at the same time, so as to write the data to be backed up into the at least two second non-volatile memories at the same time through the second command; a third command is sent to the at least two second non-volatile memories in sequence according to a preset order, so as to determine whether the data to be backed up has been written into the at least two second non-volatile memories; when it is determined that the data to be backed up has been written into the at least two second non-volatile memories, confirming that the data to be backed up has been successfully written into the first non-volatile memory.
[0012] In an exemplary embodiment, before writing the data to be backed up into the first non-volatile memory through the selection operation, the method further includes: a determination step: determining whether a first target block corresponding to a current block address selected by the selection operation in a fifth non-volatile memory is a bad block, wherein the fifth non-volatile memory is any one of the at least two second non-volatile memories; an updating step: in the case where the first target block is a bad block, updating the second target block corresponding to a next block address of the current block address to the first target block, and updating the next block address to the current block address; looping through the determination step and the updating step until the first target block is not a bad block, and determining the first target block as the third target block in the first non-volatile memory for storing the data to be backed up.
[0013] In an exemplary embodiment, after writing the data to be backed up into the first non-volatile memory, the method includes: sending a fourth command to a fifth non-volatile memory, wherein the fourth command is used to obtain the data to be backed up from the first non-volatile memory, wherein the fifth non-volatile memory is any one of the at least two second non-volatile memories; and generating an alarm event when no feedback data from the fifth non-volatile memory is received, wherein the alarm event is used to indicate that the fifth non-volatile memory is damaged.
[0014] According to another embodiment of the present application, a device for writing data to be backed up is provided, which is applied to a target controller, wherein the target controller is deployed on a redundant array of disks system, wherein the redundant array of disks system includes a first non-volatile memory connected to the target controller, and a volatile memory connected to the target controller for storing the data to be backed up; the target controller is connected to a central processing unit of the redundant array of disks system via the volatile memory; the device includes: an acquisition module, which is used to acquire the data to be backed up, wherein the data to be backed up is data that needs to be written to a disk in the redundant array of disks system; and a writing module, which is used to write the data to be backed up into the first non-volatile memory, wherein a first virtual resource required to acquire the first non-volatile memory is lower than a second virtual resource required to acquire the ONFI non-volatile memory, wherein the first non-volatile memory includes at least two second non-volatile memories.
[0015] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.
[0016] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0017] According to another embodiment of the present application, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.
[0018] Through the present application, a method for writing data to be backed up is provided, which is applied to a target controller, wherein the target controller is deployed on a redundant array of disks system, wherein the redundant array of disks system includes a first non-volatile memory connected to the target controller, and a volatile memory connected to the target controller for storing the data to be backed up; the target controller is connected to a central processing unit of the redundant array of disks system through the volatile memory; the method includes: obtaining the data to be backed up of the disk to be written into the redundant array of disks system; writing the data to be backed up into the first non-volatile memory, wherein the first virtual resource required to obtain the first non-volatile memory is lower than the second virtual resource required to obtain the ONFI non-volatile memory, wherein the first non-volatile memory includes at least two second non-volatile memories. Therefore, the problem that the power-off protection scheme for the redundant array of disks system in the prior art usually selects a large-capacity ONFI non-volatile memory for data backup, which is costly, can be solved. Thus, the technical effect of reducing the cost of the power-off protection scheme is achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 It is a hardware structure block diagram of a computer terminal of a method for writing data to be backed up according to an embodiment of the present application;
[0020] Figure 2 is a flowchart of a method for writing data to be backed up according to an embodiment of the present application;
[0021] Figure 3 is an implementation architecture diagram of a method for writing data to be backed up according to an embodiment of the present application;
[0022] Figure 4 is another flow chart (I) of a method for writing data to be backed up according to an embodiment of the present application;
[0023] Figure 5 is another flow chart (II) of the method for writing data to be backed up according to an embodiment of the present application;
[0024] Figure 6 1 is a backup schematic diagram (I) of a method for writing data to be backed up according to an embodiment of the present application;
[0025] Figure 7 Schematic diagram (II) of the method for writing data to be backed up according to an embodiment of the present application;
[0026] Figure 8 It is a structural block diagram of a device for writing data to be backed up according to an embodiment of the present application. DETAILED DESCRIPTION
[0027] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0029] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a computer terminal as an example, Figure 1 1 is a hardware structure block diagram of a computer terminal of a method for writing data to be backed up according to an embodiment of the present application. Figure 1 As shown, the computer terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the above-mentioned computer terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0030] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for allocating load resources in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, the above method is implemented. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0031] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of a computer terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0032] Figure 2 The flowchart of the method for writing the data to be backed up according to the embodiment of the present application includes but is not limited to being applied to a target controller, the target controller is deployed on a redundant array of disks system, the redundant array of disks system includes a first non-volatile memory connected to the target controller, and a volatile memory connected to the target controller for storing the data to be backed up; the target controller is connected to the central processing unit of the redundant array of disks system through the volatile memory. Figure 2 As shown, the process includes the following steps:
[0033] Step S202, obtaining the data to be backed up, wherein the data to be backed up is data that needs to be written to a disk in the redundant array of disks system;
[0034] Step S204, writing the data to be backed up into the first non-volatile memory, wherein the first virtual resource required to obtain the first non-volatile memory is lower than the second virtual resource required to obtain the ONFI non-volatile memory, wherein the first non-volatile memory includes at least two second non-volatile memories.
[0035] Through the above steps, a method for writing data to be backed up is provided, which is applied to a target controller, wherein the target controller is deployed on a redundant array of disks system, wherein the redundant array of disks system includes a first non-volatile memory connected to the target controller, and a volatile memory connected to the target controller for storing the data to be backed up; the target controller is connected to a central processing unit of the redundant array of disks system through the volatile memory; the method includes: obtaining the data to be backed up of the disks in the redundant array of disks system; writing the data to be backed up into the first non-volatile memory, wherein the first virtual resource required for obtaining the first non-volatile memory is lower than the second virtual resource required for obtaining the ONFI non-volatile memory, wherein the first non-volatile memory includes at least two second non-volatile memories. Therefore, the problem that the power-off protection scheme for the redundant array of disks system in the prior art usually selects a large-capacity ONFI non-volatile memory for data backup, which is costly, can be solved. Thus, the technical effect of reducing the cost of the power-off protection scheme is achieved.
[0036] In an exemplary embodiment, obtaining the data to be backed up includes: receiving a first command from the central processor, wherein the first command is used to drive the target controller to back up the data to be backed up; and obtaining the data to be backed up from the volatile memory through the first command.
[0037] Optionally, the target controller in the embodiment of the present application may be a QSPI controller, and the first non-volatile memory may be a QSPI NAND Flash. In the embodiment of the present application, the central processing unit is responsible for controlling the data backup process of the data to be backed up, and drives the QSPI controller to write the data to be backed up to the QSPI NAND Flash.
[0038] Further, the technical terms in the embodiments of the present application are explained below:
[0039] Quad Serial Peripheral Interface, referred to as QSPI, is a high-speed serial communication protocol, mainly used for data transmission between microcontrollers and external memory. QSPI allows data to be transmitted at four times the speed of traditional SPI (Serial Peripheral Interface) because it can send and receive data on four data lines at the same time.
[0040] NAND is a non-volatile storage technology widely used in various electronic devices, such as solid-state drives (SSDs), USB flash drives, smartphones and other portable devices. NAND memory is characterized by high density, low cost and high write speed.
[0041] Open NAND Flash Interface, referred to as ONFI, is an open standard jointly developed by NAND flash memory manufacturers and storage device manufacturers to define the interface specifications between NAND flash memory and host systems.
[0042] SSD is a solid state drive, a hard disk that uses flash memory as storage medium.
[0043] Non-Volatile Memory express, referred to as NVMe, is a non-volatile memory host controller interface specification and an SSD hard drive interface specification.
[0044] In an exemplary embodiment, writing the data to be backed up into the first non-volatile memory includes: selecting the first non-volatile memory through a chip select signal corresponding to the first non-volatile memory; and writing the data to be backed up into the first non-volatile memory through the selection operation.
[0045] In the embodiment of the present application, the first non-volatile memory includes at least two second non-volatile memories, and each second non-volatile memory has a dedicated chip select signal. When the data to be backed up needs to be stored in the first non-volatile memory, the first non-volatile memory needs to be selected by the chip select signal, and then the operation of writing the data to be backed up into the first non-volatile memory is performed.
[0046] Therefore, the optional embodiment of the present application deploys at least two second non-volatile memories, so that the data to be backed up can be backed up in at least two second non-volatile memories, preventing the loss of the data to be backed up due to damage to any second non-volatile memory, thereby improving the reliability of the RAID system.
[0047] In an exemplary embodiment, writing the data to be backed up into the first non-volatile memory through the selection operation includes: when the selection type of the selection operation is the first type, sending a second command to a third non-volatile memory in the first non-volatile memory to write the data to be backed up into the third non-volatile memory, wherein the third non-volatile memory is a memory selected by the selection operation among the at least two second non-volatile memories; sending a third command to the third non-volatile memory to confirm whether the data to be backed up has been written into the third non-volatile memory; and after confirming that the data to be backed up has been written into the third non-volatile memory, In the case of writing to the third non-volatile memory, a second command is sent to a fourth non-volatile memory in the first non-volatile memory to write the data to be backed up into the fourth non-volatile memory, wherein the fourth non-volatile memory is a memory other than the third non-volatile memory in the at least two second non-volatile memories; the third command is sent to the fourth non-volatile memory to confirm whether the data to be backed up has been written into the fourth non-volatile memory; and when it is confirmed that the data to be backed up has been written into the fourth non-volatile memory, it is confirmed that the data to be backed up has been successfully written into the first non-volatile memory.
[0048] That is, in this embodiment, the data to be backed up are sequentially written into at least two second non-volatile memories in the first non-volatile memory. Specifically, after the third non-volatile memory is selected by the selection operation (specifically, the third non-volatile memory is selected by the chip selection signal dedicated to the third non-volatile memory), after the data to be backed up is written into the third non-volatile memory by the second command, it is checked by the third command whether the data to be backed up has been successfully written into the third non-volatile memory; further, after the data to be backed up is successfully written into the third non-volatile memory, the fourth non-volatile memory is selected by the selection operation, and the data to be backed up is continuously written into the fourth non-volatile memory by the second command and the third command, and so on, until the data to be backed up is sequentially written into all the second non-volatile memories in the at least two second non-volatile memories.
[0049] Therefore, the embodiment of the present application implements the backup of the data to be backed up by writing the data to be backed up into at least two second non-volatile memories one by one, thereby ensuring the security of the data to be backed up.
[0050] In an exemplary embodiment, the data to be backed up is written into the first non-volatile memory through the selection operation, comprising: when the selection type of the selection operation is the second type, a second command is sent to the at least two second non-volatile memories at the same time, so as to write the data to be backed up into the at least two second non-volatile memories at the same time through the second command; a third command is sent to the at least two second non-volatile memories in sequence according to a preset order, so as to determine whether the data to be backed up has been written into the at least two second non-volatile memories; when it is determined that the data to be backed up has been written into the at least two second non-volatile memories, confirming that the data to be backed up has been successfully written into the first non-volatile memory.
[0051] Optionally, the at least two second non-volatile memories can be selected by dedicated chip selection signals corresponding to the at least two second non-volatile memories, so that the data to be backed up can be written into the at least two second non-volatile memories at the same time. Then, a third command is used to check whether the data to be backed up is successfully written. Optionally, the preset order can be the order in which the at least two second non-volatile memories are deployed in the RAID system, and the embodiments of the present application do not limit the preset order.
[0052] Therefore, the embodiment of the present application saves writing time and improves the backup efficiency of the data to be backed up by writing the data to be backed up into the at least two second non-volatile memories at the same time.
[0053] In an exemplary embodiment, before writing the data to be backed up into the first non-volatile memory through the selection operation, the method further includes: a determination step: determining whether a first target block corresponding to a current block address selected by the selection operation in a fifth non-volatile memory is a bad block, wherein the fifth non-volatile memory is any one of the at least two second non-volatile memories; an updating step: in the case where the first target block is a bad block, updating the second target block corresponding to a next block address of the current block address to the first target block, and updating the next block address to the current block address; looping through the determination step and the updating step until the first target block is not a bad block, and determining the first target block as the third target block in the first non-volatile memory for storing the data to be backed up.
[0054] That is, it is simultaneously detected whether the first target block in at least two second non-volatile memories is a bad block. If the first target block is not a bad block, the first target block can be used as a storage block for the data to be backed up (i.e., the third target block). Thus, the embodiment of the present application ensures that the data to be backed up can be stored in the non-bad blocks in at least two second non-volatile memories by detecting whether the first target blocks in at least two second non-volatile memories are bad blocks, thereby ensuring the backup quality of the data to be backed up.
[0055] In an exemplary embodiment, after writing the data to be backed up into the first non-volatile memory, the method includes: sending a fourth command to a fifth non-volatile memory, wherein the fourth command is used to obtain the data to be backed up from the first non-volatile memory, wherein the fifth non-volatile memory is any one of the at least two second non-volatile memories; and generating an alarm event when no feedback data from the fifth non-volatile memory is received, wherein the alarm event is used to indicate that the fifth non-volatile memory is damaged.
[0056] Optionally, after generating the alarm event, the method further includes:
[0057] increasing the number of times the alarm is received in the fifth non-volatile memory by a target value;
[0058] When a preset condition is met, the fifth non-volatile memory is ranked one position lower in the preset sequence;
[0059] Among them, the preset conditions include: the number of times the police were called meets a first threshold, and the recording time between two consecutive times the police were called is less than a second threshold.
[0060] Optionally, the record table of the number of alarms in the fifth non-volatile memory is checked at every preset time interval.
[0061] This preset duration is adjustable;
[0062] And the record table of the number of alarms is used to record at least the following information: the unique identifier of the fifth non-volatile memory, the alarm event, the generation time of the alarm event, and the processing status of the alarm event; wherein the processing status includes: the processing operation of the fifth non-volatile memory, such as: repair, replacement, etc.; and the processing time of the alarm event of the fifth non-volatile memory.
[0063] Therefore, the embodiment of the present application can efficiently and preferentially store the data to be backed up in the more stable fifth non-volatile memory by recording the alarm event.
[0064] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0065] In order to better understand the process of the above-mentioned method for writing data to be backed up, the implementation process of the above-mentioned method for writing data to be backed up is described below in combination with an optional embodiment, but it is not used to limit the technical solution of the embodiment of the present application.
[0066] To solve the above problems, an optional embodiment of the present application provides a reliable data backup method (equivalent to the writing method of the data to be backed up in the above embodiment), using multiple QSPI NAND Flash (equivalent to at least two non-volatile memories in the above embodiment) to achieve low-cost and reliable data backup.
[0067] like Figure 3 As shown, the data backup method in the optional embodiment of the present application can be based on the following Figure 3 The architecture shown is implemented. Figure 3 The architecture shown includes:
[0068] 1)CPU: responsible for data backup process control, driving the QSPI controller to write the data to be backed up to QSPINANDFlash.
[0069] 2) QSPI controller: This hardware module is responsible for connecting an external QSPI NAND chip (equivalent to the first non-volatile memory in the above embodiment), and connecting multiple QSPI NAND chips (equivalent to at least two non-volatile memories in the above embodiment) through multiple chip select signals and common clock and data signals.
[0070] 3) QSPl NAND: Non-volatile NAND Flash memory used to store data to be backed up. There are at least two QSPI NAND chips, each with a dedicated chip select signal, and multiple NAND Flash chips share clock and data signals. The above figure only illustrates the case of two QSPI NAND Flashes. In fact, the number of NAND chips can be increased by setting more chip select signals.
[0071] 4) Data to be backed up: Data to be backed up is stored in the system's volatile memory, which is usually SRAM or DRAM.
[0072] 5) Backup power supply: responsible for providing backup power for the entire system during data backup.
[0073] In order to ensure the reliability of data backup and prevent data loss due to damage of a single NAND Flash chip, the present invention uses a method of backing up multiple NAND Flash chips (equivalent to at least two non-volatile memories in the above embodiment) to achieve data redundancy. The same copy of the data to be backed up will be written into multiple NAND Flash chips, and each NAND Flash has a complete copy of the data to be backed up, thereby ensuring that after one NAND Flash data is damaged, the data can be restored from the backup of other NAND Flash chips.
[0074] In an optional embodiment of the present application, a process for writing data to be backed up includes:
[0075] Step 31: Select a data block to be backed up (i.e., data to be backed up);
[0076] Step 32: Select QSPI NAND 0 (equivalent to the third non-volatile memory) through the chip select signal;
[0077] Step 33: Send a second command to write the data block into QSPI NAND 0;
[0078] Step 34: Send the third command to check whether the QSPI NAND 0 data block has been written;
[0079] Step 35: Select QSPI NAND 1 (equivalent to the fourth non-volatile memory) through the chip select signal;
[0080] Step 36: Send a second command to write the data block to QSPI NAND 1;
[0081] Step 37: Send the third command to check whether the QSPI NAND 1 data block has been written;
[0082] Step 38: Select the next data block to be backed up, and repeat steps 32 to 37 until all data blocks are backed up.
[0083] In the above steps 31 to 38, the write operations of the two NAND Flash chips are performed sequentially, and the time required for each additional NAND Flash chip backup operation will double. During the data backup period, the system is powered by a backup power supply, so the traditional multi-backup operation has the risk of being unable to support the backup power supply due to a long time, or requiring a larger capacity backup power supply, thereby increasing the cost.
[0084] Furthermore, the optional embodiment of the present application also provides a concurrent writing process to achieve multiple backups of the data to be backed up, which can achieve that when the number of backup copies is increased, the concurrent writing process does not substantially increase the overall backup time, such as Figure 4 As shown, including:
[0085] Step 41, selecting a data block to be backed up;
[0086] Step 42, select all QSPI NANDs simultaneously through chip select signals;
[0087] Step 43, send a command to write the data block into QSPI NAND;
[0088] Step 44, select only QSPI NAND 0 through the chip select signal;
[0089] Step 45, check whether the QSPI NAND 0 data block is written;
[0090] Step 46, select only QSPI NAND 1 through the chip select signal;
[0091] Step 47, check whether QSPI NAND 1 data block writing is completed;
[0092] Step 48: Select the next piece of data to be backed up, and repeat steps 42 to 47 until all data are backed up.
[0093] In the above-mentioned concurrent writing process, the difference from the sequential writing process is that when executing the data (i.e., data to be backed up) writing operation, all QSPI NANDs (equivalent to at least two non-volatile memories) are selected at the same time through the chip select signal, and then the data writing command (i.e., the second command) is sent, and the data is written to multiple NAND Flashes at the same time through one QSPI data transmission. Then, when checking whether the data block writing operation is completed, check whether the data writing of multiple NAND Flashes is completed. When executing the data writing operation of step 43 in the above operation process, it is necessary to send the data block to be backed up to NAND Flash through the QSPI bus, and start the programming operation process of NAND Flash, which is the main time-consuming part of the QSPI NAND writing operation process. In this process, the optional embodiment of the present application achieves the purpose of increasing the number of backup copies without substantially increasing the overall backup time by concurrently operating two Flash writes.
[0094] The backup non-volatile storage medium used in the optional embodiment of the present application is NAND Flash (i.e., the first non-volatile memory). One feature of NAND Flash is that there may be bad blocks, which should be skipped when writing to NAND Flash. In the above concurrent backup process, it is necessary to process multiple NAND bad blocks at the same time, such as Figure 5 As shown, the optional embodiment of the present application adopts the following steps to implement bad block skipping:
[0095] Step 51, selecting the next NAND Flash block address to be written;
[0096] Step 52, check whether the block address is a bad block on QSPI NAND 0, if it is a bad block, go to step 51 to continue;
[0097] Step 53, check whether the block address is a bad block on QSPI NAND 1, if it is a bad block, go to step 51 to continue;
[0098] Step 54: Select the current block as the target data block for data writing, and start executing the concurrent writing operation.
[0099] The core of the above steps 52 to 54 is: when performing concurrent write operations, it is necessary to perform write operations on the same target block of multiple NAND Flash chips. At this time, it is necessary to determine whether the target block of all NAND Flash chips is a bad block. If the target block on any NAND Flash is a bad block, skip the target block and select the next block to continue processing.
[0100] The following is a specific example to illustrate the specific implementation of the present invention.
[0101] like Figure 6 As shown in the figure, there are 3 data blocks to be backed up in the system, which need to be backed up to two QSPI NAND Flash. Both QSPI NANDs have bad blocks, QPSI NAND 0 block 2 is a bad block, and QSPI NAND 1 block 3 is a bad block. The data writing operation process includes:
[0102] Step 601: Select data block 1 as data to be backed up.
[0103] Step 602: Select NAND block 1 as the backup target block.
[0104] Step 603: Check whether NAND 0 and NAND 1 block 1 (equivalent to the first target block) are bad blocks. If neither is a bad block, it is determined that the NAND block is available.
[0105] Step 604: Execute the concurrent data writing process to write the data block 1 to be backed up into the NAND block 1.
[0106] Step 605: Select data block 2 as the data to be backed up.
[0107] Step 606: Select NAND block 2 as the backup target block.
[0108] Step 607: Check whether NAND 0 and NAND 1 block 2 (equivalent to the first target block) are bad blocks. The result is that the block of NAND0 is a bad block, and it is determined that the NAND block is unusable.
[0109] Step 608: Select NAND block 3 as the backup target block.
[0110] Step 609: Check whether NAND 0 and NAND 1 block 3 (equivalent to the second target block) are bad blocks. The result is that the block of NAND 1 is a bad block, and it is determined that the NAND block is unusable.
[0111] Step 610: Select NAND block 4 as the backup target block.
[0112] Step 611: Check whether NAND 0 and NAND 1 block 4 are bad blocks. If they are not bad blocks, it is determined that the NAND block is available.
[0113] Step 612: Execute the concurrent data writing process to write the data block 2 to be backed up into the NAND block 4.
[0114] Step 613: Select data block 3 as the data to be backed up.
[0115] Step 614: Select NAND block 5 as the backup target block.
[0116] Step 615: Check whether NAND 0 and NAND 1 block 4 are bad blocks. If they are not bad blocks, it is determined that the NAND block is available.
[0117] Step 616: Execute the concurrent data writing process to write the data block 3 to be backed up into the NAND block 5.
[0118] In step 601 to step 616, the concurrent data writing process for two QSPI NAND Flashes includes:
[0119] Step 71: Set the chip select signals of NAND 0 and NAND 1 to the selected state at the same time.
[0120] Step 72: Operate the QSPI controller to send a Program Load command to load the data to be written into the write cache inside the NAND Flash through the QSPI bus.
[0121] Step 73: Operate the QSPI controller to send a Program Execute command to instruct the NAND Flash to write data from the internal cache to the Flash. The second command includes the Program Load command and the Program Execute command.
[0122] Step 74: Only the NAND 0 chip select signal is set to the selected state at the same time.
[0123] Step 75: Operate the QSPI controller to query the NAND Flash 1Busy status.
[0124] Step 76: Only the NAND 1 chip select signal is set to the selected state at the same time.
[0125] Step 77: Operate the QSPI controller to query the NAND Flash 1 Busy status.
[0126] Step 78: Repeat steps 4 to 7 until both NAND 0 and NAND 1 exit the Busy state. At this point, a concurrent data write operation is completed.
[0127] In an optional embodiment of the present application, the data distribution state after completing the data backup is as follows: Figure 7 As shown. Figure 7 As shown, although block 3 of NAND 0 and block 2 of NAND 1 are good blocks, these blocks are skipped and no data is written because the mirror block on the other NAND is bad.
[0128] Therefore, the optional embodiment of the present application uses QSPI NAND to reduce the implementation complexity of the power-off protection data backup system, thereby reducing the implementation cost; the concurrent writing method is used to solve the problem of increased writing time caused by multi-mirror backup, while increasing the security of data backup, basically does not increase the data backup time, thereby reducing the back power supply demand during data backup; finally, the optional embodiment of the present application also solves the problem of Flash bad block processing during concurrent backup, eliminating the technical barriers that exist when using NAND Flash.
[0129] The optional embodiments of the present application have certain versatility and can be used in RAID systems or other devices that require power-off data backup.
[0130] In this embodiment, a device for writing data to be backed up is also provided, which is used to implement the above embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0131] Figure 8 is a structural block diagram of a device for writing data to be backed up according to an embodiment of the present application, such as Figure 8 As shown, the device is applied to a target controller, the target controller is deployed on a redundant array of disks system, the redundant array of disks system includes a first non-volatile memory connected to the target controller, and a volatile memory connected to the target controller for storing the data to be backed up; the target controller is connected to a central processor of the redundant array of disks system through the volatile memory; the device includes:
[0132] An acquisition module 82 is used to acquire the data to be backed up, wherein the data to be backed up is data that needs to be written into a disk in the redundant array of disks system;
[0133] The writing module 84 is used to write the data to be backed up into the first non-volatile memory, wherein the first virtual resource required to obtain the first non-volatile memory is lower than the second virtual resource required to obtain the ONFI non-volatile memory, wherein the first non-volatile memory includes at least two second non-volatile memories.
[0134] The above device is applied to a target controller, the target controller is deployed on a redundant array of disks system, the redundant array of disks system includes a first non-volatile memory connected to the target controller, and a volatile memory connected to the target controller for storing the data to be backed up; the target controller is connected to the central processing unit of the redundant array of disks system through the volatile memory; the method includes: obtaining the data to be backed up that needs to be written to the disk in the redundant array of disks system; writing the data to be backed up into the first non-volatile memory, wherein the first virtual resource required to obtain the first non-volatile memory is lower than the second virtual resource required to obtain the ONFI non-volatile memory, wherein the first non-volatile memory includes at least two second non-volatile memories. Therefore, the problem that the power-off protection scheme for the redundant array of disks system in the prior art usually selects the ONFI non-volatile memory with a larger capacity for data backup, which is costly, can be solved. Thus, the technical effect of reducing the cost of the power-off protection scheme is achieved.
[0135] In an exemplary embodiment, the acquisition module 82 is further used to: receive a first command from the central processor, wherein the first command is used to drive the target controller to back up the data to be backed up; and acquire the data to be backed up from the volatile memory through the first command.
[0136] In an exemplary embodiment, the writing module 84 is further used to: perform a selection operation on the first non-volatile memory through a chip selection signal corresponding to the first non-volatile memory; and write the data to be backed up into the first non-volatile memory through the selection operation.
[0137] In an exemplary embodiment, the writing module 84 is further used to: when the selected type of the selection operation is the first type, send a second command to a third non-volatile memory in the first non-volatile memory to write the data to be backed up into the third non-volatile memory, wherein the third non-volatile memory is a memory selected by the selection operation among the at least two second non-volatile memories; send a third command to the third non-volatile memory to confirm whether the data to be backed up has been written into the third non-volatile memory; when it is confirmed that the data to be backed up has been written into the third non-volatile memory, send a second command to a fourth non-volatile memory in the first non-volatile memory to write the data to be backed up into the fourth non-volatile memory, wherein the fourth non-volatile memory is a memory among the at least two second non-volatile memories except the third non-volatile memory; send the third command to the fourth non-volatile memory to confirm whether the data to be backed up has been written into the fourth non-volatile memory; when it is confirmed that the data to be backed up has been written into the fourth non-volatile memory, confirm that the data to be backed up has been successfully written into the first non-volatile memory.
[0138] In an exemplary embodiment, the write module 84 is also used to: when the selected type of the selected operation is the second type, simultaneously send a second command to the at least two second non-volatile memories, so as to simultaneously write the data to be backed up into the at least two second non-volatile memories through the second command; send a third command to the at least two second non-volatile memories in sequence according to a preset order to determine whether the data to be backed up have all been written into the at least two second non-volatile memories; and when it is determined that the data to be backed up have all been written into the at least two second non-volatile memories, confirm that the data to be backed up has been successfully written into the first non-volatile memory.
[0139] In an exemplary embodiment, before writing the data to be backed up into the first non-volatile memory through the selection operation, the device also includes a determination module, which is used to: determine whether the first target block corresponding to the current block address selected by the selection operation in the fifth non-volatile memory is a bad block, wherein the fifth non-volatile memory is any one of the at least two second non-volatile memories; update step: when the first target block is a bad block, update the second target block corresponding to the next block address of the current block address to the first target block, and update the next block address to the current block address; loop the determination step and the update step until the first target block is not a bad block, and determine the first target block as the third target block in the first non-volatile memory for storing the data to be backed up.
[0140] In an exemplary embodiment, after writing the data to be backed up into the first non-volatile memory, the device further includes: an alarm module, used to: send a fourth command to a fifth non-volatile memory, wherein the fourth command is used to obtain the data to be backed up from the first non-volatile memory, wherein the fifth non-volatile memory is any one of the at least two second non-volatile memories; and generate an alarm event when no feedback data from the fifth non-volatile memory is received, wherein the alarm event is used to indicate that the fifth non-volatile memory is damaged.
[0141] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.
[0142] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0143] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0144] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0145] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.
[0146] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.
[0147] An embodiment of the present application also provides a computer program, which includes computer instructions stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps in any one of the above method embodiments.
[0148] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.
[0149] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0150] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for writing data to be backed up, characterized in that: Applied to a target controller, the target controller is deployed on a redundant array of disks system, the redundant array of disks system comprises a first non-volatile memory connected to the target controller, and a volatile memory connected to the target controller for storing the data to be backed up; The target controller is connected to the central processing unit of the redundant array of disks system through the volatile memory; the method comprises: Acquire the data to be backed up, wherein the data to be backed up is data that needs to be written into a disk in the redundant array of disks system; The data to be backed up is written into the first non-volatile memory, wherein the first virtual resource required to obtain the first non-volatile memory is lower than the second virtual resource required to obtain the ONFI non-volatile memory, wherein the first non-volatile memory includes at least two second non-volatile memories.
2. The method according to claim 1, characterized in that Acquiring the data to be backed up includes: receiving a first command from the central processor, wherein the first command is used to drive the target controller to back up the data to be backed up; The data to be backed up is obtained from the volatile memory through the first command.
3. The method according to claim 1, characterized in that Writing the to-be-backed-up data into the first non-volatile memory comprises: performing a selection operation on the first non-volatile memory through a chip selection signal corresponding to the first non-volatile memory; The data to be backed up is written into the first non-volatile memory through the selection operation.
4. The method according to claim 3, characterized in that Writing the to-be-backed-up data into the first non-volatile memory through the selection operation includes: In a case where the selection type of the selection operation is the first type, sending a second command to a third non-volatile memory in the first non-volatile memory to write the to-be-backed-up data into the third non-volatile memory, wherein the third non-volatile memory is a memory selected by the selection operation among the at least two second non-volatile memories; Sending a third command to the third non-volatile memory to confirm whether the data to be backed up has been written into the third non-volatile memory; When confirming that the data to be backed up has been written into the third non-volatile memory, sending a second command to a fourth non-volatile memory in the first non-volatile memory to write the data to be backed up into the fourth non-volatile memory, wherein the fourth non-volatile memory is a memory in the at least two second non-volatile memories except the third non-volatile memory; Sending the third command to the fourth non-volatile memory to confirm whether the data to be backed up has been written into the fourth non-volatile memory; When it is confirmed that the data to be backed up has been written into the fourth non-volatile memory, it is confirmed that the data to be backed up has been successfully written into the first non-volatile memory.
5. The method according to claim 3, characterized in that: Writing the to-be-backed-up data into the first non-volatile memory through the selection operation includes: When the selected type of the selected operation is the second type, simultaneously sending a second command to the at least two second non-volatile memories, so as to simultaneously write the to-be-backed-up data into the at least two second non-volatile memories through the second command; Sending a third command to the at least two second non-volatile memories in sequence according to a preset order to determine whether the data to be backed up have all been written into the at least two second non-volatile memories; When it is determined that the data to be backed up have been written into the at least two second non-volatile memories, it is confirmed that the data to be backed up have been successfully written into the first non-volatile memory.
6. The method according to claim 3, characterized in that Before writing the to-be-backed-up data into the first non-volatile memory through the selection operation, the method further includes: Determining step: determining whether the first target block corresponding to the current block address selected in the fifth non-volatile memory by the selection operation is a bad block, wherein the fifth non-volatile memory is any one of the at least two second non-volatile memories; Updating step: when the first target block is a bad block, updating the second target block corresponding to the next block address of the current block address to the first target block, and updating the next block address to the current block address; The determining step and the updating step are executed in a loop until the first target block is not a bad block, and the first target block is determined as a third target block in the first non-volatile memory for storing the data to be backed up.
7. The method according to claim 1, characterized in that After writing the data to be backed up into the first non-volatile memory, the method includes: Sending a fourth command to a fifth non-volatile memory, wherein the fourth command is used to obtain the data to be backed up from the first non-volatile memory, wherein the fifth non-volatile memory is any one of the at least two second non-volatile memories; In a case where no feedback data from the fifth non-volatile memory is received, an alarm event is generated, wherein the alarm event is used to indicate that the fifth non-volatile memory is damaged.
8. A device for writing data to be backed up, characterized in that: Applied to a target controller, the target controller is deployed on a redundant array of disks system, the redundant array of disks system comprises a first non-volatile memory connected to the target controller, and a volatile memory connected to the target controller for storing the data to be backed up; The target controller is connected to the central processing unit of the redundant array of disks system through the volatile memory; the device comprises: An acquisition module, used for acquiring the data to be backed up, wherein the data to be backed up is data that needs to be written into a disk in the redundant array of disks system; A writing module is used to write the data to be backed up into the first non-volatile memory, wherein the first virtual resource required to obtain the first non-volatile memory is lower than the second virtual resource required to obtain the ONFI non-volatile memory, wherein the first non-volatile memory includes at least two second non-volatile memories.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 1 to 7 when executed by a processor.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method described in any one of claims 1 to 7 are implemented.
