Over-provisioning adjustment method, system, device, storage medium, and program product
By sending write requests and mapping deletion requests to the solid-state drive (SSD), the mapping relationship between the logical and physical areas is dynamically adjusted, solving the problem that the reserved space of the SSD cannot be dynamically adjusted, and realizing simple and safe reserved space adjustment.
Patent Information
- Application Number
- PCT/CN2025/103944
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-07-08
- Filing Date
- 2025-06-26
- Publication Date
- 2026-01-15
AI Technical Summary
In existing technologies, the reserved space of solid-state drives cannot be dynamically adjusted, requiring users to perform complex operations and posing data security risks.
By sending write requests and mapping deletion requests to the solid-state drive, the usage status of the logical area and the mapping relationship of the physical area can be dynamically adjusted, increasing or decreasing the reserved space.
It enables simple and easy adjustment of reserved space without formatting the solid-state drive, conforms to the semantics of the host operating system, and improves operational efficiency and security.
Smart Images

Figure CN2025103944_15012026_PF_FP_ABST
Abstract
Description
Methods, systems, equipment, storage media, and software products for adjusting reserved space
[0001] This disclosure claims priority to Chinese Patent Application No. 202410912542.X, filed with the China Patent Office on July 8, 2024, entitled “Method, System, Apparatus, Storage Medium and Program Product for Adjusting Reserved Space”, the entire contents of which are incorporated herein by reference. Technical Field
[0002] This disclosure relates to the field of computer technology, and in particular to a method, system, device, storage medium, and program product for adjusting reserved space. Background Technology
[0003] Over-provisioning (OP) refers to the storage capacity reserved in a solid-state drive (SSD). This storage capacity is unusable by the host computer; in other words, reserved space is the difference between the actual physical capacity of the SSD and the usable capacity. Over-provisioning can improve SSD performance and durability.
[0004] Typically, SSD manufacturers do not provide external interfaces for users to dynamically adjust the reserved space size of SSDs; the reserved space is set at the factory. Currently, the common practice is to reformat the drive and then use an external tool provided by the manufacturer to reset the reserved space. This method relies on the user first copying and backing up the data on the drive, and it also depends on external tools, making it complex, inefficient, and posing data security risks. Summary of the Invention
[0005] In view of the above problems, this disclosure is made to provide an adjustment method, system, device, storage medium, and program product for resolving or at least partially resolving the above problems.
[0006] A first aspect of this disclosure provides an information recommendation method applicable to a host communicatively connected to the solid-state drive; the method includes:
[0007] When it is necessary to increase the reserved space of the solid-state drive, a write request is sent to the solid-state drive; wherein, the write request carries the data to be written, the size of the data to be written, and the target logical address; the size of the data to be written and the target logical address are used to define the target logical area;
[0008] After the solid-state drive completes the writing process of the data to be written, the usage status of the target logical area is set to non-idle state;
[0009] Send a mapping relationship deletion request to the solid-state drive; wherein, the mapping relationship deletion request is used to request the deletion of the mapping relationship between the target logical area and the target physical area; the mapping relationship is created by the solid-state drive during the writing process of the data to be written; the target physical area is the physical area in the solid-state drive used to store the data to be written.
[0010] In the technical solution provided by this disclosure, when it is necessary to increase the reserved space of the solid-state drive (SSD), a write request is sent to the SSD to set the usage state of the target logical area to a non-idle state and delete the mapping relationship between the target logical area and the target physical area used to store the data to be written in the write request. In this way, the target logical area is occupied (i.e., inaccessible to the user), and the target physical area is released (i.e., can be mapped to user data). That is, the logical space capacity accessible to the user is reduced, and consequently, the physical space capacity accessible to the user is also reduced. The actual physical capacity of the SSD remains unchanged; the reduction in the physical space capacity accessible to the user is equivalent to an increase in the actual reserved space capacity of the SSD.
[0011] It should be noted that in this embodiment, occupying a portion of the logical area by sending write requests and mapping deletion requests to increase the reserved space of the SSD is consistent with the operational semantics of the host operating system, and the size of the SSD's reserved space can be adjusted without formatting the SSD. Therefore, the dynamic adjustment scheme for SSD reserved space provided in this embodiment is simple and easy to implement.
[0012] Optionally, the starting address of the target logical area is the target logical address; the length of the target logical area is determined by the size of the data to be written. For example, the length of the target logical area is the size of the data to be written. It should be noted that the size of the data to be written is also the length of the data to be written.
[0013] In one embodiment provided in the first aspect of this disclosure, the method further includes:
[0014] When it is necessary to increase the reserved space of the solid-state drive, determine the amount of reserved space that needs to be increased;
[0015] The size of the data to be written is determined based on the amount of additional reserved space required.
[0016] Optionally, the size of the data to be written is equal to the size of the required additional reserved space.
[0017] In one embodiment provided in the first aspect of this disclosure, the method further includes:
[0018] The data to be written is generated based on the size of the data to be written.
[0019] In this embodiment of the disclosure, the specific content of the data to be written can be randomly generated, as long as the size of the data to be written meets the requirements.
[0020] In one embodiment provided in the first aspect of this disclosure, the method further includes:
[0021] Receive adjustment instructions from the user; the adjustment instructions are used to instruct the user to adjust the size of the reserved space on the solid-state drive.
[0022] Based on the adjustment instructions, determine whether it is necessary to increase the reserved space of the solid-state drive.
[0023] In this embodiment of the disclosure, the user can send adjustment commands to the host according to actual needs to dynamically adjust the size of the reserved space of the solid-state drive.
[0024] In one embodiment provided in the first aspect of this disclosure, the method further includes:
[0025] When it is necessary to reduce the reserved space of the solid-state drive, a logical sub-area is determined from the target logical area;
[0026] Set the usage status of the logical sub-region to idle.
[0027] In this embodiment, after setting the usage state of the logical sub-region to an idle state, the logical sub-region can be accessed by the user. This increases the logical space capacity accessible to the user, and consequently, the physical space capacity accessible to the user also increases. The actual physical capacity of the SSD remains unchanged; however, the increase in the physical space capacity accessible to the user is equivalent to a decrease in the actual reserved space capacity of the SSD.
[0028] In one embodiment provided in the first aspect of this disclosure, when it is necessary to reduce the reserved space of the solid-state drive, determining a logical sub-region from the target logical region includes:
[0029] When it is necessary to reduce the reserved space of the solid-state drive, determine the amount of reserved space to be reduced;
[0030] Based on the required reduction in reserved space, determine the logical sub-regions from the target logical region;
[0031] The size of the logical sub-region is equal to the amount of reserved space that needs to be reduced.
[0032] In one embodiment provided in the first aspect of this disclosure, the solid-state drive stores a mapping table; the mapping relationship is recorded in the mapping table.
[0033] After the mapping relationship in the mapping table is deleted, the physical pages in the target physical area are set as invalid pages by the solid-state drive;
[0034] After the invalid page is reclaimed, it is set as a free page by the solid-state drive.
[0035] In one embodiment provided in the first aspect of this disclosure, the host computer runs an application for adjusting the reserved space size of the solid-state drive;
[0036] The write request is generated by the application.
[0037] Once the target logical area is set to a non-idle state, the target logical area cannot be accessed by other applications on the host.
[0038] Other applications are distinct from those used to adjust the reserved space size of the solid-state drive.
[0039] A second aspect of this disclosure provides a system for adjusting reserved space in a solid-state drive (SSD), comprising: the SSD and a host communicatively connected to the SSD; wherein,
[0040] The host is configured to: send a write request to the solid-state drive when it is necessary to increase the reserved space of the solid-state drive; wherein the write request carries the data to be written, the size of the data to be written, and the target logical address; the size of the data to be written and the target logical address are used to define the target logical area;
[0041] The solid-state drive is used to: execute the writing process of the data to be written according to the write request;
[0042] The host is further configured to: after the solid-state drive completes the writing process of the data to be written, set the usage status of the target logical area to a non-idle state; and send a mapping relationship deletion request to the solid-state drive.
[0043] The solid-state drive is further configured to: delete the mapping relationship between the target logical area and the target physical area according to the mapping relationship deletion request; the mapping relationship is created by the solid-state drive during the writing process of the data to be written; the target physical area is the physical area in the solid-state drive used to store the data to be written.
[0044] A third aspect of this disclosure provides an electronic device. The electronic device includes: a memory and a processor, wherein,
[0045] The memory is used to store programs;
[0046] The processor, coupled to the memory, is configured to execute the program stored in the memory to implement the method described in any of the preceding embodiments.
[0047] A fourth aspect of this disclosure provides a computer-readable storage medium storing a computer program that, when executed by a computer, can implement any of the numerical methods described above.
[0048] A fourth aspect of this disclosure provides a computer program product including a computer program that, when executed by a processor, implements the method described in any of the preceding claims. Attached Figure Description
[0049] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0050] Figure 1a is an interactive signaling diagram of a method for dynamically adjusting SSD reserved space according to an embodiment of this disclosure;
[0051] Figure 1b is a schematic diagram of the mapping relationship between the logical address space and the physical address space of an SSD provided in an embodiment of this disclosure;
[0052] Figure 2 is an interactive signaling diagram of a method for dynamically adjusting SSD reserved space according to an embodiment of this disclosure;
[0053] Figure 3 is a flowchart illustrating a method for dynamically adjusting SSD reserved space according to an embodiment of this disclosure;
[0054] Figure 4 is a structural block diagram of an electronic device provided in an embodiment of this disclosure. Detailed Implementation
[0055] To enable those skilled in the art to better understand the present disclosure, the technical solutions of the present disclosure will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are merely some embodiments of the present disclosure, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present disclosure without creative effort are within the scope of protection of the present disclosure.
[0056] Furthermore, some processes described in the specification, claims, and accompanying drawings of this disclosure include multiple operations that appear in a specific order. These operations may be performed out of order or in parallel. Operation numbers such as 101, 102, etc., are merely used to distinguish different operations and do not represent any execution order. Additionally, these processes may include more or fewer operations, and these operations may be performed sequentially or in parallel. It should be noted that the terms "first," "second," etc., used herein are used to distinguish different messages, devices, modules, etc., and do not represent a chronological order, nor do they limit "first" and "second" to different types.
[0057] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.
[0058] First, the terminology used in the embodiments of this disclosure will be explained. It should be understood that this explanation is for the purpose of providing a clearer understanding of the embodiments of this disclosure and does not necessarily constitute a limitation thereof.
[0059] Solid-state drives (SSDs) are hard drives made of solid-state electronic storage chips. They consist of a control unit (or control chip, the brain of the SSD) and storage units (or storage chips). The storage units can be flash memory (FLASH chips) or DRAM (Dynamic Random Access Memory) chips. Flash-based SSDs are the main type of SSD. Their internal structure is very simple; the main body of an SSD is a PCB (Printed Circuit Board), on which components include the control chip and the flash memory chips for data storage. SSDs offer fast read and write speeds, high random access performance, and use circuitry to control access locations. Some SSDs also include a cache unit.
[0060] To facilitate understanding of the technical solutions provided in this disclosure, a detailed introduction to SSDs based on flash memory chips is provided below.
[0061] An SSD consists of a controller (also known as a master controller), multiple flash memory chips (e.g., NAND flash memory chips), and a host interface. The master controller controls multiple flash memory chips in parallel through several channels, greatly improving the underlying bandwidth. Each flash memory chip consists of multiple blocks, and each block contains multiple physical pages. Physical pages are where user data is actually stored; that is, the data in the physical pages is the data saved by the user. Some SSDs also include cache units.
[0062] The host interacts with the SSD through the host interface. The host accesses the SSD via logical addresses, and the basic unit of host access to the SSD is called a host page (or logical page). Internally, the controller and flash memory chips access the flash memory in units of physical pages. The SSD maintains a mapping table to maintain the mapping from logical addresses to physical addresses (i.e., the mapping from user pages to physical pages). During each read / write operation, the physical address can be directly calculated from the table using the logical address.
[0063] Logical address: This refers to the address used by a program during execution, also known as a virtual address. It is generated by the host operating system and used to access data in the SSD. The size and number of bits of the logical address depend on the processor architecture and operating system design, and it is usually a fixed-length binary value. The SSD controller retrieves data by translating logical addresses into physical addresses. The physical address refers to the actual address within the SSD.
[0064] A physical page is the smallest unit of data access on an SSD. Each data access operation requires at least one physical page, and each physical page is typically 4KB or 8KB in size. SSD writes are divided into two types: new writes and overwrite writes (or updates), with different processing flows. The new write process involves finding a free physical page, writing the data to the free physical page, and updating the mapping table. Since SSDs cannot directly overwrite, the overwrite write process is as follows: When it is necessary to update certain bytes in physical page G, a free physical page H must first be found. The data in physical page G is read into the SSD's internal cache, the bytes to be updated are updated in the cache, the data in the cache is written to the free physical page H, physical page G is set to an invalid page in the mapping table, and a mapping relationship is added to the mapping table for the free physical page H (i.e., adding a mapping relationship from the user page accessed by the host to the free physical page H).
[0065] Typically, SSDs also have reserved space. This reserved space refers to the storage capacity set aside from the SSD; this storage capacity is unusable by the host machine. In other words, reserved space represents the capacity that the user cannot operate on, and its size is the difference between the SSD's actual physical capacity and its usable physical capacity. In other words, the actual storage space of the SSD is larger than the writable space. Usable physical capacity refers to the physical capacity provided by the SSD to the user or the physical capacity available to the host machine.
[0066] If there are many write operations, a large number of invalid pages will be generated, similar to disk fragmentation. In this case, the SSD's garbage collection (GC) mechanism is needed to reclaim this space. During garbage collection, the aforementioned reserved space needs to be utilized.
[0067] Furthermore, reserved space can improve SSD performance because it provides additional buffer space to the flash controller to manage program / erase (P / E) cycles and increases the likelihood that write operations will directly enter pre-erase blocks. Reserved space can also improve the durability of SSDs because it distributes the total number of writes and erases across more flash blocks (e.g., NAND blocks) and pages. It's worth noting that an SSD block may fail if erased too many times.
[0068] During garbage collection, data migration is involved (for example, when erasing invalid pages to reclaim their space, valid data from other pages in the block containing the invalid page needs to be migrated to an empty block before erasing the block containing the invalid page). Data migration within an SSD is internal disk migration traffic, which affects SSD access performance. Therefore, the larger the reserved space, the fewer invalid pages there are in a significant number of blocks when garbage collection is needed (e.g., when the SSD's space utilization exceeds a preset threshold). Erasing these blocks requires migrating much less data, thus reducing migration traffic. Therefore, a larger reserved space results in better SSD access performance. Space utilization refers to the ratio of the SSD's actual data storage capacity to its actual physical capacity. The actual data storage capacity of an SSD is the sum of the data stored in valid pages and the data stored in invalid pages. Generally, when the SSD's space utilization exceeds a preset threshold, the actual data storage capacity will exceed the available physical capacity, but the sum of the data stored in valid pages will always be less than or equal to the available physical capacity.
[0069] The following section will introduce the method for dynamically increasing the reserved space of a solid-state drive, with reference to Figure 1a:
[0070] 100. The first application on the host receives the user's adjustment command to increase the reserved space on the solid-state drive.
[0071] The first application is the one used to adjust the reserved space size of the solid-state drive.
[0072] This adjustment command is also an adjustment command carrying a first prompt message; the first prompt message is used to prompt the user to increase the reserved space of the solid-state drive.
[0073] For example, a user can input the above instructions through the interface provided by the first application on the host.
[0074] For example, when the host is a server, the user can send the above instructions to the server through a terminal device.
[0075] For example, the above adjustment instructions may also carry the required increase in the amount of reserved space.
[0076] 101. The first application on the host sends a write request to the solid-state drive based on the required increase in reserved space.
[0077] The host and the solid-state drive are connected via a communication interface.
[0078] The write request includes the data to be written, the target logical address, and the length (size) of the data to be written.
[0079] The size of the data to be written is the same as the amount of additional reserved space required.
[0080] The target logical address and the length of the data to be written are used to define the logical area (i.e., the target logical area) for storing the data to be written. The starting address of this logical area is the target logical address, and the length of this logical area is the length of the data to be written. This logical area is located in the logical address space corresponding to the solid-state drive (SSD). The target logical address is located in the logical address space corresponding to the SSD. The size of the logical address space corresponding to the SSD is equal to the available physical capacity of the SSD.
[0081] When the host sends a write request to the solid-state drive, the above logical area is in an idle state, that is, the usage status is idle, for example, its used field is 0.
[0082] In this embodiment of the disclosure, the solid-state drive is in operation when the first application on the host sends a write request to the solid-state drive.
[0083] For example, the first application can send the above-mentioned write request to the host's operating system through the write interface provided by the operating system, and the operating system can send the write request to the solid-state drive through the communication interface.
[0084] 102. The solid-state drive allocates a physical area (i.e., the target physical area mentioned above) from the physical address space of the solid-state drive according to the target logical address carried in the write request and the length of the data to be written.
[0085] Optionally, the physical region is in an idle state. That is, the physical pages within the physical region are in an idle state, or the physical pages within the physical region are free pages.
[0086] The length of the physical region is equal to the length of the data to be written. The starting address of the physical region is called the target physical address.
[0087] 103. Solid-state drives establish a mapping relationship between logical areas and physical areas in the mapping table.
[0088] Specifically, the above mapping relationship can be a mapping relationship between the target logical address and the target physical address.
[0089] In practical applications, solid-state drives can also write the data to be written carried in the write request to the physical area. The step of writing the data to be written to the physical area can be performed before or after step 103 above, and this disclosure embodiment does not specifically limit this.
[0090] 104. After the solid-state drive completes the mapping relationship, notify the host that the write was successful.
[0091] 105. After the solid-state drive completes the mapping relationship, the host sets the usage status of the logical area to non-idle.
[0092] For example, setting the `used` field of this logical area to 1. It's important to note that after the usage status of this logical area is set to non-idle, when other user programs on the host (excluding the first user program) need to perform write operations, the operating system will only allocate an idle logical area from the logical address space for those other user programs. In other words, the operating system will not allocate a logical area with a non-idle usage status to those other user programs. Therefore, after the usage status of this logical area is set to non-idle, it can only be used by the first user program (equivalent to the logical area being occupied by the first user program) and cannot be used by other user programs on the host.
[0093] The logical address space of a solid-state drive (SSD) occupied by the first user program can be called the reserved logical space, which cannot be used by the user.
[0094] After the solid-state drive establishes the above mapping relationship, it can notify the host that the write was successful (that is, the write process of the data to be written is completed), and then the host (specifically the host's operating system) executes the above step 105.
[0095] 106. The first application on the host sends a deletion request to the solid-state drive to delete the above mapping relationship (that is, the mapping relationship deletion request mentioned above).
[0096] After the host operating system completes step 105, it can notify the first application that the write was successful. Then, the first application executes step 106. Specifically, the first application generates a deletion request and sends it to the operating system through the interface provided by the host operating system. The operating system then sends the deletion request to the solid-state drive.
[0097] 107. The solid-state drive deletes the above mapping relationship in the above mapping table.
[0098] After deleting the mapping relationship from the above mapping table, the solid-state drive (SSD) sets the above physical region as an invalid region in the mapping table, that is, sets the physical pages within the above physical region as invalid pages. Invalid pages will be reclaimed during subsequent garbage collection.
[0099] After the above mapping relationship is deleted, the physical address in the above physical area can be mapped to other logical addresses outside the above logical area.
[0100] For example, the operations performed by the solid-state drive are specifically implemented by the controller on the solid-state drive.
[0101] As shown in Figure 1b, the reserved logical areas 11a, 11b, and 11c in the SSD's logical address space constitute the logical reserved space. For example, the target logical area mentioned above is the reserved logical area 11a in Figure 1b, and the mapping relationship between the reserved logical area 11a and the target physical area 12 in the SSD's physical address space (represented by the line connecting the two in Figure 1b) is deleted.
[0102] In this embodiment, the aforementioned logical area is equivalent to a reserved logical space. This reserved logical space is inaccessible to users (i.e., programs on the host other than the first application). In other words, the capacity of the logical space accessible to users is reduced, and consequently, the capacity of the physical space accessible to users is also reduced. The actual physical capacity of the SSD remains unchanged. The reduction in the capacity of the physical space accessible to users is equivalent to an increase in the actual reserved space capacity of the SSD.
[0103] It should be noted that the data to be written stored in the aforementioned physical area will be erased during the SSD's garbage collection process. That is, invalid pages within the physical area are reclaimed and made available for writing user data again. After being reclaimed, invalid pages are designated as free pages by the SSD. These free pages can be used in subsequent new write or overwrite processes. The specific garbage collection process can be found in the relevant sections of the above embodiments and will not be detailed here.
[0104] The following section will explain the method for dynamically reducing the reserved space of a solid-state drive, with reference to Figure 2:
[0105] 200. The first application on the host receives the user's adjustment command to reduce the reserved space on the solid-state drive.
[0106] This adjustment instruction is also an adjustment instruction carrying a second prompt message, which is used to prompt the reduction of the reserved space of the solid-state drive.
[0107] For example, a user can input the above instructions through the interface provided by the first application on the host.
[0108] For example, when the host is a server, the user can send the above instructions to the server through a terminal device.
[0109] For example, the above instructions may include the desired reduction in the amount of reserved space.
[0110] 201. The first application on the host sets the usage status of the first logical area currently occupied by the first application to an idle state according to the required reduction in reserved space.
[0111] The size of the first logic area is the same as the amount of reserved space that needs to be reduced.
[0112] It should be noted that the aforementioned target logical area is also the logical area occupied by the first application. The aforementioned first logical area can be a sub-area of the aforementioned target logical area. The length of this sub-area can be less than or equal to the length of the target logical area.
[0113] Figure 3 is a flowchart illustrating a method for adjusting reserved space in a solid-state drive according to an embodiment of this disclosure. The method is executed by a host computer communicatively connected to the solid-state drive. As shown in Figure 3, the method includes:
[0114] 301. When it is necessary to increase the reserved space of the solid-state drive, send a write request to the solid-state drive.
[0115] The write request includes the data to be written, the size of the data to be written, and the target logical address; the size of the data to be written and the target logical address are used to define the target logical area.
[0116] 302. After the solid-state drive completes the writing process of the data to be written, the usage status of the target logical area is set to non-idle state.
[0117] 303. Send a mapping deletion request to the solid-state drive.
[0118] The mapping relationship deletion request is used to request the deletion of the mapping relationship between the target logical area and the target physical area; the mapping relationship is created by the solid-state drive during the writing process of the data to be written; the target physical area is the physical area in the solid-state drive used to store the data to be written.
[0119] In the technical solution provided by this disclosure, when it is necessary to increase the reserved space of the solid-state drive (SSD), a write request is sent to the SSD to set the usage state of the target logical area to a non-idle state and delete the mapping relationship between the target logical area and the target physical area used to store the data to be written in the write request. In this way, the target logical area is occupied (i.e., inaccessible to the user), and the target physical area is released (i.e., can be mapped to user data). That is, the logical space capacity accessible to the user is reduced, and consequently, the physical space capacity accessible to the user is also reduced. The actual physical capacity of the SSD remains unchanged; the reduction in the physical space capacity accessible to the user is equivalent to an increase in the actual reserved space capacity of the SSD.
[0120] It should be noted that in this embodiment of the disclosure, occupying part of the logical area by sending write requests and mapping relationship deletion requests to increase the reserved space of the SSD is in line with the operating semantics of the host operating system.
[0121] The SSD reserved space adjustment scheme provided in this disclosure does not require backing up the data already stored in the SSD or formatting it before adjustment. Furthermore, the adjustment scheme is simple and easy to implement.
[0122] Optionally, the method further includes:
[0123] 304. When it is necessary to increase the reserved space of the solid-state drive, determine the amount of reserved space to be increased.
[0124] 305. Determine the size of the data to be written based on the required amount of additional reserved space.
[0125] Optionally, the size of the data to be written is equal to the size of the required additional reserved space.
[0126] This disclosure provides a technical solution for dynamically increasing SSD reserved space. In this solution, when additional reserved space is needed, the required increase in reserved logical space is determined by defining the size of the data to be written in the write request. The size of the data to be written in the write request is easily controlled; by controlling the size of the data to be written in the write request, the required increase in reserved logical space is defined within the logical address space of the solid-state drive. Therefore, the technical solution for dynamically increasing SSD reserved space provided by this disclosure is simple and easy to operate.
[0127] Optionally, the method further includes:
[0128] 306. Generate the data to be written based on the size of the data to be written.
[0129] The size of the generated data to be written is defined by the size of the data to be written determined in step 305 above. The content of the generated data to be written can be random or generated according to the default configuration (e.g., the data on each bit is 0 or 1).
[0130] Optionally, the method further includes:
[0131] 307. Receive adjustment instructions from users.
[0132] The adjustment command is used to instruct the adjustment of the size of the reserved space of the solid-state drive.
[0133] 308. Based on the adjustment instruction, determine whether it is necessary to increase the reserved space of the solid-state drive.
[0134] For example, the adjustment instruction may carry a first instruction indicating that the reserved space of the solid-state drive (SSD) needs to be increased, or a second instruction indicating that the reserved space of the SSD needs to be decreased. When the adjustment instruction carries the first instruction, it is determined that the reserved space of the SSD needs to be increased. When the adjustment instruction carries the second instruction, it is determined that the reserved space of the SSD needs to be decreased.
[0135] For example, the above adjustment instructions may also include the amount of reserved space to be increased or decreased.
[0136] For example, the adjustment instruction mentioned above may include the required target reserved space size. After receiving the adjustment instruction, the host determines, based on the required target reserved space size and the current reserved space size of the SSD, whether it is necessary to increase or decrease the reserved space of the SSD.
[0137] It should be noted that the current reserved space of the SSD is greater than or equal to the initial reserved space of the SSD. The initial reserved space refers to the space set by the SSD manufacturer for the SSD drive.
[0138] For example, the required increase or decrease in reserved space is determined based on the target reserved space size and the current reserved space size of the SSD.
[0139] Optionally, the method further includes:
[0140] 309. When it is necessary to reduce the reserved space of the solid-state drive, a logical sub-area is determined from the target logical area.
[0141] 310. Set the usage status of the logical sub-region to an idle state. Optionally, 309 above can be implemented using the following steps:
[0142] 3091. When it is necessary to reduce the reserved space of the solid-state drive, determine the amount of reserved space to be reduced.
[0143] 3092. Based on the required reduction in reserved space, determine the logical sub-region from the target logical region.
[0144] The size of the logical sub-region is equal to the amount of reserved space that needs to be reduced.
[0145] The aforementioned target logical area belongs to the reserved logical space of the SSD. A logical sub-area is determined from the reserved logical space of the SSD and then released. This allows the user to use the logical sub-area, effectively increasing the amount of logical space available to the user, which in turn increases the amount of physical space available, thereby reducing the reserved space on the SSD. The technical solution for dynamically increasing the reserved space on the SSD provided in this disclosure is simple, easy to operate, and requires no data backup.
[0146] Optionally, the solid-state drive stores a mapping table; the mapping relationship is recorded in the mapping table.
[0147] After the mapping relationship in the mapping table is deleted, the physical pages in the target physical area are set as invalid pages by the solid-state drive;
[0148] After the invalid page is reclaimed, it is set as a free page by the solid-state drive.
[0149] In this embodiment, the deletion of a mapping relationship in the mapping table automatically triggers the SSD to mark it as an invalid page, reclaim the invalid page, and set it as a free page. These are all existing processing logics of the SSD. In other words, this solution achieves dynamic adjustment of the reserved space on the SSD without modifying the SSD itself. Specifically, this solution only requires designing an additional application for adjusting the reserved space size of the SSD and installing it on the host to achieve dynamic adjustment of the reserved space on the SSD, without requiring any modifications to the SSD. Therefore, the solution provided by this embodiment has good compatibility.
[0150] Optionally, the host computer runs an application for adjusting the reserved space size of the solid-state drive;
[0151] The write request is generated by the application.
[0152] Once the target logical area is set to a non-idle state, the target logical area cannot be accessed by other applications on the host.
[0153] It should be noted that any steps in the method provided in this disclosure that are not fully described in detail can be found in the corresponding content of the above embodiments, and will not be repeated here. Furthermore, the method provided in this disclosure may include other parts or all of the steps in the above embodiments in addition to the steps described above; for details, please refer to the corresponding content of the above embodiments, and will not be repeated here.
[0154] This disclosure also provides a system for adjusting reserved space in a solid-state drive (SSD). The system includes: the SSD and a host communicatively connected to the SSD; wherein,
[0155] The host is configured to: send a write request to the solid-state drive when it is necessary to increase the reserved space of the solid-state drive; wherein the write request carries the data to be written, the size of the data to be written, and the target logical address; the size of the data to be written and the target logical address are used to define the target logical area;
[0156] The solid-state drive is used to: execute the writing process of the data to be written according to the write request;
[0157] The host is further configured to: after the solid-state drive completes the writing process of the data to be written, set the usage status of the target logical area to a non-idle state; and send a mapping relationship deletion request to the solid-state drive.
[0158] The solid-state drive is further configured to: delete the mapping relationship between the target logical area and the target physical area according to the mapping relationship deletion request; the mapping relationship is created by the solid-state drive during the writing process of the data to be written; the target physical area is the physical area in the solid-state drive used to store the data to be written.
[0159] It should be noted that the specific implementation of each unit in the system provided in this embodiment and the specific interactions between units can be found in the corresponding content in the above embodiments, and will not be repeated here.
[0160] The terminal device mentioned in the embodiments of this disclosure may also be referred to as a terminal. It can be a mobile terminal, a fixed terminal, or a portable terminal, such as a mobile phone, site, unit, device, multimedia computer, multimedia tablet, internet node, communicator, desktop computer, laptop computer, notebook computer, netbook computer, tablet computer, personal communication system (PCS) device, personal navigation device, personal digital assistant (PDA), audio / video player, digital camera / camcorder, positioning device, television receiver, radio broadcast receiver, e-book device, gaming device, or any combination thereof, including accessories, peripherals, or any combination thereof for these devices. It is also foreseeable that the terminal device can support any type of user-facing interface device (e.g., wearable device).
[0161] The server mentioned in the embodiments of this disclosure can be one or more servers. The server can also be a physical server or a virtual server, etc. The server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.
[0162] Figure 4 shows a schematic diagram of the structure of an electronic device provided according to an embodiment of the present disclosure. As shown in Figure 4, the electronic device includes a memory 1101 and a processor 1102. The memory 1101 can be configured to store various other data to support operation on the electronic device. Examples of such data include instructions for any application or method used to operate on the electronic device. The memory 1101 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Electrically Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0163] The memory 1101 is used to store programs;
[0164] The processor 1102 is coupled to the memory 1101 and is used to execute the program stored in the memory 1101 to implement the methods provided in the above-described method embodiments.
[0165] Furthermore, as shown in Figure 4, the electronic device also includes other components such as a communication component 1103, a display 1104, a power supply component 1105, and an audio component 1106. Figure 4 only schematically shows some of the components and does not imply that the electronic device includes only the components shown in Figure 4.
[0166] Accordingly, this disclosure also provides a computer-readable storage medium storing a computer program, which, when executed by a computer, can implement the steps or functions of the methods provided in the above-described method embodiments.
[0167] This disclosure also provides a computer program product, including a computer program that, when executed by a processor, can implement the steps or functions of the methods provided in the above-described method embodiments.
[0168] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0169] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM (Read Only Memory) / RAM (Random Access Memory), magnetic disk, optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0170] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this disclosure, and are not intended to limit them. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions 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 this disclosure.
Claims
1. A method for adjusting reserved space in a solid-state drive, wherein, Applicable to a host communicating with the solid-state drive; the method includes: When it is necessary to increase the reserved space of the solid-state drive, a write request is sent to the solid-state drive; wherein, the write request carries the data to be written, the size of the data to be written, and the target logical address; the size of the data to be written and the target logical address are used to define the target logical area; After the solid-state drive completes the writing process of the data to be written, the usage status of the target logical area is set to non-idle state; Send a mapping relationship deletion request to the solid-state drive; wherein, the mapping relationship deletion request is used to request the deletion of the mapping relationship between the target logical area and the target physical area; the mapping relationship is created by the solid-state drive during the writing process of the data to be written; the target physical area is the physical area in the solid-state drive used to store the data to be written.
2. The method according to claim 1, wherein, Also includes: When it is necessary to increase the reserved space of the solid-state drive, determine the amount of reserved space that needs to be increased; The size of the data to be written is determined based on the amount of additional reserved space required.
3. The method according to claim 2, wherein, The size of the data to be written is equal to the size of the required additional reserved space.
4. The method according to any one of claims 1-3, wherein, Also includes: The data to be written is generated based on the size of the data to be written.
5. The method according to any one of claims 1-4, wherein, Also includes: Receive adjustment instructions from the user; the adjustment instructions are used to instruct the user to adjust the size of the reserved space on the solid-state drive. Based on the adjustment instructions, determine whether it is necessary to increase the reserved space of the solid-state drive.
6. The method according to any one of claims 1-5, wherein, Also includes: When it is necessary to reduce the reserved space of the solid-state drive, a logical sub-area is determined from the target logical area; Set the usage status of the logical sub-region to idle.
7. The method according to claim 6, wherein, When it is necessary to reduce the reserved space of the solid-state drive, a logical sub-region is determined from the target logical region, including: When it is necessary to reduce the reserved space of the solid-state drive, determine the amount of reserved space to be reduced; Based on the required reduction in reserved space, determine the logical sub-regions from the target logical region; The size of the logical sub-region is equal to the amount of reserved space that needs to be reduced.
8. The method according to any one of claims 1-7, wherein, The solid-state drive stores a mapping table; the mapping relationship is recorded in the mapping table. After the mapping relationship in the mapping table is deleted, the physical pages in the target physical area are set as invalid pages by the solid-state drive; After the invalid page is reclaimed, it is set as a free page by the solid-state drive.
9. The method according to any one of claims 1-8, wherein, The host computer runs an application for adjusting the reserved space size of the solid-state drive; The write request is generated by the application. Once the target logical area is set to a non-idle state, the target logical area cannot be accessed by other applications on the host.
10. A system for adjusting reserved space in a solid-state drive, wherein, include: The solid-state drive and the host communicatively connected to the solid-state drive; wherein... The host is configured to: send a write request to the solid-state drive when it is necessary to increase the reserved space of the solid-state drive; wherein the write request carries the data to be written, the size of the data to be written, and the target logical address; the size of the data to be written and the target logical address are used to define the target logical area; The solid-state drive is used to: execute the writing process of the data to be written according to the write request; The host is further configured to: after the solid-state drive completes the writing process of the data to be written, set the usage status of the target logical area to a non-idle state; and send a mapping relationship deletion request to the solid-state drive. The solid-state drive is further configured to: delete the mapping relationship between the target logical area and the target physical area according to the mapping relationship deletion request; the mapping relationship is created by the solid-state drive during the writing process of the data to be written; the target physical area is the physical area in the solid-state drive used to store the data to be written.
11. An electronic device, wherein, include: Memory and processor, among which, The memory is used to store programs; The processor, coupled to the memory, is configured to execute the program stored in the memory to implement the method of any one of claims 1 to 9.
12. A computer-readable storage medium storing a computer program, wherein, When the computer program is executed by a computer, it can implement the method of any one of claims 1 to 9.
13. A computer program product comprising a computer program, wherein, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 9.
Citation Information
Patent Citations
Method and a device for dynamically adjusting reserved space of solid state disk
CN113311992A
Solid state disk reserved space setting method and device, electronic equipment and storage medium
CN115857832A
Data writing method and solid state disk
CN117492637A
Solid state disk address mapping method, device and product
CN118170327A
Method for storing data by storage device and storage device
US20180232314A1