Partition management method and equipment
By adjusting the partition structure on the storage device, setting some system partitions at the tail of the user data partition, and merging or adjusting the partition table, the problem of insufficient system partition size is solved, improving the success rate of system software updates and reducing system overhead.
Patent Information
- Application Number
- CN202310700273.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-13
- Publication Date
- 2024-12-13
AI Technical Summary
The size of the system partition in the existing storage device is not enough to accommodate the updated system software, resulting in the failure of system software update. How to effectively manage the system partition to meet the updated system software needs?
By setting some system partitions at the end of the user data partition, merging or adjusting the partition table to expand the size of the system partition, ensuring that the system partition can meet the updated system software needs and reducing the time and system overhead of expanding the system partition.
It increases the probability of successful system software updates, reduces the time-consuming and system overhead of expanding system partitions, and avoids the risks of modifying the start address of user data partitions.
Smart Images

Figure CN119127058A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of storage technology, and in particular to a partition management method and device. Background Art
[0002] Partitioning is an important means of dividing storage devices (such as disks) into areas. A storage device can be divided into several areas by information such as the starting address and size. The divided areas are called partitions. Different partitions can be used to store different data.
[0003] At present, the partitions on the storage device include system partitions and user data partitions. The system partition can be used to store system software data, etc., and the user data partition can be used to store data generated by the user when using the storage device. The system partition is usually set at the head of the storage device, and the user data partition is usually set at the tail of the storage device. With the update of the system software, the data size of the system software may exceed the space size of the corresponding system partition, thereby causing the system software update to fail. Therefore, how to manage the system partition so that the size of the system partition can meet the system software update is a problem that needs to be solved. Summary of the invention
[0004] The present application provides a partition management method and device, which can expand the size of a system partition so that the size of the system partition can meet the needs of updated system software, thereby increasing the probability of successful system software update.
[0005] In order to achieve the above objectives, this application adopts the following technical solutions:
[0006] In a first aspect, a partition management method is provided, the method comprising: obtaining a request message, the request message being used to read and write partitions included in a storage device, the partitions comprising a user data partition and multiple system partitions, the system partition being used to store a first type of data, the user data partition being used to store a second type of data, the system partition comprising a first system partition and a second system partition, the first system partition being arranged in front of the user data partition, and the second system partition being arranged behind the user data partition; determining a target partition included in the storage device according to the request message; and reading and writing the target partition.
[0007] The first type of data and the second type of data are different types of data.
[0008] Based on the above technical solution, compared with setting all system partitions in front of the user data partition, setting part of the system partitions behind the user data partition is equivalent to dividing the space occupied by the part of the rear system partition to the front system partition, that is, expanding the space size of the system partition located in front of the user data. In this way, if the software in these front system partitions is updated, the size of the system partition can meet the updated system software, thereby increasing the probability of successful system software update.
[0009] In a possible design, before the acquisition request message is sent, the first system partition and the second system partition are both set in front of the user data partition; the method further includes: when the space of the first system partition is insufficient, merging part or all of the space of the second system partition set in front of the user data partition into the space of the first system partition; and setting the second system partition behind the user data partition. Based on this design, the second system partition set in front of the user data partition is set behind the user data partition, and then the free space in front of the user data partition is allocated to the first system partition, so as to achieve the purpose of expanding the size of the system partition. Moreover, when the space of the first system partition is insufficient, executing this process again can save system overhead.
[0010] In a possible design, the starting address of the user data partition remains unchanged; the setting of the second system partition behind the user data partition includes: setting the first space of the user data partition as the second system partition, the first space including the continuous free space at the end of the user data partition. Based on this design, the starting address of the user data partition is not modified, and thus the storage address of all data in the user data partition does not need to be modified. Only the end address of the user data partition needs to be modified, which can reduce the risk of modifying the storage address of all data in the user data partition, and can also reduce the time and system overhead of expanding the system partition. In addition, the continuous free space at the end of the user data partition is allocated to the second system partition, which can facilitate the reading and writing of data in the second system partition.
[0011] In a possible design, the first space is greater than or equal to the second system partition. Based on this design, the continuous space whose tail of the user data partition is greater than the second system partition is re-divided into the second system partition, which is equivalent to expanding the space size of the second system partition. In this way, when the space of the second system partition is insufficient, the purpose of expanding the space of the second system partition can also be achieved. The continuous space whose tail of the user data partition is equal to the second system partition is re-divided into the second system partition, which can ensure that there is enough space for data in the second system partition to be stored.
[0012] In one possible design, before setting the first space of the user data partition as the second system partition, the method also includes: if user data is stored in the first space, moving the user data to the second space of the user data partition for storage, the second space being different from the first space, and the second space being free space in the user data partition.
[0013] Based on this design, when data is stored in the continuous free space at the end of the user data partition, the data in the space is moved to other free spaces in the user data partition, so as to achieve the purpose of obtaining the continuous free space at the end of the user data partition, so as to allocate this part of the space to the second system partition. In this way, the starting address of the user data partition is not changed, and only the ending address of the user data partition and the storage address of the moved data need to be modified, that is, the address of the user data partition and the addresses of all the data stored in the user data partition do not need to be adjusted, which can reduce the time consumption and system overhead of expanding the system partition and reduce the risk of modifying the storage address of the data in the user data partition.
[0014] In a possible design, the first space of the user data partition is set as the second system partition by updating the size of the user data partition and the start address and end address of the second system partition included in the partition table, the partition table corresponds to the storage device, and the partition table is used to index the partitions included in the storage device. Based on this design, the purpose of setting the system partition behind the user data partition can be achieved by modifying the size of the user data partition, the start address and end address of the second system partition, etc., included in the partition table corresponding to the storage device.
[0015] In a possible design, the starting address of the updated second system partition is determined according to the size of the storage device and the size of the first space; the size of the updated user data partition is determined according to the starting address of the user data partition and the starting address of the updated second system partition. Based on this design, since the sizes of different storage devices are different, the starting addresses of the system partitions set behind the user data partitions are also different. In this way, by determining the starting address of the second system partition according to the size of the storage device and the size of the first space, the accuracy of the obtained starting address of the second system partition can be improved, and thus the accuracy of the obtained user data partition size can be improved.
[0016] In a possible design, the method further includes: when the space of the second system partition is insufficient, merging the third space of the user data partition into the space of the second system partition, the third space including the continuous free space at the end of the user data partition. Based on this design, when the space of the system partition set behind the user data partition is insufficient, the continuous free space at the end of the user data partition is further allocated to the system partition, and when the size of the system partition to be expanded is reached, the starting address of the user data partition does not need to be changed, and only the end address of the user data partition and the storage address of the moved data need to be modified, that is, the address of the user data partition and the addresses of all data stored in the user data partition do not need to be adjusted completely, which can reduce the risk of modifying the storage address of data in the user data partition while reducing the time consumption and system overhead of expanding the system partition.
[0017] In a possible design, before merging the third space of the user data partition into the space of the second system partition, the method further includes: if the third space stores user data, moving the user data to the fourth space of the user data partition for storage, the fourth space is different from the third space, and the fourth space is the free space in the user data partition. Based on this design, when data is stored in the continuous free space at the end of the user data partition, the data in the space is moved to other free spaces of the user data partition, so as to achieve the purpose of obtaining the continuous free space at the end of the user data partition, so as to allocate this part of the space to the second system partition with insufficient space. In this way, when the purpose of expanding the size of the second system partition is achieved, the starting address of the user data partition is not changed, and only the ending address of the user data partition and the storage address of the moved data need to be modified, that is, the address of the user data partition and the addresses of all the data stored in the user data partition do not need to be adjusted completely, which can reduce the risk of modifying the storage address of the data in the user data partition while reducing the time consumption and system overhead of expanding the system partition.
[0018] In a possible design, before obtaining the request message, the method further includes: obtaining a partition table, the partition table including at least one parameter of the starting address and the ending address of the second system partition and the size of the user data partition; and determining whether to update the at least one parameter according to the size of the storage device. Based on this design, since different storage devices may correspond to different partition tables, the starting address and the ending address of the second system partition, the size of the user data partition, etc. included in the storage table are corrected based on the actual size of the storage device, so that the partition table can be adapted to the actual size of the storage device, thereby ensuring the read and write performance of the storage device.
[0019] In a second aspect, a device is provided, which has the function of implementing the method described in the first aspect and any one of the designs thereof. The function can be implemented by hardware, or by hardware executing corresponding software implementation. The hardware or software includes one or more modules corresponding to the above functions. In a possible example, the device includes an acquisition unit (or acquisition module) and a processing unit (or processing module); the acquisition unit is used to obtain a request message, the request message is used to read and write a partition included in a storage device, the partition includes a user data partition and multiple system partitions, the system partition is used to store a first type of data, the user data partition is used to store a second type of data, the system partition includes a first system partition and a second system partition, the first system partition is set in front of the user data partition, and the second system partition is set behind the user data partition; the processing unit is used to determine the target partition included in the storage device according to the request message; the processing unit is also used to read and write the target partition.
[0020] In one possible design, the first system partition and the second system partition are both arranged in front of the user data partition; the processing unit is further used to merge part or all of the space of the second system partition arranged in front of the user data partition into the space of the first system partition when the space of the first system partition is insufficient; the processing unit is also used to arrange the second system partition behind the user data partition.
[0021] In one possible design, the starting address of the user data partition remains unchanged; the processing unit is specifically used to set the first space of the user data partition as the second system partition, and the first space includes the continuous free space at the end of the user data partition.
[0022] In one possible design, the first space is larger than or equal to the second system partition.
[0023] In one possible design, the processing unit is also used to move the user data to the second space of the user data partition for storage if the user data is stored in the first space, where the second space is different from the first space and is free space in the user data partition.
[0024] In one possible design, the first space of the user data partition is set to the second system partition by updating the size of the user data partition included in the partition table, as well as the starting address and the ending address of the second system partition. The partition table corresponds to the storage device, and the partition table is used to index the partitions included in the storage device.
[0025] In one possible design, the starting address of the updated second system partition is determined according to the size of the storage device and the size of the first space; the size of the updated user data partition is determined according to the starting address of the user data partition and the starting address of the updated second system partition.
[0026] In one possible design, the processing unit is further used to merge the third space of the user data partition into the space of the second system partition when the space of the second system partition is insufficient, and the third space includes continuous free space at the end of the user data partition.
[0027] In one possible design, the processing unit is also used to move user data to the fourth space of the user data partition for storage if the user data is stored in the third space; the fourth space is different from the third space, and the fourth space is free space in the user data partition.
[0028] In one possible design, the acquisition unit is also used to obtain a partition table, which includes a starting address and an ending address of the second system partition and at least one parameter of the size of the user data partition; the processing unit is also used to determine whether to update the at least one parameter based on the size of the storage device.
[0029] In a third aspect, a device is provided, comprising a processor and a memory, wherein the memory is coupled to the processor, the memory is used to store computer program code, the computer program code comprises computer instructions, and the processor reads the computer instructions from the memory so that the device executes the method described in the first aspect and any one of the designs thereof.
[0030] In one possible design, the device further includes a communication interface, which can be used for the device to communicate with other devices. Exemplarily, the communication interface can be a transceiver, an input / output interface, an interface circuit, an output circuit, an input circuit, a pin or a related circuit, etc.
[0031] In a fourth aspect, a computer-readable storage medium is provided, which includes a computer program or instructions. When the computer program or instructions are run on a device, the device executes the method described in the first aspect and any one of the designs thereof.
[0032] In a fifth aspect, a computer program product is provided. When the computer program product is run on a computer, the computer can execute the method described in the first aspect and any one of the designs thereof.
[0033] According to a sixth aspect, a circuit system is provided, the circuit system comprising a processing circuit, wherein the processing circuit is configured to execute the method described in any one of the designs of the first aspect.
[0034] In the seventh aspect, a chip system is provided, comprising at least one processor and at least one interface circuit, wherein the at least one interface circuit is used to perform transceiver functions and send instructions to at least one processor, and when the at least one processor executes the instructions, the at least one processor executes the method described in the first aspect and any one of the designs thereof.
[0035] It should be noted that the technical effects brought about by any design in the above-mentioned second to seventh aspects can refer to the technical effects brought about by the corresponding design in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 It is a structural diagram of an existing GPT;
[0037] Figure 2 A schematic diagram of the architecture of a file system provided in an embodiment of the present application;
[0038] Figure 3 It is a structural diagram of an existing partition;
[0039] Figure 4 The following is a schematic diagram of the architecture of an existing file system;
[0040] Figure 5 A schematic diagram of an existing interface for adjusting the size of a system partition;
[0041] Figure 6 A schematic diagram of the structure of a device provided in an embodiment of the present application;
[0042] Figure 7 A schematic diagram of the architecture of a centralized storage system provided in an embodiment of the present application;
[0043] Figure 8 A schematic diagram of the structure of another device provided in an embodiment of the present application;
[0044] Fig. 9 A software structure diagram of a device provided in an embodiment of the present application;
[0045] Fig.10 A schematic diagram of a scenario for moving data in a user data partition provided in an embodiment of the present application;
[0046] Fig.11 A schematic diagram of a partition structure provided in an embodiment of the present application;
[0047] Fig.12a A schematic diagram of a partition management method provided in an embodiment of the present application;
[0048] Figure 12bA schematic diagram of another partition management method provided in an embodiment of the present application;
[0049] Fig.13 A schematic diagram of a scenario for updating a partition table provided in an embodiment of the present application;
[0050] Fig.14 A flowchart of a partition management method provided in an embodiment of the present application;
[0051] Fig.15 A flowchart of another partition management method provided in an embodiment of the present application;
[0052] Fig.16 A flowchart of another partition management method provided in an embodiment of the present application;
[0053] Fig.17 A schematic diagram of the structure of another device provided in an embodiment of the present application;
[0054] Fig.18 A schematic diagram of the structure of a chip system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0055] In the description of this application, unless otherwise specified, " / " indicates that the objects associated with each other are in an "or" relationship, for example, A / B can represent A or B; "and / or" in this application is merely a description of the association relationship between associated objects, indicating that three relationships may exist, for example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural.
[0056] In the description of this application, unless otherwise specified, "plurality" means two or more than two. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can mean: a, b, c, a and b, a and c, b and c, a and b and c, where a, b, and c can be single or multiple.
[0057] In addition, in order to clearly describe the technical solutions of the embodiments of the present application, in the embodiments of the present application, words such as "first" and "second" are used to distinguish the same items or similar items with substantially the same functions and effects. Those skilled in the art can understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit the difference.
[0058] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete way for easy understanding.
[0059] The features, structures or characteristics in this application may be combined in one or more embodiments in any suitable manner. In various embodiments of this application, the size of the sequence number of each process does not mean the order of execution. 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.
[0060] Some optional features in the embodiments of the present application may be implemented independently in some scenarios without relying on other features to solve corresponding technical problems and achieve corresponding effects. They may also be combined with other features in some scenarios as needed.
[0061] In this application, unless otherwise specified, the same or similar parts between the various embodiments can refer to each other. In each embodiment of this application, if there is no special description and logical conflict, the terms and / or descriptions between different embodiments are consistent and can be referenced to each other, and the technical features in different embodiments can be combined to form new embodiments according to their inherent logical relationships. The implementation methods of this application do not constitute a limitation on the scope of protection of this application.
[0062] In addition, the network architecture and business scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Ordinary technicians in this field can know that with the evolution of network architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0063] It can be understood that the embodiment of the present application takes the partition structure of a storage device divided into a system partition and a user data partition, where the system partition is used to store system software data and the user data partition is used to store data generated by the user in the process of using the storage device as an example. The technical solution provided in the embodiment of the present application is also applicable to a partition architecture in which a storage device is divided into two different types of partitions, and the two different types of partitions are respectively used to store different types of data. It can also be understood that the name of the partition does not constitute a limitation on its function.
[0064] To facilitate understanding, the technical terms and related concepts that may be involved in the embodiments of the present application are first introduced below.
[0065] 1. Partition
[0066] Partitioning is an important means of dividing storage devices (such as disks) into areas. A storage device can be divided into several areas by information such as the starting address and size. The divided areas are called partitions. Different partitions can be used to store different data.
[0067] In some partition architectures, the partitions on the storage device include a system partition and a user data partition. The system partition can be used to store data of system software, and the data of these system software can be used to implement some system functions. For example, the system partition can include a FASTBOOT partition, an NV partition, a MODEM partition, a KERNEL partition, a SYSTEM partition, a VENDOR partition, a PRODUCT partition, etc. Among them, the data stored in the FASTBOOT partition can be used for device system startup, etc. In some embodiments, the device can be a device with the above-mentioned storage device installed. The NV partition is used to store some information of the device, such as radio frequency parameters, etc. The data stored in the MODEM partition can be used for the device to implement communication functions. The KERNEL partition can be used to store the image file of the system kernel. The SYSTEM partition, the VENDOR partition, and the PRODUCT partition can be used to store data related to the upper operating system, such as pre-installed applications, executable programs, system services, etc.
[0068] The user data partition can be used to store data generated when the user uses the storage device.
[0069] 2. Partition table
[0070] The partition table is the framework that supports the normal operation of storage devices (such as disks, etc.). The storage device can be divided into several partitions through the partition table, and the partition table can be used to record the relevant information of each partition. Optionally, the partition table can be stored in the header of the storage device.
[0071] Currently, the types of partition tables include master boot record (MBR) partition table and GUID partition table (GPT). Among them, MBR partition table, as the partition table corresponding to the traditional partition scheme, stores partition information in 64 bytes in the first sector of the storage device, and can represent a limited number of partitions on the storage device.
[0072] GPT is a partition table corresponding to the new partition scheme. It divides the storage device into logical block addresses (LBA) and records partition information. Compared with MBR, GPT can represent more partitions on the storage device.
[0073] For example, Figure 1FIG. 1 shows a schematic diagram of the structure of an existing GPT. Figure 1 As shown in the figure, the GPT header LBA0 stores the MBR of the traditional partition scheme, which can be called the protective MBR. LBA1 is the primary GPT header, which stores the available space of the storage device, the size and number of items that make up the partition table, etc. LBA2-LBA33 store partition table items, and a partition table item is used to represent the information of a partition, such as partition type, start address, end address, partition name, partition attributes, etc. LBA33 and later stores the data of each partition, such as the data of partition 1, the data of partition 2, and so on.
[0074] 3. File system
[0075] The file system is the method and data structure used by the device's operating system to explicitly store files on the device partitions. The file system is a structured form of data file storage and organization. For example, Figure 2 A schematic diagram of the structure of a file system provided in an embodiment of the present application is shown.
[0076] All data in a computer are 0s and 1s. A series of 01 combinations stored on hardware media is completely indistinguishable and unmanageable for a computer. Therefore, computers use the concept of "files" to organize these data. Data for the same purpose is organized into different types of files according to the structure required by different applications. Different suffixes are usually used to refer to different types, and then the computer gives each file a name that is easy to understand and remember.
[0077] When there are many files, the computer divides them into several groups (such as Figure 2 Each group of files is placed in the same directory (or folder, such as Figure 2 In addition to files, there can also be sub-directories (called sub-directories or sub-folders) under the directory, and all files and directories form a tree structure. This tree structure has a special name: file system. There are many types of file systems, the common ones are FAT / FAT32 / NTFS in Windows, EXT2 / EXT3 / EXT4 / XFS / BtrFS in Linux, etc.
[0078] Generally, a file system consists of two parts: meta data and file data. Meta data includes the attribute information of the file system itself, such as the file system type, size, and index of the file data stored in the file system. File data is the actual content of the files stored in the file system.
[0079] In the current partitioning scheme, the system partition is set at the head of the storage device, and the user data partition is set at the tail of the storage device. In some scenarios, the storage device may have different configuration versions. The capacity of the storage devices with different configuration versions may be different, and the set partition size may also be different. However, to ensure the reliability of the data in the user data partition, the starting address (or starting position on the storage device) of the user data partition is the same on storage devices with different configurations.
[0080] For example, the capacity of a low-configuration storage device is 128 gigabytes (GB, abbreviated as G), the capacity of a high-configuration storage device is 256G, and the system partition includes a FASTBOOT partition, an NV partition, a MODEM partition, a KERNEL partition, a SYSTEM partition, a VENDOR partition, a PRODUCT partition, etc. Figure 3 A schematic diagram of the structure of an existing partition is shown.
[0081] in, Figure 3 (1) is a schematic diagram of the structure of the partitions set on a 128G storage device. Figure 3 (2) is a schematic diagram of the structure of the partitions set on a 256G storage device. Figure 3 (1) and Figure 3 As shown in (2), the system partition is set at the head of the storage device, and the user data partition is set at the tail of the storage device. The starting address of the user data partition on the 128G storage device is the same as the starting address on the 256G storage device, but the size of the user data partition is different, such as the size of the user data partition on the 128G storage device is smaller than the size of the user data partition on the 256G storage device.
[0082] During the use of the device, the system software in the device may be updated to provide users with a better experience. As the system software is updated, the system software data may exceed the size of the corresponding system partition. Figure 3 Taking the image file in the MODEM partition as an example, the image file becomes larger due to the system software corresponding to the image file being updated, and the size of the MODEM partition may not be enough to store the enlarged image file. This may cause the system software update to fail, that is, the system software cannot be updated in time, thereby affecting the user's experience.
[0083] In an existing solution, when setting the above-mentioned system partition, the requirements for system software updates are met by reserving space for the system partition. For example: when setting a certain system partition, a portion of free space is reserved in the system partition. Alternatively, a portion of free space is reserved on the storage device, and when the size of the system partition is insufficient, this portion of the reserved free space is used as the space of the system partition. In this solution, since it is impossible to estimate the data size of the updated system software, the reserved free space may still be insufficient, or too much free space may be reserved, resulting in a reduction in the space for storing user data, affecting the user experience.
[0084] Another solution is to solve the above problem by evolving the hierarchical file system plus (HFS+) into the Apple file system (APFS), and providing the storage area runtime sharing capability provided by APFS. The storage area runtime sharing capability refers to: adding a virtual volume management layer, a partition can have multiple virtual volumes, and the space of the partition can be allocated to any of the multiple virtual volumes.
[0085] For example, Figure 4 (1) is a schematic diagram of the structure of an existing HFS+. Figure 4 As shown in (1), one partition corresponds to one virtual volume, and the space of the partition can only be allocated to the corresponding virtual volume. For example, the space of partition 1 can be allocated to virtual volume 1, and the space of partition 2 can be allocated to virtual volume 2. Figure 4 (2) is a schematic diagram of the structure of an existing APFS file system. Figure 4 As shown in (2), a partition corresponds to multiple virtual volumes, and the space of the partition can be allocated to the multiple virtual volumes. For example, the space of partition 3 can be allocated to virtual volume 3 and virtual volume 4 at the same time.
[0086] In this solution, the added virtual volume management layer will cause performance loss during operation.
[0087] In another solution, the above technical problem is solved by adjusting the sizes of the system partition and the user data partition under the architecture of non-isolation of the system partition and the user data partition. It can be understood that the architecture of non-isolation of the system partition and the user data partition means that the system partition and the user data partition may store data generated by the user in the process of using the device and the data of the system software at the same time. For example, Figure 5 FIG. 1 shows a schematic diagram of an existing interface for adjusting the size of a system partition. Figure 5As shown, the adjustment interface 500 of a partition includes an adjustment button 501 and an adjustment button 502. The size of the corresponding partition can be adjusted by dragging the adjustment button 501 and / or the adjustment button 502 left and right. The adjustment interface 500 can also include one or more adjustment options, such as partition size 503, available space in front of the partition 504, available space behind the partition 505, etc. The size of the partition can also be adjusted through these adjustment options.
[0088] First, this solution is not suitable for a partition structure where the system partition is isolated from the user data partition, that is, a partition structure where the system partition is only used to store system software data, and the user data partition is only used to store data generated by the user during the use of the device. In addition, this solution requires the user to adjust the size of the system partition and / or the size of the user data partition, which is cumbersome. In addition, in the process of adjusting the partition size, the user may modify the starting address of the user data partition, which will require the storage addresses of all data stored in the user data partition to be recalculated and refreshed. This process is time-consuming and has a large system overhead.
[0089] Based on this, an embodiment of the present application provides a partition management method, which can expand the size of the system partition by setting part of the system partition at the tail position of the storage device, so that the size of the system partition can meet the needs of the updated system software, thereby increasing the probability of successful system software update, and at the same time reducing the time consumption of expanding the system partition and reducing system overhead.
[0090] The technical solution provided in the embodiment of the present application can be applied to the device 600, or to a system including the device 600.
[0091] For example, device 600 may be an embedded device, a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, as well as various types of terminal devices such as a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) device, a virtual reality (VR) device, an artificial intelligence (AI) device, a wearable device, an in-vehicle device, a smart home device and / or a smart city device.
[0092] For another example, device 600 may be a network device, such as a Node B (NB), a baseband unit (BBU), an access point (AP) in a wireless fidelity (WIFI) system, a wireless relay node, a wireless backhaul node, a transmission point (TP) or a transmission / receiption point (TRP), etc. It may also be 5G, such as a gNB in an NR system, or a transmission point (TRP or TP), or a network node constituting a gNB or a transmission point, such as a baseband unit (BBU) or a distributed unit (DU), etc. It may also be a satellite, etc.
[0093] For another example, the device 600 in the present application may be a module, a module group, a component, or a chip, etc., which is built into any device as one or more components or units.
[0094] In some embodiments, the device 600 may be a fixed device or a portable device.
[0095] Optionally, the operating system installed on the device 600 includes but is not limited to Or other operating systems. This application does not limit the specific type of device 600 and the installed operating system.
[0096] For example, taking the device 600 as a mobile phone, Figure 6 A schematic diagram of the structure of a device 600 provided in an embodiment of the present application is shown.
[0097] like Figure 6 As shown, the device 600 may include a processor 610, a storage device 620, a universal serial bus (USB) interface 630, a charging management module 640, a power management module 641, a battery 642, an antenna 1, an antenna 2, a mobile communication module 650, a wireless communication module 660, an audio module 670, a sensor module 680, a button 690, a motor 691, an indicator 692, a camera 693, a display screen 694, and a subscriber identification module (SIM) card interface 695, etc.
[0098] The processor 610 may include one or more processing units, for example, the processor 610 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0099] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.
[0100] The processor 610 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 610 is a cache memory. The memory may store instructions or data that the processor 610 has just used or cyclically used. If the processor 610 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 610, and thus improves the efficiency of the system.
[0101] In some embodiments, processor 610 may include one or more interfaces.
[0102] The charging management module 640 is used to receive charging input from a charger, where the charger can be a wireless charger or a wired charger.
[0103] The power management module 641 is used to connect the battery 642, the charging management module 640 and the processor 610. The power management module 641 receives input from the battery 642 and / or the charging management module 640 to power the processor 610, the storage device 620, the display screen 694, the camera 693, and the wireless communication module 660.
[0104] The wireless communication function of the device 600 can be implemented through antenna 1, antenna 2, mobile communication module 650, wireless communication module 660, modem processor and baseband processor.
[0105] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in device 600 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0106] The mobile communication module 650 may provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the device 600. The mobile communication module 650 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc.
[0107] The wireless communication module 660 can provide wireless communication solutions applied on the device 600, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication technology (NFC), infrared technology (IR), etc.
[0108] In some embodiments, antenna 1 of device 600 is coupled to mobile communication module 650, and antenna 2 is coupled to wireless communication module 660, so that device 600 can communicate with the network and other devices through wireless communication technology.
[0109] The device 600 implements the display function through a GPU, a display screen 694, and an application processor, etc. The display screen 694 is used to display images, videos, etc. The display screen 694 includes a display panel. The camera 693 is used to capture static images or videos.
[0110] The storage device 620 can be used to store computer executable program codes, and the executable program codes include instructions. The storage device 620 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the device 600 (such as audio data, a phone book, etc.), etc. In some embodiments, the storage device 620 and the device 600 may be integrated together, such as the storage device 620 may be a module, a module, a component, or a chip built into the device 600 as one or more components or units. In other embodiments, the storage device 620 may be independently set up separately from the device 600.
[0111] Exemplarily, the storage device 620 may be a memory in which various system partitions are separated from user data partitions. For example, the storage device 620 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), a mechanical hard disk (HDD), a solid state drive (SSD), a shingled magnetic recording (SMR) disk, or an SSD supporting a zoned namespace (ZNS), or other memory, such as a persistent memory (PMEM), etc. The processor 610 executes various functional applications and data processing of the device 600 by running instructions stored in the storage device 620 and / or instructions stored in a memory provided in the processor.
[0112] In some embodiments of the present application, the device 600 can divide the storage device 620 into different partitions by means of a partition table, and different partitions are used to store different data. In some embodiments, the storage device 620 may include a system partition and a user data partition, such as the system partition may be the above-mentioned storage program area, and the user data partition may be the above-mentioned storage data area.
[0113] Optionally, in the embodiment of the present application, the storage system used by the device 600 and the like may be a centralized storage system or a distributed storage system. Among them, the centralized storage system is characterized by having a unified entrance, and all data from external devices must pass through this entrance, and this entrance is the engine of the centralized storage system. The engine is the core component of the centralized storage system, and many advanced functions of the storage system are implemented in it.
[0114] For example, Figure 7 A schematic diagram of the architecture of a centralized storage system provided in an embodiment of the present application is shown.
[0115] like Figure 7 As shown, the engine 121 may have one or more controllers. Figure 7 The example of the engine 121 including one controller is used for explanation. In a possible example, if the engine 121 has multiple controllers, any two controllers may have a mirror channel to achieve the function of any two controllers backing up each other, thereby preventing the entire device 600 from being unavailable due to hardware failure.
[0116] The engine 121 further includes a front-end interface 1211 and a back-end interface 1214, wherein the front-end interface 1211 is used to communicate with other devices, and the back-end interface 1214 is used to communicate with the storage device 620 to expand the capacity of the device 600. Through the back-end interface 1214, the engine 121 can connect more storage devices 620, thereby forming a very large storage resource pool.
[0117] In hardware, such as Figure 7 As shown, the controller includes at least a processor 1212 and a memory 1213. The processor 1212 is a central processing unit (CPU) for processing data access requests from outside the device 600 (server or other storage system), and also for processing requests generated inside the device 600. For an introduction to the processor 1212, please refer to the introduction to the processor 610 described above.
[0118] Exemplarily, when the processor 1212 receives write data requests sent by other devices through the front-end interface 1211, the data in these write data requests will be temporarily stored in the memory 1213. When the total amount of data in the memory 1213 reaches a certain threshold, the processor 1212 sends the data stored in the memory 1213 to the storage device 620 through the back-end port for persistent storage. Figure 7 In the example, the storage device 620 includes a hard disk drive (HDD) 1221, a hard disk 1222, a solid state drive (SSD) 1223 or other hard disks 1224.
[0119] Memory 1213 refers to an internal memory that directly exchanges data with the processor. It can read and write data at any time and at a very high speed. It serves as a temporary data storage for the operating system or other running programs. Memory includes at least two types of memories. For example, memory can be either a random access memory, such as DRAM, or SCM, or a read-only memory (ROM). In practical applications, multiple memories 1213 and different types of memories 1213 can be configured in the controller. This embodiment does not limit the number and type of memory 1213. In addition, memory 1213 can be configured to have a power-saving function. The power-saving function means that when the system loses power and then powers on again, the data stored in memory 1213 will not be lost. Memory with a power-saving function is called a non-volatile memory.
[0120] The memory 1213 stores software programs, and the processor 1212 runs the software programs in the memory 1213 to manage the memory 620 .
[0121] in addition, Figure 7 Only one engine 121 is shown in the figure. However, in actual applications, the storage system may include two or more engines 121, and redundancy or load balancing is performed between the multiple engines 121.
[0122] The audio module 670 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signal. The button 690 includes a power button, a volume button, etc. The button 690 can be a mechanical button or a touch button.
[0123] Motor 691 can generate vibration prompts.
[0124] Indicator 692 can be an indicator light, which can be used to indicate the charging status, power change, and can also be used to indicate messages, missed calls, notifications, etc.
[0125] The SIM card interface 695 is used to connect a SIM card.
[0126] For example, the above only uses a mobile phone as an example to illustrate the structure of the device 600 in the embodiment of the present application, but does not constitute a limitation on the structure and form of the device 600. The embodiment of the present application does not limit the structure and form of the device 600. For example, Figure 8 Another exemplary structure of the device 600 is shown. Figure 8 As shown, the device 600 includes: a processor 801, a memory 802, and a transceiver 803. The implementation of the processor 801 and the memory 802 can be found in Figure 6The processor and storage device shown are implemented as shown. The transceiver 803 can be used for the device 600 to interact with other devices (such as electronic devices). The transceiver 803 can be based on devices such as Wi-Fi, Bluetooth or other communication protocols.
[0127] It is understood that the structure shown in the embodiment of the present application does not constitute a specific limitation on the device 600. In other embodiments of the present application, the device 600 may include Figure 6 , Figure 8 More or fewer components are shown, or some components are combined, or some components are separated, or different component arrangements are arranged. The components shown in the figure can be implemented in hardware, software, or a combination of software and hardware.
[0128] In some embodiments, the software architecture of the device 600 may adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the layered architecture as an example to exemplify the software structure of the device 600.
[0129] Fig. 9 A software structure block diagram of a device 600 provided in an embodiment of the present application is shown.
[0130] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the software structure of the device 600 may include three layers, namely, storage device, file system layer and business software layer from bottom to top.
[0131] In some embodiments, the storage device may be divided into different partitions, and different partitions may be used to store different data. Exemplarily, these partitions may include a system partition and a user data partition. For an introduction to the system partition and the user data partition, reference may be made to the above description.
[0132] In some embodiments of the present application, part of the system partition may be arranged in front of the user data partition, and part of the system partition may be arranged behind the user data partition (not shown in the figure).
[0133] In some embodiments, the storage device may include a partition table, which may be used to record relevant information of each partition. Optionally, the partition table may be stored in the header of the storage device. Currently, the partition table may also be stored in other locations of the storage device, which is not limited in the embodiments of the present application.
[0134] The file system layer can be used to manage files on the storage device. In some embodiments, the file system layer can include one or more file systems, such as file system 1, file system 2, etc. In some embodiments, different partitions can correspond to different file systems, and each file system can manage the data in the corresponding partition.
[0135] In some embodiments, the file system (such as file system 2) corresponding to the user data partition may include a data migration module, and the data migration module may migrate the data stored later in the user data partition to the free space at the front of the user data partition. For example, the data migration module may store the data stored later in the user data partition at the front position in the user data partition by determining the storage address of the data stored later in the user data partition.
[0136] As a specific implementation, the data migration module can move the data in the user data partition based on the garbage collection (GC) function included in the log-structured feature of the file system. Among them, the GC function can be used to reclaim the free space (such as invalid blocks) in the user data partition. The data migration module can perform targeted migration of the data stored in the user data partition based on the GC function, such as moving the data stored at the tail position of the user data partition to the free space (such as invalid blocks) in front of the user data partition, and then in the case of realizing the recovery of the free space in the user data partition, the space at the tail position of the user data partition can also be freed up.
[0137] In some embodiments, the data migration module may also be used to modify the address range of the user data partition managed by the file system, thereby achieving the purpose of modifying the size of the user data partition.
[0138] It is understood that the above embodiment takes the data migration module as an example in which the data migration module is located in the file system corresponding to the user data partition. In other embodiments, the data migration module may also be directly located in the file system layer, and the embodiment of the present application does not limit the specific location of the data migration module. In other embodiments, the data migration module may also be called a garbage collection (GC) module. It is understood that the name does not constitute a limitation on the function.
[0139] For example, Fig.10 FIG. 1 shows a schematic diagram of a scenario for moving data in a user data partition provided by an embodiment of the present application. Fig.10 As shown in (1), the data migration module can move data 1, data 2, data 3, etc. to the locations of area 1, area 2, and area 3 of the user data partition respectively. In response to the migration operation, the data storage status of the user data partition can be as follows: Fig.10 As shown in (2).
[0140] Optionally, after the data migration module migrates the data in the user data partition, the data in the user data partition may be stored continuously or may not be stored continuously.
[0141] Furthermore, the data migration module can also modify the address management range of the file system corresponding to the user data partition. Fig.10 For example, if the address management range of the file system corresponding to the user data partition shown in (1) is from address a to address c, if the data migration module deletes address b to address c from the address management range of the file system, the address management range of the file system becomes from address a to address b. Correspondingly, the size of the user data partition becomes Fig.10 The size shown in (3).
[0142] The business software layer may include various types of business software. Exemplarily, these business software may include but are not limited to system software and application software. Exemplarily, system software may include but are not limited to pre-installed applications, executable programs, system services, etc. of the device 600. Among them, pre-installed applications may refer to applications that have been installed on the device 600 before leaving the factory. Application software may refer to software and programs installed by the user in the process of using the device 600 after the device 600 leaves the factory, as well as data generated in the process of using the system software, etc. For example, application software includes but is not limited to third-party applications, executable programs, user data (such as phone books, text messages, videos, photos, messages), etc.
[0143] In some embodiments, data of different types of business software may be stored in different partitions, such as data of system software may be stored in the above-mentioned system partition, and data of application software may be stored in the above-mentioned user data partition.
[0144] In some embodiments of the present application, when the system software of the service software layer is updated, if it is determined that the space of the system partition for storing the system software data on the storage device is insufficient to store the updated system software data, the system partition size can be expanded by modifying the parameters of the system partition stored in the partition table on the storage device, such as size, start address, end address, etc. And / or, the data in the user data partition is moved by the data migration module in the file system layer to allocate the free space of the user data partition to the aforementioned insufficient system partition, so as to expand the size of the system partition.
[0145] Understandably, Fig. 9The architecture shown is only schematic, and is only used as a logical architecture. In actual implementation, the architecture may be divided in other ways, such as including more or fewer levels. The system architecture of the device 600 may also be divided into functional modules, and each functional module may be divided according to each function. Two or more functions may also be integrated into one processing unit. The integrated unit may be implemented in the form of hardware or in the form of software functional modules.
[0146] The technical solutions involved in the following embodiments can all have the following features: Figure 6 , Figure 8 , Fig. 9 The present invention is implemented in a device with the structure shown in the figure.
[0147] It is understood that in the following embodiments, device 600 is a mobile phone and storage device 620 is a storage device. It is also understood that the execution subject of the partition management method provided in the embodiment of the present application can be a mobile phone or a processor in the mobile phone, such as a chip.
[0148] The embodiment of the present application provides a partition management method, which sets part of the system partition located at the head of the storage device to the tail of the storage device. In this way, the size of the system partition can be expanded. If the system software stored in the system partition is updated, the size of the system partition can meet the updated system software, thereby increasing the probability of successful system software update.
[0149] In some embodiments, part or all of the first type of system partitions located in the front of the storage device may be set at the tail of the storage device. The second type of system partitions located in the front of the storage device may still be set at the head of the storage device. Optionally, the number of the first type of system partitions and the number of the second type of system partitions may both be one or more.
[0150] The first type of system partition may be a partition used for mobile phone operation, such as but not limited to NV partition, MODEM partition, KERNEL partition, SYSTEM partition, VENDOR partition, PRODUCT partition, etc. It can be understood that the data in the first type of system partition is the data that needs to be loaded when the mobile phone is running. Setting the first type of system partition at the end of the storage device will not affect the startup of the mobile phone.
[0151] The second type of system partition can be a partition used for mobile phone startup, power-on completion, and partition table parsing, etc., such as including but not limited to XLOADER partition, FASTBOOT partition, etc. Among them, the XLOADER partition can be located at the starting address of the storage device (such as address 0), and the XLOADER partition can be used to perform some initialization operations on the storage device, such as parsing the partition table to obtain the address of the FASTBOOT partition, and then loading and starting the FASTBOOT partition, and completing the subsequent mobile phone startup process by the FASTBOOT partition. Of course, the addresses of other partitions on the storage device can also be obtained by parsing the partition table. It can be understood that the data in the second type of system partition is the data that needs to be loaded when the mobile phone is started. Since the location of each partition on the storage device cannot be determined when the mobile phone is started, the data will be loaded from the head of the storage device for execution. In this way, the second type of system partition is still set at the head of the storage device to facilitate the loading of data when the mobile phone is started, so as to complete the successful startup of the mobile phone, such as the power-on process. And by loading the second type of system partition to parse the partition table, the addresses of other partitions on the storage device can be obtained, so as to facilitate the subsequent loading of data of each partition when the mobile phone is running.
[0152] In a specific embodiment, part or all of the first type of system partition may be set at the end of the storage device. It is understood that setting at the end of the storage device may mean that the end address of the storage device is the end address of a first type of system partition.
[0153] For example, the first type of system partition includes NV partition, MODEM partition, KERNEL partition, SYSTEM partition, VENDOR partition, and PRODUCT partition, and the second type of system partition includes FASTBOOT partition. Fig.11 (1) shows a schematic diagram of a storage device partition structure provided by an embodiment of the present application. Fig.11 As shown in (1), the FASTBOOT partition, NV partition, MODEM partition, and KERNEL partition are set at the head of the storage device, and the SYSTEM partition, VENDOR partition, and PRODUCT partition are set at the very end of the storage device, wherein the end address of the PRODUCT partition is the end address of the storage device.
[0154] In another specific embodiment, part or all of the first type of system partition may be specifically set at a position of a preset size away from the end of the storage device. It can be understood that the position of a preset size away from the end of the storage device may refer to a position of a preset size away from the end address of the storage device as the end address of a first type of system partition. Optionally, the preset size may be set by the developer according to actual needs, and the embodiment of the present application does not limit this.
[0155] For example, it is still taken that the first type of system partition includes NV partition, MODEM partition, KERNEL partition, SYSTEM partition, VENDOR partition, and PRODUCT partition, and the second type of system partition includes FASTBOOT partition. Fig.11 (2) shows a schematic diagram of the structure of another storage device partition provided by an embodiment of the present application. Fig.11 As shown in (2), the FASTBOOT partition, NV partition, MODEM partition, and KERNEL partition are set at the head of the storage device, and the SYSTEM partition, VENDOR partition, and PRODUCT partition are set at a position at a preset size away from the end of the storage device, wherein the end address of the PRODUCT partition is a position at a preset size away from the end address of the storage device.
[0156] In some scenarios, before a mobile phone leaves the factory, it uses Fig.11 The partition structure shown.
[0157] In this scenario, in some embodiments, the size of each system partition may be preset. In other embodiments, the size of each system partition may be determined based on the growth of data stored in the system partition. For example, if the data stored in a system partition grows more and / or the data grows more frequently, the system partition may be set larger. If the storage device of a system partition grows less and / or the data grows less frequently, the system partition may be set smaller.
[0158] In other scenarios, before the mobile phone leaves the factory, it uses Figure 3 In this scenario, in order to make the size of the system partition sufficient for the updated system software and improve the probability of successful system software update, the mobile phone can Figure 3 The partition structure shown is converted to something like Fig.11The partition structure shown. For example, a mobile phone can set part of the system partition located in the storage device to the end of the storage device by modifying the index of the system partition and the user data partition in the partition table, such as the starting address, the ending address, the partition size, etc. of the partition. In some embodiments, after modifying the index of the user data partition, it is also necessary to modify the address management range of the file system corresponding to the user data partition, so that the address range managed by the file system corresponding to the user data partition is the address range of the modified user data partition.
[0159] It can be understood that in this scenario, for the system partitions still set at the head of the storage device, the positions of some system partitions may not change, while the positions of some system partitions may change. Figure 3 The structure of the partition shown is converted into Fig.11 After the partition structure shown in (1) is changed, the positions of the KERNEL partition and the MODEM partition are changed, such as the starting address of the KERNEL partition is changed, the ending address of the MODEM partition is changed, etc., while the positions of the FASTBOOT partition, NV partition, etc. are not changed.
[0160] Optionally, the positions of system partitions that are still set at the head of the storage device may also be changed. Optionally, whether the position of a system partition that is still set at the head of the storage device is changed can be determined based on the growth of data in the storage device in the system partition and / or the growth of data in other system partitions that are still stored in the head of the storage device. For example, if the data stored in a system partition grows more and / or the data grows more frequently, the system partition can be expanded and other system partitions can be reduced. If the data in the storage device in a system partition grows less and / or the data grows less frequently, the system partition can be reduced and other system partitions can be expanded, etc.
[0161] In some embodiments, the system partition may be insufficient because the system software stored in the system partition may be updated from time to time, and the size of the system partition may not be sufficient to store the updated system software. Figure 3 The partition structure shown is converted to something like Fig.11 Before the partition structure shown, the mobile phone can also first determine whether the space of several system partitions set at the head of the storage device is insufficient. If it is determined that the space of some or all system partitions is insufficient, the above conversion operation is performed. On the contrary, if it is determined that the space of all system partitions is sufficient, the mobile phone may not perform the above conversion operation. In this way, the system overhead of the mobile phone can be saved while improving the probability of successful system software upgrade.
[0162] Optionally, in this embodiment, the mobile phone can adjust the system partition that does not have insufficient space to the end of the storage device, and keep the system partition that has insufficient space at the head of the storage device. In this way, the head of the storage device can have more free space to be re-partitioned to the system partition with insufficient space, so as to achieve the purpose of expanding the system partition with insufficient space.
[0163] In this embodiment, combined Figure 3 In the partition structure shown in (1), taking the system partitions with insufficient space as SYSTEM partition and VENDOR partition as an example, the mobile phone can set one or more system partitions with sufficient space at the end of the storage device. Fig.12a As shown, the phone can Fig.12a The PRODUCT partition shown in (1) is set at the end of the storage device, and the free space at the head of the storage device is allocated to the SYSTEM partition, VENDOR partition, etc. Fig.12a The partition structure shown in (2).
[0164] Combination Figure 12b In the partition structure shown in (1), taking the system partitions with insufficient space as SYSTEM partition and PRODUCT partition as an example, the mobile phone can set one or more system partitions with sufficient space at the end of the storage device. Figure 12b The PRELOAD partition shown in (1) is set at the end of the storage device, and the free space at the head of the storage device is allocated to the SYSTEM partition, PRODUCT partition, etc. Figure 12b The partition structure shown in (2) is about Figure 12b For the functional introduction of each partition, please refer to the introduction in the relevant technology, which will not be repeated in this article.
[0165] In some embodiments, one or more system partitions located after the system partition with insufficient space can be set at the end of the storage device. In this way, the modification of the address of the system partition set at the head of the storage device can be reduced, saving the system overhead of the mobile phone. Fig.12a In the example shown in (2), only the end address of the SYSTEM partition and the start and end addresses of the VENDOR partition are modified. There is no need to modify the addresses of other system partitions that are still set at the head of the storage device, such as the FASTBOOT partition, NV partition, MODEM partition, KERNEL partition, etc.
[0166] Optionally, the location of the system partition that is still located at the head of the storage device but does not have insufficient space may be changed or not changed. Fig.12a (2) is based on the example of no change. Figure 12b(2) is an example of change, and this application does not limit this.
[0167] In other embodiments, one or more system partitions located before the system partition where insufficient space occurs may also be set at the tail position of the storage device.
[0168] In some scenarios, since the tail position of the storage device is occupied by the user data partition, the system partition is set at the tail position of the storage device, that is, part of the space of the user data partition is reallocated to the system partition. Fig.12a As shown in (3), part of the space in the user data partition needs to be allocated to the PRODUCT partition. Figure 12b As shown in (3), part of the space of the user data partition needs to be allocated to the PRELOAD partition.
[0169] In a specific embodiment, the tail free space of the user data partition may be allocated to the system partition located at the tail position of the storage device.
[0170] In some scenarios, since data may be stored at the later position in the user data partition, such as the continuous free space behind the user data partition is smaller than the required space size of the system partition to be set at the tail position of the storage device. It can be understood that the required space size of the system partition can be the actual size of the system partition, or it can be larger or smaller than the actual size of the system partition. At this time, the later data in these user data partitions can be moved to the earlier free space in the user data partition. For example, the mobile phone can specifically implement this operation through the data migration module described above. This makes it easier to reallocate part of the space of the user data partition to the system partition set at the tail position of the storage device.
[0171] In this way, the starting address of the user data partition does not need to be changed, and only the end address of the user data partition and the storage address of the moved data need to be modified. It is not necessary to adjust the addresses of all the user data partitions and the addresses of all the data stored in the user data partitions, which can reduce the time and system overhead of expanding the system partition and reduce the risk of modifying the storage address of the data in the user data partition.
[0172] In some embodiments, the location, size, etc. of the system partition and / or the user data partition can be adjusted by modifying the corresponding parameters of the system partition and / or the user data partition in the partition table. Exemplarily, the parameters in the partition table may include, but are not limited to, one or more of the size, start address, and end address of the system partition, and the size and end address of the user data partition.
[0173] In some embodiments, the starting address of a system partition set at the end of a storage device may be determined based on the size of the storage device, the size of the space required for the system partition, a preset size, and the starting address, end address, and required space size of other system partitions set at the end of the storage device. The size of a user data partition may be determined based on the starting address of the user data partition, the size of the space required for the system partition set at the end of the storage device, a preset size, and the like.
[0174] As a possible implementation, taking a system partition set at the end of a storage device as an example, the starting address of the system partition set at the end of the storage device can satisfy Formula 1, and the size of the user data partition can satisfy Formula 2.
[0175] The starting address of the system partition = storage device size - the space required for the system partition Formula 1
[0176] The size of the user data partition = the starting address of the system partition - the starting address of the user data partition Formula 2
[0177] In Formula 1, the "starting address of the system partition" is the starting address of the system partition set at the end of the storage device. In Formula 2, the "starting address of the system partition" is the "starting address of the system partition" obtained according to Formula 1. Optionally, Formula 2 can also be transformed into Formula 2.1.
[0178] The size of the user data partition = the starting address of the user data partition - the space required by the system partition Formula 2.1
[0179] For the introduction of each parameter in formula 2.1, please refer to the introduction of the corresponding parameters in formula 1 and formula 2.
[0180] As another possible implementation, multiple system partitions may be set at the end of the storage device. The starting address of the system partition set at the end of the storage device and adjacent to the user data partition may satisfy Formula 3, and the size of the user data partition may satisfy Formula 4.
[0181] The starting address of system partition 1 = storage device size - the space required for all rear system partitions Formula 3
[0182] The size of the user data partition = the starting address of the system partition 1 - the starting address of the user data partition Formula 4
[0183] Among them, in Formula 3, "the starting address of system partition 1" is the starting address of the system partition set at the end of the storage device (i.e., behind the user data partition) and adjacent to the user data partition, and "the required space size of all rear system partitions" is the required space size of all system partitions set at the end of the storage device. In Formula 4, "the starting address of system partition 1" is the "starting address of system partition 1" obtained according to Formula 3. Optionally, similar to the way Formula 2 is transformed into Formula 2.1, Formula 4 can also be transformed into Formula 4.1.
[0184] The size of the user data partition = the starting address of the user data partition - the space required by all the post-system partitions Formula 4.1
[0185] For the introduction of each parameter in Formula 4.1, please refer to the introduction of the corresponding parameters in Formula 3 and Formula 4.
[0186] It can be understood that in this implementation, the starting address, ending address, etc. of the system partition stored at the tail position of the storage device and not adjacent to the user data partition can also be determined based on the size of the storage device, the preset size, and the size, starting address, ending address, etc. of other system partitions located at the tail position of the storage device.
[0187] It can be understood that the above implementation is based on the example of setting the rear system partition at the end of the storage device. If the rear system partition is set at a position with a preset distance from the end of the storage device, the above formula 1 can be transformed into formula 5.
[0188] The starting address of the system partition = storage device size - the space required for the system partition - the preset size Formula 5
[0189] For the description of each parameter in Formula 5, refer to the description of the corresponding parameter in Formula 1. Accordingly, the "starting address of the system partition" in Formula 2 can be determined according to Formula 5. Alternatively, the "required space size of the system partition" in Formula 2.1 can also be replaced by the sum of the "required space size of the system partition" and the "preset size" in Formula 5.
[0190] Similarly, the above formula 3 can also be transformed into formula 6.
[0191] The starting address of system partition 1 = storage device size - the space required for all rear system partitions - the preset size Formula 6
[0192] For the description of each parameter in Formula 6, refer to the description of the corresponding parameter in Formula 3. Accordingly, the "starting address of system partition 1" in Formula 4 can be determined according to Formula 6, or the "space required by all rear system partitions" in Formula 4.1 can also be replaced by the sum of the "space required by all rear system partitions" and the "preset size" in Formula 6.
[0193] As combined Fig.12a According to the partition structure shown in (2) and the above formulas 1 and 2, the starting address of the PRODUCT partition can satisfy formula 7, and the size of the user data partition can satisfy formula 8.
[0194] The starting address of the PRODUCT partition = storage device size - the space required for the PRODUCT partition Formula 7
[0195] The size of the user data partition = the starting address of the PRODUCT partition - the starting address of the user data partition Formula 8
[0196] It can be understood that Formula 7 and Formula 8 are based on the example that the PRODUCT partition is set at the end of the storage device. If the PRODUCT partition is set at a preset distance from the end of the storage device, then combined with the above Formula 5, the starting address of the PRODUCT partition can satisfy Formula 9.
[0197] The starting address of the PRODUCT partition = storage device size - the space required for the PRODUCT partition - the preset size Formula 9
[0198] Correspondingly, in Formula 8, the starting address of the PRODUCT partition can be determined according to Formula 9, and then the size of the user data partition can be determined according to Formula 8.
[0199] Similarly, combined Figure 12b According to the partition structure shown in (2) and the above formulas 1 and 2, the starting address of the PRELOAD partition can satisfy formula 10, and the size of the user data partition can satisfy formula 11.
[0200] The starting address of the PRELOAD partition = the size of the storage device - the space required for the PRELOAD partition Formula 10
[0201] The size of the user data partition = the starting address of the PRELOAD partition - the starting address of the user data partition Formula 11
[0202] It can be understood that Formula 10 and Formula 11 are also based on the example that the PRELOAD partition is set at the end of the storage device. If the PRELOAD partition is set at a position of a preset size away from the end of the storage device, the starting address of the PRELOAD partition and the size of the user data partition can refer to the relevant implementation of the PRODUCT partition described in Formula 9.
[0203] It can be understood that in this embodiment, data is stored at the later position in the user data partition as an example. In other embodiments, if data is not stored at the later position in the user data partition, such as the continuous free space at the back of the user data partition is greater than or equal to the required size of the system partition to be stored at the end of the storage device, the mobile phone may not adjust the position of the data stored in the user data partition. In this way, the system overhead can be reduced, and the risk of modifying the storage address of the data in the user data partition can be further reduced.
[0204] In other embodiments, the system partition with insufficient space may be adjusted to the end of the storage device, and the system partition with no insufficient space may be retained at the head of the storage device, which is not limited in the embodiments of the present application. For the specific implementation of this embodiment, reference may be made to the above-mentioned related implementation of adjusting the system partition with no insufficient space to the end of the storage device, and retaining the system partition with insufficient space at the head of the storage device.
[0205] In some embodiments, the partition structure of the mobile phone is already as follows Fig.11 , Fig.12a Middle (2) Figure 12b After the partition structure shown in (2), the space of the system partition at the head of the storage device may still be insufficient due to the fact that the system software stored in the system partition is updated from time to time, and the size of the system partition may not be sufficient to store the updated system software. In this case, further methods such as those described above can be adopted, such as: the system partition that does not have insufficient space can be adjusted to the tail position of the storage device, and the system partition that has insufficient space is still retained at the head position of the storage device. Alternatively, the system partition that has insufficient space can be adjusted to the tail position of the storage device, and the system partition that does not have insufficient space can still be retained at the head position of the storage device, etc., to achieve the purpose of expanding the space of the system partition.
[0206] In some embodiments, the partition structure of the mobile phone is already as follows Fig.11 , Fig.12a Middle (2) Figure 12bAfter the partition structure shown in (2), the system partition at the end of the storage device may also be short of space because the system software stored in the system partition is updated from time to time and the size of the system partition may not be sufficient to store the updated system software.
[0207] In this embodiment, as a possible implementation, the tail free space of the user data partition may continue to be allocated to the system partition with insufficient space located at the tail of the storage device. Similarly, at this time, data may also be stored at the rear of the user data partition, such as the continuous free space behind the user data partition is smaller than the size of the space to be expanded of the system partition with insufficient space. Optionally, the size of the space to be expanded may be greater than or equal to the size of the space lacking of the system partition with insufficient space.
[0208] At this time, the mobile phone can adopt the method described above to move the data at the back of the user data partition to the free space at the front of the user data partition. This facilitates the reallocation of part of the space of the user data partition to the system partition that is set at the end of the storage device and has insufficient space. Optionally, the free space divided from the user data partition can also be reallocated to the system partition that is set at the end of the storage device and has no insufficient space, and the embodiments of the present application are not limited to this.
[0209] Exemplary, combined Fig.12a In the partition structure shown in (2), taking the insufficient space of the system partition as the PRODUCT partition as an example, after the mobile phone reallocates part of the space of the user data partition to the PRODUCT partition, the partition structure of the storage device can be as follows: Fig.12a As shown in (3).
[0210] Similarly, combined Figure 12b In the partition structure shown in (2), taking the system partition with insufficient space as the PRELOAD partition as an example, after the mobile phone reallocates part of the space of the user data partition to the PRELOAD partition, the partition structure of the storage device can be as follows: Figure 12b As shown in (3).
[0211] Similarly, in this embodiment, the mobile phone can also adjust the position, size, etc. of the system partition and / or the user data partition by modifying the corresponding parameters of the system partition and / or the user data partition in the partition table. Please refer to the above description for the introduction of the parameters in the partition table.
[0212] In some scenarios, for a system partition that is set at the end of a storage device and has insufficient space, after part of the space of the user data partition is reallocated to the system partition, one or more of the start address, end address, size, etc. of the system partition will change. For other system partitions that are set at the end of a storage device and do not have insufficient space, one or more of the start address, end address, size, etc. may or may not change.
[0213] For other implementations of this embodiment, reference may be made to the relevant implementations of the embodiment described above.
[0214] In some other embodiments, the partition structure of the mobile phone is already as follows: Fig.11 , Fig.12a Middle (2) Figure 12b After the partition structure shown in (2), if the space of the system partition located at the tail of the storage device is insufficient, and / or the space of the system partition located at the head of the storage device is insufficient, the virtual volume technology described above can also be used to use the free space of other system partitions as the free space of the system partition with insufficient space. Alternatively, the space of the other system partition can be reduced by modifying the address of the other system partition, and the space of the other system partition can be allocated to the system partition with insufficient space. Optionally, the other system partition can be the system partition located at the head of the storage device, or the system partition located at the tail of the storage device.
[0215] In some scenarios, the storage device may have different versions, such as a high-configuration version, a low-configuration version, etc. The sizes of storage devices of different versions may be different. In some embodiments, for multiple storage devices of different versions, they may correspond to one partition table. Alternatively, all storage devices of different versions may also correspond to one partition table.
[0216] For example, taking the storage device including 4 versions as an example, the storage device of version 1 and the storage device of version 2 correspond to partition table 1, and partition table 1 may be a partition table adapted for storage devices of version 1, version 2, or other versions. It can be understood that the partition table adapted for the storage device may mean that the partition table is designed according to the actual size of the storage device. The storage device of version 3 and the storage device of version 4 correspond to partition table 2, and partition table 2 may be a partition table adapted for storage devices of version 3, version 4, or other versions. Partition table 1 and partition table 2 may be designed according to the actual size of storage devices of different versions.
[0217] For another example, taking a storage device including four versions, the storage device of version 1, the storage device of version 2, the storage device of version 3, and the storage device of version 4 all correspond to partition table 3, and partition table 3 can be designed according to the actual size of any version of the storage device from version 1 to version 4.
[0218] In this embodiment, after the mobile phone obtains the partition table, it saves the partition table to the storage device before reading and writing the storage device according to the partition table. Since the partition table obtained by the mobile phone may not be the partition table adapted to the current version of the storage device, that is, the partition table is not designed according to the actual size of the current version of the storage device. Therefore, the mobile phone can also calibrate the obtained partition table first to ensure that the partition table saved to the storage device is adapted to the storage device.
[0219] In the embodiment of the present application, the starting address of the user data partition is unchanged on storage devices of different versions. This can reduce the probability of data loss in the user data partition and improve the reliability of the storage device. Therefore, in a specific embodiment, when the mobile phone calibrates the partition table, it is not necessary to recalculate the starting address of the user data partition, which can reduce system overhead.
[0220] For example, before a mobile phone leaves the factory, it uses Fig.11 , Fig.12a Middle (2) Figure 12b Middle (2) Fig.13 Take the partition structure shown in (1) as an example. It can be understood that Figure 12b Middle (2) Fig.13 In (1), etc., the partition table is stored in the head of the storage device as an example. Since the starting address of the user data partition of different versions of storage devices is unchanged, the starting address and ending address of the system partition before the user data partition will not change for different versions of storage devices, but the size of the user data partition and the starting address and ending address of the system partition after the user data partition may change.
[0221] In some embodiments, similar to the method for determining the starting address of the system partition set at the tail position of the storage device and the size of the user data partition as described in Formulas 1 to 6 above, the mobile phone can determine one or more of the starting address, ending address, and size of the user data partition of the system partition set at the tail position of the storage device based on the size of the current storage device, a preset size, etc.
[0222] As a possible implementation, taking the case where a system partition is set at the tail position of the storage device as an example, the starting address of the system partition set at the tail position of the storage device can satisfy Formula 12, and the size of the user data partition can satisfy Formula 13.
[0223] The starting address of the system partition = storage device size - system partition size Formula 12
[0224] The size of the user data partition = the starting address of the system partition - the starting address of the user data partition Formula 13
[0225] In Formula 12, "the starting address of the system partition" is the starting address of the system partition set at the end of the storage device. "The size of the system partition" is the actual size of the system partition. In Formula 13, "the starting address of the system partition" is the "starting address of the system partition" obtained according to Formula 12. Optionally, Formula 13 may also adopt a variation such as that shown in Formula 2.1 above.
[0226] As another possible implementation, multiple system partitions may be set at the end of the storage device. The starting address of the system partition set at the end of the storage device and adjacent to the user data partition may satisfy Formula 14, and the size of the user data partition may satisfy Formula 15.
[0227] The starting address of system partition 1 = storage device size - total size of post-system partitions Formula 14
[0228] The size of the user data partition = the starting address of the system partition 1 - the starting address of the user data partition Formula 15
[0229] Among them, in formula 14, "the starting address of system partition 1" is the starting address of the system partition set at the end of the storage device and adjacent to the user data partition, and "the size of all rear system partitions" is the space size of all system partitions set at the end of the storage device. In formula 15, "the starting address of system partition 1" is the "starting address of system partition 1" obtained according to formula 14. Optionally, formula 15 can also adopt a variation such as that shown in the above formula 4.1.
[0230] It can be understood that the above implementation is based on the example of setting the rear system partition at the end of the storage device. Similarly, if the rear system partition is set at the end of the storage device at a preset size, the above formulas 12 to 15 can also be expressed in a modified manner such as formulas 5 to 6 described above.
[0231] As combined Fig.13 The partition structure described in (1) assumes that the partition table obtained by the mobile phone is as follows Fig.13As shown in (2), the end address of the user data partition is "H". The start address of the PRODUCT partition is "H" and the end address is "I". At this time, combined with the above formula 12 and formula 13, the start address of the PRODUCT partition can satisfy formula 16, and the size of the user data partition can satisfy formula 17.
[0232] The starting address of the PRODUCT partition = storage device size - PRODUCT partition size Formula 16
[0233] The size of the user data partition = the starting address of the PRODUCT partition - the starting address of the user data partition Formula 17
[0234] If the starting address of the PRODUCT partition is "M" calculated according to formula 16, the size of the user data partition is "MF", and the tail address of the storage device changes from "I" to "L", then Fig.13 The partition table shown in (2) can be updated as Fig.13 It can be understood that, because the sizes of storage devices of different versions may be different, under the same address rule, the tail address of the storage device is determined according to the actual size of the storage device.
[0235] On the contrary, if the starting address and ending address of the PRODUCT partition are determined according to Formula 16 and Formula 17, and the size of the user data partition remains unchanged, then the following parameters may be omitted: Fig.13 The partition table shown in (2) is updated.
[0236] In other embodiments, different versions of storage devices may correspond to different partition tables. For example, there may be a one-to-one correspondence between different versions of storage devices and partition tables. In this way, the mobile phone may not perform the above-mentioned operation of calibrating the partition table, and may directly store the partition table in the storage device. In this way, system overhead may be saved.
[0237] For example, Fig.14 A schematic diagram of a method for updating a partition table provided in an embodiment of the present application is shown. Fig.14 As shown, the method comprises the following steps:
[0238] S1401. The mobile phone obtains a partition table.
[0239] S1402. The mobile phone updates the partition table according to the actual size of the storage device.
[0240] For the specific implementation of this step, please refer to the relevant implementation described above.
[0241] S1403. The mobile phone stores the partition table in the storage device.
[0242] In some embodiments, in step S1403, when the partition table obtained by the mobile phone is compatible with the storage device, the partition table may be an unupdated partition table. In other embodiments, when the partition table obtained by the mobile phone is not compatible with the storage device, the partition table may be an updated partition table.
[0243] Optionally, in an embodiment of the present application, the partition table can be stored in the header of the storage device.
[0244] Combine the following Figure 12b The partition structure shown in (1) is converted to Figure 12b In the scenario of the partition structure shown in (2), the partition table obtained by the mobile phone is not compatible with the storage device as an example, as a specific embodiment, Fig.15 FIG. 1 is a flow chart of a partition management method provided by an embodiment of the present application. Fig.15 As shown, the method comprises the following steps:
[0245] S1501. The mobile phone updates the acquired partition table.
[0246] For the specific implementation of this step, please refer to Fig.14 The related implementation described.
[0247] Optionally, the mobile phone may first store the partition table in a storage device and then update it, or may first update the partition table and then store the updated partition table in the storage device.
[0248] S1502. The mobile phone obtains the size of the PRELOAD partition.
[0249] If confirmed on the phone, Figure 12b The PRELOAD partition at position (1) is set as follows: Figure 12b When the position shown in (2) is reached, the mobile phone can execute step S1502. The size of the PRELOAD partition can be Figure 12b That is, when the mobile phone determines to set a system partition that is set before the user data partition and then after the user data partition, the mobile phone can obtain the size of the system partition.
[0250] Optionally, in step S1502, the size of the PRELOAD partition may be the actual size of the PRELOAD partition, or may be the space size required by the PRELOAD partition.
[0251] S1503. The mobile phone reduces the user data partition to a specified size.
[0252] The specified size may be the space size required by the PRELOAD partition. Optionally, the space size required by the PRELOAD partition may be the same as the actual size of the PRELOAD partition, or may be larger or smaller than the actual size of the PRELOAD partition.
[0253] If the mobile phone can Figure 12b The user data partition shown in (1) is reduced by the specified size.
[0254] S1504: The mobile phone calibrates the size of the user data partition and the starting address of the PRELOAD partition.
[0255] Optionally, in step S1504, the mobile phone may calibrate the size of the user data partition and the starting address of the PRELOAD partition using methods such as Formula 1 to Formula 6 described above. For example, after calibration, the size of the user data partition is as follows: Figure 12b The size shown in (1) is updated as follows Figure 12b The starting address of the PRELOAD partition is Figure 12b The starting address shown in (1) is updated as follows Figure 12b The starting address shown in (2).
[0256] S1505. The mobile phone updates one or more of the starting address, ending address, size, etc. of the user data partition and the PRELOAD partition.
[0257] For example, the mobile phone may update one or more of the start address, end address, size, etc. of the user data partition and the PRELOAD partition stored in the partition table according to the size of the calibrated user data partition and the start address of the PRELOAD partition.
[0258] S1506. Flash the partition table of the mobile phone.
[0259] Among them, the mobile phone flashes the partition table, that is, updates the partition table stored in the storage device. Optionally, the mobile phone can also update one or more other system partitions (such as Figure 12b One or more of the start address, end address, size, etc. of the SYSTEM partition, PRODUCT partition, etc. shown in (1) are updated.
[0260] For example, Fig.16 FIG. 1 is a flow chart of a partition management method provided by an embodiment of the present application. The execution subject of the method may be the device 600 described above, or a processor in the device 600, such as a chip. Fig.16 As shown, the method comprises the following steps:
[0261] S1601. Get request message.
[0262] The request message may be used to read and write partitions included in the storage device, and the partitions include a user data partition and multiple system partitions. The system partition is used to store a first type of data. Exemplarily, the first type of data may include, but is not limited to, data such as the system software described above. The user data partition is used to store a second type of data. Exemplarily, the second type of data may include, but is not limited to, data generated during the user's use of the storage device described above.
[0263] The system partition includes a first system partition and a second system partition. The first system partition is set in front of the user data partition, and the second system partition is set behind the user data partition. Optionally, the data stored in the first system partition and the second system partition may be different. Optionally, the system partition may also include one or more system partitions other than the first system partition and the second system partition. Fig.12a The partition structure shown in (2).
[0264] In some embodiments, before executing step S1401, the first system partition and the second system partition are both set in front of the user data partition, such as Fig.12a The partition architecture shown in (1) in FIG. 1 is a block diagram of a partition structure. Optionally, in this embodiment, other system partitions may be arranged behind the user data partition. In this case, the second system partition may be arranged behind the user data partition. For example, if the space of the first system partition is insufficient, part or all of the space of the second system partition arranged in front of the user data partition may be merged into the space of the first system partition, and the second system partition may be arranged behind the user data partition.
[0265] It is understandable that the space of the merged first system partition is larger than the space of the original first system partition. In some embodiments, the merge operation can also be performed based on the space missing from the first system partition to determine how much space of the second system partition is merged into the first system partition. Optionally, the space of the original first system partition may also be divided into other system partitions.
[0266] In a specific embodiment, the second system partition is set after the user data partition, and the starting address of the user data partition remains unchanged. The second system partition is set after the user data partition and can be implemented as follows: the first space of the user data partition is set as the second system partition, and the first space includes the continuous free space at the end of the user data partition, such as Fig.12a The partition structure shown in (2) in FIG. 10A . Optionally, the first space may be larger than or equal to the second system partition. In this way, it can be ensured that there is enough space to store the data in the second system partition.
[0267] In some embodiments, before setting the first space of the user data partition as the second system partition, if the first space stores user data, the user data is moved to the second space of the user data partition for storage, and the second space is different from the first space, and the second space is the free space in the user data partition. For example, the second space may be the space located in front of the first space. Optionally, the second space may be a continuous free space or may not be a continuous free space.
[0268] In some embodiments, the first space of the user data partition can be set as the second system partition by updating the size of the user data partition included in the partition table, as well as the start address and end address of the second system partition. For this specific implementation, reference can be made to the relevant implementation described above. The partition table corresponds to the storage device, that is, the partition table is a partition table adapted by the storage device, and the partition table is used to index the partitions included in the storage device. Optionally, the partition table can be stored in the header of the storage device.
[0269] In some embodiments, the starting address of the updated second system partition is determined according to the size of the storage device and the size of the first space; the size of the updated user data partition is determined according to the starting address of the user partition and the starting address of the updated second system partition (or the size of the first space). Optionally, the size of the first space may be the size of the second system partition.
[0270] In some embodiments, when the space of the second system partition set behind the user data partition is insufficient, the third space of the user data partition can be merged into the space of the second system partition, and the third space can also include the continuous free space at the end of the user data partition. In other words, the size of the second system partition can be expanded by the size of the third space.
[0271] In some embodiments, if the third space stores user data, the user data is moved to the fourth space of the user data partition for storage, the fourth space is different from the third space, and the fourth space is the free space in the user data partition. Optionally, the fourth space may be the space located in front of the third space, the fourth space may be a continuous free space, or may not be a continuous free space. Optionally, the fourth space may be the same as or different from the second space.
[0272] S1602: Determine a target partition included in the storage device according to the request message.
[0273] Optionally, the target partition may include one or more partitions included in the storage device, which is not limited in this application. In some embodiments, the target partition may be determined according to the request message through a partition table corresponding to the storage device, and the partition table may be stored in the storage device or in other locations.
[0274] S1603. Read and write the target partition.
[0275] It can be understood that reading and writing a target partition may refer to reading data from the target partition or writing data to the target partition.
[0276] The above mainly introduces the solution provided by the embodiment of the present application from the perspective of the method. It is understandable that, in order to realize the above functions, the device includes a hardware structure and / or software module corresponding to the execution of each function. In combination with the units and algorithm steps of each example described in the embodiment disclosed in this application, the embodiment of the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer-driven hardware 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 to exceed the scope of the technical solution of the embodiment of the present application.
[0277] The present application is an embodiment that can divide the functional modules of the device according to the above method example. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of units in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0278] like Fig.17 1700 is a schematic diagram of a structure of a device provided in an embodiment of the present application. The device 1700 can be used to implement the methods described in the above method embodiments. Exemplarily, the device 1700 may include: a processing unit 1701 and an acquisition unit 1702.
[0279] The processing unit 1701 is used to support the device 1700 to execute Figures 1 to 16 The acquisition unit 1702 is used to support the device 1700 to perform Figures 1 to 16 The acquisition function of any one of the above.
[0280] Optional, Fig.17 The device 1700 shown may also include a storage unit 1703, which stores a program or instruction. When the processing unit 1701 executes the program or instruction, Fig.17 The device 1700 shown can execute the method described in the above method embodiment.
[0281] Optional, Fig.17The device 1700 shown may also include a communication unit, which is used to support the device 1700 in executing the steps of communication between the device and other devices in the embodiments of the present application.
[0282] Fig.17 The technical effects of the device 1700 shown can refer to the technical effects described in the above method embodiment, and will not be repeated here. Fig.17 The processing unit 1701 involved in the device 1700 shown can be implemented by a processor or a processor-related circuit component, which can be a processor or a processing module. The communication unit can be implemented by a transceiver or a transceiver-related circuit component, which can be a transceiver or a transceiver module.
[0283] The present application also provides a chip system, such as Fig.18 As shown, the chip system includes at least one processor 1801 and at least one interface circuit 1802. The processor 1801 and the interface circuit 1802 can be interconnected via lines. For example, the interface circuit 1802 can be used to receive signals from other devices. For another example, the interface circuit 1802 can be used to send signals to other devices (such as processor 1801). Exemplarily, the interface circuit 1802 can read instructions stored in the memory and send the instructions to the processor 1801. When the instructions are executed by the processor 1801, the device can execute the various steps executed by the device in the above embodiment. Of course, the chip system can also include other discrete devices, which are not specifically limited in the embodiments of the present application.
[0284] Optionally, the processor in the chip system may be one or more. The processor may be implemented by hardware or by software. When implemented by hardware, the processor may be a logic circuit, an integrated circuit, etc. When implemented by software, the processor may be a general-purpose processor implemented by reading software code stored in a memory.
[0285] Optionally, the memory in the chip system may be one or more. The memory may be integrated with the processor or may be separately provided with the processor, which is not limited in the present application. Exemplarily, the memory may be a non-transient processor, such as a read-only memory ROM, which may be integrated with the processor on the same chip or may be provided on different chips. The present application does not specifically limit the type of memory and the arrangement of the memory and the processor.
[0286] Exemplarily, the chip system can be a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on chip (SoC), a central processor unit (CPU), a network processor (NP), a digital signal processor (DSP), a microcontroller unit (MCU), a programmable logic device (PLD) or other integrated chips.
[0287] It should be understood that each step in the above method embodiment can be completed by an integrated logic circuit of hardware in a processor or by instructions in the form of software. The method steps disclosed in the embodiments of the present application can be directly embodied as being executed by a hardware processor, or by a combination of hardware and software modules in a processor.
[0288] An embodiment of the present application also provides a computer storage medium, in which computer instructions are stored. When the computer instructions are executed on a device, the device executes the method described in the above method embodiment.
[0289] An embodiment of the present application provides a computer program product, which includes: a computer program or instructions, when the computer program or instructions are executed on a computer, the computer executes the method described in the above method embodiment.
[0290] In addition, an embodiment of the present application also provides a device, which can specifically be a chip, component or module, and the device may include a connected processor and memory; wherein the memory is used to store computer-executable instructions, and when the device is running, the processor can execute the computer-executable instructions stored in the memory so that the device executes the methods in the above-mentioned method embodiments.
[0291] Among them, the equipment, computer storage medium, computer program product or chip provided in this embodiment is used to execute the corresponding method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method provided above, and will not be repeated here.
[0292] Through the description of the above implementation methods, technical personnel in the relevant field can understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0293] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The various embodiments can be combined with each other or referenced to each other without conflict. The device embodiments described above are merely schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0294] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0295] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0296] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0297] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A partition management method, characterized in that: The method comprises: Get a request message, where the request message is used to read and write partitions included in a storage device, where the partitions include a user data partition and multiple system partitions, where the system partition is used to store a first type of data, where the user data partition is used to store a second type of data, where the system partition includes a first system partition and a second system partition, where the first system partition is arranged in front of the user data partition, and where the second system partition is arranged behind the user data partition; Determine a target partition included in the storage device according to the request message; Read and write the target partition.
2. The method according to claim 1, characterized in that Before the acquisition request message, the first system partition and the second system partition are both arranged in front of the user data partition; The method further comprises: In the case where the space of the first system partition is insufficient, merging part or all of the space of the second system partition arranged in front of the user data partition into the space of the first system partition; The second system partition is arranged behind the user data partition.
3. The method according to claim 2, characterized in that The starting address of the user data partition remains unchanged; The step of arranging the second system partition behind the user data partition includes: The first space of the user data partition is set as the second system partition, wherein the first space includes a continuous free space at the end of the user data partition.
4. The method according to claim 3, characterized in that The first space is larger than or equal to the second system partition.
5. The method according to claim 4, characterized in that Before setting the first space of the user data partition as the second system partition, the method further includes: If user data is stored in the first space, the user data is moved to a second space of the user data partition for storage, where the second space is different from the first space and is a free space in the user data partition.
6. The method according to any one of claims 3 to 5, characterized in that: By updating the size of the user data partition included in the partition table, as well as the starting address and the ending address of the second system partition, the first space of the user data partition is set as the second system partition, and the partition table corresponds to the storage device, and the partition table is used to index the partitions included in the storage device.
7. The method according to claim 6, characterized in that The starting address of the updated second system partition is determined according to the size of the storage device and the size of the first space; the size of the updated user data partition is determined according to the starting address of the user data partition and the starting address of the updated second system partition.
8. The method according to claim 1, characterized in that The method further comprises: In the case that the space of the second system partition is insufficient, the third space of the user data partition is merged into the space of the second system partition, and the third space includes the continuous free space at the end of the user data partition.
9. The method according to claim 8, characterized in that Before merging the third space of the user data partition into the space of the second system partition, the method further includes: If user data is stored in the third space, the user data is moved to a fourth space of the user data partition for storage. The fourth space is different from the third space and is a free space in the user data partition.
10. The method according to claim 1, characterized in that Before obtaining the request message, the method further includes: Obtaining a partition table, the partition table including at least one parameter of a start address and an end address of the second system partition and a size of the user data partition; Determine whether to update the at least one parameter according to the size of the storage device.
11. A device, characterized in that: The method comprises modules for executing the steps of the method as claimed in any one of claims 1 to 10.
12. A device, characterized in that: include: A processor and a memory, the memory is coupled to the processor, the memory is used to store program code, the program code includes instructions, the processor reads the instructions from the memory, so that the device executes the method according to any one of claims 1-10.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium comprises a computer program, and when the computer program is run on a device, the device is caused to perform the method according to any one of claims 1 to 10.
14. A computer program product, characterized in that The computer program product comprises: a computer program or instructions, and when the computer program or instructions are run on a computer, the computer is caused to perform the method according to any one of claims 1 to 10.
Citation Information
Cited By
Partition management method and device
EP4708015A1
Partition management method and device
WO2024255221A1
