Synchronous updating method and device for folder mounting, electronic equipment and storage medium
By building a mirror mapping structure and temporary mirror, the problem of synchronous modification in the existing technology cannot be performed while folders are constantly open and connected, and efficient folder updates are achieved.
Patent Information
- Application Number
- CN202411325211.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-23
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2044-09-23
AI Technical Summary
The prior art cannot synchronously modify the folders when the folders are constantly open to mount and connect, resulting in a reduced update efficiency.
By building a mirror mapping structure and temporary mirror, when ensuring the target folder mount connection based on temporary mirrors, the mirror mapping structure is updated according to the mirror request content and mapping relationship, and the mirror update result is obtained, and the target file is finally updated based on the mirror update result. The clip is synchronously updated.
It realizes synchronous update of folders when folders are continuously opened and connected, improving update efficiency.
Smart Images

Figure CN119449819A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of folder update, and in particular to a method, device, electronic device and storage medium for synchronously updating folder mounting. Background Art
[0002] With the rapid development of server technology, folder mounting technology can remotely mount the client's local folder to the server, so that the server can operate the file resources on the client in the same way as operating the local disk.
[0003] At present, in the prior art, for using a kernel-based virtual machine (KVM) client to implement file mounting, when the file needs to be updated, the KVM client will only parse the hard disk image when the folder mount is disconnected, and compare all the files in the image with the mounted folder one by one. If there is a difference, the changes in the image file will be synchronized to the mounted folder. In the above method, if the folder needs to be updated, the mount must be disconnected, and it is impossible to synchronize the folder without disconnecting the mount connection, which reduces the update efficiency.
[0004] Therefore, there is an urgent need for a synchronous update method for folder mounting, which can realize the synchronous update of folders without disconnecting the mounting connection of the folders, thereby improving the update efficiency. Summary of the invention
[0005] The present invention provides a method, device, electronic device and storage medium for synchronous updating of folder mounting, so as to solve the defect in the prior art that it is impossible to synchronously modify the folder without disconnecting the mounting connection of the folder, so that the updating efficiency is reduced. Based on the construction of the mirror mapping structure and the temporary mirror, the mirror mapping structure is updated according to the mirror request content and the mapping relationship while ensuring the mounting connection of the target folder based on the temporary mirror, and the mirror update result is obtained. Finally, the target folder is synchronously updated based on the mirror update result, so that the folder can be synchronously updated without disconnecting the mounting connection of the folder, thereby improving the updating efficiency.
[0006] The present invention provides a synchronous update method for mounting a folder, comprising the following steps.
[0007] Obtain the basic file information and data request information of the target folder; wherein the data request information is the data communication information with the server.
[0008] A temporary image and an image mapping structure are constructed according to basic file information; wherein the image mapping structure is used to establish a mapping relationship between a target folder and a temporary image.
[0009] The image request content is determined according to the data request information and the temporary image, and a folder mount connection is performed on the target folder on the temporary image based on the image request content.
[0010] When the target folder remains mounted, the image mapping structure is updated according to the image request content and the mapping relationship, and the image update result is obtained.
[0011] The target folder is updated synchronously based on the mirror update result.
[0012] According to a folder mounting synchronous update method provided by the present invention, 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; the mirror mapping structure includes a file location table and a directory tree; the mirror mapping structure is constructed according to the basic file information, including: constructing a file location table according to the cluster list information and the file node pointer; wherein the file location table is a linked list structure, which is used to locate the mirror request content of the temporary mirror to a specific directory in the mounted target folder; constructing a directory tree according to the file type, file name, file parent node pointer and file information linked list node pointer; wherein the directory tree is used to save the directory structure and file path of the mounted target folder.
[0013] According to a synchronous update method for folder mounting 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; the mirror request content is determined according to data request information and a temporary mirror, including: determining the address area of the data request information; when 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 is updated, and determining the first mirror request content according to the update of the storage distribution; when 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 is changed, and determining the second mirror request content according to the change of the file directory.
[0014] According to a synchronous update method for folder mounting provided by the present invention, when the image request content is the first image request content, the image mapping structure is updated according to the image request content and the mapping relationship, and the image update result is obtained, including: obtaining an initial cluster list and an initial storage list; wherein the initial cluster list is a list obtained by splicing all valid members in the file location table, and the initial storage list is a list in which all invalid members in the file location table are uniformly stored; according to the image request content and the mapping relationship, the remaining members in the file location table of the image mapping structure are traversed, and the tail information of the cluster list information corresponding to the current node of the remaining members and the header of the initial cluster list are determined. Whether there is overlap in information; in the case that the table tail information and the table header 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, and after deleting the successfully matched members in both the cluster list information and the initial storage list, it is determined whether the traversal of the remaining members in the file location table is completed; in the case that the traversal of the remaining members in the file location table is completed, it is determined that the update of the mirror mapping structure is completed and the request parsing result is obtained; in the case that the traversal of the remaining members in the file location table is not completed, continue to return to execute the step of traversing the remaining members in the file location table according to the mirror request content.
[0015] A synchronous update method for folder mounting provided by the present invention also includes: when there is overlap between the table footer 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 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 step of successfully matching members.
[0016] According to a folder mounting synchronous update method provided by the present invention, when the image request content is the second image request content, the image mapping structure is updated according to the image request content and the mapping relationship, and the image update result is obtained, including: According to the image request content, the remaining members in the file location table are traversed to determine the cluster list information corresponding to the current node of the remaining members; Determine the address fragment of the current node in the temporary image according to the cluster list information; if the address area is not within the address fragment, return to execute 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 area is within the address fragment, 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 a directory, read the directory entry of the data area to determine whether there is a corresponding directory tree node in the directory entry; if there is a corresponding directory tree node in the directory entry, determine whether the directory entry of the data area has been read; if the directory entry of the data area has been read, determine that the update of the image mapping structure is completed and obtain the request parsing result; if the directory entry of the data area has not been read, continue to return to execute the step of reading the directory entry of the data area to determine whether there is a corresponding directory tree node in the directory entry.
[0017] A synchronous update method for folder mounting provided in accordance with the present invention also 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 according to 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 in the data area have been read; when the directory entries in the data area have been read, determining that the update of the mirror mapping structure is completed, and obtaining the request parsing result according to the file path and the offset address.
[0018] The present invention also provides a synchronous update device for folder mounting, comprising the following modules.
[0019] The information acquisition module is used to obtain the basic file information and data request information of the target folder; wherein the data request information is the data communication information between the server and the target folder.
[0020] An image building module, used to build a temporary image and an image mapping structure according to basic file information; wherein the image mapping structure is used to establish a mapping relationship between a target folder and a temporary image; The file mounting module is used to determine the image request content according to the data request information and the temporary image, and to perform a folder mounting connection on the target folder on the temporary image based on the image request content.
[0021] 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 remains mounted and connected, and obtain the image update result.
[0022] The file update module is used to synchronously update the target folder based on the mirror update result.
[0023] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the synchronous update method of mounting a folder as described above is implemented.
[0024] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the synchronous update method of any of the above-mentioned folder mounting is implemented.
[0025] The present invention also provides a computer program product, including a computer program, which implements any of the above-mentioned folder mounting synchronous update methods when executed by a processor.
[0026] The present invention provides a folder mounting synchronous update method, device, electronic device and storage medium, which obtains basic file information and data request information of a target folder; wherein the data request information is data communication information with a server; constructs a temporary mirror and a mirror mapping structure according to the basic file information; wherein the mirror mapping structure is used to establish a mapping relationship between the target folder and the temporary mirror; determines the mirror request content according to the data request information and the temporary mirror, and mounts the target folder on the temporary mirror based on the mirror request content; updates the mirror mapping structure according to the mirror request content and the mapping relationship when the target folder remains mounted, and obtains a mirror update result; and synchronously updates the target folder based on the mirror update result. The technical solution of the present invention is used to solve the defect in the prior art that it is impossible to synchronously modify a folder without disconnecting the mounting connection of the folder, thereby reducing the update efficiency. Based on the construction of a mirror mapping structure and a temporary mirror, while ensuring the mounting connection of the target folder based on the temporary mirror, the mirror mapping structure is updated according to the mirror request content and the mapping relationship, and the mirror update result is obtained. Finally, the target folder is synchronously updated based on the mirror update result, thereby realizing that the folder can be synchronously updated without disconnecting the mounting connection of the folder, thereby improving the update efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0028] Figure 1 It is a flowchart of the synchronous update method of folder mounting provided by the present invention.
[0029] Figure 2It is a schematic diagram of the file location table provided by the present invention.
[0030] Figure 3 It is a schematic diagram of the directory tree provided by the present invention.
[0031] Figure 4 This is one of the processing schematic diagrams of the mirror request content provided by the present invention.
[0032] Figure 5 This is the second schematic diagram of processing the mirror request content provided by the present invention.
[0033] Figure 6 It is a structural schematic diagram of the synchronous update device for folder mounting provided by the present invention.
[0034] Figure 7 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0035] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0036] Combine the following Figure 1-Figure 5 The synchronous update method for mounting a folder provided by the present invention is described. The synchronous update method for mounting a folder provided by the present invention can be applicable to the real-time synchronous update situation under the folder mounting state. The execution subject of the method can be an electronic device, or it can be a synchronous update device for mounting a folder arranged in the electronic device. The synchronous update device for mounting a folder can be implemented by software, hardware or a combination of both. Figure 1 : is a flowchart of the synchronous update method of folder mounting provided by the present invention, such as Figure 1 As shown, the method includes the following steps 101, 102, 103, 104 and 105.
[0037] Step 101: Obtain basic file information and data request information of a target folder.
[0038] In this step, the target folder refers to the folder that needs to update files, and 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; data request information is data communication information with the server.
[0039] The cluster list information is used to save the set of clusters occupied by the target folder in the temporary image. The cluster list information is formed when the data size of a file exceeds the capacity of a cluster, it will be allocated and recorded to the cluster number of the next cluster to continue to store data, thus forming a cluster chain. The cluster list information is saved in a one-dimensional array in the order of the cluster chain. The file node pointer points to the node that describes the same file in the directory tree. The file parent node pointer points to the parent node, that is, the parent directory node. The root node saves the mounted target folder itself, and its parent directory is not concerned by the folder mounting function, so for the root node, this member is empty. For each node in the directory tree, the parent node pointer can be used to form a linked list with itself as the linked list head and the root node as the linked list tail. The names of the members in this linked list are spliced in order to get the path of the corresponding child node in the mounted target folder. The file information linked list node pointer points to the node that describes the same file in the file location table.
[0040] Specifically, the cluster list information, file node pointer, file type, file name, file parent node pointer and file information linked list node pointer of the target folder are obtained, and the data request information, i.e., the communication information with the server data, is obtained through communication with the server data.
[0041] Step 102: Construct a temporary image and an image mapping structure according to basic file information.
[0042] In this step, the image mapping structure is used to establish a mapping relationship between the target folder and the temporary image.
[0043] In a specific implementation, the image mapping structure includes a file location table and a directory tree; the specific implementation of constructing the image 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, which is 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 the file type, file name, file parent node pointer and file information linked list node pointer; wherein the directory tree is used to save the directory structure and file path of the mounted target folder.
[0044] In this step, the file location table is a linked list structure, which stores the cluster distribution information of all files in the mounted target folder in the temporary image. The nodes in the linked list correspond to the files in the mounted target folder one by one. The file location table is used to locate the write request of the temporary image to a specific file / directory in the mounted folder. Each node has the following members: cluster list information and file node pointer. The directory tree is used to store 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. The nodes in the tree correspond to the files in the mounted folder one by one. Each node has the following members: file type, file name, file parent node pointer and file information linked list node pointer.
[0045] Specifically, a file location table is constructed according to the cluster list information and the file node pointer; wherein the file location table is a linked list structure, which is 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 according to the file type, file name, file parent node pointer and file information linked list node pointer; wherein the directory tree is used to save the directory structure and file path of the mounted target folder.
[0046] For example, Figure 2 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 file node pointer; Figure 3 It 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 composed of a file type, a file name, a file parent node pointer, and a file information linked list node pointer to construct a directory tree.
[0047] The advantage of this setting is that the file parent node pointer is added to the directory tree, each node only stores its own name, and can quickly obtain its own path, avoiding the storage of path information in each node and reducing the storage space of the directory tree. Furthermore, the mirror mapping structure is constructed through the directory tree and the file location table. The mutual cooperation of the directory tree and the file location table can efficiently convert the mirror request content in the temporary image.
[0048] Step 103: Determine the image request content according to the data request information and the temporary image, and perform a folder mount connection on the target folder on the temporary image based on the image request content.
[0049] Specifically, after obtaining the data request information, the image request content is to read and write the temporary image based on the data request information, respond to the read data request, thereby determining the image request content based on the response, and based on the image request content, the target folder is mounted and connected on the temporary image, completing the basic function of mounting the target folder.
[0050] In a specific embodiment, the specific implementation method of determining the mirror request content based on data request information and a temporary mirror includes: determining the address area of the data request information; when 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 is updated, and determining the first mirror request content based on the update of the storage distribution; when 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 is changed, and determining the second mirror request content based on the change of the file directory.
[0051] In this step, the mirroring request content includes a first mirroring request content and a second mirroring request content, the first mirroring request content is content for updating the file location table, and the second mirroring request content is content for updating the directory tree.
[0052] Specifically, when data request information is obtained, the address area of the data request information is determined, and it is judged in which area of the temporary mirror the data request information is located. When the address area of the data request information is located in the file allocation table of the temporary mirror, it is determined that the storage distribution in the temporary mirror is updated, and the first mirror request content is determined based on the update of the storage distribution. The first mirror request content is the content for updating the file location table. When the address area of the mirror request content is located in the data area of the temporary mirror, it is determined that the file directory in the temporary mirror is changed, and the second mirror request content is determined based on the change of the file directory. The second mirror request content is the content for updating the directory tree.
[0053] Step 104: When the target folder remains mounted, the image mapping structure is updated according to the image request content and the mapping relationship, and an image update result is obtained.
[0054] In a specific implementation, when the image request content is the first image request content, the image mapping structure is updated according to the image request content and the mapping relationship, and the specific implementation of obtaining the image update result includes: obtaining an initial cluster list and an initial storage list; wherein the initial cluster list is a list obtained by splicing all valid members in the file location table, and the initial storage list is a list in which all invalid members in the file location table are uniformly stored; traversing the remaining members in the file location table of the image mapping structure according to the image request content and the mapping relationship, and determining whether the tail information of the cluster list information corresponding to the current node of the remaining members and the header information of the initial cluster list overlap; in the case that the tail information and the header 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 matched members, and after deleting the matched members from both the cluster list information and the initial storage list, determining whether the traversal of the remaining members in the file location table is completed; in the case that the traversal of the remaining members in the file location table is completed, determining that the update of the image mapping structure is completed, and obtaining the request parsing result; in the case that the traversal of the remaining members in the file location table is not completed, continuing to return to the step of traversing the remaining members in the file location table according to the image request content.
[0055] In a specific implementation, it also includes: when there is overlap between the table tail information and the table header information, after concatenating the cluster list information and the initial cluster list, deleting the corresponding cluster list in the initial cluster list, and continuing to 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 step of successfully matching members.
[0056] Specifically, Figure 4 This is one of the processing schematic diagrams of the image request content provided by the present invention, such as Figure 4 As shown, the processing process includes the following steps.
[0057] Step 401: Obtain an initial cluster list and an initial storage list.
[0058] The initial cluster list is a list obtained by concatenating all valid members in the file location table, and the initial storage list is a list in which all invalid members in the file location table are stored uniformly.
[0059] Specifically, the image request content is preprocessed to obtain an initial cluster list obtained by concatenating all valid members in the file location table and an initial storage list obtained by uniformly storing all invalid members in the file location table.
[0060] Step 402: traverse the remaining members in the file location table.
[0061] Specifically, the remaining members in the file location table of the image mapping structure are traversed according to the image request content and the mapping relationship.
[0062] Step 403: Determine whether the tail information of the cluster list information corresponding to the current node of the remaining member overlaps with the header information of the initial cluster list.
[0063] Specifically, determine whether the tail information of the cluster list information corresponding to the current node of the remaining member overlaps with the header information of the initial cluster list. If the tail information and the header information overlap, execute step 404; if the tail information and the header information do not overlap, execute step 405.
[0064] Step 404: After concatenating the cluster list information and the initial cluster list, delete the corresponding cluster list in the initial cluster list.
[0065] Specifically, when the table footer information and the table header information overlap, the cluster list information and the initial cluster list are concatenated, and the corresponding cluster list in the initial cluster list is deleted after the cluster list information and the initial cluster list are concatenated. After deleting the corresponding cluster list in the initial cluster list, step 405 is continued.
[0066] 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 is continued.
[0067] 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.
[0068] Specifically, when there is no overlap between the table footer information and the table header information, after determining the successfully matched member, delete the successfully matched member from both the cluster list information and the initial storage list, and continue to execute step 406 after deleting the successfully matched member from both the cluster list information and the initial storage list.
[0069] Step 406: Determine whether the traversal of the remaining members in the file location table is complete.
[0070] Specifically, when the traversal of the remaining members in the file location table is completed, it is determined that the mirror mapping structure update is completed and the request parsing result is obtained. When the traversal of the remaining members in the file location table is not completed, the process returns to step 402 to traverse the remaining members in the file location table according to the mirror request content.
[0071] Step 407: Get the image update result.
[0072] Specifically, when the traversal of the remaining members in the file location table is completed, it is determined that the update of the mirror mapping structure is completed, and the request parsing result is obtained.
[0073] In a specific implementation, when the image request content is the second image request content, the image mapping structure is updated according to the image request content and the mapping relationship, and the specific implementation method of obtaining the image update result includes: 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; determining the address fragment of the current node in the temporary image according to the cluster list information; when the address area is not located in the address fragment, returning to execute 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 area is located in the address fragment, locating the corresponding directory tree node according to the node pointer of the directory tree; when the node type of the directory tree node is a directory, reading the directory entry of the data area, and determining whether the corresponding directory tree node exists in the directory entry; when the corresponding directory tree node exists in the directory entry, determining whether the directory entry of the data area has been read; when the directory entry of the data area has been read, determining that the update of the image mapping structure is completed, and obtaining the request parsing result; when the directory entry of the data area has not been read, continuing to return to execute the step of reading the directory entry of the data area and determining whether the corresponding directory tree node exists in the directory entry.
[0074] In a specific implementation, it also 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, continuing to execute the step of determining whether the directory entries in the data area have been read; when the directory entries in the data area have been read, determining that the mirror mapping structure update is completed, and obtaining the request parsing result based on the file path and the offset address.
[0075] Specifically, Figure 5 This is the second schematic diagram of processing the image request content provided by the present invention, such as Figure 5 As shown, the processing process includes the following steps.
[0076] Step 501: traverse the remaining members in the file location table according to the mirror request content, and determine the cluster list information corresponding to the current node of the remaining members.
[0077] Step 502: Determine the address fragment of the current node in the temporary image according to the cluster list information.
[0078] Step 503: Determine whether the address area is within the address segment.
[0079] Specifically, determine whether the address region is within the address fragment. If the address region is not within the address fragment, continue to return to step 502 to determine the address fragment of the current node in the temporary image according to the cluster list information. If the address region is within the address fragment, continue to execute step 504.
[0080] Step 504: locate the corresponding directory tree node according to the node pointer of the directory tree.
[0081] Specifically, when the address area is located within the address segment, the corresponding directory tree node is located according to the node pointer of the directory tree.
[0082] Step 505: Determine whether the node type of the directory tree node is a directory.
[0083] Specifically, it is determined whether the node type of the directory tree node is a directory. If it is determined that the node type of the directory tree node is a directory, step 506 is continued to be executed; if it is determined that the node type of the directory tree node is not a directory, step 507 is continued to be executed.
[0084] Step 506: Read the directory entry of the data area.
[0085] Specifically, the directory entry of the data area is read, the directory entry is compared with the child node corresponding to the directory tree node, and step 508 is continued.
[0086] Step 507: Determine 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.
[0087] Specifically, when 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 according to the request start address of the data request information and the cluster list header, and step 514 is continued to determine whether the data area has been read.
[0088] Step 508: Determine whether the directory entry is marked for deletion.
[0089] Specifically, the directory entry is compared with the child node corresponding to the directory tree node to determine whether the directory entry is marked for deletion. If it is determined that the directory entry is not marked for deletion, step 510 is continued. If it is determined that the directory entry is marked for deletion, step 509 is continued.
[0090] Step 509: Delete the file.
[0091] Specifically, when it is determined that the directory entry file name of the directory entry 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, and the file is deleted according to the node path corresponding to the node and the deletion operation. The tree with the current directory tree node as the root and the nodes corresponding to the nodes in the tree in the linked list are further deleted, and step 514 is continued to determine whether the data area has been read.
[0092] Step 510: Determine whether the directory entry file name of the directory entry is consistent with the directory tree node.
[0093] Specifically, determine whether the directory entry file name of the directory entry is consistent with the directory tree node. If it is determined that the directory entry file name of the directory entry is consistent with the directory tree node, continue to execute step 512; if it is determined that the directory entry file name of the directory entry is inconsistent with the directory tree node, continue to execute step 511.
[0094] Step 511: Rename the file.
[0095] Specifically, when it is determined that the directory entry file name 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 step 514 is continued to determine whether the data area has been read.
[0096] Step 512: Determine whether the directory entry has no corresponding directory tree node.
[0097] Specifically, it is determined whether the directory entry has no corresponding directory tree node. If it is determined that the directory entry has no corresponding directory tree node, step 513 is continued to be executed; if it is determined that the directory entry has a corresponding directory tree node, step 514 is continued to be executed.
[0098] Step 513: Create a new file.
[0099] Specifically, when it is determined that a corresponding directory tree node exists for a 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 continued to determine whether the data area has been read.
[0100] Step 514: Determine whether the data area has been read completely.
[0101] Specifically, if it is determined that the data area has been read completely, step 515 is continued to be executed; if it is determined that the data area has not been read completely, step 506 is continued to be executed to read the directory entry of the data area.
[0102] Step 515: Determine whether the image mapping structure update is complete and obtain the request parsing result.
[0103] Specifically, when it is determined that the data area has been read, it is determined that the mirror mapping structure has been updated, and the request parsing result is obtained.
[0104] Step 105: Synchronously update the target folder based on the mirror update result.
[0105] Specifically, after obtaining the image update result, the image update result includes the path of the operation target in the mounted target folder, the operation type, file modification data, etc. The operation type can be, for example, a new file, file content modification, file name modification, file deletion, etc.; the file modification data can be, for example, a new file or a file deletion operation, the corresponding file member in the target folder is empty, the content of the file member in the target folder for the file content modification operation is the modified content, and the name of the file member in the target folder for the file name modification operation is the modified name; based on the path of the operation target in the mounted target folder, the operation type, file modification data, etc. contained in the image update result, the target folder is synchronously updated.
[0106] The present invention provides a method for synchronously updating folder mounting, which obtains basic file information and data request information of a target folder; wherein the data request information is data communication information between a server; constructs a temporary image and an image mapping structure according to the basic file information; wherein the image mapping structure is used to establish a mapping relationship between the target folder and the temporary image; determines the image request content according to the data request information and the temporary image, and mounts the target folder on the temporary image based on the image request content; updates the image mapping structure according to the image request content and the mapping relationship when the target folder remains mounted, and obtains the image update result; and synchronously updates the target folder based on the image update result. Based on the above embodiments, the technical scheme of the present invention is used to solve the defect that the existing technology cannot realize synchronous modification of the folder without disconnecting the mounting connection, which reduces the update efficiency. Based on the construction of the image mapping structure and the temporary image, the image mapping structure is updated according to the image request content and the mapping relationship when the target folder is mounted based on the temporary image, and the image update result is obtained. Finally, the target folder is synchronously updated based on the image update result, so that the folder can be synchronously updated without disconnecting the mounting connection, thereby improving the update efficiency.
[0107] The synchronous update device for mounting a folder provided by the present invention is described below. The synchronous update device for mounting a folder described below and the synchronous update method for mounting a folder described above can be referred to each other.
[0108] Figure 6 This is a schematic diagram of the structure of the synchronous update device for folder mounting provided by the present invention, referring to Figure 6 As shown, the folder mounting synchronous update device 600 includes: an information acquisition module 601, an image building module 602, a file mounting module 603, a structure updating module 604 and a file updating module 605.
[0109] The information acquisition module 601 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 image building module 602 is used to build a temporary image and an image mapping structure according to basic file information; wherein the image mapping structure is used to establish a mapping relationship between a target folder and a temporary image.
[0110] The file mounting module 603 is used to determine the image request content according to the data request information and the temporary image, and perform a folder mounting connection on the target folder on the temporary image based on the image request content.
[0111] The structure update module 603 is used to update the image mapping structure according to the image request content and the mapping relationship, and obtain the image update result when the target folder remains mounted and connected; The file update module 604 is used to synchronously update the target folder based on the mirror update result.
[0112] In an exemplary embodiment, 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; the mirror mapping structure includes a file location table and a directory tree.
[0113] In an exemplary embodiment, the image construction module 602 constructs an image mapping structure based on basic file information, and is specifically used to: construct a file location table based on cluster list information and file node pointers; wherein the file location table is a linked list structure, which is used to locate the image request content of the temporary image to a specific directory in the mounted target folder; construct a directory tree based on the file type, file name, file parent node pointer and file information linked list node pointer; wherein the directory tree is used to save the directory structure and file path of the mounted target folder.
[0114] In an exemplary embodiment, the mirroring request content includes first mirroring request content and second mirroring request content, the first mirroring request content is content for updating the file location table, and the second mirroring request content is content for updating the directory tree.
[0115] In an exemplary embodiment, the image construction module 602 determines the image request content based on the data request information and the temporary image, and is specifically used to: determine the address area of the data request information; when 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 is updated, and determine the first image request content based on the update of the storage distribution; when 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 is changed, and determine the second image request content based on the change of the file directory.
[0116] In an exemplary embodiment, the structure update module 603, when the image request content is the first image request content, updates the image mapping structure according to the image request content and the mapping relationship, and obtains the image update result, which is specifically used to: obtain an initial cluster list and an initial storage list; wherein the initial cluster list is a list obtained by splicing all valid members in the file location table, and the initial storage list is a list in which all invalid members in the file location table are uniformly stored; traverse the remaining members in the file location table of the image mapping structure according to the image request content and the mapping relationship, determine the tail information of the cluster list information corresponding to the current node of the remaining members and the header information of the initial cluster list; whether there is overlap between the table tail information and the table header information; in the case that there is no overlap between the cluster list members in the cluster list information corresponding to the current node and the invalid members in the initial storage list, determine the successfully matched members, and after deleting the successfully matched members from both the cluster list information and the initial storage list, determine whether the traversal of the remaining members in the file location table is completed; in the case that the traversal of the remaining members in the file location table is completed, determine that the update of the image mapping structure is completed, and obtain the request parsing result; in the case that the traversal of the remaining members in the file location table is not completed, continue to return to execute the step of traversing the remaining members in the file location table according to the image request content.
[0117] In an exemplary embodiment, the structure update module 603, when the image request content is the first image request content, updates the image mapping structure according to the image request content and the mapping relationship, and obtains the image update result, and is also used for: when there is overlap between the table footer information and the table header information, after concatenating the cluster list information and the initial cluster list, deleting the corresponding cluster list in the initial cluster list, and continuing to match the cluster list members in the cluster list information corresponding to the current node with the invalid members in the initial storage list, and determining the step of successfully matching the members.
[0118] In an exemplary embodiment, the structure update module 603 updates the image mapping structure according to the image request content and the mapping relationship when the image request content is the second image request content, and obtains the image update result, which is specifically used to: traverse the remaining members in the file location table according to the image request content, and determine the cluster list information corresponding to the current node of the remaining members; determine the address fragment of the current node in the temporary image according to the cluster list information; if the address area is not located in the address fragment, return to execute 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 area is located in the address fragment, 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 a directory, read the directory entry of the data area, and determine whether the corresponding directory tree node exists in the directory entry; if the corresponding directory tree node exists in the directory entry, determine whether the directory entry of the data area has been read; if the directory entry of the data area has been read, determine that the image mapping structure update is completed, and obtain the request parsing result; if the directory entry of the data area has not been read, continue to return to execute the step of reading the directory entry of the data area and determining whether the corresponding directory tree node exists in the directory entry.
[0119] In an exemplary 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, and is also used for: 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, continuing to execute the step of determining whether the directory entry of the data area has been read; when the directory entry of the data area has been read, determining that the image mapping structure update is completed, and obtaining the request parsing result according to the file path and the offset address.
[0120] The device of this embodiment can be used to execute the method of any embodiment in the embodiment of the synchronous update method side of folder mounting. Its specific implementation process and technical effects are similar to those in the embodiment of the synchronous update method side of folder mounting. For details, please refer to the detailed description in the embodiment of the synchronous update method side of folder mounting, which will not be repeated here.
[0121] Figure 7 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 communication interface 720, a memory 730 and a communication bus 740, wherein the processor 710, the communication interface 720 and the memory 730 communicate with each other through the communication bus 740. The processor 710 may call the logic instructions in the memory 730 to execute the synchronous update method of folder mounting, the method comprising: 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 an image mapping structure according to 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 according to the data request information and the temporary image, and mounting the target folder on the temporary image based on the image request content; when the target folder remains mounted, updating the image mapping structure according to 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.
[0122] In addition, the logic instructions in the above-mentioned memory 730 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0123] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program 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 including: obtaining basic file information and data request information of the target folder; wherein the data request information is data communication information with a server; constructing 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; 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.
[0124] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the folder mounting synchronization update method provided by the above-mentioned methods, the method comprising: obtaining basic file information and data request information of the target folder; wherein the data request information is data communication information with a server; constructing a temporary mirror and a mirror mapping structure according to the basic file information; wherein the mirror mapping structure is used to establish a mapping relationship between the target folder and the temporary mirror; determining the mirror request content according to the data request information and the temporary mirror, and mounting the target folder on the temporary mirror based on the mirror request content; while the target folder remains mounted, updating the mirror mapping structure according to the mirror request content and the mapping relationship, and obtaining the mirror update result; and synchronously updating the target folder based on the mirror update result.
[0125] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0126] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0127] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for synchronously updating a folder mount, characterized in that: include: Obtaining 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 an image mapping structure according to the basic file information; wherein the image mapping structure is used to establish a mapping relationship between the target folder and the temporary image; Determine the image request content according to the data request information and the temporary image, and perform a folder mount connection on the target folder on the temporary image based on the image request content; In the case where the target folder remains mounted, the image mapping structure is updated according to the image request content and the mapping relationship, and an image update result is obtained; The target folder is synchronously updated based on the mirror image update result.
2. The method for synchronously updating folder mounting according to claim 1, characterized in that: 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; The mirror mapping structure includes a file location table and a directory tree; Constructing the mirror mapping structure according to the basic file information includes: Constructing the file location table according to the cluster list information and the file node pointer; 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; The directory tree is constructed according to the file type, the file name, the file parent node pointer and the file information linked list node pointer; wherein the directory tree is used to store the directory structure and file path of the mounted target folder.
3. The synchronous update method of folder mounting according to claim 2, characterized in that: The mirroring request content includes a first mirroring request content and a second mirroring request content, wherein the first mirroring request content is content for updating the file location table, and the second mirroring request content is content for updating the directory tree; The determining the mirror request content according to the data request information and the temporary mirror includes: Determining an address area of the data request information; In a case where 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 is updated, and determining the first image request content according to the update of the storage distribution; In the case where the address area of the mirror request content is located in the data area of the temporary mirror, it is determined that a file directory in the temporary mirror is changed, and the second mirror request content is determined according to the change of the file directory.
4. The method for synchronously updating folder mounting according to claim 3, characterized in that: When the mirror request content is the first mirror request content, updating the mirror mapping structure according to the mirror request content and the mapping relationship, and obtaining a mirror update result, includes: Acquire an initial cluster list and an initial storage list; wherein the initial cluster list is a list obtained by concatenating all valid members in the file location table, and the initial storage list is a list in which all invalid members in the file location table are uniformly stored; Traversing the remaining members in the file location table of the mirror mapping structure according to the mirror request content and the mapping relationship, and determining whether the tail information of the cluster list information corresponding to the current node of the remaining members overlaps with the header information of the initial cluster list; In the case where the table tail information and the table header 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, and after deleting the successfully matched members from both the cluster list information and the initial storage list, determine whether the traversal of the remaining members in the file location table is completed; When the traversal of the remaining members in the file location table is completed, determining that the update of the mirror mapping structure is completed, and obtaining the request parsing result; In the case that the traversal of the remaining members in the file location table has not been completed, the step of returning to execute the step of traversing the remaining members in the file location table according to the mirror request content.
5. The synchronous update method of folder mounting according to claim 4, characterized in that: Also includes: In the case where the table tail information and the table header information overlap, after splicing the cluster list information and the initial cluster list, the corresponding cluster list in the initial cluster list is deleted, and 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 step of successfully matching members.
6. The synchronous update method of folder mounting according to claim 3, characterized in that: When the mirror request content is the second mirror request content, updating the mirror mapping structure according to the mirror request content and the mapping relationship, and obtaining a 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; Determine the address fragment of the current node in the temporary image according to the cluster list information; In the case where the address area is not located within the address fragment, returning to the step of traversing the remaining members in the file location table according to the mirror request content to determine the cluster list information corresponding to the current node of the remaining members; In the case where the address area is located within the address fragment, locating the corresponding directory tree node according to the node pointer of the directory tree; In the case where the node type of the directory tree node is a directory, reading the directory entry of the data area to determine whether there is a corresponding directory tree node in the directory entry; In the case where the corresponding directory tree node exists in the directory entry, determining whether the directory entry of the data area has been read; When the directory entry of the data area is read completely, determining that the mirror mapping structure is updated completely, and obtaining the request parsing result; When the directory entry of the data area has not been read completely, the step of returning to the step of reading the directory entry of the data area and determining whether the directory entry has a corresponding directory tree node.
7. The synchronous update method of folder mounting according to claim 6, characterized in that: Also includes: In the case that 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 perform the step of determining whether the directory entry of the data area has been read; When the directory entry of the data area is completely read, it is determined that the update of the mirror mapping structure is completed, and the request parsing result is obtained according to the file path and the offset address.
8. A synchronous update device for mounting a folder, characterized in that: include: An information acquisition module, used to acquire basic file information and data request information of a target folder; wherein the data request information is data communication information with a server; An image building module, used to build a temporary image and an image mapping structure according to the basic file information; wherein the image mapping structure is used to establish a mapping relationship between the target folder and the temporary image; A file mounting module, configured to determine the image request content according to the data request information and the temporary image, and perform a folder mounting connection on the target folder on the temporary image based on the image request content; A structure update module, used to update the image mapping structure according to the image request content and the mapping relationship, and obtain an image update result when the target folder remains mounted and connected; The file update module is used to synchronously update the target folder based on the mirror update result.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the synchronous update method of folder mounting according to any one of claims 1 to 7 is implemented.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the synchronous update method of folder mounting as claimed in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
KVM and folder one-key mounting method, device, equipment and medium
CN108776680A
Folder mounting method, device and equipment, and medium
CN111506547A
Data transmission control method and related equipment
CN115297107A
File mounting method and device
CN117331890A
Mirror file system
US20130304705A1