Data writing method and device, equipment, storage medium and product

By deciding whether to perform data writing locally based on the home information of the data block during file migration, and migrating the results to the post-migration location of the target file, the write operation cannot be performed during file migration in the prior art. Problem, improving the efficiency of file migration and data writing.

CN119441144APending Publication Date: 2025-02-14CHINA MOBILE INFORMATION TECHNOLOGY CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411517110.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-28
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

During file migration, the existing technology adopts a file lock mechanism, which makes it impossible to perform write operations during the migration process, affecting business efficiency and reducing migration and write efficiency.

Method used

During the migration process of the target file, the home information of the data block is obtained in response to the data write request. If the data block is not stored locally, data writing is performed locally and the result is migrated to the migration location of the target file.

Benefits of technology

It realizes the synchronous execution of data writing operations during file migration, ensuring that the data writing results are correctly migrated, and improving the efficiency of file migration and data writing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119441144A_ABST
    Figure CN119441144A_ABST
Patent Text Reader

Abstract

The invention discloses a data writing method and device, equipment, a storage medium and a product, and relates to the technical field of data migration, and the method comprises the steps that in the migration process of a target file, in response to a data writing request, first attribution information of a first target data block corresponding to the data writing request is acquired, and the target file comprises a plurality of data blocks; under the condition that the first attribution information represents that the first target data block is not stored locally, executing the data writing request locally to obtain an execution result; and migrating the execution result to the migrated position of the target file. According to the method and the device, the data writing operation can be synchronously executed while the file is migrated, the lossless writing of the file is realized, and the migration efficiency of the file and the writing efficiency of the data are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of data migration, and in particular to a data writing method, device, equipment, storage medium and product. Background Art

[0002] In the related art, a file lock mechanism is often used during the migration of file data, that is, the file data can only be written after the file migration is completed. This makes it impossible to carry out some businesses that need to perform write operations while the file is migrating, affecting the normal development of the business and reducing the migration efficiency and reading and writing efficiency of the file.

[0003] Therefore, how to improve the efficiency of file migration and writing is a problem that needs to be solved urgently. Summary of the invention

[0004] The main purpose of this application is to provide a data writing method, device, equipment, storage medium and product, aiming to solve the technical problem of how to improve file migration efficiency and writing efficiency.

[0005] To achieve the above purpose, the present application proposes a data writing method, which includes: In a migration process of a target file, in response to a data write request, obtaining first ownership information of a first target data block corresponding to the data write request, wherein the target file includes a plurality of data blocks; When the first attribution information indicates that the first target data block is not stored locally, executing the data write request locally to obtain an execution result; Migrate the execution results to the post-migration location of the target file.

[0006] In one embodiment, when the first attribution information indicates that the first target data block is not stored locally, executing the data write request locally to obtain the execution result includes: Determine a data write amount of the data write request; When the data writing amount is greater than or equal to the set value, the data writing request is executed locally to obtain the execution result; When the amount of data written is less than the set value, the target data block is obtained from the post-migration position; Execute a data write request on the target data block locally and obtain an execution result.

[0007] In some embodiments, the data writing method further includes: In the migration process of the target file, in response to a data read request, obtaining second attribution information of a second target data block corresponding to the data read request; When the second belonging information indicates that the second target data block is not stored locally, the second target data block is read from the migrated location.

[0008] In some embodiments, during the migration process of the target file, after obtaining the second ownership information of the second target data block corresponding to the data read request in response to the data read request, the data writing method further includes: In the case that the second attribution information indicates that the second target data block is being transmitted, in response to monitoring that the second attribution information changes to indicate that the second target data block is no longer stored locally, the second target data block is read from the migrated location.

[0009] In some embodiments, obtaining first ownership information of a first target data block corresponding to a data write request includes: Obtaining a current status value of a first target data block from a data block bitmap of the target file, wherein each data block in the target file has a corresponding status value in the data block bitmap; When the current state value is a first preset value, determining that the first ownership information of the first target data block is that the data block is stored locally; When the current state value is the second preset value, it is determined that the first ownership information of the first target data block is that the data block is not stored locally.

[0010] In some embodiments, obtaining the current state value of the first target data block from the data block bitmap of the target file includes: Obtain metadata of the target file; the metadata includes a data block bitmap and a location after migration; From the data block bitmap, obtain the current state value of the first target data block.

[0011] In addition, to achieve the above purpose, the present application also proposes a data writing device, the data writing device comprising: an attribution acquisition module, used for acquiring first attribution information of a first target data block corresponding to a data write request in response to a data write request during a migration process of a target file, wherein the target file includes a plurality of data blocks; An operation execution module, configured to execute a data write request locally to obtain an execution result when the first attribution information indicates that the first target data block is not stored locally; The data migration module is used to migrate the execution results to the post-migration location of the target file.

[0012] In addition, to achieve the above objectives, the present application also proposes a data writing device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the data writing method as described above.

[0013] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium. A computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the data writing method as described above are implemented.

[0014] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the data writing method as described above are implemented.

[0015] One or more technical solutions proposed in this application have at least the following technical effects: Since the target file is divided into multiple data blocks, and the ownership information of the data blocks is pre-recorded, during the migration process of the target file, when data needs to be written, it can be determined whether the first target data block is stored locally according to the first ownership information of the first target data block. In the case that the first target data block is not stored locally, the data writing operation is performed locally, and the execution result is migrated to the post-migration position of the target file, thereby ensuring that the data writing operation can be performed synchronously while the file is being migrated, and the changes to the target file caused by the data writing operation are also migrated to the post-migration position of the target file, realizing lossless writing of the file, and improving the file migration efficiency and data writing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0017] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0018] Figure 1 A schematic diagram of a data writing method according to an embodiment of the present application; Figure 2 An embodiment of the present application provides Figure 1 Schematic diagram of the process of step S110; Figure 3 An embodiment of the present application provides Figure 2 Schematic diagram of the process of step S111; Figure 4 A schematic diagram of a data block bitmap provided for an exemplary embodiment of the present application; Figure 5A schematic diagram of a flow chart of a data writing method provided in another embodiment of the present application; Figure 6 A schematic diagram of a brief flow chart of a data writing method provided by an exemplary embodiment of the present application in situation ①; Figure 7 A schematic diagram of the structure of a data writing device provided in an embodiment of the present application; Figure 8 A schematic diagram of the structure of a data writing device provided in an embodiment of the present application.

[0019] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0020] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0021] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0022] The main solution of the embodiment of the present application is: in the migration process of the target file, in response to a data write request, obtaining first attribution information of the first target data block corresponding to the data write request, wherein the target file includes multiple data blocks; when the first attribution information indicates that the first target data block is not stored locally, executing the data write request locally to obtain the execution result; and migrating the execution result to the post-migration position of the target file.

[0023] In this embodiment, for the convenience of description, the following description is made with the data writing device as the execution subject.

[0024] In the related art, during the migration of file data, in order to avoid data inconsistency caused by reading and writing files during the migration process, a file lock mechanism is used to lock the file during the file migration process. When it is necessary to read and write files, all operations will be blocked, and read and write operations can only be performed after the file migration is completed. File lock is also a mutual exclusion mechanism that ensures that multiple terminals can read / write the same file in a safe manner. The reason for controlling these read and write services is that these read and write operations are unpredictable. This unpredictable timing will cause competitive access to the same file resource, resulting in unexpected results.

[0025] There are generally two types of lock mechanisms in file lock schemes: cooperative locks and mandatory locks. Cooperative locks are not mandatory lock schemes and are only effective when the participating ends cooperate by explicitly acquiring locks. Unlike cooperative locks, mandatory locks do not require any cooperation between participating processes. Once a mandatory lock is activated on a file, the operating system prevents other processes from reading or writing the file. Regardless of the lock mechanism, the file read and write performance will be affected. Only after the entire file is released can it be read and written.

[0026] Based on the above-mentioned related technologies, some businesses that need to perform read and write operations while migrating files cannot be carried out, which affects the normal development of the business and reduces the migration efficiency and writing efficiency of files.

[0027] The present application provides a solution that allows data writing operations to be performed synchronously while migrating files, and changes to the target file caused by the data writing operation are also migrated to the post-migration location of the target file, achieving lossless reading and writing of files and improving file migration efficiency and data writing efficiency.

[0028] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or a data writing device or a data writing apparatus capable of realizing the above functions. The data writing apparatus is taken as an example to illustrate this embodiment and the following embodiments.

[0029] Reference Figure 1 , Figure 1 A schematic diagram of a flow chart of a data writing method provided in an embodiment of the present application.

[0030] In this embodiment, the data writing method includes steps S110 to S130: Step S110 : in the process of migrating the target file, in response to a data writing request, obtaining first ownership information of a first target data block corresponding to the data writing request.

[0031] The target file includes multiple data blocks.

[0032] It should be noted that the target file refers to a data file that is migrated from a pre-migration location to a post-migration location. Specifically, the target file may be migrated from a local computer to another host, or from one local partition to another local partition, or from a local computer to a mobile hard disk. In the following embodiments, the data writing method is described in detail by taking the migration of a target file from a local computer to another host as an example.

[0033] In addition, in this embodiment, before the target file is migrated, the target file can be segmented according to a preset data size value to obtain multiple units. Each segmented unit is a data block, so that a target file can include multiple data blocks. In one example, the preset data size value can be 1Mb.

[0034] It should be noted that the above-mentioned "segmentation" may refer to the segmentation of the storage location, that is, the target file is actually segmented and stored in the form of data blocks. Taking the above-mentioned 1Mb as an example, the target file is segmented and stored in units of 1Mb.

[0035] In some implementations, when the entire target file needs to be migrated, different data blocks belonging to the same target file can perform a migration process in parallel in the background to improve the file migration efficiency.

[0036] During the migration of the target file, there are two situations: ① After the data block is transferred, the local data block is cleared immediately; ② After the data block is transferred, the local data block is cleared only after the preset clearing condition is met. For example, the preset clearing condition is that it has not been accessed within a set time. For the above situation ①, the complete data block will only exist in one of the local and post-migration locations; for the above situation ②, the complete data block may exist in both the local and post-migration locations.

[0037] In some embodiments, the data write request may be generated and sent by a user other than the host, and the data write request is sent to the local host (i.e., the data write device / equipment in this embodiment), and the local host responds. For example, when the application scenario of this embodiment is counter business, while the background data (target file) is being migrated, the counter still needs to handle some business for the background data. At this time, if the counter needs to make certain additions to the background data, it needs to generate a corresponding data write request and send it to the local host to write data to the background data being migrated.

[0038] In some implementations, the data write request includes the location of the written data in the target file and the amount of data written. Still using the above example to illustrate, when the counter needs to add background data, the location of the data to be added and its data size should be clarified, so as to clarify the implementation method for subsequent data writing.

[0039] Specifically, after receiving a data write request, the local host may locate the data block based on the position of the written data in the target file, that is, determine the first target data block.

[0040] In some embodiments, when the target file is segmented, a corresponding identifier can be determined in advance for each segmented data block, and a mapping relationship between the identifier and the data block can be established. In one example, the identifier can be a number, and the composition order of different data blocks in the target file can be recorded in the form of a number, thereby ensuring that there will be no errors in the logic before and after the migration of the target file, and achieving lossless transmission. It can be understood that the form of the identifier determined for the data block is not limited to the number, and other identification forms can also be formulated according to the actual scenario requirements, which is not limited in this embodiment.

[0041] Taking the above numbering as an example, based on the numbering and the pre-established mapping relationship between the numbering and the data block, the local host can quickly locate which data block the data to be written by the user corresponds to, that is, the first target data block.

[0042] For the above situation ①: like Figure 2 As shown, in a feasible implementation manner, obtaining the first ownership information of the first target data block corresponding to the data write request in step S110 may include steps S111 to S113: Step S111, obtaining the current status value of the first target data block from the data block bitmap of the target file.

[0043] Each data block in the target file has a corresponding status value in the data block bitmap.

[0044] Step S112: when the current state value is the first preset value, determining that the first ownership information of the first target data block is that the data block is stored locally.

[0045] Step S113: when the current state value is the second preset value, determining that the first ownership information of the first target data block is that the data block is not stored locally.

[0046] like Figure 3 As shown, in a feasible implementation manner, obtaining the status value of the first target data block from the data block bitmap of the target file in step S111 may include steps S1111 to S1112: Step S1111, obtaining metadata of the target file; the metadata includes a data block bitmap and a post-migration position.

[0047] Step S1112: Obtain the current state value of the first target data block from the data block bitmap.

[0048] Specifically, the target file may have pre-set metadata. The metadata refers to the content pre-set when the target file is split, and the metadata at least includes a data block bitmap and a position of the target file after migration.

[0049] The data block bitmap includes a status value corresponding to each data block in the target file, and the status value is used to reflect the migration status of the data block, that is, whether the migration has been completed (for example, whether the data block has been completely moved to the post-migration position).

[0050] In some embodiments, during the migration process, if the data block is completely migrated to the post-migration location, the device corresponding to the post-migration location (e.g., the host device) may send a feedback signal to the local host to inform that the migration of the data block has been completed. In response to receiving the feedback signal, the local host may modify the status value corresponding to the data block to indicate that the migration of the data block has been completed.

[0051] Specifically, the status value may include a first preset value and a second preset value, wherein when the status value is the first preset value, it indicates that the corresponding data block has not been migrated yet, for example, it is in the process of migration; when the status value is the second preset value, it indicates that the corresponding data block has been migrated. In this embodiment, the status value of the data block is set to the first preset value by default.

[0052] For example, the first preset value may be set to 1, and the second preset value may be set to 0. Then, the data block bitmap of the target file in the example may be as follows: Figure 4 After the data block transmission is completed, the post-migration location (eg, remote host) generates a feedback signal and sends it to the local host, so that the local host changes the state value of the data block from the first preset value to the second preset value, that is, from 1 to 0.

[0053] By searching for the above status value in the data block bitmap, the local host can determine the migration status of the first target data block, thereby determining the first ownership information of the first target data block.

[0054] Step S120 , when the first ownership information indicates that the first target data block is not stored locally, execute the data write request locally to obtain an execution result.

[0055] Step S130, migrating the execution result to the post-migration location of the target file.

[0056] Since this embodiment is based on the above situation ①, that is, after the data block transmission is completed, the local data block is immediately cleared, so if the first target data block has completed the migration (that is, the status value is 0), the first target data block must not exist locally; if the first target data block has not completed the migration (that is, the status value is 1), the first target data block is stored locally, and the position after the transmission does not currently have a complete first target data block.

[0057] In some implementations, after receiving a data write request, different subsequent implementations may be selected according to the data write amount included in the data write request.

[0058] Specifically, a set value can be preset, and the execution plan can be determined by comparing the data write amount with the set value. The set value can be the maximum amount of data that a data block can carry (for example, 1Mb), or it can be set to other values ​​according to actual needs, which is not limited in this embodiment.

[0059] In some implementations, when the data write amount is greater than or equal to a set value, the data write request may be executed locally to obtain an execution result.

[0060] Specifically, when the data write amount is greater than or equal to the set value, the data write request can be executed through the following steps: a. Determine one or more local data blocks in the local target file; b. Write the data to be written into the local data block and obtain the execution result. Thereafter, step S130 is executed to migrate the data in the local data block to the post-migration position. Taking the business scenario as an example, through the above steps, the modification of the target file can be synchronized to the post-migration position, thereby ensuring the lossless transmission of the target file and ensuring the concurrency of the business content and data migration. At the same time, due to the large amount of written data, the first target data block is not retrieved, but the written content (such as the modified content) is directly migrated to the post-migration position after being executed locally, and the post-migration position (such as the host corresponding to the post-migration position) performs further operations (such as adding the modified content to the corresponding position), which can minimize the transmission delay, reduce the occupancy of the network bandwidth, and improve the writing efficiency.

[0061] In some implementations, when the data write amount is less than a set value, the data write request may be executed by the following steps: Obtain the data in the first target data block from the post-migration position; execute a data write request locally for the data in the first target data block to obtain an execution result. It is understandable that when the amount of data written is less than the set value, it means that there is very little content to be written (for example, the carrying size of each data block is 1Mb, and the amount of data written is only 4kb). To ensure the accuracy of the location of the written content, an input / output (IO) request can be suspended in the foreground at this time, and the data in the first target data block corresponding to the data write request is obtained from the post-migration position to the local data block, and the data can be written directly to the local data block.

[0062] After writing is completed, the status value corresponding to the local data block can be set to the first preset value, thereby automatically initiating data migration and transferring the local data block to the post-migration position to replace the first target data block in the post-migration position. This can also ensure lossless transmission of the target file, ensure concurrent business domain data migration, and improve writing and transmission efficiency.

[0063] For the above situation ②: In case ②, only the status value can be used to know whether the data block has been migrated, but not whether the data block is still stored locally. It is possible that the data block has been migrated, but is still stored locally. Therefore, for each data block, an indicator can be set to reflect whether the data block is still stored locally. The indicator can be stored in the metadata in the form of a mapping table, and this embodiment does not limit the storage form.

[0064] Specifically, when the indicator is set to the first indicator value, it indicates that the data block is no longer stored locally, that is, the data block stored locally has not been accessed within the time threshold. When the indicator is set to the second indicator value, it indicates that the data block is still stored locally, that is, the data block has not been migrated, or the migration has been completed but the time threshold for cleaning data has not been reached.

[0065] In some implementations, the indicator corresponding to each data block may be set to the second indicator value by default. For any data block, when the data block is cleared, the local system automatically changes the indicator from the second indicator value to the first indicator value.

[0066] Then, during the migration process of the target file, after receiving a data write request, first attribution information of the first target data block corresponding to the data write request may be obtained based on the index of the first target data block.

[0067] After obtaining the first attribution information, the subsequent steps are the same as the above-mentioned steps S120 to S130, and the embodiments of the present application will not be repeated here.

[0068] In the data writing method provided by the present embodiment, since the target file is divided into multiple data blocks and the ownership information of the data blocks is recorded in advance, during the migration process of the target file, when data needs to be written, it can be determined whether the first target data block is stored locally according to the first ownership information of the first target data block. In the case that the first target data block is not stored locally, the data writing operation is performed locally, and the execution result is migrated to the post-migration position of the target file, thereby ensuring that the data writing operation can be performed synchronously while the file is being migrated, and the changes to the target file caused by the data writing operation are also migrated to the post-migration position of the target file, thereby realizing lossless reading and writing of files and improving the migration efficiency of files and the writing efficiency of data.

[0069] See also Figure 5 , Figure 5 A schematic flow chart of a data writing method provided by another embodiment of the present application is shown. The data writing method is applied to a data writing device and includes the following steps S210 to S230.

[0070] Step S210 : in the process of migrating the target file, in response to a data read request, obtaining second attribution information of a second target data block corresponding to the data read request.

[0071] Similar to the above-mentioned embodiment, if during the migration process of the target file, the service needs to perform a read operation on the target file, a data read request may be generated and sent to the local host.

[0072] The data read request may include the data range to be read (eg the aforementioned data block number), so that the local host can locate the corresponding second target data block in the target file.

[0073] The second attribution information is used to indicate whether the second target data block is stored locally. The method for obtaining the second attribution information is similar to that for obtaining the first attribution information. For details, please refer to the relevant descriptions in steps S110 to S130, which will not be repeated in this embodiment.

[0074] Step S220 , when the second belonging information indicates that the second target data block is not stored locally, read the second target data block from the post-migration location.

[0075] Step S230 , when the second attribution information indicates that the second target data block is being transmitted, in response to monitoring that the second attribution information changes to indicate that the second target data block is no longer stored locally, reading the second target data block from the migrated location.

[0076] Different from the write operation in the above embodiment, since the read operation only requires data acquisition and does not involve data writing, as long as the data block is not stored locally, the data block must be obtained from the migrated location. Therefore, there is no need to consider the impact of the data volume corresponding to the data read request on bandwidth occupancy.

[0077] For the situation ① in the above embodiment: If the second attribution information indicates that the second target data block is not stored locally, then the second target data block must be stored in the post-migration location. At this time, a foreground I / O request can be suspended on the local host to request to obtain the data in the second target data block from the post-migration location, that is, the remote host where the second target data block is currently stored, to the local host, and perform a read operation on the local host.

[0078] If the second attribution information indicates that the second target data block is in the process of being transmitted (for example, the status value of the second target data block is 1), the second attribution information can be monitored. When the second attribution information changes to indicate that the second target data block is no longer stored locally (that is, the status value changes to 0), the data in the second target data block is obtained from the remote host to the local host, and a read operation is performed.

[0079] For the situation ② in the above embodiment: If the second attribution information indicates that the second target data block is still stored locally, the read operation can be directly performed locally.

[0080] If the second attribution information indicates that the second target data block is not stored locally, the second target data block must be stored in a migrated location. The data in the second target data block can be obtained from a remote host corresponding to the migrated location to a local host to perform a read operation on the local host.

[0081] In some implementations, after the local read is completed, the data obtained by the local host can be cleared immediately to release storage space; or the clearing operation can be performed after a set time length is reached, which is not limited in this embodiment.

[0082] The data writing method provided in the present embodiment determines whether the second target data block is still currently stored locally by acquiring the second attribution information of the second target data block. When the second target data block is still currently stored locally, the read operation is directly performed locally; when the second target data block is not currently stored locally, the data in the second target data block is acquired from the migrated position locally, and then the read operation is performed locally; when the second target data block is in the process of being transmitted, the data in the second target data block is acquired from the migrated position locally after the transmission of the second target data block is completed, and the read operation is performed locally, so that during the migration process of the target file, the target file can be read normally locally, thereby ensuring that file migration and business development can be performed in parallel, thereby improving data reading efficiency.

[0083] For example, to facilitate understanding, the implementation process of the data writing method obtained by combining this embodiment with the above-mentioned embodiment 1 is as follows. Figure 6 , Figure 6 A brief flowchart of the data writing method in case ① is provided. Specifically: Assume that the metadata of the target file includes a data block bitmap, which includes a status value of each data block. The status value includes 1 and 0, which is used to reflect whether the data block has completed migration. After the data block is migrated, it is immediately cleared in the local host.

[0084] Data write request: During the process of transferring the target file from the local host to the remote host, if the local host receives a data write request, it searches the data block bitmap for the status value of the first target data block; if the status value is 1, the first target data block is still stored in the local host, that is, the first target data block has not yet completed the migration, and the data write request can be directly executed on the local host; if the status value is 0, the first target data block has been migrated to the remote host and cleared in the local host, and it is determined whether the data write amount corresponding to the data write request is less than the set value: If the data write amount is less than the set value, the data of the first target data block is obtained from the remote host to the local host, the data write request is executed on the local host, the execution result is obtained, and the execution result is sent to the remote host; if the data write amount is greater than or equal to the set value, the data write request is executed in the local data block of the local host, the execution result is obtained, and the execution result is sent to the remote host.

[0085] Data read request: During the process of transmitting the target file from the local host to the remote host, if the local host receives a data read request, the status value of the second target data block is searched in the data block bitmap; if the status value is 1, the second target data block is in the transmission process, that is, the second target data block has not yet completed the migration. At this time, it is possible to detect in real time whether the status value of the second target data block changes to 0. If it changes to 0, it means that the migration process is over, the data of the second target data block is obtained from the remote host to the local host, and the data read request is executed in the local host; if it does not change to 0, the monitoring continues.

[0086] If the status value is 0, it means that the second target data block has been migrated to the remote end and cleared in the local host. At this time, the data of the second target data block is directly obtained from the remote host to the local host, and the data read request is executed in the local host.

[0087] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the data writing method of the present application. More simple transformations based on this technical concept are all within the protection scope of the present application.

[0088] This application also provides a data writing device, please refer to Figure 7 , the data writing device 100 comprises: The attribution acquisition module 110 is used to acquire first attribution information of a first target data block corresponding to the data write request in response to the data write request during the migration process of the target file, wherein the target file includes a plurality of data blocks; The operation execution module 120 is used to execute the data writing request locally and obtain the execution result when the first belonging information indicates that the first target data block is not stored locally; The data migration module 130 is used to migrate the execution result to the post-migration location of the target file.

[0089] The data writing device 110 provided by the present application adopts the data writing method in the above embodiment, which can solve the technical problem of how to improve the file migration efficiency and the reading and writing efficiency. Compared with the prior art, the beneficial effects of the data writing device 110 provided by the present application are the same as the beneficial effects of the data writing method provided by the above embodiment, and the other technical features in the data writing device 110 are the same as the features disclosed in the above embodiment method, which will not be repeated here.

[0090] The present application provides a data writing device, which includes: at least one processor; and a memory that is communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the data writing method in the above-mentioned embodiment one.

[0091] Reference below Figure 8 , which shows a schematic diagram of the structure of a data writing device 200 suitable for implementing the embodiment of the present application. The data writing device 200 in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 8 The data writing device 200 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0092] like Figure 8As shown, the data writing device 200 may include a processing device 210 (such as a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 220 or a program loaded from a storage device 230 to a random access memory (RAM: Random Access Memory) 240. In RAM240, various programs and data required for the operation of the data writing device 200 are also stored. The processing device 210, ROM220 and RAM240 are connected to each other through a bus 250. An input / output (I / O) interface 260 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 260: an input device 270 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 280 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 230 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 290. The communication device 290 can allow the data writing device 200 to communicate with other devices wirelessly or by wire to exchange data. Although the data writing device 200 with various systems is shown in the figure, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.

[0093] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through a communication device, or installed from the storage device 230, or installed from the ROM 220. When the computer program is executed by the processing device 210, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0094] The data writing device 200 provided by the present application adopts the data writing method in the above embodiment, which can solve the technical problem of how to improve the efficiency of file migration and reading and writing. Compared with the prior art, the beneficial effects of the data writing device 200 provided by the present application are the same as the beneficial effects of the data writing method provided by the above embodiment, and the other technical features in the data writing device 200 are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.

[0095] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0096] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0097] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, wherein the computer-readable program instructions are used to execute the data writing method in the above-mentioned embodiment.

[0098] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.

[0099] The computer-readable storage medium may be included in the electronic device, or may exist independently without being installed in the electronic device.

[0100] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device can write a computer program code for performing the operation of the present application in one or more programming languages ​​or a combination thereof. The programming language includes an object-oriented programming language, such as Java, Smalltalk, C++, and a conventional procedural programming language, such as "C" language or a similar programming language. The program code can be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).

[0101] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0102] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0103] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned data writing method, and can solve the technical problem of how to improve the efficiency of file migration and reading and writing. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the data writing method provided by the above-mentioned embodiment, and will not be repeated here.

[0104] The present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned data writing method when executed by a processor.

[0105] The computer program product provided by this application can solve the technical problem of how to improve the efficiency of file migration and reading and writing. Compared with the prior art, the beneficial effects of the computer program product provided by this application are the same as the beneficial effects of the data writing method provided by the above embodiment, which will not be repeated here.

[0106] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A data writing method, characterized in that: The data writing method comprises: In the migration process of the target file, in response to a data write request, obtaining first ownership information of a first target data block corresponding to the data write request, wherein the target file includes a plurality of data blocks; When the first ownership information indicates that the first target data block is not stored locally, executing the data write request locally to obtain an execution result; The execution result is migrated to a post-migration location of the target file.

2. The data writing method according to claim 1, characterized in that: The step of executing the data write request locally to obtain an execution result when the first ownership information indicates that the first target data block is not stored locally includes: Determining a data write amount of the data write request; When the data writing amount is greater than or equal to the set value, executing the data writing request locally to obtain an execution result; When the data writing amount is less than a set value, acquiring the target data block from the post-migration position; The data write request is executed locally on the target data block to obtain an execution result.

3. The data writing method according to claim 1, characterized in that: The data writing method further includes: In the migration process of the target file, in response to a data read request, obtaining second attribution information of a second target data block corresponding to the data read request; When the second belonging information indicates that the second target data block is not stored locally, the second target data block is read from the post-migration location.

4. The data writing method according to claim 3, characterized in that: In the migration process of the target file, after obtaining the second ownership information of the second target data block corresponding to the data read request in response to the data read request, the data writing method further includes: In a case where the second attribution information indicates that the second target data block is in the process of being transmitted, in response to monitoring that the second attribution information changes to indicate that the second target data block is no longer stored locally, the second target data block is read from the post-migration location.

5. The data writing method according to any one of claims 1 to 4, characterized in that: The obtaining first ownership information of the first target data block corresponding to the data write request includes: Obtaining a current status value of the first target data block from a data block bitmap of the target file, wherein each data block in the target file has a corresponding status value in the data block bitmap; When the current state value is a first preset value, determining that the first ownership information of the first target data block is that the data block is stored locally; When the current state value is a second preset value, it is determined that the first ownership information of the first target data block is that the data block is not stored locally.

6. The data writing method according to claim 5, characterized in that: The acquiring the current status value of the first target data block from the data block bitmap of the target file includes: Acquire metadata of the target file; the metadata includes the data block bitmap and the post-migration position; From the data block bitmap, a current state value of the first target data block is obtained.

7. A data writing device, characterized in that: The data writing device comprises: an attribution acquisition module, configured to acquire first attribution information of a first target data block corresponding to a data write request in response to a data write request during a migration process of the target file, wherein the target file includes a plurality of data blocks; an operation execution module, configured to execute the data write request locally and obtain an execution result when the first ownership information indicates that the first target data block is not stored locally; The data migration module is used to migrate the execution result to the post-migration location of the target file.

8. A data writing device, characterized in that: The data writing device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the data writing method according to any one of claims 1 to 6.

9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the data writing method according to any one of claims 1 to 6 are implemented.

10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the data writing method according to any one of claims 1 to 6 are implemented.