Data access method, terminal device, and storage medium
By obtaining and utilizing memory mapped files for data writing processing, the problem of long time-consuming data writing processing caused by multiple access requests to physical volumes in LVM technology is solved, and data access efficiency is improved.
Patent Information
- Application Number
- PCT/CN2024/076323
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-02-27
- Filing Date
- 2024-02-06
- Publication Date
- 2024-09-06
AI Technical Summary
In the data processing process based on logical volume management (LVM) technology, the processing of multiple access requests to the physical volume leads to instruction queuing, resulting in long data writing processing and low efficiency.
By obtaining the memory mapped file of the target physical volume, the number of direct accesses to the physical volume is reduced, the memory mapped file is used for data writing processing, and the processed files are synchronized to the physical volume, thereby reducing the actual number of physical volume accesses.
It effectively reduces the data writing processing time of the physical volume, improves the efficiency of data access, and reduces the number of access requests to the physical volume.
Smart Images

Figure CN2024076323_06092024_PF_FP
Abstract
Description
Data access method, terminal device and storage medium
[0001] Cross-references
[0002] This application claims priority to the Chinese patent application filed with the China Patent Office on February 27, 2023, with application number 202310217297.6 and application name “Data Access Method, Terminal Device and Storage Medium”. The entire contents of the application are incorporated by reference into this application. Technical Field
[0003] The present application relates to the field of data processing technology, and in particular to a data access method, terminal device and storage medium. Background Art
[0004] Among the storage technologies of terminal devices, Logical Volume Manager (LVM) technology is a mainstream technology and is widely used in the storage and virtualized storage management of terminal devices. In the process of executing data writing to the physical volume based on the data processing instructions of this technology, multiple data read and write memory access processes of the physical volume are involved. In the case of a large number of data write instructions, the instructions will be queued, resulting in a long time and low efficiency in executing the data write process.
[0005] Summary of the Invention
[0006] The present invention provides a data access method, terminal equipment and storage medium, aiming to reduce the number of accesses to a physical volume, thereby reducing the time consumed in data writing processing on the physical volume and improving the efficiency of data access.
[0007] In a first aspect, an embodiment of the present invention provides a data access method applied to a terminal device, comprising: when an access request to a target physical volume of the storage device is obtained, obtaining a first memory mapping file corresponding to the target physical volume, the first memory mapping file being used to indicate data of the target physical volume; when the access request is a write request, performing data writing processing on the first memory mapping file according to the access request; and synchronizing the first memory mapping file after the data writing processing to the target physical volume.
[0008] In a second aspect, an embodiment of the present invention also provides a data access method, comprising: when an access request to a target physical volume of the storage device is obtained, obtaining a first memory mapping file corresponding to the target physical volume, the first memory mapping file being used to indicate the data of the target physical volume; determining the offset position information of the target data in the access request according to the access request; determining the target position corresponding to the offset position information in the first memory mapping file, and performing data access processing on the data located at the target position of the first memory mapping file.
[0009] In a third aspect, an embodiment of the present invention further provides a terminal device, comprising a processor, a memory, a computer program stored on the memory and executable by the processor, and a data bus for realizing connection and communication between the processor and the memory, wherein when the computer program is executed by the processor, the steps of the data access method provided in the first aspect and / or the steps of the data access method provided in the second aspect are implemented.
[0010] In a fourth aspect, an embodiment of the present invention further provides a storage medium, which stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of the data access method provided in the first aspect and / or the data access method provided in the second aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0012] FIG1 is a schematic diagram of a step flow of a data access method provided by the present application;
[0013] FIG2 is a schematic block diagram of a target directory file provided by an embodiment of the present application;
[0014] FIG3 is a schematic diagram of the steps of another data access method provided by the present application;
[0015] FIG4 is a schematic block diagram of the structure of a terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0016] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0017] The flowcharts shown in the accompanying drawings are for illustrative purposes only and do not necessarily include all contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may be decomposed, combined, or partially merged, so the actual execution order may vary depending on the actual situation.
[0018] It should be understood that the terms used in this specification are only for the purpose of describing specific embodiments and are not intended to limit the present application. As used in this specification and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms unless the context clearly indicates otherwise.
[0019] The present invention provides a data access method, a terminal device, and a storage medium. The data access method can be applied to a terminal device, which can be an electronic device such as a tablet computer, a laptop computer, or a desktop computer.
[0020] It can be understood that the terminal device includes a storage device. When the current terminal device performs data access processing based on a data access request of an LVM command, it usually reads the header of the physical volume in the storage device in response to the LVM command to identify whether the physical volume is a valid physical volume. At this time, one access request processing needs to be completed. Furthermore, it is necessary to store the size of the metadata area, checksum and other information of the metadata area in the metadata header area of the valid physical volume starting from the starting offset 4096 bytes of the physical volume to verify the validity of the metadata. During the above period, multiple access request processing needs to be completed. In addition, after performing the above processing, it is necessary to read the logical volume metadata header area and modify the metadata according to the specific LVM command. This process also requires multiple access request processing. In summary, in the current process of data processing of physical volumes based on LVM commands, the number of access request processing times is too high, which easily causes processing instructions to be queued, resulting in low data processing efficiency and long time consumption. The data access method provided by the present application can effectively reduce the number of access request processing times in the process of data processing of physical volumes, thereby improving data processing efficiency and reducing time consumption. The specific steps are described in the embodiments below.
[0021] The following embodiments of the present application are described in detail with reference to the accompanying drawings. In the absence of conflict, the following embodiments and features therein may be combined with each other.
[0022] Please refer to FIG. 1 , which is a flowchart illustrating the steps of a data access method provided by the present application.
[0023] As shown in FIG1 , the data access method includes steps S101 to S103 .
[0024] Step S101: When an access request to a target physical volume of the storage device is obtained, a first memory mapping file corresponding to the target physical volume is obtained, where the first memory mapping file is used to indicate data of the target physical volume.
[0025] Exemplarily, the storage device of the terminal device includes one or more physical volumes. It can be understood that the physical volumes are composed of disk partitions in the storage device.
[0026] Exemplarily, the access request may be an access request corresponding to an LVM instruction, wherein, under the access request of the LVM instruction, data writing processing may be performed on multiple physical volumes at the same time to implement data writing processing on logical volumes under the LVM technology. It can be understood that the physical volumes may be divided into volume groups, and the logical volumes may be determined by the division of the volume groups.
[0027] Illustratively, the access request to the target physical volume may be a request to access one or more target physical volumes.
[0028] Exemplarily, in response to an access request, a first memory mapping file corresponding to the target physical volume is obtained, and the first memory mapping file is used to indicate the data in the target physical volume, so that corresponding data access can be performed on the first memory mapping file, avoiding direct data access to the target physical volume, thereby reducing the number of data accesses to the target physical volume.
[0029] In some embodiments, before obtaining an access request to a target physical volume of a storage device, the method further includes: scanning the physical volumes in the storage device; performing data mapping on the physical volumes that meet preset data verification conditions to obtain a memory-mapped file corresponding to each physical volume; and storing the memory-mapped file in a target directory file of the storage device. Obtaining the first memory-mapped file corresponding to the target physical volume includes obtaining the first memory-mapped file corresponding to the target physical volume from the target directory file.
[0030] Exemplarily, the first memory mapping file corresponding to the target physical volume can be obtained from the target directory file in the storage device. It can be understood that the target directory file is used to store memory mapping files corresponding to several physical volumes, so that when the first memory mapping file corresponding to the target physical volume is obtained, it can be obtained from the target directory file to improve the efficiency of obtaining the first memory mapping file, thereby improving the efficiency of data access.
[0031] Specifically, as shown in Figure 2, Figure 2 is a schematic block diagram of the target directory file provided by an embodiment of the present application. The target directory file is stored in the path of the memory file system tmpfs, and the target directory file is named after the volume group (Volume Group, VG) name. In the target directory file, memory mapping files corresponding to multiple physical volumes are stored, such as memory mapping file 1 and memory mapping file 2. For example, these memory mapping files are named according to the device path of the corresponding physical volume so that the correspondence between the memory mapping file and the physical volume can be determined.
[0032] In other embodiments, obtaining the first memory file corresponding to the target physical volume in the target directory file includes: if the target directory file does not find the first memory mapping file corresponding to the target physical volume, obtaining volume group metadata in the storage device, and determining the first memory mapping file corresponding to the target physical volume based on the volume group metadata, wherein the volume group metadata includes data of multiple physical volumes.
[0033] Exemplarily, if the first memory mapping file corresponding to the target physical volume cannot be found in the target directory file, it is determined that the target physical volume has not established a mapping of the memory mapping file, and the volume group metadata is obtained to generate the first memory mapping file corresponding to the target physical volume, wherein the volume group metadata is composed of data of multiple physical volumes, and the volume group metadata can also be used to determine the logical volume.
[0034] It can be understood that the process of establishing a memory mapping file corresponding to a physical volume can be described as follows.
[0035] In some specific embodiments, before obtaining an access request to a target physical volume, a physical volume in a storage device is scanned to establish a memory mapping file corresponding to the physical volume. Specifically, the process of scanning the physical volume and establishing a memory mapping file corresponding to the physical volume is implemented by scanning a block device.
[0036] Specifically, each physical volume in the storage device is scanned, and the physical volumes that meet the preset data verification conditions are determined, and data mapping processing is performed on the physical volumes that meet the preset data verification conditions to obtain a memory mapping file corresponding to each physical volume, and the memory mapping file is stored in a target directory file, so that when an access request to the target physical volume of the storage device is obtained, the first memory mapping file corresponding to the target physical volume is obtained in the target directory file.
[0037] In some embodiments, data mapping processing is performed on physical volumes that meet preset verification conditions to obtain a memory mapping file corresponding to each physical volume, including: obtaining the offset and size of the metadata header of the physical volume; determining the size of the metadata header area of the physical volume based on the offset and size of the metadata header; determining the size of the volume group metadata area of the physical volume based on the data stored in the metadata header area; and mapping the size of the physical volume header area, the size of the metadata header area, the size of the volume group metadata area, the physical volume header data of the physical volume, the data stored in the metadata header area, and the data stored in the volume group metadata area to the memory mapping file when it is determined that the data set stored in the metadata header area and the data stored in the volume group metadata area pass the data verification conditions.
[0038] Exemplarily, before obtaining the offset and size of the metadata header of the physical volume, the physical volume header area is scanned to determine whether the current physical volume is legal based on the physical volume header data in the physical volume header area, and if the physical volume is a legal physical volume, the offset and size of the metadata header of the physical volume are obtained.
[0039] It is understandable that, when the physical volume is an illegal physical volume, the acquisition process of the offset and size of the metadata header of the illegal physical volume is not performed, so as to improve the generation efficiency of the memory-mapped file.
[0040] Exemplarily, after obtaining the offset and size of the metadata of the physical volume, the metadata header area is scanned to determine the size of the volume group metadata area. It can be understood that the data corresponding to the size of the volume group metadata area is stored in the metadata header area. Therefore, the metadata header area can be scanned and the size of the volume group metadata area can be determined based on the scanning results.
[0041] After determining the size of the volume group metadata area, the data stored in the volume group metadata area and the checksum data of the metadata area in the metadata header area are obtained to verify the legitimacy of the data in the volume group metadata area based on the checksum data. It can be understood that when the data in the volume group metadata area is determined to be legal based on the checksum data, it is determined that the data stored in the metadata header area and the data stored in the volume group metadata area pass the data verification conditions, and the memory mapping file generation processing is executed.
[0042] Specifically, since the starting offset of the physical volume header area relative to the physical volume is 0, and the physical volume header area, metadata header area, and volume group metadata area are continuous areas on the physical volume, they can be mapped to the memory mapping file based on the corresponding sizes of the physical volume header area, metadata header area, and volume group metadata area. At the same time, the data stored in the physical volume header area, metadata header area, and volume group metadata area are read into the memory mapping file to complete the generation of the memory mapping file, and the obtained memory mapping file is named and stored in the target directory file.
[0043] Step S102: When the access request is a write request, data is written into the first memory-mapped file according to the access request.
[0044] Exemplarily, a write request is used to indicate data writing processing to the target physical volume. In the case where the access request is a write request, data writing processing is performed on the first memory mapping file obtained from the target directory file according to the access request to obtain the first memory mapping file after data writing processing, thereby completing the data writing processing to the target physical volume through the first memory mapping file after data writing processing.
[0045] In some embodiments, data writing processing is performed on the first memory-mapped file according to the access request, including: determining the first data and the offset position and size of the first data according to the access request; determining the target write position of the first data in the first memory-mapped file according to the offset position and size of the first data; and writing the first data to the target write position of the first memory-mapped file.
[0046] Exemplarily, the access request includes the first data to be written, the offset position and size of the first data. It can be understood that the offset position of the first data is used to indicate the expected position of the first data in the first memory-mapped file. Therefore, the target write position of the first data in the first memory-mapped file can be determined based on the offset position and size of the first data, and the first data is written to the target write position of the first memory-mapped file to complete the data write processing of the first memory-mapped file, so that the data write processing of the target physical volume can be completed based on the first memory-mapped file after the data write processing.
[0047] Step S103: writing the processed data into the first memory-mapped file and synchronizing it to the target physical volume.
[0048] Exemplarily, after the first memory-mapped file completes the data writing process, the first memory-mapped file that has completed the data writing process is synchronized to the target physical volume to complete the data writing process on the target physical volume. It can be understood that through the data access method provided in the embodiment of the present application, in the process of completing the data writing process on the target physical volume, only a small amount of data access processing needs to be completed on the target physical volume, including but not limited to the data access processing on the target physical volume when generating the memory-mapped file, and the data access processing completed on the target physical volume during synchronization. During the entire process, the access requests submitted to each physical volume by the LVM command process are actually only in the single digits, which effectively reduces the number of access requests submitted to the physical volume and improves the efficiency of data access processing.
[0049] In some embodiments, synchronizing the data in the first memory-mapped file after data writing processing to the target physical volume includes: determining the initial data offset position of the first memory-mapped file after data writing processing and the initial offset position of the target physical volume; aligning the initial data offset position of the target physical volume according to the initial data offset position of the first memory-mapped file after data writing processing, and synchronizing the data in the data-write-processed first memory-mapped file to the target physical volume based on the aligned initial data offset position of the target physical volume.
[0050] Exemplarily, the initial data offset position of the target physical volume is determined, and the initial data offset position of the first memory-mapped file is determined, and the initial data offset positions of the two are aligned, so as to synchronize the data written into the processed first memory-mapped file to the target physical volume based on the aligned initial data offset position in the target physical volume.
[0051] Specifically, the initial data offset position is used to indicate the offset position 0 of the target physical volume. It can be understood that the synchronization processing can be a data replacement processing. For example, after the initial data offset position of the first memory mapping file is aligned with the initial data offset position of the target physical volume, the data starting from the initial data offset position in the first memory mapping file and the data starting from the initial data offset position in the target physical volume are replaced to complete the synchronization processing. For example, if the data of the first memory mapping file is changed only after the 5801th line, then during the synchronization process, the data of the target physical volume before the 5801th line is replaced, but is still the same as the original data, and the data after the 5801th line is the same as the first memory mapping file, so as to complete the data write processing based on the first data in the data access.
[0052] It should be noted that the number of rows and size of the above-mentioned data writing positions are illustrative examples and do not limit the data writing positions and sizes of this application.
[0053] In some specific embodiments, the status of the first memory-mapped file after the data write process is marked as dirty to indicate that the data write process has been completed for the memory-mapped file. After the terminal device completes the access request of the LVM instruction, the list of accessed physical volumes is traversed; based on the obtained list of accessed physical volumes, the corresponding memory-mapped file is searched in the target directory file, and it is determined whether the status of the queried memory-mapped file is marked as dirty, and the memory-mapped file whose status is marked as dirty is synchronized with the corresponding physical volume to complete the data write process for the physical volume. After the synchronization of the memory-mapped file to the physical volume is completed, the status of all memory-mapped files is marked as clean so that the status of the memory-mapped file can be modified when the data write process is performed next time.
[0054] By marking the status of the memory-mapped file as clean and storing it in the target directory file, the memory-mapped file corresponding to the physical volume can be obtained from the target directory file the next time an access request is received, thereby reducing the number of times the data mapping between the physical volume and the memory-mapped file needs to be re-established, thereby reducing the number of accesses to the physical volume.
[0055] It should be noted that after obtaining the first memory mapping file corresponding to the target physical volume, it is determined whether the access request is a write request or a read request. If the access request is a write request, step S102 is executed; if the access request is a read request, the steps described below are executed.
[0056] In other embodiments, after obtaining the first memory-mapped file corresponding to the target physical volume, the method further includes: when the access request is a read request, obtaining second data in the first memory-mapped file according to the access request.
[0057] Exemplarily, when it is determined that the access request is a read request, the second data is read from the first memory-mapped file according to the access request to complete the data reading process of the first memory-mapped file.
[0058] It can be understood that if only data reading processing is performed on the first memory-mapped file, it is determined that the data in the first memory-mapped file has not been modified. Therefore, the first memory-mapped file after completing the current access request is the same as the first memory-mapped file before completing the current access request, and there is no need to synchronize with the physical volume to reduce the number of accesses to the physical volume.
[0059] Specifically, the state of the first memory-mapped file that has completed the data reading process is kept clean, so that there is no need to synchronize the physical volume with the memory-mapped file in the clean state, thereby reducing the number of accesses to the physical volume.
[0060] The data access method provided by the present application completes the data writing process on the target physical volume by obtaining the first memory mapping file corresponding to the target physical volume when obtaining an access request to the target physical volume of the storage device, performing data writing process on the first memory mapping file based on the access request, and synchronizing the first memory mapping file after the data writing process to the target physical volume. By performing data writing process on the first memory mapping file, the actual number of accesses to the target physical volume is reduced, thereby improving the efficiency of data access and reducing the time consumption of data access.
[0061] Please refer to FIG3 , which is a schematic diagram of the steps of another data access method provided by the present application.
[0062] The present application also provides a data access method applied to a terminal device, the terminal device includes a storage device, and the method includes steps S201 to S203.
[0063] Step S201: When an access request to a target physical volume of the storage device is obtained, a first memory mapping file corresponding to the target physical volume is obtained, where the first memory mapping file is used to indicate data of the target physical volume.
[0064] It can be understood that step S201 is the same as step S101 , and reference may be made to the description of step S101 .
[0065] Step S202: Determine the offset location information of the target data in the access request according to the access request.
[0066] Exemplarily, the access request includes a read request or a write request for the first memory-mapped file based on the target data, and the offset position information of the target data is used to indicate the target position of the data for the read request or the write request to the first memory-mapped file, so as to perform data reading processing or data writing processing on the data located at the target position in the first memory-mapped file.
[0067] Step S203: determining a target location corresponding to the offset location information in the first memory-mapped file, and performing data access processing on the data located at the target location of the first memory-mapped file.
[0068] Exemplarily, a target position is determined in the first memory-mapped file based on the offset position information to perform data access processing on the data located at the target position in the first memory-mapped file, wherein the data access processing includes data reading processing or data writing processing. It can be understood that data access to the physical volume is achieved through data access to the first memory-mapped file. The specific data access process can be as described in the embodiment provided above and will not be repeated here.
[0069] The data access method provided in the present application implements data access to a physical volume by performing data access on a first memory-mapped file, thereby reducing the number of data accesses to the physical volume, improving the efficiency of data access, and reducing the time consumption of data access.
[0070] Please refer to FIG4 , which is a schematic block diagram of the structure of a terminal device provided in an embodiment of the present application.
[0071] As shown in FIG4 , a terminal device 300 includes a processor 301 and a memory 302 . The processor 301 and the memory 302 are connected via a bus 303 , such as an I 2 C (Inter-integrated Circuit) bus.
[0072] Specifically, the processor 301 is used to provide computing and control capabilities to support the operation of the entire terminal device. The processor 301 can be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor can be a microprocessor or the processor can also be any conventional processor.
[0073] Specifically, the memory 302 may be a Flash chip, a read-only memory (ROM) disk, an optical disk, a USB flash drive, or a mobile hard disk.
[0074] Those skilled in the art will understand that the structure shown in Figure 4 is merely a block diagram of a partial structure related to the embodiment of the present application, and does not constitute a limitation on the terminal device to which the embodiment of the present application is applied. The specific server may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0075] The processor is configured to run a computer program stored in a memory, and implement any one of the data access methods provided in the embodiments of the present application when executing the computer program.
[0076] In one embodiment, the processor is used to run a computer program stored in a memory, and implement the following steps when executing the computer program: when an access request to a target physical volume of the storage device is obtained, a first memory mapping file corresponding to the target physical volume is obtained, and the first memory mapping file is used to indicate the data of the target physical volume; when the access request is a write request, data is written to the first memory mapping file according to the access request; and the first memory mapping file after the data is written is synchronized to the target physical volume.
[0077] In one embodiment, when the processor implements data writing processing on the first memory-mapped file according to the access request, it is used to implement: determining the first data and the offset position and size of the first data according to the access request; determining the target write position of the first data in the first memory-mapped file according to the offset position and size of the first data; and writing the first data to the target write position of the first memory-mapped file.
[0078] In one embodiment, when synchronizing the first memory-mapped file after data writing processing to the target physical volume, the processor is used to implement: determining the initial data offset position of the first memory-mapped file after data writing processing and the initial data offset position of the target physical volume; aligning the initial data offset position of the target physical volume according to the initial data offset position of the first memory-mapped file after data writing processing; and synchronizing the data in the first memory-mapped file after data writing processing to the target physical volume based on the aligned initial data offset position of the target physical volume.
[0079] In one embodiment, before obtaining an access request to a target physical volume of the storage device, the processor is further configured to: scan the physical volumes in the storage device; perform data mapping on the physical volumes that meet a preset data verification condition to obtain a memory mapping file corresponding to each physical volume; and store the memory mapping file in a target directory file of the storage device;
[0080] When obtaining the first memory-mapped file corresponding to the target physical volume, the processor is configured to obtain the first memory-mapped file corresponding to the target physical volume in the target directory file.
[0081] In one embodiment, when the processor performs data mapping processing on physical volumes that meet preset verification conditions and obtains a memory mapping file corresponding to each physical volume, it is used to: obtain the offset and size of the metadata header of the physical volume; determine the size of the metadata header area of the physical volume based on the offset and size of the metadata header; determine the size of the volume group metadata area of the physical volume based on the data stored in the metadata header area; and when it is determined that the data stored in the metadata header area and the data stored in the volume group metadata area pass the data verification conditions, map the size of the physical volume header area, the size of the metadata header area, the size of the volume group metadata area, the physical volume header data of the physical volume, the data stored in the metadata header area, and the data stored in the volume group metadata area to the memory mapping file.
[0082] In one embodiment, when the processor obtains the first memory file corresponding to the target physical volume in the target directory file, it is used to implement: if the first memory mapping file corresponding to the target physical volume is not queried in the target directory file, obtain the volume group metadata in the storage device, and determine the first memory mapping file corresponding to the target physical volume based on the volume group metadata, wherein the volume group metadata includes data of multiple physical volumes.
[0083] In one embodiment, after obtaining the first memory-mapped file corresponding to the target physical volume, the processor is further configured to obtain second data in the first memory-mapped file according to the access request when the access request is a read request.
[0084] In one embodiment, when implementing the data access method, the processor is used to implement the following steps: when obtaining an access request to the target physical volume of the storage device, obtaining a first memory mapping file corresponding to the target physical volume, the first memory mapping file being used to indicate the data of the target physical volume; determining the offset position information of the target data in the access request according to the access request; determining the target position corresponding to the offset position information in the first memory mapping file, and performing data access processing on the data located at the target position of the first memory mapping file.
[0085] It should be noted that those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working process of the terminal device described above can refer to the corresponding process in the aforementioned data access method embodiment and will not be repeated here.
[0086] An embodiment of the present application also provides a storage medium for computer-readable storage, wherein the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of any data access method provided in the description of the embodiment of the present application.
[0087] The storage medium may be an internal storage unit of the terminal device described in the aforementioned embodiment, such as a hard disk or memory of the terminal device. The storage medium may also be an external storage device of the terminal device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the terminal device.
[0088] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In a hardware embodiment, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As is well known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable, and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media includes, but is not limited to, random access memory (RAM), ROM, electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical disc storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those skilled in the art that communication media generally contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0089] It should be understood that the term "and / or" used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, including these combinations. It should be noted that, in this article, the terms "include", "comprise" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system that includes a series of elements includes not only those elements, but also includes other elements that are not explicitly listed, or also includes elements that are inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "including a..." does not exclude the presence of other identical elements in the process, method, article or system that includes the element.
[0090] The serial numbers of the embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments. The above are only specific embodiments of the present application, but the scope of protection of the present application is not limited thereto. Any person skilled in the art can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application shall be based on the scope of protection of the claims.
Claims
1. A data access method, applied to a terminal device, wherein the terminal device includes a storage device; the method comprises: When an access request to a target physical volume of the storage device is obtained, obtaining a first memory mapping file corresponding to the target physical volume, wherein the first memory mapping file is used to indicate data of the target physical volume; When the access request is a write request, performing data writing processing on the first memory-mapped file according to the access request; The data is written into the processed first memory-mapped file and synchronized to the target physical volume.
2. The data access method according to claim 1, wherein: The performing data writing processing on the first memory-mapped file according to the access request includes: Determine first data and an offset position and a size of the first data according to the access request; Determine a target write position of the first data in the first memory-mapped file according to the offset position and size of the first data; The first data is written to a target write location of the first memory-mapped file.
3. The data access method according to claim 1, wherein: The step of writing the processed data into the first memory-mapped file and synchronizing it to the target physical volume includes: Determining an initial data offset position of the first memory-mapped file after data writing processing and an initial data offset position of the target physical volume; According to the initial data offset position of the first memory-mapped file after the data writing process, aligning the initial data offset position of the target physical volume; Based on the initial data offset position after the alignment of the target physical volume, the data in the processed first memory-mapped file is written and synchronized to the target physical volume.
4. The data access method according to any one of claims 1 to 3, wherein: Before obtaining an access request to a target physical volume of the storage device, the method further includes: Scanning the physical volumes in the storage device; Performing data mapping processing on the physical volumes that meet the preset data verification conditions to obtain a memory mapping file corresponding to each of the physical volumes; Storing the memory-mapped file in a target directory file of the storage device; The obtaining of the first memory mapping file corresponding to the target physical volume includes: A first memory mapping file corresponding to the target physical volume is obtained in the target directory file.
5. The data access method according to claim 4, wherein: The performing data mapping processing on the physical volumes meeting the preset verification conditions to obtain the memory mapping file corresponding to each of the physical volumes includes: Obtaining the offset and size of the metadata header of the physical volume; Determining the size of the metadata header area of the physical volume according to the offset and size of the metadata header; Determine the size of the volume group metadata area of the physical volume according to the data stored in the metadata header area; When it is determined that the data stored in the metadata header area and the data stored in the volume group metadata area pass the data verification condition, the size of the physical volume header area, the size of the metadata header area, the size of the volume group metadata area, the physical volume header data of the physical volume, the data stored in the metadata header area, and the data stored in the volume group metadata area are mapped to the memory mapping file.
6. The data access method according to claim 4, wherein: The step of obtaining the first memory file corresponding to the target physical volume in the target directory file includes: When the target directory file fails to find the first memory mapping file corresponding to the target physical volume, volume group metadata in the storage device is obtained, and the first memory mapping file corresponding to the target physical volume is determined based on the volume group metadata, wherein the volume group metadata includes data of multiple physical volumes.
7. The data access method according to any one of claims 1 to 3, wherein: After obtaining the first memory mapping file corresponding to the target physical volume, the method further includes: In a case where the access request is a read request, second data is obtained in the first memory-mapped file according to the access request.
8. A data access method, applied to a terminal device, wherein the terminal device includes a storage device; the method comprises: When an access request to a target physical volume of the storage device is obtained, obtaining a first memory mapping file corresponding to the target physical volume, wherein the first memory mapping file is used to indicate data of the target physical volume; Determine, according to the access request, offset location information of the target data in the access request; Determine a target position in the first memory-mapped file that corresponds to the offset position information, and perform data access processing on the data located at the target position in the first memory-mapped file.
9. A terminal device, comprising a processor, a memory, a computer program stored in the memory and executable by the processor, and a data bus for realizing connection and communication between the processor and the memory, wherein when the computer program is executed by the processor, the steps of the data access method as described in any one of claims 1 to 7 or the steps of the data access method as described in claim 8 are realized.
10. A storage medium for computer-readable storage, wherein the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of the data access method described in any one of claims 1 to 7 or the steps of the data access method described in claim 8.
Citation Information
Patent Citations
Method for storing file and mobile terminal
CN106775488A
Data processing method and device
CN110262757A
Data access method and device and storage medium
CN110399227A
Data writing method and device, data reading method and device and electronic device
CN112000589A
Data access method and device and data storage method and device
CN114764426A
Cited By
Medical big data file exporting method and system based on memory mapping file and terminal
CN119473129A
Synchronization signal processing method and artificial intelligence chip
CN121349718A
