Methods, devices, electronic devices and storage media for synchronous updates of mounted folders
By constructing an image mapping structure and a temporary image, the problem of virtual machine client folder mounting not being able to update synchronously was solved, achieving efficient updates without breaking the connection.
Patent Information
- Application Number
- CN202411325211.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-23
- Publication Date
- 2025-11-14
- Estimated Expiration
- 2044-09-23
AI Technical Summary
In existing technologies, kernel-based virtual machine clients cannot perform synchronous updates without disconnecting when mounting folders, resulting in low update efficiency.
By constructing a mirror mapping structure and a temporary image, a mapping relationship is established between the target folder and the temporary image. The mirror mapping structure is updated according to the data request content, and synchronous updates are performed while the folder maintains its mount connection.
It enables synchronous updates without interrupting the mounting connection of the folder, thus improving update efficiency.
Smart Images

Figure CN119449819B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of folder update technology, and in particular to a method, apparatus, electronic device, and storage medium for synchronous updating of mounted folders. Background Technology
[0002] With the rapid development of server technology, folder mounting technology can remotely mount local folders on a client machine to a server, allowing the server to operate on file resources on the client machine in the same way as it operates on the local disk.
[0003] Currently, in existing technologies, when using a kernel-based Virtual Machine (KVM) client to mount files, the KVM client only parses the disk image when the folder mount is disconnected. It compares all files in the image with the mounted folder, and if there are differences, the modifications in the image files are synchronized to the mounted folder. In this method, updating the folder requires disconnecting the mount, making it impossible to synchronize modifications to the folder without disconnecting the mount connection, thus reducing update efficiency.
[0004] Therefore, there is an urgent need for a synchronous update method for folder mounting that can achieve synchronous updates of folders without breaking the mounting connection, thereby improving update efficiency. Summary of the Invention
[0005] This invention provides a method, apparatus, electronic device, and storage medium for synchronous updating of mounted folders. It addresses the shortcomings of existing technologies that cannot synchronously modify folders without breaking the mounting connection, leading to reduced update efficiency. Based on a mirror mapping structure and the construction of a temporary mirror, while ensuring the target folder's mounting connection is maintained using the temporary mirror, the mirror mapping structure is updated according to the mirror request content and mapping relationship to obtain the mirror update result. Finally, the target folder is synchronously updated based on the mirror update result, enabling synchronous updates of folders without breaking the mounting connection and improving update efficiency.
[0006] This invention provides a method for synchronously updating mounted folders, comprising the following steps.
[0007] Obtain basic file information and data request information for the target folder; the data request information is the data communication information between the target folder and the server.
[0008] A temporary image and an image mapping structure are constructed based on the basic file information; the image mapping structure is used to establish a mapping relationship between the target folder and the temporary image.
[0009] Based on the data request information and the temporary image, determine the image request content, and mount the target folder on the temporary image based on the image request content.
[0010] While maintaining the mount connection to the target folder, update the image mapping structure based on the image request content and mapping relationship, and obtain the image update result.
[0011] The target folder is updated synchronously based on the mirror update results.
[0012] According to the present invention, a method for synchronously updating a mounted folder includes the following basic file information: cluster list information, file node pointers, file type, file name, file parent node pointer, and file information linked list node pointers; the mirror mapping structure includes a file location table and a directory tree; and the method for constructing the mirror mapping structure based on the basic file information includes: constructing a file location table based on the cluster list information and file node pointers; wherein the file location table is a linked list structure used to locate the mirror request content of a temporary mirror to a specific directory in the mounted target folder; and constructing a directory tree based on the file type, file name, file parent node pointer, and file information linked list node pointers; wherein the directory tree is used to store the directory structure and file path of the mounted target folder.
[0013] According to a folder mounting synchronization update method provided by the present invention, the mirror request content includes a first mirror request content and a second mirror request content. The first mirror request content is the content for updating the file location table, and the second mirror request content is the content for updating the directory tree. Determining the mirror request content based on data request information and a temporary mirror includes: determining the address area of the data request information; if the address area of the data request information is located in the file allocation table of the temporary mirror, determining that the storage distribution in the temporary mirror has been updated, and determining the first mirror request content based on the update of the storage distribution; if the address area of the mirror request content is located in the data area of the temporary mirror, determining that the file directory in the temporary mirror has been changed, and determining the second mirror request content based on the change of the file directory.
[0014] According to the present invention, a method for synchronously updating a folder mounting, when the mirror request content is the first mirror request content, updates the mirror mapping structure according to the mirror request content and the mapping relationship, and obtains the mirror update result, including: obtaining an initial cluster list and an initial storage list; wherein, the initial cluster list is a list concatenated with all valid members in the file location table, and the initial storage list is a list that uniformly stores all invalid members in the file location table; traversing the remaining members in the file location table of the mirror mapping structure according to the mirror request content and the mapping relationship, determining the tail information of the cluster list information corresponding to the current node of the remaining members and the head information of the initial cluster list. If there is no overlap between the information at the end of the table and the information at the beginning of the table, match the cluster list members in the cluster list information corresponding to the current node with the invalid members in the initial storage list, determine the successfully matched members, and delete the successfully matched members in both the cluster list information and the initial storage list. Then, determine whether the remaining members in the file location table have been traversed. If the remaining members in the file location table have been traversed, determine that the mirror mapping structure update is complete and obtain the request parsing result. If the remaining members in the file location table have not been traversed, continue to return to execute the step of traversing the remaining members in the file location table according to the mirror request content.
[0015] According to the present invention, a method for synchronously updating a folder mounting system further includes: when there is overlap between the table tail information and the table header information, deleting the corresponding cluster list in the initial cluster list after splicing the cluster list information and the initial cluster list, and continuing to perform the step of matching the cluster list members in the cluster list information corresponding to the current node with the invalid members in the initial storage list to determine the successfully matched members.
[0016] According to a folder mounting synchronization update method provided by the present invention, when the mirror request content is the second mirror request content, the mirror mapping structure is updated according to the mirror request content and the mapping relationship, and the mirror update result is obtained, including:
[0017] Based on the content of the image request, traverse the remaining members in the file location table to determine the cluster list information corresponding to the current node of the remaining members;
[0018] Based on the cluster list information, determine the address segment of the current node in the temporary image; if the address region is not within the address segment, return to the step of traversing the remaining members in the file location table according to the image request content to determine the cluster list information corresponding to the current node of the remaining members; if the address region is within the address segment, locate the corresponding directory tree node according to the node pointer of the directory tree; if the node type of the directory tree node is directory, read the directory entries in the data area to determine if there is a corresponding directory tree node in the directory entries; if there is a corresponding directory tree node in the directory entries, determine if the directory entries in the data area have been read completely; if the directory entries in the data area have been read completely, determine that the image mapping structure update is complete and obtain the request parsing result; if the directory entries in the data area have not been read completely, continue to return to the step of reading the directory entries in the data area and determining if there is a corresponding directory tree node in the directory entries.
[0019] According to the synchronous update method for folder mounting provided by the present invention, the method further includes: when the node type of the directory tree node is not a directory, after determining the offset address of the data request information in the target folder based on the request start address of the data request information and the cluster list header, the method continues to execute the step of determining whether the directory entries of the data area have been read; when the directory entries of the data area have been read, the method determines that the mirror mapping structure update is complete, and obtains the request parsing result based on the file path and offset address.
[0020] The present invention also provides a folder mounting synchronization update device, comprising the following modules.
[0021] The information acquisition module is used to acquire basic file information and data request information of the target folder; among which, the data request information is the data communication information between the server and the target folder.
[0022] The image building module is used to build temporary images and image mapping structures based on basic file information; the image mapping structure is used to establish a mapping relationship between the target folder and the temporary image.
[0023] The file mounting module is used to determine the image request content based on the data request information and the temporary image, and to mount the target folder on the temporary image based on the image request content.
[0024] The structure update module is used to update the image mapping structure based on the image request content and mapping relationship while maintaining the mount connection of the target folder, and obtain the image update result.
[0025] The file update module is used to synchronously update the target folder based on the mirror update results.
[0026] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the computer program to implement a synchronous update method for folder mounting as described above.
[0027] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a synchronous update method for folder mounting as described above.
[0028] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements a synchronous update method for folder mounting as described above.
[0029] This invention provides a method, apparatus, electronic device, and storage medium for synchronous updating of mounted folders. The method involves acquiring basic file information and data request information of a target folder; wherein the data request information is data communication information with a server; constructing a temporary image and a mirror mapping structure based on the basic file information; wherein the mirror mapping structure is used to establish a mapping relationship between the target folder and the temporary image; determining the mirror request content based on the data request information and the temporary image, and mounting the target folder on the temporary image based on the mirror request content; updating the mirror mapping structure based on the mirror request content and the mapping relationship while maintaining the mounting connection of the target folder, and obtaining the mirror update result; and synchronously updating the target folder based on the mirror update result. The technical solution of this invention addresses the shortcomings of existing technologies that cannot synchronously modify folders without breaking the mount connection, resulting in reduced update efficiency. Based on the construction of a mirror mapping structure and a temporary mirror, while ensuring the target folder's mount connection is maintained by the temporary mirror, the mirror mapping structure is updated according to the mirror request content and mapping relationship to obtain the mirror update result. Finally, the target folder is synchronously updated based on the mirror update result, thus enabling synchronous updates of folders without breaking the mount connection and improving update efficiency. Attached Figure Description
[0030] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0031] Figure 1 This is a flowchart illustrating the synchronous update method for folder mounting provided by the present invention.
[0032] Figure 2This is a schematic diagram of the file location table provided by the present invention.
[0033] Figure 3 This is a schematic diagram of the directory tree provided by the present invention.
[0034] Figure 4 This is one of the schematic diagrams illustrating the processing of mirror request content provided by the present invention.
[0035] Figure 5 This is the second schematic diagram of the processing of mirror request content provided by the present invention.
[0036] Figure 6 This is a schematic diagram of the folder mounting and synchronization update device provided by the present invention.
[0037] Figure 7 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0038] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0039] The following is combined Figures 1-5 The present invention describes a method for synchronous updating of mounted folders. This method is applicable to real-time synchronous updates in the case of mounted folders. The execution subject of this method can be an electronic device or a synchronous updating device for mounted folders installed in the electronic device. The synchronous updating device for mounted folders can be implemented by software, hardware, or a combination of both. Figure 1 This is a flowchart illustrating the folder mounting and synchronization update method provided by the present invention, as shown below. Figure 1 As shown, the method includes the following steps 101, 102, 103, 104 and 105.
[0040] Step 101: Obtain basic file information and data request information for the target folder.
[0041] In this step, the target folder refers to the folder where the files need to be updated. The basic file information includes cluster list information, file node pointers, file type, file name, file parent node pointers, and file information linked list node pointers. The data request information is the data communication information between the server and the client.
[0042] The cluster list information stores the set of clusters occupied by the target folder in the temporary image. The cluster list is formed when a file's data size exceeds the capacity of a cluster; it is then allocated and recorded in the next cluster to continue storing data, thus forming a cluster chain. The cluster list information stores these clusters in a one-dimensional array according to their order. File node pointers point to nodes in the directory tree that describe the same file. File parent node pointers point to parent nodes, i.e., parent directory nodes. The root node stores the mounted target folder itself; its parent directory is not relevant to the folder mounting function, so this member is empty for the root node. For each node in the directory tree, a linked list can be formed using the parent node pointer, with itself as the head and the root node as the tail. Concatenating the names of the members in this linked list in order yields the path of the corresponding child node in the mounted target folder. File information linked list node pointers point to nodes in the file location table that describe the same file.
[0043] Specifically, it obtains cluster list information, file node pointers, file types, file names, file parent node pointers, and file information linked list node pointers of the target folder, and obtains data request information, i.e., communication information with the server, through communication with the server data.
[0044] Step 102: Construct a temporary image and image mapping structure based on the basic file information.
[0045] In this step, the mirror mapping structure is used to establish a mapping relationship between the target folder and the temporary image.
[0046] In one specific implementation, the mirror mapping structure includes a file location table and a directory tree. A specific implementation of constructing the mirror mapping structure based on basic file information includes: constructing a file location table based on cluster list information and file node pointers; wherein the file location table is a linked list structure used to locate the mirror request content of the temporary mirror to a specific directory within the mounted target folder; constructing a directory tree based on file type, file name, file parent node pointer, and file information linked list node pointers; wherein the directory tree is used to store the directory structure and file paths of the mounted target folder.
[0047] In this step, the file location table is a linked list structure that stores the cluster distribution information of all files in the mounted target folder within the temporary image. Each node in the linked list corresponds one-to-one with a file in the mounted target folder. The file location table is used to direct write requests from the temporary image to a specific file / directory within the mounted folder. Each node has the following members: cluster list information and a file node pointer. The directory tree stores the directory structure and path of the mounted target folder. Its tree structure reflects the directory structure of the files in the mounted target folder. Each node in the tree corresponds one-to-one with a file in the mounted folder. Each node has the following members: file type, file name, file parent node pointer, and file information linked list node pointer.
[0048] Specifically, a file location table is constructed based on the cluster list information and file node pointers; the file location table is a linked list structure used to locate the image request content of the temporary image to a specific directory in the mounted target folder; a directory tree is constructed based on the file type, file name, file parent node pointer, and file information linked list node pointers; the directory tree is used to store the directory structure and file path of the mounted target folder.
[0049] For example, Figure 2 This is a schematic diagram of the file location table provided by the present invention, such as... Figure 2 As shown, any node in the file location table consists of cluster list information and a file node pointer; Figure 3 This is a schematic diagram of the directory tree provided by the present invention, such as... Figure 3 As shown, any node in the directory tree is constructed from the file type, file name, pointer to the file's parent node, and pointers to the linked list nodes of the file information.
[0050] The advantage of this setup is that by adding a parent node pointer to the file in the directory tree, each node only stores its own name, allowing for quick retrieval of its own path. This avoids storing path information in each node, reducing the directory tree's storage space. Furthermore, by constructing a mirror mapping structure using the directory tree and file location table, the cooperation between the directory tree and the file location table can efficiently transform the mirror request content in the temporary image.
[0051] Step 103: Determine the image request content based on the data request information and the temporary image, and mount the target folder on the temporary image based on the image request content.
[0052] Specifically, after obtaining the data request information, the image request content is read and written to the temporary image based on the data request information, the data request is responded to, the image request content is determined based on the response, and the target folder is mounted on the temporary image based on the image request content, thus completing the basic function of mounting the target folder.
[0053] In one specific implementation, the method for determining the image request content based on the data request information and the temporary image includes: determining the address area of the data request information; if the address area of the data request information is located in the file allocation table of the temporary image, determining that the storage distribution in the temporary image has been updated, and determining the first image request content based on the update of the storage distribution; if the address area of the image request content is located in the data area of the temporary image, determining that the file directory in the temporary image has been changed, and determining the second image request content based on the change of the file directory.
[0054] In this step, the mirror request content includes a first mirror request content and a second mirror request content. The first mirror request content is the content for updating the file location table, and the second mirror request content is the content for updating the directory tree.
[0055] Specifically, when data request information is obtained, the address range of the data request information is determined, and it is determined which area of the temporary image the data request information is located in. If the address range of the data request information is located in the file allocation table of the temporary image, it is determined that the storage distribution in the temporary image has been updated, and the first image request content is determined based on the update of the storage distribution. The first image request content is the content that updates the file location table. If the address range of the image request content is located in the data area of the temporary image, it is determined that the file directory in the temporary image has been changed, and the second image request content is determined based on the change of the file directory. The second image request content is the content that updates the directory tree.
[0056] Step 104: While maintaining the mount connection to the target folder, update the image mapping structure according to the image request content and mapping relationship, and obtain the image update result.
[0057] In one specific implementation, when the mirror request content is the first mirror request content, the specific implementation of updating the mirror mapping structure according to the mirror request content and mapping relationship, and obtaining the mirror update result includes: obtaining an initial cluster list and an initial storage list; wherein, the initial cluster list is a list concatenated with all valid members in the file location table, and the initial storage list is a list that uniformly stores all invalid members in the file location table; traversing the remaining members in the file location table of the mirror mapping structure according to the mirror request content and mapping relationship, determining whether the tail information of the cluster list information corresponding to the current node of the remaining member overlaps with the head information of the initial cluster list; if the tail information and the head information do not overlap, matching the cluster list members in the cluster list information corresponding to the current node with the invalid members in the initial storage list, determining the successfully matched members, and deleting the successfully matched members in both the cluster list information and the initial storage list, and then determining whether the traversal of the remaining members in the file location table has ended; if the traversal of the remaining members in the file location table has ended, determining that the mirror mapping structure update is complete, and obtaining the request parsing result; if the traversal of the remaining members in the file location table has not ended, continuing to execute the step of traversing the remaining members in the file location table according to the mirror request content.
[0058] In one specific implementation, the method further includes: if there is overlap between the table tail information and the table head information, after splicing the cluster list information and the initial cluster list, deleting the corresponding cluster list in the initial cluster list, and continuing to perform the step of matching the cluster list members in the cluster list information corresponding to the current node with the invalid members in the initial storage list to determine the successfully matched members.
[0059] Specifically, Figure 4 This is one of the schematic diagrams illustrating the processing of mirror request content provided by the present invention, such as... Figure 4 As shown, the processing procedure includes the following steps.
[0060] Step 401: Obtain the initial cluster list and the initial storage list.
[0061] The initial cluster list is a list concatenated with all valid members in the file location table, and the initial storage list is a list that stores all invalid members in the file location table.
[0062] Specifically, the mirror request content is preprocessed to obtain an initial cluster list that concatenates all valid members in the file location table and an initial storage list that stores all invalid members in the file location table.
[0063] Step 402: Traverse the remaining members in the file location table.
[0064] Specifically, the remaining members of the file location table in the image mapping structure are traversed based on the image request content and mapping relationship.
[0065] Step 403: Determine whether the tail information of the cluster list information corresponding to the current node of the remaining members overlaps with the head information of the initial cluster list.
[0066] Specifically, determine whether the tail information of the cluster list corresponding to the current node of the remaining members overlaps with the head information of the initial cluster list. If the tail information and the head information overlap, proceed to step 404; if the tail information and the head information do not overlap, proceed to step 405.
[0067] Step 404: After splicing the cluster list information and the initial cluster list, delete the corresponding cluster list in the initial cluster list.
[0068] Specifically, if there is overlap between the table tail information and the table header information, the cluster list information and the initial cluster list are concatenated. After concatenating the cluster list information and the initial cluster list, the corresponding cluster list in the initial cluster list is deleted. After deleting the corresponding cluster list in the initial cluster list, step 405 is executed.
[0069] Then continue to perform the step of matching the cluster list members in the cluster list information corresponding to the current node with the invalid members in the initial storage list to determine the successfully matched members.
[0070] Step 405: Match the cluster list members in the cluster list information corresponding to the current node with the invalid members in the initial storage list to determine the successfully matched members.
[0071] Specifically, if there is no overlap between the table tail information and the table head information, after determining the successfully matched member, delete the successfully matched member in both the cluster list information and the initial storage list, and then continue to execute step 406.
[0072] Step 406: Determine whether the remaining members in the file location table have been traversed.
[0073] Specifically, if the traversal of the remaining members in the file location table is complete, the mirror mapping structure update is confirmed, and the request parsing result is obtained. If the traversal of the remaining members in the file location table is not complete, the process returns to step 402, which involves traversing the remaining members in the file location table based on the mirror request content.
[0074] Step 407: Obtain the image update result.
[0075] Specifically, once the remaining members in the file location table have been traversed, the mirror mapping structure update is confirmed, and the request parsing result is obtained.
[0076] In one specific implementation, when the mirror request content is the second mirror request content, the specific implementation of updating the mirror mapping structure according to the mirror request content and mapping relationship, and obtaining the mirror update result includes: traversing the remaining members in the file location table according to the mirror request content, and determining the cluster list information corresponding to the current node of the remaining members; determining the address segment of the current node in the temporary mirror according to the cluster list information; if the address region is not located within the address segment, returning to the step of traversing the remaining members in the file location table according to the mirror request content and determining the cluster list information corresponding to the current node of the remaining members; if the address region is located within the address segment, locating the corresponding directory tree node according to the node pointer of the directory tree; if the node type of the directory tree node is a directory, reading the directory entries in the data area, and determining whether there is a corresponding directory tree node in the directory entries; if there is a corresponding directory tree node in the directory entries, determining whether the directory entries in the data area have been read completely; if the directory entries in the data area have been read completely, determining that the mirror mapping structure update is complete and obtaining the request parsing result; if the directory entries in the data area have not been read completely, continuing to return to the step of reading the directory entries in the data area and determining whether there is a corresponding directory tree node in the directory entries.
[0077] In one specific implementation, the method further includes: if the node type of the directory tree node is not a directory, after determining the offset address of the data request information in the target folder based on the request start address of the data request information and the cluster list header, continuing to execute the step of determining whether the directory entries of the data area have been read; if the directory entries of the data area have been read, determining that the mirror mapping structure has been updated, and obtaining the request parsing result based on the file path and offset address.
[0078] Specifically, Figure 5 This is the second schematic diagram of the processing of mirror request content provided by the present invention, as shown below. Figure 5 As shown, the processing procedure includes the following steps.
[0079] Step 501: Traverse the remaining members in the file location table according to the image request content to determine the cluster list information corresponding to the current node of the remaining members.
[0080] Step 502: Determine the address segment of the current node in the temporary image based on the cluster list information.
[0081] Step 503: Determine whether the address region is located within an address segment.
[0082] Specifically, determine whether the address region is within an address segment. If the address region is not within an address segment, return to step 502 to determine the address segment of the current node in the temporary image based on the cluster list information. If the address region is within an address segment, proceed to step 504.
[0083] Step 504: Locate the corresponding directory tree node based on the node pointer of the directory tree.
[0084] Specifically, when the address region is located within an address segment, the corresponding directory tree node is located based on the node pointer of the directory tree.
[0085] Step 505: Determine whether the node type of the directory tree node is a directory.
[0086] Specifically, determine whether the node type of the directory tree node is a directory. If the node type of the directory tree node is determined to be a directory, proceed to step 506; if the node type of the directory tree node is determined not to be a directory, proceed to step 507.
[0087] Step 506: Read the directory entries in the data area.
[0088] Specifically, the directory entries in the data area are read, the directory entries are compared with the child nodes corresponding to the directory tree nodes, and then step 508 is executed.
[0089] Step 507: Determine the offset address of the data request information in the target folder based on the request start address and cluster list header of the data request information.
[0090] Specifically, if it is determined that the node type of the directory tree node is not a directory, the offset address of the data request information in the target folder is determined based on the request start address of the data request information and the cluster list header, and step 514 is executed to determine whether the data area has been read.
[0091] Step 508: Determine whether the directory entry has been marked for deletion.
[0092] Specifically, the directory entry is compared with the corresponding child nodes of the directory tree node to determine whether the directory entry has been marked for deletion. If the directory entry has not been marked for deletion, proceed to step 510. If the directory entry has been marked for deletion, proceed to step 509.
[0093] Step 509: Delete the file.
[0094] Specifically, if the directory entry file name is consistent with the directory tree node, the directory entry is marked for deletion. At this time, the file of the node corresponding to the directory entry is deleted. The file is deleted according to the node path and deletion operation. The tree rooted at the current directory tree node and the node corresponding to the node in the tree in the linked list are further deleted. Then, step 514 is executed to determine whether the data area has been read.
[0095] Step 510: Determine whether the directory entry file name matches the directory tree node.
[0096] Specifically, determine whether the directory entry file name of the directory entry is consistent with the directory tree node. If the directory entry file name is consistent with the directory tree node, continue to step 512; if the directory entry file name is inconsistent with the directory tree node, continue to step 511.
[0097] Step 511: Rename the file.
[0098] Specifically, if the filename of the directory entry is inconsistent with the directory tree node, the file corresponding to the directory tree node needs to be renamed. That is, the node name of the directory tree node is updated to the new name according to the current node path and the new name, and then step 514 is executed to determine whether the data area has been read.
[0099] Step 512: Determine if the directory item does not have a corresponding directory tree node.
[0100] Specifically, determine whether the directory item has no corresponding directory tree node. If it is determined that the directory item has no corresponding directory tree node, continue to step 513; if it is determined that the directory item has a corresponding directory tree node, continue to step 514.
[0101] Step 513: Create a new file.
[0102] Specifically, if it is determined that there is a corresponding directory tree node for the directory entry, a new file is created, a new directory tree node is created with the file name in the directory entry, a corresponding node is created in the linked list, one member of the cluster list information is the starting cluster number in the directory entry, and after the new file is created, step 514 is executed to determine whether the data area has been read.
[0103] Step 514: Determine whether the data area has been completely read.
[0104] Specifically, if it is determined that the data area has been completely read, proceed to step 515; if it is determined that the data area has not been completely read, return to step 506 to read the directory entries of the data area.
[0105] Step 515: Confirm that the mirror mapping structure update is complete and obtain the request parsing result.
[0106] Specifically, once the data area has been read completely, the mirror mapping structure update is complete, and the request parsing result is obtained.
[0107] Step 105: Synchronize and update the target folder based on the mirror update results.
[0108] Specifically, after obtaining the image update result, the image update result includes the path of the target operation in the mounted target folder, the operation type, and the file modification data. The operation type can be, for example, creating a new file, modifying the file content, modifying the file name, or deleting a file. The file modification data can be, for example, the corresponding file member in the target folder is empty for creating a new file or deleting a file, the content of the corresponding file member in the target folder is the modified content for modifying the file content, and the name of the corresponding file member in the target folder is the modified name for modifying the file name. Based on the path of the target operation in the mounted target folder, the operation type, and the file modification data contained in the image update result, the target folder is synchronously updated.
[0109] This invention provides a method for synchronously updating mounted folders. The method involves obtaining basic file information and data request information of the target folder; the data request information is data communication information with the server; constructing a temporary mirror and a mirror mapping structure based on the basic file information; the mirror mapping structure establishing a mapping relationship between the target folder and the temporary mirror; determining the mirror request content based on the data request information and the temporary mirror, and mounting the target folder on the temporary mirror based on the mirror request content; updating the mirror mapping structure based on the mirror request content and the mapping relationship while maintaining the mounting connection of the target folder, and obtaining the mirror update result; and synchronously updating the target folder based on the mirror update result. Based on the above embodiments, the technical solution of this invention addresses the deficiency in existing technologies where synchronous modification of folders cannot be achieved without breaking the mounting connection, resulting in reduced update efficiency. By constructing a mirror mapping structure and a temporary mirror, and maintaining the target folder's mounting connection based on the temporary mirror, updating the mirror mapping structure based on the mirror request content and the mapping relationship, and obtaining the mirror update result, and finally synchronously updating the target folder based on the mirror update result, this method achieves synchronous updates of folders without breaking the mounting connection, thus improving update efficiency.
[0110] The following describes the folder mounting synchronization update device provided by the present invention. The folder mounting synchronization update device described below and the folder mounting synchronization update method described above can be referred to in correspondence.
[0111] Figure 6 This is a schematic diagram of the folder mounting synchronization update device provided by the present invention, with reference to... Figure 6 As shown, the folder mounting synchronization update device 600 includes: an information acquisition module 601, an image building module 602, a file mounting module 603, a structure update module 604, and a file update module 605.
[0112] The information acquisition module 601 is used to acquire basic file information and data request information of the target folder; among which, the data request information is data communication information with the server;
[0113] The image building module 602 is used to build a temporary image and an image mapping structure based on the basic file information; wherein, the image mapping structure is used to establish a mapping relationship between the target folder and the temporary image.
[0114] The file mounting module 603 is used to determine the image request content based on the data request information and the temporary image, and to mount the target folder on the temporary image based on the image request content.
[0115] The structure update module 603 is used to update the image mapping structure according to the image request content and mapping relationship while maintaining the mount connection of the target folder, and obtain the image update result;
[0116] File update module 604 is used to synchronously update the target folder based on the mirror update results.
[0117] In one example embodiment, the basic file information includes cluster list information, file node pointers, file type, file name, file parent node pointers, and file information linked list node pointers; the mirror mapping structure includes a file location table and a directory tree.
[0118] In one example embodiment, the image building module 602 constructs an image mapping structure based on basic file information, specifically for: constructing a file location table based on cluster list information and file node pointers; wherein, the file location table is a linked list structure used to locate the image request content of the temporary image to a specific directory in the mounted target folder; constructing a directory tree based on file type, file name, file parent node pointer, and file information linked list node pointers; wherein, the directory tree is used to store the directory structure and file path of the mounted target folder.
[0119] In one example embodiment, the mirror request content includes a first mirror request content and a second mirror request content. The first mirror request content is content that updates the file location table, and the second mirror request content is content that updates the directory tree.
[0120] In one example embodiment, the image building module 602 determines the image request content based on the data request information and the temporary image. Specifically, it is used to: determine the address area of the data request information; if the address area of the data request information is located in the file allocation table of the temporary image, determine that the storage distribution in the temporary image has been updated, and determine the first image request content based on the update of the storage distribution; if the address area of the image request content is located in the data area of the temporary image, determine that the file directory in the temporary image has been changed, and determine the second image request content based on the change of the file directory.
[0121] In one example embodiment, the structure update module 603, when the mirror request content is the first mirror request content, updates the mirror mapping structure according to the mirror request content and the mapping relationship, and obtains the mirror update result. Specifically, it is used to: obtain an initial cluster list and an initial storage list; wherein, the initial cluster list is a list concatenated with all valid members in the file location table, and the initial storage list is a list that uniformly stores all invalid members in the file location table; traverse the remaining members in the file location table of the mirror mapping structure according to the mirror request content and the mapping relationship, and determine the tail information of the cluster list information corresponding to the current node of the remaining members and the head information of the initial cluster list. If there is no overlap between the table header and tail information, match the cluster list members in the cluster list information corresponding to the current node with the invalid members in the initial storage list, determine the successfully matched members, and delete the successfully matched members in both the cluster list information and the initial storage list. Then, determine whether the remaining members in the file location table have been traversed. If the remaining members in the file location table have been traversed, determine that the mirror mapping structure update is complete and obtain the request parsing result. If the remaining members in the file location table have not been traversed, continue to return to execute the step of traversing the remaining members in the file location table according to the mirror request content.
[0122] In one example embodiment, the structure update module 603, when the mirror request content is the first mirror request content, updates the mirror mapping structure according to the mirror request content and mapping relationship, and obtains the mirror update result. It is also used to: in the case that the table tail information and table head information overlap, delete the corresponding cluster list in the initial cluster list after splicing the cluster list information and the initial cluster list, and continue to perform the step of matching the cluster list members in the cluster list information corresponding to the current node with the invalid members in the initial storage list to determine the successfully matched members.
[0123] In one example embodiment, the structure update module 603, when the image request content is the second image request content, updates the image mapping structure according to the image request content and the mapping relationship, and obtains the image update result. Specifically, it is used for: traversing the remaining members in the file location table according to the image request content, determining the cluster list information corresponding to the current node of the remaining members; determining the address segment of the current node in the temporary image according to the cluster list information; if the address region is not located within the address segment, returning to the step of traversing the remaining members in the file location table according to the image request content and determining the cluster list information corresponding to the current node of the remaining members; if the address region is located within the address segment, locating the corresponding directory tree node according to the node pointer of the directory tree; if the node type of the directory tree node is a directory, reading the directory entries in the data area, determining whether there is a corresponding directory tree node in the directory entries; if there is a corresponding directory tree node in the directory entries, determining whether the directory entries in the data area have been read completely; if the directory entries in the data area have been read completely, determining that the image mapping structure update is complete and obtaining the request parsing result; if the directory entries in the data area have not been read completely, continuing to return to the step of reading the directory entries in the data area and determining whether there is a corresponding directory tree node in the directory entries.
[0124] In one example embodiment, the structure update module 603, when the mirror request content is the second mirror request content, updates the mirror mapping structure according to the mirror request content and mapping relationship, and obtains the mirror update result. It is also used to: when the node type of the directory tree node is not a directory, after determining the offset address of the data request information in the target folder according to the request start address of the data request information and the cluster list header, continue to execute the step of determining whether the directory entries of the data area have been read; when the directory entries of the data area have been read, determine that the mirror mapping structure update is complete, and obtain the request parsing result according to the file path and offset address.
[0125] The apparatus of this embodiment can be used to execute the method of any embodiment of the folder mounting synchronization update method side embodiment. Its specific implementation process and technical effects are similar to those of the folder mounting synchronization update method side embodiment. For details, please refer to the detailed description in the folder mounting synchronization update method side embodiment, which will not be repeated here.
[0126] Figure 7 This is a schematic diagram of the structure of the electronic device provided by the present invention, such as... Figure 7As shown, the electronic device may include a processor 710, a communications interface 720, a memory 730, and a communication bus 740, wherein the processor 710, communications interface 720, and memory 730 communicate with each other via the communication bus 740. The processor 710 can call logical instructions in the memory 730 to execute a folder mounting synchronization update method. This method includes: obtaining basic file information and data request information of the target folder; wherein the data request information is data communication information with the server; constructing a temporary image and a image mapping structure based on the basic file information; wherein the image mapping structure is used to establish a mapping relationship between the target folder and the temporary image; determining the image request content based on the data request information and the temporary image, and mounting the target folder on the temporary image based on the image request content; while the target folder remains mounted, updating the image mapping structure based on the image request content and the mapping relationship, and obtaining the image update result; and synchronously updating the target folder based on the image update result.
[0127] Furthermore, the logical instructions in the aforementioned memory 730 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0128] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the folder mounting synchronization update method provided by the above methods. The method includes: obtaining basic file information and data request information of the target folder; wherein, the data request information is data communication information between the target folder and the server; constructing a temporary image and a mirror mapping structure based on the basic file information; wherein, the mirror mapping structure is used to establish a mapping relationship between the target folder and the temporary image; determining the mirror request content based on the data request information and the temporary image, and mounting the target folder on the temporary image based on the mirror request content; updating the mirror mapping structure based on the mirror request content and the mapping relationship while the target folder remains mounted, and obtaining the mirror update result; and synchronously updating the target folder based on the mirror update result.
[0129] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements a synchronous update method for folder mounting provided by the above methods. The method includes: obtaining basic file information and data request information of a target folder; wherein the data request information is data communication information between a server and the target folder; constructing a temporary image and a mirror mapping structure based on the basic file information; wherein the mirror mapping structure is used to establish a mapping relationship between the target folder and the temporary image; determining the mirror request content based on the data request information and the temporary image, and mounting the target folder on the temporary image based on the mirror request content; updating the mirror mapping structure based on the mirror request content and the mapping relationship while the target folder remains mounted, and obtaining a mirror update result; and synchronously updating the target folder based on the mirror update result.
[0130] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0131] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0132] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for synchronous updates of mounted folders, characterized in that, include: Obtain basic file information and data request information for the target folder; wherein, the data request information is data communication information with the server; the basic file information includes cluster list information, file node pointers, file type, file name, file parent node pointers, and file information linked list node pointers; A temporary image and an image mapping structure are constructed based on the basic file information. The image mapping structure is used to establish a mapping relationship between the target folder and the temporary image. The image mapping structure includes a file location table and a directory tree. Constructing the image mapping structure based on the basic file information includes: constructing the file location table based on the cluster list information and the file node pointers; wherein the file location table is a linked list structure used to locate the image request content of the temporary image to a specific directory within the mounted target folder; constructing the directory tree based on the file type, the file name, the file parent node pointer, and the file information linked list node pointers; wherein the directory tree is used to store the directory structure and file paths of the mounted target folder. The image request content is determined based on the data request information and the temporary image, and the target folder is mounted on the temporary image based on the image request content. The image request content includes a first image request content and a second image request content. The first image request content updates the file location table, and the second image request content updates the directory tree. Determining the image request content based on the data request information and the temporary image includes: determining the address range of the data request information; if the address range of the data request information is located in the file allocation table of the temporary image, determining that the storage distribution in the temporary image has been updated, and determining the first image request content based on the updated storage distribution; if the address range of the image request content is located in the data area of the temporary image, determining that the file directory in the temporary image has been changed, and determining the second image request content based on the changed file directory. While maintaining the mount connection of the target folder, the image mapping structure is updated according to the image request content and the mapping relationship, and the image update result is obtained; The target folder is synchronously updated based on the mirror update results.
2. The method for synchronously updating a folder mount according to claim 1, characterized in that, When the image request content is the first image request content, updating the image mapping structure according to the image request content and the mapping relationship, and obtaining the image update result, includes: Obtain an initial cluster list and an initial storage list; wherein, the initial cluster list is a list obtained by concatenating all valid members of the file location table, and the initial storage list is a list in which all invalid members of the file location table are stored uniformly; Based on the image request content and the mapping relationship, traverse the remaining members in the file location table of the image mapping structure to determine whether the tail information of the cluster list information corresponding to the current node of the remaining member overlaps with the head information of the initial cluster list; If the table tail information and the table head information do not overlap, the cluster list members in the cluster list information corresponding to the current node are matched with the invalid members in the initial storage list to determine the successfully matched members. After deleting the successfully matched members in both the cluster list information and the initial storage list, it is determined whether the remaining members in the file location table have been traversed. If the traversal of the remaining members in the file location table is completed, it is determined that the mirror mapping structure update is complete, and the request parsing result is obtained; If the remaining members in the file location table have not been traversed, continue to execute the step of traversing the remaining members in the file location table according to the image request content.
3. The method for synchronously updating a folder mount according to claim 2, characterized in that, Also includes: If the table tail information and the table header information overlap, after concatenating the cluster list information and the initial cluster list, delete the corresponding cluster list in the initial cluster list, and continue to perform the step of matching the cluster list members in the cluster list information corresponding to the current node with the invalid members in the initial storage list to determine the successfully matched members.
4. The method for synchronously updating a folder mount according to claim 1, characterized in that, When the image request content is the second image request content, updating the image mapping structure according to the image request content and the mapping relationship, and obtaining the image update result, includes: Based on the image request content, traverse the remaining members in the file location table to determine the cluster list information corresponding to the current node of the remaining members; The address segment of the current node in the temporary image is determined based on the cluster list information; If the address region is not located within the address segment, return to the step of traversing the remaining members in the file location table according to the image request content and determining the cluster list information corresponding to the current node of the remaining members; When the address region is located within the address segment, the corresponding directory tree node is located according to the node pointer of the directory tree; If the node type of the directory tree node is a directory, read the directory entries in the data area and determine whether there is a corresponding directory tree node in the directory entries; If a corresponding directory tree node exists in the directory entry, determine whether the directory entry of the data area has been completely read; Once the directory entries in the data area have been read, it is determined that the mirror mapping structure update is complete, and the request parsing result is obtained; If the directory entries in the data area have not been completely read, continue to execute the step of reading the directory entries in the data area and determining whether the corresponding directory tree node exists in the directory entries.
5. The method for synchronously updating a folder mount according to claim 4, characterized in that, Also includes: If the node type of the directory tree node is not a directory, after determining the offset address of the data request information in the target folder based on the request start address of the data request information and the cluster list header, continue to execute the step of determining whether the directory entries of the data area have been read. Once the directory entries in the data area have been read, it is determined that the mirror mapping structure update is complete, and the request parsing result is obtained based on the file path and the offset address.
6. A folder mounting synchronization and update device, characterized in that, include: The information acquisition module is used to acquire basic file information and data request information of the target folder; wherein, the data request information is data communication information with the server; the basic file information includes cluster list information, file node pointer, file type, file name, file parent node pointer, and file information linked list node pointer; An image building module is used to construct a temporary image and an image mapping structure based on the basic file information. The image mapping structure is used to establish a mapping relationship between the target folder and the temporary image. The image mapping structure includes a file location table and a directory tree. Constructing the image mapping structure based on the basic file information includes: constructing the file location table based on the cluster list information and the file node pointers; wherein the file location table is a linked list structure used to locate the image request content of the temporary image to a specific directory within the mounted target folder; constructing the directory tree based on the file type, the file name, the file parent node pointer, and the file information linked list node pointers; wherein the directory tree is used to store the directory structure and file paths of the mounted target folder. The file mounting module is used to determine the image request content based on the data request information and the temporary image, and to mount the target folder on the temporary image based on the image request content; wherein, the image request content includes a first image request content and a second image request content, the first image request content being the content that updates the file location table, and the second image request content being the content that updates the directory tree; determining the image request content based on the data request information and the temporary image includes: determining the address area of the data request information; if the address area of the data request information is located in the file allocation table of the temporary image, determining that the storage distribution in the temporary image has been updated, and determining the first image request content based on the update of the storage distribution; if the address area of the image request content is located in the data area of the temporary image, determining that the file directory in the temporary image has been changed, and determining the second image request content based on the change of the file directory; The structure update module is used to update the image mapping structure according to the image request content and the mapping relationship while the target folder maintains the mount connection, and obtain the image update result; The file update module is used to synchronously update the target folder based on the mirror update results.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the synchronous update method for folder mounting as described in any one of claims 1 to 5.
8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the synchronous update method for folder mounting as described in any one of claims 1 to 5.
Citation Information
Patent Citations
File mounting method and device
CN117331890A
Mirror file system
US20130304705A1