Storage device, storage management method and device, electronic device and computer readable medium
By introducing three physical space designs into the storage device, the problem of waste of reserved storage space in the operating system is solved, and efficient utilization of storage resources and stable system operation is achieved.
Patent Information
- Application Number
- CN202510610719.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-12
- Publication Date
- 2025-08-26
AI Technical Summary
In the prior art, the storage space reserved by the operating system is used for system expansion, resulting in wasted storage resources and users cannot effectively use these spaces to store personal data or application files.
The storage device design of three types of physical spaces is adopted. The first physical space is used to store system data, the second physical space is used to store user data, and the third physical space is used to store system or user data according to needs, realizing capacity expansion or shrinking capacity to avoid waste of resources.
Through flexible storage space management, waste of storage resources is avoided, ensuring the stable operation of the system and maximizing the utilization of storage space.
Smart Images

Figure CN120540587A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and more specifically, to a storage device, a storage management method, an apparatus, an electronic device, and a computer-readable medium. Background Art
[0002] In modern operating system storage management, the division between system and user data partitions is a crucial design decision. To ensure stable operating system operation and long-term scalability, a certain amount of space is typically reserved. This reserved space primarily addresses future system file expansion needs, particularly when operating system updates, software installations, or log file generation, which may require additional storage space. Therefore, reserving sufficient space ensures that the system partition has sufficient headroom when system expansion is needed, thus avoiding issues caused by insufficient storage space during system operation.
[0003] However, while this design provides flexibility and scalability for the operating system, it also has a significant drawback: reserved space leads to wasted storage resources. Because this part of the space is allocated exclusively to the system partition, rather than the user data partition, users cannot use this space to store personal data or application files unless there is a need for expansion. Summary of the Invention
[0004] The present application proposes a storage device, a storage management method, an apparatus, an electronic device, and a computer-readable medium to improve the above-mentioned defects.
[0005] In a first aspect, the present application provides a storage device, which is applied to an electronic device, and the storage device includes a first physical space, a second physical space, and a third physical space; the first physical space is used to store system data of the electronic device; the second physical space is used to store user data of the electronic device; the third physical space is configured to store system data and / or user data according to the needs of expanding or shrinking the storage device.
[0006] In the second aspect, the present application also provides a storage management method, which is applied to a processor of an electronic device, and the electronic device also includes the above-mentioned storage device. The method includes: determining the current capacity requirement of the first logical space, wherein the first logical space is obtained based on at least the first physical space configuration, and the first logical space is used to store the system data of the electronic device; if the capacity requirement requires expansion, performing an expansion operation on the first logical space through the third physical space.
[0007] In a third aspect, the present application further provides a storage management device, which is applied to a processor of an electronic device, wherein the electronic device also includes the above-mentioned storage device, and the device includes a determination unit and an execution unit. The determination unit is used to determine the current capacity requirement of a first logical space, wherein the first logical space is configured based on at least the first physical space, and the first logical space is used to store system data of the electronic device. The execution unit is used to perform a capacity expansion operation on the first logical space through the third physical space if the capacity requirement requires capacity expansion.
[0008] In a fourth aspect, the present application also provides an electronic device, comprising: a processor; the above-mentioned storage device; and a processor for executing the above-mentioned method.
[0009] In a fifth aspect, the present application also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a program code executable by a processor, and when the program code is executed by the processor, the processor executes the above method.
[0010] The storage device, storage management method, apparatus, electronic device and computer-readable medium provided by the present application, the storage device includes a first physical space, a second physical space and a third physical space; the first physical space is used to store the system data of the electronic device; the second physical space is used to store the user data of the electronic device; the third physical space is configured to store system data and / or user data according to the needs of expansion or contraction of the storage device. In other words, the third physical space may be used as an expansion space for system data, or it may be used to store user data when not used as an expansion space, so as to avoid the third physical space being idle and causing waste of resources when it is not used as an expansion space.
[0011] Other features and advantages of the present application will be described in the following description, and in part will become apparent from the description, or will be understood by practicing the present application. The purposes and other advantages of the present application can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0013] Figure 1 A schematic diagram of an electronic device provided by an embodiment of the present application is shown;
[0014] Figure 2 A schematic diagram of a storage device provided by an embodiment of the present application is shown;
[0015] Figure 3 A schematic diagram showing a first physical space, a second physical space, and a third physical space provided in an embodiment of the present application is shown;
[0016] Figure 4 A schematic diagram showing a first physical space, a second physical space, and a third physical space provided in another embodiment of the present application is shown;
[0017] Figure 5 A schematic diagram showing a first physical space, a second physical space, and a third physical space provided in another embodiment of the present application is shown;
[0018] Figure 6 A flowchart of a storage management method provided by an embodiment of the present application is shown;
[0019] Figure 7 A flowchart of a storage management method provided by another embodiment of the present application is shown;
[0020] Figure 8 A schematic diagram illustrating a process of expanding a first logical space according to an embodiment of the present application is shown;
[0021] Figure 9 A schematic diagram illustrating a process of expanding a first logical space provided in another embodiment of the present application is shown;
[0022] Figure 10 A flowchart of a storage management method provided by another embodiment of the present application is shown;
[0023] Figure 11 A schematic diagram illustrating a process of expanding the first logical space provided in another embodiment of the present application is shown;
[0024] Figure 12 A schematic diagram illustrating a process of expanding the first logical space provided in yet another embodiment of the present application is shown;
[0025] Figure 13 A schematic diagram illustrating a process of expanding the first logical space provided in yet another embodiment of the present application is shown;
[0026] Figure 14 A schematic diagram illustrating a process of expanding the first logical space provided in yet another embodiment of the present application is shown;
[0027] Figure 15 A schematic diagram showing a capacity expansion process during an OTA upgrade phase provided by an embodiment of the present application is shown;
[0028] Figure 16A module block diagram of a storage management device provided by an embodiment of the present application is shown;
[0029] Figure 17 A storage unit for storing or carrying program codes for implementing the method according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0030] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application for which protection is claimed, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work fall within the scope of protection of the present application.
[0031] It should be noted that similar reference numerals and letters represent similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined or explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and should not be understood as indicating or implying relative importance.
[0032] In modern operating system storage management, the division between the system partition and the user data partition is a crucial design decision. To ensure stable operation and long-term scalability of the operating system, additional space is typically reserved beyond the system and user data partitions. This reserved space primarily accommodates future system file expansion needs, particularly when operating system updates, software installations, or log file generation, which may require additional storage space. Therefore, reserving sufficient space ensures that the system partition has sufficient headroom when system expansion is needed, thus avoiding issues caused by insufficient storage space during system operation.
[0033] However, while this design provides flexibility and scalability for the operating system, it also has a significant drawback: reserved space leads to wasted storage resources. Because this space is allocated exclusively to the system partition, not the user data partition, users cannot use it to store personal data or application files unless expansion is required. This "free space" appears to users as unused resources, unable to be used effectively.
[0034] Furthermore, as user data volume grows, if the system partition isn't expanded in a timely manner, the user data partition may run out of storage. This further depletes reserved space, as the system partition hasn't been expanded, leaving space that could have been used for data storage unused for extended periods. Therefore, when designing partitions, it's important to balance the size of reserved space with the needs of the user data partition to ensure maximum storage space utilization while also ensuring system operation and future expansion capabilities.
[0035] Therefore, in order to overcome the above-mentioned defects, an embodiment of the present application provides a storage device, which is applied to an electronic device. The storage device may include a first physical space, a second physical space and a third physical space. Among these three physical spaces, there is space for users to store user data, there is space for storing system data, and there is also a physical space for balancing user data storage requirements and system data expansion requirements.
[0036] It is understood that the storage device may include a random access memory (RAM) or a read-only memory (ROM). The storage device may be used to store data, instructions, programs, codes, code sets, or instruction sets. The storage device may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the following various method embodiments, etc. The data storage area may also store data (such as system data and user data) created by the electronic device during use.
[0037] It should be noted that system data refers to all files and information used to support the device operating system, application operation, and interaction between hardware and software. For example, the system data may include the core files and drivers of the operating system (for example, kernel, system libraries, configuration files, etc.); applications or tools that come with the operating system, such as file managers, setup programs, browsers, email clients, etc.; temporary files generated by the operating system and applications, which are usually used to improve operating efficiency or record the operating status of the system and applications (such as error logs, temporary caches, etc.); data such as the device's hardware and software configuration, network settings, etc. User data refers to all files and information created, stored or managed by the user of the device. It generally includes: personal files (such as documents, pictures, videos, music, e-books, etc.); application data, such as data generated by applications installed on electronic devices, including application settings, cache files, log files, and personal data generated during application use; downloaded files: files downloaded by users from the Internet, such as PDF documents, installation packages, compressed files, etc.
[0038] In other words, user data primarily refers to files and information generated or managed by users, typically directly related to their personal needs and activities. System data refers to operating system files, configurations, and auxiliary files that ensure the proper functioning of a device. While typically not directly manipulated by the user, it is crucial to the device's performance and stability. Furthermore, some operating systems and applications generate data based on user habits, such as search history and usage history. Although this data is related to the operating system, it is considered user data.
[0039] like Figure 1 As shown, the electronic device 10 includes a storage device 100 and a processor 200 .
[0040] The processor 200 may include one or more processing cores. The processor 200 utilizes various interfaces and circuits to connect various components within the electronic device 10. It executes instructions, programs, code sets, or instruction sets stored in the storage device 100, as well as accesses data stored in the storage device 100, to perform various functions and process data within the electronic device 10. Optionally, the processor 200 may be implemented using at least one of the following hardware forms: a digital signal processing (DSP), a field-programmable gate array (FPGA), or a programmable logic array (PLA). The processor 200 may integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. The CPU primarily processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing display content; and the modem handles wireless communications. It is understood that the modem may not be integrated into the processor 200 and may be implemented separately via a communication chip.
[0041] The storage device 100 includes a first physical space 110, a second physical space 120, and a third physical space 130. The first physical space 110 is used to store system data of the electronic device; the second physical space 130 is used to store user data of the electronic device; and the third physical space 130 is configured to store system data and / or user data according to the needs of expanding or shrinking the storage device.
[0042] It is understandable that the first physical space 110 is used as a storage space for system file data, the second physical space is set as a storage space for user data, and the third physical space 130 can be used to store both user data and system data. In other words, the third physical space 130 can serve as an expansion space for the first physical space. When the storage space of the first physical space cannot meet the current storage needs of system data, or when the storage space of the first physical space is insufficient, part of the space in the third physical space can be selected as an expansion space for the first physical space to increase the storage space for the system data. Of course, when the third physical space is not used to store system data, that is, the space in the third physical space not used to store system files, can be used to store user data.
[0043] It should be noted that physical space refers to the physical area or storage medium where the memory hardware actually exists. It corresponds to the actual storage location on the electronic device hardware (such as a hard disk, a memory stick, a solid-state drive, etc.). Each physical storage location has a unique physical address, and the electronic device can directly access the data through this physical address. Usually, the unit after the entire disk is partitioned based on the Global Unique Identifier Partition Table (GUID Partition Table, GPT) or the Master Boot Record (Master Boot Record, MBR) is the physical space, and any partition is continuous in the disk address. That is to say, in the embodiment of the present application, the physical space refers to a continuous physical address range.
[0044] Logical memory is an abstraction layer in computer systems, referring to the address space used by operating systems and applications to manage and access memory. Logical memory does not directly correspond to the actual location of physical memory, but is instead virtualized by the operating system. Logical memory is composed of all or part of multiple physical partitions. Typically, addresses on physical disks may not be contiguous. The relationship between physical and logical memory is typically achieved through address mapping.
[0045] As an implementation method, in an embodiment of the present application, the electronic device has a first logical space and a second logical space, the first logical space serving as a storage space for system data, the second logical space serving as a storage space for user data, and the physical space corresponding to the first logical space includes the first physical space, and may include at least part of the third physical space, and of course, may not include the third physical space. Similarly, the physical space corresponding to the second logical space includes the second physical space, and may include at least part of the third physical space, or may not include the third physical space. Specifically, the third physical space is used as part of the first logical space and the second logical space, and can be set based on the current expansion requirements. Please refer to the subsequent method embodiments for details.
[0046] It should be noted that the positional relationship among the first physical space, the second physical space and the third physical space may be distributed in a variety of ways based on different application scenarios or the configuration of the first logical space, such as Figure 2 shown.
[0047] Assuming that the first physical space is located at the head among the three physical spaces, the distribution of the three physical spaces can be as follows: Figure 2 (a) and (b), where Figure 2 In (a), the first physical space and the third physical space are located before the second physical space, that is, the third physical space is located between the first physical space and the second physical space. In other words, the physical address of the third physical space is located before the first physical address of the second physical space. It can be understood that the address range of the third physical space is smaller than the starting address of the second physical space, that is, the memory area of the third physical space is located before the memory area of the second physical space. Figure 2 The difference between (a) and (b) is that Figure 2 In (b), the third physical space is located behind the second physical space, that is, the second physical space is located between the first physical space and the third physical space.
[0048] Assuming that the second physical space is located at the head among the three physical spaces, the distribution of the three physical spaces can be as follows: Figure 2 (c) and (d), where Figure 2 In (c), the second physical space, the first physical space and the third physical space are distributed in sequence, and the first physical space is located between the second physical space and the third physical space. Figure 2 In (d), the second physical space, the third physical space and the first physical space are distributed in sequence, and the third physical space is located between the second physical space and the first physical space.
[0049] Assuming that the third physical space is located at the head among the three physical spaces, the distribution of the three physical spaces can be as follows: Figure 2 (e) and (f), where Figure 2 In (e), the third physical space, the second physical space and the first physical space are distributed in sequence, and the second physical space is located between the third physical space and the first physical space. Figure 2 In (f), the third physical space, the first physical space and the second physical space are distributed in sequence, and the first physical space is located between the third physical space and the second physical space.
[0050] It should be noted that the above-mentioned distribution methods can be freely selected according to different scenarios or different needs. For example, if the first logical space is the space obtained by mapping the logical addresses of the first physical space and at least part of the third physical space to obtain a larger physical space, then the first physical space and the third physical space must be adjacent, that is, the first physical space and the third physical space must be continuous. However, if the first logical space is the space obtained by concatenating the logical addresses of the first physical space and at least part of the third physical space, then the first physical space and the third physical space do not need to be continuous physical spaces. Similarly, the second logical space can also require that the second physical space and the third physical space are continuous or discontinuous.
[0051] In an embodiment of the present application, taking into account the case where the third physical space is located after the second physical space, for example, the same electronic device (e.g., a smart phone) may have configurations of different capacity sizes. On the one hand, shrinking from the end of the user data partition will cause the partition table to differ between different capacity configurations, which is not easy to maintain. On the other hand, when the capacity is expanded multiple times, it may be necessary to relocate the system partition data. In other words, smart phones with different capacity configurations will have different user data partition sizes, and shrinking from the end of the user data partition may cause differences in the partition table of the mobile phone model. This difference makes the system complicated during maintenance, and different processing may be required for different versions of the partition table.
[0052] In one embodiment of the present application, the third physical space is located before the second physical space. In addition, the first physical space can be located before the third physical space. On the one hand, it can facilitate the merging of part of the first physical space and the third physical space into a new first physical space to achieve the expansion of the first physical space. On the other hand, it can also make the first physical space located before the third physical space, so that when the first physical space is expanded using the third physical space, the data in the first physical space will not be subject to excessive maintenance. Furthermore, the first physical space is located in the head area of the storage device, which can improve performance, management convenience and data stability, that is, it can quickly access, reduce fragmentation, improve stability and optimize storage layout.
[0053] Therefore, in one embodiment of the present application, Figure 2 The layout of (a) is described in the subsequent embodiments, but this is not a limitation on the layout of the three physical spaces.
[0054] It should be noted that the first physical space, the second physical space and the third physical space are three independent physical spaces, that is, Figure 2As shown, each of the first physical space, the second physical space and the third physical space is an independent partition. Of course, the first physical space, the second physical space and the third physical space can also be three areas divided from at least one physical space. For example, Figure 2 Taking the layout of the three physical spaces in (a) as an example, the implementation method in which the three physical spaces are divided by at least one physical space is shown.
[0055] like Figure 3 As shown, assuming that the storage device includes a designated physical space 300, the designated physical space 300 may include three areas, and the three areas are used to implement the three functions of storing system data, storing user data, and scaling, wherein scaling means storing system data and / or user data based on the needs of storage device expansion or reduction. The three areas are respectively the first physical space 110, the second physical space 120, and the third physical space 130. The three physical spaces are not independent physical spaces relative to the designated physical space 300 (such as Figure 3 As shown, the three areas are divided by dotted lines), which correspond to three different areas of the designated physical space 300 and are used to implement different data storage functions.
[0056] like Figure 4 As shown, the storage device includes a first target physical space 401 and a second physical space 120. The first target physical space 401 may include two areas, which are used to implement the two functions of storing system data and expanding and contracting capacity. In other words, the two areas of the first target physical space 401 are the first physical space 110 and the third physical space 130. Figure 4 As shown, the first target physical space 401 and the second physical space 120 are separated by a "solid line", indicating that the first target physical space 401 and the second physical space 120 are two independent physical spaces, and the first physical space 110 and the third physical space 130 are separated by a "dotted line", indicating that the first physical space 110 and the third physical space 130 are two areas of the first target physical space 401, that is, the area used as the third physical space and the area used as the first physical space can be determined in the first target physical space 401.
[0057] like Figure 5As shown, the storage device includes a first physical space 110 and a second target physical space 402. The second target physical space 402 may include two areas, which are respectively used to implement the two functions of storing user data and scaling. In other words, the two areas of the second target physical space 402 are the second physical space 120 and the third physical space 130. Therefore, the first physical space 110 and the second target physical space 402 are two independent physical spaces, and the second physical space 120 and the third physical space 130 are two areas of the second target physical space 402. That is, in the second target physical space 402, it is possible to determine an area used as the third physical space and an area used as the second physical space.
[0058] Therefore, in one embodiment, the first physical space 110, the second physical space 120 and the third physical space 130 may be an independent physical space (eg Figure 3 In another embodiment, the second physical space 120 is an independent physical space, and the first physical space 110 and the third physical space 130 are an independent physical space (such as Figure 4 In another embodiment, the first physical space 110 is an independent physical space, and the second physical space 120 and the third physical space 130 are an independent physical space (such as Figure 5 in another embodiment, the first physical space 110, the second physical space 120 and the third physical space 130 are three independent physical spaces.
[0059] It is understandable that in the embodiments of the present application, a storage device may be defined to have three physical spaces corresponding to its functions, namely, a first physical space for storing system data of the electronic device, a second physical space for storing user data of the electronic device, and a third physical space configured to store system data and / or user data according to the needs of expansion or contraction of the storage device. However, there is no limitation on whether the first physical space, the second physical space, and the third physical space are independent physical spaces or whether they are divided from at least one physical space.
[0060] See also Figure 6 , Figure 6 A storage management method provided in an embodiment of the present application is shown. The method is applied to the above-mentioned electronic device. The execution subject of the method may be a processor of the electronic device. The method includes: S601 and S602.
[0061] S601: Determine a current capacity requirement of a first logical space, wherein the first logical space is configured based on at least the first physical space, and the first logical space is used to store system data of the electronic device.
[0062] It should be noted that the first logical space is the storage space for system data. The correspondence between logical space and physical space can be found in the previous section and will not be elaborated here. The first logical space corresponds to a physical space. In other words, the first logical space is configured based on its corresponding physical space through logical address mapping. For example, when an application requests access to a logical address, the operating system converts it to the corresponding physical address to locate the actual location of the data on the storage device.
[0063] Therefore, the first logical space is configured at least based on the first physical space, which means that the physical space corresponding to the first logical space includes at least the first physical space. That is to say, the current first logical space may use the third physical space or may not use the third physical space. However, the first physical space as a physical space for storing system data will be used as the physical space corresponding to the first logical space.
[0064] As an implementation method, the capacity requirement of the first logical space can be an expansion requirement or a contraction requirement. It is understandable that the expansion requirement of the logical space means that the logical space needs to be increased, and the contraction requirement means that the capacity of the first logical space needs to be reduced.
[0065] It is understandable that the demand for expansion of the first logical space refers to the insufficient capacity of the first logical space, and the reasons for the demand for expansion of the first logical space may be system upgrades and other reasons. Specifically, system upgrades are usually accompanied by the introduction of new features, and these new features may require additional storage space. For example, new application modules, services or data structures may increase data storage requirements. Alternatively, system upgrades may introduce new data formats or architectures, such as changes in database schemas, which may result in an increase in data volume or the need for more metadata storage. In addition, during the upgrade process, it is usually necessary to back up the current data status in case of unexpected situations, which will lead to a temporary increase in storage requirements. It should be noted that the aforementioned other reasons may be temporary files and caches, logs and monitoring data, and other data that lead to insufficient capacity of the first logical space, i.e., the need for expansion. Of course, the other reasons may also include other factors, for example, it may be a user-triggered expansion request, and the specific reasons are not limited here.
[0066] As an implementation method, the implementation method of determining the capacity requirement of the current first logical space may include, in the scenario of system upgrade of the electronic device, determining the capacity parameters corresponding to the system upgrade; and determining the capacity requirement of the current first logical space based on the capacity space of the current first logical space and the capacity parameters.
[0067] Specifically, determine the capacity parameters corresponding to the system upgrade, for example, obtain the relevant system upgrade instructions, and obtain the storage capacity required for the upcoming system version upgrade, i.e., the capacity parameters. For example, the capacity parameters may include the storage requirements for newly added files and components, reserved temporary file space (such as temporary files generated during the installation process), or any additional configuration or data files, etc. Determine the capacity of the current first logical space, i.e., the capacity of the available space, and compare the size relationship between the capacity parameter and the capacity of the available space. If the capacity of the available space is greater than or equal to the capacity parameter, then determine that the current first logical space does not need to be expanded, i.e., the capacity requirement of the current first logical space is not an expansion requirement: if the capacity of the available space is less than the capacity parameter, then determine that the current first logical space needs to be expanded, i.e., the capacity requirement of the current first logical space is an expansion requirement.
[0068] It is understandable that the capacity demand of the first logical space can be a demand for shrinking in addition to an expansion demand. Specifically, the demand for shrinking is the opposite of the demand for expansion, and refers to reducing the capacity of the first logical space. Exemplarily, the scenarios that lead to the demand for shrinking can include freeing up space after a system upgrade, that is, after a system upgrade, if the compatibility between the new version and the old version is no longer required, the files of the old version can be deleted to free up space; it can also include regularly cleaning up temporary files, log files or expired data that are no longer needed; using deduplication technology to eliminate duplicate data in storage; compressing or transferring some larger files, etc.
[0069] S602: If the capacity requirement is that capacity expansion is required, perform a capacity expansion operation on the first logical space through the third physical space.
[0070] In the case where the first logical space needs to be expanded, since the third physical space serves as the expansion space for system data, that is, the third physical space can serve as the expansion space for the first logical space, the expansion operation can be performed on the first logical space through the third physical space. The specific expansion methods may include at least two types. The first is to increase the capacity of the corresponding physical space. In the embodiment of the present application, it may refer to increasing the first physical space. The second is to splice more physical spaces, that is, in some cases, other physical spaces (such as part of the third physical space) can be spliced together at the logical address. For example, by using a logical volume manager or a specific file system function, multiple physical spaces can be combined into one logical space, thereby logically expanding the available storage space of the first logical space. The specific implementation methods of these two methods will be explained in detail in the subsequent embodiments.
[0071] Specifically, if the capacity requirement is for expansion, performing the capacity expansion operation on the first logical space via the third physical space may be implemented as follows: if the capacity requirement is for expansion, at least a portion of space in the third physical space is determined as a first target space; based on the first target space, the capacity expansion operation is performed on the current first logical space to obtain a new first logical space. It is understood that the first target space is at least a portion of the physical space determined in the third physical space as the expansion space for the system data based on the physical space corresponding to the current first logical space. In other words, if the physical space corresponding to the first logical space does not include the third physical space, that is, the physical space corresponding to the first logical space is only the first physical space, then at least a portion of space in the third physical space may be selected as the first target space. For example, if the capacity requirement of the first logical space is determined to be for expansion, the required expansion capacity is determined, and the size of the first target space is determined based on the expansion capacity. Of course, if the physical space currently corresponding to the first logical space includes the third physical space, then the first target space is at least a portion of the portion of space in the third physical space that has not yet been used for the first logical space. In addition, based on the first target space, the expansion operation performed on the current first logical space may refer to subsequent embodiments.
[0072] Therefore, in the embodiment of the present application, at least a portion of the space in the third physical space that is not used to store the system data is used to expand the storage capacity of the user data. In other words, the third physical space can be used as an expansion space for system data, and can also be used to store user data when not used as an expansion space, thereby avoiding the third physical space being idle and wasting resources when not used for expansion. Therefore, when expansion is needed, the storage space for system data can be expanded based on the third physical space, while the remaining space can continue to be used to store user data.
[0073] See also Figure 7 , Figure 7 A storage management method provided in an embodiment of the present application is shown. The method is applied to the above-mentioned electronic device. The execution subject of the method may be a processor of the electronic device. The method includes: S701 and S704.
[0074] S701: Determine a current capacity requirement of a first logical space, wherein the first logical space is configured based on at least the first physical space, and the first logical space is used to store system data of the electronic device.
[0075] It should be noted that, in the embodiment of the present application, the storage device can be abstracted into a first logical space and a second logical space. For the description of the first logical space and the second logical space, reference can be made to the above content.
[0076] In the embodiment of the present application, it is assumed that the physical space corresponding to the first logical space is the first physical space, that is, the physical space corresponding to the first logical space does not include the third physical space.
[0077] The first logical space can be expanded by increasing the current first physical space based on the third physical space. Then, the second physical space and the current third physical space are jointly used as the physical space corresponding to the second logical space. That is, by logically splicing the second physical space and the third physical space, for example, splicing the third physical space to the end of the second physical space in terms of the logical address, the second physical space and the third physical space are jointly configured as the second logical space. It is understandable that if the third physical space is completely merged into the first physical space, that is, the third physical space no longer exists, then the physical space corresponding to the second logical space is the second physical space.
[0078] S702: If the capacity requirement is for expansion, determine, in the third physical space, at least a portion of space that is continuous with the first physical space as a first target space.
[0079] As mentioned above, in the embodiment of the present application, the first logical space can be expanded by increasing the current first physical space based on the third physical space. Since the physical addresses of the physical spaces are continuous, the first physical space and the third physical space are adjacent. Specifically, Figure 2 In (a), (c), (d) and (f), the first physical space and the third physical space are adjacent. In the embodiment of the present application, Figure 2 (a) As an example, the specific expansion method of the embodiment of the present application is described. For details, please refer to the above Figure 2 Description.
[0080] For example, Figure 2 As shown in (a), the third physical space is located between the first physical space and the second physical space, and the third physical space is located before the address of the second physical space. The first target space can be determined by determining the currently required expansion capacity, that is, the additional space capacity required based on the available space of the current first logical space. Based on the expansion capacity, starting from the physical address of the third physical space adjacent to the end physical address of the current first physical space, a space area corresponding to the expansion capacity is determined as the first target space.
[0081] S703: Merge the first physical space and the first target space into a new first physical space, wherein the physical space other than the first target space in the third physical space is used as a new third physical space.
[0082] S704: Configure the new first physical space as a new first logical space.
[0083] It should be noted that in the embodiments of the present application, the first physical space is variable, that is, the first physical space can be re-divided into different sizes, and accordingly, the third physical space is also variable. That is, after determining the first target space, since the first target space and the current first physical space are continuous or adjacent, the two can be merged into a new physical space, that is, a new first physical space is obtained by merging. Since the first target space is merged into the first physical space, the physical space in the third physical space outside the first target space serves as the new third physical space.
[0084] like Figure 8 As shown, Figure 8 In (a), the first target space 131 is the space that needs to be expanded this time. That is, based on the current first logical space, the first target space is determined in the third physical space to expand the current first logical space. Figure 8 In (a), the physical space corresponding to the current second logical space 520 includes the second physical space 120 and the third physical space 130, and the logical address of the third physical space 130 in the second logical space is after the logical address of the second physical space. That is, it can be seen that the third physical space 130 is spliced to the user data partition at the logical address through the logical space or file multi-device mounting technology and then used.
[0085] It should be noted that the current third physical space also includes the first target space 131, and the first logical space 510 is the logical mapping space of the current first physical space, that is, the physical space corresponding to the first logical space 510 is the current first physical space. Figure 8As shown in (b), the first target space 131 and Figure 8 The first physical space 110 in (a) is merged into a new first physical space. As can be seen, the first physical space becomes larger, which in turn causes the first logical space 510 to become larger, and its increased capacity equals the capacity of the first target space. Since the first target space is divided from the third physical space and added to the first physical space, the third physical space becomes smaller, and accordingly, the second logical space 520 also becomes smaller. The second logical space at this point is the logical space corresponding to the second physical space and the current third physical space (i.e., the third physical space after the first target space is divided).
[0086] As an implementation method, in order to expand the capacity of the first logical space more finely and facilitate the management of the first logical space and the second logical space. The third physical space can be divided into multiple sub-physical spaces. That is, the third physical space is located between the first physical space and the second physical space, the physical address of the third physical space is located before the first physical address of the second physical space, and the third physical space is divided into multiple sub-physical spaces along the first order. Moreover, the multiple sub-physical spaces in the current third physical space are spliced to the tail of the second logical space in the logical address according to the second order, wherein the first order is opposite to the second order, and the second logical space is used to store user data. The first order is the direction from the first physical space to the second physical space, and the second order is opposite to the first order, that is, the tail of the second physical space points to the head.
[0087] like Figure 9 As shown in (a), the third physical space 130 is divided into three sub-physical spaces along the first order F1, namely sub-physical space r1, sub-physical space r2, and sub-physical space r3. Sub-physical space r1, sub-physical space r2, and sub-physical space r3 are logically spliced to the end of the logical address corresponding to the second physical space in accordance with the second order F2. Specifically, the second physical space corresponds to the first sub-logical space of the second logical space. After the end logical address of the first sub-logical space, the logical addresses of sub-physical space r3, sub-physical space r2, and sub-physical space r1 are sequentially spliced. With respect to the first physical space, the distances between sub-physical space r1, sub-physical space r2, and sub-physical space r3 and the first physical space gradually increase, wherein sub-physical space r1 is adjacent to the first physical space 110. It can be seen that the physical space corresponding to the first logical space is the current first physical space, and the physical space corresponding to the second logical space includes the second physical space sub-physical space r1, sub-physical space r2 and sub-physical space r3, and it can be seen from the second logical space that sub-physical space r3, sub-physical space r2 and sub-physical space r1 are spliced in sequence after the second physical space.
[0088] like Figure 9 As shown in (b), assuming that the first target space is the sub-physical space r1, it can be seen that the new first physical space is Figure 9 (a) The new physical space after merging the sub-physical space r1 on the basis of the first physical space is the new third physical space. Only the sub-physical space r2 and the sub-physical space r3 remain in the new third physical space, and the capacity of the first logical space becomes larger. In addition, the logical addresses of the sub-physical space r3 and the sub-physical space r2 are spliced after the logical address of the second physical space. In other words, the capacity of the second logical space becomes smaller. Therefore, in the embodiment of the present application, the physical space corresponding to the first logical space is the first physical space. The first physical space can be increased by dividing part of the space adjacent to the first physical space of the third physical space into the first physical space, thereby expanding the capacity of the first logical space.
[0089] See also Figure 10 , Figure 10 A storage management method provided in an embodiment of the present application is shown. The method is applied to the above-mentioned electronic device. The execution subject of the method may be a processor of the electronic device. The method includes: S1001 and S1003.
[0090] S1001: Determine a current capacity requirement of a first logical space, wherein the first logical space is configured based on at least the first physical space, and the first logical space is used to store system data of the electronic device.
[0091] In the embodiment of the present application, the physical space corresponding to the first logical space includes at least the first physical space. That is, in the embodiment of the present application, the physical space corresponding to the first logical space may include the first physical space, or may include at least part of the first physical space and the third physical space. This depends on whether the current first logical space uses at least part of the third physical space.
[0092] It should be noted that in the implementation of this application, the first physical space and the second physical space can be unchanged, that is, the capacity remains unchanged, and the first logical space increases the capacity of the first logical space by splicing the logical addresses of different parts of the third physical space.
[0093] S1002: If the capacity requirement is for expansion, determine at least a portion of the space in the third physical space as a first target space.
[0094] It is understood that the third physical space can be divided into two parts according to different uses: a first target space and a second target space. The first target space is used to store system data and is part of the physical space corresponding to the first logical space. The second target space is the portion of the third physical space outside the first target space and is part of the physical space of the second logical space. In other words, the first target space refers to the space in the third physical space used to store system data, and the second target space refers to the space in the third physical space used to store user data.
[0095] It should be noted that the capacity determined by the first target space can refer to the above content and will not be repeated here. Unlike the above embodiment, in the embodiment of the present application, the first target space does not have to be continuous (i.e., adjacent) with the first physical space. This is because the first target space is expanded into the current first logical space by splicing logical addresses, rather than by merging with the first physical space to form a new physical space. Therefore, in theory, the first target space can be any space in the third physical space, or multiple partial areas, which can be adjacent or non-adjacent.
[0096] S1003: Concatenate the logical address of the first target space with the first logical space to obtain a new first logical space.
[0097] For example, assuming that the third physical space is located between the first physical space and the second physical space, the physical address of the third physical space is located before the first physical address of the second physical space. Figure 11 As shown, Figure 11 (a) can refer to the above description Figure 8 (a), I will not elaborate on this. Figure 11 As shown in (b), assuming that the physical space corresponding to the current first logical space is the first physical space, that is, the current first logical space does not use the third physical space. Then, when it is determined that the first logical space needs to be expanded, the first target space 131 and the second target space 132 are determined in the third physical space. It should be noted that there are not many restrictions on the positions of the first target space 131 and the second target space 132. That is, Figure 11 The first target space 131 and the second target space 132 in (b) may also be interchanged. In other embodiments, the first target space 131 and the second target space 132 may be a plurality of discontinuous partial areas. Figure 11 (b) is only an example and is not limiting.
[0098] from Figure 11(b) It can be seen that the first target space 131 is logically spliced to the first logical space. For example, the logical address of the first target space 131 can be spliced to the end of the current first logical space. In addition, it can be seen that the logical address of the first target space 131 in the second logical space is deleted, and the area in the second logical space corresponding to the third physical space is the second target space 132. Furthermore, it can be seen that the physical space size of the third physical space 130 has not changed.
[0099] It should be noted that when expanding the first logical space using the above two methods, after the first target space is determined, the logical addresses corresponding to the first target space are deleted in the second logical space. For example, the logical addresses corresponding to at least a portion of the space in the third physical space that is not used to store the system data are concatenated to the end of the second logical space. After determining at least a portion of the space in the third physical space as the first target space, the method further includes: deleting the logical addresses corresponding to the first target space in the second logical space.
[0100] Similar to the aforementioned embodiment, in the embodiment of the present application, the third physical space can also be divided into multiple sub-physical spaces. Each sub-physical space corresponds to a maximum capacity. Therefore, when expanding capacity, the corresponding sub-physical space can be selected based on the current capacity demand and the maximum capacity of each sub-physical space to achieve capacity expansion. For example, if the capacity corresponding to the current expansion demand is 1GB, then a sub-physical space with a maximum capacity of 1GB can be selected from multiple sub-physical spaces to achieve capacity expansion, or two sub-physical spaces with a maximum capacity of 500MB can be selected to achieve capacity expansion. There is no specific limitation.
[0101] As an embodiment, the maximum storage capacity of the sub-physical space may be 500M, 1GB, or 2GB, or the maximum storage capacity may be obtained based on the capacity requirements of each system upgrade within a preset time period. For example, the capacity of the update package for each system upgrade within the preset time period is determined, and the maximum storage capacity of the sub-physical space is determined based on the capacity of the update package for each system upgrade. For example, the maximum storage capacity of the sub-physical space may be determined based on the capacity of the largest update package, or the maximum storage capacity of the sub-physical space may be determined based on the average update package capacity, which is not limited here. Alternatively, the capacity of each update package may be rounded up to obtain a capacity reference value, and the capacity reference value that appears the most times may be used as the maximum storage capacity of the sub-physical space.
[0102] It should be noted that the maximum storage capacity of each sub-physical space can be the same, or different, or partially the same and partially different, and there is no limitation on this. In the embodiment of the present application, the maximum storage capacity of each of the sub-physical spaces can be set to be the same, then the maximum storage capacity can be the aforementioned 500M, 1GB or 2GB, of course, it can also be determined based on the aforementioned update package capacity. For example, by statistically determining the amount of update inclusion within a preset time period, the capacity reference value with the most occurrences is 1GB, then the maximum storage capacity of each sub-physical space can be set to 1GB, of course, it can also be 500MB.
[0103] It is understandable that the maximum storage capacity of each sub-physical space can be set based on usage requirements and is not limited to this.
[0104] like Figure 12 As shown, Figure 12 The description of (a) can refer to the above Figure 9 The corresponding contents of (a) will not be repeated here. Figure 12 As shown in (b), it can be seen that the first target space is the sub-physical space r1, and the sub-physical space r1 is used for the first logical space, that is, the current first logical space is spliced with the logical address of the sub-physical space r1. For example, the logical address of the sub-physical space r1 is spliced to Figure 12 (a) is the tail of the first logical space, then correspondingly, the logical address of the sub-physical space r1 in the second logical space is deleted, and the third physical space remains unchanged, still including the sub-physical space r1, the sub-physical space r2 and the sub-physical space r3.
[0105] As an implementation method, although multiple different sub-physical spaces are divided, it is also possible to set a part of the area of the same sub-physical space to belong to the first logical space, and another part of the area to belong to the second logical space. That is to say, when the third physical space includes multiple sub-physical spaces, the method for determining the first target space can be to determine at least part of the sub-physical space and / or at least part of the area of the specified sub-physical space.
[0106] like Figure 13 As shown, Figure 13 The description of (a) can refer to the above Figure 9 The corresponding contents of (a) will not be repeated here. Figure 13 As shown in (b), it can be seen that the first target space includes partial areas of sub-physical space r1 and sub-physical space r2, that is, partial areas of sub-physical space r1 and sub-physical space r2 are used for the first logical space, that is, the current first logical space is spliced with the logical addresses of partial areas of sub-physical space r1 and sub-physical space r2. For example, the logical addresses of partial areas of sub-physical space r1 and sub-physical space r2 are spliced to Figure 13 (a) is the tail of the first logical space, then correspondingly, the logical addresses of the sub-physical space r1 and part of the sub-physical space r2 in the second logical space are deleted, and the logical addresses of the remaining parts of the sub-physical space r2 are retained in the second logical space. The third physical space remains unchanged and still includes the sub-physical space r1, sub-physical space r2 and sub-physical space r3. In this embodiment, the sub-physical space r2 is schematically divided into a first part r21 and a second part r22. After expansion, the first logical space is spliced with the logical addresses of the sub-physical space r1 and the first part r21, while the logical address of the sub-physical space r3 and the logical address of the second part r22 are retained in the second logical space, and the logical addresses of the sub-physical space r1 and the first part r21 in the corresponding second logical space are deleted.
[0107] As another embodiment, when the third physical space includes multiple sub-physical spaces, the determined first target space may be a sub-physical space that is not adjacent to the first physical space. Figure 14 As shown, Figure 14 The description of (a) can refer to the above Figure 9 The corresponding contents of (a) will not be repeated here. Figure 14 As shown in (b), it can be seen that the first target space is the sub-physical space r2, and the sub-physical space r2 is used for the first logical space, that is, the current first logical space is spliced with the logical address of the sub-physical space r2. For example, the logical address of the sub-physical space r2 is spliced to Figure 11 (a) is the tail of the first logical space, then correspondingly, the logical address of the sub-physical space r2 in the second logical space is deleted, and the third physical space remains unchanged, still including the sub-physical space r1, the sub-physical space r2 and the sub-physical space r3.
[0108] Therefore, through the expansion methods of the above-mentioned different embodiments, the first logical space can be expanded by increasing the physical space or splicing more physical spaces to meet the expansion requirements during system upgrades.
[0109] Specifically, if Figure 12 As shown in the figure, OTA upgrade is a software upgrade method that remotely updates the device through a wireless network (such as Wi-Fi, 4G, 5G, etc.). When performing an OTA upgrade, it may be necessary to expand the storage space. For example, if the update file is large, there are too many temporary files and backups. Figure 15As shown, in the scenario of OTA upgrade, to determine whether capacity expansion is needed, you can refer to the aforementioned method for determining the capacity requirements of the first logical space, which will not be repeated here. If capacity expansion is required, the reserved partition capacity that needs to be returned is calculated, that is, the capacity of the first target space is determined. The user data partition file system is scaled down to release space, that is, the user data in the first target space is deleted. Then, the system partition usage area is expanded, that is, the first target space is configured to the first logical space to achieve the expansion of the first logical space. After that, it is the process of system upgrade, that is, the upgrade process writes the upgrade data, restarts the device, and the upgrade ends. Therefore, during the OTA upgrade, the capacity requirements of the OTA upgrade can be met by expanding the first logical space.
[0110] It should be noted that, in addition to the above-mentioned capacity expansion requirements, capacity reduction requirements are also included. Specifically, the method provided in the embodiment of the present application also includes, if the capacity requirement is to reduce capacity, then at least part of the space in the physical space corresponding to the first logical space is used as the second target space; the logical space corresponding to the second target space is deleted in the first logical space, and merged into the second logical space, wherein the second logical space is used to store user data. In other words, when the capacity of the first logical space is remaining or the capacity of the first logical space is not needed too much, part of the capacity of the first logical space can be released, thereby alleviating the storage pressure of the second logical space, that is, providing more storage space for storing user data.
[0111] It can be understood that the shrinking process is the reverse process of the aforementioned expansion process. Compared with the expansion process which increases the first logical space by increasing the first physical space, the shrinking process is to determine the partial space adjacent to the third physical space in the current first physical space as the second target space, or to determine at least the partial space closer to the third physical space in the current first physical space as the second target space, delete the logical space corresponding to the second target space in the first logical space, and merge it into the second logical space.
[0112] In another embodiment, compared to the expansion method of increasing the first logical space through logical splicing, the shrinking process can be that when the physical space corresponding to the current first logical space includes at least part of the third physical space, the second target space can be determined from at least part of the third physical space corresponding to the current first logical space, and the logical space corresponding to the second target space can be deleted from the first logical space and merged into the second logical space.
[0113] It should be noted that the shrinking operation can refer to the aforementioned expansion operation and be implemented in a reverse processing manner.
[0114] Therefore, in the embodiment of the present application, the reserved space, i.e., the third physical space, is not wasted and can be used to store user data. When the system partition size is expanded, the process is simpler, more efficient, and consumes less energy. Only the data at the end of the file system logical address needs to be moved, and there is no need to rebuild the file system metadata area. Furthermore, the expansion operation can be performed online, that is, while the user is using the phone, because it will not affect the user data in the area before the area used for expansion in the second logical space. In other words, the operation can be performed in the background while the user is using the smart device.
[0115] See also Figure 16 , which shows a structural block diagram of a storage management device 1600 provided in an embodiment of the present application, applied to a processor of an electronic device, and the electronic device also includes the above-mentioned storage device. The device may include: a determination unit 1601 and an execution unit 1602.
[0116] The determining unit 1601 is configured to determine a current capacity requirement of a first logical space, where the first logical space is configured based at least on the first physical space and is used to store system data of the electronic device.
[0117] Furthermore, the determination unit 1601 is also used to determine the capacity parameters corresponding to the system upgrade in the scenario of the system upgrade of the electronic device; and determine the capacity requirement of the current first logical space based on the capacity space of the current first logical space and the capacity parameters.
[0118] The execution unit 1602 is configured to, if the capacity requirement is that expansion is required, perform an expansion operation on the first logical space through the third physical space.
[0119] Furthermore, the execution unit 1602 is also used to determine at least part of the space in the third physical space as the first target space if the capacity requirement requires expansion; based on the first target space, perform an expansion operation on the current first logical space to obtain a new first logical space.
[0120] Furthermore, the first physical space and the second physical space are adjacent, and the execution unit 1602 is further used to determine at least a portion of the space continuous with the first physical space in the third physical space as the first target space if the capacity requirement requires expansion.
[0121] Furthermore, the execution unit 1602 is also used to merge the first physical space and the first target space into a new first physical space, wherein the physical space outside the first target space in the third physical space is used as a new third physical space; and configure the new first physical space as a new first logical space.
[0122] Furthermore, the third physical space is located between the first physical space and the second physical space, the physical address of the third physical space is located before the first physical address of the second physical space, and the third physical space is divided into multiple sub-physical spaces along the first order. The execution unit 1602 is also used to determine at least one sub-physical space continuous with the first physical space as the first target space in the sub-physical space corresponding to the third physical space along the first order if the capacity requirement requires expansion.
[0123] Furthermore, the multiple sub-physical spaces in the current third physical space are spliced to the end of the second logical space in terms of logical address according to a second order, wherein the first order and the second order are opposite, and the second logical space is used to store user data.
[0124] Furthermore, the execution unit 1602 is further configured to concatenate the logical address of the first target space with the first logical space to obtain a new first logical space.
[0125] Furthermore, the logical addresses corresponding to at least part of the space in the third physical space that is not used to store the system data are spliced to the end of the second logical space, and the second logical space is used to store user data. The execution unit 1602 is also used to delete the logical addresses corresponding to the first target space in the second logical space.
[0126] Furthermore, the execution unit 1602 is also used to use at least part of the physical space corresponding to the first logical space as the second target space if the capacity requirement requires capacity reduction; delete the logical space corresponding to the second target space in the first logical space and merge it into the second logical space, wherein the second logical space is used to store user data.
[0127] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0128] In several embodiments provided in this application, the coupling between modules may be electrical, mechanical or other forms of coupling.
[0129] In addition, the functional modules in the various embodiments of the present application may be integrated into a processing module, or each module may exist physically separately, or two or more modules may be integrated into a single module. The above-mentioned integrated modules may be implemented in the form of hardware or software functional modules.
[0130] Please refer to Figure 17 , which shows a block diagram of a computer-readable medium provided in an embodiment of the present application. The computer-readable medium 1700 stores program code, which can be called by a processor to execute the method described in the above method embodiment.
[0131] Computer-readable medium 1700 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, hard disk, or ROM. Alternatively, computer-readable medium 1700 may include non-transitory computer-readable storage medium. Computer-readable medium 1700 has storage space for program code 1710 for executing any of the method steps described above. This program code can be read from or written to one or more computer program products. Program code 1710 may be compressed, for example, in a suitable form.
[0132] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A storage device, characterized in that: Applied to an electronic device, the storage device comprises a first physical space, a second physical space and a third physical space; The first physical space is used to store system data of the electronic device; The second physical space is used to store user data of the electronic device; The third physical space is configured to store system data and / or user data according to the requirements of expansion or contraction of the storage device.
2. The storage device according to claim 1, wherein: The physical address of the third physical space is located before the first physical address of the second physical space.
3. The storage device according to claim 2, wherein: The third physical space is located between the first physical space and the second physical space.
4. The storage device according to claim 1, wherein: The third physical space is divided into a plurality of sub-physical spaces, and each of the sub-physical spaces is used to store the system data or user data.
5. The storage device according to claim 4, wherein: The maximum storage capacity of each of the sub-physical spaces is the same.
6. A storage management method, characterized in that: A processor applied to an electronic device, wherein the electronic device further comprises the storage device according to any one of claims 1 to 5, wherein the method comprises: determining a current capacity requirement of a first logical space, wherein the first logical space is configured based on at least the first physical space, and the first logical space is used to store system data of the electronic device; If the capacity requirement is that capacity expansion is required, an expansion operation is performed on the first logical space through the third physical space.
7. The method according to claim 6, characterized in that If the capacity requirement is that expansion is required, performing an expansion operation on the first logical space through the third physical space includes: If the capacity requirement is that capacity expansion is required, determining at least a portion of the space in the third physical space as a first target space; Based on the first target space, an expansion operation is performed on the current first logical space to obtain a new first logical space.
8. The method according to claim 7, characterized in that The first physical space and the second physical space are adjacent to each other, and if the capacity requirement is that capacity expansion is required, determining at least part of the space in the third physical space as the first target space includes: If the capacity requirement is to expand capacity, in the third physical space, at least a portion of space continuous with the first physical space is determined as a first target space.
9. The method according to claim 8, characterized in that The step of performing an expansion operation on the current first logical space based on the first target space to obtain a new first logical space includes: merging the first physical space and the first target space into a new first physical space, wherein the physical space other than the first target space in the third physical space is used as the new third physical space; The new first physical space is configured as a new first logical space.
10. The method according to claim 8, characterized in that The third physical space is located between the first physical space and the second physical space, a physical address of the third physical space is located before a first physical address of the second physical space, the third physical space is divided into a plurality of sub-physical spaces along a first sequence, and if the capacity requirement is that capacity expansion is required, determining, in the third physical space, at least a portion of space that is continuous with the first physical space as a first target space, includes: If the capacity requirement is for expansion, in the sub-physical space corresponding to the third physical space, at least one sub-physical space continuous with the first physical space is determined as the first target space along the first order.
11. The method according to claim 10, characterized in that The multiple sub-physical spaces in the current third physical space are spliced to the end of the second logical space in the logical address according to the second order, wherein the first order and the second order are opposite, and the second logical space is used to store user data.
12. The method according to claim 7, characterized in that The step of performing an expansion operation on the current first logical space based on the first target space to obtain a new first logical space includes: The logical address of the first target space is concatenated with the first logical space to obtain a new first logical space.
13. The method according to claim 7, characterized in that The logical addresses corresponding to at least a portion of the space in the third physical space that is not used to store the system data are spliced to the end of the second logical space, where the second logical space is used to store user data. If the capacity requirement is that capacity expansion is required, after determining at least a portion of the space in the third physical space as the first target space, the method further includes: The logical address corresponding to the first target space is deleted in the second logical space.
14. The method according to claim 6, characterized in that Also includes: If the capacity requirement is to reduce the capacity, at least part of the physical space corresponding to the first logical space is used as the second target space; The logical space corresponding to the second target space is deleted from the first logical space and merged into the second logical space, wherein the second logical space is used to store user data.
15. The method according to any one of claims 6 to 14, characterized in that: The determining of the current capacity requirement of the first logical space includes: In a scenario of a system upgrade of the electronic device, determining a capacity parameter corresponding to the system upgrade; Based on the current capacity of the first logical space and the capacity parameter, the current capacity requirement of the first logical space is determined.
16. A storage management device, characterized in that: A processor applied to an electronic device, wherein the electronic device further comprises the storage device according to any one of claims 1 to 5, wherein the apparatus comprises: a determining unit, configured to determine a current capacity requirement of a first logical space, wherein the first logical space is configured based on at least the first physical space, and the first logical space is used to store system data of the electronic device; An execution unit is configured to, if the capacity requirement is for expansion, perform a capacity expansion operation on the first logical space through the third physical space.
17. An electronic device, characterized in that: include: processor; The storage device according to any one of claims 1 to 5 above; A processor, configured to execute the method according to any one of claims 6 to 15.
18. A computer-readable medium, characterized in that The computer-readable medium stores a program code executable by a processor, and when the program code is executed by the processor, the processor executes the method according to any one of claims 6 to 15.