A method for managing a storage device and an electronic device
By monitoring host read/write speed and data volume, dynamically adjusting the operating speed of storage devices and performing garbage collection, the high power consumption problem of storage devices during low-speed read/write operations is solved, achieving power management and improved system stability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 合肥康芯威存储技术有限公司
- Filing Date
- 2026-07-02
- Publication Date
- 2026-07-31
AI Technical Summary
In existing technologies, storage devices cannot automatically reduce their frequency when the host is performing low-speed read/write operations, resulting in high power consumption and affecting system stability.
By monitoring the host's read/write speed and data volume, the operating speed of the storage device is adjusted, and garbage collection is performed in idle state to achieve dynamic power consumption management.
While ensuring host performance, reduce the power consumption of storage devices and improve system stability and response speed.
Smart Images

Figure CN122489017A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of storage technology, and in particular to a method for managing storage devices and an electronic device. Background Technology
[0002] To reduce the power consumption of storage devices, both low-power optimization designs at the hardware level and methods such as firmware-triggered low-power modes after hardware finalization rely on the host's state to be effective. Even if the host performs read and write operations at a continuous and low rate, the storage device cannot reduce its frequency and is forced to maintain full speed. In this case, the bandwidth provided by the storage device running at full speed, which is far higher than the actual demand, not only leads to unnecessary power consumption but also affects system stability and lifespan. Summary of the Invention
[0003] The purpose of this invention is to provide a storage device management method and electronic device that can reduce the power consumption of the storage device while ensuring host performance.
[0004] This invention provides a method for managing a storage device, comprising at least: Obtain the host's read and write speeds and determine whether the storage device is idle; If the storage device is not idle, the operating speed of the storage device is adjusted according to the read / write speed of the host and the total amount of data written and read by the host; and If the storage device is in an idle state, the storage device performs a garbage collection operation and adjusts the operating speed of the storage device according to the storage space released by the garbage collection operation.
[0005] In one embodiment of the present invention, the operating speed of the storage device includes the operating speed of the controller and the operating speed of the backend.
[0006] In one embodiment of the present invention, before obtaining the read / write speed of the host, the management method includes the following steps: configuring the operating speed of the storage device to a preset speed.
[0007] In one embodiment of the present invention, the management method further includes the following steps: Obtain the interface clock frequency and bus width of the storage device, and determine whether the interface clock frequency and bus width match the preset speed of the storage device; If the interface clock frequency and the bus width match the preset speed of the storage device, the read / write speed of the host is obtained; and If the interface clock frequency and the bus width do not match the preset speed of the storage device, the operating speed of the storage device will be reconfigured to the preset speed.
[0008] In one embodiment of the present invention, if the storage device is in a non-idle state, the management method further includes the following steps: Monitor whether the read / write speed of the host changes; If the read / write speed of the host remains unchanged, monitor whether the total amount of data written and read by the host exceeds a preset threshold. If the total amount of data written and read by the host exceeds the preset threshold, reduce the operating speed of the storage device; and If the read / write speed of the host changes, the operating speed of the storage device is maintained, and the total amount of data written and read by the host is re-acquired at the changed read / write speed.
[0009] In one embodiment of the present invention, when the total amount of data written and read by the host exceeds a preset threshold, the operating speed of the storage device is reduced to a preset multiple of the read and write speed of the host.
[0010] In one embodiment of the present invention, the operating speed of the storage device configured according to the preset multiple is less than the preset speed of the storage device, and the operating speed of the storage device configured according to the preset multiple is greater than the read / write speed of the host.
[0011] In one embodiment of the present invention, if the storage device is in an idle state, the management method further includes the following steps: The storage device performs a garbage collection operation to release the storage space of the storage device; Determine whether the released storage space exceeds a preset value; If the released storage space exceeds a preset value, the operating speed of the storage device will be reduced; and If the released storage space does not exceed the preset value, maintain the operating speed of the storage device and repeatedly perform garbage collection operations until the released storage space exceeds the preset value.
[0012] In one embodiment of the present invention, when the storage device performs a garbage collection operation, the operating speed of the storage device is the maximum operating speed.
[0013] The present invention also provides an electronic device, the electronic device comprising: Memory, which stores computer programs; and The processor runs the computer program to implement any of the management methods described above.
[0014] In summary, this invention provides a storage device management method and electronic device. By statistically analyzing the total amount of data written and read by the host, and triggering storage device speed adjustment when the total data amount reaches a preset threshold while maintaining a constant host read / write speed, power consumption can be automatically reduced. By resetting the total amount of data written and read to zero when a change in host read / write speed is detected, while keeping the storage device's operating speed constant, system stability is improved. By performing garbage collection at maximum operating speed in the storage device's idle state, and automatically adjusting the storage device's operating speed based on the released storage space, the time it takes for the storage device to enter low-power mode can be shortened. By setting the storage device's controller operating speed and backend operating speed to a preset multiple of the host read / write speed, sufficient processing capacity is reserved to compensate for internal operations such as firmware code execution and garbage collection, ensuring that background tasks are not affected and that a rapid response is possible when the host read / write speed changes.
[0015] Of course, any product implementing this invention does not necessarily need to achieve all of the advantages described above at the same time. Attached Figure Description
[0016] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a schematic diagram of a storage device management method in one embodiment.
[0018] Figure 2 This is a schematic diagram illustrating the specific steps of a management method in one embodiment.
[0019] Figure 3 This is a schematic diagram of an electronic device in one embodiment.
[0020] Label Explanation: 11. Processor; 12. Memory. Detailed Implementation
[0021] To facilitate understanding of this application, a more complete description will be provided below with reference to the accompanying drawings. Preferred embodiments of this application are shown in the drawings. However, this application can be implemented in many different forms and is not limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the disclosure of this application.
[0022] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein in the specification of this application is for the purpose of describing particular embodiments only and is not intended to be limiting of this application.
[0023] In the description of this invention, it should be understood that the terms "center," "upper," "lower," "front," "rear," "left," and "right," etc., indicating orientation or positional relationships, are based on the orientation or positional relationships shown in the accompanying drawings and are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the device or component referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the invention. Similarly, the terms "high" and "low," indicating degree, are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the device or component referred to must have a high or low position, and therefore should not be construed as a limitation of the invention. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0024] In practical applications of storage devices, to achieve peak performance, the internal controller and back-end interfaces are typically configured to operate at full speed to ensure peak bandwidth response to host access at any time. However, this increases power consumption. Storage devices entering low-power mode primarily rely on active triggering from the host. Even if the host's read / write speed is low, the storage device must maintain full-speed operation until triggered. This results in the storage device operating at high power and low throughput for extended periods, leading to not only high power consumption but also impacting system stability. Therefore, this invention provides a storage device management method and electronic device that can reduce power consumption while maintaining host performance.
[0025] Please see Figure 1 As shown, the present invention provides a method for managing a storage device, the method comprising steps S110 to S140.
[0026] Step S110: Obtain the read and write speed of the host.
[0027] Step S120: Determine whether the storage device is in an idle state. If the storage device is not in an idle state, proceed to step S130. If the storage device is in an idle state, proceed to step S140.
[0028] Step S130: Adjust the operating speed of the storage device according to the host's read / write speed and the total amount of data written and read by the host.
[0029] Step S140: The storage device performs a garbage collection operation and adjusts the operating speed of the storage device according to the storage space released by the garbage collection operation.
[0030] Please see Figure 2 As shown, in one embodiment of the present invention, during the boot phase of the host system, a large number of system boot files, initialization drivers, and operating system kernel images need to be quickly read from the storage device. Therefore, after the storage device is powered on, it runs at its maximum operating speed, which can minimize the host's boot time and ensure system startup performance and transient response speed during the boot phase.
[0031] Please see Figure 2 As shown, in one embodiment of the present invention, after the storage device is powered on, before executing step S110, the storage device management method further includes switching the operating speed of the storage device from the maximum operating speed to a preset speed, and determining whether the interface clock frequency and bus width of the storage device match the preset speed. If the interface clock frequency and bus width of the storage device match the preset speed, then step S110 continues to be executed. If the interface clock frequency and bus width of the storage device do not match the preset speed, then the operating speed of the storage device is switched back to the preset speed. Specifically, this includes steps S101 to S103.
[0032] Step S101: Configure the operating speed of the storage device to a preset speed.
[0033] Step S102: Obtain the interface clock frequency and bus width of the storage device.
[0034] Step S103: Determine whether the interface clock frequency and bus width match the preset speed. If the interface clock frequency and bus width match the preset speed, proceed to step S110. If the interface clock frequency and bus width do not match the preset speed, return to step S101.
[0035] Please see Figure 2As shown, in one embodiment of the present invention, in steps S101 to S103, after a period of power-on, the operating speed of the storage device is configured to a preset speed. The interface clock frequency and bus width of the storage device are obtained, and it is determined whether the interface clock frequency and bus width match the preset speed of the storage device, thus determining whether the operating speed of the storage device has been successfully switched. If the interface clock frequency and bus width match the preset speed of the storage device, it indicates that the operating speed of the storage device has been successfully switched. If the interface clock frequency and bus width do not match the preset speed of the storage device, it indicates that the operating speed of the storage device has not been successfully switched to the preset speed, and the operating speed of the storage device is reconfigured to the preset speed. Confirming the interface clock frequency and bus width ensures that the physical link has been calibrated, and subsequent adjustments to the operating speed of the storage device are based on this confirmed benchmark. In this embodiment, in HS400 mode, the preset speed of the storage device is, for example, 330MHz, the interface clock frequency is, for example, 165MHz, and the bus width is, for example, 8 bits.
[0036] Please see Figure 2 As shown, in one embodiment of the present invention, in steps S130 and S140, when the storage device is in a non-idle state, the amount of data written and read by the host is counted. If the host's read / write speed remains unchanged, and the total amount of data written and read by the host exceeds a preset threshold, the storage device reduces its operating speed. If the host's read / write speed remains unchanged, and the total amount of data written and read does not exceed the preset threshold, the count of data written and read by the host continues until the total amount of data written and read exceeds the preset threshold. If the host's read / write speed changes, the storage device's operating speed is maintained, and the recorded total amount of data written and read is cleared to zero. When the storage device is in an idle state, the storage device performs garbage collection at its maximum operating speed. If the storage space released by garbage collection reaches a preset value, the storage device reduces its operating speed. If the storage space released by garbage collection does not reach the preset value, the storage device maintains its maximum operating speed for garbage collection. Specifically, step S130 includes steps S131 to S135, and step S140 includes steps S141 to S145.
[0037] Step S120: Determine whether the storage device is in an idle state. If the storage device is not in an idle state, proceed to step S131. If the storage device is in an idle state, proceed to step S141.
[0038] Step S131: Obtain the total amount of data written and read by the host.
[0039] Step S132: Monitor whether the host's read / write speed has changed. If the host's read / write speed has not changed, proceed to step S133. If the host's read / write speed has changed, proceed to step S134.
[0040] Step S133: Determine whether the total amount of data written and read by the host exceeds a preset threshold. If the total amount of data written and read by the host exceeds the preset threshold, proceed to step S135. If the total amount of data written and read by the host does not exceed the preset threshold, return to step S131.
[0041] Step S134: Maintain the operating speed of the storage device, clear the total amount of data written and read by the host, and return to step S131.
[0042] Step S135: Reduce the operating speed of the storage device.
[0043] Step S141: Set the operating speed of the storage device to the maximum operating speed.
[0044] Step S142: The storage device performs a garbage collection operation to release the storage space of the storage device.
[0045] Step S143: Determine whether the released storage space exceeds a preset value. If the released storage space exceeds the preset value, proceed to step S144. If the released storage space does not exceed the preset value, proceed to step S145.
[0046] Step S144: Reduce the operating speed of the storage device.
[0047] Step S145: Maintain the operating speed of the storage device and return to step S142.
[0048] Please see Figure 2 As shown, in one embodiment of the present invention, in steps S131 to S133, the storage device monitors the read and write operations initiated by the host in real time, obtains the host's read and write speed, and adjusts its own operating speed according to the host's read and write speed. The operating speed of the storage device includes the operating speed of the controller and the operating speed of the backend. That is, the operating speed of the controller and the operating speed of the backend in the storage device are adjusted according to the host's read and write speed.
[0049] Please see Figure 2 As shown, in one embodiment of the present invention, in steps S131 to S133, when the storage device is in a non-idle state, each time the host completes a write or read operation, the amount of data written or read is added to the total data amount. The total data amount accumulates from zero starting from system startup and is used to determine whether the trigger condition for adjusting the storage device's operating speed has been met. In this embodiment, the storage device's firmware continuously accumulates the host's real-time data read and write volume using an internal counter. The firmware calculates the total accumulated read and write data volume after power-on by statistically counting the number of sectors or data block lengths of read and write operations.
[0050] Please see Figure 2 As shown, in one embodiment of the present invention, in steps S132 to S135, when the storage device is in a non-idle state, if the host read / write speed is not detected to have changed, the storage device continuously accumulates the amount of data written and read each time, and compares the accumulated total amount of data written and read with a preset threshold. The preset threshold is a critical value determined based on empirical data or system testing, used to determine whether the system has passed the high-load, high-frequency interaction phase after power-on. If the accumulated total amount of data written and read exceeds the preset threshold, it indicates that the system has passed the power-on transient phase and entered a stable, normal operating period, and the storage device performs a speed reduction operation. If the accumulated total amount of data written and read does not exceed the preset threshold, it indicates that the system may still be in the configuration or driver loading phase. At this time, the storage device continues to operate at a preset speed and continuously accumulates the total amount of data written and read until the total amount of data written and read exceeds the preset threshold.
[0051] Please see Figure 2 As shown, in one embodiment of the present invention, in step S135, when the total amount of data written and read by the host exceeds a preset threshold, the operating speed of the storage device is reduced to a preset multiple of the host's read / write speed. The operating speed of the storage device configured according to the preset multiple is less than the preset speed of the storage device, and the operating speed of the storage device configured according to the preset multiple is greater than the host's read / write speed. In this embodiment, the operating speed of the controller and the backend is adjusted, for example, to twice the host's read / write speed. When the host's read / write speed is detected to be, for example, 50MHz, the operating speed of the controller and the backend is adaptively adjusted to, for example, 100MHz. When the host's read / write speed is detected to be, for example, 100MHz, the operating speed of the controller and the backend is adaptively adjusted to, for example, 200MHz. This embodiment, by establishing a speed level mapping relationship, can ensure the performance margin of the firmware code execution time, garbage collection, and other background algorithms within the storage device for flash memory operations, while maximizing power saving space.
[0052] Please see Figure 2 As shown, in one embodiment of the present invention, in steps S132 to S134, when the host's read / write speed changes, the total amount of data written and read by the host is cleared to zero, and the amount of data written and read by the host under the changed read / write speed is recalculated. This accurately reflects the throughput under the changed read / write speed and avoids incorrect judgments by the storage device. At this time, the storage device's own operating speed remains unchanged, still operating at the preset speed. This avoids frequent speed changes of the storage device due to short-term fluctuations or instantaneous switching of the host speed, ensuring system stability.
[0053] Please see Figure 2As shown, in one embodiment of the present invention, during steps S120 to S141, when the storage device is in an idle state, i.e., the host has neither write nor read commands, and this state of no write and read operations continues for more than a preset time, the storage device performs a garbage collection operation. The storage device operates at its maximum speed, enabling it to quickly reorganize the storage space during the idle state. In this embodiment, the maximum operating speed of the controller is, for example, 400MHz, and the operating speed of the backend is, for example, 400MHz.
[0054] Please see Figure 2 As shown, in one embodiment of the present invention, during steps S141 to S144, when the storage device performs garbage collection at its maximum operating speed, the released storage space is compared with a preset value. The preset value can be dynamically set based on the total capacity of the storage device, the proportion of free storage space, or historical garbage collection efficiency. If the released storage space is greater than the preset value, it indicates that enough storage space has been released for subsequent host writing, and the operating speed of the controller and backend is reduced. In this embodiment, when host read / write operations are detected to have stopped and the storage device is in an idle state, the controller and backend are run at maximum operating speed, enabling the storage device to complete garbage collection as early as possible and enter a low-power mode, thus reducing the average power consumption of the storage device.
[0055] Please see Figure 2 As shown, in one embodiment of the present invention, in step S145, if the released storage space is less than a preset value, it indicates that the free storage space is insufficient. At this time, the controller and backend still maintain maximum operating speed to perform garbage collection in the background until the released storage space reaches the preset value. When the released storage space reaches the preset value, it indicates that the current garbage collection task has been successfully completed, and then the controller and backend run at reduced speed. This embodiment achieves transient response of power consumption control by monitoring the release status of storage space, ensuring that the storage device can quickly switch back to a low-power state when there are no tasks, and minimizing static power consumption.
[0056] Please see Figure 3 As shown, the present invention provides an electronic device, which includes a processor 11, a memory 12, and a computer program stored on the memory 12 and executable on the processor 11. The processor 11 executes a management method for the aforementioned memory device.
[0057] Please see Figure 3As shown, the memory 12 includes at least one type of readable storage medium, including flash memory, portable hard drive, multimedia card, card-type memory (e.g., SD or DX memory), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 12 can be an internal storage unit of an electronic device, such as a portable hard drive. In other embodiments, the memory 12 can be an external storage device of the electronic device, such as a plug-in portable hard drive, Smart Media Card (SMC), Secure Digital (SD) card, Flash Card, etc. Furthermore, the memory 12 can include both internal and external storage units of the electronic device. The memory 12 can be used not only to store application software and various types of data installed on the electronic device, but also to temporarily store data that has been output or will be output.
[0058] Please see Figure 3 As shown, in some embodiments, the processor 11 may be composed of integrated circuits, such as a single packaged integrated circuit or multiple integrated circuits packaged with the same or different functions, including combinations of one or more central processing units, microprocessors, digital processing chips, graphics processors, and various control chips. The processor 11 is the control unit of the electronic device, connecting various components of the entire electronic device through various interfaces and lines. It executes programs or modules stored in the memory 12 and calls data stored in the memory 12 (such as programs for managing storage devices) to perform various functions of the electronic device and process data.
[0059] In some embodiments, the processor 11 executes the operating system of the electronic device and various installed applications. The processor 11 executes the applications to implement the steps in the above-described storage device management method.
[0060] In some embodiments, the computer program may be divided into one or more modules, one or more of which are stored in the memory 12 and executed by the processor 11 to perform the present invention. The one or more modules may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in an electronic device.
[0061] This invention provides a storage device management method and electronic device. By statistically analyzing the total amount of data written and read by the host, and triggering storage device speed adjustment when the total data amount reaches a preset threshold while maintaining a constant host read / write speed, power consumption can be automatically reduced. By resetting the accumulated write and read data to zero when a change in host read / write speed is detected, while maintaining a constant storage device operating speed, system stability is improved. By performing garbage collection at maximum operating speed in the storage device's idle state, the storage device automatically adjusts its operating speed based on the released storage space, shortening the time it takes for the storage device to enter low-power mode. By setting the storage device's controller operating speed and backend operating speed to preset multiples of the host read / write speed, sufficient processing capacity is reserved to compensate for internal operations such as firmware code execution and garbage collection, ensuring that background tasks are unaffected and that a rapid response is possible when host read / write speed changes.
[0062] The embodiments of the present invention disclosed above are merely illustrative of the invention. The embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the content of this specification. This specification selects and specifically describes these embodiments to better explain the principles and practical applications of the invention, thereby enabling those skilled in the art to better understand and utilize the invention. The invention is limited only by the claims and their full scope and equivalents.
Claims
1. A management method of a storage device, characterized by, At least including: Obtain the host's read and write speeds and determine whether the storage device is idle; If the storage device is not idle, the operating speed of the storage device is adjusted according to the read and write speed of the host and the total amount of data written and read by the host; as well as If the storage device is in an idle state, the storage device performs a garbage collection operation and adjusts the operating speed of the storage device according to the storage space released by the garbage collection operation.
2. The management method according to claim 1, characterized in that, The operating speed of the storage device includes the operating speed of the controller and the operating speed of the backend.
3. The management method according to claim 1, characterized in that, Before obtaining the read / write speed of the host, the management method includes the following steps: configuring the operating speed of the storage device to a preset speed.
4. The management method according to claim 3, characterized in that, The management method also includes the following steps: Obtain the interface clock frequency and bus width of the storage device, and determine whether the interface clock frequency and bus width match the preset speed of the storage device; If the interface clock frequency and the bus width match the preset speed of the storage device, the read / write speed of the host is obtained; and If the interface clock frequency and the bus width do not match the preset speed of the storage device, the operating speed of the storage device will be reconfigured to the preset speed.
5. The management method according to claim 1, characterized in that, If the storage device is in a non-idle state, the management method further includes the following steps: Monitor whether the read / write speed of the host changes; If the read / write speed of the host remains unchanged, monitor whether the total amount of data written and read by the host exceeds a preset threshold. If the total amount of data written and read by the host exceeds the preset threshold, reduce the operating speed of the storage device; and If the read / write speed of the host changes, the operating speed of the storage device is maintained, and the total amount of data written and read by the host is re-acquired at the changed read / write speed.
6. The management method according to claim 5, characterized in that, When the total amount of data written and read by the host exceeds a preset threshold, the operating speed of the storage device is reduced to a preset multiple of the host's read and write speed.
7. The management method according to claim 6, characterized in that, The operating speed of the storage device configured according to the preset multiple is less than the preset speed of the storage device, and the operating speed of the storage device configured according to the preset multiple is greater than the read and write speed of the host.
8. The management method according to claim 1, characterized in that, If the storage device is in an idle state, the management method further includes the following steps: The storage device performs a garbage collection operation to release the storage space of the storage device; Determine whether the released storage space exceeds a preset value; If the released storage space exceeds a preset value, the operating speed of the storage device will be reduced; and If the released storage space does not exceed the preset value, maintain the operating speed of the storage device and repeatedly perform garbage collection operations until the released storage space exceeds the preset value.
9. The management method according to claim 8, characterized in that, When the storage device performs a garbage collection operation, the storage device operates at its maximum operating speed.
10. An electronic device, characterized in that, The electronic device includes: Memory, which stores computer programs; and The processor runs the computer program to implement the management method as described in any one of claims 1 to 9.