WO2025257616A1 - 数据读取与存储方法、设备、系统、存储介质及程序产品 - Google Patents
数据读取与存储方法、设备、系统、存储介质及程序产品Info
- Publication number
- WO2025257616A1 WO2025257616A1 PCT/IB2025/051392 IB2025051392W WO2025257616A1 WO 2025257616 A1 WO2025257616 A1 WO 2025257616A1 IB 2025051392 W IB2025051392 W IB 2025051392W WO 2025257616 A1 WO2025257616 A1 WO 2025257616A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- storage
- data
- block
- flash memory
- state
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input 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/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
-
- G—PHYSICS
- G11—INFORMATION STORAGE
- G11C—STATIC STORES
- G11C16/00—Erasable programmable read-only memories
- G11C16/02—Erasable programmable read-only memories electrically programmable
- G11C16/06—Auxiliary circuits, e.g. for writing into memory
- G11C16/10—Programming or data input circuits
Definitions
- Flash memory is a non-volatile storage medium. Depending on the connection method of the storage cells, flash memory is divided into various types (e.g., NOR Flash and NAND Flash).
- NAND Flash has smaller storage cells, is suitable for high-density integration, and can provide larger storage capacity, therefore it is widely used.
- NAND Flash faces the problem of read interference. From a hardware perspective, read interference manifests as follows: when reading a memory page (also called a memory cell) within the same erase block in NAND Flash, the read voltage causes changes in the storage voltage of other memory pages within the same erase block. Furthermore, as the number of reads increases, the impact on other memory pages accumulates, ultimately leading to an increase in the data error rate of that erase block.
- Erase blocks as data erasure units in NAND Flash, typically contain multiple storage pages. When only a portion of the storage pages within an Erase block have been written to, it is said to be in a partially programmed state. For Erase blocks in a partially programmed state, read interference issues are more pronounced due to their metastable state.
- Some existing solutions involve maintaining a cache within the NAND Flash-based storage medium, such as a Solid State Disk (SSD), for Erase blocks in a partially programmed state. When data needs to be read from an Erase block in this state, it is read directly from the cache, bypassing the read operation on the partially programmed Erase block itself, thus resolving the read interference problem.
- SSD Solid State Disk
- the present invention discloses several methods, devices, systems, storage media, and program products for data reading and storage, aiming to solve the read interference problem caused by the Erase Block within an SSD, which is in a partially programmed state, thereby eliminating interference with the cache space on the SSD. The interdependence between them makes the solution easy to implement.
- This disclosure provides a flash memory storage system, including: a storage engine, a memory storage unit, and a flash memory.
- a temporary cache is provided in the memory storage unit for caching data in at least partially partially programmed storage blocks in the flash memory.
- the storage engine is configured to respond to read requests by reading the data to be read from the temporary cache if the temporary cache contains the data to be read; and by reading the data to be read from a first storage block in the flash memory if the temporary cache does not contain the data to be read, wherein the first storage block is a storage block in the flash memory that is in a partially programmed or fully programmed state.
- This disclosure also provides a data reading method applied to a storage engine.
- the storage engine's memory includes a temporary cache for caching data in storage blocks of flash memory that are at least partially in a locally programmed state.
- the method includes: responding to a read request and querying whether the temporary cache contains data to be read; if the temporary cache contains data to be read, reading the data to be read from the temporary cache; if the temporary cache does not contain the data to be read, reading the data to be read from a first storage block of the flash memory, wherein the first storage block is a storage block of the flash memory that is in a locally programmed state or a fully programmed state.
- This disclosure also provides a data storage method applied to a storage engine.
- the storage engine's memory includes a temporary cache for caching data in storage blocks of flash memory that are at least partially in a locally programmed state.
- the method includes: responding to a write request and writing data to be stored into a second storage block of the flash memory that is in a locally programmed state or an idle state; writing the data to be stored into the temporary cache to cache data in the second storage block, wherein the second storage block belongs to a target storage block.
- This disclosure also provides an electronic device, including: a memory and a processor; the memory is used to store a computer program, and the processor is coupled to the memory and used to execute the computer program to implement the steps in the methods described above.
- This disclosure also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, causes the processor to implement the steps in the methods described above.
- This disclosure also provides a computer program product including a computer program/instructions, which, when executed by a processor, causes the processor to implement the steps in the method embodiments described above.
- This disclosure also provides a computer program product including a non-volatile computer-readable storage medium for storing a computer program, which, when executed by a processor, implements the steps in the method embodiments described above.
- a temporary cache is introduced in the memory storage of the storage engine to cache data in at least part of the storage blocks in the flash memory that are in a locally programmed state. This allows data to be read directly from the temporary cache when reading data from these locally programmed blocks, avoiding direct reading from the locally programmed blocks within the flash memory. This solves the read interference problem associated with locally programmed blocks within the flash memory.
- the memory storage in the flash storage system can be configured with abundant memory resources to cache data from locally programmed blocks, thus eliminating reliance on cache space on the flash memory itself, making it more flexible and convenient, and enabling practical implementation.
- the accompanying drawings which are included to provide a further understanding of this disclosure and constitute a part of this disclosure, illustrate exemplary embodiments of the present disclosure and are used to explain the disclosure, but do not constitute an undue limitation of the disclosure.
- Figure 1 is a schematic diagram of the structure of a flash memory storage system provided in an exemplary embodiment of this disclosure
- Figure 2 is a schematic diagram of the state changes of a storage block provided in an exemplary embodiment of this disclosure
- Figure 3 is a schematic diagram of the structure of a flash memory storage system using a ZNS interface provided in an exemplary embodiment of this disclosure
- Figure 4 is a schematic diagram of the structure of another flash memory storage system using a ZNS interface provided in an exemplary embodiment of this disclosure
- Figure 5 is a schematic diagram of the process of evicting data in a temporary buffer area based on the programming state change information of a storage block provided in an exemplary embodiment of this disclosure
- Figure 6 is a schematic diagram of a data flow aggregation model provided in an exemplary embodiment of this disclosure
- Figure 7 is a schematic diagram of the structure of a storage block and virtual buffer block misalignment phenomenon provided in an exemplary embodiment of this disclosure
- Figure 8 is a flowchart of a data reading method provided in an exemplary embodiment of this disclosure
- this embodiment introduces a temporary cache in the memory storage of the storage engine. This cache caches data from at least partially programmed blocks in the flash memory, allowing data to be read directly from the temporary cache when accessing these partially programmed blocks. This avoids reading directly from the partially programmed blocks within the flash memory, thus resolving the read interference problem.
- FIG. 1 is a schematic diagram of the structure of a flash memory storage system provided by an exemplary embodiment of this disclosure.
- the flash memory storage system 100 includes: a storage engine 101, a memory storage 102, and a flash memory 103.
- a temporary cache area 102L is provided in the memory storage 102 to cache data in storage blocks in the flash memory 103 that are at least partially in a locally programmed state.
- the storage engine 101 refers to a software program in the flash memory storage system suitable for various data processing (such as storage, reading, deletion, updating, etc.), which can run on a host.
- the host where the storage engine 101 is located can be a computer, terminal device, server, or workstation, etc., and there is no limitation thereto.
- the storage engine 101 has a memory storage 102 and a flash memory 103.
- the memory storage 102 and the flash memory 103 cooperate with each other to provide a basis for the storage engine 101 to perform data storage and access.
- the main memory 102 also known as RAM or main memory, is used to store programs and data temporarily needed during computer operation.
- the Central Processing Unit can be a semiconductor memory, such as Dynamic Random-access Memory (DRAM) or Static Random-access Memory (SRAM), etc., without limitation.
- the main memory 102 has the characteristics of smaller storage capacity, faster access speed, and volatile storage when power is off.
- the flash memory 103 mainly refers to memory implemented based on NAND Flash, such as SSDs and flash drives (USB flash drives), used to store programs and data temporarily not used during CPU operation.
- main memory it has the characteristics of larger storage capacity, slower access speed, and non-volatile storage when power is off, making it suitable for persistent storage of various data.
- the flash memory 103 includes at least a storage controller 1031 and a flash memory medium 1032.
- the storage controller 1031 mainly plays a control role and is used to run the firmware program of the flash memory 103 to perform related data reading, writing and erasing operations on the storage cells on the flash memory medium 1032.
- the storage cells are the basic components of the flash memory medium 1032.
- the storage cell types of NAND Flash include single-level cells (SLC), multi-level cells (MLC), trinary-level cells (TLC), and quad-level cells (QLC).
- the flash memory 103 interconnects with the storage engine 101 or the host where the storage engine 101 resides using the Non-Volatile Memory Express (NVMe) interface specification.
- NVMe Non-Volatile Memory Express
- NVMe also known as the Non-Volatile Memory Host Controller Interface Specification (NVMHCIS)
- PCIe Peripheral Component Interconnect Express
- the NVMe interface specification is the basic interface specification for the interconnection between the flash memory 103 and the host. Based on the NVMe interface specification, the flash memory 103 can employ different storage management technologies, such as block device management technology or zoned namespaces (ZNS) management technology.
- ZNS zoned namespaces
- block device management technology is a technology that performs data transmission and storage operations in units of fixed-size data blocks;
- ZNS management technology is a management technology that divides the storage space into multiple continuous, non-overlapping logical regions (Zones) and requires data to be written sequentially within and between Zones.
- the flash memory 103 can employ block device management technology.
- the interconnection interface between the flash memory 103 and the host can be called the block device interface (or simply block interface). This block interface supports random access to data at any location on the block device, without requiring sequential reading like a character device.
- the flash memory 103 can be abstracted as a contiguous logical block address (LBA) space.
- LBA logical block address
- Flash memory By organizing data into fixed-size logical blocks, such as 512 bytes or 4 kilobytes (KB), as the basic unit for read and write operations, data is stored in fixed-size logical blocks, supporting random read/write and in-place updates. In-place updates mean that data can be overwritten and written to any location.
- the flash memory is abstracted as contiguous logical blocks, the characteristics of the underlying storage medium (such as NAND Flash) can be hidden from software programs such as the storage engine and operating system. During read and write operations, only the block interface needs to be interacted with, without needing to consider the characteristics of the underlying storage medium. Flash memory using a block interface allows random access and overwrite to any location, offering high flexibility.
- flash memory 103 can employ ZNS management technology.
- the interconnection interface between flash memory 103 and the host can be called the ZNS interface.
- ZNS introduces the concept of "zones" based on NVMe, abstracting the address space of the flash memory into a series of contiguous logical partitions. Data within each zone is written sequentially, preventing random or overwrite writes. To update data, the entire partition must be reset before writing again.
- This sequential writing method reduces write amplification, improving the performance and lifespan of the flash memory. Furthermore, ZNS simplifies the internal design and implementation of flash memory. Data layout on the flash memory area is implemented by the storage engine. Through the collaborative work between the storage engine and the flash memory, the overall write amplification factor of the flash memory is reduced, thereby fully utilizing the characteristics of the underlying storage medium.
- the basic unit for data reading and writing in the flash memory medium 1032 is called a storage block.
- a storage block is the smallest unit for data erasure in the flash memory, and a storage block may include one or more storage pages. The concept of a storage block may differ depending on the storage management technology used in the flash memory.
- a partition in the flash memory can be implemented as a storage block.
- a logical block in the flash memory can be implemented as a storage block.
- a partition in the flash memory is also called a flash memory area.
- the storage blocks in the flash memory can have the following states: Open, Seal, Offline, Garbage Collection, Erase, and Free. For ease of management, these states can be simplified to three states: Free, Open, and Closed.
- Figure 2 is a schematic diagram of the state changes of a storage block provided in an exemplary embodiment of this disclosure.
- a storage block in the Free state refers to a storage block that has not been allocated any data.
- a storage block in the Free state needs to be opened before writing to change from the Free state to the Open state.
- When a storage block is in the Open state it can accept write operations, i.e., it is in a writable state. In the writable state, it can also accept read operations; therefore, the writable state can also be called a read-write state.
- When a storage block is in the Closed state it can accept read operations but no longer accepts write operations, i.e., it is in a read-only state. Read state.
- the read/write state of a storage block can also be referred to as its programming state, which includes partial programming (i.e., writable state) and full programming (i.e., read-only state).
- the storage block When some pages in a storage block have been written with data, the storage block is said to be in a partial programming state; when all pages in a storage block have been written with data, the storage block is said to be in a full programming state.
- partial programming state i.e., writable state
- full programming i.e., read-only state
- a temporary buffer 102L is introduced in the memory memory 102 to cache data in at least partially partially programmed storage blocks in the flash memory 103. Since the temporary buffer 1021 stores data from storage blocks in a partially programmed state, when reading data from these storage blocks, the data can first be read from the temporary buffer 1021. If the data is successfully read from the temporary buffer 1021, reading from the partially programmed storage blocks in the flash memory 103 can be avoided, thus solving the read interference problem associated with storage blocks in a partially programmed state within the flash memory 103. Furthermore, if the data cannot be successfully read from the temporary buffer 1021, reading from the flash memory 103 can then guarantee successful data reading.
- the temporary buffer 102L is used to cache data from at least partially partially programmed storage blocks in the flash memory 103.
- the term "at least partially in a locally programmed state" can refer to a portion or all of the locally programmed storage blocks in the flash memory 103.
- it can include locally programmed storage blocks used to store specific data, or the first N storage blocks to be in a locally programmed state, where N is a positive integer, etc.
- it can include any one of the identified locally programmed storage blocks.
- the programming state of the storage blocks changes dynamically. Therefore, when implemented as entirely locally programmed storage blocks, the specific implementation depends on the identification of the storage block's programming state.
- the temporary cache 1021 can also temporarily store data from storage blocks that have transitioned from a partially programmed state to a fully programmed state, until the data in the fully programmed storage block is deleted. In this embodiment, the data stored in the temporary cache 1021 is written under the control of the storage engine 101.
- the storage engine 101 writes the data to be stored to a second storage block in the flash memory 103 that is in a partially programmed or idle state (as shown in 7 in Figure 1), and simultaneously writes the data to be stored to the temporary cache to cache the data in the second storage block (as shown in 5 in Figure 1).
- the second storage block is the target storage block for writing the data to be stored, and the data to be stored is referred to as the second data. In this way, when reading the second data, it can first be read from the temporary cache 1021, and if the read fails, it can then be read from the second storage block in the flash memory 103, which can reduce the read interference problem faced by the second storage block.
- FIG. 1021 and flash memory 103 can be written simultaneously, or temporary buffer 1021 can be written first and then flash memory. 103, or the data can be written to the flash memory 103 first and then to the temporary buffer 1021.
- the write request originates from the user end of the flash memory system, which can be various applications, systems, or functional modules.
- the method of writing the second data to the flash memory differs depending on the interface used.
- Figure 3 is a schematic diagram of a flash memory system using a ZNS interface provided in an exemplary embodiment of this disclosure.
- Figure 3 when the flash memory uses a ZNS interface, the storage engine selects a flash memory area in a partially programmed or idle state from multiple flash memory areas provided by the flash memory (as shown in Figure 3, partitions A-T).
- Figure 3 shows an example of partition B as the second storage block.
- the partition identifier of the second storage block and the data to be stored are sent to the storage controller in the memory (as shown in Figure 3, 7) so that the storage controller writes the data to be stored into the second storage block (as shown in Figure 3, 8).
- Each storage block has a unique identifier used to indicate to the storage controller that the data is written to the correct location.
- Figure 4 is a schematic diagram of another flash memory storage system using a ZNS interface provided by an exemplary embodiment of this disclosure.
- the storage engine sends the data to be stored to the storage controller in the flash memory (as shown in 8 in Figure 4), so that the storage controller selects an erase block in a partially programmed state or an idle state from a plurality of erase blocks provided by the flash memory (logical blocks a-t in Figure 4) as the second storage block (as shown in 9 in Figure 4).
- Figure 4 shows an example of using logical block b as the second storage block, and writes the data to be stored into the second storage block (as shown in 10 in Figure 4).
- the flash memory uses a ZNS interface
- the flash area in a partially programmed state or an idle state is selected from a plurality of flash areas provided by the flash memory as the second storage block.
- the embodiments of this disclosure do not limit the selection method.
- the storage engine can manage and maintain the state of any flash area in the flash memory.
- when the storage engine selects a flash region as the second storage block from among multiple flash regions provided by the flash memory it may include the following implementation methods: Case 1: If there is no flash region in a partially programmed state on the flash memory, select a flash region from the free flash regions as the second storage block; or if there is no free flash region on the flash memory, create a free flash region as the second storage block.
- a garbage collection (GC) mechanism can be used to reclaim and reorganize storage space to create a free flash region as the second storage block.
- GC garbage collection
- Case 2 If there is a flash region in a partially programmed state on the flash memory, and the available storage space of the currently partially programmed flash region is greater than or equal to the storage space required for the data to be stored, then the currently partially programmed flash region is used as the second storage block.
- Scenario 3 If a partially programmed flash memory area exists in the flash memory, and the available storage space of this area is less than the storage space required for the second data, the partially programmed flash memory area will be used as the second storage block. If the partially programmed flash memory area is full, the next flash memory area will be selected as the new second storage block.
- the storage engine's data reading process includes: responding to a read request, first checking if the temporary buffer contains the data to be read; if the temporary buffer contains the data to be read, reading the data from the temporary buffer; if the temporary buffer does not contain the data to be read, reading the data from the first storage block in the flash memory.
- the first storage block is a storage block in the flash memory that is either partially programmed or fully programmed.
- the read request originates from the user end of the flash memory system, which can be various applications, systems, or functional modules.
- the read request may include an identifier of the data to be read. The method of reading data from the flash memory varies depending on the interface of the flash memory.
- the identity document (ID) can be implemented as logical block address information.
- This logical block address information is passed to the storage engine so that the storage engine can query the data to be read based on the logical block address information.
- the storage engine will first query the temporary cache (as shown in 1 in Figure 3). If a match is found, the data is read and returned directly (as shown in 2 in Figure 3). If a match is not found, the storage engine sends the partition identifier corresponding to the data to be read, obtained from the logical block address information, to the storage controller (as shown in 3 in Figure 3).
- the storage controller then reads the data from partition A in the flash memory based on this partition identifier (as shown in 4 in Figure 3) and returns the result (as shown in 5 in Figure 3).
- Figure 3 uses reading from partition A as an example.
- the logical block address information is passed to the storage engine so that the storage engine can query the data to be read from the temporary cache based on the logical block address information (as shown in 1 in Figure 4); if a match is found, the data is read and returned directly (as shown in 2 in Figure 4); if a match is not found, the logical block address information is passed to the storage controller (as shown in 3 in Figure 4), and the storage controller determines the corresponding logical block based on the logical block address information (as shown in 4 in Figure 4), and then reads the data from logical block a in the flash memory (as shown in 5 in Figure 4) and returns it (as shown in 6 in Figure 4).
- Figure 4 uses reading from logical block a as an example.
- a temporary cache in the memory memory to cache the data in the storage blocks in the flash memory that are at least partially in a locally programmed state
- the read interference problem of storage blocks in a locally programmed state inside the flash memory is solved.
- the main memory 102 can be configured with abundant memory resources to cache data of storage blocks in a partially programmed state, thereby solving the problem of limited cache space on the flash memory 103.
- the main memory in the flash memory storage system can be configured with abundant memory resources to solve the problem of limited cache space on the flash memory, memory resources are still limited.
- the storage engine is further configured to: perform data eviction processing on the data in the temporary cache area based on the programming state change information of at least some storage blocks in a partially programmed state to release cache space.
- Figure 5 is a schematic diagram illustrating the process of evicting data in a temporary cache based on the programming state change information of storage blocks, according to an exemplary embodiment of this disclosure.
- the storage engine when evicting data in a temporary cache based on the programming state change information of storage blocks, the storage engine is used to: for any storage block that caches data in the temporary cache, when any storage block changes from a partially programmed state (writable state) to a fully programmed state (read-only state), delete the data cached in that storage block in the temporary cache.
- the data eviction management in the temporary cache depends on the programming state of the storage blocks, requiring maintenance and management of the programming state of the storage blocks.
- the data corresponding to the storage blocks in the flash memory that are in a fully programmed state is evicted.
- the temporary cache may store data corresponding to multiple storage blocks; therefore, when evicting any storage block, it is also necessary to accurately determine the boundary of the data corresponding to that storage block in the temporary cache.
- the storage engine creates a virtual cache block adapted to any storage block.
- the virtual cache block can be created before data is stored in any storage block, or when data is first stored in any storage block.
- the data information cached by any storage block in the temporary cache area is recorded in the virtual cache block, and the programming state of any storage block is maintained through the read/write state of the virtual cache block.
- the writable state and read-only state of the virtual cache block correspond to the partial programming state and fully programming state of the any storage block, respectively.
- the data information can be data identification information, the data storage location in the temporary cache area, etc., used to identify which data needs to be deleted during data deletion.
- the read/write states of any storage block and its corresponding virtual cache block, as well as the data stored in any storage block and its corresponding virtual cache block correspond.
- the programming state of any storage block and its data boundaries in the temporary cache area can be determined from the virtual cache block. Furthermore, when a storage block is detected to change from a partially programmed state to a fully programmed state, it is only necessary to delete the data cached in the virtual cache block that corresponds to the storage block in the temporary cache area.
- the virtual cache block is a logical resource designed as a data structure.
- the data structure can be an array, list, or binary tree, etc., used to organize and store data.
- the virtual cache block is an abstract concept, not a specific physical storage unit, but rather an abstraction of any storage block in the flash memory within the temporary cache area.
- the temporary cache area can also be divided into physical cache blocks of the same size according to the size of the storage block, with the data in each storage block cached in one physical cache block.
- each physical cache block corresponds to a virtual cache block, used to record the correspondence between the cached data in that physical cache block and the storage blocks.
- the virtual cache block and the storage block have a correspondence; this can be one virtual cache block to one storage block, one virtual cache block to multiple storage blocks, or multiple virtual cache blocks to one storage block—there are no restrictions.
- the correspondence between physical cache blocks and virtual cache blocks is the same as the correspondence between virtual cache blocks and storage blocks—it can be one-to-one, one-to-many, or many-to-one—there are no restrictions.
- the interconnect interface between the flash memory and the host can be divided into a block interface and a ZNS interface. Under different interface implementations, the storage engine's ability to perceive the programming state of the storage blocks differs.
- a flash memory uses the ZNS interface, there is a mapping relationship between logical block addresses and partitions. This mapping divides the logical block address space into multiple partitions, each corresponding to a continuous range of logical block addresses.
- a flash memory using the ZNS interface completely exposes the underlying storage medium to the storage engine, which directly reads and writes to the underlying storage medium (i.e., the flash memory itself).
- the storage engine can perceive the state of the storage blocks within the underlying storage medium.
- the characteristics of the underlying storage medium are hidden from the storage engine. During read and write operations, it interacts directly with the block interface, and the storage engine cannot perceive the characteristics of the underlying storage medium. Therefore, the storage engine cannot directly obtain the programming state of the storage blocks in the flash memory using the block interface.
- the state of the storage blocks is transparent to the storage engine, and the storage engine's detection of changes in the state of the storage blocks is direct and effective. Therefore, when the flash memory uses a ZNS interface, the storage engine can create a virtual buffer block adapted to the storage block each time an idle storage block in the flash memory is enabled during the process of storing data into the flash memory. Each time a new storage block is enabled, the enabled storage block will enter a partially programmable state from the idle state. Furthermore, when writing data to each storage block that has entered the partially programmable state, the data in each storage block that has entered the partially programmable state can be cached in the temporary buffer.
- the storage engine can sense the state of storage blocks in the underlying storage medium and create a virtual cache block adapted to the new storage block in the temporary cache area each time a new storage block is enabled, it can achieve a correspondence between the programming state of the storage block and the read/write state of the virtual cache block, as well as alignment between the boundaries of the storage block and the boundaries of the virtual cache block.
- the programming state of the storage block can be mapped to the read/write state of the virtual cache block, and can also be directly mapped to the virtual cache block corresponding to the storage block.
- cross-block writes can be avoided.
- the corresponding virtual cache blocks can be marked in the temporary cache area to complete the mapping from the programming state of the storage block to the read/write state of the virtual cache block. Therefore, when the storage engine maintains the programming state of any storage block through the read/write status of virtual cache blocks, if an enabled storage block is in a partially programmed state, the virtual cache block corresponding to that storage block is marked as writable. As the second data is continuously written, the programming state of the storage block changes. When the storage block is full, it means that the storage block has moved from a partially programmed state to a fully programmed state.
- the virtual cache block corresponding to that storage block is marked as read-only. This completes the mapping from the programming state of the storage block to the read/write state of the virtual cache block.
- the programming state of the storage block is mapped to the read/write state of the virtual cache block.
- the storage engine can obtain the programming state of the storage block corresponding to the storage block by detecting the read/write state of the virtual cache block.
- the storage engine monitors the read/write state of any virtual cache block. If any virtual cache block is in a read-only state, based on the data information recorded in any virtual cache block, it deletes the data cached in the temporary cache area from the storage block corresponding to that virtual cache block, thus achieving data eviction management in the temporary cache area.
- Scenario 2 When the flash memory uses a block interface, the implementation of data eviction management from the temporary buffer is as follows: As mentioned above, when the flash memory uses a block interface, the characteristics of the underlying storage medium are hidden from the storage engine. The storage engine cannot directly obtain the programming state of the storage blocks in the flash memory with a block interface. That is, the programming state of the storage blocks in a flash memory with a block interface is opaque to the storage engine and is in a black box state. In this embodiment, for a flash memory with a block interface, when data is written to the flash memory, it is first written to the write buffer of the flash memory memory. The data is aggregated in the write buffer.
- FIG. 6 is a schematic diagram of a data flow aggregation model provided by an exemplary embodiment of this disclosure. As shown in Figure 6, this embodiment of the disclosure proposes a data flow aggregation model to describe the data writing process of a storage block in a flash memory.
- This fixed threshold can be a value related to the capacity of the storage block, referred to as the target threshold.
- This target threshold can be the maximum amount of data that the storage block can store, or a capacity value determined based on the maximum data amount.
- this disclosure also provides a data flow-based virtual cache block and state detection mechanism.
- a virtual cache block is created in the temporary buffer. This virtual cache block is marked as writable upon creation. Whenever the amount of data in the temporary buffer reaches a target threshold, it indicates that a memory block in the flash memory is full, and the virtual cache block is marked as read-only.
- the programming state of a memory block is mapped to the read/write state of the virtual cache block in the temporary buffer.
- the programming state of a memory block can be determined based on the read/write state of the virtual cache block, achieving the purpose of detecting the programming state of the memory block.
- data in read-only memory blocks can be evicted from the temporary buffer.
- the following section uses a block interface implementation as an example to introduce the details of the data flow-based virtual cache block and its state detection mechanism, as well as the management of data eviction from the temporary buffer.
- the write process can only be simulated based on the data flow aggregation model described above.
- the storage block is considered full.
- data corresponding to storage blocks in read-only state can be evicted from the temporary cache.
- simulating storage block writes using a data flow aggregation model to detect the storage block status the storage blocks are opaque to the storage engine; the true usage status of the storage blocks is not visible.
- Data may be written starting from the middle of a storage block, potentially leading to misalignment. This discussion uses the example of writing data starting from the middle of a storage block...
- this disclosure provides a delayed eviction strategy.
- the storage engine monitors the read/write status of N consecutive virtual cache blocks. When all N consecutive virtual cache blocks are in read-only state, the data in the storage block corresponding to the earliest virtual cache block cached in the temporary cache is deleted based on the data information recorded in the earliest virtual cache block among the N consecutive virtual cache blocks.
- the storage engine is responsible for counting the number of reads and moving the data; in the block device interface implementation, the storage controller in the flash memory is responsible for counting the number of reads and moving the data.
- an idle storage block (hereinafter referred to as an idle storage block) needs to be selected from the storage blocks in the flash memory.
- the entity performing the selection operation differs depending on the interface implementation.
- the storage engine is responsible for selecting the idle storage block; in the block device interface implementation, the storage controller in the flash memory is responsible for selecting the idle storage block. This disclosure does not limit the method of selecting free storage blocks in its embodiments; examples are provided below.
- a list of free blocks can be maintained, recording information about currently available free storage blocks, including the starting address and length of the storage block, as well as the number of erase/write cycles.
- a free storage block can be selected from this list.
- the second data can be divided into cold data and hot data according to the access frequency of the second data. Based on the characteristics of cold and hot data, suitable free storage blocks are selected for storage.
- Hot data is stored in storage blocks with fewer erase/write cycles
- cold data is stored in storage blocks with more erase/write cycles to optimize storage performance and extend the lifespan of the flash memory.
- garbage collection can be triggered to reclaim the storage space occupied by invalid data and recycle and reuse the storage space by moving valid data, thus restoring some storage blocks to a free state.
- This disclosure does not limit the garbage collection strategy, such as the mark-sweep algorithm or generational collection algorithm.
- Figure 8 is a flowchart illustrating a data reading method provided in an exemplary embodiment of this disclosure. As shown in Figure 8, this disclosure also provides a data reading method applied to a storage engine.
- the storage engine's memory memory has a temporary cache area for caching data in storage blocks in the flash memory that are at least partially in a locally programmed state.
- the method includes:
- the temporary buffer does not contain the data to be read, read the data to be read from a first storage block in the flash memory, wherein the first storage block is a storage block in the flash memory that is in a partially programmed state or a fully programmed state.
- the above method further includes: responding to a write request, writing the data to be stored into a second storage block in the flash memory that is in a partially programmed state or an idle state; writing the data to be stored into a temporary buffer to cache the second storage block. The data in the block, wherein the second storage block belongs to the target storage block.
- responding to a write request and writing the data to be stored into the second storage block in the flash memory that is in a partially programmed state or an idle state includes: when the flash memory uses an interconnect interface ZNS interface, responding to the write request, selecting a flash area in a partially programmed state or an idle state from a plurality of flash areas provided by the flash memory as the second storage block; sending the identifier of the second storage block and the data to be stored to a storage controller in the memory, so that the storage controller writes the data to be stored into the second storage block; when the flash memory uses a block device interface, responding to the write request, sending the data to be stored to the storage controller in the flash memory, so that the storage controller selects an erase block in a partially programmed state or an idle state from a plurality of erase blocks provided by the flash memory as the second storage block and writes the data to be stored into the second storage block.
- the above method further includes: for any storage block that caches data in a temporary buffer, when any storage block enters a fully programmed state from a partially programmed state, deleting the data cached in any storage block in the temporary buffer.
- the method further includes: creating a virtual cache block adapted to any storage block; when data in any storage block is cached in a temporary cache area, recording the data information cached by any storage block in the temporary cache area in the virtual cache block, and maintaining the programming state of any storage block through the read/write state of the virtual cache block; wherein the writable state and read-only state of the virtual cache block correspond to the partial programming state and fully programming state of any storage block, respectively.
- creating a virtual cache block adapted to that storage block includes: when the flash memory uses a ZNS interface, during the process of storing data into the flash memory, using each enabled storage block in the flash memory that is in an idle state as any storage block and creating a virtual cache block adapted to that storage block, wherein the enabled storage block enters a partially programmable state from an idle state; when the flash memory uses a block device interface, during the process of storing data into the flash memory, when data is started to be cached in a temporary buffer, creating the first virtual cache block, and creating the next virtual cache block whenever the amount of data cached in the temporary buffer reaches a target threshold; wherein the amount of data cached in the temporary buffer reaching the target threshold is used to indicate that a storage block in the flash memory is full.
- deleting the data in any storage block cached in the temporary cache includes: When the flash memory uses a ZNS interface, monitoring the read/write status of any virtual cache block; when any virtual cache block is in a read-only state, deleting the data in the corresponding storage block of any virtual cache block cached in the temporary cache based on the data information recorded in the virtual cache block; when the flash memory uses a block device interface, monitoring the read/write status of N consecutive virtual cache blocks; when all N consecutive virtual cache blocks are in a read-only state, deleting the data in the earliest virtual cache block among the N consecutive virtual cache blocks based on the data recorded in the earliest virtual cache block among the N consecutive virtual cache blocks.
- the information is used to delete the data in the storage block corresponding to the earliest virtual cache block cached in the temporary cache area, where N is a natural number greater than or equal to 2.
- the above method further includes: when the flash memory uses a ZNS interface, counting the number of reads of the storage block in the fully programmed state; when the number of reads reaches a set threshold, moving the data in the storage block in the fully programmed state to another storage block in the flash memory that is in an idle state.
- Figure 9 is a flowchart illustrating another data reading method provided by an exemplary embodiment of the present disclosure. As shown in Figure 9, a data storage method provided by an embodiment of the present disclosure is applied to a storage engine. The memory storage of the storage engine is provided with a temporary cache area for caching data in at least part of the storage blocks in the flash memory that are in a partially programmed state. The method includes:
- S901 Responding to a write request, write the data to be stored into the second memory block in the flash memory that is in a partially programmed or idle state;
- writing the data to be stored into a second storage block in the flash memory that is in a partially programmed state or an idle state includes: when the flash memory uses an interconnect interface ZNS interface, selecting a flash area in a partially programmed state or an idle state from a plurality of flash areas provided by the flash memory as the second storage block; sending the identifier of the second storage block and the data to be stored to a storage controller in the memory, so that the storage controller writes the data to be stored into the second storage block; when the flash memory uses a block device interface, sending the data to be stored to a storage controller in the flash memory, so that the storage controller selects an erase block in a partially programmed state or an idle state from a plurality of erase blocks provided by the flash memory as the second storage block and writes the data to be stored into the second storage block.
- each step in the method of this embodiment can be the same device, or the method can be executed by different devices.
- the execution subject of steps 801 to 803 can be device A; or the execution subject of steps 801 and 802 can be device A, and the execution subject of step 803 can be device B; and so on.
- some processes described in the above embodiments and accompanying drawings include multiple operations appearing in a specific order. However, it should be clearly understood that these operations may not be executed in the order they appear in this document, or may be executed in parallel.
- FIG. 10 is a schematic diagram of an electronic device provided in an exemplary embodiment of this disclosure. As shown in Figure 8, the electronic device includes: a memory 104 and a processor 105.
- the memory 104 is used to store computer programs and can be configured to store various other data to support operation on a computing platform.
- the memory 104 can store contact data, phonebook data, messages, pictures, videos, etc. It can be implemented using any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
- SRAM static random access memory
- EEPROM electrically erasable programmable read-only memory
- EPROM erasable programmable read-only memory
- PROM programmable read-only memory
- ROM read-only memory
- a processor 105 coupled to the memory 104, is configured to execute a computer program in the memory 104 to: respond to a read request and query whether the temporary buffer contains data to be read; if the temporary buffer contains data to be read, read the data to be read from the temporary buffer; if the temporary buffer does not contain the data to be read, read the data to be read from a first storage block in the flash memory, wherein the first storage block is a storage block in the flash memory in a partially programmed state or a fully programmed state.
- the processor 105 is further configured to: respond to a write request by writing data to be stored into a second storage block in the flash memory that is in the locally programmed state or the idle state; and write the data to be stored into the temporary cache area to cache the data in the second storage block, wherein the second storage block belongs to the target storage block.
- the processor 105 when the processor 105 responds to a write request and writes the data to be stored into a second storage block in the flash memory that is in the partially programmed state or the idle state, it specifically performs the following: If the flash memory uses a ZNS interface, in response to the write request, selects a flash area in the partially programmed state or the idle state from a plurality of flash areas provided by the flash memory as the second storage block; sends the identifier of the second storage block and the data to be stored to a storage controller in the memory, so that the storage controller writes the data to be stored into the second storage block; if the flash memory uses a block device interface, in response to the write request, sends the data to be stored to a storage controller in the flash memory, so that the storage controller selects an erase block in the partially programmed state or the idle state from a plurality of erase blocks provided by the flash memory as the second storage block and writes the data to be stored into the second storage block.
- the flash memory uses a ZNS interface, in response to the write request
- the processor 105 is further configured to: for any storage block that caches data in the temporary cache area, when the storage block enters the fully programmed state from the partial programming state, delete the data cached in the storage block in the temporary cache area.
- the processor 105 is further configured to: for any storage block, create a virtual cache block adapted to the storage block; when the data in the storage block is cached in the temporary cache area, record the data information cached in the temporary cache area by the storage block in the virtual cache block, and maintain the programming state of the storage block through the read/write state of the virtual cache block; wherein, the writable state and read-only state of the virtual cache block correspond to the partial programming state and the fully programmed state of the storage block, respectively.
- the processor 105 when the processor 105 creates a virtual cache block adapted to the storage block for any storage block, it is specifically configured to: when the flash memory uses a ZNS interface, when sending data to the flash memory... During the data storage process in the flash memory, each time an idle storage block in the flash memory is enabled, it is used as any one of the storage blocks, and a virtual cache block adapted to the any one of the storage blocks is created. The enabled storage block enters a partially programmable state from the idle state.
- the flash memory uses a block device interface, during the data storage process, when data is started being cached in the temporary cache area, the first virtual cache block is created. Whenever the amount of data cached in the temporary cache area reaches a target threshold, the next virtual cache block is created.
- the amount of data cached in the temporary cache area reaching the target threshold indicates that a storage block in the flash memory is full.
- the processor 105 when the processor 105 maintains the programming state of any storage block through the read/write state of the virtual cache block, it specifically performs the following: when the flash memory uses a ZNS interface, when the enabled storage block is in the partial programming state, it marks the virtual cache block as writable; when the enabled storage block moves from the partial programming state to the fully programmed state, it marks the virtual cache block as read-only; when the flash memory uses the block device interface, for any virtual cache block, it marks the any virtual cache block as writable upon creation, and marks the any virtual cache block as read-only when the amount of data cached in the temporary cache area reaches the target threshold.
- the processor 105 when the processor 105 deletes data cached in the temporary cache area from any memory block when the memory block enters the fully programmed state from the partial programming state, it is specifically configured to: when the flash memory uses a ZNS interface, monitor the read/write status of any virtual cache block; when the virtual cache block is in the read-only state, delete the data cached in the temporary cache area from the corresponding memory block of the virtual cache block according to the data information recorded in the virtual cache block; when the flash memory uses the block device interface, monitor the read/write status of N consecutive virtual cache blocks; when the N consecutive virtual cache blocks are all in the read-only state, delete the data cached in the temporary cache area from the corresponding memory block of the earliest virtual cache block according to the data information recorded in the earliest virtual cache block among the N consecutive virtual cache blocks, where N is a natural number greater than or equal to 2.
- the processor 105 is further configured to: count the number of reads of the storage block in the fully programmed state when the flash memory uses a ZNS interface; and when the number of reads reaches a set threshold, move the data in the storage block in the fully programmed state to another storage block in the flash memory that is in an idle state.
- the electronic device also includes: a communication component 106, a display 107, a power supply component 108, an audio component 109, and other components.
- FIG10 only schematically shows some components and does not imply that the electronic device only includes the components shown in FIG10.
- the components within the dashed boxes in FIG10 are optional components, not mandatory components, and their specific configuration depends on the product form of the working node.
- the working node in this embodiment can be a desktop computer, laptop computer, smartphone, or Internet of Things (IoT) device, or a server-side device such as a conventional server, cloud server, or server array. If the working node in this embodiment is implemented as a terminal device such as a desktop computer, laptop computer, or smartphone, it may include the components within the dashed box in Figure 10; if the working node in this embodiment is implemented as a server-side device such as a conventional server, cloud server, or server array, it may not include the components within the dashed box in Figure 10.
- This disclosure also provides an electronic device, the implementation structure of which is the same as that of the electronic device shown in Figure 10. The structure is the same or similar, and can be implemented with reference to the structure of the electronic device shown in Figure 10.
- the main difference between the electronic device provided in this embodiment and the electronic device in the embodiment shown in Figure 10 is that the functions implemented by the processor executing the computer program stored in the memory in the electronic device are different.
- the processor executing the computer program stored in the memory can be used to: respond to a write request and write the data to be stored into a second storage block in the flash memory that is in a partially programmed state or an idle state; write the data to be stored into the temporary buffer area to cache the data in the second storage block, wherein the second storage block belongs to the target storage block.
- the processor when the processor responds to a write request and writes the data to be stored into a second storage block in the flash memory that is in a partially programmed state or an idle state, it specifically performs the following steps: If the flash memory uses a ZNS interface, it selects a flash area in the partially programmed state or the idle state from a plurality of flash areas provided by the flash memory as the second storage block; it sends the identifier of the second storage block and the data to be stored to a storage controller in the memory, so that the storage controller writes the data to be stored into the second storage block; if the flash memory uses a block device interface, it sends the data to be stored to a storage controller in the flash memory, so that the storage controller selects an erase block in the partially programmed state or the idle state from a plurality of erase blocks provided by the flash memory as the second storage block and writes the data to be stored into the second storage block.
- this disclosure also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, enables the processor to implement the steps of the above-described method.
- This disclosure also provides a computer program product comprising a computer program/instructions that, when executed by a processor, cause the processor to perform the steps described in the method embodiments above.
- This disclosure further provides a computer program product comprising a non-volatile computer-readable storage medium for storing a computer program that, when executed by a processor, performs the steps described in the method embodiments above.
- the aforementioned memory can be implemented using any type of volatile or non-volatile storage device or a combination thereof, such as Static Random-Access Memory (SRAM), Electrically Erasable Programmable Read Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
- SRAM Static Random-Access Memory
- EEPROM Electrically Erasable Programmable Read Only Memory
- EPROM Erasable Programmable Read Only Memory
- PROM Programmable Read-Only Memory
- ROM Read-Only Memory
- magnetic storage flash memory
- flash memory magnetic disk
- optical disk optical disk.
- the aforementioned communication component is configured to facilitate wired or wireless communication between the device containing the communication component and other devices.
- the device containing the communication component can access wireless networks based on communication standards (such as WiFi, 2G, 3G, 4G/LTE, 5G, or combinations thereof).
- the communication component receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel.
- the communication component further includes a Near Field Communication (NFC) module to facilitate short-range communication.
- NFC Near Field Communication
- the NFC module may be based on Radio Frequency Identification (RFID) technology, or the Infrared Data Association (IRDA) technology. This is achieved using technologies such as Data Association (IrDA), Ultra Wide Band (UWB), Bluetooth (BT), and others.
- RFID Radio Frequency Identification
- IRDA Infrared Data Association
- IrDA Data Association
- UWB Ultra Wide Band
- Bluetooth Bluetooth
- the aforementioned display includes a screen, which may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, it can be implemented as a touchscreen to receive input signals from the user.
- LCD Liquid Crystal Display
- TP Touch Panel
- the touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel.
- the touch sensors can sense not only the boundaries of touch or swipe actions but also the duration and pressure associated with the touch or swipe operation.
- the aforementioned power supply component provides power to various components of the device in which it resides.
- the power supply component may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device in which it resides.
- the aforementioned audio component can be configured to output and/or input audio signals.
- the audio component includes a microphone (MIC) configured to receive external audio signals when the device containing the audio component is in an operating mode, such as a call mode, recording mode, or voice recognition mode.
- MIC microphone
- the received audio signals may be further stored in memory or transmitted via a communication component.
- the audio component also includes a speaker for outputting audio signals.
- this disclosure can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects.
- this disclosure can take the form of a computer program product implemented on one or more computer-readable storage media (including, but not limited to, disk storage, compact disc read-only memory (CD-ROM), optical storage, etc.) containing computer-usable program code.
- These computer program instructions can also be stored in a computer-readable storage medium capable of directing a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means that implement the functions specified in one or more blocks of the flowchart and/or one or more blocks of the block diagram.
- These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, thereby providing steps for implementing the functions specified in one or more flowcharts and/or one or more blocks of a block diagram.
- a computing device includes one or more processors, input/output interfaces, network interfaces, and memory.
- Memory may include non-persistent storage in computer-readable media, random access memory (RAM), etc.
- RAM random access memory
- RAM random access memory
- ROM read-only memory
- Computer-readable media include permanent and non-permanent, removable and non-removable media.
- Information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data.
- Examples of computer storage media include, but are not limited to, phase-change random access memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, Digital Video Disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information that can be accessed by a computing device.
- PRAM phase-change random access memory
- SRAM static random access memory
- DRAM dynamic random access memory
- RAM random access memory
- ROM read-only memory
- EEPROM electrically erasable programmable read-only memory
- flash memory or other memory technologies
- CD-ROM Compact Disc
- DVD Digital Video Disc
- magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information that can be accessed by a computing device.
- a write request In response to a write request, it writes the data to be stored into a second storage block in the flash memory that is in a partially programmed state or an idle state. It also writes the data to be stored into the temporary buffer to cache the data in the second storage block, wherein the second storage block is a target storage block, thereby solving the read interference problem existing in storage blocks in a partially programmed state within the flash memory.
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)
- Techniques For Improving Reliability Of Storages (AREA)
Abstract
本公开实施例提供一种数据读取与存储方法、设备、系统、存储介质及程序产品,涉及云计算技术领域。在本公开实施例中,在存储引擎的内存存储器中引入了临时缓存区,用于缓存闪存存储器中至少部分处于局部编程状态的存储块中的数据,以供在对处于局部编程状态的存储块进行数据读取时,可直接从临时缓存区中进行读取,避免了从闪存存储器中处于局部编程状态的存储块进行读取,从而解决了在闪存存储器内部处于局部编程状态的存储块存在的读干扰问题。另外,闪存存储系统中的内存存储器可配置丰富的内存资源来实现对处于局部编程状态的存储块的数据缓存,由此可摆脱了对闪存存储器上的缓存空间的依赖,更加灵活、方便,具备了落地实施的条件。
Description
数 据读取 与存储方 法、 设备、 系统、 存储介质及程 序产品 交叉援引 本 公开要求于 2024年 06月 11日提交中国专利局、 申请号为 202410750036.5、发明名称 为 “数据读取与存储方法、 设备、 系统、 存储介质及程序产品” 的中国专利申请的优先权, 其全部内容通过引用结合在本公开中。 技术领域 本 公开涉及云计算技术领域, 尤其涉及一种数据读取与存储方法、 设备、 系统、 存储介 质及程序产品。 背景技术 闪存 (Flash Memory) 是一种非易失性的存储介质, 根据存储单元的连接方式不同, 闪 存被分为多种类型 (比如, NOR Flash和 NAND Flash等) 。 其中, NAND Flash的存储单元 的体积较小, 适于高密度集成, 能提供更大存储容量, 因此被广泛应用。 但是, NAND Flash 却面临着读干扰 (Read Distrub) 问题。 从硬件角度来看 ,读干扰问题表现为:在读取 NAND Flash中同一个擦除块 (Erase Block) 中的某个存储页 (也可以称为存储单元)时, 读取电压会导致同一 Erase Block中其它存储页 的存储电压发生变化, 并且随着读取次数的不断增多, 对其它存储页的影响会不断累积, 最 终导致该 Erase Block的数据错误率上升。
Erase Block作为 NAND Flash中的数据擦除单位, 通常包含多个存储页。 在 Erase Block 中只有部分存储页被写入数据的情况下, 可称 Erase Block处于局部编程状态; 对于处于局部 编程状态的 Erase Block, 由于其处于亚稳态, 所以读干扰问题会更加突出。 现有一些解 决方法是: 在 NAND Flash实现的存储介质如固态硬盘 ( Solid State Disk, 简 称为 SSD) 内部, 针对处于局部编程状态的 Erase Block维护缓存区, 当需要读取处于局部编 程状态的 Erase Block中的数据时, 直接从缓存区中读取, 绕过对处于局部编程状态的 Erase Block的读取操作, 从而解决读干扰问题。 在 SSD内部解决处于局部编程状态的 Erase Block存在的读干扰问题, 依赖 SSD上的缓 存空间, 尤其是在 Erase Block日益增大的情况下, 缓存空间将会变的很大, 在资源非常有限 的 SSD内部, 很难提供大容量的缓存来解决读干扰问题, 导致该方案很难落地实施。 发明内容 本 公开的多个方面提供数据读取与存储方法、 设备、 系统、 存储介质及程序产品, 用以 解决 SSD内部处于局部编程状态的 Erase Block存在的读干扰问题, 以摆脱对 SSD上缓存空
间的依赖, 使方案容易落地实施。 本公开实施例提供一种 闪存存储系统, 包括: 存储引擎、 内存存储器以及闪存存储器, 在所述内存存储器中设置有临时缓存区, 用于缓存所述闪存存储器中至少部分处于局部编程 状态的存储块中的数据; 所述存储引擎, 用于响应读请求, 在所述临时缓存区中包含待读取 数据的情况下, 从所述临时缓存区中读取所述待读取数据; 在所述临时缓存区中未包含所述 待读取数据的情况下, 从所述闪存存储器中的第一存储块中读取所述待读取数据, 其中, 所 述第一存储块为所述闪存存储器中处于局部编程状态或完全编程状态的存储块。 本公开实施例还提供一种数据读 取方法, 应用于存储引擎, 所述存储引擎的内存存储器 中设置有临时缓存区,用于缓存闪存存储器中至少部分处于局部编程状态的存储块中的数据, 所述方法包括: 响应读请求, 查询所述临时缓存区中是否包含待读取数据; 在所述临时缓存 区中包含待读取数据的情况下, 从所述临时缓存区中读取所述待读取数据; 在所述临时缓存 区中未包含所述待读取数据的情况下, 从所述闪存存储器中的第一存储块中读取所述待读取 数据, 其中, 所述第一存储块为所述闪存存储器中处于所述局部编程状态或完全编程状态的 存储块。 本公开实施例还提供一种数据存储方法 , 应用于存储引擎, 所述存储引擎的内存存储器 中设置有临时缓存区,用于缓存闪存存储器中至少部分处于局部编程状态的存储块中的数据, 所述方法包括: 响应写请求, 将待存储数据写入所述闪存存储器中处于局部编程状态或空闲 状态的第二存储块; 将所述待存储数据写入所述临时缓存区中以缓存所述第二存储块中的数 据, 其中, 所述第二存储块属于目标存储块。 本公开实施例还提供一种 电子设备, 包括: 存储器和处理器; 所述存储器, 用于存储计 算机程序, 所述处理器与所述存储器耦合, 用于执行所述计算机程序, 以用于实现以上所述 方法中的步骤。 本公开实施例还提供一种存储有计 算机程序的计算机可读存储介质, 当所述计算机程序 被处理器执行时, 致使处理器能够实现以上所述方法中的步骤。 本公开实施例还提供一种计算机程序产 品, 该计算机程序产品包括计算机程序 /指令, 当 计算机程序 /指令被处理器执行时, 致使处理器能够实现上述方法实施例中的步骤。 本公开实施例还提供一种计 算机程序产品, 该计算机程序产品包括非易失性计算机可读 存储介质, 所述非易失性计算机可读存储介质用于存储计算机程序, 当所述计算机程序被处 理器执行时实现上述方法实施例中的步骤。 在本公开实施例 中, 在存储引擎的内存存储器中引入了临时缓存区, 用于缓存闪存存储 器中至少部分处于局部编程状态的存储块中的数据, 以供在对处于局部编程状态的存储块进 行数据读取时, 可直接从临时缓存区中进行读取, 避免了从闪存存储器中处于局部编程状态 的存储块进行读取, 从而解决了在闪存存储器内部处于局部编程状态的存储块存在的读干扰 问题。 另外, 闪存存储系统中的内存存储器可配置丰富的内存资源来实现对处于局部编程状 态的存储块的数据缓存, 由此可摆脱了对闪存存储器上的缓存空间的依赖, 更加灵活、 方便, 具备了落地实施的条件。
附图说明 此处所说 明的附图用来提供对本公开的进一步理解, 构成本公开的一部分, 本公开的示 意性实施例及其说明用于解释本公开, 并不构成对本公开的不当限定。 在附图中: 图 1为本公开一示例性实施例提供的闪存存储系统的结构示意图; 图 2为本公开一示例性实施例提供的存储块的状态变化的示意图; 图 3为本公开一示例性实施例提供的一种采用 ZNS接口的闪存存储系统的结构示意图; 图 4为本公开一示例性实施例提供的另一种采用 ZNS接 口的闪存存储系统的结构示意 图; 图 5为本公开一示例性实施例提供的根据存储块的编程状态变化信息, 对临时缓存区中 的数据进行淘汰的过程示意图; 图 6为本公开一示例性实施例提供的一种数据流聚合模型的示意图; 图 7为本公开一示例性实施例提供的存储块与虚拟缓存块不对齐现象的结构示意图; 图 8为本公开一示例性实施例提供的一种数据读取方法的流程示意图; 图 9为本公开一示例性实施例提供的另一种数据读取方法的流程示意图; 图 10为本公开一示例性实施例提供的一种电子设备的结构示意图。 具体实施方式 为使本公开 的目的、 技术方案和优点更加清楚, 下面将结合本公开具体实施例及相应的 附图对本公开技术方案进行清楚、 完整地描述。 显然, 所描述的实施例仅是本公开一部分实 施例, 而不是全部的实施例。 基于本公开中的实施例, 本领域普通技术人员在没有做出创造 性劳动前提下所获得的所有其他实施例, 都属于本公开保护的范围。 需要说 明的是, 本公开所涉及的用户信息 (包括但不限于用户设备信息、 用户个人信息 等)和数据 (包括但不限于用于分析的数据、 存储的数据、 展示的数据等) , 均为经用户授 权或者经过各方充分授权的信息和数据, 并且相关数据的收集、 使用和处理需要遵守相关国 家和地区的相关法律法规和标准, 并提供有相应的操作入口, 供用户选择授权或者拒绝。 另 外, 本公开涉及的各种模型 (包括但不限于语言模型或大模型) 是符合相关法律和标准规定 的。 针对现有在 SSD内部处于局部编程状态的 Erase Block存在的读干扰问题, 在本公开实 施例中, 在存储引擎的内存存储器中引入了临时缓存区, 用于缓存闪存存储器中至少部分处 于局部编程状态的存储块中的数据, 以供在对处于局部编程状态的存储块进行数据读取时, 可直接从临时缓存区中进行读取, 避免了从闪存存储器中处于局部编程状态的存储块进行读 取, 从而解决了在闪存存储器内部处于局部编程状态的存储块存在的读干扰问题。 另外, 闪 存存储系统中的内存存储器可配置丰富的内存资源来实现对处于局部编程状态的存储块的数 据缓存, 由此可摆脱了对闪存存储器上的缓存空间的依赖, 更加灵活、 方便, 具备了落地实 施的条件。
以下结合附图, 详细说明本公开各实施例提供的技术方案。 图 1为本公开一示例性实施例提供的闪存存储系统的结构示意图。 如图 1所示, 该闪存 存储系统 100包括: 存储引擎 101、 内存存储器 102以及闪存存储器 103 , 在内存存储器 102 中设置有临时缓存区 102L 用于缓存闪存存储器 103中至少部分处于局部编程状态的存储块 中的数据。 在本 实施例中, 存储引擎 101是指闪存存储系统中适合进行各种数据处理 (例如存储、 读取、 删除、 更新等) 的软件程序, 可以运行在主机上。 其中, 存储引擎 101所在的主机可 以是计算机、 终端设备、 服务器或工作站等, 对此不做限制。 在本实施例中, 存储引擎 101 具有内存存储器 102和闪存存储器 103 , 内存存储器 102和闪存存储器 103相互配合, 为存 储引擎 101进行数据存储和访问提供基础。 在本 实施例中, 内存存储器 102简称内存 (memory) , 又称主存存储器, 用于存放计算 机运行时临时需要使用的程序和数据, 能够被中央处理器 (Central Processing Unit, 简称为 CPU ) 直接随机存取, 可采用半导体存储器, 例如, 可以采用动态随机存储器 (Dynamic Random-access memory, 简称为 DRAM) 或静态随机存储器 (Static Random-access memory, 简称为 SRAM) 等, 对此不做限定。 相比于闪存存储器 103 , 内存存储器 102具有存储容量 小、存取速度快和掉电易失等特点; 闪存存储器 103 , 主要是指以 NAND Flash为基础所实现 的存储器, 例如 SSD和一种闪存驱动器 (U盘)等, 用于存放 CPU运行时暂时不用的程序 和数据, 相比于内存, 其具有存储容量大、 存取速度慢和掉电非易失等特点, 适合持久化存 储各种数据。 在本 实施例中, 闪存存储器 103至少包括存储控制器 1031和闪存介质 1032, 存储控制 器 1031主要起控制作用, 用于运行闪存存储器 103的固件程序以对闪存介质 1032上的存储 单元进行相关的数据读、写和擦除等操作;存储单元是闪存介质 1032的基本组成部分,比如, NAND Flash 的存储单元类型包括单层单元 (Single-Level Cell, 简称为 SLC) 、 二层单元 (Mulit-Level Cell, 简称为 MLC) 、 三层单元 ( Trinary-Level Cell, 简称为 TLC) 和四层单 元 (Quad-Level Cell, 简称为 QLC) 。 在本 实施例中, 闪存存储器 103采用非易失性存储器 ( Non Volatile Memory Express, 简 称为 NVMe)接口规范与存储引擎 101或存储引擎 101所在主机互联, NVMe又称非易失性 内存主机控制器接口规范 (Non Volatile Memory Host Controller Interface Specification,简称为 NVMHCIS ) 是一种使用高速串行计算机扩展总线标准 ( Peripheral Component Interconnect Express,简称为 PCIe)总线连接非易失性存储介质的接口标准,具有高带宽、低延迟等特点。 其中, NVMe接口规范是闪存存储器 103与主机互联的基本接口规范。在 NVMe接口规 范的基础上, 闪存存储器 103 可以采用不同的存储管理技术, 例如可以采用块设备 (Block Device) 管理技术或者分区命名空间 (Zoned Namespaces, 简称为 ZNS) 管理技术。 其中, 块设备管理技术是以固定大小的数据块( Block)为单位进行数据传输和存储操作的技术; ZNS 管理技术是将存储空间划分为多个连续的、不可重叠的逻辑区域(Zone) ,并要求数据在 Zone 内部和 Zone之间按着顺序写入的管理技术。
在本实施例 中, 闪存存储器 103可以采用块设备管理技术, 在该情况下, 可以将闪存存 储器 103与主机之间的互联接口称为块设备接口 (简称为块接口) , 该块接口支持随机访问 块设备上的任意位置的数据, 而不需要像字符设备那样顺序读取; 另外, 在该情况下, 可将 闪存存储器 103抽象为连续的逻辑块地址(Logical Block Address, 简称为 LB A)空间, 通过 将数据组织成固定大小的逻辑块 (Block) , 例如 512字节、 4千字节(KB)等作为读写操作 的基本单位, 数据被存储在固定大小的逻辑块中, 支持随机读写和原地更新, 原地更新意味 着数据可以覆盖写入任意位置。 由于闪存存储器被抽象为连续的逻辑块, 因此可以将底层存 储介质 (如 NAND Flash)的特性对存储引擎和操作系统等软件程序隐藏起来, 在进行读写操 作时, 只需与块接口进行交互, 而不需要考虑底层存储介质的特性。 其中, 采用块接口的闪 存存储器允许随机访问和覆盖写入任意位置, 具有较高的灵活性, 但这种灵活性也带来了频 繁的读-修改-写循环, 增大了写放大 (额外写入数据量大于实际数据变化量) , 对闪存存储 器的使用寿命具有不利 影响。 在此说明, 闪存存储器中的逻辑块也可以称为擦除块 (Erase Block) o 在本实施例 中, 闪存存储器 103可以采用 ZNS管理技术, 在该情况下, 可以将闪存存储 器 103与主机之间的互联接口称为 ZNS接口。 ZNS在 NVMe的基础上引入 “分区 (Zone) ” 的概念,可将闪存存储器的地址空间抽象为一个个连续的逻辑分区,每个 Zone内部的数据以 顺序方式写入, 不能随机写入或覆盖写入, 如需更新数据, 则需先将整个分区重置才能再次 写入。 这种顺序写入方式减少了写放大, 提高了闪存存储器的性能和使用寿命。 另外, ZNS 简化了闪存存储器内部的设计与实现, 数据在闪存区上的布局由存储引擎来实现, 通过存储 引擎与闪存存储器的协同配合来降低闪存存储器的整体写放大系数, 从而可以充分使用底层 存储介质的特性。 无论是采用上述 哪种存储管理技术,在本公开实施例中,将闪存介质 1032中进行数据读 写的基本单位称为存储块, 存储块是闪存存储器中进行数据擦除的最小单位, 一个存储块可 以包括一个或多个存储页。 根据闪存存储器采用的存储管理技术的不同, 本公开实施例中存 储块的概念会有所不同。对于采用 ZNS接口的闪存存储器, 闪存存储器中的一个分区可以实 现为一个存储块。 对于采用块接口的闪存存储器, 闪存存储器中的一个逻辑块可以实现为一 个存储块。 需要说明的是, 在本公开实施例中, 在采用 ZNS接口实现的情况下, 闪存存储器 中的一个分区又称为闪存区。 在本实施例 中,闪存存储器中的存储块可具有如下几种状态:开放(Open)、只读(Seal)、 损坏 (Offline) 、 数据搬迁 (Garbage Collection) 、 擦除 (Erase)和空闲 (Free) 。 其中, 为了方便管理, 可将上述几种状态简化为空闲、 开放和关闭三种状态。 图 2为本公开一示例 性实施例提供的存储块的状态变化的示意图, 如图 2所示, 处于空闲状态的存储块是指未被 分配任何数据的存储块; 处于空闲状态的存储块在写入之前需要被打开, 以从空闲状态变为 开放状态; 存储块处于开放状态时可接受写入操作, 即处于可写状态, 在可写状态下, 也可 以接受读取操作, 因此可写状态也可以称为可读写状态; 存储块在被写满时则会从开放状态 切换至关闭状态; 存储块在处于关闭状态时可接受读取操作, 不再接受写入操作, 即处于只
读状态。 其 中, 也可以将存储块的读写状态称为存储块的编程状态, 存储块的编程状态包括局部 编程状态 (即可写状态) 和完全编程状态 (即只读状态) 。 在存储块中的部分存储页被写入 数据的情况下, 可称存储块处于局部编程状态; 在存储块中所有存储页都已写入数据的情况 下, 可称存储块处于完全编程状态。 对于处于局部编程状态的存储块, 存在读干扰问题。 在 读取闪存介质中同一个存储块中的某个存储页时, 读取电压会导致同一个存储块中其它存储 页的存储电压发生变化, 并且随着读取次数的不断增多, 对其它存储页的影响会不断累积, 最终导致该存储块的数据错误率上升。 为 了解决上述读干扰问题, 在本公开实施例中, 在内存存储器 102中引入了临时缓存区 102L 用于缓存闪存存储器 103中至少部分处于局部编程状态的存储块中的数据。 由于在临 时缓存区 1021中存储了处于局部编程状态的存储块中的数据,在对处于局部编程状态的存储 块进行数据读取时, 可先从临时缓存区 1021中进行读取, 如果在临时缓存区 1021中成功读 取数据, 则可以避免从闪存存储器 103中对处于局部编程状态的存储块进行读取, 从而解决 了在闪存存储器 103内部处于局部编程状态的存储块存在的读干扰问题。 进一步, 如果在临 时缓存区 1021中未能成功读取数据,再从闪存存储器 103中读取数据, 可以保证成功读取数 据。 在本实施例 中, 临时缓存区 102L 用于缓存闪存存储器 103中至少部分处于局部编程状 态的存储块中的数据。 其中, “至少部分处于局部编程状态的存储块 ”可以是闪存存储器 103 中处于局部编程状态的存储块中的一部分或全部, 在实现为一部分处于局部编程状态的存储 块的情况下, 可以包括用于存储特定数据的处于局部编程状态的存储块, 或最早处于局部编 程状态的前 N个存储块, 其中, N是正整数等; 在实现为全部处于局部编程状态的存储块的 情况下, 可以包括识别到的处于局部编程状态的任意一个存储块。 随着数据的不断存储, 存 储块的编程状态也会动态变化, 因此, 在实现为全部处于局部编程状态的存储块的情况下, 具体视对存储块的编程状态的识别情况而定, 如果能够准确识别出任意一个处于局部编程状 态的存储块, 则可以缓存所有处于局部编程状态的存储块的数据; 如果识别不是很准确, 则 存储识别出的处于局部编程状态的存储块的数据。 另外, 随着数据的不断存储, 存储块的编 程状态也会动态变化,临时缓存区 1021中也可以临时存储从局部编程状态进入完全编程状态 的存储块中的数据, 直至该处于完全编程状态的存储块中的数据被删除。 在本实施例 中, 临时缓存区 1021中存储的数据是由存储引擎 101控制写入的,存储引擎 101 响应于写请求, 一方面将待存储数据写入闪存存储器 103 中处于局部编程状态或空闲状 态的第二存储块 (如图 1中⑦所示) , 另一方面将待存储数据写入临时缓存区中以缓存第二 存储块中的数据 (如图 1中⑤所示) , 第二存储块属于写入待存储数据的目标存储块, 并将 待存储数据称为第二数据。 这样, 在读取第二数据时, 可以先行从临时缓存区 1021中读取, 在读取失败的情况下, 再从闪存存储器 103中的第二存储块中读取, 可减轻第二存储块面临 的读干扰问题。 需要说明的图中的写入顺序即⑤和 ⑦仅作示例, 对此不作限制。 例如, 可以 同时写入临时缓存区 1021和闪存存储器 103 , 也可先写临时缓存区 1021后写入闪存存储器
103 , 还可先写入闪存存储器 103后写入临时缓存区 1021 o 其中, 写请求来自闪存存储系统 的使用端, 使用端可以是各种应用程序、 系统或功能模块等。 其 中, 针对采用不同接口的闪存存储器, 向闪存存储器中写入第二数据的方式会有所不 同。 在一些实施例中, 图 3为本公开一示例性实施例提供的一种采用 ZNS接口的闪存存储系 统的结构示意图, 如图 3所示, 在闪存存储器采用 ZNS接口的情况下, 存储引擎从闪存存储 器提供的多个闪存区中 (如图 3中分区 A-分区 T) 选择处于局部编程状态或空闲状态的闪存 区作为第二存储块, 图 3中以分区 B作为第二存储块的一种示例; 将第二存储块的分区标识 和待存储数据发送给内存存储器中的存储控制器 (如图 3 中⑦所示) , 以使存储控制器将待 存储数据写入第二存储块中 (如图 3中⑧所示) , 其中, 每个存储块具有唯一标识, 用于指 示存储控制器将数据写入正确的位置。 在另一些实施例中, 图 4为本公开一示例性实施例提 供的另一种采用 ZNS接口的闪存存储系统的结构示意图, 如图 4所示, 在闪存存储器采用块 设备接口的情况下, 存储引擎将待存储数据发送给闪存存储器中的存储控制器 (如图 4中⑧ 所示) , 以使存储控制器从闪存存储器提供的多个擦除块中 (如图 4中逻辑块 a-逻辑块 t)选 择处于局部编程状态或空闲状态的擦除块作为第二存储块 (如图 4中⑨所示) , 图 4中以逻 辑块 b作为第二存储块的一种示例, 并将待存储数据写入第二存储块中 (如图 4中⑩所示) 。 在 闪存存储器采用 ZNS接口的情况下,从闪存存储器提供的多个闪存区中选择处于局部 编程状态或空闲状态的闪存区作为第二存储块, 本公开实施例对选择的方式不作限制。其中, 存储引擎可以管理和维护闪存存储器中任意一个闪存区的状态。 在一可选实施例中, 存储引 擎在从闪存存储器提供的多个闪存区内选择闪存区作为第二存储块时,可包括如下实现方式: 情况 1: 在闪存存储器上不存在处于局部编程状态的闪存区的情况下, 从处于空闲状态 的闪存区中选择一个闪存区作为第二存储块, 或者在闪存存储器上不存在处于空闲状态的闪 存区的情况下, 创建一个处于空闲状态的闪存区作为第二存储块; 其中, 在创建一个处于空 闲状态的闪存区作为第二存储块时, 可利用垃圾回收(Garbage Collection, 简称为 GC)机制, 用以回收并整理存储空间以创建一个处于空闲状态的闪存区作为第二存储块。 情况 2: 在闪存存储器上存在处于局部编程状态的闪存区的情况下, 若当前处于局部编 程状态的闪存区的可用存储空间大于等于待存储数据所需存储空间, 则将当前处于局部编程 状态的闪存区作为第二存储块。 情况 3: 在闪存存储器上存在处于局部编程状态的闪存区的情况下, 若当前处于局部编 程状态的闪存区的可用存储空间小于第二数据所需存储空间的情况下, 将当前处于局部编程 状态的闪存区作为第二存储块; 以及在当前处于局部编程状态的闪存区被写满的情况下, 选 择下一个闪存区作为新的第二存储块。 具体地 , 存储引擎读取数据的过程包括: 响应读请求, 首先查询临时缓存区中是否包含 待读取数据; 在临时缓存区中包含待读取数据的情况下, 从临时缓存区中读取待读取数据; 在临时缓存区中未包含待读取数据的情况下, 从闪存存储器中的第一存储块中读取待读取数 据, 第一存储块为闪存存储器中处于局部编程状态或完全编程状态的存储块。 其中, 读请求 来自闪存存储系统的使用端, 使用端可以是各种应用程序、 系统或功能模块等。
在本实施例 中, 读请求可包含待读取数据的标识。 其中, 针对不同接口的闪存存储器, 从闪存存储器中读取数据的方式会有所不同。 在一可选实施例中, 如图 3所示, 在闪存存储 器采用 ZNS接口的情况下, 该身份标识 (Identity document, 简称为 ID) 可实现为逻辑块地 址信息, 将逻辑块地址信息传递给存储引擎, 以供存储引擎根据逻辑块地址信息查询待读取 数据。 存储引擎会首先从临时缓存区中进行查询 (如图 3中①所示) , 如果命中则直接读取 返回 (如图 3中②所示) ; 若未命中, 则将存储引擎根据逻辑块地址信息查询待读取数据对 应的分区标识发送给存储控制器 (如图 3中③所示) , 以供存储控制器根据该分区标识从闪 存存储器中的分区 A进行读取 (如图 3中④所示) , 并返回 (如图 3中⑤所示) , 图 3中以 从分区 A进行读取作为示例。 在另一可选实施例中, 如图 4所示, 在闪存存储器采用块设备 接口的情况下, 将逻辑块地址信息传递给存储引擎, 以供存储引擎根据逻辑块地址信息从临 时缓存区中查询待读取数据 (如图 4中①所示);若命中则直接读取返回(如图 4中②所示); 若未命中则将逻辑块地址信息传递给存储控制器 (如图 4中③所示) , 由存储控制器根据逻 辑块地址信息确定与之对应的逻辑块 (如图 4中④所示) , 进而从闪存存储器中的逻辑块 a 读取数据 (如图 4中⑤所示) , 并返回 (如图 4中⑥所示) , 图 4中以从逻辑块 a进行读取 作为示例。 在上述实施例 中, 通过在内存存储器中实现在内存存储器中引入了临时缓存区, 缓存闪 存存储器中至少部分处于局部编程状态的存储块中的数据, 从而解决了在闪存存储器内部处 于局部编程状态的存储块存在的读干扰问题。 另外, 在本实施例的闪存存储系统 100中, 相 比于在闪存存储器 103中设置数据缓存区 (或称缓存空间) , 内存存储器 102可配置丰富的 内存资源来实现对处于局部编程状态的存储块的数据缓存, 由此可解决闪存存储器 103上的 缓存空间受限的问题。 尽管 闪存存储系统中的内存存储器可配置丰富的内存资源, 可解决闪存存储器上的缓存 空间受限的问题, 但内存资源依然是有限的, 所以有必要对临时缓存区中的数据进行淘汰管 理, 以提高缓存资源利用率。 为此 , 在一可选实施例中, 存储引擎还用于: 根据至少部分处于局部编程状态的存储块 的编程状态变化信息, 对临时缓存区中的数据进行淘汰处理, 以释放缓存空间。 图 5为本公 开一示例性实施例提供的根据存储块的编程状态变化信息, 对临时缓存区中的数据进行淘汰 的过程示意图, 如图 5所示, 在根据存储块的编程变化信息, 对临时缓存区中的数据进行淘 汰处理时, 存储引擎用于: 针对在临时缓存区中缓存数据的任一存储块, 在该任一存储块从 局部编程状态 (可写状态)进入完全编程状态(只读状态) 的情况下 , 将临时缓存区中缓存 的该任一存储块中的数据删除。 由此可见, 临时缓存区中的数据的淘汰管理依赖于存储块的 编程状态, 需要对存储块的编程状态进行维护和管理。 在从 临时缓存区中进行数据淘汰时, 是对闪存存储器中处于完全编程状态的存储块对应 的数据进行淘汰。 但是临时缓存区中可能存储有多个存储块对应的数据, 因此在淘汰任一存 储块时, 还需准确地确定该任一存储块所对应的数据在临时缓存区中的边界。 为 了实现针对存储块的编程状态的维护和管理, 以及准确地确定该任一存储块所对应的
数据在临时缓存区中的边界。在本实施例中, 无论是块接口或 ZNS接口的闪存存储器, 存储 引擎针对任一存储块, 创建与所述任一存储块适配的虚拟缓存块, 其中, 创建虚拟缓存块的 时机可以是在开始向该任一存储块存储数据之前, 或者, 在首次向任一存储块中存储数据的 情况下; 进一步, 在临时缓存区中缓存任一存储块中的数据的情况下, 在虚拟缓存块中记录 该任一存储块在临时缓存区中缓存的数据信息, 并通过虚拟缓存块的读写状态维护该任一存 储块的编程状态; 其中, 虚拟缓存块的可写状态和只读状态分别对应该任一存储块的局部编 程状态和完全编程状态。 数据信息可以是数据的标识信息、 数据在临时缓存区中的存储位置 等, 用于在进行数据删除时能够标识需要删除哪些数据的信息。 至此, 任一存储块和与任一 存储块适配的虚拟缓存块的读写状态对应, 以及任一存储块和与任一存储块适配的虚拟缓存 块所存储的数据对应, 由虚拟缓存块即可确定任一存储块的编程状态和在临时缓存区中的数 据边界。 进而, 在检测到任一存储块从局部编程状态变化为完全编程状态时, 只需将临时缓 存区中缓存的与任一存储块适配的虚拟缓存块中的数据删除即可。 在本公开实施例 中, 虚拟缓存块是一种逻辑资源, 被设计为一种数据结构, 可选地, 数 据结构可以是数组、 列表或二叉树等, 用于组织和存储数据。 虚拟缓存块是抽象的概念, 不 是具体的物理存储单元, 而是对闪存存储器中的任一存储块, 在临时缓存区中进行抽象得到 的。在一些实施例中,还可以按照存储块的大小将临时缓存区切分为相同大小的物理缓存块, 每个存储块中的数据被缓存在一个物理缓存块中。 另外, 每个物理缓存块对应虚拟缓存块, 用于记录该物理缓存块中缓存的数据与存储块之间的对应关系。 其 中, 在为存储块创建与任一存储块适配的虚拟缓存块, 虚拟缓存块与存储块具有对应 关系, 可以是一个虚拟缓存块对应一个存储块、 一个虚拟缓存块对应多个存储块或者多个虚 拟缓存块对应一个存储块, 对此不做限制。 相应地, 在将临时缓存区切分为物理缓存块的情 况下, 物理缓存块与虚拟缓存块的对应关系, 与虚拟缓存块与存储块的对应关系相同, 可以 是一对一、 一对多或多对一, 对此不做限定。 其 中, 通过闪存存储器采用存储管理技术的不同, 可将闪存存储器与主机之间的互联接 口划分为块接口和 ZNS接口, 不同接口实现方式下, 存储引擎对存储块的编程状态的感知能 力不同。 在闪存存储器采用 ZNS接口的情况下, 存在逻辑块地址到分区的映射关系, 通过这 种映射方式将逻辑块地址空间划分为多个分区, 每个分区对应一段连续的逻辑块地址范围。 由此可见, 采用 ZNS接口的闪存存储器将底层存储介质完全暴露给了存储引擎, 由存储引擎 对闪存存储器的底层存储介质 (即闪存介质)直接进行读写操作, 所以存储引擎可感知底层 存储介质中存储块的状态。 相应地, 根据上文可知, 在闪存存储器采用块接口的情况下, 底 层存储介质的特性对存储引擎隐藏起来, 在进行读写操作时, 直接与块接口进行交互, 存储 引擎对底层存储介质的特性无法感知。 因此, 存储引擎无法直接获取块接口的闪存存储器中 存储块的编程状态。 由此可见, 不同的接口实现方式下, 存储引擎对存储块的编程状态的感 知能力不同, 则通过虚拟缓存块的读写状态维护该任一存储块的编程状态的方式也会有所不 同。 进而, 导致针对临时缓存区中数据进行淘汰管理的实现方式不同。 基于此 , 下面分别针对不同 ZNS接口和块接口, 对从临时缓存区中数据的淘汰管理进行
介绍: 情况 1: 在闪存存储器采用 ZNS接口的情况下, 对从临时缓存区中数据的淘汰管理的实 现方式如下: 根据上文可知 , 采用 ZNS接口的闪存存储器将底层存储介质完全暴露给了存储引擎, 存 储引擎可感知底层存储介质中存储块的状态, 存储块的状态对存储引擎来说是透明的, 存储 引擎对存储块的状态变化的检测直接有效。 因此, 在闪存存储器采用 ZNS接口的情况下, 存储引擎可以在向闪存存储器中存储数据 过程中, 在每次启用的闪存存储器中处于空闲状态的存储块时, 创建与该存储块适配的虚拟 缓存块, 其中, 每次启用一个新的存储块时被启用的存储块会从空闲状态进入局部可编程状 态。 进而, 在向每个进入局部编程状态的存储块中写入数据时, 可以在临时缓存区中缓存每 个进入局部编程状态的存储块中的数据。由于存储引擎可感知底层存储介质中存储块的状态, 并在每次启用一个新的存储块时, 在临时缓存区中创建与新的存储块适配的虚拟缓存块, 因 此可以做到存储块的编程状态与虚拟缓存块的读写状态 - 对应, 以及存储块的边界与虚拟 缓存块的边界对齐。 这样在向每个存储块写入数据时, 存储块的编程状态可映射至虚拟缓存 块的读写状态, 以及可直接映射到与存储块对应的虚拟缓存块中, 并且由于对齐, 还可避免 跨存储块的写入。 在 闪存存储器采用 ZNS接口的情况下,在感知到底层存储介质中存储块的状态的基础上, 可在临时缓存区中对相应的虚拟缓存块进行标记, 以完成存储块的编程状态到虚拟缓存块的 读写状态的映射。 因此, 存储引擎在通过虚拟缓存块的读写状态维护任意一个存储块的编程 状态时, 在被启用的存储块处于局部编程状态的情况下, 标记与该存储块对应的虚拟缓存块 为可写状态; 随着第二数据的不断写入, 该存储块的编程状态会发生变化, 当存储块被写满 时, 意味着存储块从局部编程状态进入完全编程状态, 在该情况下, 标记与该存储块对应的 虚拟缓存块为只读状态。 至此, 完成存储块的编程状态到虚拟缓存块的读写状态的映射。 在闪存存储器采用 ZNS接口的情况下, 存储块的编程状态映射到虚拟缓存块的读写 状态。 存储引擎可通过检测虚拟缓存 块的读写状态来获取与存 储块对应的存储块的编 程 状态。 存储引擎监测任一虚拟缓存块 的读写状态, 在任一虚拟缓存块为只读状态的情 况 下, 根据任一虚拟缓存块中记录 的数据信息, 将临时缓存区中缓存的与该任一虚拟 缓存 块对应存储块 中的数据删除, 实现对临时缓存区中数据的淘汰管理 。 情况 2: 在闪存存储器采用块接口的情况下, 对从临时缓存区中数据的淘汰管理的实现 方式如下: 根据上文可知 , 在闪存存储器采用块接口的情况下, 底层存储介质的特性对存储引擎隐 藏起来, 存储引擎无法直接获取块接口的闪存存储器中存储块的编程状态, 也即采用块接口 的闪存存储器, 存储块的编程状态对存储引擎来说是不透明的, 处于黑盒状态。 在本实施例 中, 对于采用块接口的闪存存储器, 数据在写入闪存存储器时, 首先会被写 入到闪存存储器内存的写入缓冲区 (Write buffer) 中, 数据在写入缓冲区中进行聚合, 聚合 到一定程度或达到预设的容量限制时, 存储控制器会触发数据转移操作, 即将聚合的数据一
次性写入存储块中, 并且存储块只做追加 (append only) 写入。 其中, 每个存储块所能存储 的最大数据量是固定的, 且已知的, 该最大数据量具体与闪存存储器采用的闪存介质、 工艺、 厂商等有关, 对此不做限定。 基于此 , 图 6为本公开一示例性实施例提供的一种数据流聚合模型的示意图, 如图 6所 示, 本公开实施例提出一种数据流聚合模型, 用于描述闪存存储器中一个存储块的数据写入 过程。 在数据流聚合模型中, 假设数据从存储块 0开始写入, 当数据聚合到固定阈值时, 则 代表存储块 0被写满, 这里的固定阈值可以是与存储块的容量相关的数值, 可称为目标阈值, 该目标阈值可以是存储块所能存储的最大数据量, 或者是根据最大数据量确定的容量值; 进 一步, 关闭存储块 0, 并开启一个新的存储块 (即存储块 1) 继续接受写入操作, 在存储块 1 被写满之后, 关闭存储块 1 , 并继续创建下一个存储块(即存储块 2) , 以继续接受写入操作, 以此类推。 至此, 可以根据该数据流聚合模型来模拟闪存存储器中存储块的写入过程。 在能够通过数据流 聚合模型来模拟闪存存储器中存储块的写入过程的基础上, 为了对采 用块接口的闪存存储器中的存储块的状态进行检测, 本公开实施例还提供一种基于数据流的 虚拟缓存块及状态检测机制。 在向闪存存储器中存储数据过程中, 在开始向临时缓存区中缓 存数据的情况下, 在临时缓存区中创建虚拟缓存块, 在创建时标记该虚拟缓存块为可写状态, 每当临时缓存区中的数据量达到目标阈值时, 则代表闪存存储器中一个存储块被写满, 标记 该虚拟缓存块为只读状态。 据此, 存储块的编程状态被映射至临时缓存区中虚拟缓存块的读 写状态, 可以根据虚拟缓存块的读写状态来判断存储块的编程状态, 达到对存储块的编程状 态检测的目的。 在能够对采用块接口的闪存存储器中存储块的编程状态进行检测的基础上, 可将闪存存储器中处于只读状态的存储块中的数据从临时缓存区中进行淘汰。 下面以块接口 实现为例, 对基于数据流的虚拟缓存块及状态检测机制, 以及从临时缓存区中数据的淘汰管 理的细节进行介绍。 其中, 在闪存存储器采用块设备接口的情况下 , 存储引擎在向闪存存储器中存储数 据过程 中, 在开始向临时缓存区中缓存数据的情况下, 创建首个虚拟缓存块并标记 该虚 拟缓存块为 可写状态, 每当临时缓存区中缓存的数据量达到 目标阈值时, 标记当前虚拟 缓存块为 只读状态, 进一步创建下一个虚拟缓存块并标记该 虚拟缓存块为可写状态 ; 进 一步, 在临时缓存区中缓存的数据量 再次达到目标阈值的情 况下, 标记该虚拟缓存块为 只读状态 , 依次类推。 其中, 临时缓存区中缓存的数据量达到目标阈值理论上表示闪存 存储器中一个 存储块被写满。 需要说明的是, 这里的存储块被写满是理论意义上的写满, 由于块接 口的闪存存储器对存储 引擎不透明, 所以只能根据上述数据流聚合模型对存 储 块的写入过程 进行模拟, 在数据量达到目标阈值时, 认为该存储块被写满。 在能够对采用块接 口的闪存存储器中存储块 的编程状态进行检测的基础 上, 可对闪 存存储器 中处于只读状态的存储块对 应的数据从临时缓存 区中进行淘汰。 然而, 通过数 据流聚合模 型来模拟存储块的写入 以对存储块的状态进行检 测时, 存储块对于存储引擎 来说是不透 明的, 看不到存储块的真实的使用状态, 数据在写入时可能是从一个存储 块 的中间位置 开始写入的, 所以可能会存在不对齐的现象 。 在此以从存储块的中间位置进
行写入为例对 不对齐现象进行解释说 明。 图 7为本公开一示例性实施例提供的存储块与 虚拟缓存块 不对齐现象的结构示意图, 如图 7所示, 在开始对存储块 0写入数据时, 同 时向临时缓存 区中的虚拟缓存块 (0)进行写入,假定是从存储块 0的中间位置开始写入。 在写入两个虚拟 缓存块后, 在虚拟缓存块(1)被标记为只读状态时, 在闪存存储器对应 的写入位置 仍是位于存储块 2的中间位置, 由此导致虚拟缓存块与存储块的不对齐现象 发生。 对于存储块 0来说, 其在临时缓存区中的数据分布在虚拟缓存块 (0)和虚拟缓存 块 ( 1) 上。 如果在虚拟缓存块 (0) 被标记为只读状态时, 直接将虚拟缓存块 (0)对应 的数据从临 时缓存区中淘汰出去的话 , 那么如果读请求是对存储块 0或 1的访问将会绕 过临时缓存 区, 直接从存储块 0或 1上进行数据读取, 从而导致处于局部编程状态下的 存储块的读干 扰问题的发生。 基于此, 本公开实施例提供一种延迟淘汰策略 , 在闪存存储器采用块设备接口的情 况下, 存储引擎负责监测连续 N个虚拟缓存块 的读写状态, 在连续 N个虚拟缓存块均为 只读状态 的情况下, 根据连续 N个虚拟缓存块中最早虚拟缓存块 中记录的数据信息, 将 临时缓存 区中缓存的该最早虚拟缓存块 对应存储块中的数据删除 , 其中, N为大于或等 于 2的自然数。 其中, N可根据经验值进行配置; 或者, 也可试运行一段时间, 根据运 行效果进行动 态调整, 例如, 在 N为某个具体的自然数时, 统计临时缓存区中的容量损 耗与在对存 储块进行读取的错误率 , 且在两者之间找到平衡, 以提高闪存存储系统的性 能和可靠性 。 可选地, 最早的虚拟缓存块可以是最早的 M个虚拟 缓存块, M为大于或等于 1的自 然数, 且 M<NO 以解决上述 图 7所示的不对齐问题为例, 对延迟淘汰策略进行解释说 明。 如图 7所示, 在虚拟缓存块 (0) 的状态发生变化时 (即从可写状态切换至只读状态 时) , 不对虚拟缓存块 (0) 进行淘汰, 而是延迟到虚拟缓存块 (1) 的状态发生变化时, 才对虚拟缓存 块 (0) 进行淘汰。 对于虚拟缓存块 (1) 来说, 延迟到虚拟缓存块 2的状 态发生变化 时, 才对其进行淘汰, 依次类推。 这样, 虽然增加了临时缓存区中一个虚拟 缓存块的容量 , 但是在对存储块 0或 1进行访问时, 将会直接从临时缓存区中进行数据 读取, 提高了临时缓存区的命中率 , 也即是说, 通过牺牲临时缓存区中的内存容量来换 取命中率 , 有效地解决了上述不对齐问题导致的读干扰 问题的发生。 需要说明的是, 此 处以延迟淘汰 一个虚拟缓存块进行举例说 明, 但不仅限于此。 综上, 对于采用块接口的闪存存储器中的存储块 , 存储引擎实现了基于数据流的虚 拟缓存块及 状态检测机制, 借助于该机制, 可完成对闪存存储器中处于只读状态 的存储 块对应的数 据从临时缓存区中进行 淘汰, 并在淘汰的过程中, 采用延迟淘汰策略, 通过 牺牲临时缓 存区中的内存容量来换 取命中率, 有效地解决了上述不对齐问题导致 的读干 扰问题的发 生。 基于此, 块接口的闪存存储器实现了和 ZNS接口的闪存存储器相同的管 理机制, 均可利用存储引擎对从临时缓存 区中数据的淘汰管理。 进一步, 在本公开上述实施例中, 主要描述了如何解决处于局部编程状 态的存储块 面临的读干 扰问题。 在实际应用中, 对于处于完全编程状态下的存储块, 也存在读干扰
问题。 为解决该问题, 在本公开实施例中, 对存储块的读次数进行统计, 在读次数达到 设定次数 阈值时, 将处于完全编程状态的存储块中的数据搬 移到闪存存储器中处于 空闲 状态的另一存储 块中。 其中, 不同接口的闪存存储器, 对处于完全编程状态的存储块的读次数 统计及数据 搬移的执行 主体不同。 在 ZNS接口实现下, 由存储引擎负责存储块的读次数统计及数据 搬移; 在块设备接口实现下, 由闪存存储器中的存储控制器 负责存储块的读次数统计 及 数据搬移 。 在本实施例中, 在将处于完全编程状态的存储块 中的数据搬移到闪存存 储器中处于 空闲状态 的另一存储块中时, 需从闪存存储器中的存储块 中选择处于空闲状态的存储 块 (简称空闲存储块) 。 针对不同的接口实现方式, 执行选择操作的主体不同。 在 ZNS接 口实现下 , 由存储引擎负责选择空闲存储块; 在块设备接口实现下, 由闪存存储器中的 存储控制器 负责选择空闲存储块 。 其中, 本公开实施例对选择空闲存储块的方式不作限 定, 下面进行举例介绍。 在一可选实施例中, 可维护一个空闲块列表 , 记录当前可用的空闲存储块信息, 该 信息包括存 储块的起始地址和长度 以及该存储块的擦写次数 。 当需要进行写入操作时, 从该列表 中选择一个空闲存储块 即可。 为延长闪存的使用寿命, 需确保所有存储块的擦 写次数尽可 能均匀 (即磨损均衡) , 因此在选择空闲存储块时, 可优先选择擦写次数较 少的存储块 , 以避免某些存储块被过度消耗。 在另一可选实施例中, 还可以根据第二数 据的访 问频率, 将第二数据分为冷数据和热数据, 基于冷数据和热数据的特性, 选择合 适的空闲存储 块进行存储。 其中, 热数据选择擦写次数较少的存储块, 冷数据选择擦写 次数较多 的存储块, 以优化存储性能和延长闪存存储器的使用寿命 。 可选地, 当闪存存储器中的空闲存储块不足时 , 还可触发垃圾回收操作, 对已失效 数据 占据的存储空间进行回收, 并通过对有效数据进行搬移 , 实现存储空间的回收再利 用, 使一些存储块恢复空闲状态 。 其中, 本公开实施例对垃圾回收的策略不作限定, 例 如标记 -清除 (Mark-Sweep) 算法、 分代收集 ( Generational Collection) 算法等。 进一步 , 图 8为本公开一示例性实施例提供的一种数据读取方法的流程示意图, 如图 8 所示, 本公开实施例还提供一种数据读取方法, 应用于存储引擎, 存储引擎的内存存储器中 设置有临时缓存区, 用于缓存闪存存储器中至少部分处于局部编程状态的存储块中的数据, 该方法包括:
S801: 响应读请求, 查询临时缓存区中是否包含待读取数据;
S802: 在临时缓存区中包含待读取数据的情况下, 从临时缓存区中读取待读取数据;
S803: 在临时缓存区中未包含待读取数据的情况下, 从闪存存储器中的第一存储块中读 取待读取数据, 其中, 第一存储块为闪存存储器中处于局部编程状态或完全编程状态的存储 块。 在一可选实施例 中, 上述方法还包括: 响应写请求, 将待存储数据写入闪存存储器中处 于局部编程状态或空闲状态的第二存储块; 将待存储数据写入临时缓存区中以缓存第二存储
块中的数据, 其中, 第二存储块属于目标存储块。 在一可选实施例 中, 响应写请求, 将待存储数据写入闪存存储器中处于局部编程状态或 空闲状态的第二存储块, 包括: 在闪存存储器采用互联接口 ZNS接口的情况下, 响应所述写 请求, 从闪存存储器提供的多个闪存区中, 选择处于局部编程状态或空闲状态的闪存区作为 第二存储块; 将第二存储块的标识和待存储数据发送给内存存储器中的存储控制器, 以使存 储控制器将待存储数据写入第二存储块中; 在闪存存储器采用块设备接口的情况下, 响应写 请求, 将待存储数据发送给闪存存储器中的存储控制器, 以使存储控制器从闪存存储器提供 的多个擦除块中, 选择处于局部编程状态或空闲状态的擦除块作为第二存储块并将待存储数 据写入第二存储块中。 在一可选实施例 中, 上述方法还包括: 针对在临时缓存区中缓存数据的任一存储块, 在 任一存储块从局部编程状态进入完全编程状态的情况下, 将临时缓存区中缓存的任一存储块 中的数据删除。 在一可选实施例 中, 上述方法还包括: 针对任一存储块, 创建与任一存储块适配的虚拟 缓存块; 在临时缓存区中缓存任一存储块中的数据的情况下, 在虚拟缓存块中记录任一存储 块在临时缓存区中缓存的数据信息, 并通过虚拟缓存块的读写状态维护任一存储块的编程状 态; 其中, 虚拟缓存块的可写状态和只读状态分别对应任一存储块的局部编程状态和完全编 程状态。 在一可选实施例 中, 针对任一存储块, 创建与任一存储块适配的虚拟缓存块, 包括: 在 闪存存储器采用 ZNS接口的情况下, 在向闪存存储器中存储数据过程中, 将每次启用的闪存 存储器中处于空闲状态的存储块作为任一存储块并创建与任一存储块适配的虚拟缓存块, 其 中, 被启用的存储块从空闲状态进入局部可编程状态; 在闪存存储器采用块设备接口的情况 下, 在向闪存存储器中存储数据的过程中, 在开始向临时缓存区中缓存数据的情况下, 创建 首个虚拟缓存块,每当临时缓存区中缓存的数据量达到目标阈值时,创建下一个虚拟缓存块; 其中, 临时缓存区中缓存的数据量达到目标阈值用于表示闪存存储器中一个存储块被写满。 在一可选实施例 中, 通过虚拟缓存块的读写状态维护任一存储块的编程状态, 包括: 在 闪存存储器采用 ZNS接口的情况下, 在被启用的存储块处于局部编程状态的情况下, 标记虚 拟缓存块为可写状态; 在被启用的存储块从局部编程状态进入完全编程状态的情况下, 标记 虚拟缓存块为只读状态; 在闪存存储器采用块设备接口的情况下, 针对任一虚拟缓存块, 在 创建时标记任一虚拟缓存块为可写状态, 并在临时缓存区中缓存的数据量达到目标阈值的情 况下, 标记任一虚拟缓存块为只读状态。 在一可选实施例 中, 在任一存储块从局部编程状态进入完全编程状态的情况下, 将临时 缓存区中缓存的任一存储块中的数据删除, 包括: 在闪存存储器采用 ZNS接口的情况下, 监 测任一虚拟缓存块的读写状态, 在任一虚拟缓存块为只读状态的情况下, 根据任一虚拟缓存 块中记录的数据信息, 将临时缓存区中缓存的任一虚拟缓存块对应存储块中的数据删除; 在 闪存存储器采用块设备接口的情况下, 监测连续 N个虚拟缓存块的读写状态,在连续 N个虚 拟缓存块均为只读状态的情况下, 根据连续 N个虚拟缓存块中最早虚拟缓存块中记录的数据
信息, 将临时缓存区中缓存的最早虚拟缓存块对应存储块中的数据删除, 其中, N为大于或 等于 2的自然数。 在一可选实施例 中, 上述方法还包括: 在闪存存储器采用 ZNS接口的情况下, 统计对处 于完全编程状态的存储块的读次数; 当读次数达到设定次数阈值的情况下, 将处于完全编程 状态的存储块中的数据搬移到闪存存储器中处于空闲状态的另一存储块中。 图 9为本公开一示例性实施例提供的另一种数据读取方法的流程示意图, 如图 9所示, 为本公开实施例提供的一种数据存储方法, 应用于存储引擎, 存储引擎的内存存储器中实设 置有临时缓存区, 用于缓存闪存存储器中至少部分处于局部编程状态的存储块中的数据, 该 方法包括:
S901: 响应写请求, 将待存储数据写入闪存存储器中处于局部编程状态或空闲状态的第 二存储块;
S902: 将待存储数据写入临时缓存区中以缓存第二存储块中的数据, 其中, 第二存储块 属于目标存储块。 在一可选实施例 中, 响应写请求, 将待存储数据写入闪存存储器中处于局部编程状态或 空闲状态的第二存储块, 包括: 在闪存存储器采用互联接口 ZNS接口的情况下, 从闪存存储 器提供的多个闪存区中选择处于局部编程状态或空闲状态的闪存区作为第二存储块; 将第二 存储块的标识和待存储数据发送给内存存储器中的存储控制器, 以使存储控制器将待存储数 据写入第二存储块中; 在闪存存储器采用块设备接口的情况下, 将待存储数据发送给闪存存 储器中的存储控制器, 以使存储控制器从闪存存储器提供的多个擦除块中, 选择处于局部编 程状态或空闲状态的擦除块作为第二存储块并将待存储数据写入第二存储块中。 关于本实施例方法 中各步骤的详细实施方式 以及有益效果已经在前述实 施例中进行 了详细描述 , 此处将不做详细阐述说明。 需要说明的是, 上述实施例所提供方法的各步骤的执行主体均可以是同一设备, 或者, 该方法也由不同设备作为执行主体。 比如, 步骤 801至步骤 803的执行主体可以为设备 A; 又比如, 步骤 801和 802的执行主体可以为设备 A, 步骤 803的执行主体可以为设备 B; 等 等。 另外, 在上述实施例及附图中的描述的一些流程中, 包含了按照特定顺序出现的多个操 作, 但是应该清楚了解, 这些操作可以不按照其在本文中出现的顺序来执行或并行执行, 操 作的序号如 801、 802等, 仅仅是用于区分开任意一个不同的操作, 序号本身不代表任何的执 行顺序。 另外, 这些流程可以包括更多或更少的操作, 并且这些操作可以按顺序执行或并行 执行。 需要说明的是, 本文中的 “第一”、 “第二 ”等描述, 是用于区分不同的消息、 设备、 模 块等, 不代表先后顺序, 也不限定 “第一 ”和 “第二 ”是不同的类型。 图 10为本公开一示例性实施例提供的一种电子设备的结构示意图。 由图 8可知, 该电子 设备包括: 存储器 104、 处理器 105。 存储器 104, 用于存储计算机程序, 并可被配置为存储其它各种数据以支持在计算 平台上的操 作。 这些数据的示例包括用于在计算平台上操作 的任何应用程序或方法 的指
令, 联系人数据, 电话簿数据, 消息, 图片, 视频等。 存储器 104可以由任何类型的易失性或非易失性存储设备或 者它们的组合实现, 如 静态随机存 取存储器 (SRAM) , 电可擦除可编程只读存储器 (EEPROM) , 可擦除可 编程只读存储 器 (EPROM) , 可编程只读存储器 (PROM) , 只读存储器 (ROM) , 磁 存储器, 快闪存储器, 磁盘或光盘。 处理器 105 , 与存储器 104耦合, 用于执行存储器 104中的计算机程序, 以用于: 响应读请求 , 查询所述临时缓存区中是否包含待读取数据 ; 在所述临时缓存区中包含待 读取数据 的情况下, 从所述临时缓存区中读取所述待读取数 据; 在所述临时缓存区中未 包含所述待 读取数据的情况下, 从所述闪存存储器中的第一 存储块中读取所述待读 取数 据, 其中, 所述第一存储块为所述闪存存储器中处于所述局 部编程状态或完全编程状 态 的存储块 。 在一可选实施例中, 处理器 105 , 还用于: 响应写请求, 将待存储数据写入所述闪 存存储器 中处于所述局部编程状态 或空闲状态的第二存储块 ; 将所述待存储数据写入所 述临时缓存 区中以缓存所述第二存储 块中的数据, 其中, 所述第二存储块属于目标存储 块。 在一可选实施例中, 处理器 105在响应写请求, 将待存储数据写入所述闪存存储器 中处于所述 局部编程状态或空闲状态 的第二存储块时, 具体用于: 在所述闪存存储器采 用 ZNS接口的情况下, 响应所述写请求, 从所述闪存存储器提供的多个闪存区中, 选择 处于所述局 部编程状态或所述空 闲状态的闪存区作为所述第 二存储块; 将所述第二存储 块的标识和 所述待存储数据发送给所 述内存存储器中的存储 控制器, 以使所述存储控制 器将所述待 存储数据写入所述第二存 储块中; 在所述闪存存储器采用块设备接 口的情况 下, 响应所述写请求, 将所述待存储数据发送给所述闪存存储 器中的存储控制器, 以使 所述存储控 制器从所述闪存存储器 提供的多个擦除块中, 选择处于所述局部编程状态 或 所述空 闲状态的擦除块作 为所述第二存储 块并将所述待存 储数据写入所 述第二存储块 中。 在一可选实施例中, 处理器 105 , 还用于: 针对在所述临时缓存区中缓存数据的任 一存储块 , 在所述任一存储块从所述局部编程状态进入所述 完全编程状态的情况下 , 将 所述临时缓存 区中缓存的所述任一存储块 中的数据删除。 在一可选实施例中, 处理器 105 , 还用于: 针对所述任一存储块, 创建与所述任一 存储块适配 的虚拟缓存块;在所述临时缓存区中缓存所 述任一存储块中的数据 的情况下, 在所述虚拟 缓存块中记录所述任一存 储块在所述临时缓存 区中缓存的数据信息, 并通过 所述虚拟缓 存块的读写状态维护所述 任一存储块的编程状态 ; 其中, 所述虚拟缓存块的 可写状态 和只读状态分 别对应所述任一存 储块的所述局 部编程状态和所 述完全编程状 在一可选实施例中, 处理器 105在针对所述任一存储块 , 创建与所述任一存储块适 配的虚拟缓存 块时, 具体用于: 在所述闪存存储器采用 ZNS接口的情况下, 在向所述闪
存存储器 中存储数据过程中, 将每次启用的所述闪存存储器 中处于空闲状态的存储块 作 为所述任一 存储块, 并创建与所述任一存储块适配的所述虚拟 缓存块, 其中, 被启用的 所述存储块 从所述空闲状态进入局部可编 程状态; 在所述闪存存储器采用块设备接 口的 情况下, 在向所述闪存存储器中存储 数据的过程中, 在开始向所述临时缓存区中缓存 数 据的情况 下, 创建首个所述虚拟缓存块, 每当所述临时缓存区中缓存的数据量达到 目标 阈值时, 创建下一个所述虚拟缓存块 ; 其中, 所述临时缓存区中缓存的数据量达到目标 阈值用于表示 所述闪存存储器中一个所述 存储块被写满。 在一可选实施例中, 处理器 105在通过所述虚拟缓存块 的读写状态维护所述任一存 储块的编程状 态时, 具体用于: 在所述闪存存储器采用 ZNS接口的情况下, 在被启用的 所述存储块 处于所述局部编程状态 的情况下, 标记所述虚拟缓存块为可写状态; 在被启 用的所述存 储块从所述局部编程状态 进入所述完全编程状态 的情况下, 标记所述虚拟缓 存块为所述 只读状态; 在所述闪存存储器采用所述块设备接 口的情况下, 针对任一虚拟 缓存块, 在创建时标记所述任一虚拟 缓存块为所述可写状态 , 并在所述临时缓存区中缓 存的数据量达 到所述目标阈值的情况下 , 标记所述任一虚拟缓存块为所述只读状态。 在一可选实施例中, 处理器 105在所述任一存储块从所述局 部编程状态进入所述完 全编程状态 的情况下, 将所述临时缓存区中缓存的所述任一 存储块中的数据删除时 , 具 体用于: 在所述闪存存储器采用 ZNS接 口的情况下, 监测所述任一虚拟缓存块的读写状 态, 在所述任一虚拟缓存块为所述 只读状态的情况下, 根据所述任一虚拟缓存块 中记录 的所述数据 信息, 将所述临时缓存区中缓存的所述任一虚拟 缓存块对应存储块中 的数据 删除; 在所述闪存存储器采用所述块设备 接口的情况下, 监测连续 N个虚拟缓存块的读 写状态, 在所述连续 N个虚拟缓存块均为所 述只读状态的情况下, 根据所述连续 N个虚 拟缓存块 中最早虚拟缓存块中记录 的所述数据信息, 将所述临时缓存区中缓存的所述 最 早虚拟缓存块 对应存储块中的数据删除 , 其中, N为大于或等于 2的自然数。 在一可选实施例中, 处理器 105 , 还用于: 在所述闪存存储器采用 ZNS接口的情况 下, 统计对处于所述完全编程状态 的存储块的读次数; 当所述读次数达到设定次数 阈值 的情况下 , 将所述处于完全编程状态的存储块中的数据搬移 到所述闪存存储器中处 于空 闲状态的另一存 储块中。 进一步 , 如图 10所示, 该电子设备还包括: 通信组件 106、 显示器 107、 电源组件 108、 音频组件 109等其它组件。 图 10中仅示意性给出部分组件, 并不意味着电子设备只包括图 10所示组件 。 另外, 图 10中虚线框内的组件为可选组件, 而非必选组件, 具体可视工作节 点的产品形态而定。 本实施例的工作节点可以实现为台式电脑、 笔记本电脑、 智能手机或物 联网 (Internet of Things, 简称为 I0T) 设备等终端设备, 也可以是常规服务器、 云服务器或 服务器阵列等服务端设备。 若本实施例的工作节点实现为台式电脑、 笔记本电脑、 智能手机 等终端设备, 可以包含图 10中虚线框内的组件; 若本实施例的工作节点实现为常规服务器、 云服务器或服务器阵列等服务端设备, 则可以不包含图 10中虚线框内的组件。 本公开实施例还提供一种 电子设备,该电子设备的实现结构与图 10所示电子设备的实现
结构相同或类似, 可参照图 10所示电子设备的结构实现。 本实施例提供的电子设备与图 10 所示实施例中电子设备的区别主要在于: 所述电子设备中的处理器执行存储器中存储的计算 机程序所实现的功能不同。 对本实施例提供的电子设备来说, 其处理器执行存储器中存储的 计算机程序, 可用于: 响应写请求, 将待存储数据写入所述闪存存储器中处于局部编程状态 或空闲状态的第二存储块; 将所述待存储数据写入所述临时缓存区中以缓存所述第二存储块 中的数据, 其中, 所述第二存储块属于目标存储块。 在一可选实施例 中, 处理器在响应写请求, 将待存储数据写入所述闪存存储器中处于局 部编程状态或空闲状态的第二存储块时, 具体用于: 在所述闪存存储器采用 ZNS接口的情况 下, 从所述闪存存储器提供的多个闪存区中选择处于所述局部编程状态或所述空闲状态的闪 存区作为所述第二存储块; 将所述第二存储块的标识和所述待存储数据发送给所述内存存储 器中的存储控制器, 以使所述存储控制器将所述待存储数据写入所述第二存储块中; 在所述 闪存存储器采用块设备接口的情况下, 将所述待存储数据发送给所述闪存存储器中的存储控 制器, 以使所述存储控制器从所述闪存存储器提供的多个擦除块中, 选择处于所述局部编程 状态或所述空闲状态的擦除块作为所述第二存储块并将所述待存储数据写入所述第二存储块 中。 关于本实施例方法 中各步骤的详细实施方式 以及有益效果已经在前述实 施例中进行 了详细描述 , 此处将不做详细阐述说明。 相应地 , 本公开实施例还提供一种存储有计算机程序的计算机可读存储介质, 当所述计 算机程序被处理器执行时, 致使处理器能够实现以上所述方法中的步骤。 本公开实施例还提供一种计算机程序产 品, 该计算机程序产品包括计算机程序 /指令, 当 计算机程序 /指令被处理器执行时, 致使处理器能够实现上述方法实施例中的步骤。 本公开实施例还提供一种计算机程序产 品, 包括非易失性计算机可读存储介质, 非易失 性计算机可读存储介质用于存储计算机程序, 当计算机程序被处理器执行时实现上述方法实 施例中的步骤。 上述存储器可 以由任何类型的易失性或非易失性存储设备或者它们的组合实现, 如静态 随机存取存储器 (Static Random- Access Memory, 简称为 SRAM) , 电可擦除可编程只读存 储器 (Electrically Erasable Programmable Read Only Memory, 简称为 EEPROM) , 可擦除可 编程只读存储器 (Erasable Programmable Read Only Memory, 简称为 EPROM) , 可编程只读 存储器(Programmable Read-Only Memory,简称为 PROM) ,只读存储器(Read-Only Memory, 简称为 ROM) , 磁存储器, 快闪存储器, 磁盘或光盘。 上述通信组件被配置为便于通信组件所在设备和其他设备之 间有线或无线方式的通信。 通信组件所在设备可以接入基于通信标准的无线网络 (比如 WiFi, 2G、 3G、 4G/LTE、 5G等 移动通信网络, 或它们的组合) 。 在一个示例性实施例中, 通信组件经由广播信道接收来自 外部广播管理系统的广播信号或广播相关信息。 在一个示例性实施例中, 通信组件还包括近 场通信 (Near Field Communication, 简称为 NFC)模块, 以促进短程通信。 例如, 在 NFC模 块可基于射频识别(Radio Frequency Identification,简称为 RFID)技术,红外数据协会( Infrared
Data Association, 简称为 IrDA)技术, 超宽带 (Ultra Wide Band, 简称为 UWB)技术, 蓝牙 (BlueTooth, 简称为 BT) 技术和其他技术来实现。 上述 显示器包括屏幕,其屏幕可以包括液晶显示器( Liquid Crystal Display,简称为 LCD) 和触摸面板 (TouchPanel, 简称为 TP) 。 如果屏幕包括触摸面板, 屏幕可以被实现为触摸屏, 以接收来自用户的输入信号。 触摸面板包括一个或多个触摸传感器以感测触摸、 滑动和触摸 面板上的手势。 触摸传感器可以不仅感测触摸或滑动动作的边界, 而且还检测与触摸或滑动 操作相关的持续时间和压力。 上述 电源组件, 为电源组件所在设备的各种组件提供电力。 电源组件可以包括电源管理 系统, 一个或多个电源, 及其他与为电源组件所在设备生成、 管理和分配电力相关联的组件。 上述音频组件 , 可被配置为输出和 /或输入音频信号。 例如, 音频组件包括一个麦克风 (Microphone, 简称为 MIC) , 当音频组件所在设备处于操作模式, 如呼叫模式、 记录模式 和语音识别模式时, 麦克风被配置为接收外部音频信号。 所接收的音频信号可以被进一步存 储在存储器或经由通信组件发送。 在一些实施例中, 音频组件还包括一个扬声器, 用于输出 音频信号。 本领域 内的技术人员应明白, 本公开的实施例可提供为方法、 系统、 或计算机程序产品。 因此, 本公开可采用完全硬件实施例、 完全软件实施例、 或结合软件和硬件方面的实施例的 形式。 而且, 本公开可采用在一个或多个其中包含有计算机可用程序代码的计算机可读存储 介质 (包括但不限于磁盘存储器、 只读光盘 (Compact Disc Read-Only Memory, 简称为 CD-ROM ) . 光学存储器等) 上实施的计算机程序产品的形式。 本 公开是参照根据本公开实施例的方法、 设备 (系统) 、 和计算机程序产品的流程图和 /或方框图来描述的。 应理解可由计算机程序指令实现流程图和 /或方框图中的每一流程和 /或方框、 以及流程图和 /或方框图中的流程和/或方框的结合。 可提供这些计算机程序指 令到通用计算机、 专用计算机、 嵌入式处理机或其他可编程数据处理设备的处理器以产生一 个机器, 使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流 程图一个流程或多个流程和 /或方框图一个方框或多个方框中指定的功能的装置。 这些计算机程序指令也可存储在 能引导计算机或其他可编程数据处理设备以特定方式工 作的计算机可读存储器中, 使得存储在该计算机可读存储器中的指令产生包括指令装置的制 造品, 该指令装置实现在流程图一个流程或多个流程和 /或方框图一个方框或多个方框中指 定的功能。 这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上 , 使得在计算机或 其他可编程设备上执行一系列操作步骤以产生计算机实现的处理, 从而在计算机或其他可编 程设备上执行的指令提供用于实现在流程图一个流程或多个流程和 /或方框图一个方框或多 个方框中指定的功能的步骤。 在一个典 型的配置中, 计算设备包括一个或多个处理器、 输入 /输出接口、 网络接口和内 存。 内存可能包括计算机可读介质中的非永久性存储器, 随机存取存储器 (Random Access
Memory, 简称为 RAM) 和 /或非易失性内存等形式, 如只读存储器 (ROM) 或闪存(flash RAM ) o 内存是计算机可读介质的示例。 计算机可读介质包括永久性和非永久性 、 可移动和非可移动媒体可以由任何方法或技术 来实现信息存储。 信息可以是计算机可读指令、 数据结构、 程序的模块或其他数据。 计算机 的存储介质的例子包括, 但不限于相变内存 (Phase-change Random Access Memory, 简称为 PRAM )、静态随机存取存储器 (SRAM)、动态随机存取存储器 (Dynamic Random Access Memory, 简称为 DRAM)、 其他类型的随机存取存储器 (RAM)、 只读存储器 (ROM) 、 电可擦除可编程只读存储器 (EEPROM)、 快闪记忆体或其他内存技术、 只读光盘只读存储 器 (CD-ROM) 、 数字多功能光盘 (Digital Video Disc, 简称为 DVD) 或其他光学存储、 磁盒式磁带, 磁带磁盘存储或其他磁性存储设备或任何其他非传输介质, 可用于存储可以被 计算设备访问的信息。 按照本文中的界定, 计算机可读介质不包括暂存电脑可读媒体
(transitory media) , 如调制的数据信号和载波。 还 需要说明的是, 术语“包括”、 “包含”或者其任何其他变体意在涵盖非排他性的包含, 从而使得包括一系列要素的过程、 方法、 商品或者设备不仅包括那些要素, 而且还包括没有 明确列出的其他要素, 或者是还包括为这种过程、 方法、 商品或者设备所固有的要素。 在没 有更多限制的情况下, 由语句 “包括一个 ..... ”限定的要素, 并不排除在包括要素的过程、 方 法、 商品或者设备中还存在另外的相同要素。 以上仅为本公开的实施例而已, 并不用于限制本公开。 对于本领域技术人员来说, 本公 开可以有各种更改和变化。 凡在本公开的精神和原理之内所作的任何修改、 等同替换、 改进 等, 均应包含在本公开的权利要求范围之内。 工业实用性 本 公开实施例提供的方案可以应用于数据的读取和存储过程中, 响应读请求, 查询所述 临时缓存区中是否包含待读取数据; 在所述临时缓存区中包含待读取数据的情况下, 从所述 临时缓存区中读取所述待读取数据; 在所述临时缓存区中未包含所述待读取数据的情况下, 从所述闪存存储器中的第一存储块中读取所述待读取数据, 其中, 所述第一存储块为所述闪 存存储器中处于所述局部编程状态或完全编程状态的存储块。 响应写请求, 将待存储数据写 入所述闪存存储器中处于局部编程状态或空闲状态的第二存储块; 将所述待存储数据写入所 述临时缓存区中以缓存所述第二存储块中的数据, 其中, 所述第二存储块属于目标存储块, 进而解决了在闪存存储 器内部处于局部编程状态 的存储块存在的读干扰问题 。
Claims
1.一种闪存存储系统, 包括: 存储引擎、 内存存储器以及闪存存储器, 在所述内存 存储器 中设置有临时缓存区, 用于缓存所述闪存存储器 中至少部分处于局部编程状态 的 存储块中 的数据; 所述存储引擎, 用于响应读请求, 在所述临时缓存区中包含待读取数据 的情况下, 从所述临 时缓存区中读取所述待读 取数据; 在所述临时缓存区中未包含所述待读取数 据 的情况下 , 从所述闪存存储器中的第一存储块中读取所述待 读取数据, 其中, 所述第一 存储块为在所 述闪存存储器中处于所述局 部编程状态或完全编程状态 的存储块。
2.根据权利要求 1 所述的系统, 其中, 所述存储引擎还用于: 针对在所述临时缓存 区中缓存数 据的任一存储块, 在所述任一存储块从所述局部 编程状态进入所述完全编 程 状态的情况 下, 将所述临时缓存区中缓存的所述任一存储块中的数据 删除。
3.根据权利要求 1-2任一项所述的系统, 其中, 所述存储引擎还用于: 在所述闪存存储器采用互 联接口 ZNS接口的情况下 , 统计对处于所述完全编程状态 的存储块 的读次数; 当所述读次数达到设定 次数阈值的情况下, 将处于所述完全编程状态 的存储块中的 数据搬移到所 述闪存存储器中处于空 闲状态的另一存储块中。
4.一种数据读取方法, 应用于存储引擎, 所述存储引擎的内存存储器中设置有 临时 缓存区, 用于缓存闪存存储器中至 少部分处于局部编程状态 的存储块中的数据, 所述方 法包括: 响应读请求, 查询所述临时缓存区中是否包含待读取数 据; 在所述临时缓存区 中包含待读取数据的情况下 , 从所述临时缓存区中读取所述待读 取数据; 在所述临时缓存区 中未包含所述待读取数据 的情况下, 从所述闪存存储器中的第一 存储块 中读取所述待读取数据, 其中, 所述第一存储块为所述闪存存储器中处于所述 局 部编程状态 或完全编程状态的存储块 。
5.根据权利要求 4所述的方法, 其中, 还包括: 响应写请求, 将待存储数据写入所述闪存存储器 中处于所述局部编程状态 或空闲状 态的第二存储 块; 将所述待存储数据写入 所述临时缓存区中 以缓存所述第二存储块中的数 据, 其中, 所述第二存储 块属于目标存储块。
6.根据权利要求 5 所述的方法, 其特征在于, 响应写请求, 将待存储数据写入所述 闪存存储器 中处于所述局部编程状态或 空闲状态的第二存储块, 包括: 在所述闪存存储器采用互 联接口 ZNS接口的情况下 , 响应所述写请求, 从所述闪存 存储器提供 的多个闪存区中, 选择处于所述局部编程状态或 所述空闲状态的闪存 区作为
所述第二存 储块; 将所述第二存储块的标识和所述待存储数 据发送给所述内存存储器 中 的存储控制器 , 以使所述存储控制器将所述待存储数据写入所述第二 存储块中; 在所述闪存存储器采用 块设备接口的情况下 , 响应所述写请求, 将所述待存储数据 发送给所述 闪存存储器中的存储控 制器, 以使所述存储控制器从所述闪存存储器提供 的 多个擦除块 中, 选择处于所述局部编程状态或所述空闲状态 的擦除块作为所述第二存 储 块并将所述待 存储数据写入所述第二存储 块中。
7.根据权利要求 4所述的方法, 其中, 还包括: 针对在所述临时缓存 区中缓存数据的任一存储块 , 在所述任一存储块从所述局部编 程状态进入 所述完全编程状态的情 况下, 将所述临时缓存区中缓存的所述任一存储块 中 的数据删除 。
8.根据权利要求 7所述的方法, 其中, 还包括: 针对所述任一存储块, 创建与所述任一存储块适配 的虚拟缓存块; 在所述临时缓存区 中缓存所述任一存储块中 的数据的情况下, 在所述虚拟缓存块中 记录所述任 一存储块在所述临时缓存 区中缓存的数据信息 , 并通过所述虚拟缓存块的读 写状态维护所 述任一存储块的编程状态 ; 其中, 所述虚拟缓存块的可写状态和只读状态 分别对应所述任一存储块 的所述局部 编程状态和所 述完全编程状态。
9.根据权利要求 8 所述的方法, 其中, 针对所述任一存储块, 创建与所述任一存储 块适配的虚拟 缓存块, 包括: 在所述闪存存储器采用 ZNS接口的情况下,在向所述闪存存储器中存储数据过程 中, 将每次启用 的所述闪存存储器中处于 空闲状态的存储块作为所 述任一存储块, 并创建与 所述任一存 储块适配的所述虚拟缓存 块, 其中, 被启用的所述存储块从所述空闲状态进 入局部可编程 状态; 在所述闪存存储器采用 块设备接口的情况下 , 在向所述闪存存储器中存储数据的过 程中, 在开始向所述临时缓存区 中缓存数据的情况下, 创建首个所述虚拟缓存块 , 每当 所述临时缓 存区中缓存的数据量达 到目标阈值时, 创建下一个所述虚拟缓存块; 其中, 所述临时缓 存区中缓存的数据量达 到目标阈值用于表示所述 闪存存储器中一个所述存 储 块被写满 。
10.根据权利要求 9所述的方法, 其中, 通过所述虚拟缓存块的读写状态维护所述任 一存储块 的编程状态, 包括: 在所述闪存存储器采用 ZNS接口的情况下, 在被启用的所述存储块处于所述局部编 程状态的情 况下, 标记所述虚拟缓存块为可写状态; 在被启用的所述存储块从所述局 部 编程状态进入 所述完全编程状态的情况 下, 标记所述虚拟缓存块为所述只读状态; 在所述闪存存储器采用 所述块设备接口的情况 下, 针对任一虚拟缓存块, 在创建时 标记所述任 一虚拟缓存块为所述可 写状态, 并在所述临时缓存区中缓存的数据量达 到所 述目标阈值 的情况下, 标记所述任一虚拟缓存块为所述只读状态 。
11.根据权利要求 10 所述的方法, 其中, 在所述任一存储块从所述局部编程状态进 入所述完全 编程状态的情况下, 将所述临时缓存区中缓存 的所述任一存储块中的数据 删 除, 包括: 在所述闪存存储器采用 ZNS接口的情况下, 监测所述任一虚拟缓存块的读写状态 , 在所述任一 虚拟缓存块为所述只读状 态的情况下, 根据所述任一虚拟缓存块中记录 的所 述数据信息 ,将所述临时缓存区中缓存的所述任一虚 拟缓存块对应存储块中的数 据删除; 在所述闪存存储器采用所 述块设备接口的情况下, 监测连续 N个虚拟缓存块 的读写 状态, 在所述连续 N个虚拟缓存块均为所述 只读状态的情况下, 根据所述连续 N个虚拟 缓存块 中最早虚拟缓存块中记录 的所述数据信息, 将所述临时缓存区中缓存的所述 最早 虚拟缓存块对 应存储块中的数据删除 , 其中, N为大于或等于 2的自然数。
12.根据权利要求 4-11任一项所述的方法, 其中, 还包括: 在所述闪存存储器采用 ZNS接口的情况下, 统计对处于所述完全编程状态的存储块 的读次数 ; 当所述读次数达到设定 次数阈值的情况下, 将处于所述完全编程状态 的存储块中的 数据搬移到所 述闪存存储器中处于空 闲状态的另一存储块中。
13.一种数据存储方法, 应用于存储引擎, 所述存储引擎的内存存储器中设置有临时 缓存区, 用于缓存闪存存储器中至 少部分处于局部编程状态 的存储块中的数据, 所述方 法包括: 响应写请求, 将待存储数据写入所述闪存存储器 中处于局部编程状态或 空闲状态的 第二存储块 ; 将所述待存储数据写入 所述临时缓存区中 以缓存所述第二存储块中的数 据, 其中, 所述第二存储 块属于目标存储块。
14.根据权利要求 13 所述的方法, 其中, 响应写请求, 将待存储数据写入所述闪存 存储器中处 于局部编程状态或空闲状态 的第二存储块, 包括: 在所述闪存存储器采用互 联接口 ZNS接口的情况下 , 从所述闪存存储器提供的多个 闪存区 中选择处于所述局部编程状态 或所述空闲状态的闪存 区作为所述第二存储块 ; 将 所述第二存 储块的标识和所述待存储 数据发送给所述内存存 储器中的存储控制器 , 以使 所述存储控 制器将所述待存储数据写入所 述第二存储块中; 在所述闪存存储器采用 块设备接口的情况下 , 将所述待存储数据发送给所述闪存存 储器中的存 储控制器, 以使所述存储控制器从所述闪存存储 器提供的多个擦除块 中, 选 择处于所述 局部编程状态或所述空 闲状态的擦除块作为所述 第二存储块并将所述待存 储 数据写入所述 第二存储块中。
15.一种电子设备, 包括: 存储器和处理器; 所述存储器, 用于存储计算机程序, 所 述处理器与 所述存储器耦合, 用于执行所述存储器中的计算机 程序, 以用于实现权利要
求 4-14任一项所述方法中的步骤。
16.一种存储有计算机程序 /指令的计算机可读存储介质,当所述计算机程序被处理器 执行时, 致使所述处理器能够实现权利 要求 4-14中任一项所述方法中的步骤。
17.一种计算机程序产品, 包括: 计算机程序 /指令, 当所述计算机程序 /指令被处理 器执行时 , 致使所述处理器能够实现权利要求 4-14中任一项所述方法中的步骤。
18.一种计算机程序产品, 包括非易失性计算机可读存储介质, 所述非易失性计算机 可读存 储介质用于存储 计算机程序, 当所述计算机程序被处理器执行时 实现权利要求 4-14中任一项所述方法 中的步骤。
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410750036.5A CN121116157A (zh) | 2024-06-11 | 2024-06-11 | 数据读取与存储方法、设备、系统、存储介质及程序产品 |
| CN202410750036.5 | 2024-06-11 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2025257616A1 true WO2025257616A1 (zh) | 2025-12-18 |
Family
ID=97940183
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/IB2025/051392 Pending WO2025257616A1 (zh) | 2024-06-11 | 2025-02-11 | 数据读取与存储方法、设备、系统、存储介质及程序产品 |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN121116157A (zh) |
| WO (1) | WO2025257616A1 (zh) |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101256536A (zh) * | 2007-03-01 | 2008-09-03 | 创惟科技股份有限公司 | 闪存地址转换层系统 |
| CN110750466A (zh) * | 2019-10-18 | 2020-02-04 | 深圳豪杰创新电子有限公司 | 提高闪存擦写寿命的方法和装置 |
| CN115061635A (zh) * | 2022-06-30 | 2022-09-16 | 苏州忆联信息系统有限公司 | 固态硬盘闪存块读取次数压缩的方法、装置、计算机设备及存储介质 |
| CN116700609A (zh) * | 2023-04-27 | 2023-09-05 | 福建新大陆通信科技股份有限公司 | 一种nand闪存寿命提升方法 |
| CN117420965A (zh) * | 2023-12-18 | 2024-01-19 | 合肥康芯威存储技术有限公司 | 一种存储器及其控制方法 |
-
2024
- 2024-06-11 CN CN202410750036.5A patent/CN121116157A/zh active Pending
-
2025
- 2025-02-11 WO PCT/IB2025/051392 patent/WO2025257616A1/zh active Pending
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101256536A (zh) * | 2007-03-01 | 2008-09-03 | 创惟科技股份有限公司 | 闪存地址转换层系统 |
| CN110750466A (zh) * | 2019-10-18 | 2020-02-04 | 深圳豪杰创新电子有限公司 | 提高闪存擦写寿命的方法和装置 |
| CN115061635A (zh) * | 2022-06-30 | 2022-09-16 | 苏州忆联信息系统有限公司 | 固态硬盘闪存块读取次数压缩的方法、装置、计算机设备及存储介质 |
| CN116700609A (zh) * | 2023-04-27 | 2023-09-05 | 福建新大陆通信科技股份有限公司 | 一种nand闪存寿命提升方法 |
| CN117420965A (zh) * | 2023-12-18 | 2024-01-19 | 合肥康芯威存储技术有限公司 | 一种存储器及其控制方法 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN121116157A (zh) | 2025-12-12 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11803325B2 (en) | Specifying media type in write commands | |
| US8521949B2 (en) | Data deleting method and apparatus | |
| CN106326133B (zh) | 存储系统、存储管理装置、存储器、混合存储装置及存储管理方法 | |
| US9817765B2 (en) | Dynamic hierarchical memory cache awareness within a storage system | |
| CN112783420B (zh) | 数据删除与垃圾回收方法、设备、系统及存储介质 | |
| GB2511325A (en) | Cache allocation in a computerized system | |
| US11144224B2 (en) | Locality-aware, memory-efficient, time-efficient hot data identification using count-min-sketch for flash or streaming applications | |
| US12197318B2 (en) | File system integration into data mining model | |
| TWI873412B (zh) | 執行嵌入式多媒體卡命令的方法及電腦程式產品及裝置 | |
| CN103631536A (zh) | 一种利用ssd的无效数据优化raid5/6写性能的方法 | |
| CN115421651A (zh) | 固态硬盘的数据处理方法、固态硬盘、电子设备及介质 | |
| CN110321057A (zh) | 具有增强io性能确定性的缓存的存储设备 | |
| CN109164976A (zh) | 利用写缓存优化存储设备性能 | |
| CN103530236A (zh) | 一种混合硬盘的实现方法及装置 | |
| WO2021088587A1 (zh) | 数据访问方法、装置及存储介质 | |
| CN108664217B (zh) | 一种降低固态盘存储系统写性能抖动的缓存方法及系统 | |
| CN119512984A (zh) | 高效利用存储设备中缓存prp的缓存单元的方法 | |
| CN107577492A (zh) | 加速文件系统读写的nvm块设备驱动方法及系统 | |
| CN110515861B (zh) | 处理刷写命令的存储设备及其方法 | |
| CN115934002B (zh) | 固态硬盘的访问方法、固态硬盘、存储系统及云服务器 | |
| TW202141280A (zh) | 管理資料儲存的方法及裝置以及電腦程式產品 | |
| CN121116157A (zh) | 数据读取与存储方法、设备、系统、存储介质及程序产品 | |
| CN115480697A (zh) | 数据处理方法、装置、计算机设备及存储介质 | |
| CN110580128B (zh) | 使用缓存反馈信息指导数据预读 | |
| KR102065033B1 (ko) | 메모리 상에서 고속 데이터 저장 및 복원 방법 및 이러한 방법을 수행하는 메모리 |
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: 25821432 Country of ref document: EP Kind code of ref document: A1 |