CN114356237A - Control method, memory and electronic equipment - Google Patents

Control method, memory and electronic equipment Download PDF

Info

Publication number
CN114356237A
CN114356237A CN202111678036.1A CN202111678036A CN114356237A CN 114356237 A CN114356237 A CN 114356237A CN 202111678036 A CN202111678036 A CN 202111678036A CN 114356237 A CN114356237 A CN 114356237A
Authority
CN
China
Prior art keywords
space
memory
block
user
reserved space
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111678036.1A
Other languages
Chinese (zh)
Inventor
王胜
华国军
王虎
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Lenovo Beijing Ltd
Original Assignee
Lenovo Beijing Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Lenovo Beijing Ltd filed Critical Lenovo Beijing Ltd
Priority to CN202111678036.1A priority Critical patent/CN114356237A/en
Publication of CN114356237A publication Critical patent/CN114356237A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Memory System (AREA)

Abstract

The application discloses a control method, a memory and electronic equipment, the application detects the state of a user available space and/or a reserved space storage block of the memory to obtain the state distribution information of the user available space and/or the reserved space storage block, determines whether a preset condition is met or not based on the detected state distribution information, and adjusts the states of the user available space and the storage block in the reserved space based on the determination result of meeting the preset condition to increase the size of the reserved space of the memory, thereby realizing the dynamic promotion of the capacity of the reserved space according to the actual use condition of the memory.

Description

Control method, memory and electronic equipment
Technical Field
The present application belongs to the technical field of storage resource management, and in particular, to a control method, a memory, and an electronic device.
Background
The storage space of a Solid State Disk (SSD) is divided into a user available space and a reserved space (OP), and the reserved space cannot be identified by a user for use, and is mainly used for garbage collection, Raid backup of stored data, and providing a spare block for replacing a bad block of the user available space, and the like.
Currently, the reserved space of the solid state disk is limited and fixed, for example, the reserved space of the consumer-grade solid state disk is about 7% of the total capacity of the solid state disk. When the storage blocks of the reserved space are consumed to a certain extent, resulting in too few available blocks of the reserved space, the problem of using the solid state disk may occur, for example, when the solid state disk crashes, a blue screen, and the like, even resulting in that the SSD cannot be used, and how to improve the situation becomes a technical problem that needs to be solved in the art.
Disclosure of Invention
Therefore, the application discloses the following technical scheme:
a control method is applied to a controller of a memory, wherein the memory comprises a user available space and a reserved space, and the user available space and the reserved space are respectively formed by memory blocks;
the method comprises the following steps:
detecting the state of the storage block of the user available space and/or the reserved space to obtain the state distribution information of the storage block of the user available space and/or the reserved space;
determining whether a predetermined condition is satisfied based on the state distribution information;
and if a preset condition is met, adjusting the states of the user available space and the storage blocks in the reserved space to increase the size of the reserved space.
Optionally, the detecting the state of the storage block of the user available space and/or the reserved space includes:
detecting an idle state of a memory block of the user available space;
and detecting the consumption state of the spare block in the storage block of the reserved space.
Optionally, the state distribution information of the storage block of the user usable space includes: the free capacity and/or the free duration of the storage block of the user available space;
the state distribution information of the memory block of the reserved space comprises: a consumption rate of spare blocks in the reserved memory blocks.
Optionally, in the method:
if the state distribution information includes state distribution information of a memory block of the user usable space, the predetermined condition includes: the free capacity of the storage block of the user available space reaches a preset first free capacity threshold value and/or the free time reaches a preset time threshold value;
if the state distribution information includes state distribution information of a storage block of the reserved space, the predetermined condition includes: the consumption rate of the standby blocks in the reserved space storage blocks reaches a preset consumption rate threshold value;
if the state distribution information includes state distribution information of the user available space and the storage blocks of the reserved space, the predetermined condition includes: the free capacity of the storage block of the user available space reaches a preset first free capacity threshold value and/or the free time reaches a preset time threshold value, and the consumption rate of the standby block in the reserved space storage block reaches a preset consumption rate threshold value.
Optionally, the adjusting the states of the user usable space and the storage blocks in the reserved space to increase the size of the reserved space includes:
sending a first request instruction for requesting to increase the reserved space to a device system of a device where the memory is located; the first request instruction comprises a first increment applied to the reserved space;
acquiring a logic block address distributed by the equipment system based on the first request instruction, and carrying out data transfer processing on at least one target storage block corresponding to the logic block address; the total capacity of the at least one target storage block is not lower than the first increment and is a storage block of the available space of the user;
using the at least one target storage block which completes the data moving processing as a reserved space of the memory;
sending a completion instruction for indicating completion of data transfer to the equipment system, so that the equipment system synchronously adjusts the storage space information of the memory based on the completion instruction.
Optionally, the device system synchronously adjusts the storage space information of the memory based on the completing instruction, including:
the device system modifies a namespace parameter of the memory or locks a logical block address of the at least one target memory block to make the logical block address of the at least one target memory block invisible to a user;
wherein the modified namespace parameters include: the reserved space and the available space of the user of the memory correspond to the capacity and the address range of the logical block respectively.
Optionally, the method further includes:
and adjusting the states of the user available space and the storage blocks in the reserved space to reduce the size of the reserved space based on detecting that the free capacity of the storage blocks of the user available space is lower than a preset second free capacity threshold.
Optionally, the adjusting the states of the user usable space and the storage blocks in the reserved space to reduce the size of the reserved space includes:
acquiring a returning instruction of the equipment system for indicating to return a storage block of the available space of the user;
determining whether a storage block actually occupied exists in the target storage block converted into the reserved space;
if so, remapping the target physical address for the logical block address corresponding to the actually occupied target storage block, and sending the logical block address of each target storage block to the equipment system after remapping is completed so as to synchronously adjust the storage space information of the memory by the equipment system;
if the logical block address does not exist, the logical block address corresponding to each target storage block is sent to an equipment system, so that the equipment system synchronously adjusts the storage space information of the memory;
and the target physical address is a physical address of a corresponding memory block which is not actually occupied in the reserved space of the memory.
A memory, comprising:
a storage medium including a reserved space and a user usable space, the user usable space and the reserved space being respectively constituted by storage blocks;
a controller for performing the control method as claimed in any one of the above.
An electronic device, comprising:
a memory as described above;
and the processor is at least used for interacting with the controller in the memory, and realizing data access to the storage medium in the memory and/or adjustment of reserved space and available space of a user in the storage medium through interaction with the controller.
According to the scheme, the control method, the memory and the electronic device disclosed by the application detect the state of the user available space and/or the reserved space memory block of the memory to obtain the state distribution information of the user available space and/or the reserved space memory block, determine whether the preset condition is met or not based on the detected state distribution information, and adjust the states of the user available space and the memory block in the reserved space based on the determination result that the preset condition is met to increase the size of the reserved space of the memory, so that the capacity of the reserved space is dynamically increased according to the actual use condition of the memory.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
FIG. 1 is a schematic flow chart of a control method provided herein;
FIG. 2 is a diagram of an implementation process for adjusting the states of memory blocks in user usable space and reserved space to increase the size of the reserved space according to the present application;
FIG. 3 is a schematic illustration of the increase in headspace size provided herein;
FIG. 4 is a schematic flow chart of another control method provided herein;
FIG. 5 is a diagram illustrating an implementation process for adjusting the states of the memory blocks in the user's available space and the reserved space to reduce the size of the reserved space;
FIG. 6 is a schematic illustration of the reduction of headspace size provided herein;
FIG. 7 is a block diagram of the memory provided in the present application;
fig. 8 is a block diagram of the electronic device according to the present invention.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The embodiment of the application discloses a control method, a memory and electronic equipment. The memory may be, but is not limited to, a solid state disk or other memory device/storage component that employs a flash memory (e.g., Nandflash, NorFlash) as a storage medium, the memory including user-usable space, i.e., memory space in the memory that can be used by a user for identification, and reserved space that cannot be used by a user for identification, primarily for garbage collection, Raid backup of stored data, and providing spare blocks for replacing bad blocks of user-usable space, etc.
The user usable space and the reserved space of the memory are respectively composed of memory blocks.
Referring to fig. 1, a control method disclosed in an embodiment of the present application at least includes the following processing steps:
step 101, detecting the state of the storage block of the user available space and/or the reserved space of the storage to obtain the state distribution information of the storage block of the user available space and/or the reserved space.
Optionally, the idle state of the storage block in the user available space in the memory may be detected, and/or the consumption state of the spare block in the storage block in the reserved space of the memory may be detected. The spare block refers to a storage block in the reserved space for replacing a bad block of the available space of the user.
By detecting the idle state of the storage block of the user available space, state distribution information such as the idle capacity and/or the idle duration of the storage block of the user available space can be obtained; the free capacity of the storage blocks in the available space of the user specifically refers to the total free capacity of all the storage blocks in the available space of the user.
The consumption rate of the spare blocks in the reserved space storage block can be obtained by detecting the consumption state of the spare blocks in the reserved space storage block, and the detected consumption rate of the spare blocks is used as the state distribution information of the reserved space storage block.
And 102, determining whether a preset condition is met or not based on the detected state distribution information.
Wherein the predetermined condition is a preset condition for triggering the increase of the size of the reserved space of the memory. The predetermined condition is related to the information type of the state distribution information, and specifically, the predetermined condition may be preset according to the information type of the state distribution information to be detected, so that the preset predetermined condition is matched with the information type of the state distribution information to be detected.
The setting of the predetermined condition mainly comprises the following conditions:
11) the state distribution information to be detected comprises the state distribution information of the storage block of the available space of the user;
the predetermined condition in this case may be set as: the free capacity of the storage block of the available space of the user reaches a preset first free capacity threshold value and/or the free time reaches a preset time threshold value.
Correspondingly, in this case, the detected free capacity of the user available space storage block may be specifically compared with the first free capacity threshold in the set predetermined condition, and/or the free duration may be compared with the duration threshold in the set predetermined condition, if the free capacity of the user available space storage block reaches the first free capacity threshold, and/or the free duration reaches the duration threshold, it is determined that the predetermined condition is met, otherwise, it is not met.
In practical application, the capacity of different spaces of the memory can be adjusted preferably by combining two factors of the free capacity and the free time of the storage block of the available space of the user, and the predetermined condition (to trigger the capacity adjustment) is determined to be met only when the free capacity of the storage block of the available space of the user reaches the first free capacity threshold and the free time reaches the time threshold.
12) The state distribution information to be detected comprises the state distribution information of the storage blocks of the reserved space;
in this case, the predetermined condition may be set as: and the consumption rate of the standby blocks in the reserved space storage blocks reaches a preset consumption rate threshold value.
Correspondingly, in this case, the consumption rate of the spare block in the detected reserved space storage block may be specifically compared with the consumption rate threshold in the set predetermined condition, and if the consumption rate of the detected spare block reaches the consumption rate threshold, it is determined that the predetermined condition is satisfied, otherwise, it is not satisfied.
13) The state distribution information to be detected comprises the state distribution information of the storage blocks of the available space and the reserved space of the user;
the predetermined condition in this case may be set as: the free capacity of the storage block of the user available space reaches a preset first free capacity threshold value and/or the free time reaches a preset time threshold value, and the consumption rate of the standby block in the reserved space storage block reaches a preset consumption rate threshold value.
Correspondingly, in this case, the free capacity and/or the free duration of the user available space storage block may be compared with the first free capacity threshold and/or the duration threshold in the predetermined condition, and the detected consumption rate of the spare block in the reserved space storage block may be compared with the consumption rate threshold in the predetermined condition, if the free capacity of the user available space storage block reaches the first free capacity threshold and/or the free duration threshold, and the consumption rate of the spare block in the reserved space storage block reaches the consumption rate threshold, it is determined that the predetermined condition is satisfied, and otherwise, it is not satisfied.
And 103, if the preset condition is met, adjusting the states of the storage blocks in the available space and the reserved space of the user to increase the size of the reserved space of the memory.
If the predetermined condition is satisfied, the states of the storage blocks of the available space and the reserved space in the memory are adjusted, and the capacities (sizes) of the available space and the reserved space in the memory are adjusted by adjusting the states of the storage blocks of the available space and the reserved space in the memory, so that the purpose of increasing the size of the reserved space in the memory is achieved.
Otherwise, if the predetermined condition is not satisfied, the state of the memory of the available space and the reserved space of the user does not need to be adjusted, and the existing state of each space memory block is maintained.
Referring to fig. 2, the process of adjusting the states of the user available space and the memory blocks in the reserved space to increase the size of the memory reserved space may be further implemented as:
step 201, a first request instruction for requesting to increase the reserved space is sent to the device system of the device where the memory is located.
The memory can be, but is not limited to, any of numerous general purpose or special purpose computing device environments or configurations, such as personal computers, server computers, hand-held or portable devices, tablet devices, multi-processor devices, and the like.
The controller of the memory, such as the SSD controller, may specifically initiate a first request instruction for applying for increasing the reserved space to a component, such as a host CPU (Central Processing Unit), in the device where the memory is located, where the component is used for running the device system, where the first request instruction carries the applied first increase amount for the reserved space.
For the above-mentioned situation 11), the controller of the memory may specifically determine the first increase amount to the reserved space according to the free capacity of the user available space storage block, and preferably, the first increase amount to the reserved space and the free capacity of the user available space storage block have a positive correlation, that is, the larger the free capacity of the user available space storage block is, the larger the determined first increase amount to the reserved space is, and conversely, the smaller the free capacity of the user available space storage block is, the smaller the determined first increase amount to the reserved space is.
One example of determining the first increase amount based on the free capacity of the user available space storage block is provided below:
according to the ratio of free capacity in the available space for users (free capacity/total capacity of available space for users), different levels of capacity increase of the reserved space are defined, for example: if the proportion of the free capacity is 1/3, the reserved space is increased by 7%, and accordingly, the first increase of the reserved space is determined as follows: total user available space capacity 7%; if the proportion of the free capacity is 1/2, the reserved space is increased by 14%, and accordingly, the first increase is determined as: total user available space capacity 14%; if the proportion of the free capacity is 2/3, the reserved space is increased by 28%, and correspondingly, the first increase is determined as: total user available space capacity 28%.
In view of the above situation 12), the controller of the memory may specifically determine the first increment to the reserved space according to the number of free spare blocks of the reserved space storage block or the spare block consumption rate, optionally, the first increment has an inverse correlation with the actual number of free spare blocks of the reserved space, or has a positive correlation with the spare block consumption rate, and the smaller the actual number of free spare blocks of the reserved space or the higher the spare block consumption rate is, the larger the first increment is determined for the reserved space.
In practical application, different numbers of free spare blocks/consumption rates of spare blocks may be preset, and a corresponding relationship between different first increments may be determined, based on the corresponding relationship, a first increment that matches the actual number of free spare blocks/consumption rate of spare blocks in the reserved space.
The above case 13) is a combination of cases 11) and 12), and for case 13), an appropriate first increment may be adapted to the reserved space, taking into account the actual free capacity of the storage block of the available space of the user and the actual number of free spare blocks/spare block consumption rate of the reserved space.
Step 202, obtaining a logical block address allocated by the device system based on the first request, and performing data transfer processing on at least one target storage block corresponding to the logical block address.
After receiving a first request instruction sent by a controller of a memory, the device system determines a Logical area Address of which the corresponding capacity matches the applied first increment from an LBA (Logical Block Address) range corresponding to a user available space of the memory according to the applied first increment of the reserved space in the instruction, and allocates the determined Logical area Address to the controller of the memory.
Specifically, after receiving the first request instruction, the device system may allocate, to the controller of the memory, a logical area address corresponding to the first increment of the requested capacity from the end of the LBA of the available space of the memory user.
The allocated logical block address corresponds to at least one target storage block, the at least one target storage block is a storage block in the user available space, and the total capacity of the at least one target storage block is not lower than the applied first increment, e.g., equal to the applied first increment.
And the controller of the memory receives the logical block address distributed by the equipment system and carries out data transfer processing on at least one target memory block corresponding to the logical block address.
The data movement process may be further implemented as: and for each target storage block, the controller of the memory determines whether data is written in the target storage block, if so, the data in the target storage block is transferred to other storage blocks which are not written with data except the target storage blocks in the user available space, and if not, the data transfer processing is not required to be executed on the target storage block.
And the controller of the memory ensures that each target memory block to be converted into the reserved space is a free block in which user data is not written by carrying out data transfer processing on the target memory block.
Step 203, using the at least one target storage block which completes the data transfer processing as a reserved space of the memory.
And step 204, sending a finishing instruction for indicating to finish the data movement to the equipment system, so that the equipment system synchronously adjusts the storage space information of the storage based on the received finishing instruction.
After the data transfer processing is completed, the controller uses each target storage block indicated by the logical block address allocated by the system as a reserved space of the memory, and simultaneously sends a completion instruction for indicating the completion of the data transfer to the equipment system.
The system receives the completion instruction and synchronously adjusts the storage space information of the memory based on the received completion instruction. Optionally, in an embodiment, the system modifies the namespace parameter of the memory to adjust the storage space information of the memory, where the modified namespace parameter specifically includes: the reserved space of the memory and the available space of the user correspond to the capacity and the address range of the logical block respectively. Specifically, the system transfers the logical block address corresponding to each target storage block from the original logical block address range of the user usable space to the logical block address range of the reserved space, and adaptively adjusts the capacity values of the user usable space and the reserved space.
Optionally, the device system may modify the capacity size and LBA range of the user available space and the reserved space in the Memory namespace by using a standard instruction of a Non Volatile Memory Host Controller Interface (NMVE).
In another embodiment, the device system locks the logical block address of the at least one target storage block converted from the user usable space to the reserved space, and makes the logical block address of each target storage block invisible to the user through the logical block address locking, so that each target storage block cannot be used for writing user data any more, thereby implementing the adjustment of the storage space information of the memory. This embodiment does not require modification of the existing namespace parameters of the memory, i.e., the existing namespace parameters of the memory remain unchanged.
That is, in the embodiment based on address locking, from the perspective of the memory namespace parameters, the at least one target memory block still belongs to the user usable space, but the device system makes each target memory block invisible to the user by locking the logical block address of each target memory block, and simultaneously, in combination with the control condition that the controller of the memory actually uses each target memory block as the memory reserved space, the device system realizes that each target memory block is converted from the user usable space to the reserved space for use under the condition that the memory namespace parameters are maintained unchanged.
In the above two embodiments, the manner of modifying the memory namespace parameters needs to make the adjustment of the available space/reserved space of the memory user effective by restarting the device (e.g., restarting the server) after the modification of the memory namespace parameters is completed; in contrast, according to the address locking-based implementation mode, adjustment and validation of the available space/reserved space of the memory user can be achieved on line without restarting the device, but the locking information maintenance of the memory is required to be carried out in the device system.
In practical application, the adopted implementation mode can be selected according to requirements. Wherein, because the free capacity of the available space of the user dynamically changes with the use (data writing/deleting) condition of the user, when the free capacity of the storage block of the available space of the user is dynamically adjusted according to the free capacity of the storage block of the available space of the user aiming at the condition 11), the adjustment of the free capacity of the reserved space is relatively frequent and the adjustment frequency is higher, so that the implementation mode of locking the address of the logical block can be preferably adopted to adjust the free space/the free space capacity of the storage block aiming at the condition 11); when the reserved space capacity is dynamically adjusted according to the consumption rate of the reserved space spare block for the case 12), the adjustment frequency is relatively low compared with the case 11), so that the capacity adjustment of the user usable space/reserved space can be performed preferably in a manner of modifying the memory name space.
After each target storage block is converted into a storage block of a reserved space, as shown in fig. 3, the capacity (size) of the reserved space is increased, and a controller of the memory may select a corresponding block from each target storage block converted into the reserved space for use as needed, for example, select the corresponding block as a spare block to replace a bad block of a user-available space, or select the corresponding block for garbage collection, Raid backup, or the like.
According to the scheme, the method provided by the embodiment of the application can be used for adaptively increasing the capacity of the reserved space of the memory according to the actual use condition of the memory by monitoring the state distribution information of the user available space and/or the reserved space storage blocks in the memory and intelligently adjusting the size of the reserved space of the memory according to the monitored state distribution information, so that the use problems of the memory, such as crash of equipment, blue screen, even disk drop of the memory and the like caused by too few available blocks of the reserved space are avoided, and the service life of the memory is prolonged.
In addition, the Write Amplification Factor (WAF) is higher in the condition of small reserved space capacity than in the condition of large reserved space capacity, so that the larger reserved space can reduce the Write Amplification factor, and more data can be effectively written into the memory.
In an embodiment, referring to fig. 4, the control method of the embodiment corresponding to fig. 1 may further include the following processing:
and 104, based on the fact that the free capacity of the storage block of the user available space is detected to be lower than a preset second free capacity threshold value, adjusting the states of the storage block in the user available space and the reserved space to reduce the size of the reserved space.
The second free capacity threshold is less than the first free capacity threshold above.
And when the free capacity of the storage blocks of the available space of the user is lower than a second free capacity threshold value, triggering the process of returning each target storage block converted into the reserved space to the available space of the user.
As shown in fig. 5, the processing procedure specifically includes:
step 501, obtaining a returning instruction of the device system for indicating to return a storage block of the user available space.
Optionally, the device system monitors the free capacity of the storage block in the available space of the user in real time, and once it is monitored that the free capacity of the storage block in the available space of the user is lower than the second free capacity threshold, sends a return instruction to a controller (e.g., an SSD controller) of the memory to instruct the controller of the memory to return each target storage block in the available space of the user.
Step 502, determining whether a target storage block converted into the reserved space has an actually occupied storage block.
After receiving the return instruction, the controller of the memory first detects whether a storage block actually occupied exists in each target storage block, that is, determines whether each target storage block has been written into corresponding data as a reserved space, such as garbage data, Raid backup data, or user data in a bad block of a user usable space.
Step 503, if yes, remapping the target physical address for the logical block address corresponding to the target storage block actually occupied, and sending the logical block address of each target storage block to the equipment system after remapping is completed, so that the equipment system synchronously adjusts the storage space information of the memory.
If the fact that the storage blocks are actually occupied is detected to exist in each target storage block, a controller of the memory remaps a target physical address for a logical block address corresponding to the actually occupied target storage block, the target physical address is a physical address of a corresponding storage block which is not actually occupied in a reserved space of the memory, and the storage blocks indicated by the target physical address are other storage blocks except the target storage blocks in the reserved space, so that the target storage blocks returned to the available space of the user are enabled to be free.
After the remapping is completed, the logical block address of each target storage block is sent to the equipment system, so that the equipment system synchronously adjusts the storage space information of the memory.
The device system can specifically modify the namespace information of the memory to realize the adjustment of the storage space information of the memory, wherein the modification comprises the modification of the capacity and the logical block address range of the user available space and the reserved space of the memory, specifically, the logical block address corresponding to each target storage block is transferred from the logical block address range of the reserved space to the logical block address range of the user available space, and the capacity values of the user available space and the reserved space are adaptively adjusted.
Or, the device system may unlock (or simply "unlock") the logical block address of each target storage block, so as to adjust the storage space information of the memory, and after the unlocking is completed, the logical block address of each target storage block is visible to the user, and accordingly, user data may be written into the target storage block based on the unlocked logical block address.
In addition, for the case that there is an actually occupied storage block in each target storage block, in other embodiments, the data in the actually occupied target storage block may also be transferred to other free storage blocks except for each target storage block in the reserved space by a data transfer manner, so as to ensure that the target storage block returned to the user available space is free and available.
Step 504, if not, the logical block address corresponding to each target storage block is sent to the equipment system, so that the equipment system synchronously adjusts the storage space information of the memory.
On the contrary, if it is detected that no actually occupied storage block exists in each target storage block, the logical block address corresponding to each target storage block is directly sent to the equipment system without performing the above-mentioned physical address remapping processing or data transfer processing on each target storage block.
After the device system receives the logical block address returned by the controller of the memory, each target memory block is made available to the user by executing corresponding namespace modification processing or logical block address unlocking processing, so that each target memory block is converted from the reserved space to a memory block of the user available space, which can be specifically shown in fig. 6.
Optionally, for the solid state disk, based on the standard data, the command format, and the processing flow of the NVMe base specification, the PCIe SSD controller and the device host may recognize the executed instruction (the first request instruction) for increasing the reserved space capacity and the instruction (the return instruction) for returning the available space capacity of the user, so as to perform capacity adjustment triggering and management on the entire solid state disk namespace.
In the embodiment, when the free capacity of the storage block in the available space of the user is lower than a certain threshold, each target storage block converted into the reserved space is returned to the available space of the user, so that the capacity of the reserved space can be dynamically increased, the service life of the memory can be prolonged, the dynamic capacity requirement of the user on the available space of the user can be considered, and the size of the reserved space (the number of spare blocks) can be adjusted more flexibly and reasonably.
The embodiment of the present application further discloses a memory, a composition structure of which is shown in fig. 7, including:
the storage medium 701 includes a reserved space and a user usable space, and the user usable space and the reserved space are respectively formed by storage blocks.
Optionally, the storage medium 701 is a flash memory, such as Nandflash or NorFlash, and the memory may be, but is not limited to, a solid state disk or other storage device/storage component using the flash memory as a storage medium.
The user available space is storage space which can be identified and used by a user in the memory, and on the contrary, the reserved space cannot be identified and used by the user, and is mainly used for garbage collection, Raid backup of stored data, and the provision of a spare block for replacing a bad block of the user available space, and the like.
The controller 702 is configured to execute the control method disclosed in any of the above method embodiments, and implement dynamic adjustment of the available space and the reserved space of the memory user by executing the control method disclosed in any of the above method embodiments.
The dynamic adjustment process of the available space and the reserved space of the memory users by the controller 702 can be referred to the above description of the embodiments of the methods, and will not be described in detail here.
In addition, embodiments of the present application also disclose an electronic device, which may be, but is not limited to, a device in any of numerous general purpose or special purpose computing device environments or configurations, such as a personal computer, server computer, hand-held or portable device, tablet device, multi-processor device, or the like.
The composition structure of the electronic device is shown in fig. 8, and specifically includes:
the memory 801 is the memory disclosed in the previous embodiment.
The memory 801 includes a storage medium including a reserved space and a user usable space, which are respectively constituted by memory blocks, and a controller. A controller of the memory 801 for performing the control method as disclosed in any of the above method embodiments.
The processor 802, at least, is operable to interact with a controller in the memory 801 to enable data access to the storage medium of the memory 801 and/or to adjust the amount of reserved space and user space available in the storage medium by interacting with the controller of the memory 801.
The processor 802 may be a Central Processing Unit (CPU), an application-specific integrated circuit (ASIC), a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device.
Besides, the electronic device may further include a communication interface, a communication bus, and the like. The memory 801, processor 802 and communication interface communicate with each other via a communication bus.
The communication interface is used for communication between the electronic device and other devices. The communication bus may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like, and may be divided into an address bus, a data bus, a control bus, and the like.
To sum up, compared with the prior art, the control method, the memory and the electronic device disclosed in the embodiments of the present application have at least the following technical advantages:
21) by transferring a part of storage blocks of the available space of the user to the reserved space, the write amplification factor is reduced, and the data volume which can be effectively written into the memory is improved;
22) more spare blocks can be vacated to replace bad blocks in the available space of the user, so that the service life of the memory is prolonged;
23) the problem of memory failure caused by rapid consumption of spare blocks in a frequent abnormal power failure state is solved, when the number of free available blocks in a reserved space is reduced due to rapid increase of bad blocks of the memory, a part of memory blocks in the available space of a user is dynamically transferred into the reserved space, and the memory is guaranteed not to be down due to the exhaustion of the reserved space, so that the problem of disk dropping is avoided even if the memory is short in service life or the reserved space is insufficient under certain special conditions, time for timely moving data is provided for the user, the user data is guaranteed not to be lost, and the safety of the data of the memory is greatly improved;
24) the garbage recycling frequency is reduced, and the influence of garbage recycling on the performance of the memory is correspondingly reduced.
It should be noted that, in the present specification, the embodiments are all described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other.
For convenience of description, the above system or apparatus is described as being divided into various modules or units by function, respectively. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing the present application.
From the above description of the embodiments, it is clear to those skilled in the art that the present application can be implemented by software plus necessary general hardware platform. Based on such understanding, the technical solutions of the present application may be essentially or partially implemented in the form of a software product, which may be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments or some parts of the embodiments of the present application.
Finally, it is further noted that, herein, relational terms such as first, second, third, fourth, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The foregoing is only a preferred embodiment of the present application and it should be noted that those skilled in the art can make several improvements and modifications without departing from the principle of the present application, and these improvements and modifications should also be considered as the protection scope of the present application.

Claims (10)

1. A control method is applied to a controller of a memory, wherein the memory comprises a user available space and a reserved space, and the user available space and the reserved space are respectively formed by memory blocks;
the method comprises the following steps:
detecting the state of the storage block of the user available space and/or the reserved space to obtain the state distribution information of the storage block of the user available space and/or the reserved space;
determining whether a predetermined condition is satisfied based on the state distribution information;
and if a preset condition is met, adjusting the states of the user available space and the storage blocks in the reserved space to increase the size of the reserved space.
2. The method of claim 1, the detecting a state of a memory block of the user available space and/or the reserved space, comprising:
detecting an idle state of a memory block of the user available space;
and detecting the consumption state of the spare block in the storage block of the reserved space.
3. The method of claim 2, the state distribution information for the memory blocks of user available space comprising: the free capacity and/or the free duration of the storage block of the user available space;
the state distribution information of the memory block of the reserved space comprises: a consumption rate of spare blocks in the reserved memory blocks.
4. The method of claim 3, wherein:
if the state distribution information includes state distribution information of a memory block of the user usable space, the predetermined condition includes: the free capacity of the storage block of the user available space reaches a preset first free capacity threshold value and/or the free time reaches a preset time threshold value;
if the state distribution information includes state distribution information of a storage block of the reserved space, the predetermined condition includes: the consumption rate of the standby blocks in the reserved space storage blocks reaches a preset consumption rate threshold value;
if the state distribution information includes state distribution information of the user available space and the storage blocks of the reserved space, the predetermined condition includes: the free capacity of the storage block of the user available space reaches a preset first free capacity threshold value and/or the free time reaches a preset time threshold value, and the consumption rate of the standby block in the reserved space storage block reaches a preset consumption rate threshold value.
5. The method of claim 1, the adjusting the state of the user available space and the memory blocks in the reserved space to increase the size of the reserved space, comprising:
sending a first request instruction for requesting to increase the reserved space to a device system of a device where the memory is located; the first request instruction comprises a first increment applied to the reserved space;
acquiring a logic block address distributed by the equipment system based on the first request instruction, and carrying out data transfer processing on at least one target storage block corresponding to the logic block address; the total capacity of the at least one target storage block is not lower than the first increment and is a storage block of the available space of the user;
using the at least one target storage block which completes the data moving processing as a reserved space of the memory;
sending a completion instruction for indicating completion of data transfer to the equipment system, so that the equipment system synchronously adjusts the storage space information of the memory based on the completion instruction.
6. The method of claim 5, the device system synchronously adjusting storage space information of the memory based on the completion instruction, comprising:
the device system modifies a namespace parameter of the memory or locks a logical block address of the at least one target memory block to make the logical block address of the at least one target memory block invisible to a user;
wherein the modified namespace parameters include: the reserved space and the available space of the user of the memory correspond to the capacity and the address range of the logical block respectively.
7. The method of claim 5, further comprising:
and adjusting the states of the user available space and the storage blocks in the reserved space to reduce the size of the reserved space based on detecting that the free capacity of the storage blocks of the user available space is lower than a preset second free capacity threshold.
8. The method of claim 7, the adjusting the state of the user available space and the memory blocks in the reserved space to reduce the size of the reserved space, comprising:
acquiring a returning instruction of the equipment system for indicating to return a storage block of the available space of the user;
determining whether a storage block actually occupied exists in the target storage block converted into the reserved space;
if so, remapping the target physical address for the logical block address corresponding to the actually occupied target storage block, and sending the logical block address of each target storage block to the equipment system after remapping is completed so as to synchronously adjust the storage space information of the memory by the equipment system;
if the logical block address does not exist, the logical block address corresponding to each target storage block is sent to an equipment system, so that the equipment system synchronously adjusts the storage space information of the memory;
and the target physical address is a physical address of a corresponding memory block which is not actually occupied in the reserved space of the memory.
9. A memory, comprising:
a storage medium including a reserved space and a user usable space, the user usable space and the reserved space being respectively constituted by storage blocks;
a controller for performing the control method of any one of claims 1-8.
10. An electronic device, comprising:
the memory of claim 9;
and the processor is at least used for interacting with the controller in the memory, and realizing data access to the storage medium in the memory and/or adjustment of reserved space and available space of a user in the storage medium through interaction with the controller.
CN202111678036.1A 2021-12-31 2021-12-31 Control method, memory and electronic equipment Pending CN114356237A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111678036.1A CN114356237A (en) 2021-12-31 2021-12-31 Control method, memory and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111678036.1A CN114356237A (en) 2021-12-31 2021-12-31 Control method, memory and electronic equipment

Publications (1)

Publication Number Publication Date
CN114356237A true CN114356237A (en) 2022-04-15

Family

ID=81104754

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111678036.1A Pending CN114356237A (en) 2021-12-31 2021-12-31 Control method, memory and electronic equipment

Country Status (1)

Country Link
CN (1) CN114356237A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116414727A (en) * 2023-06-12 2023-07-11 深圳大普微电子科技有限公司 Space management method of flash memory device, memory control chip and flash memory device
CN117149093A (en) * 2023-10-27 2023-12-01 四川省华存智谷科技有限责任公司 Method for improving reliability of storage system through SSD (solid State disk) capacity shrinkage

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116414727A (en) * 2023-06-12 2023-07-11 深圳大普微电子科技有限公司 Space management method of flash memory device, memory control chip and flash memory device
CN117149093A (en) * 2023-10-27 2023-12-01 四川省华存智谷科技有限责任公司 Method for improving reliability of storage system through SSD (solid State disk) capacity shrinkage
CN117149093B (en) * 2023-10-27 2024-03-26 四川省华存智谷科技有限责任公司 Method for improving reliability of storage system through SSD (solid State disk) capacity shrinkage

Similar Documents

Publication Publication Date Title
CN106909314B (en) Storage system and control method
US8301670B2 (en) Managing snapshot storage pools
US7975123B2 (en) Computer system, management computer and storage system, and storage area allocation amount controlling method
JP3933027B2 (en) Cache memory partition management method in disk array system
CN114356237A (en) Control method, memory and electronic equipment
US10884630B2 (en) Storage system
US10241909B2 (en) Non-volatile memory device
US9058212B2 (en) Combining memory pages having identical content
US11392428B2 (en) Fork handling in application operations mapped to direct access persistent memory
US20080229071A1 (en) Prefetch control apparatus, storage device system and prefetch control method
US20150067238A1 (en) Computing Device and Method for Predicting Low Memory Conditions
US9448920B2 (en) Granting and revoking supplemental memory allocation requests
CN111240601B (en) Method, device, equipment and storage medium for determining superblock of partitioned space
CN107533435B (en) Storage space allocation method and storage equipment
CN107484427A (en) For handling the method and storage device of slitting in storage device
CN110968524B (en) Data storage control method, device, storage medium and electronic device
US11132291B2 (en) System and method of FPGA-executed flash translation layer in multiple solid state drives
US20130290666A1 (en) Demand-Based Memory Management of Non-pagable Data Storage
US11126553B2 (en) Dynamic allocation of memory between containers
CN107924363A (en) Use the automated storing device management of memory management unit
US11354233B2 (en) Method and system for facilitating fast crash recovery in a storage device
US11494076B2 (en) Storage-usage-based host/storage mapping management system
CN111881065A (en) Physical address processing method, device, equipment and medium for data deduplication operation
CN107766262B (en) Method and device for adjusting number of concurrent write commands
CN113778342B (en) Data storage method and related equipment thereof

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination