WO2018188618A1 - 固态硬盘访问 - Google Patents

固态硬盘访问 Download PDF

Info

Publication number
WO2018188618A1
WO2018188618A1 PCT/CN2018/082740 CN2018082740W WO2018188618A1 WO 2018188618 A1 WO2018188618 A1 WO 2018188618A1 CN 2018082740 W CN2018082740 W CN 2018082740W WO 2018188618 A1 WO2018188618 A1 WO 2018188618A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
sector
cache
strip
flash memory
Prior art date
Application number
PCT/CN2018/082740
Other languages
English (en)
French (fr)
Inventor
姚少钦
Original Assignee
紫光华山信息技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 紫光华山信息技术有限公司 filed Critical 紫光华山信息技术有限公司
Priority to EP18785096.1A priority Critical patent/EP3598290B1/en
Priority to JP2019556277A priority patent/JP6823734B2/ja
Priority to US16/604,984 priority patent/US11126377B2/en
Publication of WO2018188618A1 publication Critical patent/WO2018188618A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/061Improving I/O performance
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • G06F3/0659Command handling arrangements, e.g. command buffers, queues, command scheduling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0238Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory
    • G06F12/0246Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory in block erasable memory, e.g. flash memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0804Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches with main memory updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0866Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches for peripheral storage systems, e.g. disk cache
    • G06F12/0868Data transfer between cache memory and other subsystems, e.g. storage devices or host systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0866Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches for peripheral storage systems, e.g. disk cache
    • G06F12/0873Mapping of cache memory to specific storage devices or parts thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/10Address translation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0604Improving or facilitating administration, e.g. storage management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • G06F3/0658Controller construction arrangements
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/068Hybrid storage device
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0683Plurality of storage devices
    • G06F3/0688Non-volatile semiconductor memory arrays
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/10Providing a specific technical effect
    • G06F2212/1008Correctness of operation, e.g. memory ordering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/10Providing a specific technical effect
    • G06F2212/1016Performance improvement
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/10Providing a specific technical effect
    • G06F2212/1032Reliability improvement, data loss prevention, degraded operation etc
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/21Employing a record carrier using a specific recording technology
    • G06F2212/214Solid state disk
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/26Using a specific storage system architecture
    • G06F2212/261Storage comprising a plurality of storage devices
    • G06F2212/262Storage comprising a plurality of storage devices configured as RAID
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/72Details relating to flash memory management
    • G06F2212/7208Multiple device management, e.g. distributing data over multiple flash devices

Definitions

  • SSD Solid State Disk
  • controller operates multiple flash memories in parallel using multiple physical channels.
  • FIG. 1 is a schematic diagram of data storage comparison using a striping technique and a striping technique, which are shown in an embodiment of the present disclosure.
  • FIG. 2 is a schematic structural diagram of an SSD according to an embodiment of the present disclosure.
  • FIG. 3 is a flowchart of an SSD access method shown in an embodiment of the present disclosure.
  • FIG. 4 is a flow chart showing a write operation after receiving a write data command, according to an embodiment of the present disclosure.
  • FIG. 5 is a flow chart of a strip aging operation shown in an embodiment of the present disclosure.
  • FIG. 6 is a flow chart showing a read operation after receiving a read data command, according to an embodiment of the present disclosure.
  • FIG. 7 is a flow chart showing data recovery and migration operations when a physical channel fails, according to an embodiment of the present disclosure.
  • FIG. 8 is a schematic diagram of a hardware structure of an SSD where an SSD access device is located according to an embodiment of the present disclosure.
  • FIG. 9 is a schematic structural diagram of an SSD access apparatus according to an embodiment of the present disclosure.
  • FIG. 10 is another schematic structural diagram of an SSD access apparatus according to an embodiment of the present disclosure.
  • first, second, third, etc. may be used in the present disclosure to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other.
  • first information may also be referred to as second information without departing from the scope of the present disclosure.
  • second information may also be referred to as first information.
  • word "if” as used herein may be interpreted as "when” or “when” or “in response to a determination.”
  • Parallel data reading and writing can be performed by using multi-channel parallel technology.
  • data reading and writing is not always continuous, and in most cases, random reading and writing. This way, access violations occur when accessing flash memory mounted on the same physical channel at the same time.
  • the solution to the above access conflict problem is mainly to strip data.
  • Striping technology is an automatic technique for balancing the load of data read and write to the flash memory mounted on each physical channel.
  • data can be divided into multiple sub-data of predetermined size and stored in flash memory mounted on different physical channels, thereby enabling parallel reading and writing of data, and effective Avoid access violations.
  • flash memory has the feature that it must be erased before it can be programmed.
  • the smallest unit of erasure is a block, the smallest unit of reading and writing is a page, and a block can contain multiple pages. Therefore, when modifying the data in the flash memory, it is not possible to directly overwrite the original data with the new data. Instead, the data in the entire block needs to be read and saved into the memory, and the data to be modified is updated to be new in the memory. Data, then erase the data in the entire block, and write the modified data in the memory to the block. This will cause a write application problem with the SSD. For example, suppose that 1024 pages in a block are all filled.
  • SSDs have a large write amplification ratio, which affects the performance and service life of SSDs.
  • the SSD of the embodiment of the present disclosure includes: a controller 201, a cache 202, three or more physical channels 204, and a flash memory 203 mounted on each physical channel 204.
  • the cache 202 may be a storage space divided in the memory.
  • the SSD of the embodiment of the present disclosure can perform data reading and writing by using a multi-channel parallel technology and a striping technology.
  • the SSD access method of the embodiment of the present disclosure includes the following steps.
  • Step S301 receiving a write data command, and determining a first stripe and a first sector corresponding to an LBA (Logical Block Address) of the data to be written carried in the write data command.
  • LBA Logical Block Address
  • Each strip may include more than three sectors, and each strip includes a number of sectors equal to the number of physical channels in the SSD, and is also equivalent to the number of flash memories in the SSD. For example, when the number of physical channels in the SSD is 4, each strip contains 4 sectors.
  • step S302 it is determined whether the first strip exists in the cache. If yes, step S303 is performed; otherwise, step S304 is performed.
  • Step S303 the data to be written as the data of the first sector is written into the cache.
  • Step S304 the first strip is created, and the data to be written is written into the buffer as the data of the first sector.
  • the cache 202 is set in the SSD, and after receiving the write data command, the SSD first stores the data to be written into the cache 202.
  • the hotspot data that needs to be modified frequently, since the hotspot data can be stored in the cache 202, it is only necessary to modify the data in the cache 202 without repeatedly erasing the flash memory 203. Reduced write amplification ratio.
  • the SSD can provide a fault-tolerant mechanism by calculating redundant check data.
  • the principle is to verify the user data in each strip of the cache to obtain check data, and distribute the check data in different physical channels according to a certain rule. Mounted on the flash. In this way, when a physical channel fails, for example, the physical channel fails, or the flash failure of the physical channel is mounted, data recovery can be achieved. In addition, data recovery can also be achieved when data reading of a sector in the stripe fails.
  • a storage space can be divided in the memory as a cache for buffering data of a sector of a stripe and storing the record information of the stripe.
  • the sector size may be taken as the stripe depth, and the physical channel number N is used as the stripe width, that is, each strip may include N sectors.
  • one sector can be 4K bits in size.
  • N sectors in each strip may be numbered starting from 0, followed by sector 0, sector 1, sector 2, ..., sector N-1, and The last N2 sectors can be fixed as parity data sectors.
  • the SSD access method of the embodiment of the present disclosure includes the following.
  • the write operation performed by the SSD is as follows.
  • Step S401 after receiving the write data command sent by the host, determine a first strip and a first sector corresponding to the LBA of the data to be written carried in the write data command.
  • each LBA can be assigned to a different strip, and, from the initial value of the LBA, every N1 consecutive LBAs can be allocated to the same strip.
  • the index of the first strip corresponding to the data to be written is determined according to formula (1) and formula (2): 3 and the identifier of the first sector. :2.
  • step S402 it is determined whether there is a first strip in the cache, and if so, step S403 is performed; otherwise, step S406 is performed.
  • each Hash bucket is used to store the index of multiple stripes and the cache address of the record information.
  • the method of determining whether the first strip exists in the cache in step S402 may be as follows.
  • the hash calculation is performed on the index of the first strip and the number of physical channels N.
  • the hash calculation result is used as the bucket ID (identification), and the Hash bucket identified by the bucket ID is searched in the memory.
  • a CRC32 Cyclic Redundancy Check
  • Step S403 it is determined whether the data of the first sector is stored in the cache, and if so, step S404 is performed, otherwise, step S405 is performed;
  • the record information cache address of the first strip After the record information cache address of the first strip is obtained, the record information of the first stripe may be found in the cache, and the data of the first sector is stored in the cache according to the obtained record information. Since the data of the strip stored in the cache can be written to the flash memory when the strip is aged, and the data of a certain sector in the strip needs to be modified, the modified new data of the sector is written in the cache. Therefore, the modified data (also referred to as the latest data) of these sectors can be stored in the cache, and the pre-modification data (also referred to as old data) of the sector can also be stored in the flash memory.
  • the corresponding first mark and second mark may be set for each sector in the record information of the strip.
  • the first tag and the second tag can be combined to represent the cache and data storage conditions in the flash memory. For example, when the first mark of the sector is valid and the second mark is valid, it may indicate that the data of the sector is stored in both the cache and the flash memory, but the cache may store the latest data of the sector, and the flash memory The storage may be the old data of the sector; when the first mark of the sector is valid and the second mark is invalid, it may indicate that the data of the sector is stored in the cache, and the sector does not exist in the flash memory.
  • the cache address of the data of the sector in the cache is also recorded in the record information of the strip.
  • step S403 it can be determined whether the first flag of the first sector is valid, and if so, it is determined that the data of the first sector is stored in the buffer.
  • Step S404 updating the data of the first sector stored in the cache to the data to be written. At this time, the data to be written becomes the latest data of the first sector.
  • updating the data of the first sector stored in the cache to the data to be written may be: writing the data to be written into the cache, and recording the record information of the first stripe.
  • the cache address of the data of the first sector is updated to the cache address in which the data to be written is written into the cache, and the first flag corresponding to the first sector is maintained to be valid.
  • the cache address of the pre-update data of the first sector may also be recorded as a free address so that other data can be subsequently written at the free address.
  • the cache address of Dada A is Addr A
  • the data to be written is Dada B
  • the data of the first sector stored in the cache is Dada.
  • the method of updating A to the data to be written Dada B may be: writing Dada B into the cache, the cache address is Addr B, and the cache address of the data of the first sector recorded in the record information of the first strip is added by Addr A
  • the update is Addr B.
  • the cache address Addr A of the pre-update data Dada A of the first sector can also be recorded as a free address, so that other data can be subsequently written in Addr A.
  • step S405 the data to be written as the data of the first sector can be written into the cache.
  • the cache address of the data of the first sector may be recorded in the record information of the first strip as the cache address of the data to be written, and the first flag of the first sector is set to be valid.
  • a first stripe may be created, and the data to be written as the data of the first sector is written into the cache.
  • the cache address of the data of the first sector may be recorded in the record information of the first strip as the cache address of the data to be written, and the first flag of the first sector is set to be valid.
  • the process of creating a stripe may be: recording an index of the stripe and a cache address of the record information in a Hash bucket corresponding to the stripe, calculating a logical channel corresponding to each sector in the stripe, and recording the stripe to the stripe In the recorded information of the tape, the first mark and the second mark of each sector are set to be invalid in the record information of the strip.
  • the identifier p_logic_channel_id of the logical channel corresponding to the check data sector may be calculated according to formula (3):
  • the identifier d_logic_channel_id of the logical channel corresponding to the user data sector can be calculated according to formula (4):
  • sector_id represents the identity of the sector
  • strip_index represents the index of the strip in which the sector is located
  • % represents the modulo operator
  • the total number of logical channels in an SSD can be the same as the total number of physical channels.
  • the logical channel and the physical channel can have a one-to-one correspondence.
  • logical channel 0 may correspond to physical channel
  • logical channel 1 may correspond to physical channel 1, and so on.
  • the physical channel in the SSD may be invalid.
  • the physical channel itself is faulty or the flash memory of the channel is faulty.
  • the logical channel corresponding to the failed physical channel may be associated with other normal physical channels. .
  • the correspondence between the logical channel and the physical channel can be saved in the channel mapping table.
  • the SSD may first store the data to be written into the cache. In this way, for some hotspot data that needs to be modified frequently, it is only necessary to modify the data in the cache without repeatedly writing to the flash memory, thereby reducing the write amplification ratio of the SSD.
  • the index of the stripe is added to the aging list, and each stripe in the aging list has a corresponding priority.
  • the priority corresponding to the stripe is related to one or more combinations of parameters such as the size of the buffered storage space, the number of read/write data commands, the frequency of use of the stripe, the time of use of the stripe, and the amount of valid data of the stripe. For example, a higher frequency stripe will have a lower priority, ensuring that data that is often modified as much as possible is stored in the cache to reduce the number of erase writes to the flash. For example, one of the highest priority strips can be periodically selected from the aging list for aging.
  • the steps performed by the SSD are as shown in FIG. 5, and include the following steps.
  • Step S501 For each user data sector in the second stripe, if the data of the sector is stored in the flash memory corresponding to the sector, the data of the sector is read from the flash memory and written into the cache.
  • the data for the sector is stored in flash memory.
  • the LBA corresponding to the sector may be determined, and a PBA (Physical Block Address) corresponding to the LBA is searched in the address translation table, and the data of the sector is read from the flash memory according to the found PBA and written. Cache.
  • the first flag of the user data sector may be set to be valid, and the cache address of the data of the user data sector may be recorded in the record information of the second strip.
  • the method for determining the LBA corresponding to the sector may be: calculating the LBA corresponding to the sector according to the formula (1) and the formula (2) in the case of the index of the known strip and the identifier of the sector.
  • step S501 the data of each user data sector in the second strip is stored in the cache.
  • Step S502 performing check calculation on data of all user data sectors of the second strip stored in the cache, and obtaining check data, and writing the check data as data of the check data sector of the second strip Cache; at this time, the data of each sector (including the user data sector and the check data sector) in the second strip is stored in the cache.
  • the check data can be calculated according to the user data in the stripe.
  • Step S503 writing data of each sector of the second strip stored in the cache to the flash memory. Specifically, for each sector in the second strip, determining a logical channel corresponding to the sector, searching for a physical channel corresponding to the logical channel, reading data of the sector from the cache, and writing the physical channel Mounted flash memory, after the completion of writing, record the correspondence between LBA and PBA in the address translation table.
  • the LBA can be obtained according to the formula (1) and the formula (2) in the case of the known strip index and the sector identifier.
  • the PBA can be known after the data is written. For example, the PBA can identify The offset of the data in the block, page in the flash.
  • the second strip in the cache can also be deleted.
  • the method for deleting the second strip may be: deleting the index of the second strip recorded in the Hash bucket and the cache address of the record information, and deleting the record information of the second strip.
  • the cache address of these data can also be recorded as a free address for subsequent writing of other data.
  • the read operation performed by the SSD is as follows.
  • Step S601 after receiving the read data command sent by the host, determine a third stripe and a third sector corresponding to the LBA of the data to be read carried in the read data command.
  • step S601 the third stripe and the third sector corresponding to the LBA may be determined according to formula (1) and formula (2).
  • step S602 it is determined whether there is a third strip in the cache. If yes, step S603 is performed; otherwise, step S606 is performed.
  • Hash buckets can be created in advance in memory, and each Hash bucket is used to store indexes of multiple stripes and a cache address of record information.
  • the specific method of determining whether or not the third strip exists in the buffer in step S602 is as follows.
  • Determining whether there is a third strip index in the Hash bucket that is found if yes, determining that there is a third strip in the cache, and obtaining a cache address of the record information of the third strip from the Hash bucket; otherwise, determining There is no third strip in the cache.
  • Step S603 it is determined whether the data of the third sector is stored in the cache, and if so, step S604 is performed, otherwise, it means that the data of the third sector is stored in the flash memory, then step S606 is performed;
  • the record information of the third stripe may be found in the cache, and whether the data of the third sector is stored in the cache is determined according to the record information of the third stripe. . For example, if the first flag of the third sector recorded in the record information of the third strip is valid, it is determined that the data of the third sector is stored in the cache, otherwise, the data storage of the third sector is determined. In flash memory. However, whether the data of the third sector is stored in the flash memory or not is determined based on the second flag of the third sector recorded in the record information of the third strip.
  • the second flag of the third sector recorded in the record information of the third strip is valid, it is determined that the data of the third sector is stored in the flash memory; otherwise, it is determined that the third sector is not stored in the flash memory.
  • the data In this case, a read error may have occurred and may need to be reported to the host.
  • Step S604 the data of the third sector is read from the cache, and then step S605 is performed.
  • the cache address of the data of the third sector can be obtained in the record information of the third stripe, so that the data of the third sector can be read according to the cache address.
  • step S605 the read data is returned to the host.
  • Step S606 the data of the third sector is read from the flash memory, and then step S605 is performed.
  • the method of reading data from the flash memory may be: searching for the PBA corresponding to the LBA in the address conversion table according to the LBA of the data, and reading the data from the flash memory according to the found PBA.
  • the data of the third sector is not read from the flash memory in step S606, the data of the sector other than the third sector in the third strip is read from the flash memory, and the readout is used.
  • the data of the other sectors recovers the data of the third sector and is returned to the host.
  • the data when the data is read by the method shown in FIG. 6, if there is data to be read in the cache, the data can be read from the cache, and if there is no data to be read in the cache, the data can be read from the flash memory. The data. In this way, because the data is read from the cache faster, it can provide users with higher data read and write speeds.
  • the data stored in the flash memory mounted on the failed physical channel is restored without interrupting the service, and the strip before the failure (below)
  • the data in the old strip can also be migrated into the new strip.
  • the index of the old stripe can be recorded in the stripe recovery (strip_recover) table.
  • Step S701 reading data of the sector other than the failed sector in the old strip from the flash memory, and restoring the data of the failed sector by using the read data (including user data and check data), and the recovered data will be recovered.
  • the data is written to the cache as a failed sector.
  • the number of sectors in the old strip is equal to the number of physical channels before the failure.
  • the sector corresponding to the logical channel bound to the physical channel also fails.
  • new stripes and sectors can be re-determined based on the number of valid physical channels in the SSD.
  • the number of physical channels in the SSD is N.
  • the strip at this time is called the old strip, and the N sectors of each old strip include: N1 user data sectors and N2 checksums. Data sector.
  • the number of physical channels in the SSD is N-1.
  • the strips at this time are called new strips.
  • the N-1 sectors of each new strip may include: N1-1 User data sector and N2 parity data sectors.
  • the new stripe and the new sector corresponding to the LBA may be determined according to N1-1.
  • Step S702 for each old user data sector in the old stripe, the new stripe and the new user data sector corresponding to the LBA may be determined according to the LBA of the old user data sector. If the data of the old user data sector is stored in the cache, the data of the old user data sector can be migrated to the new user data sector in the new stripe. If the data of the old user data sector is stored in the flash memory, the data of the user data sector can be read from the flash memory and written into the cache, and the data of the old user data sector is migrated to the new stripe. The new user data sector.
  • the old stripe can be deleted, and the index of the old stripe is recorded into the strip_recover table.
  • a new stripe and a new user data sector corresponding to the LBA can be determined according to formula (1) and formula (2).
  • the manner of migrating the data of the old user data sector to the new user data sector in the new stripe may be: recording the cache address of the data of the new user data sector in the record information of the new stripe Is: the cache address of the data of the old user data sector.
  • step S702 before migrating the data of the old user data sector to the new user data sector in the new stripe, it is also necessary to determine whether the new stripe exists in the cache, if not, it is required The new strip is created first, and then the data of the old user data sector is migrated to the new user data sector in the new stripe.
  • the number of physical channels after the failure is reduced compared with that before the failure, the number of sectors in the new stripe is also smaller than the number of sectors in the old stripe. Therefore, the user data in a new stripe comes from 1 Or 2 old strips, the 1 or 2 old strips may be referred to as the old strip associated with the new strip.
  • the new strip can be added to the aging list.
  • the SSD pattern corresponding to each strip can be marked in the aging list, and the old strip corresponds to the SSD mode before the failure, for example, the SSD mode before the failure is N1+N2 mode.
  • the new strip corresponds to the SSD mode after the failure, for example, the SSD mode after the failure is (N1-1)+N2 mode.
  • the method for determining an old strip associated with a new strip may be: determining the LBA range corresponding to the new strip according to formula (1), in the case where the index of the new strip is known; for the LBA The minimum value in the range is determined according to formula (1), and the index of the corresponding first old strip is determined.
  • the index of the corresponding second old strip is determined according to formula (1);
  • the index of the old strip is the same as the index of the second old strip, and it is determined that there is only one old strip associated with the new strip, that is, the first old strip (that is, the second old strip); If the index of an old strip is different from the index of the second old strip, and the difference between the two is 1, it is determined that the old strip associated with the new strip has two, respectively, the first old strip and The second old strip.
  • the SSD receives the read data command sent by the host, the new strip corresponding to the LBA of the data to be read carried in the read data command is determined; the new one does not exist in the cache.
  • striping perform the following steps:
  • the old strip exists in the cache, when the physical channel bound to the logical channel corresponding to the old sector is normal, the data of the old sector is read from the cache or the memory and returned to the host, when the old fan When the physical channel bound to the logical channel corresponding to the zone fails, the data of the old stripe is restored and migrated;
  • the PBA corresponding to the LBA is searched in the address translation table, and the data is read from the flash according to the PBA. And returning to the host, when the physical channel bound to the logical channel corresponding to the old sector fails, the data of the old stripe is restored and migrated.
  • the data stored in the flash memory of the failed physical channel can be restored, and the data in the strip before the failure is migrated to the new strip to ensure the service.
  • the continuation of the SSD improves the fault tolerance of the SSD and improves the high availability (HA) of the service.
  • the SSD can read and write data normally, and the old and new stripes can exist in parallel.
  • the present disclosure also provides an embodiment of an SSD access device.
  • Embodiments of the disclosed SSD access device can be applied to an SSD.
  • the SSD includes: a controller 10, three or more physical channels 20, and each physical channel 20 is mounted. Flash memory 30, bus 40, and machine readable storage medium 50.
  • a storage space can be divided into a cache 70 in the machine readable storage medium 50, but this is not restrictive, and the cache 70 can have other embodiments.
  • the controller 10 can perform the SSD access method described above by reading machine executable instructions in the machine readable storage medium 50.
  • the controller 10 can be, for example, a processor such as a CPU. In the actual implementation process, other hardware may be included according to the actual function of the SSD, and details are not described herein again.
  • the machine-readable storage medium 50 herein can be any electronic, magnetic, optical, or other physical storage device that can contain or store information such as executable instructions, data, and the like.
  • the machine-readable storage medium may be a volatile storage medium or a non-volatile storage medium such as a RAM (Radom Access Memory), a flash memory, a storage drive (such as a hard disk drive), any type of storage disk. Or a combination of one or more of the foregoing.
  • the embodiment of the disclosed SSD access device 60 may be implemented by software, or may be implemented by hardware or a combination of hardware and software. Taking a software implementation as an example, as a logical means, it is formed by the controller 10 of its SSD reading and running machine executable instructions in the machine readable storage medium 50.
  • the SSD access device 60 of the embodiment of the present disclosure includes: a receiving unit 601 and a reading and writing unit 602.
  • the receiving unit 601 is configured to receive a write data command for the SSD, and determine a first stripe and a first sector corresponding to the LBA of the data to be written carried in the write data command, where the SSD includes N physical channels and Cache, each physical channel is loaded with memory, the cache includes a plurality of stripes, each strip includes N sectors, and N is an integer greater than or equal to 3.
  • the reading and writing unit 602 is configured to: if the first strip exists in the cache, write the data to be written as the data of the first sector to the cache, and if the first strip does not exist in the cache, create the first strip. The data to be written as the first sector is written to the cache.
  • the receiving unit 601 is specifically configured to determine an index strip_index and a sector identifier sector_id of the stripe corresponding to the LBA according to the following formula:
  • N1 represents the number of sectors in a strip for storing user data
  • N1 is an integer greater than 1 and less than N.
  • the SSD access device 60 further includes a calculation unit 603.
  • the reading and writing unit 602 is configured to: for each user data sector in the second strip, if the data of the sector is stored in the flash memory, the data of the sector is read from the flash memory and written into the cache.
  • the calculating unit 603 is configured to perform check calculation on data of all user data sectors of the second strip stored in the cache, to obtain check data of the check data sector of the second strip.
  • the reading and writing unit 602 writes the check data of the check data sector of the second stripe calculated by the calculating unit 603 into the cache; and is also used to write the data of all the sectors of the second strip stored in the cache to the flash memory. .
  • the reading and writing unit 602 is further configured to write data of a sector of the second strip stored in the cache into the flash memory by:
  • the logical channel corresponding to the sector is determined to include:
  • the identifier d_logic_channel_id of the logical channel corresponding to the user data sector is determined as follows:
  • the identifier p_logic_channel_id of the logical channel corresponding to the check data sector is determined as follows:
  • sector_id represents the sector identifier
  • strip_index represents the index of the strip in which the sector is located
  • % represents the modulo operator
  • the receiving unit 601 is further configured to receive a read data command for the SSD, and determine a third stripe and a third sector corresponding to the LBA of the data to be read carried in the read data command.
  • the reading and writing unit 602 is further configured to: if a third strip exists in the cache, and data of the third sector is stored in the cache, read data of the third sector from the cache as data to be read; There is a third strip, and the data of the third sector in the third strip is stored in the flash memory, or, if there is no third strip in the cache, the third read from the flash memory corresponding to the third sector The data of the sector is used as data to be read.
  • the above SSD access device 60 further includes the following units.
  • a detecting unit 604 configured to detect a state of the physical channel
  • the recovery migration unit 605 is configured to perform the following steps for the old strip in the cache when the detecting unit 604 detects that one of the N physical channels fails:
  • the recovered data is written into the cache as data of the failed sector
  • the data of the user data sector is stored in the cache, the data of the user data sector is migrated to the new user data sector in the new stripe;
  • the data of the user data sector is stored in the flash memory, the data of the user data sector is read from the flash memory and written into the cache, and the data of the user data sector is migrated to the new user in the new stripe. Data sector.
  • the device embodiment since it basically corresponds to the method embodiment, reference may be made to the partial description of the method embodiment.
  • the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, ie may be located A place, or it can be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the objectives of the present disclosure. Those of ordinary skill in the art can understand and implement without any creative effort.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Memory System Of A Hierarchy Structure (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Read Only Memory (AREA)

Abstract

一种固态硬盘SSD访问方法及SSD,其中,SSD中包括:缓存(202)、N个物理通道(204)、以及每个物理通道挂载的闪存(203)。该缓存包括多个条带,每个条带包括N个扇区,N为大于等于3的整数。该方法应用于SSD。根据该方法,接收针对SSD的写数据命令,确定与该写数据命令中携带的待写入数据的LBA相对应的第一条带和第一扇区(S301);若缓存中存在第一条带(S302),则将该待写入数据作为第一扇区的数据写入缓存(S303);若缓存中不存在第一条带,则创建第一条带,将该待写入数据作为第一扇区的数据写入缓存(S304)。

Description

固态硬盘访问
相关申请的交叉引用
本专利申请要求于2017年4月14日提交的、申请号为201710244793.5、发明名称为“固态硬盘访问方法及装置”的中国专利申请的优先权,该申请的全文以引用的方式并入本文中。
背景技术
SSD(Solid State Disk,固态硬盘)主要由控制器和闪存(Flash)组成。目前,SSD通常采用多通道并行技术,以便提供更高的数据读写速度。具体的,控制器使用多个物理通道(Channel)并行操作多个闪存。
附图说明
图1是本公开实施例示出的未采用条带化技术和采用了条带化技术的数据存储对比示意图。
图2是本公开实施例示出的SSD的结构示意图。
图3是本公开实施例示出的SSD访问方法的流程图。
图4是本公开实施例示出的在接收到写数据命令后的写入操作流程图。
图5是本公开实施例示出的条带老化操作的流程图。
图6是本公开实施例示出的在接收到读数据命令后的读取操作流程图。
图7是本公开实施例示出的在物理通道失效时的数据恢复和迁移操作的流程图。
图8是本公开实施例示出的SSD访问装置所在SSD的硬件结构示意图。
图9是本公开实施例示出的SSD访问装置的一种结构示意图。
图10是本公开实施例示出的SSD访问装置的另一种结构示意图。
具体实施方式
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本公开相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本公开的一些方面相一致的装置和方法的例子。
在本公开使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本公开。在本公开和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。还应当理解,本文中使用的术语“和/或”是指并包含一个或多个相关联的列出项目的任何或所有可能组合。
应当理解,尽管在本公开可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本公开范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。
采用多通道并行技术可以并行的进行数据读写,但是,在实际应用中数据读写并不总是连续的,大部分情况下都是随机读写。这样,在同时访问同一物理通道挂载的闪存时就会导致访问冲突。解决上述访问冲突问题的方案主要是将数据进行条带化。条带化技术就是一种自动的将数据读写的负载均衡到各个物理通道挂载的闪存上的技术。
如图1所示,通过采用条带化技术,可以将数据分割成多份预定大小的子数据,并将它们分别存储到不同物理通道挂载的闪存中,从而实现数据并行读写,并且有效避免访问冲突。
另外,闪存具有必须先擦除(erase)才能写入(program)的特性。擦除的最小单位是块(Block),读写的最小单位是页(Page),一个块可包含多个页。因此,对闪存中的数据进行修改时,不可以直接用新数据覆盖原有数据,而是需要将整个块中的数据读取出来保存到内存中,在内存中将需要修改的数据更新为新数据,然后擦除整个块中的数据,将内存中修改后的数据写入该块中。这样就会产生SSD的写入放大(Write Application)问题。例如,假设一个块中的1024个页全部被写满了,此时,若需要修改其中一个页中的数据,则需要将该页所属块中的所有数据读取到内存中并修改该页中的数据,然后将闪存中该块的所有数据擦除,将内存中修改后的数据写入该块中,此时的 写入放大比为1024。
SSD存在写入放大比很大的问题,从而影响了SSD的性能和使用寿命。
为了解决上述问题,本公开以下实施例中提供了一种SSD访问方法,以及一种可以应用该方法的装置。如图2所示,本公开实施例的SSD中包括:控制器201、缓存(Cache)202、三个以上物理通道204、以及每个物理通道204挂载的闪存(Flash)203。其中,缓存202可以是内存中划分出的存储空间。本公开实施例的SSD可采用多通道并行技术和条带化技术进行数据读写。
基于此,如图3所示,本公开实施例的SSD访问方法包括以下步骤。
步骤S301,接收写数据命令,确定与该写数据命令中携带的待写入数据的LBA(Logical Block Address,逻辑区块地址)相对应的第一条带和第一扇区。
其中,每个条带可包括三个以上扇区,且每个条带包括的扇区数等于SSD中的物理通道数,也相当于SSD中闪存的个数。例如,当SSD中的物理通道数为4时,每个条带中包含4个扇区。
步骤S302,判断缓存中是否存在第一条带,若是,则执行步骤S303,否则,执行步骤S304。
步骤S303,将待写入数据作为第一扇区的数据写入缓存。
步骤S304,创建第一条带,将待写入数据作为第一扇区的数据写入缓存。
本公开上述实施例的方法中,在SSD中设置了缓存202,SSD在接收到写数据命令后,先将待写入数据存放到缓存202中。这样,对于某些需要经常进行修改的热点数据,由于该热点数据可被存放到缓存202中,因此只需修改缓存202中的数据即可,而无需反复对闪存203进行擦除写入,从而减少了写入放大比。
下面对上述的SSD访问方法进行详述。SSD可通过计算冗余的校验数据来提供容错机制,其原理是对缓存的各个条带中的用户数据进行校验计算得到校验数据,并将校验数据按照一定规律分布在不同物理通道挂载的闪存上。这样,当某个物理通道失效时,例如,该物理通道故障、或者该物理通道挂载的闪存故障,可以实现数据恢复。另外,当条带中某个扇区的数据读取失败时,也可以实现数据恢复。
可以在内存中划分一个存储空间作为缓存,用于缓存某个条带的某个扇区的数据,以及存储该条带的记录信息。
在本公开实施例中,可以扇区(sector)大小作为条带深度,以物理通道数N作为条带宽度,即,每个条带中可包含N个扇区。为了提供容错机制,每个条带的N个扇区中可包括:用于存放用户数据的N1个用户数据扇区、以及用于存放校验数据的N2个校验数据扇区,N1+N2=N,N1>N2。例如,一个扇区的大小可为4K比特。
在一个示例中,可以将每个条带(strip)中的N个扇区从0开始进行编号,依次为扇区0、扇区1、扇区2、…、扇区N-1,而且,最后N2个扇区可以被固定作为校验数据扇区。
基于此,本公开实施例的SSD访问方法包括以下内容。
数据写入
如图4所示,在接收到主机(Host)发来的写数据命令后,SSD执行的写入操作如下。
步骤S401,在接收到主机发来的写数据命令后,确定与该写数据命令中携带的待写入数据的LBA相对应的第一条带和第一扇区。
其中,确定LBA对应的第一条带的索引strip_index和第一扇区的标识sector_id的计算方法可以参见公式(1)和公式(2):
Figure PCTCN2018082740-appb-000001
sector_id=LBA%N1        (2)
其中,
Figure PCTCN2018082740-appb-000002
表示向下取整运算符,%表示取模运算符。
通过公式(1),可以将各个LBA分配到不同的条带中,而且,从LBA的初始值开始、每N1个连续的LBA可被分配到同一条带中。
当N1=4时,按照公式(1)和公式(2)计算得到的各个LBA对应的条带的索引和扇区的标识,可以参见表1所示。
表1
Figure PCTCN2018082740-appb-000003
Figure PCTCN2018082740-appb-000004
假设,步骤S401中待写入数据的LBA为14,则按照公式(1)和公式(2)确定出该待写入数据对应于的第一条带的索引:3以及第一扇区的标识:2。
步骤S402,判断缓存中是否存在第一条带,若是,则执行步骤S403,否则,执行步骤S406。
例如,可以预先在内存中创建多个Hash桶(bucket),每个Hash桶用于存放多个条带的索引和记录信息的缓存地址。从而,在步骤S402中判断缓存中是否存在第一条带的方法可以为如下。
对第一条带的索引和物理通道数N进行哈希计算,将哈希计算结果作为桶ID(标识),在内存中查找该桶ID所标识的Hash桶。例如,对第一条带的索引和N之和进行CRC32(Cyclic Redundancy Check,循环冗余校验码)计算,然后取计算结果的低18位作为桶ID。
判断查找到的Hash桶中是否存在第一条带的索引,若存在,则确定缓存中存在第一条带,可以从该Hash桶中获取第一条带的记录信息缓存地址;否则,确定缓存中不存在第一条带。
步骤S403,判断缓存中是否存放有第一扇区的数据,若是,则执行步骤S404,否则,则执行步骤S405;
在获取到第一条带的记录信息缓存地址后,可以在缓存中查找到第一条带的记录信息,根据该获取到的记录信息判断缓存中是否存放有第一扇区的数据。由于在条带老化时可将缓存中存放的该条带的数据写入闪存,而该条带中某扇区的数据需要修改时会在缓存中写入该扇区的修改后的新数据。因此,缓存中可存放有这些扇区的修改后的数据(也可称为最新数据),而闪存中也可存放有该扇区的修改前的数据(也可称为老数据)。因此,为了便于判断扇区的数据存放在缓存中还是存放在闪存中,可以在该条带的记录 信息中为每个扇区设置对应的第一标记和第二标记。第一标记和第二标记可联合表示缓存以及闪存中的数据存储情况。例如,当扇区的第一标记为有效、第二标记为有效时,可表示缓存和闪存中均存储有该扇区的数据,不过缓存中存储的可能是该扇区的最新数据,而闪存中存储的可能是该扇区的老数据;当扇区的第一标记为有效、第二标记为无效时,可表示缓存中存储有该扇区的数据,而闪存中不存在该扇区的数据;当扇区的第一标记为无效、第二标记为有效时,可表示缓存中不存在该扇区的数据,闪存中存储有该扇区的数据;当扇区的第一标记为无效、第二标记为无效时,可表示缓存和闪存中均不存在该扇区的数据。
其中,当条带中的某一扇区的数据存储在缓存中时,还会在该条带的记录信息中记录该扇区的数据在缓存中的缓存地址。
这样,在步骤S403中可以判断第一扇区的第一标记是否为有效,若是,则确定缓存中存放有第一扇区的数据。
步骤S404,将缓存中存放的第一扇区的数据更新为待写入数据。此时,该待写入数据成为第一扇区的最新数据。
例如,在步骤S404中,将缓存中存放的第一扇区的数据更新为待写入数据的方式可以是:将待写入数据写入缓存,并将第一条带的记录信息中记录的第一扇区的数据的缓存地址更新为该待写入数据被写入缓存中的缓存地址,并将第一扇区对应的第一标记维持为有效。另外,还可以将第一扇区的更新前数据的缓存地址记录为空闲地址,以便后续可在该空闲地址写入其它数据。
例如,假设缓存中存放的更新前数据为Dada A,Dada A的缓存地址为Addr A;该待写入数据为Dada B,则在步骤S404中,将缓存中存放的第一扇区的数据Dada A更新为待写入数据Dada B的方式可以是:将Dada B写入缓存,缓存地址为Addr B,将第一条带的记录信息中记录的第一扇区的数据的缓存地址由Addr A更新为Addr B,另外,还可以将第一扇区的更新前数据Dada A的缓存地址Addr A记录为空闲地址,以便后续可在Addr A写入其它数据。
如果第一条带中的第一扇区的数据频繁发生修改,则会反复执行上述步骤S401至步骤S404,每次执行步骤S404时会将缓存中存放的第一扇区的数据进行更新,而更新前数据此时会被看作无效数据,等待后续被其它数据覆盖。等到第一条带老化时,会将缓存中存放的第一条带的数据写入闪存,具体方法可以参见图5,这里不再赘述。
步骤S405,可将待写入数据作为第一扇区的数据写入缓存。另外,可在第一条带的记录信息中记录第一扇区的数据的缓存地址为该待写入数据的缓存地址,并将第一扇区的第一标记置为有效。
步骤S406,可创建第一条带,将待写入数据作为第一扇区的数据写入缓存。另外,可在第一条带的记录信息中记录第一扇区的数据的缓存地址为该待写入数据的缓存地址,并将第一扇区的第一标记置为有效。
例如,创建条带的过程可以是:在该条带对应的Hash桶中记录该条带的索引和记录信息的缓存地址,计算该条带中每个扇区对应的逻辑通道并记录到该条带的记录信息中,在该条带的记录信息中将每个扇区的第一标记和第二标记均置为无效。
其中,可以按照公式(3)计算校验数据扇区对应的逻辑通道的标识p_logic_channel_id:
p_logic_channel_id=strip_index%N          (3)
可以按照公式(4)计算用户数据扇区对应的逻辑通道的标识d_logic_channel_id:
Figure PCTCN2018082740-appb-000005
其中,sector_id表示扇区的标识,strip_index表示扇区所在条带的索引,%表示取模运算符。
SSD中的逻辑通道总数可与物理通道总数相同。初始时,逻辑通道与物理通道可具有一一对应关系。例如,初始时,逻辑通道0可对应于物理通道0,逻辑通道1可对应于物理通道1,以此类推。后续,SSD中的物理通道可能会失效,例如,物理通道自身故障或该通道挂载的闪存故障,此时,原本对应于失效的物理通道的逻辑通道,可与其它正常的物理通道建立对应关系。逻辑通道与物理通道之间的对应关系可以保存在通道映射表中。
从公式(3)可以看出,在不同的条带中,校验数据扇区对应的逻辑通道可均匀分布在所有逻辑通道中。从而,不同条带中的校验数据会均匀的分布在所有物理通道挂载的闪存中。这样可以有效避免所有校验数据都存放在同一物理通道挂载的闪存而影响该闪存的使用寿命。
从公式(3)和公式(4)可以看出,同一条带中的各个扇区对应的逻辑通道也可以 是均匀分布在所有逻辑通道中,从而提高了SSD的并行访问能力。
通过如图4所示的方法,SSD在接收到主机发来的写数据命令后,可先将待写入数据存放到缓存中。这样,对于某些需要经常进行修改的热点数据,只需修改缓存中的数据即可,而无需反复对闪存进行擦除写入,从而减少了SSD的写入放大比。
条带老化
另外,在缓存中创建任一个条带后,会将该条带的索引添加到老化链表中,老化链表中的每个条带具有对应的优先级。条带对应的优先级与缓存的存储空间大小、读/写数据命令数量、条带使用频率、条带最近使用时间、条带有效数据量等参数中的一个或多个组合有关。例如,使用频率较高的条带的优先级会较低,从而确保经常需要进行修改的数据尽量存放在缓存中,以便减少对闪存的擦除写入次数。例如,可以周期性的从老化链表中选择一个优先级最高的条带进行老化。
当某个条带需要进行老化,即将缓存中该条带的数据写入闪存时,SSD执行的步骤如图5所示,包括以下步骤。
步骤S501,针对第二条带中的每个用户数据扇区,若该扇区的数据存储在该扇区对应的闪存中,则从闪存中读取该扇区的数据并写入缓存。
例如,针对第二条带中的每个用户数据扇区,若该扇区的第一标记为无效、第二标记为有效,说明该扇区的数据存储在闪存中。可确定该扇区对应的LBA,在地址转换表中查找与该LBA对应的PBA(Physical Block Address,物理区块地址),根据查找到的PBA从闪存中读取该扇区的数据并写入缓存。另外,还可以将该用户数据扇区的第一标记置为有效,在第二条带的记录信息中记录该用户数据扇区的数据的缓存地址。其中,确定扇区对应的LBA的方式可以是:在已知条带的索引和扇区的标识的情况下,按照公式(1)和公式(2)计算出该扇区对应的LBA。
从而,在步骤S501执行完之后,第二条带中各个用户数据扇区的数据均存放到了缓存中。
步骤S502,对缓存中存放的第二条带的所有用户数据扇区的数据进行校验计算,得到校验数据,将该校验数据作为第二条带的校验数据扇区的数据写入缓存;此时,第二条带中各个扇区(包括用户数据扇区和校验数据扇区)的数据均存放在了缓存中。
可见,在将条带中的数据写入闪存时,可根据条带中的用户数据计算出校验数据。
步骤S503,将缓存中存放的第二条带的各个扇区的数据写入闪存。具体的,针对第二条带中的每个扇区,确定该扇区对应的逻辑通道,查找与该逻辑通道对应的物理通道,从缓存中读取该扇区的数据并写入该物理通道挂载的闪存,写入完成后,在地址转换表中记录LBA与PBA的对应关系。其中,LBA可以在已知条带的索引和扇区的标识的情况下,按照公式(1)和公式(2)得到,PBA是在数据写入完成后即可获知,例如,PBA可以标识出数据在闪存中的块、页中的偏移位置。
在将缓存中存放的第二条带的各个扇区的数据写入闪存之后,还可以将缓存中的第二条带删除。例如,删除第二条带的方法具体可以是:将Hash桶中记录的第二条带的索引和记录信息的缓存地址删除,删除第二条带的记录信息。另外,还可以将这些数据的缓存地址记录为空闲地址,以便后续写入其它数据。
通过如图5所示的方法,当某一条带老化时,会将该条带中的用户数据和校验数据一起写入闪存。
数据读取
如图6所示,在接收到主机发来的读数据命令后,SSD执行的读取操作如下。
步骤S601,在接收到主机发来的读数据命令之后,确定与该读数据命令中携带的待读取数据的LBA相对应的第三条带和第三扇区。
在步骤S601中,可以按照公式(1)和公式(2)确定LBA对应的第三条带和第三扇区。
步骤S602,判断缓存中是否存在第三条带,若存在,则执行步骤S603,否则,执行步骤S606。
例如,可以预先在内存中创建多个Hash桶,每个Hash桶用于存放多个条带的索引和记录信息的缓存地址。从而,在步骤S602中判断缓存中是否存在第三条带的具体方法为如下。
对第三条带的索引和物理通道数N进行哈希计算,将哈希计算结果作为桶ID,在内存中查找该桶ID所标识的Hash桶;例如,对第三条带的索引和N之和进行CRC32计算,然后取计算结果的低18位作为桶ID。
判断查找到的Hash桶中是否存在第三条带的索引,若存在,则确定缓存中存在第三条带,可以从该Hash桶中获取第三条带的记录信息的缓存地址;否则,确定缓存中 不存在第三条带。
步骤S603,判断第三扇区的数据是否存储在缓存中,若是,则执行步骤S604,否则,意味着第三扇区的数据存放在闪存中,则执行步骤S606;
在获取到第三条带的记录信息的缓存地址后,可以在缓存中查找到第三条带的记录信息,根据该第三条带的记录信息判断第三扇区的数据是否存储在缓存中。例如,若该第三条带的记录信息中记录的第三扇区的第一标记为有效,则判断出第三扇区的数据存储在缓存中,否则,判断出第三扇区的数据存储在闪存中。不过,第三扇区的数据是否存储在闪存中,还可根据第三条带的记录信息中记录的第三扇区的第二标记进行判断。例如,若第三条带的记录信息中记录的第三扇区的第二标记为有效,则判断出第三扇区的数据存储在闪存中,否则,判断出闪存中未存储第三扇区的数据。在这种情况下,可能发生了读错误,有可能需要上报主机。
步骤S604,从缓存中读取第三扇区的数据,之后,执行步骤S605。
例如,可在第三条带的记录信息中获取第三扇区的数据的缓存地址,从而,可根据该缓存地址读取第三扇区的数据。
步骤S605,将读出的数据返回给主机。
步骤S606,从闪存中读取第三扇区的数据,之后,执行步骤S605。
其中,从闪存中读取数据的方式可以是:根据数据的LBA,在地址转换表中查找与该LBA对应的PBA,根据查找到的PBA从闪存中读取数据。
根据一个示例,如果在步骤S606中从闪存中读取第三扇区的数据失败,则从闪存中读取第三条带中除第三扇区以外的其它扇区的数据,使用读出的其它扇区的数据恢复出第三扇区的数据并返回给主机。
通过如图6所示的方法,读取数据时,若缓存中存在待读取数据,则可从缓存中读取该数据,若缓存中不存在待读取数据,则可从闪存中读取该数据。这样,由于从缓存中读取数据的速度更快,从而能够为用户提供更高的数据读写速度。
物理通道失效时的数据恢复和迁移
为了提高SSD的可靠性,当某个物理通道失效时,要在不中断业务的前提下将失效的物理通道所挂载的闪存中存储的数据进行恢复,并且,将失效前的条带(以下又可称为老条带)中的数据迁移到新条带中。为了确定出已经完成数据恢复和迁移的老条带, 在老条带完成数据恢复和迁移后,可以将该老条带的索引记录到条带恢复(strip_recover)表中。
例如,如图7所示,当检测到某一物理通道失效时,针对缓存中的每个老条带执行以下步骤。
步骤S701,从闪存中读取该老条带中除失效扇区以外的其它扇区的数据,使用读出的数据(包括用户数据和校验数据)恢复失效扇区的数据,将恢复出的数据作为失效扇区的数据写入缓存。
其中,老条带中的扇区数等于失效前的物理通道数,当某一物理通道失效时,与该物理通道绑定的逻辑通道对应的扇区也相应失效。此时,可以根据SSD中的有效物理通道的数量来重新确定新的条带和扇区。
假设,在失效前,SSD中的物理通道数为N,此时的条带称为老条带,每个老条带的N个扇区中包括:N1个用户数据扇区和N2个校验数据扇区。
当某一物理通道失效后,SSD中的物理通道数为N-1,此时的条带称为新条带,每个新条带的N-1个扇区中可包括:N1-1个用户数据扇区和N2个校验数据扇区。此时,在执行读写数据操作时,可按照N1-1来确定LBA对应的新条带和新扇区。
步骤S702,针对该老条带中的每个老用户数据扇区,可根据该老用户数据扇区的LBA确定该LBA对应的新条带和新用户数据扇区。若该老用户数据扇区的数据存储在缓存中,则可将该老用户数据扇区的数据迁移到该新条带中的该新用户数据扇区。若该老用户数据扇区的数据存储在闪存中,则可从闪存中读取该用户数据扇区的数据并写入缓存,将该老用户数据扇区的数据迁移到该新条带中的该新用户数据扇区。
后续,在老条带的数据迁移完成后,可以将该老条带删除,并将该老条带的索引记录到strip_recover表中。
例如,可以按照公式(1)和公式(2)确定LBA对应的新条带和新用户数据扇区。
将该老用户数据扇区的数据迁移到该新条带中的该新用户数据扇区的方式可以是:在该新条带的记录信息中,记录该新用户数据扇区的数据的缓存地址为:该老用户数据扇区的数据的缓存地址。
显然,在步骤S702中,在将该老用户数据扇区的数据迁移到该新条带中的该新用户数据扇区之前,还需要判断缓存中是否存在该新条带,若不存在,需要先创建该新条 带,然后,再将该老用户数据扇区的数据迁移到该新条带中的该新用户数据扇区。
由于与失效前相比,失效后的物理通道数减少了,新条带中的扇区数也比老条带中的扇区数少,因此,一个新条带中的用户数据来自于1个或2个老条带,将这1个或2个老条带可称为与该新条带关联的老条带。
在实际实施过程中,任一新条带被创建后,可将该新条带添加到老化链表中。在数据恢复和迁移过程中,老化链表中既存在老条带也存在新条带。为了便于区别老条带和新条带,可以在老化链表中标记每个条带对应的SSD模式,老条带对应的是失效前的SSD模式,例如失效前的SSD模式为N1+N2模式,新条带对应的是失效后的SSD模式,例如失效后的SSD模式为(N1-1)+N2模式。在预定周期到达时,从老化链表中选择优先级最高的新条带进行老化,老条带无需进行老化。需要注意的是:当需要对某一新条带进行老化时,需要先判断与该新条带关联的老条带是否已经完成了数据恢复和迁移,若已经完成了数据恢复和迁移,才能对该新条带进行老化,将该新条带的数据写入闪存;若尚未完成数据恢复和迁移,则暂时不对该新条带进行老化,而在对关联的老条带进行数据恢复后,将老条带的数据迁移到新条带。这样,可以避免老条带的数据被破坏而无法恢复数据。
其中,确定与某一新条带关联的老条带的方法可以是:按照公式(1)在已知该新条带的索引的情况下,确定该新条带对应的LBA范围;针对该LBA范围中的最小值,按照公式(1)确定对应的第一老条带的索引,针对该LBA范围中的最大值,按照公式(1)确定对应的第二老条带的索引;若第一老条带的索引与第二老条带的索引相同,则确定与该新条带关联的老条带只有1个,即为第一老条带(也就是第二老条带);若第一老条带的索引与第二老条带的索引不相同,并且两者的差值为1,则确定与该新条带关联的老条带有2个,分别为第一老条带和第二老条带。
在数据恢复和迁移过程中,若SSD接收到了主机发来的读数据命令,则确定与该读数据命令中携带的待读取数据的LBA相对应的新条带;在缓存中不存在该新条带的情况下,执行以下步骤:
确定与该LBA对应的老条带和老扇区;
若缓存中存在该老条带,则当该老扇区对应的逻辑通道所绑定的物理通道正常时,从缓存或内存中读取该老扇区的数据并返回给主机,当该老扇区对应的逻辑通道所绑定的物理通道失效时,对该老条带的数据进行数据恢复和迁移;
若缓存中不存在该老条带,则当该老扇区对应的逻辑通道所绑定的物理通道正常时,在地址转换表中查找该LBA对应的PBA,根据该PBA从闪存中读取数据并返回给主机,当该老扇区对应的逻辑通道所绑定的物理通道失效时,对该老条带的数据进行数据恢复和迁移。
通过上述的数据恢复和迁移方法,能够在物理通道失效时,对失效的物理通道挂载的闪存中存储的数据进行恢复,将失效前的条带中的数据迁移到新条带上去,保证业务的延续,提高了SSD的容错能力,提高了业务的高可用性(HA),并且,在数据恢复和迁移过程中,SSD能正常进行数据读写,新老条带可以并行存在。
与前述SSD访问方法的实施例相对应,本公开还提供了SSD访问装置的实施例。
本公开SSD访问装置的实施例可以应用在SSD上。从硬件层面而言,如图8所示,为本公开SSD访问装置所在SSD的一种硬件结构示意图,该SSD中包括:控制器10、三个以上物理通道20、每个物理通道20挂载的闪存30、总线40、以及机器可读存储介质50。其中,机器可读存储介质50中可划分出一块存储空间作为缓存70,但是这不具有限制性,缓存70也可具有其他实施方式。通过读取机器可读存储介质50中的机器可执行指令,控制器10可执行上文描述的SSD访问方法。控制器10例如可以是CPU等处理器。在实际实施过程中,根据该SSD的实际功能,还可以包括其他硬件,对此不再赘述。
在本文中的机器可读存储介质50可以是任何电子、磁性、光学或其它物理存储装置,可以包含或存储信息,如可执行指令、数据,等等。例如,机器可读存储介质可以是易失性存储介质或非易失性存储介质,例如RAM(Radom Access Memory,随机存取存储器)、闪存、存储驱动器(如硬盘驱动器)、任何类型的存储盘、或者前述一种或多种的组合。
本公开SSD访问装置60的实施例可以通过软件实现,也可以通过硬件或者软硬件结合的方式实现。以软件实现为例,作为一个逻辑意义上的装置,是通过其所在SSD的控制器10读取并运行机器可读存储介质50中的机器可执行指令形成的。
请参考图9,本公开实施例的SSD访问装置60中包括:接收单元601和读写单元602。
接收单元601,用于接收针对SSD的写数据命令,确定与写数据命令中携带的待写入数据的LBA相对应的第一条带和第一扇区,其中,SSD包括N个物理通道和缓 存,每个物理通道挂载有内存,缓存包括多个条带,每个条带中包括N个扇区,N为大于等于3的整数。
读写单元602,用于若缓存中存在第一条带,则将待写入数据作为第一扇区的数据写入缓存,若缓存中不存在第一条带,则创建第一条带,将待写入数据作为第一扇区的数据写入缓存。
其中,接收单元601具体用于按照以下公式确定LBA对应的条带的索引strip_index和扇区标识sector_id:
Figure PCTCN2018082740-appb-000006
sector_id=LBA%N1;
其中,N1表示一个条带中用于存放用户数据的扇区的个数,N1为大于1并且小于N的整数,
Figure PCTCN2018082740-appb-000007
表示向下取整运算符,%表示取模运算符。
如图10所示,上述SSD访问装置60中还包括:计算单元603。
读写单元602,用于针对第二条带中的每个用户数据扇区,若该扇区的数据存储在闪存中,则从闪存中读取该扇区的数据并写入缓存。
计算单元603,用于对缓存中存放的第二条带的所有用户数据扇区的数据进行校验计算,得到第二条带的校验数据扇区的校验数据。
读写单元602将计算单元603计算得到的第二条带的校验数据扇区的校验数据写入缓存;还用于将缓存中存放的第二条带的所有扇区的数据写入闪存。
其中,读写单元602还用于通过以下方式将缓存中存放的第二条带的扇区的数据写入闪存:
确定该扇区对应的逻辑通道,查找与该逻辑通道对应的物理通道,将缓存中存放的该扇区的数据写入该物理通道挂载的闪存。
其中,确定该扇区对应的逻辑通道包括:
在该扇区为用于存放用户数据的用户数据扇区时,如下确定该用户数据扇区对应的逻辑通道的标识d_logic_channel_id:
Figure PCTCN2018082740-appb-000008
在该扇区为用于存放校验数据的校验数据扇区时,如下确定该校验数据扇区对应的逻辑通道的标识p_logic_channel_id:
p_logic_channel_id=strip_index%N;
其中,sector_id表示扇区标识,strip_index表示扇区所在条带的索引,%表示取模运算符。
其中,接收单元601,还用于接收针对SSD的读数据命令,确定与读数据命令中携带的待读取数据的LBA相对应的第三条带和第三扇区。
读写单元602,还用于若缓存中存在第三条带、并且第三扇区的数据存储在缓存中,则从缓存中读取第三扇区的数据作为待读取数据;若缓存中存在第三条带、并且第三条带中的第三扇区的数据存放在闪存中,或者,若缓存中不存在第三条带,则从第三扇区对应的闪存中读取第三扇区的数据作为待读取数据。
如图10所示,上述SSD访问装置60中还包括如下单元。
检测单元604,用于检测物理通道的状态;
恢复迁移单元605,用于当检测单元604检测到N物理通道之一失效时,针对缓存中的老条带执行以下步骤:
从闪存中读取该老条带中除失效扇区以外的其它扇区的数据,其中,该失效扇区为与所述失效的物理通道绑定的逻辑通道所对应的扇区;
使用读出的数据恢复失效扇区的数据,
将恢复出的数据作为失效扇区的数据写入缓存;
针对该条带中的每个用户数据扇区的LBA确定该LBA对应的新条带和新用户数据扇区,其中,新条带中的扇区数等于SSD中的有效物理通道数
若该用户数据扇区的数据存储在缓存中,则将该用户数据扇区的数据迁移到该新条带中的该新用户数据扇区;
若该用户数据扇区的数据存储在闪存中,则从闪存中读取该用户数据扇区的数据并写入缓存,将该用户数据扇区的数据迁移到该新条带中的该新用户数据扇区。
上述装置中各个单元的功能和作用的实现过程具体详见上述方法中对应步骤的实现过程,在此不再赘述。
对于装置实施例而言,由于其基本对应于方法实施例,所以相关之处参见方法实施例的部分说明即可。以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本公开方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。
需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。
以上对本公开实施例所提供的方法和装置进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本公开的方法及其核心思想;同时,对于本领域的一般技术人员,依据本公开的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本公开内容不应理解为对本公开的限制。

Claims (14)

  1. 一种固态硬盘SSD访问方法,包括:
    接收针对SSD的写数据命令,其中,所述SSD包括N个物理通道和缓存,每个所述物理通道挂载有闪存,所述缓存包括多个条带,每个所述条带包括N个扇区,N为大于等于3的整数;
    确定与所述写数据命令中携带的待写入数据的逻辑区块地址LBA相对应的第一条带和第一扇区;
    若所述缓存中存在所述第一条带,则将所述待写入数据作为所述第一扇区的数据写入所述缓存;
    若所述缓存中不存在所述第一条带,则创建所述第一条带,将所述待写入数据作为所述第一扇区的数据写入所述缓存。
  2. 根据权利要求1所述的方法,其特征在于,确定与所述写数据命令中携带的待写入数据的LBA相对应的所述第一条带和所述第一扇区包括:
    确定所述第一条带的索引
    Figure PCTCN2018082740-appb-100001
    确定所述第一扇区的标识sector_id=LBA%N1;
    其中,N1表示一个条带中用于存放用户数据的扇区的个数,N1为大于1并且小于N的整数;
    Figure PCTCN2018082740-appb-100002
    表示向下取整运算符,
    %表示取模运算符。
  3. 根据权利要求1所述的方法,还包括:
    针对第二条带中的每个用户数据扇区,若该扇区的数据存储在闪存中,则从所述闪存中读取该扇区的数据并写入所述缓存;
    对所述缓存中存放的所述第二条带的所有用户数据扇区的数据进行校验计算,得到所述第二条带的校验数据扇区的校验数据,并将该校验数据写入所述缓存;
    将所述缓存中存放的所述第二条带的所有扇区的数据写入闪存。
  4. 根据权利要求1所述的方法,还包括:通过以下方式将所述缓存中存放的扇区的数据写入闪存:
    确定该扇区对应的逻辑通道,
    查找与该逻辑通道对应的物理通道,
    将所述缓存中存放的该扇区的数据写入该物理通道挂载的所述闪存。
  5. 根据权利要求4所述的方法,其特征在于,确定该扇区对应的逻辑通道包括:
    在该扇区为用于存放用户数据的用户数据扇区时,如下确定该用户数据扇区对应的逻辑通道的标识d_logic_channel_id:
    Figure PCTCN2018082740-appb-100003
    在该扇区为用于存放校验数据的校验数据扇区时,如下确定该校验数据扇区对应的逻辑通道的标识p_logic_channel_id:
    p_logic_channel_id=strip_index%N;
    其中,sector_id表示该扇区的标识,strip_index表示该扇区所在条带的索引,%表示取模运算符。
  6. 根据权利要求1所述的方法,还包括:
    接收针对所述SSD的读数据命令;
    确定与所述读数据命令中携带的待读取数据的LBA相对应的第三条带和第三扇区;
    若所述缓存中存在所述第三条带、并且所述第三扇区的数据存储在所述缓存中,则从所述缓存中读取所述第三扇区的数据作为所述待读取数据;
    若所述缓存中存在所述第三条带、并且所述第三条带中的所述第三扇区的数据存放在闪存中,则从所述第三扇区对应的闪存中读取所述第三扇区的数据作为所述待读取数据;
    若所述缓存中不存在所述第三条带,则从所述第三扇区对应的闪存中读取所述第三扇区的数据作为所述待读取数据。
  7. 根据权利要求1所述的方法,还包括:
    当检测到所述N物理通道之一失效时,针对所述缓存中的老条带执行以下步骤:
    从所述闪存中读取该条带中除失效扇区以外的其它扇区的数据,其中,该失效扇区为与所述失效的物理通道绑定的逻辑通道所对应的扇区;
    使用读出的数据恢复所述失效扇区的数据;
    将恢复出的数据作为所述失效扇区的数据写入所述缓存;
    根据该条带中的每个用户数据扇区的LBA确定该LBA对应的新条带和新用户数据扇区,其中该新条带中的扇区数等于所述SSD中的有效物理通道的数量;
    若该用户数据扇区的数据存储在所述缓存中,则将该用户数据扇区的数据迁移到该新条带中的该新用户数据扇区;
    若该用户数据扇区的数据存储在所述闪存中,则在从所述闪存中读取该用户数据扇区的数据并写入所述缓存后,将该用户数据扇区的数据迁移到该新条带中的该新用户数据扇区。
  8. 一种固态硬盘SSD,包括:
    包括多个条带的缓存,每个所述条带包括N个扇区,N为大于等于3的整数;
    N个物理通道;
    每个所述物理通道挂载的闪存;
    控制器;以及
    存储有机器可执行指令的机器可读存储介质,
    其中,通过读取并执行所述机器可执行指令,所述控制器被促使:
    接收针对所述SSD的写数据命令;
    确定与所述写数据命令中携带的待写入数据的逻辑区块地址LBA相对应的第一条带和第一扇区;
    若所述缓存中存在所述第一条带,则将所述待写入数据作为所述第一扇区的数据写入所述缓存;
    若所述缓存中不存在所述第一条带,则创建所述第一条带,将所述待写入数据作为所述第一扇区的数据写入所述缓存。
  9. 根据权利要求8所述的SSD,其特征在于,在确定与所述写数据命令中携带的待写入数据的LBA相对应的所述第一条带和所述第一扇区时,所述控制器还被所述机器可执行指令促使:
    确定所述第一条带的索引
    Figure PCTCN2018082740-appb-100004
    确定所述第一扇区的标识sector_id=LBA%N1;
    其中,N1表示一个条带中用于存放用户数据的扇区的个数,N1为大于1并且小于N的整数;
    Figure PCTCN2018082740-appb-100005
    表示向下取整运算符,
    %表示取模运算符。
  10. 根据权利要求8所述的SSD,其特征在于,所述控制器还被所述机器可执行指令促使:
    针对第二条带中的每个用户数据扇区,若该扇区的数据存储在闪存中,则从所述闪存中读取该扇区的数据并写入所述缓存;
    对所述缓存中存放的所述第二条带的所有用户数据扇区的数据进行校验计算,得到所述第二条带的校验数据扇区的校验数据,并将该校验数据写入所述缓存;
    将所述缓存中存放的所述第二条带的所有扇区的数据写入闪存。
  11. 根据权利要求8所述的SSD,其特征在于,所述控制器还被所述机器可执行指令促使:
    通过以下方式将所述缓存中存放的扇区的数据写入闪存:
    确定该扇区对应的逻辑通道,
    查找与该逻辑通道对应的物理通道,
    将所述缓存中存放的该扇区的数据写入该物理通道挂载的所述闪存。
  12. 根据权利要求11所述的SSD,其特征在于,在确定该扇区对应的逻辑通道时,所述控制器还被所述机器可执行指令促使:
    在该扇区为用于存放用户数据的用户数据扇区时,如下确定该用户数据扇区对应的逻辑通道的标识d_logic_channel_id:
    Figure PCTCN2018082740-appb-100006
    在该扇区为用于存放校验数据的校验数据扇区时,如下确定该校验数据扇区对应的逻辑通道的标识p_logic_channel_id:
    p_logic_channel_id=strip_index%N;
    其中,sector_id表示扇区标识,strip_index表示扇区所在条带的索引,%表示取模运算符。
  13. 根据权利要求8所述的SSD,其特征在于,所述控制器还被所述机器可执行指令促使:
    接收针对所述SSD的读数据命令;
    确定与所述读数据命令中携带的待读取数据的LBA相对应的第三条带和第三扇区;
    若所述缓存中存在所述第三条带、并且所述第三扇区的数据存储在所述缓存中,则从所述缓存中读取所述第三扇区的数据作为所述待读取数据;
    若所述缓存中存在所述第三条带、并且所述第三条带中的所述第三扇区的数据存放在闪存中,则从所述第三扇区对应的闪存中读取所述第三扇区的数据作为所述待读取数据;
    若所述缓存中不存在所述第三条带,则从所述第三扇区对应的闪存中读取所述第三 扇区的数据作为所述待读取数据。
  14. 根据权利要求8所述的SSD,其特征在于,所述控制器还被所述机器可执行指令促使:
    当检测到所述N物理通道之一失效时,针对所述缓存中的老条带执行以下步骤:
    从所述闪存中读取该条带中除失效扇区以外的其它扇区的数据,其中,该失效扇区为与所述失效的物理通道绑定的逻辑通道所对应的扇区;
    使用读出的数据恢复所述失效扇区的数据;
    将恢复出的数据作为所述失效扇区的数据写入所述缓存;
    根据该条带中的每个用户数据扇区的LBA确定该LBA对应的新条带和新用户数据扇区,其中,该新条带中的扇区数等于所述SSD中的有效物理通道的数量;
    若该用户数据扇区的数据存储在所述缓存中,则将该用户数据扇区的数据迁移到该新条带中的该新用户数据扇区;
    若该用户数据扇区的数据存储在所述闪存中,则从所述闪存中读取该用户数据扇区的数据并写入所述缓存后,将该用户数据扇区的数据迁移到该新条带中的该新用户数据扇区。
PCT/CN2018/082740 2017-04-14 2018-04-12 固态硬盘访问 WO2018188618A1 (zh)

Priority Applications (3)

Application Number Priority Date Filing Date Title
EP18785096.1A EP3598290B1 (en) 2017-04-14 2018-04-12 Solid-state disk access
JP2019556277A JP6823734B2 (ja) 2017-04-14 2018-04-12 ソリッドステートディスクアクセス
US16/604,984 US11126377B2 (en) 2017-04-14 2018-04-12 Accessing solid state disk

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710244793.5 2017-04-14
CN201710244793.5A CN108255414B (zh) 2017-04-14 2017-04-14 固态硬盘访问方法及装置

Publications (1)

Publication Number Publication Date
WO2018188618A1 true WO2018188618A1 (zh) 2018-10-18

Family

ID=62721790

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/082740 WO2018188618A1 (zh) 2017-04-14 2018-04-12 固态硬盘访问

Country Status (5)

Country Link
US (1) US11126377B2 (zh)
EP (1) EP3598290B1 (zh)
JP (1) JP6823734B2 (zh)
CN (1) CN108255414B (zh)
WO (1) WO2018188618A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2021026769A (ja) * 2019-07-31 2021-02-22 ベイジン バイドゥ ネットコム サイエンス アンド テクノロジー カンパニー リミテッド ストレージ管理のための方法、装置、機器、コンピュータ読み取り可能な記憶媒体及びコンピュータプログラム
JP7491545B2 (ja) 2019-12-27 2024-05-28 Necソリューションイノベータ株式会社 情報処理方法

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112130762B (zh) * 2020-09-07 2024-01-26 上海威固信息技术股份有限公司 一种固态硬盘数据存储与操作方法
CN112817533A (zh) * 2021-01-29 2021-05-18 深圳忆联信息系统有限公司 Ssd管理方法、装置计算机设备及存储介质
CN113918485B (zh) * 2021-10-12 2023-04-11 广东省高峰科技有限公司 一种闪存资料防丢失方法、装置、设备及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102779548A (zh) * 2011-05-09 2012-11-14 深圳市晶凯电子技术有限公司 用闪存介质作为存储体进行分级管理的固态存储装置及其构建方法
CN104641419A (zh) * 2012-07-13 2015-05-20 三星电子株式会社 固态驱动器控制器、固态驱动器、固态驱动器的数据处理方法、多通道固态驱动器、raid控制器以及其中记录有用于向固态驱动器提供顺序信息的计算机程序的计算机可读记录介质
US20160077962A1 (en) * 2014-09-17 2016-03-17 Kabushiki Kaisha Toshiba Hybrid-hdd policy for what host-r/w data goes into nand
CN105739915A (zh) * 2014-12-29 2016-07-06 三星电子株式会社 存储系统中执行的条带重建方法和存储系统

Family Cites Families (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090204872A1 (en) * 2003-12-02 2009-08-13 Super Talent Electronics Inc. Command Queuing Smart Storage Transfer Manager for Striping Data to Raw-NAND Flash Modules
JP4440803B2 (ja) 2005-03-03 2010-03-24 富士通株式会社 記憶装置、その制御方法及びプログラム
US8959280B2 (en) * 2008-06-18 2015-02-17 Super Talent Technology, Corp. Super-endurance solid-state drive with endurance translation layer (ETL) and diversion of temp files for reduced flash wear
CN101727295B (zh) * 2008-10-31 2012-01-04 西安奇维测控科技有限公司 一种基于虚拟块闪存地址映射的数据写入及读出方法
CN101840364A (zh) * 2010-01-29 2010-09-22 成都市华为赛门铁克科技有限公司 一种恢复数据的方法及存储装置
CN101819509A (zh) * 2010-04-19 2010-09-01 清华大学深圳研究生院 一种固态硬盘读写方法
JP2012064158A (ja) * 2010-09-17 2012-03-29 Toshiba Corp メモリ管理装置及びメモリ管理方法
WO2013091192A1 (zh) * 2011-12-21 2013-06-27 华为技术有限公司 提供多设备镜像和条带功能的磁盘缓存方法、设备和系统
US9390020B2 (en) * 2012-07-06 2016-07-12 Seagate Technology Llc Hybrid memory with associative cache
US11037625B2 (en) * 2012-11-20 2021-06-15 Thstyme Bermuda Limited Solid state drive architectures
US9811531B2 (en) * 2013-08-26 2017-11-07 Vmware, Inc. Scalable distributed storage architecture
KR20160083762A (ko) * 2015-01-02 2016-07-12 삼성전자주식회사 스토리지 시스템에서의 매핑 테이블 관리 방법 및 이를 적용한 스토리지 시스템
US9678665B2 (en) * 2015-03-06 2017-06-13 Western Digital Technologies, Inc. Methods and systems for memory page allocation
EP3367251B1 (en) * 2016-12-29 2023-06-21 Huawei Technologies Co., Ltd. Storage system and solid state hard disk

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102779548A (zh) * 2011-05-09 2012-11-14 深圳市晶凯电子技术有限公司 用闪存介质作为存储体进行分级管理的固态存储装置及其构建方法
CN104641419A (zh) * 2012-07-13 2015-05-20 三星电子株式会社 固态驱动器控制器、固态驱动器、固态驱动器的数据处理方法、多通道固态驱动器、raid控制器以及其中记录有用于向固态驱动器提供顺序信息的计算机程序的计算机可读记录介质
US20160077962A1 (en) * 2014-09-17 2016-03-17 Kabushiki Kaisha Toshiba Hybrid-hdd policy for what host-r/w data goes into nand
CN105739915A (zh) * 2014-12-29 2016-07-06 三星电子株式会社 存储系统中执行的条带重建方法和存储系统

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3598290A4 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2021026769A (ja) * 2019-07-31 2021-02-22 ベイジン バイドゥ ネットコム サイエンス アンド テクノロジー カンパニー リミテッド ストレージ管理のための方法、装置、機器、コンピュータ読み取り可能な記憶媒体及びコンピュータプログラム
US11275683B2 (en) 2019-07-31 2022-03-15 Beijing Baidu Netcom Science And Technology Co., Ltd. Method, apparatus, device and computer-readable storage medium for storage management
JP7142665B2 (ja) 2019-07-31 2022-09-27 ベイジン バイドゥ ネットコム サイエンス テクノロジー カンパニー リミテッド ストレージ管理のための方法、装置、機器、コンピュータ読み取り可能な記憶媒体及びコンピュータプログラム
JP7491545B2 (ja) 2019-12-27 2024-05-28 Necソリューションイノベータ株式会社 情報処理方法

Also Published As

Publication number Publication date
CN108255414B (zh) 2020-04-03
EP3598290A4 (en) 2020-04-08
JP6823734B2 (ja) 2021-02-03
EP3598290B1 (en) 2024-02-28
JP2020517026A (ja) 2020-06-11
EP3598290A1 (en) 2020-01-22
US20200159458A1 (en) 2020-05-21
CN108255414A (zh) 2018-07-06
US11126377B2 (en) 2021-09-21

Similar Documents

Publication Publication Date Title
US10732898B2 (en) Method and apparatus for accessing flash memory device
WO2018188618A1 (zh) 固态硬盘访问
US10496293B2 (en) Techniques for selecting storage blocks for garbage collection based on longevity information
US10796774B2 (en) Method and apparatus for refreshing flash memory device
KR101459861B1 (ko) 스트라이프 기반 메모리 작동
KR101491943B1 (ko) 트랜잭션 로그 복구
KR101870521B1 (ko) 스토리지 저널링을 개선하는 방법 및 시스템
KR101678868B1 (ko) 플래시 주소 변환 장치 및 그 방법
JP2019502987A (ja) 不揮発性メモリ・システムにおけるマルチページ障害の回復
KR101933766B1 (ko) 플래시 메모리 플러싱을 개선하는 방법 및 시스템
US11379447B2 (en) Method and system for enhancing IOPS of a hard disk drive system based on storing metadata in host volatile memory and data in non-volatile memory using a shared controller
JP5330432B2 (ja) データ記憶装置及びテーブル管理方法
EP4012547B1 (en) Storage method and apparatus for key value (kv) and storage device
US8938641B2 (en) Method and apparatus for synchronizing storage volumes
US11989423B2 (en) Techniques for zoned namespace (ZNS) storage using multiple zones
US20180293137A1 (en) Distributed storage system
JP6556980B2 (ja) ストレージ制御装置、ストレージ制御方法及びストレージ制御プログラム
CN109002265B (zh) 一种数据处理的方法以及相关装置
US10719401B2 (en) Increasing data recoverability during central inode list loss
CN111722789A (zh) 存储器管理方法及存储器存储装置

Legal Events

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

Ref document number: 18785096

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2019556277

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 2018785096

Country of ref document: EP

Effective date: 20191014