WO2018103010A1 - 一种存储设备管理方法及用户终端 - Google Patents

一种存储设备管理方法及用户终端 Download PDF

Info

Publication number
WO2018103010A1
WO2018103010A1 PCT/CN2016/108855 CN2016108855W WO2018103010A1 WO 2018103010 A1 WO2018103010 A1 WO 2018103010A1 CN 2016108855 W CN2016108855 W CN 2016108855W WO 2018103010 A1 WO2018103010 A1 WO 2018103010A1
Authority
WO
WIPO (PCT)
Prior art keywords
management
function
garbage collection
read
user terminal
Prior art date
Application number
PCT/CN2016/108855
Other languages
English (en)
French (fr)
Inventor
陈俊彦
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to CN201680089211.4A priority Critical patent/CN109690465B/zh
Priority to PCT/CN2016/108855 priority patent/WO2018103010A1/zh
Publication of WO2018103010A1 publication Critical patent/WO2018103010A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers

Definitions

  • the embodiments of the present invention relate to the field of terminal technologies, and in particular, to a storage device management method and a user terminal.
  • Memory is a memory device used to store information in modern information technology.
  • the storage device may include a storage device such as a random access memory (RAM), a read-only memory (ROM), and a flash memory.
  • RAM random access memory
  • ROM read-only memory
  • flash memory a storage device used to store information in modern information technology.
  • RAM random access memory
  • ROM read-only memory
  • flash memory a type of non-volatile memory
  • storage devices are widely used in many user terminals such as mobile phones, computers, cameras, or wearable devices.
  • controllers in addition to storage media.
  • an embedded multimedia card eMMC
  • SD card Secure Digital Card
  • UFS Universal Flash Storage
  • the controller encapsulates many management functions (such as wear leveling, life monitoring, bad block management, garbage collection, I/O scheduling, etc.) for managing storage devices. This makes it unnecessary for the user terminal manufacturer to develop the management function of the controller package, which greatly reduces the development difficulty of the user terminal and shortens the time for launching the user terminal to the market.
  • the embodiment of the invention discloses a storage device management method and a user terminal, which can manage the storage device by the developer of the user terminal in a custom operation of the upper management module, thereby satisfying the actual operation requirements of the developer of the user terminal.
  • the first aspect provides a storage device management method, which is applied to an upper management module of a user terminal, and the method includes: an upper management module performs a first management operation, where the first management operation is used to implement a target for managing a storage device. Management function; the upper management module drives the control to the storage device The controller sends a control command for controlling the controller to cancel execution of the second management operation, the second management operation being used to implement the target management function.
  • the first management operation may be the same or different for the first management operation. That is, the target management function can be realized by performing one of the first management operation or the second management operation. Therefore, by canceling the execution of the second management operation, it is possible to avoid redundant management of the storage device.
  • the developer of the user terminal can customize the first management operation in the upper management module to implement the target management function.
  • the developer of the user terminal can also customize the start execution time of the first management operation in the upper management module. Therefore, by implementing the method provided by the first aspect, the actual operational requirements of the developer of the user terminal can be satisfied.
  • control instruction may be used to control the controller to permanently cancel the execution of the second management operation.
  • control command can be used to control the controller to cancel the execution of the second management operation within a preset time period.
  • control instruction may be used to control the controller to cancel the execution of the second management operation during the execution of the first management operation by the upper management module.
  • the upper management module is any one of a file system, an input/output I/O scheduler, and a block layer multi-queue.
  • the upper management module is a file system
  • the target management function is any one of a garbage collection function, an erasure management function, a log recording function, a read merge function, a write merge function, and an atomic write function.
  • the target management function is the garbage collection function
  • the first management operation is a first garbage collection operation
  • the second management operation is a second garbage collection operation
  • the upper management module performs the first management operation, including
  • the file system performs the first garbage collection operation when detecting that the degree of fragmentation of the data stored by the storage device reaches a preset value.
  • the file system performs the first garbage collection operation, and performs the first garbage collection operation when the storage device is written, in addition to detecting that the fragmentation degree of the file stored by the storage device reaches a preset value. operating.
  • the target management function is the garbage collection function
  • the first management operation is a first garbage collection operation
  • the second management operation is a second garbage collection operation
  • the upper management module performs the first management operation, including :
  • the file system performs the first garbage collection operation with a preset time period.
  • the file system performs the first garbage collection operation in addition to the preset time period, and may perform the first garbage collection operation when the storage device is written.
  • the controller In the existing practical application, during the execution of the write operation, it is determined whether there is enough free storage area. If there is not enough free storage area, the garbage collection operation is needed to obtain enough free storage area, and then Write data to the free storage area. Therefore, in existing practical applications, the controller generally performs garbage collection during the execution of the write operation.
  • the file system detects that the fragmentation degree of the data stored by the storage device reaches a preset value, the first garbage collection operation is performed, or the file system performs the first garbage collection operation in a preset time period, which may be advanced. Clearing out the free storage area helps to reduce the time for garbage collection operations during the write operation, thereby shortening the overall write operation time and improving the performance of the write operation.
  • the objects that need to be erased may be determined according to different rules. Therefore, the objects that need to be erased determined by the file system and the controller when performing the garbage collection operation may be different. If you do not cancel the controller to perform garbage collection operations, it may result in increasing the number of erasures of data. Since the number of erasures of the data is directly proportional to the lifetime of the storage device, by canceling the controller to perform the second garbage collection operation, only the upper layer module performs the first garbage collection operation, which is advantageous for extending the life of the storage device.
  • the upper management module is an I/O scheduler or a block-level multi-queue
  • the target management function is any one of a read priority function, a foreground application priority function, and a specific I/O current limiting function.
  • the target management function is a read priority function
  • the first management operation is a first read priority operation
  • the second management operation is a second read priority operation
  • the upper management module performs the first management operation, including
  • the I/O scheduler or the block-level multi-queue receives the execution instruction for executing the read-priority operation sent by the application installed in the user terminal, the first read-first operation is performed, and the execution instruction is the application detecting the read of the application. Sent when the number of operations is greater than the preset number.
  • a user terminal in a second aspect, includes an upper management module, and the upper management module has a function of implementing the behavior of the upper management module in the foregoing first aspect or the possible implementation manner of the first aspect.
  • a computer storage medium for storing computer software instructions for use in the wireless charging and discharging device, comprising a method for performing the method of any of the first aspect, the first aspect, instruction.
  • FIG. 1 is a schematic diagram of a system architecture provided by an embodiment of the present invention.
  • FIG. 2 is a schematic flowchart of a storage device management method according to an embodiment of the present invention.
  • Garbage collection Clears and recycles objects that have died in the memory heap or have not been used for a long time.
  • the erasure management function when the preset time period is reached, and the data to be erased is accumulated to a preset size, an erase command is issued to the memory, so that the memory erases the accumulated preset size data.
  • Logging function The function of recording logs.
  • the log is a mechanism for recovering from a fault. By logging, you can restore the normal state of the previous record when the fault occurs.
  • Atomic write function The function of ensuring that the write operation is not interrupted, that is, ensuring that the data can be completely written, and even if it fails, the data before writing can be guaranteed not to be lost.
  • Read merge function When there are multiple read operations, the number of reads that need to be read by the multiple read operations is read at one time. according to. This improves the performance of the read operation.
  • the controller of the existing memory detects that there are a plurality of read operations, and the storage addresses of the data that the plurality of read operations need to read are consecutive, the data that the plurality of read operations need to read is read at one time. For example, when there are both the read operation 1, the read operation 2, and the read operation 3, the read operation 1 is for reading the data of the storage address 0000, the read operation 2 is for reading the data of the storage address 0001, and the read operation 3 is for Read data with storage address 0002. Since 0000, 0001, and 0002 are consecutive storage addresses, the controller reads the data stored at addresses 0000 to 0002 consecutive addresses at one time.
  • Write merge function When there are multiple write operations, the data that needs to be written by the multiple write operations is written to the storage device at one time. This improves the performance of the write operation.
  • the controller of the existing memory detects that there are a plurality of write operations, and the storage addresses of the data to be written by the plurality of write operations are continuous, the data to be written by the plurality of write operations is written once. For example, there are both write operation 1, write operation 2, and write operation 3.
  • Write operation 1 is for writing data to memory address 0000
  • write operation 2 is for writing data to memory address 0001
  • write operation 3 is for writing data to memory address 0002. Since 0000, 0001, and 0002 are consecutive storage addresses, the controller writes data to be written by three write operations to the storage addresses 0000 to 0002 at one time.
  • Read priority function Performs a read operation with a certain priority policy. This reduces the latency of read operations and improves the performance of read operations. For example, a read operation is performed with a priority policy of a read operation and a write operation ratio of 100:20, that is, 100 read operations are performed first and then 20 write operations are performed.
  • the foreground application priority function the foreground application operation is performed with a certain priority policy. This can reduce the delay of the operation of the foreground application and improve the performance of the foreground application operation.
  • the operation of the foreground application is performed by the priority policy of the foreground application operation and the background application operation being 100:20, that is, the operation of the 100 foreground applications is performed first, and then the operations of the 20 background applications are performed.
  • I/O Input/Output
  • I/O types such as I/O types including read, write, sync, and erase
  • I/ O sets the priority and corresponding bandwidth to ensure that the bandwidth and performance can meet the requirements of the corresponding type of I/O.
  • a read operation, a write operation, a synchronous operation, and an erase operation are performed by a priority strategy of a read operation, a write operation, a synchronous operation, and an erase operation with a ratio of 100:20:10:10, that is, 100 readings are performed first.
  • the operation performs 20 more write operations, and after performing 20 write operations, 10 synchronous operations are executed, and 10 synchronous operations are executed. 10 erase operations.
  • File System The software organization responsible for managing and storing file information in the operating system is called the file management system, or the file system for short.
  • a file system is a system that organizes and allocates the space of a storage device, is responsible for file storage, and protects and retrieves stored files. Specifically, it is responsible for creating files for users, storing, reading, modifying, dumping files, controlling access to files, and undoing files when users no longer use them.
  • the I/O scheduler is the method used by the operating system to determine the order in which I/O operations are submitted on a block device. There are two purposes for existence, one is to improve I / O throughput, and the other is to reduce I / O response time. However, I/O throughput and I/O response time are often contradictory. To balance the two, the I/O scheduler provides multiple scheduling algorithms to accommodate different I/O request scenarios.
  • Block Multi Queue (blkmq): Different multi-core CPUs can be used to allocate different block layer submission queues to different CPU cores to better balance the I/O workload and greatly increase storage. The I/O efficiency of the device.
  • Flash Translation Layer Used to emulate flash into virtual block devices, enabling the implementation of block device class file systems on flash.
  • FTL can include functions such as address mapping, garbage collection, and wear leveling.
  • the controller In the existing practical applications, in order to reduce the development difficulty of the user terminal and shorten the time to introduce the user terminal to the market, many storage device controllers encapsulate management functions (such as the garbage collection function, the erasure management function, and the log record described above). Function, etc.).
  • the controller is a black box for the developer of the user terminal, that is, how to perform management operations inside the controller is invisible to the developer of the user terminal.
  • the management operation performed by the controller may not be an operation that the developer of the user terminal desires to perform, or the execution time of the management operation performed by the controller may not be the execution time desired by the developer of the user terminal. Therefore, the management operations performed by the controller may not meet the actual operational requirements of the developer of the user terminal.
  • the embodiment of the present invention provides a storage device management method and a user terminal.
  • FIG. 1 shows a possible system architecture provided by an embodiment of the present invention.
  • the system architecture provided by the embodiment of the present invention includes an application layer, a file system layer, a block layer (BL), a driver layer, and a storage device.
  • the application layer, the file system layer, the block layer, and the driver layer are included in the user terminal.
  • the storage device may be deployed inside the user terminal or deployed outside the user terminal.
  • Figure 1 shows an example in which a storage device is deployed inside a user terminal. When the storage device is deployed outside the user terminal, the storage device may be a mobile hard disk or a USB flash drive.
  • the user terminal may be a mobile phone, a wearable device (such as a smart watch, a smart wristband, etc.), a tablet computer, a personal computer (PC), and a personal digital assistant (Personal Digital Assistant, PDA) or terminal such as a car computer.
  • a wearable device such as a smart watch, a smart wristband, etc.
  • a tablet computer such as a smart watch, a smart wristband, etc.
  • PC personal computer
  • PDA Personal Digital Assistant
  • the application of the application layer may be any application installed in the user terminal.
  • it can be a browser application, a reader, a video play application, a music play application, an instant messaging application, an e-commerce application, etc., which are not limited in the embodiment of the present invention.
  • the file system layer file system may be a second extended file system (EXT2) to a fourth extended file system (EXT4), a Google file system ( Google File System (GFS), Flash Friendly File System (F2FS), Oracle Cluster File System (OCFS), btrfs (B-Tree File System) or any other file system File system.
  • EXT2 extended file system
  • EXT4 extended file system
  • GFS Google File System
  • F2FS Flash Friendly File System
  • OCFS Oracle Cluster File System
  • btrfs B-Tree File System
  • the block layer may include an I/O scheduler.
  • the block layer may further include a Block Multi Queue (blkmq).
  • Figure 1 shows an example of a block layer including an I/O scheduler and a block layer multi-queue.
  • the storage device may be a random access memory (RAM), a read-only memory (ROM), or an electrically erasable read-only memory (Electrically Erasable Programmable Read-Only).
  • RAM random access memory
  • ROM read-only memory
  • EEPROM Electrically erasable read-only memory
  • NVRAM Non-Volatile Random Access Memory
  • FIG. 1 takes the storage device as an eMMC in the NAND flash memory as an example.
  • the storage device includes a controller and a storage medium.
  • the controller may further include an FTL.
  • the eMMC includes a controller and a storage medium Flash.
  • FIG. 2 is a schematic flowchart diagram of a storage device management method according to an embodiment of the present invention.
  • the storage device management method may include sections 201 and 202.
  • the 201 part can be executed before the 202 part, or the part 201 can be executed after the 202 part, which is not limited by the embodiment of the present invention.
  • the upper management module performs a first management operation.
  • the upper management module is a software module located above the driver layer in the user terminal.
  • the upper management module may be the file system, the I/O scheduler, or the block layer multi-queue, etc. shown in FIG. 1.
  • the first management operation is used to implement a target management function for managing the storage device.
  • the target management function can be any management function that manages the storage device.
  • the upper management module sends a control instruction to the controller of the storage device by using a driver.
  • the control command is used to control the controller to cancel the execution of the second management operation
  • the second management operation is also used to implement the target management function. That is, the target management function can be realized by performing one of the first management operation or the second management operation. By canceling the execution of the second management operation, it is possible to avoid redundant management of the storage device.
  • control instruction may be used to control the controller to permanently cancel the execution of the second management operation.
  • control command can be used to control the controller to cancel the execution of the second management operation within a preset time period.
  • control instruction may be used to control the controller to cancel the execution of the second management operation during the execution of the first management operation by the upper management module.
  • the target management function is any one of a garbage collection function, an erasure management function, a log recording function, a read merge function, a write merge function, and an atomic write function.
  • the target management function is the garbage collection function
  • the first management operation is a first garbage collection operation
  • the second management operation is a second garbage collection operation.
  • the target management function is the erase management function
  • the first management operation is a first erase management operation
  • the second management operation is a second erase management operation.
  • the target management function is a logging function
  • the first management operation is a first logging operation
  • the second management operation is a second logging operation.
  • the first management operation is a first read merge operation
  • the second management operation is a second read merge operation.
  • the first management operation is a first write merge operation
  • the second management operation is a second write merge operation.
  • the target management function is an atomic write function
  • the first management operation is a first atomic write operation
  • the second management operation is a second atomic write operation.
  • the target management function may be any one of a read priority function, a foreground application priority function, and a specific I/O current limiting function.
  • the target management function may be any one of a read priority function, a foreground application priority function, and a specific I/O current limiting function.
  • the target management function is the read priority function
  • the first management operation is the first read priority operation
  • the second management operation is the second read priority operation
  • the target management function is the foreground application priority function
  • the first management operation is the first A foreground application priority operation
  • a second management operation is a second foreground application priority operation
  • the target management function is a specific I/O current limiting function
  • the first management operation is a first specific I/O current limiting operation
  • the second The management operation is a current limiting operation of the second specific I/O.
  • the first management operation may be different from or the same as the second management operation.
  • the target management function is a garbage collection function
  • the first management operation is a first garbage collection operation
  • the second management operation is a second garbage collection operation
  • the first garbage collection operation and the second garbage collection operation are different.
  • the first garbage collection operation and the second garbage collection operation are performed by using different garbage collection algorithms.
  • the first garbage collection operation uses a copy algorithm for garbage collection
  • the second garbage collection operation uses a mark-sweep algorithm for garbage collection.
  • the copy algorithm divides the memory space into two equal regions, using only one of them at a time.
  • the process of garbage collection is actually the process of copying the surviving object from one area to another, and in the next recycling, the two areas exchange roles. After the move is over, update the pointer reference of the object.
  • the mark-and-clear algorithm relies on a global traversal of all surviving objects to determine which objects can be recycled.
  • the traversal process starts from the root and finds all reachable objects.
  • other unreachable objects are garbage objects that can be recycled.
  • the whole process is divided into two phases: the marker phase finds all surviving objects; the cleanup phase clears all garbage objects.
  • the target management function is an erase management function
  • the first management operation is a first erase tube.
  • the second management operation is a second erasure management operation, and the first erasure management operation and the second erasure management operation are different.
  • the first erasure management operation is: when the preset time period 5S (seconds) arrives, and the data to be erased is accumulated to 10 MB (MByte), an erase command is sent to the memory, so that the memory erases the accumulated 10 MB data. .
  • the second erasure management operation is: when the preset time period 10S arrives, and the data to be erased is accumulated to 10 MB, an erase command is sent to the memory, so that the memory erases the accumulated 10 MB data, that is, only the preset time. The period is different from the preset time period of the first erase management operation.
  • the second erasure management operation may be: when the preset time period 5S arrives, and the data to be erased is accumulated to 20 MB, an erase command is sent to the memory, so that the memory erases the accumulated 20 MB data, that is, Only the data accumulation size is different from the data accumulation size of the first erasure management operation.
  • the second erasure management operation may be: when the preset time period 10S arrives, and the data to be erased is accumulated to 20 MB, an erase command is sent to the memory, so that the memory erases the accumulated 20 MB data, that is,
  • the preset time period is different from the preset time period of the first erase management operation, and the data accumulation size is different from the data accumulation size of the first erase management operation.
  • the target management function is a logging function
  • the first management operation is a first logging operation
  • the second management operation is a second logging operation, where the first logging operation and the second logging operation are different.
  • the upper management module first writes the file A into the logical address of 0X100. After the upper management module changes the file A, the upper management module writes the modified file A into the logical address of 0X300, and maintains the data of 0X100. It does not change and marks 0X100 data as data to be erased.
  • the first logging operation may be: recording the process of writing a modified version of file A to logical address 0X300 after writing file A to logical address 0X100. Each logical address corresponds to a physical address.
  • the memory actually writes the file A written in the logical address 0X100 to the physical address 2000, and the memory actually writes the modification of the file A in the logical address 0X300.
  • the version is written to the physical address 5000.
  • the second logging operation may be: recording the process of writing the modified version of the file A to the physical address 5000 after the file A is written to the physical address 2000. That is to say, the difference between the first logging operation and the second logging operation is that the first logging operation records the change of the logical address, and the second logging operation records the physical address. The change.
  • the first log management operation is performed by the upper management module, which is advantageous for improving the write performance.
  • the target management function is a read priority function
  • the first management operation is a first read priority operation
  • the second management operation is a second read priority operation
  • the first read priority operation and the second read priority operation are different.
  • the first read priority operation may be: performing a read operation with a priority policy of a ratio of read operation to write operation of 100:20, that is, performing 100 read operations and then performing 20 write operations.
  • the second read priority operation may be: performing a read operation with a priority policy of a read operation and a write operation ratio of 50:20, that is, performing 50 read operations and then performing 20 write operations.
  • the target management function is the foreground application priority function
  • the first management operation is the first foreground application priority operation
  • the second management operation is the second foreground application priority operation
  • the first foreground application priority operation and the second foreground application priority The operation is different.
  • the first foreground application priority operation may be: performing a foreground application operation with a priority policy of a foreground application operation and a background application operation ratio of 100:20, that is, performing 100 foreground application operations and then executing 20 background applications.
  • the second foreground application priority operation may be: performing a foreground application operation with a priority policy of a foreground application operation and a background application operation ratio of 30:20, that is, performing 30 foreground application operations and then executing 20 background applications. operating.
  • the target management function is a current limiting function of a specific I/O
  • the first management operation is a current limiting operation of the first specific I/O
  • the second management operation is a current limiting operation of the second specific I/O
  • the current limiting operation of the first specific I/O is different from the current limiting operation of the second specific I/O.
  • the current limiting operation of the first specific I/O may be: performing a read operation, a write operation, a synchronization operation, and a priority policy of a ratio of 100:20:10:10 by a read operation, a write operation, a synchronous operation, and an erase operation.
  • the erase operation is performed by performing 100 read operations and then performing 20 write operations, performing 20 synchronous operations after performing 20 write operations, and performing 10 erase operations after performing 10 synchronous operations.
  • the current limiting operation of the second specific I/O may be: performing a read operation, a write operation, a synchronization operation, and a priority policy of a read operation, a write operation, a synchronous operation, and an erase operation with a ratio of 50:20:10:5.
  • the erase operation is performed by performing 50 read operations and then performing 20 write operations, performing 20 write operations after performing 20 write operations, and performing 5 erase operations after performing 10 synchronization operations.
  • the execution time of the first management operation is different from the execution time of the second management operation, but the first management operation is the same as the second management operation.
  • the execution time of the first management operation is the same as the execution time of the second management operation, but the first management operation is different from the second management operation.
  • the execution time of the first management operation is different from the execution time of the second management operation, and the first management operation is different from the second management operation.
  • the developer of the user terminal can customize the first management operation in the upper management module to implement the target management function.
  • the developer of the user terminal can also customize the start execution time of the first management operation in the upper management module. Therefore, by implementing the method described in FIG. 2, the actual operational requirements of the developer of the user terminal can be satisfied.
  • the target management function is a garbage collection function
  • the first management operation is a first garbage collection operation
  • the specific implementation manner of the upper management module performing the first management operation may be The file system performs the first garbage collection operation when it detects that the fragmentation degree of the file stored by the storage device reaches a preset value.
  • the first garbage collection operation and the second garbage collection operation may be the same or different.
  • the file system performs the first garbage collection operation, and performs the first garbage collection operation when the storage device is written, in addition to detecting that the fragmentation degree of the file stored by the storage device reaches a preset value. operating.
  • the upper management module when the upper management module is a file system and the target management function is a garbage collection function, when the first management operation is the first garbage collection operation, the upper management module performs the first management operation, and the specific implementation manner may be The file system performs the first garbage collection operation in a preset time period.
  • the first garbage collection operation and the second garbage collection operation may be the same or different.
  • the file system performs the first garbage collection operation in addition to the preset time period, and may perform the first garbage collection operation when the storage device is written.
  • the controller In the existing practical application, during the execution of the write operation, it is determined whether there is enough free storage area. If there is not enough free storage area, the garbage collection operation is needed to obtain enough free storage area, and then Write data to the free storage area. Therefore, in existing practical applications, the controller generally performs garbage collection during the execution of the write operation.
  • the execution is performed.
  • a garbage collection operation, or the file system performs the first garbage collection operation in a preset time period, and can clear out the free storage area in advance, thereby reducing the time for performing the garbage collection operation during the execution of the write operation, thereby shortening the writing
  • the overall time of operation increases the performance of the write operation.
  • the objects that need to be erased may be determined according to different rules. Therefore, the objects that need to be erased determined by the file system and the controller when performing the garbage collection operation may be different. If you do not cancel the controller to perform garbage collection operations, it may result in increasing the number of erasures of data. Since the number of erasures of the data is directly proportional to the lifetime of the storage device, by canceling the controller to perform the second garbage collection operation, only the upper layer module performs the first garbage collection operation, which is advantageous for extending the life of the storage device.
  • the target management function is a read priority function
  • the first management operation is a first read priority operation
  • the second management operation is a first management operation.
  • the specific implementation manner of the first management operation performed by the upper management module may be: receiving, by the I/O scheduler or the multi-queue queue, the execution of the read priority operation sent by the application installed in the user terminal.
  • the instruction is executed, the first read priority operation is performed.
  • the execution instruction is sent when the application installed in the user terminal detects that the number of read operations of the application is greater than a preset number.
  • the implementation of the present invention also provides a user terminal.
  • the user terminal includes an upper management module.
  • the upper management module is configured to perform a first management operation, where the first management operation is used to implement a target management function for managing the storage device; the upper management module is further configured to send the controller to the storage device by using a driver And a control instruction for controlling the controller to cancel execution of the second management operation, the second management operation being used to implement the target management function.
  • the upper management module is any one of a file system, an input/output I/O scheduler, and a block layer multi-queue.
  • the upper management module is a file system
  • the target management function is any one of a garbage collection function, an erasure management function, a log recording function, a read merge function, a write merge function, and an atomic write function.
  • the target management function is a garbage collection function
  • the first management operation is a first garbage collection operation
  • the second management operation is a second garbage collection operation
  • the upper management module performs the first management operation manner.
  • the first garbage collection operation is performed when the file system detects that the fragmentation degree of the data stored by the storage device reaches a preset value.
  • the target management function is a garbage collection function
  • the first management operation is a first garbage collection operation
  • the second management operation is a second garbage collection operation
  • the upper management module performs the first management operation manner.
  • the file system performs the first garbage collection operation in a preset time period.
  • the upper management module is an I/O scheduler or a block-level multi-queue
  • the target management function is any one of a read priority function, a foreground application priority function, and a specific I/O current limiting function.
  • the target management function is a read priority function
  • the first management operation is a first read priority operation
  • the second management operation is a second read priority operation
  • the upper management module performs the first management operation manner.
  • the principle of solving the problem in the user terminal provided by the embodiment of the present invention is similar to the storage device management method in the method embodiment of the present invention. Therefore, the implementation of the device can refer to the implementation of the method. Let me repeat.
  • the above-mentioned storage medium may be a read only memory, a magnetic disk or an optical disk or the like.
  • Computer readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one location to another.
  • a storage medium may be any available media that can be accessed by a general purpose or special purpose computer.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Memory System (AREA)

Abstract

本发明实施例公开了一种存储设备管理方法及用户终端,其中,该方法应用于用户终端的上层管理模块,该方法包括:上层管理模块执行第一管理操作,该第一管理操作用于实现对存储设备进行管理的目标管理功能;上层管理模块通过驱动向存储设备的控制器发送控制指令,该控制指令用于控制控制器取消执行第二管理操作,该第二管理操作用于实现目标管理功能。可见,通过实施本发明实施例所提供的方法,可以满足用户终端的开发者的实际操作需求。

Description

一种存储设备管理方法及用户终端 技术领域
本发明实施例涉及终端技术领域,尤其涉及一种存储设备管理方法及用户终端。
背景技术
存储设备(Memory)是现代信息技术中用于保存信息的记忆设备。例如,存储设备可以包括随机存储器(Random Access Memory,RAM)、只读存储器(Read-Only Memory,ROM)和Flash存储器等存储设备。目前,存储设备在很多用户终端(如手机、电脑、相机或穿戴设备等终端)中得到了广泛地使用。
在实际应用中,很多存储设备除包括存储介质之外,还集成了控制器。例如,Flash存储器类型下的嵌入式多媒体卡(Embedded Multi Media Card,eMMC)、安全数码卡(Secure Digital Card,SD card)和通用闪存存储(Universal Flash Storage,UFS)等都集成了控制器。其中,控制器中封装了很多管理功能(如磨损均衡、寿命监控、坏块管理、垃圾回收、I/O调度等功能),用于对存储设备进行管理。这使得用户终端厂商无需开发控制器封装的管理功能,大大降低了用户终端的开发难度以及缩短了向市场推出用户终端的时间。
然而在实践中发现,控制器实现管理功能所执行的管理操作往往不满足用户终端的开发者的实际操作需求。
发明内容
本发明实施例公开了一种存储设备管理方法及用户终端,能够通过用户终端的开发者在上层管理模块自定义的操作来管理存储设备,从而满足用户终端的开发者的实际操作需求。
第一方面,提供了一种存储设备管理方法,应用于用户终端的上层管理模块,该方法包括:上层管理模块执行第一管理操作,该第一管理操作用于实现对存储设备进行管理的目标管理功能;上层管理模块通过驱动向存储设备的控 制器发送控制指令,该控制指令用于控制控制器取消执行第二管理操作,该第二管理操作用于实现目标管理功能。其中,第一管理操作可以第一管理操作相同或不同。也就是说,通过执行第一管理操作或第二管理操作中的一种就可实现目标管理功能。因此,通过取消执行第二管理操作,可避免重复地对存储设备进行管理。
可见,通过实施第一方面所提供的方法,用户终端的开发者可在上层管理模块自定义第一管理操作来实现目标管理功能。同时,用户终端的开发者也可在上层管理模块自定义第一管理操作的开始执行时间。因此,通过实施第一方面所提供的方法,可以满足用户终端的开发者的实际操作需求。
作为一种可选的实施方式,该控制指令可用于控制控制器永久取消执行第二管理操作。或者,该控制指令可用于控制控制器在预设时间段内取消执行第二管理操作。或者,该控制指令可用于控制控制器在上层管理模块执行第一管理操作期间取消执行第二管理操作。
作为一种可选的实施方式,上层管理模块为文件系统、输入/输出I/O调度器和块层多队列中的任意一种。
作为一种可选的实施方式,上层管理模块为文件系统,目标管理功能为垃圾回收功能、擦除管理功能、日志记录功能、读合并功能、写合并功能和原子写功能中的任意一种。
作为一种可选的实施方式,当目标管理功能为垃圾回收功能时,第一管理操作为第一垃圾回收操作,第二管理操作为第二垃圾回收操作,上层管理模块执行第一管理操作包括:文件系统在检测到存储设备存储的数据的碎片化程度达到预设值时,执行第一垃圾回收操作。可选的,文件系统除在检测到存储设备存储的文件的碎片化程度达到预设值时,执行第一垃圾回收操作之外,还可在对存储设备进行写操作时,执行第一垃圾回收操作。
作为一种可选的实施方式,当目标管理功能为垃圾回收功能时,第一管理操作为第一垃圾回收操作,第二管理操作为第二垃圾回收操作,上层管理模块执行第一管理操作包括:文件系统以预设时间周期执行第一垃圾回收操作。可选的,文件系统除以预设时间周期执行第一垃圾回收操作之外,还可在对存储设备进行写操作时,执行第一垃圾回收操作。
在现有的实际应用中,在执行写操作的过程中,会判断是否有足够的空闲存储区域,若没有足够的空闲存储区域,则需要进行垃圾回收操作,得到足够的空闲存储区域,然后再向空闲存储区域中写入数据。因此,在现有的实际应用中,控制器一般会在执行写操作的过程中进行垃圾回收。通过该实施方式,在文件系统检测到存储设备存储的数据的碎片化程度达到预设值时,就执行第一垃圾回收操作,或文件系统以预设时间周期执行第一垃圾回收操作,可提前清理出空闲的存储区域,有利于减少在执行写操作的过程中进行垃圾回收操作的时间,从而可缩短写操作的总体时间,提高写操作的性能。同时,由于文件系统和控制器执行垃圾回收操作时,可能根据不同的规则来确定的需要擦除的对象,因此,文件系统和控制器执行垃圾回收操作时确定的需要擦除的对象可能不同。若不取消控制器执行垃圾回收操作,可能导致增加数据的擦除次数。由于数据的擦除次数与存储设备的寿命成正比,因此,通过取消控制器执行第二垃圾回收操作,只由上层模块执行第一垃圾回收操作,有利于延长存储设备的寿命。
作为一种可选的实施方式,上层管理模块为I/O调度器或块层多队列,目标管理功能为读优先功能、前台应用优先功能和特定I/O的限流功能中的任意一种。
作为一种可选的实施方式,当目标管理功能为读优先功能时,第一管理操作为第一读优先操作,第二管理操作为第二读优先操作,上层管理模块执行第一管理操作包括:在I/O调度器或块层多队列接收到安装于用户终端的应用发送的用于执行读优先操作的执行指令时,执行第一读优先操作,执行指令为应用在检测到应用的读操作数量大于预设数量时发送的。
通过实施该实施方式,能够在应用的读操作数量较多时,及时进行读操作,提高读的性能。同时,在I/O调度器或块层多队列执行第一读优先操作时,取消控制器执行第二读优先操作,可避免写操作的延时较大,造成写的严重的卡顿。
第二方面,提供了一种用户终端,该用户终端包括上层管理模块,且该上层管理模块具有实现上述第一方面或第一方面可能的实现方式中上层管理模块行为的功能。基于同一发明构思,由于该用户终端解决问题的原理以及有益效果可以参见上述第一方面和第一方面的各可能的方法实施方式以及所带来 的有益效果,因此该用户终端的实施可以参见上述第一方面和第一方面的各可能的方法实施方式,重复之处不再赘述。
第三方面,提供了一种计算机存储介质,用于存储为上述无线充放电设备所用的计算机软件指令,其包含用于执行第一方面、第一方面的任一可能的实现方式中的方法的指令。
附图说明
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本发明实施例提供的一种系统架构的示意图;
图2是本发明实施例提供的一种存储设备管理方法的流程示意图。
具体实施方式
为了使本发明的实施例的目的、技术方案和优点更加清楚,下面将结合附图对本发明实施例的技术方案进行描述。
为了便于理解本发明实施例,下面对本发明实施中涉及的专业术语进行介绍:
垃圾回收功能:对内存堆中已经死亡的或者长时间没有使用的对象进行清除和回收。
擦除管理功能:在预设时间周期达到时,并且需要擦除的数据累积到预设大小时向储存器下发擦除指令,使存储器擦除累积的预设大小的数据。
日志记录功能:对日志进行记录的功能。日志是一个为了保障故障后能恢复的机制,通过记录日志,可在故障发生时,复原到前一次记录时的正常状态。
原子写功能:确保写操作不被打断的功能,即确保数据能完整写入,即使失败也能保证写入前的数据不丢失。
读合并功能:当存在多个读操作,一次性读取该多个读操作需要读取的数 据。这样可提高读操作的性能。现有的存储器的控制器在检测到存在多个读操作,并且该多个读操作需要读取的数据的存储地址连续时,会一次性读取该多个读操作需要读取的数据。例如,当同时存在读操作1、读操作2和读操作3时,读操作1用于读取存储地址为0000的数据,读操作2用于读取存储地址为0001的数据,读操作3用于读取存储地址为0002的数据。由于0000、0001和0002为连续的存储地址,控制器会一次性读取地址0000~0002连续性地址存储的数据。
写合并功能:当存在多个写操作,将该多个写操作需要写入的数据一次性写入存储设备。这样可提高写操作的性能。现有的存储器的控制器在检测到存在多个写操作,并且该多个写操作需要写入的数据的存储地址连续时,会一次性写入该多个写操作需要写入的数据。例如,同时存在写操作1、写操作2和写操作3。写操作1用于写入数据至存储地址0000,写操作2用于写入数据至存储地址0001,写操作3用于写入数据至存储地址0002。由于0000、0001和0002为连续的存储地址,因此,控制器一次性将三个写操作需要写入的数据写入至存储地址0000~0002。
读优先功能:以一定的优先策略执行读操作。这样可降低读操作的延时,提高读操作的性能。例如,以读操作与写操作的比例为100:20的优先策略来执行读操作,即先执行完100个读操作再执行20个写操作。
前台应用优先功能:以一定的优先策略执行前台应用的操作。这样可降低前台应用的操作的延时,提高前台应用的操作的性能。例如,通过前台应用操作与后台应用操作的比例为100:20的优先策略来执行前台应用的操作,即先执行完100个前台应用的操作再执行20个后台应用的操作。
特定I/O(Input/Output,输入/输出)的限流功能:针对不同的I/O类型(如I/O类型可包括读、写、同步和擦除等),为不同类型的I/O设定优先级和对应的带宽,以确保带宽和性能可达到相应类型的I/O的需求。例如,通过读操作、写操作、同步操作、擦除操作的比例为100:20:10:10的优先策略来执行读操作、写操作、同步操作和擦除操作,即先执行完100个读操作再执行20个写操作,执行完20个写操作之后再执行10个同步操作,执行完10个同步操作之后再执行 10个擦除操作。
文件系统:操作系统中负责管理和存储文件信息的软件机构称为文件管理系统,简称文件系统。从系统角度来看,文件系统是对存储设备的空间进行组织和分配,负责文件存储并对存入的文件进行保护和检索的系统。具体地说,它负责为用户建立文件,存入、读出、修改、转储文件,控制文件的存取,当用户不再使用时撤销文件等。
I/O调度器(Input/Output Scheduler):I/O调度器是操作系统用来决定块设备上I/O操作提交顺序的方法。存在的目的有两个,一是提高I/O吞吐量,二是降低I/O响应时间。然而I/O吞吐量和I/O响应时间往往是矛盾的,为了尽量平衡这两者,I/O调度器提供了多种调度算法来适应不同的I/O请求场景。
块层多队列(Block Multi Queue,blkmq):可以在多核CPU的情况下,将不同的块层提交队列分配到不同的CPU核上,以更好的平衡I/O的工作负载,大幅提高存储设备的I/O效率。
闪存转换层(Flash Translation Layer,FTL):用于将闪存模拟成为虚拟块设备,从而能够在闪存上实现块设备类文件系统。FTL可包括地址映射、垃圾回收、损耗均衡等功能。
在现有的实际应用中,为降低用户终端的开发难度以及缩短向市场推出用户终端的时间,很多存储设备的控制器封装了管理功能(如上述的垃圾回收功能、擦除管理功能、日志记录功能等)。然而在现有的实际应用中,控制器对于用户终端的开发者来说是一个黑盒子,即控制器内部如何执行管理操作对于用户终端的开发者来说是不可见的。控制器执行的管理操作可能不是用户终端的开发者希望执行的操作,或控制器执行的管理操作的执行时间可能不是用户终端的开发者希望的执行时间。因此,控制器执行的管理操作,可能不满足用户终端的开发者的实际操作需求。
为了能够满足用户终端的开发者的实际操作需求,本发明实施例提供了一种存储设备管理方法以及用户终端。
为了清楚的描述本发明实施例的方案,下面对本发明实施例可能应用的系 统架构进行说明。
图1示出了本发明实施例提供的一种可能的系统架构。如图1所示,本发明实施例提供的系统架构包括应用层、文件系统层、块层(Block Layer,BL)、驱动层以及存储设备。其中,应用层、文件系统层、块层、驱动层包括于用户终端。可选的,存储设备可部署在用户终端内部或部署在用户终端外部。图1以存储设备部署于用户终端内部为例。当存储设备部署在用户终端外部时,可选的,存储设备可以为移动硬盘或U盘等。
本发明实施例提供的系统架构中,用户终端可以为手机、可穿戴设备(如智能手表、智能手环等)、平板电脑、个人电脑(Personal Computer,PC)、个人数字助理(Personal Digital Assistant,PDA)或车载电脑等终端。
本发明实施例提供的系统架构中,应用层的应用可以为安装于用户终端的任意的应用。例如,可以为浏览器应用、阅读器、视频播放类应用、音乐播放类应用、即时通讯应用、电商应用等,本发明实施例不做限定。
本发明实施例提供的系统架构中,文件系统层的文件系统可以为第二代扩展文件系统(First extended filesystem,EXT2)~第四代扩展文件系统(Fourth extended filesystem,EXT4)、Google文件系统(Google File System,GFS)、闪存友好的文件系统(Flash Friendly File System,F2FS)、甲骨文集群文件系统(Oracle Cluster File System,OCFS)、btrfs(B-Tree File System)或其他文件系统中的任意一个文件系统。
本发明实施例提供的系统架构中,块层可包括I/O调度器。可选的,块层还可包括块层多队列(Block Multi Queue,blkmq)。图1以块层包括I/O调度器和块层多队列为例。
本发明实施例提供的系统架构中,存储设备可以为随机存储器(Random Access Memory,RAM)、只读存储器(Read-Only Memory,ROM)、电可擦除只读存储器(Electrically Erasable Programmable Read-Only Memory,EEPROM)、非易失性随机访问存储器(Non-Volatile Random Access Memory,NVRAM)、NAND Flash存储器或NOR Flash存储器等其他封装有控制器的存 储设备。图1以存储设备为NAND Flash存储器中的eMMC为例。
本发明实施例提供的系统架构中,存储设备包括控制器和存储介质。可选的,控制器还可包括FTL。如图1所示,eMMC包括控制器和存储介质Flash。
请参见图2,图2为本发明实施例提供的一种存储设备管理方法的流程示意图。如图2所示,该存储设备管理方法可以包括201和202部分。其中,201部分可在202部分之前执行,或201部分可在202部分之后执行,本发明实施例不做限定。
201、上层管理模块执行第一管理操作。
其中,该上层管理模块为用户终端中位于驱动层之上的软件模块。例如,上层管理模块可以为图1所示的文件系统、I/O调度器或块层多队列等。
其中,该第一管理操作用于实现对存储设备进行管理的目标管理功能。该目标管理功能可以为对存储设备进行管理的任一管理功能。
202、上层管理模块通过驱动向存储设备的控制器发送控制指令。
其中,该控制指令用于控制控制器取消执行第二管理操作,该第二管理操作也用于实现目标管理功能。也就是说,通过执行第一管理操作或第二管理操作中的一种就可实现目标管理功能。通过取消执行第二管理操作,可避免重复地对存储设备进行管理。
作为一种可选的实施方式,该控制指令可用于控制控制器永久取消执行第二管理操作。或者,该控制指令可用于控制控制器在预设时间段内取消执行第二管理操作。或者,该控制指令可用于控制控制器在上层管理模块执行第一管理操作期间取消执行第二管理操作。
作为一种可选的实施方式,当上层管理模块为文件系统时,目标管理功能为垃圾回收功能、擦除管理功能、日志记录功能、读合并功能、写合并功能、原子写功能中的任意一种。相应地,当目标管理功能为垃圾回收功能时,第一管理操作为第一垃圾回收操作,第二管理操作为第二垃圾回收操作。当目标管理功能为擦除管理功能时,第一管理操作为第一擦除管理操作,第二管理操作为第二擦除管理操作。当目标管理功能为日志记录功能时,第一管理操作为第一日志记录操作,第二管理操作为第二日志记录操作。当目标管理功能为读合 并功能时,第一管理操作为第一读合并操作,第二管理操作为第二读合并操作。当目标管理功能为写合并功能时,第一管理操作为第一写合并操作,第二管理操作为第二写合并操作。当目标管理功能为原子写功能时,第一管理操作为第一原子写操作,第二管理操作为第二原子写操作。
作为一种可选的实施方式,当上层管理模块为I/O调度器或块多队列时,目标管理功能可以为读优先功能、前台应用优先功能、特定I/O的限流功能中的任意一种。相应地,目标管理功能为读优先功能时,第一管理操作为第一读优先操作,第二管理操作为第二读优先操作;目标管理功能为前台应用优先功能时,第一管理操作为第一前台应用优先操作,第二管理操作为第二前台应用优先操作;目标管理功能为特定I/O的限流功能时,第一管理操作为第一特定I/O的限流操作,第二管理操作为第二特定I/O的限流操作。
在现有的实际应用中,实现某一管理功能可能有多种不同的具体实现方式,即执行不同的管理操作可实现同一管理功能。因此,本发明实施例中,第一管理操作可以与第二管理操作不相同或相同。
举例来说,目标管理功能为垃圾回收功能,第一管理操作为第一垃圾回收操作,第二管理操作为第二垃圾回收操作,第一垃圾回收操作和第二垃圾回收操作不相同。其中,第一垃圾回收操作和第二垃圾回收操作采用不同的垃圾回收算法执行。第一垃圾回收操作采用复制算法进行垃圾回收,第二垃圾回收操作采用标记-清除(Mark-Sweep)算法进行垃圾回收。
其中,复制算法是把内存空间划分为两个相等的区域,每次只用其中一个。垃圾回收的过程其实就是把存活对象从一个区域拷贝到另外一个区域的过程,而在下一次回收时,两个区域再互换角色。在移动结束后,再更新对象的指针引用。
其中,标记-清除算法依赖于对所有存活对象进行一次全局遍历来确定哪些对象可以回收。遍历的过程从根出发,找到所有可达对象。除此之外,其它不可达的对象就是垃圾对象,可被回收。整个过程分为两个阶段:标记阶段找到所有存活对象;清除阶段清除所有垃圾对象。
再举例来说,目标管理功能为擦除管理功能,第一管理操作为第一擦除管 理操作,第二管理操作为第二擦除管理操作,第一擦除管理操作和第二擦除管理操作不相同。第一擦除管理操作为:在预设时间周期5S(秒)到达时,并且需要擦除的数据累积到10MB(MByte)时向储存器下发擦除指令,使存储器擦除累积的10MB数据。第二擦除管理操作为:在预设时间周期10S到达时,并且需要擦除的数据累积到10MB时向储存器下发擦除指令,使存储器擦除累积的10MB数据,即只是预设时间周期与第一擦除管理操作的预设时间周期不同。或者,第二擦除管理操作也可以为:在预设时间周期5S到达时,并且需要擦除的数据累积到20MB时向储存器下发擦除指令,使存储器擦除累积的20MB数据,即只是数据累积大小与第一擦除管理操作的数据累积大小不同。或者,第二擦除管理操作也可以为:在预设时间周期10S到达时,并且需要擦除的数据累积到20MB时向储存器下发擦除指令,使存储器擦除累积的20MB数据,即预设时间周期与第一擦除管理操作的预设时间周期不同,且数据累积大小与第一擦除管理操作的数据累积大小也不同。
再举例来说,目标管理功能为日志记录功能,第一管理操作为第一日志记录操作,第二管理操作为第二日志记录操作,第一日志记录操作和第二日志记录操作不相同。例如,上层管理模块首先将文件A写入0X100的逻辑地址中,在上层管理模块对文件A进行了修改之后,上层管理模块将修改的文件A写入0X300的逻辑地址中,并保持0X100的数据不变,并将0X100的数据标记为待擦除数据。第一日志记录操作可以为:记录在将文件A写入逻辑地址0X100之后,又将文件A的修改版本写入逻辑地址0X300的这一过程。每一个逻辑地址对应一个物理地址。若0X100对应的物理地址为2000,0X300对应的物理地址为5000,则存储器实际将写入逻辑地址0X100中的文件A写入物理地址2000,存储器实际将写入逻辑地址0X300中的文件A的修改版本写入物理地址5000。若通过控制器来实现日志记录功能,则第二日志记录操作可以为:记录在将文件A写入物理地址2000之后,又将文件A的修改版本写入物理地址5000的这一过程。也即是说,第一日志记录操作和第二日志记录操作的区别在于:第一日志记录操作记录的是逻辑地址的变化,而第二日志记录操作记录的是物理地址 的变化。通过记录逻辑地址的变化,有利于提高写的性能。因此,通过上层管理模块来进行第一日志管理操作,有利于提高写的性能。
再举例来说,目标管理功能为读优先功能,第一管理操作为第一读优先操作,第二管理操作为第二读优先操作,第一读优先操作和第二读优先操作不相同。第一读优先操作可以为:以读操作与写操作的比例为100:20的优先策略来执行读操作,即先执行完100个读操作再执行20个写操作。第二读优先操作可以为:以读操作与写操作的比例为50:20的优先策略来执行读操作,即先执行完50个读操作再执行20个写操作。
再举例来说,目标管理功能为前台应用优先功能,第一管理操作为第一前台应用优先操作,第二管理操作为第二前台应用优先操作,第一前台应用优先操作和第二前台应用优先操作不相同。第一前台应用优先操作可以为:以前台应用操作与后台应用操作的比例为100:20的优先策略来执行前台应用的操作,即先执行完100个前台应用的操作再执行20个后台应用的操作。第二前台应用优先操作可以为:以前台应用操作与后台应用操作的比例为30:20的优先策略来执行前台应用的操作,即先执行完30个前台应用的操作再执行20个后台应用的操作。
再举例来说,目标管理功能为特定I/O的限流功能,第一管理操作为第一特定I/O的限流操作,第二管理操作为第二特定I/O的限流操作,第一特定I/O的限流操作和第二特定I/O的限流操作不相同。第一特定I/O的限流操作可以为:通过读操作、写操作、同步操作、擦除操作的比例为100:20:10:10的优先策略来执行读操作、写操作、同步操作和擦除操作,即先执行完100个读操作再执行20个写操作,执行完20个写操作之后再执行10个同步操作,执行完10个同步操作之后再执行10个擦除操作。第二特定I/O的限流操作可以为:通过读操作、写操作、同步操作、擦除操作的比例为50:20:10:5的优先策略来执行读操作、写操作、同步操作和擦除操作,即先执行完50个读操作再执行20个写操作,执行完20个写操作之后再执行10个同步操作,执行完10个同步操作之后再执行5个擦除操作。
本发明实施例中,可存在以下三种情况:
一、第一管理操作的执行时间与第二管理操作的执行时间不相同,但第一管理操作与第二管理操作相同。
二、第一管理操作的执行时间与第二管理操作的执行时间相同,但第一管理操作与第二管理操作不相同。
三、第一管理操作的执行时间与第二管理操作的执行时间不相同,第一管理操作与第二管理操作不相同。
可见,通过实施图2所描述的方法,用户终端的开发者可在上层管理模块自定义第一管理操作来实现目标管理功能。同时,用户终端的开发者也可在上层管理模块自定义第一管理操作的开始执行时间。因此,通过实施图2所描述的方法,可以满足用户终端的开发者的实际操作需求。
作为一种可选的实施方式,当上层管理模块为文件系统,目标管理功能为垃圾回收功能,第一管理操作为第一垃圾回收操作,上层管理模块执行第一管理操作的具体实施方式可以为:文件系统在检测到存储设备存储的文件的碎片化程度达到预设值时,执行第一垃圾回收操作。在该实施方式中,第一垃圾回收操作与第二垃圾回收操作可以相同也可以不同。可选的,文件系统除在检测到存储设备存储的文件的碎片化程度达到预设值时,执行第一垃圾回收操作之外,还可在对存储设备进行写操作时,执行第一垃圾回收操作。
作为一种可选的实施方式,当上层管理模块为文件系统,目标管理功能为垃圾回收功能,第一管理操作为第一垃圾回收操作时,上层管理模块执行第一管理操作得具体实施方式可以为:文件系统以预设时间周期执行第一垃圾回收操作。在该实施方式中,第一垃圾回收操作与第二垃圾回收操作可以相同也可以不同。可选的,文件系统除以预设时间周期执行第一垃圾回收操作之外,还可在对存储设备进行写操作时,执行第一垃圾回收操作。
在现有的实际应用中,在执行写操作的过程中,会判断是否有足够的空闲存储区域,若没有足够的空闲存储区域,则需要进行垃圾回收操作,得到足够的空闲存储区域,然后再向空闲存储区域中写入数据。因此,在现有的实际应用中,控制器一般会在执行写操作的过程中进行垃圾回收。通过该实施方式,在文件系统检测到存储设备存储的数据的碎片化程度达到预设值时,就执行第 一垃圾回收操作,或文件系统以预设时间周期执行第一垃圾回收操作,可提前清理出空闲的存储区域,有利于减少在执行写操作的过程中进行垃圾回收操作的时间,从而可缩短写操作的总体时间,提高写操作的性能。同时,由于文件系统和控制器执行垃圾回收操作时,可能根据不同的规则来确定的需要擦除的对象,因此,文件系统和控制器执行垃圾回收操作时确定的需要擦除的对象可能不同。若不取消控制器执行垃圾回收操作,可能导致增加数据的擦除次数。由于数据的擦除次数与存储设备的寿命成正比,因此,通过取消控制器执行第二垃圾回收操作,只由上层模块执行第一垃圾回收操作,有利于延长存储设备的寿命。
作为一种可选的实施方式,当上层管理模块为I/O调度器或块层多队列,目标管理功能为读优先功能,第一管理操作为第一读优先操作,第二管理操作为第二读优先操作时,上层管理模块执行第一管理操作的具体实施方式可以为:在I/O调度器或块层多队列接收到安装于用户终端的应用发送的用于执行读优先操作的执行指令时,执行第一读优先操作。其中,该执行指令为安装于用户终端的应用在检测到应用的读操作数量大于预设数量时发送的。
通过实施该实施方式,能够在应用的读操作数量较多时,及时进行读操作,提高读的性能。同时,在I/O调度器或块层多队列执行第一读优先操作时,取消控制器执行第二读优先操作,可避免写操作的延时较大,造成写的严重的卡顿。
本发明实施还提供了一种用户终端。该用户终端包括上层管理模块。其中,该上层管理模块,用于执行第一管理操作,该第一管理操作用于实现对存储设备进行管理的目标管理功能;该上层管理模块,还用于通过驱动向存储设备的控制器发送控制指令,该控制指令用于控制控制器取消执行第二管理操作,该第二管理操作用于实现目标管理功能。
作为一种可选的实施方式,上层管理模块为文件系统、输入/输出I/O调度器和块层多队列中的任意一种。
作为一种可选的实施方式,上层管理模块为文件系统,目标管理功能为垃圾回收功能、擦除管理功能、日志记录功能、读合并功能、写合并功能和原子写功能中的任意一种。
作为一种可选的实施方式,目标管理功能为垃圾回收功能,第一管理操作为第一垃圾回收操作,第二管理操作为第二垃圾回收操作,上层管理模块执行第一管理操作的方式具体为:文件系统在检测到存储设备存储的数据的碎片化程度达到预设值时,执行第一垃圾回收操作。
作为一种可选的实施方式,目标管理功能为垃圾回收功能,第一管理操作为第一垃圾回收操作,第二管理操作为第二垃圾回收操作,上层管理模块执行第一管理操作的方式具体为:文件系统以预设时间周期执行第一垃圾回收操作。
作为一种可选的实施方式,上层管理模块为I/O调度器或块层多队列,目标管理功能为读优先功能、前台应用优先功能和特定I/O的限流功能中的任意一种。
作为一种可选的实施方式,目标管理功能为读优先功能,第一管理操作为第一读优先操作,第二管理操作为第二读优先操作,上层管理模块执行第一管理操作的方式具体为:在I/O调度器或块层多队列接收到安装于用户终端的应用发送的用于执行读优先操作的执行指令时,执行第一读优先操作,执行指令为应用在检测到应用的读操作数量大于预设数量时发送的。
基于同一发明构思,本发明实施例中提供的用户终端解决问题的原理与本发明方法实施例中的存储设备管理方法相似,因此该设备的实施可以参见方法的实施,为简洁描述,在这里不再赘述。
还需要说明的是,在本发明实施例中,诸如第一、第二之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或者操作之间存在任何这种实际的关系或者顺序。
上述本发明实施例序号仅仅为了描述,不代表实施例的优劣。
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种非易失性计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。
本领域技术人员应该可以意识到,在上述一个或多个示例中,本发明所描述的功能可以用硬件、软件、固件或它们的任意组合来实现。当使用软件实现时,可以将这些功能存储在计算机可读介质中或者作为计算机可读介质上的 一个或多个指令或代码进行传输。计算机可读介质包括计算机存储介质和通信介质,其中通信介质包括便于从一个地方向另一个地方传送计算机程序的任何介质。存储介质可以是通用或专用计算机能够存取的任何可用介质。
以上所述的具体实施方式,对本发明的实施例的目的、技术方案有益效果进行了进一步详细说明,所应理解的是,不同的实施例可以进行组合,以上所述进而本发明的实施例的具体实施方式而已,并不用于限定本发明实施例的保护范围,凡在本发明实施例的精神和原则之内,所做的任何组合、修改、等同替换、改进等,均应包含在本发明实施例的保护范围之内。
以上所述的具体实施方式,对本发明的实施例的目的、技术方案和有益效果进行了进一步详细说明,所应理解的是,以上所述仅为本发明实施例的具体实施方式而已,并不用于限定本发明实施例的保护范围,凡在本发明实施例的技术方案的基础之上,所做的任何修改、等同替换、改进等,均应包括在本发明实施例的保护范围之内。

Claims (14)

  1. 一种存储设备管理方法,应用于用户终端的上层管理模块,其特征在于,所述方法包括:
    所述上层管理模块执行第一管理操作,所述第一管理操作用于实现对存储设备进行管理的目标管理功能;
    所述上层管理模块通过驱动向所述存储设备的控制器发送控制指令,所述控制指令用于控制所述控制器取消执行第二管理操作,所述第二管理操作用于实现所述目标管理功能。
  2. 根据权利要求1所述的方法,其特征在于,所述上层管理模块为文件系统、输入/输出I/O调度器和块层多队列中的任意一种。
  3. 根据权利要求2所述的方法,其特征在于,所述上层管理模块为文件系统,所述目标管理功能为垃圾回收功能、擦除管理功能、日志记录功能、读合并功能、写合并功能和原子写功能中的任意一种。
  4. 根据权利要求3所述的方法,其特征在于,当所述目标管理功能为垃圾回收功能时,所述第一管理操作为第一垃圾回收操作,所述第二管理操作为第二垃圾回收操作,所述上层管理模块执行第一管理操作包括:
    所述文件系统在检测到所述存储设备存储的数据的碎片化程度达到预设值时,执行所述第一垃圾回收操作。
  5. 根据权利要求3所述的方法,其特征在于,当所述目标管理功能为垃圾回收功能时,所述第一管理操作为第一垃圾回收操作,所述第二管理操作为第二垃圾回收操作,所述上层管理模块执行第一管理操作包括:
    所述文件系统以预设时间周期执行所述第一垃圾回收操作。
  6. 根据权利要求2所述的方法,其特征在于,所述上层管理模块为I/O调度器或块层多队列,所述目标管理功能为读优先功能、前台应用优先功能和特定I/O的限流功能中的任意一种。
  7. 根据权利要求6所述的方法,其特征在于,当所述目标管理功能为读优先功能时,所述第一管理操作为第一读优先操作,所述第二管理操作为第二读优先操作,所述上层管理模块执行第一管理操作包括:
    在所述I/O调度器或块层多队列接收到安装于所述用户终端的应用发送的用于执行读优先操作的执行指令时,执行所述第一读优先操作,所述执行指令为所述应用在检测到所述应用的读操作数量大于预设数量时发送的。
  8. 一种用户终端,其特征在于,所述用户终端包括:
    上层管理模块,用于执行第一管理操作,所述第一管理操作用于实现对存储设备进行管理的目标管理功能;
    所述上层管理模块,还用于通过驱动向所述存储设备的控制器发送控制指令,所述控制指令用于控制所述控制器取消执行第二管理操作,所述第二管理操作用于实现所述目标管理功能。
  9. 根据权利要求8所述的用户终端,其特征在于,所述上层管理模块为文件系统、输入/输出I/O调度器和块层多队列中的任意一种。
  10. 根据权利要求9所述的用户终端,其特征在于,所述上层管理模块为文件系统,所述目标管理功能为垃圾回收功能、擦除管理功能、日志记录功能、读合并功能、写合并功能和原子写功能中的任意一种。
  11. 根据权利要求10所述的用户终端,其特征在于,所述目标管理功能为垃圾回收功能,所述第一管理操作为第一垃圾回收操作,所述第二管理操作为第二垃圾回收操作,所述上层管理模块执行第一管理操作的方式具体为:
    所述文件系统在检测到所述存储设备存储的数据的碎片化程度达到预设值时,执行所述第一垃圾回收操作。
  12. 根据权利要求10所述的用户终端,其特征在于,所述目标管理功能为垃圾回收功能,所述第一管理操作为第一垃圾回收操作,所述第二管理操作 为第二垃圾回收操作,所述上层管理模块执行第一管理操作的方式具体为:
    所述文件系统以预设时间周期执行所述第一垃圾回收操作。
  13. 根据权利要求9所述的用户终端,其特征在于,所述上层管理模块为I/O调度器或块层多队列,所述目标管理功能为读优先功能、前台应用优先功能和特定I/O的限流功能中的任意一种。
  14. 根据权利要求13所述的用户终端,其特征在于,所述目标管理功能为读优先功能,所述第一管理操作为第一读优先操作,所述第二管理操作为第二读优先操作,所述上层管理模块执行第一管理操作的方式具体为:
    在所述I/O调度器或块层多队列接收到安装于所述用户终端的应用发送的用于执行读优先操作的执行指令时,执行所述第一读优先操作,所述执行指令为所述应用在检测到所述应用的读操作数量大于预设数量时发送的。
PCT/CN2016/108855 2016-12-07 2016-12-07 一种存储设备管理方法及用户终端 WO2018103010A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201680089211.4A CN109690465B (zh) 2016-12-07 2016-12-07 一种存储设备管理方法及用户终端
PCT/CN2016/108855 WO2018103010A1 (zh) 2016-12-07 2016-12-07 一种存储设备管理方法及用户终端

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2016/108855 WO2018103010A1 (zh) 2016-12-07 2016-12-07 一种存储设备管理方法及用户终端

Publications (1)

Publication Number Publication Date
WO2018103010A1 true WO2018103010A1 (zh) 2018-06-14

Family

ID=62491746

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/108855 WO2018103010A1 (zh) 2016-12-07 2016-12-07 一种存储设备管理方法及用户终端

Country Status (2)

Country Link
CN (1) CN109690465B (zh)
WO (1) WO2018103010A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110703999A (zh) * 2019-09-30 2020-01-17 盛科网络(苏州)有限公司 存储器的读操作的调度方法和存储器
CN116028327A (zh) * 2023-02-20 2023-04-28 成都佰维存储科技有限公司 文件系统读写性能测试方法、装置、可读存储介质及设备
TWI816106B (zh) * 2020-04-22 2023-09-21 德商奧迪股份有限公司 用於機動車輛的使用者介面之控制裝置、機動車輛,以及用於操作針對使用者介面的控制裝置之方法

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113806030A (zh) * 2020-07-24 2021-12-17 荣耀终端有限公司 应用的调度方法及电子设备

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2009102425A1 (en) * 2008-02-12 2009-08-20 Netapp, Inc. Hybrid media storage system architecture
CN102298506A (zh) * 2010-06-24 2011-12-28 国际商业机器公司 存储系统和用于实现存储系统的方法
CN103777905A (zh) * 2014-02-14 2014-05-07 华中科技大学 一种软件定义的固态盘融合存储方法
CN105224474A (zh) * 2014-06-03 2016-01-06 深圳市腾讯计算机系统有限公司 固态硬盘闪存转换层的实现系统和闪存转换层的实现装置
CN105511806A (zh) * 2015-11-30 2016-04-20 华为技术有限公司 处理写请求的方法和移动终端

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7640424B2 (en) * 2005-10-13 2009-12-29 Sandisk Corporation Initialization of flash storage via an embedded controller
US7640389B2 (en) * 2006-02-28 2009-12-29 Freescale Semiconductor, Inc. Non-volatile memory having a multiple block erase mode and method therefor
CN101398824A (zh) * 2007-09-26 2009-04-01 新奥特硅谷视频技术有限责任公司 利用虚拟文件系统技术实现数据处理后存储的方法
US10175885B2 (en) * 2015-01-19 2019-01-08 Toshiba Memory Corporation Memory device managing data in accordance with command and non-transitory computer readable recording medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2009102425A1 (en) * 2008-02-12 2009-08-20 Netapp, Inc. Hybrid media storage system architecture
CN102298506A (zh) * 2010-06-24 2011-12-28 国际商业机器公司 存储系统和用于实现存储系统的方法
CN103777905A (zh) * 2014-02-14 2014-05-07 华中科技大学 一种软件定义的固态盘融合存储方法
CN105224474A (zh) * 2014-06-03 2016-01-06 深圳市腾讯计算机系统有限公司 固态硬盘闪存转换层的实现系统和闪存转换层的实现装置
CN105511806A (zh) * 2015-11-30 2016-04-20 华为技术有限公司 处理写请求的方法和移动终端

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110703999A (zh) * 2019-09-30 2020-01-17 盛科网络(苏州)有限公司 存储器的读操作的调度方法和存储器
TWI816106B (zh) * 2020-04-22 2023-09-21 德商奧迪股份有限公司 用於機動車輛的使用者介面之控制裝置、機動車輛,以及用於操作針對使用者介面的控制裝置之方法
CN116028327A (zh) * 2023-02-20 2023-04-28 成都佰维存储科技有限公司 文件系统读写性能测试方法、装置、可读存储介质及设备

Also Published As

Publication number Publication date
CN109690465A (zh) 2019-04-26
CN109690465B (zh) 2020-10-09

Similar Documents

Publication Publication Date Title
KR20200064499A (ko) 메모리 시스템 및 메모리 시스템의 동작방법
US9128618B2 (en) Non-volatile memory controller processing new request before completing current operation, system including same, and method
US8984219B2 (en) Data storage device and method of writing data in the same
KR101543431B1 (ko) 불휘발성 메모리 시스템 및 그것의 액세스 방법
TW201945934A (zh) 用以在記憶裝置中進行存取管理的方法、相關記憶裝置及其控制器以及相關電子裝置
US10599345B2 (en) Memory device that writes data into a block based on time passage since erasure of data from the block
CN110928807B (zh) 用于检查存储器系统中的有效数据的设备和方法
CN110806984B (zh) 在存储器系统中搜索有效数据的设备和方法
CN111554340B (zh) 存取管理的方法、记忆装置、控制器、主装置和电子装置
WO2011047563A1 (zh) 非易失性存储器数据的读写控制方法及系统、存储设备
WO2018103010A1 (zh) 一种存储设备管理方法及用户终端
CN107590080B (zh) 映射表更新方法、存储器控制电路单元及存储器存储装置
KR20200031852A (ko) 메모리 시스템 내 펌웨어를 유지하는 방법 및 장치
CN114442914B (zh) 存储器系统
CN110968522B (zh) 存储器系统及其操作方法、包括存储器系统的数据库系统
CN110309077B (zh) 主机与设备协同工作的闪存转换层构建方法及装置
KR102595233B1 (ko) 데이터 처리 시스템 및 그것의 동작 방법
JP4745465B1 (ja) 半導体記憶装置及び半導体記憶装置の制御方法
CN110781023A (zh) 用于在存储器系统中处理数据的设备和方法
KR20210046377A (ko) 마이그레이션 동작을 위한 메모리 시스템 및 메모리 시스템의 동작방법
CN112306898A (zh) 存储设备、其操作方法及包括其的电子设备
CN110312986B (zh) 用于在固态设备上存储数据的流的机会性使用
CN113885808A (zh) 映射信息记录方法以及存储器控制电路单元与存储装置
KR20200087487A (ko) 메모리 시스템에서의 유효 데이터 체크 방법 및 장치
TW202318201A (zh) 藉助於預定命令來進行記憶體裝置的資料存取控制的方法及設備

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16923422

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16923422

Country of ref document: EP

Kind code of ref document: A1