I / O request forwarding method and apparatus

By generating I/O requests and issuing them to different device queues based on their type and disk partition, virtual devices are established and I/O operations are intercepted in abnormal situations. This solves the security problem of user-stored data in electronic devices and achieves data protection.

CN115237331BActive Publication Date: 2025-10-31HUAWEI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110441363.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-04-23
Publication Date
2025-10-31
Estimated Expiration
2041-04-23

AI Technical Summary

Technical Problem

In existing technologies, electronic devices can access each disk partition of a disk device without taking a snapshot, making it difficult to guarantee the security of user-stored data.

Method used

By generating I/O requests and issuing them to different device queues based on their type and disk partition, virtual devices are established and I/O operations are intercepted in abnormal situations to avoid damage to user-stored data.

Benefits of technology

It improves the security of user-stored data in electronic devices, preventing the loss or damage of user-stored data in abnormal situations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115237331B_ABST
    Figure CN115237331B_ABST
Patent Text Reader

Abstract

This application relates to the field of data storage technology and provides an input / output (I / O) request forwarding method and apparatus. The method includes: generating an I / O request in response to a first operation; determining the type and / or disk partition corresponding to the I / O request; and issuing the I / O request to a queue corresponding to a first device or a queue corresponding to a second device according to the type and / or disk partition corresponding to the I / O request. This method can first intercept the I / O request through the kernel of the operating system, and then issue corresponding bio descriptors to different queues according to the type of the I / O request and the disk partition, thereby improving the security of user-stored data in electronic devices.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data storage technology, and in particular to an input / output (I / O) request forwarding method and apparatus. Background Technology

[0002] A snapshot is a mirror image of a dataset at a specific point in time. Snapshots have a wide range of applications; for example, they can be used to forward I / O requests.

[0003] In related technologies, electronic devices can generate snapshots based on disk partitions of disk devices. When an electronic device detects a triggered operation for writing or reading data, it can generate an I / O request based on the triggered operation and forward the I / O request through the snapshot, thereby avoiding direct access to the disk device.

[0004] However, electronic devices can display the individual disk partitions of a disk device to the user without requiring a snapshot, and can access each disk partition based on user-triggered actions, and trigger I / O operations on each disk partition. Summary of the Invention

[0005] This application provides an I / O request forwarding method and apparatus, which solves the problem in the prior art that electronic devices can access each disk partition of a disk device and trigger I / O operations for each disk partition based on user-triggered operations without using a snapshot.

[0006] To achieve the above objectives, this application adopts the following technical solution:

[0007] Firstly, an input / output I / O request forwarding method is provided, the method comprising:

[0008] In response to the first operation, an I / O request is generated;

[0009] Determine the type and / or disk partition corresponding to the I / O request;

[0010] Based on the type of the I / O request and / or the disk partition, the I / O request is sent to the queue corresponding to the first device or the queue corresponding to the second device.

[0011] In a first possible implementation of the first aspect, the step of issuing the I / O request to the queue corresponding to the first device or the queue corresponding to the second device according to the type of the I / O request includes:

[0012] When the type of the I / O request matches a pre-set type, the amount of I / O data corresponding to the I / O request is determined.

[0013] When the I / O data volume indicates that the I / O request will not write data to the disk device, the I / O request is sent to the queue corresponding to the first device.

[0014] When the I / O data volume indicates that the I / O request will write data to the disk device, the I / O request is sent to the queue corresponding to the second device, or the I / O request is sent to the queue corresponding to the first device or the queue corresponding to the second device according to the disk partition corresponding to the I / O request.

[0015] Based on any of the possible implementations of the first aspect described above, in the second possible implementation of the first aspect, determining the type corresponding to the I / O request includes:

[0016] Determine the operation instruction in the I / O request, the operation instruction being used to represent the I / O operation corresponding to the I / O request;

[0017] The type of the I / O request is determined according to the operation instruction.

[0018] Based on any of the possible implementations of the first aspect described above, in a third possible implementation of the first aspect, the step of issuing the I / O request to the queue corresponding to the first device or the queue corresponding to the second device according to the disk partition corresponding to the I / O request includes:

[0019] Obtain the name information of the disk partition corresponding to the I / O request;

[0020] When the name information indicates that the disk partition is the first partition of the first device, the I / O request is sent to the queue corresponding to the first device.

[0021] When the name information indicates that the disk partition is the second partition of the first device, the I / O request is sent to the queue corresponding to the second device; or, depending on the type of the I / O request, the I / O request is sent to the queue corresponding to the first device or the queue corresponding to the second device.

[0022] Based on the third possible implementation of the first aspect described above, in the fourth possible implementation of the first aspect, obtaining the name information of the disk partition corresponding to the I / O request includes:

[0023] Open the disk partition corresponding to the I / O request according to the I / O request;

[0024] Obtain the name information of the disk partition.

[0025] Based on the fourth possible implementation of the first aspect described above, in the fifth possible implementation of the first aspect, before determining the type and / or disk partition corresponding to the I / O request, the method further includes:

[0026] Back up the disk partition number corresponding to the I / O request in the I / O request;

[0027] The step of opening the disk partition corresponding to the I / O request according to the I / O request includes:

[0028] Based on the backed-up disk partition number, open the disk partition corresponding to the I / O request.

[0029] Based on the fourth or fifth possible implementation of the first aspect described above, in the sixth possible implementation of the first aspect, the method further includes:

[0030] When opening the disk partition corresponding to the I / O request fails, the I / O request is sent to the queue corresponding to the second device, or, depending on the type of the I / O request, the I / O request is sent to the queue corresponding to the first device or the queue corresponding to the second device.

[0031] Based on any of the possible implementations of the first aspect described above, in the seventh possible implementation of the first aspect, before determining the type and / or disk partition corresponding to the I / O request, the method further includes:

[0032] Call the queue function corresponding to the second device to add the I / O request to the queue corresponding to the second device;

[0033] The step of issuing the I / O request to the queue corresponding to the first device or the queue corresponding to the second device according to the type and / or disk partition of the I / O request includes:

[0034] Based on the type and / or disk partition of the I / O request, call the queue function corresponding to the first device to add the I / O request to the queue corresponding to the first device, or keep the I / O request in the queue corresponding to the second device.

[0035] Based on any of the above possible implementations of the first aspect, in the eighth possible implementation of the first aspect, before generating an I / O request in response to a user-triggered operation, the method further includes:

[0036] When an abnormal state of an electronic device is detected, the virtual device is created based on the memory of the electronic device.

[0037] Based on any of the above possible implementations of the first aspect, in the ninth possible implementation of the first aspect, in the general block layer of the operating system of the electronic device, the I / O request is a bio descriptor.

[0038] In a tenth possible implementation of the first aspect, the I / O request is a bio descriptor in the general block layer of the operating system of the electronic device;

[0039] Before generating an I / O request in response to a user-triggered operation, the method further includes:

[0040] When an abnormal state of an electronic device is detected, the second device is created based on the memory of the electronic device;

[0041] Before determining the type and / or disk partition corresponding to the I / O request, the method further includes:

[0042] Call the queue function corresponding to the second device to add the I / O request to the queue corresponding to the second device;

[0043] The step of issuing the I / O request to the queue corresponding to the first device or the queue corresponding to the second device according to the type and / or disk partition of the I / O request includes:

[0044] Based on the type and / or disk partition of the I / O request, call the queue function corresponding to the first device to add the I / O request to the queue corresponding to the first device, or keep the I / O request in the queue corresponding to the second device;

[0045] Determining the type corresponding to the I / O request includes:

[0046] Determine the operation instruction in the I / O request, the operation instruction being used to represent the I / O operation corresponding to the I / O request;

[0047] The type of the I / O request is determined according to the operation instruction;

[0048] The step of issuing the I / O request to the queue corresponding to the first device or the queue corresponding to the second device according to the type of the I / O request includes:

[0049] When the type of the I / O request matches a pre-set type, the amount of I / O data corresponding to the I / O request is determined.

[0050] When the I / O data volume indicates that the I / O request will not write data to the first device, the I / O request is sent to the queue corresponding to the first device.

[0051] When the I / O data volume indicates that the I / O request will write data to the first device, the I / O request is sent to the queue corresponding to the second device; or, based on the disk partition corresponding to the I / O request, the I / O request is sent to the queue corresponding to the first device or the queue corresponding to the second device.

[0052] The step of issuing the I / O request to the queue corresponding to the first device or the queue corresponding to the second device based on the disk partition corresponding to the I / O request includes:

[0053] Obtain the name information of the disk partition corresponding to the I / O request;

[0054] When the name information indicates that the disk partition is the first partition of the first device, the I / O request is sent to the queue corresponding to the first device.

[0055] When the name information indicates that the disk partition is the second partition of the first device, the I / O request is sent to the queue corresponding to the second device; or, depending on the type of the I / O request, the I / O request is sent to the queue corresponding to the first device or the queue corresponding to the second device.

[0056] The step of obtaining the name information of the disk partition corresponding to the I / O request includes:

[0057] Open the disk partition corresponding to the I / O request according to the I / O request;

[0058] Obtain the name information of the disk partition;

[0059] Before determining the type and / or disk partition corresponding to the I / O request, the method further includes:

[0060] Back up the disk partition number corresponding to the I / O request in the I / O request;

[0061] The step of opening the disk partition corresponding to the I / O request according to the I / O request includes:

[0062] Based on the backed-up disk partition number, open the disk partition corresponding to the I / O request;

[0063] The method further includes:

[0064] When opening the disk partition corresponding to the I / O request fails, the I / O request is sent to the queue corresponding to the second device, or, depending on the type of the I / O request, the I / O request is sent to the queue corresponding to the first device or the queue corresponding to the second device.

[0065] Secondly, an input / output I / O request forwarding apparatus is provided, the apparatus comprising:

[0066] The generation module is used to generate an I / O request in response to the first operation;

[0067] The determination module is used to determine the type and / or disk partition corresponding to the I / O request;

[0068] The dispatch module is used to dispatch the I / O request to the queue corresponding to the first device or the queue corresponding to the second device according to the type and / or disk partition of the I / O request.

[0069] In a first possible implementation of the second aspect, the sending module is specifically configured to: determine the I / O data volume corresponding to the I / O request when the type corresponding to the I / O request matches a pre-set type; send the I / O request to the queue corresponding to the first device when the I / O data volume indicates that the I / O request will not write data to the disk device; send the I / O request to the queue corresponding to the second device when the I / O data volume indicates that the I / O request will write data to the disk device; or send the I / O request to the queue corresponding to the first device or the queue corresponding to the second device according to the disk partition corresponding to the I / O request.

[0070] Based on any of the above possible implementations of the second aspect, in the second possible implementation of the second aspect, the determining module is specifically used to determine the operation instruction in the I / O request, the operation instruction being used to represent the I / O operation corresponding to the I / O request; and to determine the type corresponding to the I / O request based on the operation instruction.

[0071] Based on any of the above possible implementations of the second aspect, in the third possible implementation of the second aspect, the sending module is specifically used to obtain the name information of the disk partition corresponding to the I / O request; when the name information indicates that the disk partition is the first partition of the first device, the I / O request is sent to the queue corresponding to the first device; when the name information indicates that the disk partition is the second partition of the first device, the I / O request is sent to the queue corresponding to the second device, or, according to the type corresponding to the I / O request, the I / O request is sent to the queue corresponding to the first device or the queue corresponding to the second device.

[0072] Based on the third possible implementation of the second aspect, in the fourth possible implementation of the second aspect, the sending module is further specifically used to open the disk partition corresponding to the I / O request according to the I / O request; and obtain the name information of the disk partition.

[0073] Based on the fourth possible implementation of the second aspect described above, in the fifth possible implementation of the second aspect, the apparatus further includes:

[0074] The backup module is used to back up the disk partition number corresponding to the I / O request in the I / O request;

[0075] The distribution module is also specifically used to open the disk partition corresponding to the I / O request based on the backed-up disk partition number.

[0076] Based on the fourth or fifth possible implementation of the second aspect, in the sixth possible implementation of the second aspect, the sending module is further specifically used to send the I / O request to the queue corresponding to the second device when opening the disk partition corresponding to the I / O request fails, or to send the I / O request to the queue corresponding to the first device or the queue corresponding to the second device according to the type of the I / O request.

[0077] Based on any of the possible implementations of the second aspect described above, in a seventh possible implementation of the second aspect, the apparatus further includes:

[0078] The calling module is used to call the queue function corresponding to the second device to add the I / O request to the queue corresponding to the second device.

[0079] The dispatch module is specifically used to call the queue function corresponding to the first device according to the type and / or disk partition of the I / O request, to add the I / O request to the queue corresponding to the first device, or to keep the I / O request in the queue corresponding to the second device.

[0080] Based on any of the possible implementations of the second aspect described above, in the eighth possible implementation of the second aspect, the apparatus further includes:

[0081] A module is established to create a virtual device based on the memory of the electronic device when an abnormal state of the electronic device is detected.

[0082] Based on any of the above possible implementations of the second aspect, in the ninth possible implementation of the second aspect, the I / O request is a bio descriptor in the general block layer of the operating system of the electronic device.

[0083] In a tenth possible implementation of the second aspect, the I / O request is a bio descriptor in the general block layer of the operating system of the electronic device;

[0084] The device further includes:

[0085] A module is established to establish the second device based on the memory of the electronic device when an abnormal state of the electronic device is detected.

[0086] The device further includes:

[0087] The calling module is used to call the queue function corresponding to the second device to add the I / O request to the queue corresponding to the second device.

[0088] The delivery module is specifically used to call the queue function corresponding to the first device according to the type and / or disk partition of the I / O request, to add the I / O request to the queue corresponding to the first device, or to keep the I / O request in the queue corresponding to the second device;

[0089] The determining module is specifically used to determine the operation instruction in the I / O request, the operation instruction being used to represent the I / O operation corresponding to the I / O request; and to determine the type corresponding to the I / O request based on the operation instruction.

[0090] The dispatch module is further specifically configured to: determine the I / O data volume corresponding to the I / O request when the type of the I / O request matches a pre-set type; dispatch the I / O request to the queue corresponding to the first device when the I / O data volume indicates that the I / O request will not write data to the first device; dispatch the I / O request to the queue corresponding to the second device when the I / O data volume indicates that the I / O request will write data to the first device; or dispatch the I / O request to the queue corresponding to the first device or the queue corresponding to the second device based on the disk partition corresponding to the I / O request.

[0091] The sending module is further specifically used to obtain the name information of the disk partition corresponding to the I / O request; when the name information indicates that the disk partition is the first partition of the first device, the I / O request is sent to the queue corresponding to the first device; when the name information indicates that the disk partition is the second partition of the first device, the I / O request is sent to the queue corresponding to the second device, or, according to the type of the I / O request, the I / O request is sent to the queue corresponding to the first device or the queue corresponding to the second device.

[0092] The sending module is also specifically used to open the disk partition corresponding to the I / O request according to the I / O request; and obtain the name information of the disk partition;

[0093] The device further includes:

[0094] The backup module is used to back up the disk partition number corresponding to the I / O request in the I / O request;

[0095] The sending module is also specifically used to open the disk partition corresponding to the I / O request based on the backed-up disk partition number;

[0096] The sending module is also specifically used to send the I / O request to the queue corresponding to the second device when opening the disk partition corresponding to the I / O request fails, or to send the I / O request to the queue corresponding to the first device or the queue corresponding to the second device according to the type of the I / O request.

[0097] Thirdly, an electronic device is provided, comprising: a processor for running a computer program stored in a memory to implement the I / O request forwarding method as described in any one of the first aspects.

[0098] Fourthly, a computer-readable storage medium is provided, characterized in that the computer-readable storage medium stores a computer program, which, when executed by a processor, implements the I / O request forwarding method as described in any one of the first aspects.

[0099] Fifthly, a chip system is provided, characterized in that the chip system includes a memory and a processor, the processor executing a computer program stored in the memory to implement the I / O request forwarding method as described in any one of the first aspects.

[0100] The chip system can be a single chip or a chip module composed of multiple chips.

[0101] The I / O request forwarding method and apparatus provided in this application allow an electronic device to establish a virtual device and generate a bio descriptor based on a user-triggered operation, then add the bio descriptor to the queue corresponding to the virtual device. Next, the type of the I / O request corresponding to the bio descriptor and the disk partition corresponding to the I / O request are determined, as well as whether the I / O request will damage the user-stored data in the electronic device. When the I / O request will damage the user-stored data in the electronic device, the electronic device can, through the operating system kernel, retain the bio descriptor in the queue corresponding to the virtual device, so that the I / O operation corresponding to the I / O request will not trigger I / O operations on the user-stored data. When the I / O request will not damage the user-stored data in the electronic device, the electronic device can re-add the bio descriptor to the queue corresponding to the disk device, so that the operating system kernel can trigger the corresponding I / O operation on the disk device based on the I / O request. This allows for the interception of I / O requests by the operating system kernel, and then, based on the type of I / O request and the disk partition, the distribution of corresponding bio descriptors to different queues, thereby improving the security of user-stored data in the electronic device. Attached Figure Description

[0102] Figure 1 This is a system architecture diagram of the kernel architecture of the operating system involved in an I / O request forwarding method provided in an embodiment of this application;

[0103] Figure 2 This is a schematic flowchart illustrating how an operating system kernel architecture forwards I / O requests, as provided in an embodiment of this application.

[0104] Figure 3 This is a schematic flowchart illustrating an I / O request forwarding method provided in an embodiment of this application;

[0105] Figure 4 This is a schematic diagram of an emergency backup interface provided in an embodiment of this application;

[0106] Figure 5 This is a schematic flowchart illustrating how an electronic device identifies a disk partition indicated by an I / O request, as provided in an embodiment of this application.

[0107] Figure 6 This is a structural block diagram of an I / O request forwarding device provided in an embodiment of this application;

[0108] Figure 7 This is a structural block diagram of another I / O request forwarding device provided in the embodiments of this application;

[0109] Figure 8 This is a structural block diagram of another I / O request forwarding device provided in the embodiments of this application;

[0110] Figure 9 This is a structural block diagram of another I / O request forwarding device provided in the embodiments of this application;

[0111] Figure 10 This is a structural block diagram of another I / O request forwarding device provided in the embodiments of this application;

[0112] Figure 11 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0113] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known methods, I / O requests, I / O operations, and electronic devices have been omitted so as not to obscure the description of this application with unnecessary detail.

[0114] The terminology used in the following embodiments is for the purpose of describing particular embodiments only and is not intended to be limiting of this application. As used in the specification and appended claims of this application, the singular expressions “a,” “the,” “the,” and “the” are intended to also include expressions such as “one or more,” unless the context clearly indicates otherwise.

[0115] First, the storage space of the electronic device involved in the embodiments of this application will be introduced. The storage space of the electronic device may include: a first device and a second device.

[0116] Both the first device and the second device can be block devices of electronic devices. Block devices are a type of I / O device used to store data.

[0117] For example, when an electronic device includes both a disk device and a virtual memory disk (ramdisk, hereinafter referred to as a virtual device), the first device can be the disk device of the electronic device, and the second device can be the virtual device of the electronic device; when the electronic device includes a disk device but does not include a virtual device, the first device can be a disk partition of the disk device, and the second device can be another disk partition of the disk device; when the electronic device includes at least two disk devices, the first device can be one disk device of the electronic device, and the second device can be another disk device of the electronic device; when the electronic device includes a virtual device but does not include a disk device, the first device can be a virtual partition of the virtual device, and the second device can be another virtual partition of the virtual device; when the electronic device includes at least two virtual devices, the first device can be one virtual device of the electronic device, and the second device can be another virtual device of the electronic device. The embodiments of this application do not limit the first device and the second device.

[0118] In practical applications, the disk drive of an electronic device can include at least two disk partitions, such as a first partition and a second partition. The first partition is a special partition for the electronic device, used to store system files, logs, and update data. The second partition is a non-special partition for storing data saved by the user on the electronic device. For example, the first partition of the disk drive can be a Design for X (DFX) partition, used to store logs and other data of the electronic device.

[0119] When an electronic device detects an anomaly, it can enter emergency backup mode, allowing the user to back up the data stored in the second partition. After the backup is complete, the electronic device can be restored to factory settings based on user-triggered actions, restoring it to normal operation.

[0120] When an electronic device enters emergency backup mode, the device may damage the data stored in the second partition due to user-inadvertent operations or other reasons, making it impossible to back up the user's stored data and causing data loss.

[0121] Therefore, this application proposes an I / O request forwarding method that can protect user-stored data from damage when the electronic device malfunctions.

[0122] The following explanation uses the example of a disk device of an electronic device as the first device and a virtual device of an electronic device as the second device.

[0123] The following describes the kernel architecture of the operating system involved in the I / O request forwarding method provided in the embodiments of this application. The Linux operating system is used as an example for illustration. See also... Figure 1 , Figure 1 The kernel architecture shown may include: a general block layer 110, a driver layer 120, and a device layer 130.

[0124] The general block layer 110 is used to perform operations such as merging and scheduling I / O requests; the driver layer 120 includes drivers for electronic devices, which are used to convert I / O requests into operations on the registers of electronic devices; the device layer 130 can be a disk device of an electronic device or a virtual device simulated by software.

[0125] When an electronic device detects a user-triggered operation, it can generate a corresponding bio descriptor through the operating system. For example, the electronic device can allocate a bio descriptor for the user-triggered operation through the operating system and initialize the bio descriptor so that the initialized bio descriptor can describe I / O requests.

[0126] The bio descriptor is a data structure in the general block layer 110 used to describe a single I / O request, recording the relevant information necessary for an I / O operation. For example, the bio descriptor may include: the operation type of the I / O operation, that is, whether the I / O operation is a read operation or a write operation, the data cache location of the I / O operation, and the starting sector of the block device for the I / O operation, etc.

[0127] See Figure 2 , Figure 2 This diagram illustrates a schematic flowchart of how the operating system kernel architecture forwards I / O requests. The general block layer 110 can receive I / O requests represented by bio descriptors and identify them. Based on the identification result, it determines whether to send the I / O request through the queue function corresponding to the disk device or the queue function corresponding to the virtual device. This allows the driver layer 120 and device layer 130 to perform I / O operations on the disk device or the virtual device based on the bio descriptor. This enables readable but not writable I / O operations to be performed on the second partition of the disk device, thereby protecting the data stored on the disk device.

[0128] It should be noted that the aforementioned kernel architecture, and the method of forwarding I / O requests through this architecture, can be applied in multiple scenarios. For example, it can be applied in data backup and data protection scenarios. The following example, using an electronic device entering emergency backup mode, illustrates the method by which the electronic device forwards I / O requests, that is, the method by which the electronic device sends the bio descriptor to different queue functions based on the bio descriptor.

[0129] Figure 3 This is a schematic flowchart illustrating an I / O request forwarding method provided in an embodiment of this application. It is intended as an example and not a limitation. This method can be applied to the aforementioned electronic device. See also... Figure 3 The method includes:

[0130] Step 301: Enter emergency backup mode and create a virtual device.

[0131] If an electronic device fails to start normally multiple times, it indicates that the device is in an abnormal state. The device can then enter emergency backup mode, allowing users to back up the data stored on the device and avoid losing the data after restoring the device to factory settings.

[0132] After entering emergency backup mode, an electronic device can create a virtual device based on its memory, so that in subsequent steps, the electronic device can call the queue function corresponding to the virtual device to issue I / O requests.

[0133] Step 302: Generate a bio descriptor based on the first operation triggered by the user.

[0134] After entering emergency backup mode, the electronic device can detect the first operation triggered by the user. If a user-triggered first operation for inputting or outputting data is detected, the electronic device can allocate a new bio descriptor for this first operation through the operating system kernel and set the parameter values ​​of the bio descriptor, thus initializing the bio descriptor. Afterward, the electronic device can send the initialized bio descriptor to the general block layer of the kernel in the operating system, so that the general block layer can perform the corresponding I / O operation based on the bio descriptor.

[0135] For example, if the electronic device is a mobile phone, after detecting multiple abnormal power-on attempts, the phone can enter emergency backup mode and display a message to the user such as... Figure 4 The emergency backup interface shown is available in [link / reference]. Figure 4 The emergency backup interface can include multiple options such as: data backup 401, factory reset 402, reboot 403, and power off 404. When the phone detects that the user has triggered a backup operation on data backup 401, i.e., the first operation is a backup operation, the phone can allocate a bio descriptor for this backup operation, initialize the bio descriptor, and send the initialized bio descriptor to the kernel's general block layer.

[0136] It should be noted that I / O requests from electronic devices can take different forms at different levels of the kernel architecture. For example, at the kernel's general block layer, I / O requests can be represented in the form of bio descriptors; at the driver layer and device layer, I / O requests can be represented in the form of I / O operations. This application does not limit the form of I / O requests.

[0137] Step 303: Back up the disk partition number corresponding to the I / O request in the BIOS descriptor.

[0138] The disk partition number is used to identify each partition on a disk device. For example, an electronic device can partition the disk device based on user-triggered operations, resulting in multiple disk partitions. Each disk partition can correspond to a disk partition number, so that each disk partition can be identified by its own disk partition number.

[0139] When an electronic device performs I / O operations on a disk device through the operating system kernel, the kernel performs the I / O operation on the complete disk device based on the BioDescriptor, and does not perform the I / O operation based on the disk partition number. In subsequent steps, the electronic device needs to determine the disk partition corresponding to the I / O request based on the disk partition number, so that it can issue BioDescriptors using different queue functions based on the determined disk partition. Therefore, after generating the BioDescriptor, the electronic device can back up the disk partition number corresponding to the I / O request within the BioDescriptor.

[0140] For example, electronic devices can add data structures in the BIOS descriptor to back up disk partition numbers.

[0141] Step 304: Add the bio descriptor to the queue using the queue function corresponding to the virtual device.

[0142] After the disk partition number is backed up, the electronic device can first issue a bio descriptor through the queue function corresponding to the virtual device, so that in subsequent steps, the operating system kernel can determine whether the bio descriptor needs to be reissued to the queue corresponding to the disk device.

[0143] For example, the operating system kernel can call the queue function q->make_request_fn corresponding to the virtual device to insert the bio descriptor into the request queue q corresponding to the virtual device.

[0144] Step 305: Identify the type of I / O request.

[0145] I / O requests come in many different types. After an electronic device adds an I / O request to the queue function corresponding to the virtual device, it can first determine the type of the I / O request. Based on the type of the I / O request, it can then determine whether the I / O request needs to be resent to the queue corresponding to the disk device.

[0146] In one possible implementation, the electronic device can acquire the operation instructions included in the bio descriptor, identify the acquired operation instructions, and compare the type corresponding to the operation instructions with preset types to determine whether the type of the I / O request matches the preset types. The operation instructions represent the I / O operation corresponding to the I / O request. Accordingly, the electronic device can determine the type of the I / O request based on the type of the I / O operation.

[0147] When the type of the I / O request matches the preset type, the electronic device can execute step 306; when the type of the I / O request does not match the preset type, the electronic device can execute step 308 to continue to identify other data in the bio descriptor in different ways, thereby determining whether the bio descriptor needs to be reissued.

[0148] For example, the operating system kernel can obtain the operation instructions corresponding to "bi_flags" in the bio descriptor. When "bi_flags" indicates that the operation instruction corresponding to the I / O request is "flush" + "write", it means that the I / O request is used to clear the data cached in the buffer and write it to disk. In this case, the type of I / O request matches the pre-set type, and the electronic device can execute step 306. Among them, the "flush" instruction is used to clear the data in the electronic device's buffer, the "write" instruction is used to write data to the buffer, and the "flush" + "write" instruction is used to clear the data in the buffer and write the data cached in the buffer to disk.

[0149] Step 306: When the type of the I / O request matches the preset type, determine whether the I / O request will write data to the disk device.

[0150] After determining that the type of I / O request matches the pre-set type, the electronic device needs to further determine whether the I / O request will write data to the disk device. That is, whether the I / O request will continue to write data to the disk device in addition to writing the data cached in the buffer to the disk. Based on the judgment result, it can be determined whether the bio descriptor needs to be reissued.

[0151] If the I / O request does not write data to the disk device, the electronic device can execute step 307 to reissue the bio request; if the I / O request does write data to the disk device, the electronic device can execute step 310 to keep the bio descriptor in the queue corresponding to the virtual device.

[0152] For example, the operating system kernel can retrieve the data corresponding to "bi_size" in the bio descriptor. "bi_size" describes the size of the I / O data for the bio descriptor, in bytes. If the data corresponding to "bi_size" indicates that the I / O data size is 0, it can be determined that the I / O request will not write data to the disk device. Accordingly, the operating system kernel can execute step 307. However, if the data corresponding to "bi_size" indicates that the I / O data size is not 0, it can be determined that the I / O request will write data to the disk device. Accordingly, the operating system kernel can execute step 310, causing the bio descriptor to remain in the queue corresponding to the virtual device.

[0153] Step 307: When an I / O request does not write data to the disk device, the bio descriptor is added back to the queue using the queue function corresponding to the disk device.

[0154] Once it is determined that the type of the I / O request matches the pre-set type and that no data will be written to the disk device, the electronic device can reissue the bio descriptor without processing it through the queue corresponding to the virtual device.

[0155] Correspondingly, the operating system kernel can call the queue function corresponding to the disk device to reissue the bio descriptor, so that the bio descriptor is added to the queue corresponding to the disk device, so that the electronic device can perform I / O operations on the disk device according to the bio descriptor.

[0156] The process of adding the BIOS descriptor to the queue corresponding to the disk device in step 307 is similar to the process of adding the BIOS descriptor to the queue corresponding to the virtual device in step 304, and will not be described again here.

[0157] Step 308: When the type of the I / O request does not match the preset type, determine the disk partition indicated by the I / O request.

[0158] When an electronic device determines that the type of an I / O request does not match the preset type, the electronic device can continue to determine the disk partition indicated by the I / O request, and then determine whether it is necessary to resend the bio descriptor to the queue corresponding to the disk device based on the disk partition corresponding to the I / O request.

[0159] In one possible implementation, see Figure 5 , Figure 5 A schematic flowchart is shown, illustrating how an electronic device identifies the disk partition indicated by an I / O request. The electronic device can perform the following steps:

[0160] Step 308a: Determine whether the disk partition number corresponding to the I / O request is 0.

[0161] Step 308b: When the disk partition number is 0, open the corresponding disk partition according to the disk partition number backed up in the BIOS descriptor.

[0162] Step 308c: When the disk partition number is not 0, open the corresponding disk partition according to the original disk partition number.

[0163] Step 308d: When the corresponding disk partition is successfully opened, obtain the name information of the disk partition.

[0164] This name information is used to identify disk partitions. For example, the disk device of an electronic device includes a first partition and a second partition. The disk name corresponding to the first partition is "OS" and the disk name corresponding to the second partition is "DATA". Therefore, the name information of the first partition can be "OS" and the name information of the second partition can be "DATA".

[0165] Step 308e: Determine whether the disk partition corresponding to the I / O request is the first partition of the disk device.

[0166] Step 308f: When the disk partition corresponding to the I / O request is the first partition of the disk device, the electronic device issues the I / O request through the queue function corresponding to the disk device.

[0167] Step 308g: When opening the disk partition corresponding to the I / O request fails, or when the disk partition corresponding to the I / O request is the second partition of the disk device, the bio descriptor is kept in the queue corresponding to the virtual device.

[0168] Step 308f is the same as step 309, and step 308g is the same as step 310. See the following content for details, which will not be repeated here.

[0169] Step 309: When the disk partition corresponding to the I / O request is the first partition of the disk device, the bio descriptor is added back to the queue through the queue function corresponding to the disk device.

[0170] The process of adding the bio descriptor to the queue corresponding to the disk device in step 309 is similar to the process of adding the bio descriptor to the queue corresponding to the disk device in step 307, and will not be described again here.

[0171] Step 310: When an I / O request writes data to a disk device, when opening the disk partition corresponding to the I / O request fails, or when the disk partition corresponding to the I / O request is the second partition of the disk device, retain the bio descriptor in the queue corresponding to the virtual device.

[0172] When an I / O request writes data to a disk device, when the electronic device cannot open the disk partition corresponding to the I / O request, or when the disk partition corresponding to the I / O request is the second partition of the disk device, in order to prevent user-triggered operations from causing deletion, overwriting, or other damage to the data stored by the user in the electronic device, the electronic device can control the bio descriptor to remain in the queue corresponding to the virtual device to prevent I / O operations on the disk device.

[0173] It should be noted that this embodiment of the application uses step 304 as an example, where the electronic device first adds the bio descriptor to the queue through the queue function corresponding to the virtual device. In practical applications, the electronic device may also skip step 304 and instead execute steps 305 to 309, determine the queue to which the bio descriptor needs to be added, and then call the queue function corresponding to the disk device or the queue function corresponding to the virtual device to add the bio descriptor to the corresponding queue.

[0174] Furthermore, this embodiment illustrates a process where the I / O request is first forwarded based on its type, and then forwarded based on the corresponding disk partition. In practical applications, electronic devices can also first determine whether to forward the I / O request based on its disk partition. When forwarding is not required, the electronic device can then determine whether to forward the I / O request based on its type. This embodiment does not limit the order in which the I / O requests are forwarded based on their type and disk partition.

[0175] In summary, the I / O request forwarding method provided in this application involves the electronic device establishing a virtual device after entering emergency backup mode, generating a bio descriptor based on user-triggered operations, and then adding the bio descriptor to the queue corresponding to the virtual device. Next, the type of the I / O request corresponding to the bio descriptor and the disk partition corresponding to the I / O request are determined, as well as whether the I / O request will damage the user-stored data in the electronic device. When the I / O request will damage the user-stored data in the electronic device, the electronic device can retain the bio descriptor in the queue corresponding to the virtual device through the operating system kernel, so that the I / O operation corresponding to the I / O request will not trigger I / O operations on the user-stored data. When the I / O request will not damage the user-stored data in the electronic device, the electronic device can re-add the bio descriptor to the queue corresponding to the disk device, so that the operating system kernel can trigger the corresponding I / O operation on the disk device based on the I / O request. This allows for the interception of I / O requests by the operating system kernel, and then the distribution of corresponding bio descriptors to different queues based on the type of I / O request and the disk partition, thereby improving the security of user-stored data in the electronic device.

[0176] Furthermore, by backing up the disk partition number of the I / O request, the disk partition corresponding to the I / O request can be determined based on the backed-up disk partition number when the operating system kernel performs I / O operations on a complete disk device, thereby improving the efficiency and flexibility of determining the disk partition number.

[0177] Furthermore, by determining the type of I / O request and then further determining the amount of I / O data in the bio descriptor, I / O requests can be further differentiated, thereby identifying I / O requests that will write data to the disk device and improving data security.

[0178] Furthermore, the I / O request forwarding method provided in this application implements the forwarding of I / O requests in the kernel of the operating system and does not implement the recovery function of I / O requests, so that the process of forwarding I / O requests is irreversible and electronic devices cannot write data to some partitions of the disk device, thereby improving data security.

[0179] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution, and the steps in the above embodiments can be deleted or added. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0180] Corresponding to the I / O request forwarding method described in the above embodiments, Figure 6This is a structural block diagram of an I / O request forwarding device provided in an embodiment of this application. For ease of explanation, only the parts related to the embodiment of this application are shown.

[0181] Reference Figure 6 The device includes:

[0182] Generation module 601 is used to generate an I / O request in response to the first operation;

[0183] The determination module 602 is used to determine the type and / or disk partition corresponding to the I / O request;

[0184] The dispatch module 603 is used to dispatch the I / O request to the queue corresponding to the first device or the queue corresponding to the second device according to the type and / or disk partition of the I / O request.

[0185] Optionally, the sending module 603 is specifically used to determine the I / O data volume corresponding to the I / O request when the type corresponding to the I / O request matches a pre-set type; when the I / O data volume indicates that the I / O request will not write data to the disk device, send the I / O request to the queue corresponding to the first device; when the I / O data volume indicates that the I / O request will write data to the disk device, send the I / O request to the queue corresponding to the second device; or, based on the disk partition corresponding to the I / O request, send the I / O request to the queue corresponding to the first device or the queue corresponding to the second device.

[0186] Optionally, the determining module 602 is specifically used to determine the operation instruction in the I / O request, the operation instruction being used to represent the I / O operation corresponding to the I / O request; and to determine the type corresponding to the I / O request based on the operation instruction.

[0187] Optionally, the sending module 603 is specifically used to obtain the name information of the disk partition corresponding to the I / O request; when the name information indicates that the disk partition is the first partition of the first device, the I / O request is sent to the queue corresponding to the first device; when the name information indicates that the disk partition is the second partition of the first device, the I / O request is sent to the queue corresponding to the second device, or, depending on the type of the I / O request, the I / O request is sent to the queue corresponding to the first device or the queue corresponding to the second device.

[0188] Optionally, the sending module 603 is also specifically used to open the disk partition corresponding to the I / O request according to the I / O request; and to obtain the name information of the disk partition.

[0189] Optional, see Figure 7 The device also includes:

[0190] Backup module 604 is used to back up the disk partition number corresponding to the I / O request in the I / O request;

[0191] The distribution module 603 is also specifically used to open the disk partition corresponding to the I / O request based on the backed-up disk partition number.

[0192] Optionally, the sending module 603 is further configured to send the I / O request to the queue corresponding to the second device when the disk partition corresponding to the I / O request fails to be started, or to send the I / O request to the queue corresponding to the first device or the queue corresponding to the second device according to the type of the I / O request.

[0193] Optional, see Figure 8 The device also includes:

[0194] Module 605 is used to call the queue function corresponding to the second device to add the I / O request to the queue corresponding to the second device.

[0195] The dispatch module 603 is specifically used to call the queue function corresponding to the first device according to the type and / or disk partition of the I / O request, to add the I / O request to the queue corresponding to the first device, or to keep the I / O request in the queue corresponding to the second device.

[0196] Optional, see Figure 9 The device also includes:

[0197] Module 606 is used to create a virtual device based on the memory of an electronic device when an abnormal state of the electronic device is detected.

[0198] Optionally, in the general block layer of the electronic device's operating system, the I / O request is a bio descriptor.

[0199] Optionally, in the general block layer of the electronic device's operating system, the I / O request is a bio descriptor;

[0200] See Figure 10 The device also includes:

[0201] A module 606 is established to establish the second device based on the memory of the electronic device when an abnormal state of the electronic device is detected.

[0202] The device also includes:

[0203] Module 605 is used to call the queue function corresponding to the second device to add the I / O request to the queue corresponding to the second device.

[0204] The distribution module 603 is specifically used to call the queue function corresponding to the first device according to the type and / or disk partition of the I / O request, to add the I / O request to the queue corresponding to the first device, or to keep the I / O request in the queue corresponding to the second device.

[0205] The determining module 602 is specifically used to determine the operation instruction in the I / O request, the operation instruction being used to represent the I / O operation corresponding to the I / O request; and to determine the type of the I / O request based on the operation instruction.

[0206] The issuing module 603 is further specifically used to determine the I / O data volume corresponding to the I / O request when the type corresponding to the I / O request matches a pre-set type; when the I / O data volume indicates that the I / O request will not write data to the first device, issue the I / O request to the queue corresponding to the first device; when the I / O data volume indicates that the I / O request will write data to the first device, issue the I / O request to the queue corresponding to the second device, or issue the I / O request to the queue corresponding to the first device or the queue corresponding to the second device according to the disk partition corresponding to the I / O request;

[0207] The sending module 603 is further specifically used to obtain the name information of the disk partition corresponding to the I / O request; when the name information indicates that the disk partition is the first partition of the first device, the I / O request is sent to the queue corresponding to the first device; when the name information indicates that the disk partition is the second partition of the first device, the I / O request is sent to the queue corresponding to the second device, or, according to the type of the I / O request, the I / O request is sent to the queue corresponding to the first device or the queue corresponding to the second device.

[0208] The sending module 603 is also specifically used to open the disk partition corresponding to the I / O request according to the I / O request; and to obtain the name information of the disk partition;

[0209] The device also includes:

[0210] Backup module 604 is used to back up the disk partition number corresponding to the I / O request in the I / O request;

[0211] The issuing module 603 is also specifically used to open the disk partition corresponding to the I / O request based on the backed-up disk partition number;

[0212] The sending module 603 is also specifically used to send the I / O request to the queue corresponding to the second device when opening the disk partition corresponding to the I / O request fails, or to send the I / O request to the queue corresponding to the first device or the queue corresponding to the second device according to the type of the I / O request.

[0213] In summary, the I / O request forwarding device provided in this application allows the electronic device to establish a virtual device after entering emergency backup mode. Based on user-triggered operations, a bio descriptor is generated and added to the queue corresponding to the virtual device. Subsequently, the type of the I / O request corresponding to the bio descriptor and the disk partition corresponding to the I / O request are determined, as well as whether the I / O request will damage the user-stored data in the electronic device. When the I / O request will damage the user-stored data, the electronic device can retain the bio descriptor in the queue corresponding to the virtual device through the operating system kernel, preventing the I / O operation corresponding to the I / O request from triggering I / O operations on the user-stored data. When the I / O request will not damage the user-stored data, the electronic device can re-add the bio descriptor to the queue corresponding to the disk device, so that the operating system kernel can trigger the corresponding I / O operation on the disk device based on the I / O request. This allows the operating system kernel to intercept I / O requests first, and then, based on the type of I / O request and the disk partition, issue corresponding bio descriptors to different queues, thereby improving the security of user-stored data in the electronic device.

[0214] The following describes the electronic device involved in the embodiments of this application. Please refer to... Figure 11 , Figure 11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.

[0215] The electronic device may include a processor 1110, an external memory interface 1120, an internal memory 1121, a universal serial bus (USB) interface 1130, a charging management module 1140, a power management module 1141, a battery 1142, an antenna 1, an antenna 2, a mobile communication module 1150, a wireless communication module 1160, an audio module 1170, a speaker 1170A, a receiver 1170B, a microphone 1170C, a headphone jack 1170D, a sensor module 1180, buttons 1190, a motor 1191, an indicator 1192, a camera 1193, a display screen 1194, and a subscriber identification module (SIM) card interface 1195, etc. The sensor module 1180 may include a pressure sensor 1180A, a gyroscope sensor 1180B, a barometric pressure sensor 1180C, a magnetic sensor 1180D, an accelerometer sensor 1180E, a distance sensor 1180F, a proximity sensor 1180G, a fingerprint sensor 1180H, a temperature sensor 1180J, a touch sensor 1180K, an ambient light sensor 1180L, a bone conduction sensor 1180M, etc.

[0216] It is understood that the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the electronic device. In other embodiments of this application, the electronic device may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0217] For example, the above Figures 6 to 10 The generation module 601, determination module 602, distribution module 603, backup module 604, and calling module 605 shown can be used as... Figure 11 The processor 1110 of the electronic device shown; the above Figures 6 to 10 The establishment module 606 shown can be used for Figure 11 The internal memory 1121 of the electronic device shown.

[0218] Processor 1110 may include one or more processing units, such as: application processor (AP), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, memory, video codec, digital signal processor (DSP), baseband processor, and / or neural network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0219] The controller can serve as the nerve center and command center of an electronic device. Based on the instruction opcode and timing signals, the controller generates operation control signals to control the fetching and execution of instructions.

[0220] The processor 1110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 1110 is a cache memory. This memory can store instructions or data that the processor 1110 has just used or that are used repeatedly. If the processor 1110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 1110, and thus improves the efficiency of the system.

[0221] In some embodiments, the processor 1110 may include one or more interfaces. Interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0222] The USB 1130 interface conforms to the USB standard specification, specifically including Mini USB, Micro USB, and USB Type-C interfaces. The USB 1130 interface can be used to connect a charger to charge electronic devices, and also for data transfer between electronic devices and peripherals. It can also be used to connect headphones for audio playback. This interface can also be used to connect other electronic devices, such as AR devices.

[0223] It is understood that the interface connection relationships between the modules illustrated in the embodiments of the present invention are merely illustrative and do not constitute a limitation on the structure of the electronic device. In other embodiments of this application, the electronic device may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.

[0224] The wireless communication function of the electronic device can be implemented through antenna 1, antenna 2, mobile communication module 1150, wireless communication module 1160, modem processor and baseband processor, etc.

[0225] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device can be used to cover one or more communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with a tuning switch.

[0226] The mobile communication module 1150 can provide solutions for wireless communication applications including 2G / 3G / 4G / 5G in electronic devices. The mobile communication module 1150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 1150 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 1150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 1. In some embodiments, at least some functional modules of the mobile communication module 1150 may be housed in processor 1110. In some embodiments, at least some functional modules of the mobile communication module 1150 and at least some modules of the processor 1110 may be housed in the same device.

[0227] The modem processor may include a modulator and a demodulator. The modulator modulates the low-frequency baseband signal to be transmitted into a mid-to-high frequency signal. The demodulator demodulates the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After processing by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs sound signals through an audio device (not limited to speaker 1170A, receiver 1170B, etc.) or displays images or videos through the display screen 1194. In some embodiments, the modem processor may be a separate device. In other embodiments, the modem processor may be independent of the processor 1110 and may be housed in the same device as the mobile communication module 1150 or other functional modules.

[0228] The wireless communication module 1160 can provide solutions for wireless communication applications in electronic devices, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. The wireless communication module 1160 can be one or more devices integrating at least one communication processing module. The wireless communication module 1160 receives electromagnetic waves via antenna 2, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to processor 1110. The wireless communication module 1160 can also receive signals to be transmitted from processor 1110, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2.

[0229] In some embodiments, antenna 1 of the electronic device is coupled to mobile communication module 1150, and antenna 2 is coupled to wireless communication module 1160, enabling the electronic device to communicate with networks and other devices via wireless communication technology. The wireless communication technology may include Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time-Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technologies. The GNSS may include Global Positioning System (GPS), Global Navigation Satellite System (GLONASS), BeiDou Navigation Satellite System (BDS), Quasi-Zenith Satellite System (QZSS), and / or Satellite Based Augmentation Systems (SBAS).

[0230] Electronic devices implement display functions through a GPU, a display screen 1194, and an application processor. The GPU is a microprocessor for image processing, connecting the display screen 1194 and the application processor. The GPU performs mathematical and geometric calculations for graphics rendering. The processor 1110 may include one or more GPUs, which execute program instructions to generate or modify display information.

[0231] Display screen 1194 is used to display images, videos, etc. Display screen 1194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a Mini LED, a MicroLED, a Micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device may include one or N displays 1194, where N is a positive integer greater than 1.

[0232] The external storage interface 1120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device. The external memory card communicates with the processor 1110 through the external storage interface 1120 to perform data storage functions. For example, music, video, and other files can be saved on the external memory card.

[0233] Internal memory 1121 can be used to store computer executable program code, which includes instructions. Processor 1110 executes various functional applications and data processing of the electronic device by running the instructions stored in internal memory 1121. Internal memory 1121 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback, image playback, etc.), etc. The data storage area may store data created during the use of the electronic device (such as audio data, phonebook, etc.). Furthermore, internal memory 1121 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.

[0234] Pressure sensor 1180A is used to sense pressure signals and convert them into electrical signals. In some embodiments, pressure sensor 1180A can be disposed on display screen 1194. There are many types of pressure sensors 1180A, such as resistive pressure sensors, inductive pressure sensors, and capacitive pressure sensors. A capacitive pressure sensor may include at least two parallel plates with conductive material. When force is applied to pressure sensor 1180A, the capacitance between the electrodes changes. The electronic device determines the pressure intensity based on the change in capacitance. When a touch operation is applied to display screen 1194, the electronic device detects the intensity of the touch operation based on pressure sensor 1180A. The electronic device can also calculate the touch position based on the detection signal from pressure sensor 1180A. In some embodiments, touch operations applied to the same touch position but with different touch operation intensities can correspond to different operation commands. For example, when a touch operation with an intensity less than a first pressure threshold is applied to the SMS application icon, a command to view an SMS is executed. When a touch operation with an intensity greater than or equal to the first pressure threshold is applied to the SMS application icon, a command to create a new SMS is executed.

[0235] The gyroscope sensor 1180B can be used to determine the motion attitude of an electronic device. In some embodiments, the gyroscope sensor 1180B can determine the angular velocity of the electronic device around three axes (i.e., the x, y, and z axes). The gyroscope sensor 1180B can be used for image stabilization. For example, when the shutter is pressed, the gyroscope sensor 1180B detects the angle of the electronic device's shake, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to counteract the shake of the electronic device by moving in the opposite direction, thus achieving image stabilization. The gyroscope sensor 1180B can also be used in navigation and motion-sensing gaming scenarios.

[0236] Touch sensor 1180K, also known as a "touch panel," can be located on display screen 1194. The touch sensor 1180K and display screen 1194 together form a touchscreen, also known as a "touchscreen." Touch sensor 1180K detects touch operations applied to or near it. The touch sensor can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through display screen 1194. In other embodiments, touch sensor 1180K may also be located on the surface of the electronic device, in a different position than display screen 1194.

[0237] Buttons 1190 include a power button, volume buttons, etc. Buttons 1190 can be mechanical buttons or touch-sensitive buttons. The electronic device can receive button input and generate key signal inputs related to user settings and function control of the electronic device.

[0238] Motor 1191 can generate vibration alerts. Motor 1191 can be used for incoming call vibration alerts or for touch vibration feedback. For example, different vibration feedback effects can correspond to touch operations performed on different applications (such as taking photos, playing audio, etc.). Motor 1191 can also correspond to different vibration feedback effects for touch operations performed on different areas of the display screen 1194. Different application scenarios (such as time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also be customized.

[0239] Indicator 1192 can be an indicator light, which can be used to indicate charging status, power changes, messages, missed calls, notifications, etc.

[0240] The SIM card interface 1195 is used to connect a SIM card. The SIM card can be inserted into or removed from the SIM card interface 1195 to achieve contact and separation with the electronic device. The electronic device can support one or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 1195 can support Nano SIM cards, Micro SIM cards, SIM cards, etc. Multiple cards can be inserted into the same SIM card interface 1195 simultaneously. The multiple cards can be of the same or different types. The SIM card interface 1195 is also compatible with different types of SIM cards. The SIM card interface 1195 is also compatible with external memory cards. The electronic device interacts with the network through the SIM card to achieve functions such as calls and data communication. In some embodiments, the electronic device uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the electronic device and cannot be separated from it.

[0241] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0242] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0243] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0244] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between devices or units through some interfaces, and may be electrical, mechanical, or other forms.

[0245] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0246] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0247] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include at least: any entity or device capable of carrying computer program code to an electronic device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.

[0248] Finally, it should be noted that the above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. An input / output I / O request forwarding method, characterized in that, The method includes: In response to the first operation, an I / O request is generated; Obtain the name information of the disk partition corresponding to the I / O request; When the name information indicates that the disk partition is the first partition of the first device, the I / O request is sent to the queue corresponding to the first device. The first device is a disk device, and the first partition is used to store the system files, logs and update data of the electronic device. When the name information indicates that the disk partition is the second partition of the first device, the I / O request is sent to the queue corresponding to the second device, which is a virtual memory disk, and the second partition is used to store data saved by the user in the electronic device.

2. The method according to claim 1, characterized in that, The step of obtaining the name information of the disk partition corresponding to the I / O request includes: Open the disk partition corresponding to the I / O request according to the I / O request; Obtain the name information of the disk partition.

3. The method according to claim 2, characterized in that, Before determining the disk partition corresponding to the I / O request, the method further includes: Back up the disk partition number corresponding to the I / O request in the I / O request; The step of opening the disk partition corresponding to the I / O request according to the I / O request includes: Based on the backed-up disk partition number, open the disk partition corresponding to the I / O request.

4. The method according to claim 2 or 3, characterized in that, The method further includes: When opening the disk partition corresponding to the I / O request fails, the I / O request is sent to the queue corresponding to the second device.

5. The method according to any one of claims 1 to 4, characterized in that, Before issuing the I / O request to the queue corresponding to the first device, the method further includes: Call the queue function corresponding to the second device to add the I / O request to the queue corresponding to the second device; Sending the I / O request to the queue corresponding to the first device includes: Call the queue function corresponding to the first device to add the I / O request to the queue corresponding to the first device; Sending the I / O request to the queue corresponding to the second device includes: The I / O request is retained in the queue corresponding to the second device.

6. The method according to any one of claims 1 to 5, characterized in that, In the general block layer of the operating system of an electronic device, the I / O request is a bio descriptor.

7. The method according to any one of claims 1-6, characterized in that, The step of obtaining the name information of the disk partition corresponding to the I / O request includes: When the type of the I / O request does not match the preset type, the name information of the disk partition is obtained.

8. The method as described in claim 7, characterized in that, The method further includes: When the type of the I / O request matches the pre-set type, it is determined whether the I / O request will write data to the disk device; When the I / O request does not write data to the disk device, the I / O request is sent to the queue corresponding to the first device. When the I / O request writes data to the disk device, the I / O request is sent to the queue corresponding to the second device.

9. The method as described in claim 8, characterized in that, Determining whether the I / O request will write data to the disk device includes: Obtain the amount of I / O data corresponding to the I / O request; Based on the amount of I / O data, determine whether the I / O request will write data to the disk device.

10. An electronic device, characterized in that, include: A processor for running a computer program stored in a memory to implement the I / O request forwarding method as described in any one of claims 1 to 9.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the I / O request forwarding method as described in any one of claims 1 to 9.

12. A chip system, characterized in that, The chip system includes a memory and a processor, the processor executing a computer program stored in the memory to implement the I / O request forwarding method as described in any one of claims 1 to 9.

Citation Information

Patent Citations

  • System starting method and apparatus, electronic device and storage medium

    CN108763099A

  • Data processing method, network equipment, computing node and system

    CN111865831A