Patent Description:
In recent years, with development of computer technologies and electronic device manufacturing processes, various kinds of computer systems are constantly emerging. A memory is an indispensable key component of a computer system and therefore people pose higher requirements on memory availability and reliability. In actual application, the memory is prone to a permanent or temporary failure caused by interference of ambient pressure (for example, a very high ambient temperature of the memory) and peripheral pressure (for example, poor contact of a peripheral circuit of the memory). How to detect a memory failure in a short time and deal with the failure in time has become one of current research hotspots. In the conventional technology, a real-time monitoring technology in which a normal operating state of the memory is not interrupted is usually used to monitor the memory, to detect a failure of the memory in time. In actual application, the real-time monitoring technology relates to memory data migration, for example, memory data backup and restoration. During data migration, atomicity of a migration operation needs to be ensured. In other words, migrated data needs to be consistent before and after the migration. If the migrated data is rewritten during the migration, the data needs to be migrated again. However, in an existing data migration method, a case in which migrated data is rewritten cannot be detected in time. Consequently, many invalid data operations caused by a data migration failure occur during data migration, and the existing data migration method has low efficiency, low accuracy, and poor applicability.

Document <CIT> refers to a storage area network having a host device and a consolidated storage array (CSA), one of the storage arrays of the CSA acts as a primary device of the CSA to form logical data volumes across one or more of the total storage arrays of the CSA. The logical data volumes typically have performance requirements that cannot be met by a single storage array. Upon receipt of a command from the host device to create one of the logical data volumes, the CSA primary device analyzes the storage arrays to determine a combination thereof, across which the logical data volume will be striped, that best satisfies the performance requirements. The CSA primary device configures these storage arrays to form the logical data volume and sends striping information, which defines the logical data volume, to the host device. Striping software based on the host device responds to the striping information to access the logical data volume. The CSA primary device also manages the storage arrays and the logical data volume by monitoring the storage arrays to determine whether any of the storage arrays is about to reach its saturation point, typically due to changing performance requirements of all of the logical data volumes on the storage arrays. The CSA primary device then migrates a portion of one of the logical data volumes from one storage array to another to balance the data transfer loads on the storage arrays.

Embodiments of this application provide a storage controller and a data migration monitoring method, to improve efficiency, accuracy, and applicability of the data migration method.

To describe the technical solutions in embodiments of this application or in the conventional technology more clearly, the following briefly describes the accompanying drawings for describing the embodiments or the conventional technology.

The following clearly describes the technical solutions in the embodiments of this application with reference to the accompanying drawings in the embodiments of this application.

In the embodiments of this application, for example, "first" and "second" in a first storage area of a memory and a second storage area of the memory are only used to distinguish different storage areas, and have no other limiting function. It may be understood that when the memory is an independent storage component, the first storage area and the second storage area are a part of storage space in the memory. A storage address of the first storage area or the second storage area is a segment of storage address corresponding to the storage space. When the memory includes a plurality of independent storage particles, the first storage area and the second storage area are different storage particles in the memory. In this case, a storage address of the first storage area or the second storage area is a segment of storage address corresponding to a storage particle. In the embodiments of this application, a scenario in which the first storage area is a storage area from which data is migrated, the second storage area is a storage area to which data is migrated, and the memory is the independent storage device is used as an example for description.

<FIG> is a schematic structural diagram of a storage controller according to an embodiment of this application. It can be learned from <FIG> that the storage controller is coupled to a memory. It should be noted that the memory and the storage controller in this embodiment of this application may be integrated into two mutually coupled chips, or both the memory and the storage controller may be integrated into a same memory chip. This is not limited herein.

The storage controller specifically includes a data migration circuit and a data operation determining circuit. The memory includes a first storage area and a second storage area. The data migration circuit is configured to generate a migration signal, to migrate data in the first storage area to the second storage area. In a data migration process in which the data migration circuit migrates all the data in the first storage area to the second storage area, the data operation determining circuit is configured to receive and monitor a data operation signal that is input to the memory, and output a data migration failure signal when detecting that the data operation signal is a data modify signal for the first storage area.

<FIG> is another schematic structural diagram of a storage controller according to an embodiment of this application. It can be learned from <FIG> that an end of the data migration circuit is used as an input end of the storage controller. Another end of the data migration circuit is connected to one end of the memory. Still another end of the data migration circuit is connected to an end of the data operation determining circuit. The other end of the memory is connected to another end of the data operation determining circuit and receives a data operation signal for the memory. Still another end of the data operation determining circuit is connected to an output end of the monitoring circuit.

In specific implementation, after detecting a data migration start signal at the end of the data migration circuit (that is, the input end of the storage controller), the data migration circuit may parse the data migration start signal, to extract a storage address of an area from which data is migrated (that is, the first storage area) and a storage address of an area to which data is migrated (that is, the second storage area). Then, the data migration circuit determines to start a data migration operation, and generates one or more migration signals, to migrate data in each storage unit in the first storage area to a corresponding storage unit in the second storage area. Herein, one migration signal is used to migrate data in one storage unit in the first storage area to a corresponding storage unit in the second storage area. The first storage area and the second storage area have a same size, and storage units included in the first storage area are in a one-to-one correspondence with storage units included in the second storage area. For example, it is assumed that the first storage area includes five storage units, and storage addresses of the five storage units are an address <NUM>, an address <NUM>, an address <NUM>, an address <NUM>, and an address <NUM> respectively. The five storage units store data a1, a2, a3, a4, and a5 respectively. The second storage area also includes five storage units, and addresses of the five storage units are an address <NUM>, an address <NUM>, an address <NUM>, an address <NUM>, and an address <NUM> respectively. After detecting the data migration start signal, the data migration circuit may generate one migration signal (for ease of differentiation, a first migration signal is used in the following for description). The data a1 stored in the storage unit corresponding to the address <NUM> is migrated to the storage unit corresponding to the address <NUM>. After receiving an execution success signal of the first migration signal, the data migration circuit may generate a new migration signal (a second migration signal is used for description herein), to migrate the data a2 stored in the storage unit corresponding to the address <NUM> to the storage unit corresponding to the address <NUM>. By analogy, after the data migration circuit generates five migration signals and successfully executes all the five migration signals, the data migration circuit may complete the data migration operation of migrating all the data in the first storage area to the second storage area.

When detecting that the data migration circuit determines to start the data migration operation, the data operation determining circuit may receive the data operation signal that is input to the memory at a data operation signal input end, and monitor the data operation signal in real time, to determine whether the data operation signal that is input to the memory includes the data modify signal for the first storage area. When detecting that the data operation signal that is input to the memory includes the data modify signal for a first memory, the data operation determining circuit may output the data migration failure signal at the output end of the monitoring circuit (that is, an output end of the data operation determining circuit). It should be noted that, after detecting the data migration failure signal, the data migration circuit may perform the data migration operation for the first storage area again when a fixed period arrives, until a data migration success signal is detected. The data operation signal is a data operation signal that is input to the memory at a moment in the data migration process.

<FIG> is still another schematic structural diagram of a storage controller according to an embodiment of this application. It can be learned from <FIG> that the data operation determining circuit specifically includes an address determining circuit and an operation type determining circuit. One end of the address determining circuit is used as one end of the data determining circuit, and the other end of the address determining circuit is connected to one end of the operation type determining circuit. The other end of the operation type determining circuit is used as an output end of the data operation determining circuit (also an output end of the memory). The data operation signal may be specifically a data packet that includes three types of information: data operation instruction information, a storage address to which the data operation signal points, and a data operation type. After receiving the data operation signal, the address determining circuit may first parse the data operation signal, to obtain the data storage address to which the data operation signal points. Then, the address determining circuit may determine whether the data storage address to which the data operation signal points is included in the storage address of the first storage area, and transmit, to the operation type determining circuit, an address determining signal used to indicate a determining result. If the operation type determining circuit determines, based on the address determining signal, that the data storage address to which the data operation signal points is included in the storage address of the first storage area, the operation type determining circuit may extract a data operation type corresponding to the data operation signal from the data operation signal. If the operation type determining circuit detects that the data operation type corresponding to the data operation signal is data rewrite, the operation type determining circuit may output the data migration failure signal. If the address determining circuit detects that the data storage address to which the data operation signal points is not included in the storage address of the first storage area, or the operation type determining circuit detects that the data operation type corresponding to the data operation signal is not a data rewrite operation, the operation type determining circuit may not output a signal temporarily or may output an indication signal used to indicate that the data operation signal is not the data modify signal for the first storage area. Then, the address determining circuit may obtain a new data operation signal and repeat the determining operation. In this embodiment, whether the data operation is the data rewrite operation for the first storage area is finally determined by using the data storage address to which the data operation signal points and the operation type corresponding to the data operation signal. This process is simple and easy to implement, and can ensure accuracy of a determining result.

Optionally, when the operation type determining circuit detects that the data operation type corresponding to the data operation signal is data rewrite, the operation type determining circuit may continue to monitor whether the data rewrite operation indicated by the first data operation signal is successfully performed. Specifically, after determining that the data operation signal is the data modify signal for the first storage area, the data operation determining circuit may trigger the memory to feed back a response signal corresponding to the data operation signal to the data operation determining circuit. When detecting that the response signal is a response success signal, the operation type determining circuit may determine that the data rewrite operation is successfully performed, and the data migration failure signal may be output at the output end of the monitoring circuit. When detecting that the response signal is a response failure signal, the operation type determining circuit may determine that the data rewrite operation fails to be performed, and the data migration failure signal does not need to be output. The data operation determining circuit outputs the data migration failure signal only when determining that the data rewrite operation is successfully performed, so that incorrect determining caused by a data rewrite failure can be avoided, and efficiency and accuracy of the data migration method can be improved.

When detecting that the operation type corresponding to the data operation signal is data rewrite (in other words, the data operation signal is the data modify signal for the first storage area), the operation type determining circuit sends a recording trigger signal to the data migration circuit, to trigger the data migration circuit to record the data storage address to which the data operation signal points. Then, after the data migration circuit migrates all the data in the first storage area to the second storage area, the data migration circuit performs the data migration operation on data again at the data storage address indicated by the operation signal. Herein, it should be noted that there may be a plurality of data modify signals for the first storage area in an entire data migration process. After detecting the data modify signals, the operation type determining circuit triggers the data migration circuit to record a plurality of data storage addresses to which the data modify signals point, and perform the data migration operation again on data at the plurality of data storage addresses after the current data migration operation is completed. Optionally, when there are a plurality of data modify signals for the first storage area, after completing the current data migration operation, the data migration circuit may first determine a quantity of data storage addresses to which the data modify signals that are for the first storage area and that are recorded by the data migration circuit point. When the quantity is less than or equal to a preset quantity threshold, the data migration circuit may perform data migration again on the data at the data storage addresses. When the quantity is greater than the preset quantity threshold, the data migration circuit may perform the data migration operation again on all the data in the first storage area. The data migration circuit records a data storage address at which the data rewrite operation exists, and after migrating all the data in the first storage area to the second storage area, performs the data migration operation again on the data at the data storage address at which the data rewrite operation exists. In this way, the data migration circuit does not need to repeatedly perform the data migration operation on data at a data storage address at which no data rewrite operation exists, to improve efficiency of the data migration process.

When detecting that the data operation signal is the data modify signal for the first storage area, the operation type determining circuit may send a data migration stop signal to the data migration circuit by using an end that is of the operation type determining circuit and that is connected to the data migration circuit, to trigger the data migration circuit to stop data migration. For example, with reference to the foregoing data migration example, when the data migration circuit migrates the data a3 from the first storage area to the second storage area, if the operation type determining circuit detects the data modify signal for the first storage area, the operation type determining circuit may send the data migration stop signal to the data migration circuit, to trigger the data migration circuit to stop the data migration operation. In this way, the data migration circuit does not continue to perform the data migration operation on the data a4 and a5. Therefore, a quantity of invalid data migration operations can be reduced, and migration efficiency of the data migration method based on the storage controller can be improved.

When the operation type determining circuit detects that the operation type corresponding to the data operation signal is data rewrite, after the data migration circuit migrates all the data in the first storage area to the second storage area, the operation type determining circuit sends a data migration stop signal to the data migration circuit by using an end connected to the data migration circuit, to trigger the data migration circuit to stop migrating data in the first storage area to the second storage area.

In some feasible implementations, if the data migration circuit migrates all the data in the first storage area to the second storage area, and the data operation determining circuit does not detect that the data operation signal input to the memory includes the data rewrite operation signal for the first storage area, the data operation determining circuit outputs the data migration success signal at an output end of the monitoring circuit. After detecting the data migration success signal, the data migration circuit may stop the data migration operation for the first storage area.

<FIG> is still another schematic structural diagram of a storage controller according to an embodiment of this application. It can be learned from <FIG> that the storage controller further includes an address switching circuit. One end of the address switching circuit is connected to the output end of the data operation determining circuit, and the other end of the address switching circuit is connected to one end of the memory. After the output end of the data operation determining circuit outputs the data migration success signal, the address switching circuit immediately switches, from the storage address of the first storage area to a corresponding storage address in the second storage area, a data storage address to which a data operation signal for the first storage area points at a current moment. In addition, after the data migration is completed and before the data migration circuit restores data in the second storage area to the first storage area, as long as the data operation signal input to the memory includes the data operation signal for the first storage area, the address switching circuit may switch, from the first storage area to the second storage area, the data storage address to which the data operation signal for the first storage area points. In this way, after the data migration succeeds, one or more data operation instructions for the first storage area can accurately obtain, from the second storage area, data that needs to be operated by the one or more data operation instructions. After it is determined that the data migration succeeds, address switching is performed by using the address switching circuit, so that a delay caused by using software to perform address switching can be avoided, and efficiency of the data migration method based on the storage controller is improved.

It should be noted that, in actual application, the storage controller described in this embodiment of this application may be specifically applied to an implementation scenario in which a memory has a high performance requirement. For example, a memory in user equipment (such as a mobile phone or a tablet computer), a network device (such as a base station server), or a core network device (such as a core router or a core server) has a relatively high performance requirement. The storage controller described in this embodiment of this application performs access control on memories in these devices.

In this embodiment of this application, in a process in which the data migration circuit migrates the data in the first storage area of the memory to the second storage area of the memory, the data operation determining circuit monitors, in real time, the data operation signal input into the memory, to detect, in time, a case in which the data migration fails. Therefore, a quantity of invalid data migration operations caused by a data migration failure is reduced, and efficiency, accuracy, and applicability of the data migration method are improved.

<FIG> is a schematic flowchart of a data migration monitoring method according to an embodiment of this application. The data migration monitoring method is applicable to a data migration process of a memory. In this embodiment of this application, the memory includes a first storage area and a second storage area. The data migration monitoring method provided in this embodiment of this application may be specifically implemented by a monitoring device including the storage controller described in Embodiment <NUM>. For ease of understanding, this embodiment of this application is described by using the monitoring device as an execution body. It should be noted that, in this embodiment of this application, one-time complete data migration operation starts from starting the data migration operation by the monitoring device and ends with determining whether data migration succeeds or fails by the monitoring device. A data operation for the memory described in this embodiment is specifically an operation instruction that can be received by the memory at any moment and that is used to request to process data in the memory. The monitoring method includes the following steps.

S101: Monitor a data operation for a memory in a process of migrating data in a first storage area to a second storage area.

In some feasible implementations, in a process of migrating all the data in the first storage area to the second storage area, a monitoring device may monitor the data operation for the memory at a data aggregation node of the memory. Herein, the data aggregation node of the memory may be specifically a storage controller of the memory. The data operation for the memory is an operation used to implement processing such as reading, writing, and reading clear on data stored in the memory.

Optionally, in specific implementation, the monitoring device may first obtain a data migration start instruction, and start, according to the data migration start instruction, a data migration operation of migrating the data in the first storage area to the second storage area. Herein, the data migration start instruction indicates at least a storage address of the first storage area and a storage address of the second storage area. The first storage area and the second storage area have a same size, and storage units included in the first storage area are in a one-to-one correspondence with storage units included in the second storage area. For example, it is assumed that the data migration start instruction indicates that the first storage area includes five storage units, and storage addresses of the five storage units are an address <NUM>, an address <NUM>, an address <NUM>, an address <NUM>, and an address <NUM> respectively. The five storage units store data a1, a2, a3, a4, and a5 respectively. The second storage area also includes five storage units, and addresses of the five storage units are an address <NUM>, an address <NUM>, an address <NUM>, an address <NUM>, and an address <NUM> respectively. After obtaining the data migration start instruction, the monitoring device may send a first migration instruction to the storage controller, to instruct the storage controller to migrate the data a1 stored in the storage unit corresponding to the address <NUM> to the storage unit corresponding to the address <NUM>. Then, the monitoring device may continue to send a second migration instruction, to instruct the storage controller to migrate the data a2 stored in the storage unit corresponding to the address <NUM> to the storage unit corresponding to the address <NUM>. By analogy, after migrating all the data in the first storage area to the second storage area, the monitoring device stops sending a migration instruction.

When performing the data migration operation, the monitoring device monitors the data operation for the memory in real time, to determine whether the data operation for the memory is a rewrite operation for the first storage area. Specifically, in the data migration process, the monitoring device intercepts, at the data convergence node of the memory at a moment, an operation instruction for requesting to perform a data operation on the memory. Then, the monitoring device parses and determine the operation instruction, to further determine whether the data operation that is for the memory and that is requested by the operation instruction is the rewrite operation for the first storage area.

The following uses an operation instruction A for requesting to perform the data operation (for ease of understanding and differentiation, a first data operation is used in the following for description) on the memory as an example to describe a process in which the monitoring device determines whether the data operation for the memory is the rewrite operation for the first storage area. After intercepting the operation instruction A at a moment t1, the monitoring device may parse a data storage address to which the first data operation requested by the operation instruction A points, and determine whether the data storage address to which the first data operation points is included in the storage address of the first storage area. If the monitoring device determines that the data storage address to which the first data operation points is not included in the storage address of the first storage area, the monitoring device may continue to intercept a new data operation instruction, and repeatedly perform the foregoing determining process on the new operation instruction. If the monitoring device determines that the data storage address to which the first data operation points is included in the storage address of the first storage area, the monitoring device may extract a data operation type corresponding to the first data operation. For example, the monitoring device may parse the operation instruction A to obtain an operation type identifier corresponding to the target data operation, and then determine, based on the operation type identifier, the data operation type corresponding to the target data operation. Herein, the data operation type may include a read operation, a write operation, a read clear operation, and the like. This is not limited herein. After determining the data operation type of the first data operation, the monitoring device may determine whether the data operation type is data rewrite. Herein, the data rewrite is a data operation that can cause a change to data in the first storage area, for example, the write operation or the read clear operation. If the monitoring device determines that the data operation type corresponding to the first data operation is data rewrite, the monitoring device may determine that the first data operation is the rewrite operation for the first storage area. In other words, the data operation for the memory is the data rewrite operation for the first storage area. If the monitoring device determines that the first data operation is not a rewrite operation, the monitoring device may repeatedly perform the foregoing determining process according to a new operation instruction, and finally determine whether the data rewrite operation for the first storage area exists in the data migration process.

In this embodiment, whether the data operation for the memory is the rewrite operation for the first storage area is determined by using the data storage address to which the data operation points and the operation type corresponding to the data operation, to ensure validity of the foregoing determining result. In addition, the method is easy to implement, and helps improve efficiency of the data migration method.

S102: When it is detected that the data operation for the memory is the rewrite operation for the first storage area, determine that data migration fails.

In some feasible implementations, after migration is completed, if data after the migration is inconsistent with data before the migration, it indicates that an error occurs in this data migration. Therefore, when the monitoring device determines that the data operation that is for the memory and that is intercept by the monitoring device is the rewrite operation for the first storage area, it indicates that the data in the first storage area may be changed in the data migration process. In this case, after all the data in the first storage area is migrated to the second storage area, the data in the first storage area may be different from the data in the second storage area. Therefore, the monitoring device may determine that the current data migration fails. For example, with reference to the example of the data migration process in step S101, if the monitoring device detects that a data operation instruction B is received when the monitoring device migrates a3 in the storage unit corresponding to the address <NUM> to the storage unit corresponding to the address <NUM>, and the data operation instruction B requests to write data b2 into the storage unit corresponding to the address <NUM>, after the current data migration is completed, the data stored in the first storage area is a1, b2, a3, a4, and a5, and the data stored in the second storage area is a1, a2, a3, a4, and a5. The data stored in the two storage areas is inconsistent. Therefore, when detecting the data operation instruction B, the monitoring device may determine that the current data migration fails.

Optionally, when detecting that the data operation for the memory is the rewrite operation for the first storage area, the monitoring device may continue to determine whether the rewrite operation is successfully performed. For example, the monitoring device may determine whether data at a storage address to which the rewrite operation points is changed after the rewrite operation is completed. If the data at the storage address to which the rewrite operation points is changed after the rewrite operation is completed, the rewrite operation is successfully performed. If the data at the storage address to which the rewrite operation points is not changed after the rewrite operation is completed, the rewrite operation fails to be performed. If the monitoring device determines that the rewrite operation for the first storage area is successfully performed, the monitoring device may determine that the data migration fails. If the monitoring device determines that the rewrite operation for the first storage area fails, the monitoring device continues to monitor the data operation for the memory. When it is detected that there is the data rewrite operation for the first storage area and it is determined that the data rewrite operation succeeds, it is determined that the data migration fails. This can avoid incorrect determining caused by a data rewrite failure, and improve accuracy of the data migration monitoring method.

When detecting that the data operation for the memory is the rewrite operation for the first storage area, the monitoring device records the data storage address to which the data operation points. Then, after migrating all the data in the first storage area to the second storage area, the monitoring device performs the data migration operation again on data at the storage address to which the data operation points. Herein, it should be noted that there may be a plurality of data rewrite operations for the first storage area in an entire data migration process. After detecting the data rewrite operations, the monitoring device records a plurality of data storage addresses to which the data rewrite operations point, and performs the data migration operation again on data at the plurality of data storage addresses after the current data migration operation is completed. Optionally, when there are the plurality of data rewrite operations for the first storage area, after completing the current data migration operation, the monitoring device may first determine a quantity of data storage addresses to which the data rewrite operations that are for the first storage area and that are recorded by the monitoring device point. When determining that the quantity is less than or equal to a preset quantity threshold, the monitoring device may perform the data migration again on data at the storage addresses. When determining that the quantity is greater than a preset quantity threshold, the monitoring device may perform the data migration operation again on all the data in the first storage area. Specifically, the data storage address at which the data rewrite operation exists is recorded, and after all the data in the first storage area is migrated to the second storage area, the data migration operation is performed again on the data storage address at which the data rewrite operation exists. In this way, the monitoring device does not need to repeatedly perform the data migration operation on a data storage address at which no data rewrite operation exists, to improve efficiency of the data migration process.

Optionally, when the monitoring device determines that the migration fails, the monitoring device may stop the current data migration operation. For example, with reference to the foregoing data migration example, when the monitoring device migrates the data a3 from the first storage area to the second storage area, if it is detected that a rewrite operation is performed for the first storage area, the monitoring device may stop the data migration operation. That is, the migration operation on the data a4 and a5 is not performed. In this way, a quantity of invalid data migration operations can be reduced, and data migration efficiency can be improved. Optionally, when determining that the data migration fails, the monitoring device may not immediately stop the data migration operation. The monitoring device stops the data migration operation after migrating all the data in the first storage area to the second storage area.

Optionally, after determining that the migration fails, the monitoring device may actively report that a current data migration status is a failed state. In this way, another component connected to the monitoring device can detect, in time, that the current data migration fails, to avoid more invalid operations, improve data migration efficiency, and improve resource utilization in the data migration process. Alternatively, after determining that the migration succeeds, the monitoring device may actively report that a current data migration status is a successful state. In this way, another component connected to the monitoring device can detect, in time, that the current data migration succeeds, so as to quickly respond, and improve efficiency of the data migration process.

Optionally, when determining that the current data migration fails, the monitoring device may start a preset timer for timing. When an accumulated time of the timer is equal to a preset time threshold, the monitoring device resets the timer, and restarts a second data migration operation.

In some feasible implementations, if all the data in the first storage area is migrated to the second storage area, and no rewrite operation for the first storage area is detected, the monitoring device may determine that the data migration succeeds. For example, with reference to the foregoing data migration example, until the monitoring device migrates the data a1, a2, a3, a4, and a5 from the first storage area to the second storage area, the monitoring device detects no data rewrite operation for the first storage area, or the monitoring device detects that no data rewrite operation for the first storage area is successfully performed. In this way, the monitoring device may determine that the current data migration succeeds.

Optionally, when determining that the data migration succeeds, the monitoring device may switch, from the storage address of the first storage area to a corresponding storage address in the second storage area, the data storage address to which the data operation for the first storage area points. It should be noted herein that the data operation for the first storage area described herein is a data operation that is requested by a data operation instruction for the first storage area and that is detected by the monitoring device at any time in the data migration process and after the data migration succeeds. In this way, after the data migration succeeds, the data operation can accurately indicate, from the second storage area, data that needs to be operated. When determining that data migration succeeds, the monitoring device immediately performs address mapping in the storage area, to reduce an operation delay caused by enabling address mapping based on a data migration state. In this way, data migration efficiency is improved, and it is ensured that a correct response can be obtained to the data operation for the first storage area after the data migration succeeds.

In some feasible implementations, when determining that the current data migration succeeds, the monitoring device may immediately stop monitoring the data operation signal for the memory. Then, when a new data migration start instruction is received, the monitoring operation is restarted. Through the foregoing steps, energy consumption of the monitoring device can be reduced.

In some feasible implementations, the data migration monitoring method described in Embodiment <NUM> may be applied to a data backup process and a restoration process of a memory built-in self-test (MBIST) technology. It may be understood that both the data backup process and the restoration process may be considered as a data migration process. For example, the monitoring device may monitor a data operation for a tested storage area in a process of backing up data of the tested storage area to a backup storage area related to the MBIST technology. When detecting that there is a data rewrite operation for the tested storage area, the monitoring device stops data backup, and determines that the current data backup fails. If all the data in the tested storage area is migrated to the backup storage area, and the monitoring device detects no data rewrite operation for the tested storage area, it may be determined that the data migration succeeds. Similarly, the monitoring device may repeatedly perform the foregoing monitoring operation in a process of restoring data in the backup storage area to the tested storage area. For a specific data migration monitoring process, refer to the monitoring process described in step S <NUM> and step S102. By applying the data migration monitoring method to the data backup process and the data restoration process between the tested storage area and the backup area related to the memory built-in self-test technology, a quantity of invalid data migration operations caused by a data migration failure in the data backup process and the data restoration process can be reduced. This improves efficiency and reliability of the MBIST technology.

In this embodiment of this application, the data operation for the memory is monitored in real time, so that a data migration failure caused by the data rewrite operation for the first storage area may be determined in an accurately and in time, and a quantity of invalid data operations caused by the data migration failure can be reduced. In this way, efficiency, accuracy, and applicability of a data migration process can be improved.

<FIG> is a schematic structural diagram of an electronic device according to an embodiment of this application. The electronic device provided in this embodiment of this application includes a processor <NUM>, a memory <NUM>, and a bus system <NUM>. The processor <NUM> and the memory <NUM> are connected through the bus system <NUM>.

The memory <NUM> is configured to store a program. Specifically, the program may include program code, and the program code includes computer operation instructions. The memory <NUM> includes but is not limited to a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), or a compact disc read-only memory (CD-ROM). Only one memory is shown in <FIG>. Certainly, a plurality of memories may alternatively be disposed as required.

The memory <NUM> may alternatively be a memory in the processor <NUM>. This is not limited herein.

The memory <NUM> stores the following elements: an executable module or a data structure, a subset thereof, or an extended set thereof:.

The processor <NUM> controls an operation of the electronic device, and the processor <NUM> may be one or more central processing units (CPU). When the processor <NUM> is one CPU, the CPU may be a single-core CPU or may be a multi-core CPU.

During specific application, components of the electronic device are coupled together through the bus system <NUM>. In addition to a data bus, the bus system <NUM> may further include a power bus, a control bus, a status signal bus, and the like. However, for clear description, various buses in <FIG> are all marked as the bus system <NUM>. For ease of illustration, <FIG> merely shows an example of the bus system <NUM>.

The data migration monitoring method disclosed in the embodiments of this application may be applied to the processor <NUM>, or implemented by the processor <NUM>. The processor <NUM> may be an integrated circuit chip, and has a signal processing capability.

An embodiment of this application provides a computer-readable storage medium. The computer-readable storage medium stores instructions. When the instructions are run on a computer, the data migration monitoring method described in Embodiment <NUM> may be implemented.

The computer-readable storage medium may be an internal storage unit of the monitoring device according to Embodiment <NUM>. The computer-readable storage medium may alternatively be an external storage device of the monitoring device, for example, a removable hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, or the like that is provided on the monitoring device. Further, the computer-readable storage medium may alternatively include both an internal storage unit and an external storage device of the foregoing monitoring device. The computer-readable storage medium is configured to store the foregoing computer program and other programs and data that are required by the foregoing monitoring device. The computer-readable storage medium may be further configured to temporarily store data that has been output or is to be output.

A person of ordinary skill in the art may understand that all or some of the procedures in the methods in the foregoing embodiments may be implemented by a computer program instructing related hardware. The program may be stored in a computer-readable storage medium. When the program is run, the procedures of the methods in the foregoing embodiments are performed. The foregoing storage medium includes any medium that can store program code, such as a ROM, a random access memory RAM, a magnetic disk, or an optical disc.

Claim 1:
A storage controller (<NUM>), wherein the storage controller (<NUM>) is coupled to a memory (<NUM>), the storage controller (<NUM>) comprises a data migration circuit and a data operation determining circuit, and the memory (<NUM>) comprises a first storage area and a second storage area, wherein
the data migration circuit is configured to generate a migration signal, wherein the migration signal is used to migrate data in the first storage area to the second storage area;
in a data migration process in which the data migration circuit migrates all the data in the first storage area to the second storage area, the data operation determining circuit is configured to receive and monitor a data operation signal input to the memory (<NUM>);
wherein the data operation determining circuit comprises an operation type determining circuit,
wherein the operation type determining circuit is further configured to:
when determining that the data operation signal is the data modify signal for the first storage area, trigger the data migration circuit to record the data storage address to which the data operation signal points; and
the data migration circuit is further configured to:
after all the data in the first storage area is migrated to the second storage area, remigrate, from the first storage area to the second storage area, the data at the data storage address to which the data operation signal points.