Data processing method and device, equipment and storage medium
By creating logical volumes (LVs) on slow devices and storing the identifiers of fast devices and cache devices, the problem of cache device loading failure was solved, enabling automatic loading of cache devices after system restart and ensuring data integrity.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA UNITED NETWORK COMM GRP CO LTD
- Filing Date
- 2023-06-08
- Publication Date
- 2026-07-31
AI Technical Summary
The problem of cache device loading failure in existing technology, especially when system configuration files are missing or slow devices are virtual devices, is that the cache device cannot be loaded successfully, resulting in data loss.
By creating logical volumes (LVs) on slow devices and storing the identifiers of fast devices and cache devices in their tags, the system can automatically match and load cache devices after a system reboot, avoiding reliance on system configuration files.
It effectively preserves the mapping relationship between fast and slow devices, ensuring that the cache device can be loaded normally after the system restarts, preventing data loss, and is suitable for both physical and virtual device scenarios.
Smart Images

Figure CN116737076B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data storage technology, and in particular to a data processing method, apparatus, device and storage medium. Background Technology
[0002] In the storage field, slow devices such as hard disk drives (HDDs) have slow write and read speeds, which seriously affects user experience. Currently, the industry mainly accelerates slow devices by using caching devices to access faster devices such as solid-state drives (SSDs). This leverages the high random performance of fast devices, enabling even large-capacity but slow devices with low random performance to achieve decent random input / output (IO) performance.
[0003] After adding a cache to the slow device, any data to be written will be written to the fast device. In the event of a system crash or restart, the cache device needs to be automatically loaded. Specifically, after a system restart, if there are multiple cache devices in the system, the fast and slow devices are automatically paired and combined according to the mapping relationship between fast and slow devices stored in the system configuration file, and the cache device is loaded to ensure data integrity.
[0004] However, existing technologies suffer from the problem of cache device loading failures. Summary of the Invention
[0005] This application provides a data processing method, apparatus, device, and storage medium to solve the problem of cache device loading failure in the prior art.
[0006] Firstly, this application provides a data processing method, including:
[0007] After the operating system of the electronic device is detected to be starting, the identifier of the fast device and the identifier of the cache device are obtained from the LV tag. The LV has a one-to-one correspondence with the slow device of the electronic device. The cache device is used to call the fast device to accelerate the slow device.
[0008] Based on the identifier of the cache device and the identifier of the fast device, the cache device is invoked to pair the fast device with the slow device;
[0009] Load the cached device after pairing.
[0010] In one possible implementation, obtaining the identifier of the fast device and the identifier of the cache device from the LV's tag includes:
[0011] The identifier of the cache device, the identifier of the fast device, and the partition number are obtained from the tag of the LV. The LV and the partition of the slow device have a one-to-one correspondence.
[0012] Accordingly, the step of invoking the cache device to pair the fast device with the slow device based on the identifier of the cache device and the identifier of the fast device includes:
[0013] Based on the identifier of the caching device and the identifier of the fast device, the caching device is invoked to pair the partition of the fast device corresponding to the partition number with the partition of the slow device.
[0014] In one possible implementation, before obtaining the identifier of the fast device and the identifier of the cache device from the LV tag after detecting that the operating system of the electronic device has started, the method further includes:
[0015] Create the LV corresponding to the slow device;
[0016] According to the pre-acquired configuration file, the identifier of the fast device and the identifier of the cache device are written into the tag of the LV;
[0017] The cache device is created using the fast device based on the identifier of the fast device and the identifier of the cache device.
[0018] In one possible implementation, writing the identifier of the fast device and the identifier of the cache device into the tag of the LV according to a pre-acquired configuration file includes:
[0019] According to the pre-acquired configuration file, the identifier of the cache device, the identifier of the fast device, and the partition number are written into the tag of the LV;
[0020] Accordingly, creating the cache device using the fast device based on the identifier of the fast device and the identifier of the cache device includes:
[0021] The cache device is created using the fast device based on the identifier of the cache device, the identifier of the fast device, and the partition number.
[0022] In one possible implementation, the slow device is a physical device or a virtual device.
[0023] In one possible implementation, the method further includes:
[0024] Retrieve the data to be cached;
[0025] According to the loaded paired cache device, the data to be cached is cached in the slow device or the fast device corresponding to the slow device.
[0026] Secondly, this application provides a data processing apparatus, comprising:
[0027] The acquisition module is used to obtain the identifier of the fast device and the identifier of the cache device from the LV tag after the operating system of the electronic device is detected to be starting. The LV and the slow device of the electronic device are in a one-to-one correspondence. The cache device is used to call the fast device to accelerate the slow device.
[0028] The processing module is configured to, based on the identifier of the cache device and the identifier of the fast device, invoke the cache device to pair the fast device with the slow device;
[0029] The loading module is used to load the cached device after pairing processing.
[0030] In one possible implementation, the acquisition module is specifically used for:
[0031] The identifier of the cache device, the identifier of the fast device, and the partition number are obtained from the tag of the LV. The LV and the partition of the slow device have a one-to-one correspondence.
[0032] Accordingly, the processing module is specifically used for:
[0033] Based on the identifier of the caching device and the identifier of the fast device, the caching device is invoked to pair the partition of the fast device corresponding to the partition number with the partition of the slow device.
[0034] In one possible implementation, before obtaining the identifier of the fast device and the identifier of the cache device from the LV tag after detecting the startup of the electronic device's operating system, the processing module is further configured to:
[0035] Create the LV corresponding to the slow device;
[0036] According to the pre-acquired configuration file, the identifier of the fast device and the identifier of the cache device are written into the tag of the LV;
[0037] The cache device is created using the fast device based on the identifier of the fast device and the identifier of the cache device.
[0038] In one possible implementation, before obtaining the identifier of the fast device and the identifier of the cache device from the LV tag after detecting the startup of the electronic device's operating system, the processing module is further configured to:
[0039] Create the LV corresponding to the partition of the slow device;
[0040] According to the pre-acquired configuration file, the identifier of the cache device, the identifier of the fast device, and the partition number are written into the tag of the LV;
[0041] The cache device is created using the fast device based on the identifier of the cache device, the identifier of the fast device, and the partition number.
[0042] In one possible implementation, the slow device is a physical device or a virtual device.
[0043] In one possible implementation, the processing module is further configured to:
[0044] Retrieve the data to be cached;
[0045] According to the loaded paired cache device, the data to be cached is cached in the slow device or the fast device corresponding to the slow device.
[0046] Thirdly, this application provides an electronic device, including: a processor, a memory, and computer program instructions stored in the memory and executable on the processor, wherein the processor executes the computer program instructions to implement the methods provided in the first aspect and various possible designs.
[0047] Fourthly, this application may provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the methods provided in the first aspect and various possible designs.
[0048] The data processing method, apparatus, device, and storage medium provided in this application, in which, after detecting the operating system startup of an electronic device, obtains the identifier of the fast device and the identifier of the cache device from the LV tag, and calls the cache device to pair the fast device with the slow device based on the identifier of the cache device and the identifier of the fast device, and loads the paired cache device. Here, there is a one-to-one correspondence between the LV and the slow device of the electronic device, and the cache device is used to call the fast device to accelerate the slow device. In this technical solution, compared with the system configuration file, the LV tag is less likely to be lost and can effectively preserve the mapping relationship between fast and slow devices. Furthermore, for scenarios where the slow device is a virtual device, it is not necessary to determine the corresponding hardware device based on the virtual device number, thus ensuring the success rate of loading the cache device for the slow device. That is to say, regardless of whether the system configuration file is lost or the slow device is a virtual device, the corresponding cache device can be automatically loaded normally after the system restarts, without causing data loss. Attached Figure Description
[0049] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0050] Figure 1 A flowchart illustrating an embodiment of the data processing method provided in this application;
[0051] Figure 2 A flowchart illustrating Embodiment 2 of the data processing method provided in this application;
[0052] Figure 3 This is a schematic diagram of the structure of the data processing apparatus provided in the embodiments of this application;
[0053] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0054] The accompanying drawings have illustrated specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to specific embodiments. Detailed Implementation
[0055] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0056] Before introducing the embodiments of this application, the application background of the embodiments of this application will be explained first:
[0057] In the storage field, there are currently several solutions for accelerating HDD disks. These include open-source software solutions such as the Linux kernel's buffer cache (bcache) and flash cache, both of which utilize SSDs to accelerate HDDs. These solutions leverage the high random performance of SSDs, enabling even large-capacity HDDs with low random I / O performance to achieve decent random I / O performance. For the sake of generality, we will use "slow device" to represent devices with low random I / O performance, such as HDDs, and "fast device" to represent devices with high random performance, such as SSDs. Software that uses fast devices to accelerate slow devices is called a caching device.
[0058] After adding a cache to the slow device, if data is written, it might be written to the fast device as well. This means that at this point, some data is on the fast device, and some is on the slow device; only when both are combined do they form complete data. Therefore, when the system crashes or restarts, the cache needs to be automatically loaded to ensure data integrity.
[0059] Currently, existing slow devices are all physical devices. When the system restarts or a physical device is plugged into another electronic device, its hardware information, such as its serial number, remains unchanged. Therefore, when creating a cache device, this characteristic of hardware devices is utilized by writing the mapping relationship between fast and slow devices into the operating system's configuration file. When the operating system starts, the autoloader reads the system configuration file and loads the cache device according to the mapping relationship specified when it was created, ensuring the data is in a complete state. If there are multiple cache devices in the system, the autoloader needs to automatically identify the relationship between slow and fast devices in each cache device and automatically pair and combine them correctly; otherwise, data loss will occur.
[0060] In the above scheme, the slow devices are all physical devices. When the slow device is a virtual device, since the backend of the virtual device is actually bound to the physical device, the cache device that loads the virtual device is actually the cache device that loads the physical device that the backend of the virtual device is bound to.
[0061] However, the existing technology has the following technical problems:
[0062] 1. Since the mapping relationship between fast and slow devices in the cache is stored in the system configuration file, if the system configuration file is lost, the system cannot find the above mapping relationship, which will cause the cache to fail to load.
[0063] 2. When a slow device is a virtual device, since virtual devices lack permanent information like serial numbers, they are bound to physical devices via serial numbers. These serial numbers are automatically assigned by the operating system after a system restart, potentially resulting in a different number than before the restart. This alters the mapping between virtual and physical devices, making it impossible to determine the physical device based on the pre-restart mapping, thus preventing the loading of the virtual device's cache.
[0064] In summary, existing technologies suffer from the problem of cache device loading failure.
[0065] Based on this, this application provides a data processing method that pre-creates a Logical Volume (LV) for slow devices. The LV's tag includes the device name of the fast device and the name of the cache device, and a cache device is created using the fast device. Thus, after a system restart, for each slow device, the tag of the corresponding LV can be obtained, thereby determining the device name of the fast device and the name of the cache device. The fast device and the slow device are matched using the cache device, and finally, the cache device is loaded. In this technical solution, the device name of the fast device corresponding to the slow device and the name of the cache device are persisted on the slow device, making them less prone to loss. Furthermore, when the slow device is a virtual device, there is no need to match the physical device corresponding to the virtual device, thus enabling successful loading of the cache device for the slow device.
[0066] The technical solution of this application will now be described in detail through specific embodiments.
[0067] It should be noted that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.
[0068] Figure 1 This is a flowchart illustrating an embodiment of the data processing method provided in this application. Figure 1 As shown, the data processing method may include the following steps:
[0069] S101. After detecting that the operating system of the electronic device has started, obtain the identifier of the fast device and the identifier of the cache device from the LV's tag.
[0070] The execution subject in this application embodiment can be an electronic device or a data processing device installed in an electronic device. The data processing device can be implemented by software or by a combination of software and hardware. For ease of understanding, the following description will use an electronic device as the execution subject.
[0071] In this step, after the electronic device's operating system boots up, it needs to load a cache device. This cache device is used to call upon fast devices to accelerate slow devices. Since there may be multiple slow devices in an electronic device, and there is a one-to-one correspondence between slow devices and cache devices, for each slow device, before accelerating it, it is necessary to obtain the identifier of the cache device corresponding to that slow device, as well as the identifier of the fast device that the cache device needs to call.
[0072] It should be understood that this technical solution can be applied to scenarios such as electronic devices powering on, electronic devices crashing due to unforeseen circumstances, or electronic devices restarting. For example, in the scenario of an electronic device restarting, before restarting, some data is stored on the fast device, and another part is stored on the slow device; the complete data is formed by merging these two parts. Therefore, after the electronic device restarts, a caching device needs to be loaded to ensure data integrity and prevent data loss.
[0073] It should be understood that slow devices are devices with low random I / O performance, such as HDDs, while fast devices are devices with high random performance, such as SSDs.
[0074] Optionally, the slow device can be a physical device or a virtual device.
[0075] In this embodiment, a corresponding LV is pre-created for each slow device. The LV's tag includes the identifier of the fast device and the identifier of the caching device. Thus, after detecting the operating system startup of the electronic device, the LV corresponding to each slow device can be determined, and the LV's tag, which pre-writes the identifier of the fast device and the identifier of the caching device, can be obtained. Both the fast device and the caching device are used to accelerate the slow device.
[0076] For example, the identifier of a fast device can be the device name of the fast device, and the identifier of a cache device can be the name of the cache device.
[0077] In one possible implementation, LVs can also have a one-to-one correspondence with partitions on slow devices. The LV tag can also include the partition number of the fast device. That is, the partition on the fast device corresponding to the aforementioned partition number accelerates the partition on the slow device. Therefore, in addition to obtaining the identifiers of the cache device and the fast device from the LV tag, it is also necessary to obtain the partition number of the fast device. In other words, the identifiers of the cache device, the fast device, and the partition number are obtained from the LV tag.
[0078] S102. Based on the identifier of the cache device and the identifier of the fast device, call the cache device to pair the fast device and the slow device.
[0079] In this step, after obtaining the identifier of the fast device and the identifier of the cache device from the LV tag corresponding to the slow device, the corresponding cache device can be obtained based on the identifier of the cache device, and the corresponding fast device can be obtained based on the identifier of the fast device. The fast device and the slow device are then paired to accelerate the slow device through the fast device.
[0080] In one possible implementation, if the partition number of the fast device is also obtained in S101, then the corresponding cache device and fast device need to be obtained according to the identifier of the cache device and the identifier of the fast device, and the cache device is called to pair the partition of the fast device corresponding to the partition number with the partition of the slow device.
[0081] S103, Load the cache device after pairing processing.
[0082] In this step, after the pairing process is completed, the paired cache device needs to be loaded so that the data can be stored through the loaded paired cache device after subsequent data acquisition, thus ensuring data integrity.
[0083] The data processing method provided in this application, after detecting the startup of the operating system of an electronic device, obtains the identifier of the fast device and the identifier of the cache device from the LV tag. Based on the identifiers of the cache device and the fast device, it calls the cache device to pair the fast device with the slow device and loads the paired cache device. Here, there is a one-to-one correspondence between the LV and the slow device of the electronic device, and the cache device is used to call the fast device to accelerate the slow device. In this technical solution, compared with the system configuration file, the LV tag is less likely to be lost and can effectively preserve the mapping relationship between fast and slow devices. Furthermore, for scenarios where the slow device is a virtual device, it is not necessary to determine the corresponding hardware device based on the virtual device number, thus ensuring the success rate of loading the cache device for the slow device. In other words, regardless of whether the system configuration file is lost or the slow device is a virtual device, the corresponding cache device can be automatically loaded normally after a system restart, without causing data loss.
[0084] Optionally, in some embodiments, after loading the paired cache device, if data needs to be cached, the data to be cached can be obtained, and the data to be cached can be cached in the slow device or the fast device corresponding to the slow device according to the loaded paired cache device, so as to accelerate the slow device.
[0085] It should be understood that whether data is cached on a slow device or on a corresponding fast device depends on the actual situation, such as data type, data source, or data priority. This application embodiment does not impose specific restrictions on this.
[0086] To implement the above embodiments, it is also necessary to create LVs in advance and configure the labels of LVs. The process will be explained in detail below using two methods.
[0087] Method 1
[0088] Figure 2This is a flowchart illustrating a second embodiment of the data processing method provided in this application. Figure 2 As shown, before obtaining the identifiers of the fast device and the cache device from the LV tag after detecting the startup of the electronic device's operating system, the data processing method may further include the following steps:
[0089] S201. Create the LV corresponding to the slow device.
[0090] In this step, regardless of whether the slow device is a physical or virtual device, the LV tags created on the slow device are persisted to that device. Compared to system configuration files, the mapping relationship between slow and fast devices stored through LV tags is less likely to be lost. Therefore, LV tags replace the system configuration files in the existing technology. Based on this, the first step is to create the LV corresponding to the slow device.
[0091] It should be understood that the method of creating LV can refer to the implementation method in existing technology, which will not be elaborated here.
[0092] S202. Based on the pre-acquired configuration file, write the identifier of the fast device and the identifier of the cache device into the LV's label.
[0093] In this step, the configuration file is pre-acquired and carries data containing the identifiers of the fast device and the cache device. In other words, this configuration file describes the mapping relationship between the fast device, the slow device, and the cache device. Therefore, the identifiers of the fast device and the cache device need to be written into the LV's tag to persist the tag to the slow device and prevent the loss of the aforementioned mapping relationship.
[0094] Optionally, the above-mentioned configuration file may be data pre-written by relevant personnel and input into the electronic device, or it may be data pre-obtained from other data storage devices. This application embodiment does not limit the method of obtaining the configuration file.
[0095] S203. Create a cache device using the fast device based on the identifier of the fast device and the identifier of the cache device.
[0096] In this step, after writing the identifiers of the fast device and the cache device into the LV's label, the fast device can be identified based on its identifier, and a cache device corresponding to the cache device's identifier can be created based on that fast device. In other words, the identifier of the created cache device is consistent with the corresponding identifier in the LV's label.
[0097] In one possible implementation, the cache device can be created via a command-line tool, with parameters passed in during creation, including the identifier of the fast device and the identifier of the cache device.
[0098] It should be understood that the creation of a caching device based on a fast device can be achieved through open-source software such as bcache and lashcache, and the specific method can be determined according to the actual situation. This application example does not impose any specific restrictions on this.
[0099] In the above embodiments, by creating an LV corresponding to the slow device and configuring the LV's label, the label is used to store the mapping relationship between the fast device, the slow device, and the cache device, and persists it to the slow device to prevent the loss of the mapping relationship. This effectively ensures the successful loading of the cache device after the system restarts and prevents data loss.
[0100] Method 2
[0101] Optionally, the configuration file can also include the partition number of the fast device. In other words, the configuration file can also represent the mapping relationship between the partitions of the fast device, the partitions of the slow device, and the cache device. Therefore, it is necessary to create an LV corresponding to the partition of the slow device, and according to the pre-obtained configuration file, write the identifier of the cache device, the identifier of the fast device, and the partition number into the LV's label. Based on the identifier of the cache device, the identifier of the fast device, and the partition number, the cache device is created using the fast device.
[0102] It should be understood that the implementation process of Method 2 is largely the same as that of Method 1. The difference is that in Method 1, LVs correspond one-to-one with slow devices, and the LV label contains the identifier of the cache device and the identifier of the fast device; in Method 2, LVs correspond one-to-one with the partitions of slow devices, and the LV label contains the identifier of the cache device, the identifier of the fast device, and the partition number.
[0103] It should be understood that the parts of Method 2 that are the same as those in Method 1 can be found in the explanations and descriptions in Method 1, and will not be repeated here.
[0104] Because slow devices have large storage spaces, they are typically partitioned for better utilization. In Method 2, each partition of the slow device is assigned a different LV. The label in this LV indicates which partition of which fast device is being used to accelerate the slow device partition, further improving the flexibility of data processing and reducing the amount of data that needs to be traversed when retrieving data later.
[0105] The following are embodiments of the apparatus described in this application, which can be used to execute the embodiments of the method described in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method described in this application.
[0106] Figure 3 This is a schematic diagram of the structure of the data processing apparatus provided in an embodiment of this application. Figure 3As shown, the data processing device 300 includes:
[0107] The acquisition module 301 is used to obtain the identifier of the fast device and the identifier of the cache device from the LV tag after the operating system of the electronic device is detected to be started. The LV and the slow device of the electronic device have a one-to-one correspondence. The cache device is used to call the fast device to accelerate the slow device.
[0108] The processing module 302 is used to call the cache device to pair the fast device and the slow device according to the identifier of the cache device and the identifier of the fast device.
[0109] Loading module 303 is used to load the cache device after pairing processing.
[0110] In one possible implementation, module 301 is specifically used for:
[0111] The identifier of the cache device, the identifier of the fast device, and the partition number are obtained from the LV tag. There is a one-to-one correspondence between the LV and the partition of the slow device.
[0112] Accordingly, processing module 302 is specifically used for:
[0113] Based on the identifiers of the cache device and the fast device, the cache device is invoked to pair the partitions of the fast device corresponding to the partition number with the partitions of the slow device.
[0114] In one possible implementation, before obtaining the identifier of the fast device and the identifier of the cache device from the LV tag after detecting that the operating system of the electronic device has started, the processing module 302 is further configured to:
[0115] Create the LV corresponding to the slow device.
[0116] Based on the pre-obtained configuration file, the identifiers of the fast device and the cache device are written into the LV's label.
[0117] Create a cache device using the fast device's identifier and the cache device's identifier.
[0118] In one possible implementation, before obtaining the identifier of the fast device and the identifier of the cache device from the LV tag after detecting that the operating system of the electronic device has started, the processing module 302 is further configured to:
[0119] Create the LV corresponding to the partition of the slow device.
[0120] Based on the pre-obtained configuration file, the identifier of the cache device, the identifier of the fast device, and the partition number are written into the LV's label.
[0121] Create a cache device using the fast device, based on the cache device's identifier, the fast device's identifier, and the partition number.
[0122] In one possible implementation, the slow device is either a physical device or a virtual device.
[0123] In one possible implementation, the processing module 302 is further configured to:
[0124] Retrieve the data to be cached.
[0125] Based on the loaded paired cache device, the data to be cached is cached in the slow device or the fast device corresponding to the slow device.
[0126] The data processing apparatus provided in this application embodiment can be used to execute the data processing method in any of the above embodiments. Its implementation principle and technical effect are similar, and will not be described again here.
[0127] It should be noted that the division of the various modules in the above device is merely a logical functional division. In actual implementation, they can be fully or partially integrated into a single physical entity, or they can be physically separated. Furthermore, these modules can be implemented entirely in software through processing element calls, or entirely in hardware. Alternatively, some modules can be implemented through processing element calls in software, while others are implemented in hardware. Moreover, these modules can be fully or partially integrated together, or implemented independently. The processing element here can be an integrated circuit with signal processing capabilities. During implementation, each step of the above method or each of the above modules can be completed through the integrated logic circuits in the hardware of the processor element or through software instructions.
[0128] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 4 As shown, the electronic device 40 may include: a processor 41, a memory 42, and computer program instructions stored in the memory 42 and executable on the processor 41. When the processor 41 executes the computer program instructions, it implements the data processing method provided in any of the foregoing embodiments.
[0129] Optionally, the various devices of the electronic device 40 can be connected to each other via a system bus.
[0130] The memory 42 can be a separate memory unit or a memory unit integrated into the processor. The number of processors can be one or more.
[0131] Optionally, the electronic device 40 may also include an interface for interacting with other devices.
[0132] It should be understood that processor 41 can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this application can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.
[0133] The system bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The system bus can be divided into address bus, data bus, control bus, etc. For ease of representation, only one thick line is used in the diagram, but this does not indicate that there is only one bus or one type of bus. Memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.
[0134] All or part of the steps in the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a readable memory. When the program is executed, it performs the steps of the above-described method embodiments. The aforementioned memory (storage medium) includes: read-only memory (ROM), RAM, flash memory, hard disk, solid-state drive, magnetic tape, floppy disk, optical disk, and any combination thereof.
[0135] The electronic device provided in this application embodiment can be used to execute the data processing method provided in any of the above method embodiments. Its implementation principle and technical effect are similar, and will not be described again here.
[0136] This application provides a computer-readable storage medium storing computer-executable instructions. When these instructions are executed on a computer, the computer performs the aforementioned data processing method.
[0137] The aforementioned computer-readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory, electrically erasable programmable read-only memory, erasable programmable read-only memory, programmable read-only memory, read-only memory, magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.
[0138] Optionally, a readable storage medium can be coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Alternatively, the readable storage medium can be an integral part of the processor. Both the processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components within the device.
[0139] This application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium. At least one processor can read the computer program from the computer-readable storage medium, and the at least one processor can implement the above-described data processing method when executing the computer program.
[0140] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A data processing method, characterized by, include: After the operating system of the electronic device is detected to be starting, the identifier of the fast device and the identifier of the cache device are obtained from the label of the logical volume LV. The LV corresponds one-to-one with the slow device of the electronic device. The cache device is used to call the fast device to accelerate the slow device. Based on the identifier of the cache device and the identifier of the fast device, the cache device is invoked to pair the fast device with the slow device; Load the cached device after pairing.
2. The method according to claim 1, characterized in that, Retrieve the identifiers of the fast device and the cache device from the LV tag, including: The identifier of the cache device, the identifier of the fast device, and the partition number are obtained from the tag of the LV. The LV and the partition of the slow device have a one-to-one correspondence. Accordingly, the step of invoking the cache device to pair the fast device with the slow device based on the identifier of the cache device and the identifier of the fast device includes: Based on the identifier of the caching device and the identifier of the fast device, the caching device is invoked to pair the partition of the fast device corresponding to the partition number with the partition of the slow device.
3. The method according to claim 1, characterized in that, Before obtaining the identifier of the fast device and the identifier of the cache device from the LV tag after detecting that the operating system of the electronic device has started, the method further includes: Create the LV corresponding to the slow device; According to the pre-acquired configuration file, the identifier of the fast device and the identifier of the cache device are written into the tag of the LV; The cache device is created using the fast device based on the identifier of the fast device and the identifier of the cache device.
4. The method according to claim 2, characterized in that, Before obtaining the identifier of the fast device and the identifier of the cache device from the LV tag after detecting that the operating system of the electronic device has started, the method further includes: Create the LV corresponding to the partition of the slow device; According to the pre-acquired configuration file, the identifier of the cache device, the identifier of the fast device, and the partition number are written into the tag of the LV; The cache device is created using the fast device based on the identifier of the cache device, the identifier of the fast device, and the partition number.
5. The method according to any one of claims 1 to 4, characterized in that, The slow device can be a physical device or a virtual device.
6. The method according to any one of claims 1 to 4, characterized in that, The method further includes: Retrieve the data to be cached; According to the loaded paired cache device, the data to be cached is cached in the slow device or the fast device corresponding to the slow device.
7. A data processing apparatus, characterized in that, include: The acquisition module is used to obtain the identifier of the fast device and the identifier of the cache device from the tags of the logical volume LV after the operating system of the electronic device is detected to be starting. The LV and the slow device of the electronic device are in a one-to-one correspondence. The cache device is used to call the fast device to accelerate the slow device. The processing module is configured to, based on the identifier of the cache device and the identifier of the fast device, invoke the cache device to pair the fast device with the slow device; The loading module is used to load the cached device after pairing processing.
8. The apparatus according to claim 7, characterized in that, The acquisition module is specifically used for: The identifier of the cache device, the identifier of the fast device, and the partition number are obtained from the tag of the LV. The LV and the partition of the slow device have a one-to-one correspondence. Accordingly, the processing module is specifically used for: Based on the identifier of the caching device and the identifier of the fast device, the caching device is invoked to pair the partition of the fast device corresponding to the partition number with the partition of the slow device.
9. An electronic device, comprising: A processor, a memory, and computer program instructions stored in the memory and executable on the processor, characterized in that the processor executes the computer program instructions to implement the data processing method as described in any one of claims 1 to 6.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the data processing method as described in any one of claims 1 to 6.