WO2020019267A1 - 一种数据处理方法及装置 - Google Patents

一种数据处理方法及装置 Download PDF

Info

Publication number
WO2020019267A1
WO2020019267A1 PCT/CN2018/097293 CN2018097293W WO2020019267A1 WO 2020019267 A1 WO2020019267 A1 WO 2020019267A1 CN 2018097293 W CN2018097293 W CN 2018097293W WO 2020019267 A1 WO2020019267 A1 WO 2020019267A1
Authority
WO
WIPO (PCT)
Prior art keywords
storage space
data
security level
target data
flash memory
Prior art date
Application number
PCT/CN2018/097293
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 PCT/CN2018/097293 priority Critical patent/WO2020019267A1/zh
Priority to US17/262,310 priority patent/US11593000B2/en
Priority to CN201880095798.9A priority patent/CN112513804B/zh
Publication of WO2020019267A1 publication Critical patent/WO2020019267A1/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/062Securing storage systems
    • G06F3/0622Securing storage systems in relation to access
    • 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
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • 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/0614Improving the reliability of storage systems
    • G06F3/0619Improving the reliability of storage systems in relation to data integrity, e.g. data losses, bit errors
    • 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/0629Configuration or reconfiguration of storage systems
    • G06F3/0631Configuration or reconfiguration of storage systems by allocating resources to storage systems
    • 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/0629Configuration or reconfiguration of storage systems
    • G06F3/0632Configuration or reconfiguration of storage systems by initialisation or re-initialisation of storage systems
    • 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/0638Organizing or formatting or addressing of data
    • G06F3/064Management of blocks
    • 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/0638Organizing or formatting or addressing of data
    • G06F3/0644Management of space entities, e.g. partitions, extents, pools
    • 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/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]

Definitions

  • the embodiments of the present application relate to the field of storage technology, and in particular, to a data processing method and device.
  • Redundant Array of Independent NAND is an independent programming unit inside a flash memory device, such as an independently programmable flash chip Die or Plane (a Die can include at least one Plane), analogized to an independent physical A technology that combines multiple independent programmable flash memory chips into an array.
  • a flash memory device such as an independently programmable flash chip Die or Plane (a Die can include at least one Plane), analogized to an independent physical A technology that combines multiple independent programmable flash memory chips into an array.
  • data is stored in strips. In this way, data can be written to multiple independent programmable flash chips in parallel, which greatly improves the writing speed of user data, and can provide storage. Redundancy to improve data reliability.
  • each slice includes a verification data group
  • the verification data group includes at least one verification data
  • the verification data groups of different stripes are located in different independently programmable flash memory chips. That is, for each stripe, at least one independently programmable flash memory chip is required to store the parity data in the stripe.
  • this storage method results in large storage space overhead and low effective utilization of storage space.
  • the embodiments of the present application provide a data processing method and device, which can improve the utilization rate of the storage space of a flash memory device.
  • a data processing method is provided.
  • the data processing method is applied to a non-volatile storage medium (Non Flash Memory) flash memory device including x (x is an integer greater than or equal to 1) independently programmable flash memory chips.
  • the first physical storage space of the flash memory device is used to store data blocks of the first security level and data blocks of the second security level, and the second physical storage space is used to store data blocks of the second security level.
  • the data block of the first security level is composed of x independently programmable flash memory chips in a preset and customizable independent computer flash device partially redundant array (Customizable Partial Rain (CPR)) form and a preset CPR level.
  • a security level data block includes at least one slice set.
  • the slice set is composed of m (m is an integer greater than or equal to 2) adjacent slices, and includes a check data group.
  • the verification data group is located in different independently programmable flash memory chips.
  • the preset CPR format is used to indicate that m adjacent stripes include a verification data group.
  • Data blocks of the second security level are only used to store user data.
  • the first security level is higher than the second security level.
  • the data processing method includes: the flash memory device receives a write data request for requesting to write the target data, and obtains the security level of the target data according to the write data request, so that if the security level of the target data is the first security Level, the flash memory device writes the target data to the first physical storage space; if the security level of the target data is the second security level, the flash memory device writes the target data to the second physical storage space, or writes the target data Data is written into the second physical storage space and the first physical storage space.
  • each stripe set in the data block of the first security level is composed of m adjacent strips, and each stripe set includes a check data group, that is, user data sharing in m adjacent strips
  • each strip includes at least one check data, which effectively reduces the storage space occupied by the check data and improves the utilization of the storage space.
  • the data block of the second security level is only used to store user data, that is, the data block of the second security level does not include check data.
  • the utilization rate of the storage space is also improved to a certain extent.
  • the first security level is higher than the second security level, and each stripe set in the data block of the first security level includes a check data group.
  • the existence of the check data group effectively ensures the reliability of the data. .
  • the flash memory device in this application dynamically allocates storage space for the target data according to the security level of the target data, which can not only ensure the reliability of the target data, but also effectively improve the utilization rate of the storage space.
  • the write data request received by the flash memory device includes a first identifier for indicating a security level of the target data.
  • This application uses first values of different values to specifically indicate the security level of the target data.
  • the first identifier is specifically used to indicate that the security level of the target data is the first security level.
  • the above-mentioned "if the security level of the target data is the first security level, the flash memory device writes the target data to the first physical storage space" is: the flash memory device writes the target data to the first physical storage space and the allocated And the data block of the first security level whose remaining storage space is larger than the size of the storage space required to store the target data; or, the flash memory device writes the target data to the newly allocated data block of the first security level in the first physical storage space; Alternatively, the flash memory device writes the target data into a first security level data block that has been allocated in the first physical storage space and the remaining storage space is less than the size of the storage space required to store the target data, and a new allocation in the first physical storage space Data block of the first security level.
  • the first physical storage space can store both data blocks of the first security level and data blocks of the second security level
  • the second physical storage space is only used to store data blocks of the second security level. Therefore, when the security level of the target data is the first security level, the flash memory device writes the target data into the data block of the first security level of the first physical storage space. In actual use, the flash memory device writes the target data into the data block of the first security level according to the actual usage of the storage space.
  • the first identifier is specifically used to indicate that the security level of the target data is the second security level.
  • the flash memory device writes the target data to the second physical storage space, or writes the target data to the second physical storage space and the first physical storage space.
  • the method is: the flash memory device determines the size of the remaining storage space of the second physical storage space; if the size of the remaining storage space of the second physical storage space is greater than the size of the storage space required to store the target data, the flash memory device writes the target data Into the second physical storage space; or, if the size of the remaining storage space of the second physical storage space is greater than zero and smaller than the size of the storage space required to store the target data, the flash memory device writes the target data to the second physical storage space The remaining storage space of the second physical storage space and the data block of the second security level of the first physical storage space; or, if the size of the remaining storage space of the second physical storage space is equal to zero, the flash memory device writes the target data to the first physical storage space. Data block of the second security level.
  • the flash memory device preferentially writes the target data to the second physical storage space.
  • the flash memory device writes the target data into the remaining storage space of the second physical storage space and the first physical storage space.
  • the m adjacent strips belong to different physical pages, which avoids the problem of simultaneous damage to data of different strips, and improves the flash memory device to recover correct data.
  • the m adjacent strips belong to different physical pages, which avoids the problem of simultaneous damage to data of different strips, and improves the flash memory device to recover correct data.
  • the flash memory device further receives a configuration command from the host.
  • the configuration command includes a size of the first physical storage space, a CPR form, and a preset CPR level.
  • the flash memory The device will respond to the configuration command to complete the initial configuration.
  • the first physical storage space in the present application refers to a maximum storage space in the flash memory device for storing data blocks of a first security level.
  • the size of the storage space required for the flash memory device to store the data of the first security level may be smaller than the size of the first physical storage space.
  • a data processing method is provided, which is applied to a non-volatile storage medium including a flash memory device having x (x is an integer greater than or equal to 1) independently programmable flash memory chips.
  • the first physical storage space of the flash memory device is used to store data blocks of the first security level, and the data blocks of the first security level are composed of x independently programmable flash memories.
  • the chip is composed of a preset redundant array of CPR forms that can be customized for independent computer flash memory devices and a preset CPR level.
  • the data block of the first security level includes at least one strip set, and the strip set consists of m (m is greater than or An integer equal to 2) is composed of adjacent strips.
  • the stripe set includes a parity data set.
  • the parity data sets of different stripe sets are located in different independently programmable flash chips.
  • the preset CPR form is used to indicate m.
  • Each adjacent strip includes a parity data group, and m is an integer greater than or equal to two. If the value of the first identifier is a first preset value, the first identifier is used to indicate that the security level of the target data is the first security level.
  • the above-mentioned “dynamically allocates storage space for the target data according to the security level of the target data indicated by the first identifier, and writes the target data into the allocated storage space"
  • the method is: the flash memory device writes the target data to a first security level data block allocated in the first physical storage space and the remaining storage space is greater than the size of the storage space required to store the target data; or the flash memory device writes the target data Into the newly allocated data block of the first security level in the first physical storage space; or, the flash memory device writes the target data to the allocated first physical storage space and the remaining storage space is less than the size of the storage space required to store the target data A data block of the first security level of the, and a newly allocated data block of the first security level in the first physical storage space.
  • each stripe set in the data block of the first security level is composed of m adjacent strips, and each stripe set includes a check data group, that is, user data sharing in m adjacent strips Compared with the prior art, each strip includes at least one check data, which effectively reduces the storage space occupied by the check data and improves the utilization of the storage space.
  • each stripe set in the data block of the first security level includes a check data group, and the existence of the check data group effectively ensures data reliability.
  • the flash memory device in this application dynamically allocates storage space for the target data according to the security level of the target data, which can not only ensure the reliability of the target data, but also effectively improve the utilization rate of the storage space.
  • the second physical storage space of the flash memory device is used to store a data block of a second security level, and the data block of the second security level is only used to store user data.
  • the first physical storage space of the flash memory device is also used to store data blocks of a second security level, and the second security level is lower than the first security level. If the value of the first identifier is a second preset value, the first identifier is used to indicate that the security level of the target data is the second security level.
  • the flash memory device determines the size of the remaining storage space of the second physical storage space; if the size of the remaining storage space of the second physical storage space is greater than the size of the storage space required to store the target data, the flash memory device writes the target data The second physical storage space; or, if the size of the remaining storage space of the second physical storage space is greater than zero and smaller than the size of the storage space required to store the target data, the flash memory device writes the target data to the remaining of the second physical storage space Data blocks of the second security level of the storage space and the first physical storage space; or, if the size of the remaining storage space of the second physical storage space is equal to zero, the flash memory device writes the target data to the second security of the first physical storage space Level of data blocks.
  • the data blocks of the second security level are only used to store user data, that is, the data blocks of the second security level do not include check data. Compared with the prior art, the utilization rate of the storage space is improved to a certain extent.
  • a data processing method is provided, which is applied to a terminal including a flash memory device.
  • the flash memory device includes x (x is an integer greater than or equal to 1) independently programmable flash memory chips.
  • the processor of the terminal sends a write data request including a first identifier to the flash memory device, where the write data request is used to request writing of the target data, and the first identifier is used to indicate the security level of the target data; upon receiving the write data request Then, the flash memory device dynamically allocates storage space for the target data according to the security level of the target data indicated by the first identifier, and writes the target data into the allocated storage space.
  • the first physical storage space of the flash memory device is used to store data blocks of the first security level, and the data blocks of the first security level are composed of x independently programmable flash memories.
  • the chip is composed of a preset redundant array of CPR forms that can be customized for independent computer flash memory devices and a preset CPR level.
  • the data block of the first security level includes at least one strip set, and the strip set consists of m (m is greater than or An integer equal to 2) is composed of adjacent strips.
  • the stripe set includes a parity data set.
  • the parity data sets of different stripe sets are located in different independently programmable flash chips.
  • the preset CPR form is used to indicate m.
  • Each adjacent strip includes a parity data group, and m is an integer greater than or equal to two. If the value of the first identifier is a first preset value, the first identifier is used to indicate that the security level of the target data is the first security level. In the case where the value of the first identifier is the first preset value, the aforementioned “Flash device dynamically allocates storage space for the target data according to the security level of the target data indicated by the first identifier, and writes the target data into the allocated storage space.
  • the method is: the flash memory device writes the target data to a first security level data block allocated in the first physical storage space and the remaining storage space is greater than the size of the storage space required to store the target data; or the flash memory device writes the target data The data is written into the newly allocated data block of the first security level in the first physical storage space; or, the flash memory device writes the target data to the allocated first physical storage space and the remaining storage space is less than the storage space required to store the target data The data block of the first security level of the size, and the newly allocated data block of the first security level in the first physical storage space.
  • each stripe set in the data block of the first security level is composed of m adjacent strips, and each stripe set includes a check data group, that is, user data sharing in m adjacent strips Compared with the prior art, each strip includes at least one check data, which effectively reduces the storage space occupied by the check data and improves the utilization of the storage space.
  • each stripe set in the data block of the first security level includes a check data group, and the existence of the check data group effectively ensures data reliability.
  • the flash memory device in this application dynamically allocates storage space for the target data according to the security level of the target data, which can not only ensure the reliability of the target data, but also effectively improve the utilization rate of the storage space.
  • the second physical storage space of the flash memory device is used to store a data block of a second security level, and the data block of the second security level is only used to store user data.
  • the first physical storage space of the flash memory device is also used to store data blocks of a second security level, and the second security level is lower than the first security level. If the value of the first identifier is a second preset value, the first identifier is used to indicate that the security level of the target data is the second security level.
  • the aforementioned “Flash device dynamically allocates storage space for the target data according to the security level of the target data indicated by the first identifier, and writes the target data to the allocated storage.
  • the method of "space” is: the flash memory device determines the size of the remaining storage space of the second physical storage space; if the size of the remaining storage space of the second physical storage space is greater than the size of the storage space required to store the target data, the flash memory device converts the target data Write to the second physical storage space; or, if the size of the remaining storage space of the second physical storage space is greater than zero and smaller than the size of the storage space required to store the target data, the flash memory device writes the target data to the second physical storage space The remaining storage space of the second physical storage space and the data block of the second security level of the first physical storage space; or, if the size of the remaining storage space of the second physical storage space is equal to zero, the flash memory device writes the target data to the first physical storage space. Data blocks of two security levels.
  • the data blocks of the second security level are only used to store user data, that is, the data blocks of the second security level do not include check data. Compared with the prior art, the utilization rate of the storage space is improved to a certain extent.
  • the processor may further send a configuration command to the flash memory device, where the configuration command includes a size of the first physical storage space, a CPR form, and a manner of presetting a CPR level;
  • the flash memory device completes the initial configuration of the first physical storage space according to the configuration command.
  • the processor may further dynamically allocate an available storage space of the first physical storage space for each application program in at least one application program of the terminal.
  • each application can occupy the first physical storage space of a certain size, effectively balancing the use of storage resources by each application.
  • a flash memory device includes a storage module, a communication module, and a processing module.
  • the storage module includes x independent programmable flash memory chips.
  • the first physical storage space in the storage module is used to store data blocks of a first security level, data blocks of a second security level, and data blocks of the first security level. It is composed of x independent programmable flash memory chips in a preset and customizable independent computer flash memory device partially redundant array CPR form and a preset CPR level.
  • the data block of the first security level includes at least one stripe set.
  • the set is composed of m adjacent strips.
  • the strip set includes a parity data set.
  • the parity data sets of different strip sets are located in different independently programmable flash chips.
  • the preset CPR format is used to indicate m phases.
  • the adjacent stripe includes a check data group.
  • the second security level data block is only used to store user data.
  • the second physical storage space in the storage module is used to store the second security level data block.
  • the first security level is high.
  • x is an integer greater than or equal to 1
  • m is an integer greater than or equal to 2.
  • the communication module is used to receive a write data request, and the write data request is used to request writing of target data.
  • the processing module is configured to obtain the security level of the target data according to the write data request received by the communication module, and to write the target data to the first of the storage module if the security level of the target data is the first security level.
  • the foregoing write data request includes a first identifier for indicating a security level of the target data.
  • the processing module is specifically configured to write the target data into the first physical storage space that has been allocated and the remaining storage space is greater than the size of the storage space required to store the target data.
  • a data block with a security level or write the target data into a newly allocated data block of a first security level in the first physical storage space; or write the target data into the allocated and remaining storage space in the first physical storage space
  • Data blocks of the first security level that are smaller than the size of the storage space required to store the target data, and data blocks of the first security level that are newly allocated in the first physical storage space.
  • the processing module is specifically configured to determine the size of the remaining storage space of the second physical storage space; if the size of the remaining storage space of the second physical storage space is greater than that required to store the target data The size of the storage space, write the target data into the second physical storage space; or, if the size of the remaining storage space of the second physical storage space is greater than zero and smaller than the size of the storage space required to store the target data, write the target data The remaining storage space of the second physical storage space and the data block of the second security level of the first physical storage space; or, if the size of the remaining storage space of the second physical storage space is equal to zero, the target data is written into the first physical storage space Data blocks of the second security level.
  • the m adjacent strips belong to different physical pages.
  • the communication module is further configured to receive a configuration command from the host.
  • the configuration command includes a size of the first physical storage space, a CPR form, and a preset CPR level.
  • the processing module is further configured to complete the initialization configuration in response to a configuration command received by the communication module.
  • a flash memory device includes a storage module, a communication module, and a processing module.
  • the storage module includes x independent programmable flash memory chips, where x is an integer greater than or equal to 1.
  • the communication module is configured to receive a write data request including a first identifier, where the write data request is used to request writing of target data, and the first identifier is used to indicate a security level of the target data.
  • the processing module is configured to dynamically allocate storage space for the target data according to the security level of the target data indicated by the first identifier in the write data request received by the communication module, and write the target data into the allocated storage space.
  • the first physical storage space of the storage module is used to store data blocks of a first security level, and the data blocks of the first security level are independently programmable by x
  • the flash memory chip is composed of a preset CPR form and a preset CPR level.
  • the data block of the first security level includes at least one strip set, the strip set is composed of m adjacent strips, and the strip set includes one Verification data sets.
  • the verification data sets of different strip sets are located in different independently programmable flash memory chips.
  • the preset CPR format is used to indicate that m adjacent strips include a verification data set, where m is greater than or equal to 2 Integer.
  • the first identifier is used to indicate that a security level of the target data is a first security level.
  • the foregoing processing module is specifically configured to write the target data into the first physical storage space that has been allocated and the remaining storage space is greater than the storage space required to store the target data.
  • a data block of the first security level whose remaining storage space is less than the size of the storage space required to store the target data, and a data block of the first security level newly allocated in the first physical storage space.
  • the second physical storage space of the flash memory device is used to store a data block of a second security level, and the data block of the second security level is only used to store user data.
  • the first physical storage space is also used to store data blocks of a second security level, and the second security level is lower than the first security level. If the value of the first identifier is the second preset value, the first identifier is used to indicate that the security level of the target data is the second security level.
  • the foregoing processing module is specifically configured to determine the size of the remaining storage space of the second physical storage space; if the size of the remaining storage space of the second physical storage space is greater than The size of the storage space required for storing the target data, and write the target data into the second physical storage space; or, if the size of the remaining storage space of the second physical storage space is greater than zero and smaller than the size of the storage space required for storing the target data, Write the target data into the remaining storage space of the second physical storage space and the data block of the second security level of the first physical storage space; or, if the size of the remaining storage space of the second physical storage space is equal to zero, write the target data A data block of a second security level of the first physical storage space.
  • a flash memory device includes one or more processors, a non-volatile storage medium, and a communication interface.
  • the non-volatile storage medium and the communication interface are connected to the one or more processors; the flash memory device communicates with other devices through the communication interface, and the non-volatile storage medium is used to store a computer Program code, the computer program code includes instructions, and when the one or more processors execute the instructions, the flash memory device executes as described in the first aspect, the second aspect, and various possible implementations thereof Data processing methods.
  • a computer-readable storage medium is also provided, where the computer-readable storage medium stores instructions; when the computer-readable storage medium runs on the flash memory device according to the fourth aspect or the fifth aspect, the flash memory device is caused to run on the flash memory device.
  • the data processing method described in the first aspect, the second aspect, and its various possible implementation manners is performed.
  • a computer program product containing instructions, which when executed on the flash memory device described in the fourth aspect or the fifth aspect, causes the flash memory device to execute the first aspect and the second aspect And the data processing methods described in its various possible implementations.
  • a terminal in a ninth aspect, includes a processor, and the flash memory device described in the fourth aspect, the fifth aspect, and various possible implementations thereof.
  • the processor is configured to send a write data request including the first identifier to the flash memory device, so that the flash memory device dynamically allocates storage space for the target data according to the security level of the target data indicated by the first identifier.
  • the write data request is used for Request to write target data.
  • the processor is further configured to send a configuration command to the flash memory device, so that the flash memory device completes the initialization of the first physical storage space in the flash memory device according to the configuration command.
  • Configuration the configuration command includes a size of the first physical storage space, a preset CPR form, and a preset CPR level manner.
  • the processor is further configured to dynamically allocate an available storage space of the first physical storage space for each application in at least one application of the terminal.
  • a computer-readable storage medium is further provided.
  • the computer-readable storage medium stores instructions.
  • the terminal is caused to execute the third aspect and the third aspect. Data processing methods described in various possible implementations.
  • a computer program product containing instructions, which when executed on the terminal described in the above nine aspects, causes the terminal to execute the operations described in the third aspect and its various possible implementation manners. Data processing methods.
  • FIG. 1 is a schematic diagram of a data structure of different levels of RAID in an embodiment of the present application
  • FIG. 2 is a schematic diagram of a hardware structure of a flash memory device according to an embodiment of the present application
  • FIG. 3 is a schematic structural diagram of a non-volatile storage medium according to an embodiment of the present application.
  • FIG. 4 is a schematic structural diagram of a communication system according to an embodiment of the present application.
  • FIG. 5 is a first flowchart of a data processing method in an embodiment of the present application.
  • FIG. 6 is a second schematic flowchart of a data processing method according to an embodiment of the present application.
  • FIG. 7 is a third flowchart of a data processing method according to an embodiment of the present application.
  • FIG. 8 is a schematic structural diagram of a flash memory device in an embodiment of the present application.
  • words such as “exemplary” or “for example” are used as examples, illustrations or illustrations. Any embodiment or design described as “exemplary” or “for example” in the embodiments of the present application should not be construed as more preferred or more advantageous than other embodiments or designs. Rather, the use of the words “exemplary” or “for example” is intended to present the relevant concept in a concrete manner.
  • Flash memory (NAND Flash) is one of the most widely used storage media at present, and it has characteristics incomparable with traditional media in many fields. For example: high data storage speed, low noise, energy saving, earthquake resistance, small size, etc.
  • RAID Redundant Array of Independent Disks
  • RAID is a disk array formed by combining multiple independent physical disks (disks), which can provide user hosts with higher storage performance than a single disk and provide data backup functions.
  • the combination of multiple independent physical disks can be identified by a RAID level.
  • RAID levels After continuous development of RAID technology, it now has 6 standard RAID levels from RAID 0 to RAID 5. In addition, there are RAID levels such as RAID 6, RAID 7, RAID 10 (a combination of RAID 1 and RAID 0), and RAID 01 (a combination of RAID 0 and RAID 1). Different RAID levels represent different storage performance, data security, and storage costs.
  • RAID0 is the data striping technology. It only requires more than two physical disks. The cost is low, which can improve the performance and throughput of the entire disk. RAID 0 does not provide redundancy or error repair capabilities.
  • RAID1 is a mirrored disk array. Its principle is to point the data of one physical disk at the same location to the location of another physical disk. It can automatically copy data written by a user to a physical disk to another physical disk. Data is backed up on the paired physical disks. When the original disk is busy, the data can be read directly from the mirror disk. When the original disk fails, it can also automatically switch to read and write on the mirror disk without Need to reorganize stale data. Does not cause business interruption, provides data security guarantee, and guarantees data availability and repairability to the greatest extent.
  • FIG. 1 illustrates the data distribution in the array.
  • d0, d1, d2, d3, d4, and d5 represent user data
  • d1' is backup data of d1
  • Data, d3 'is the backup data of d3, d4' is the backup data of d4, and d5 'is the backup data of d5.
  • RAID 4 is an independent disk structure with a parity code. It has an independent parity disk. This parity disk is only used to store parity data, but cannot store user data. The user data of the same level on different physical disks is verified by XOR, and the verification data obtained by the verification is stored in the verification disk. When a physical disk fails, data recovery can be completed based on data from other disks, providing data security.
  • FIG. 1 illustrates the data distribution in the array.
  • Disk 3 is the check disk
  • d0, d1, d2, d3, d4, and d5 represent user data
  • P1 is the check data of d0 and d1
  • P2 is the calibration of d2 and d3
  • Check data P3 is check data of d4 and d5.
  • RAID 5 is an independent disk structure for distributed parity. Unlike RAID 4, RAID 5's parity data is stored on different physical disks. When a physical disk fails, RAID 5 can complete data recovery based on the data of other disks.
  • FIG. 1 illustrates the data distribution in the array.
  • d0, d1, d2, d3, d4, and d5 represent user data
  • P1 is the check data of d0 and d1
  • P2 is the check data of d2 and d3
  • P3 is d4 and d5 check data.
  • RAID 6 is an independent disk structure with two distributed storage parity codes. Based on RAID 5, an additional check digit (Q) is added. RAID 6 can complete data recovery from any two concurrent disk failures in the disk array.
  • FIG. 1 shows the data distribution in the array.
  • d0, d1, d2, d3, d4, and d5 represent user data
  • P1 and Q1 are check data of d0 and d1
  • P2 and Q2 are check data of d2 and d3.
  • Data, P3 and Q3 are check data of d4 and d5.
  • An operating system can think of a disk array as a single logical storage unit or disk. By dividing the disk array into multiple stripes, data can be distributed to multiple disks, thereby achieving low latency and high bandwidth, and some of the disks can be restored to a certain extent after they are destroyed.
  • FIG. 1 respectively include strip 0, strip 1 and strip 2, and each strip
  • the bands each include at least one check data.
  • the number of stripes is not limited in different RAIDs.
  • Redundant Array of Independent NAND (RAIN) technology has subsequently appeared.
  • RAIN technology is an independent programming unit inside a flash device, such as an independent programmable flash chip Die or Plane (a Die can include at least one Plane), analogized to an independent physical disk, and multiple independent programmable flash chips are combined RAID-like technology for an array.
  • Common RAIN technologies include RAID4 and RAID5.
  • RAID class 4 there is an independent programmable flash memory chip dedicated to storing check data. Similar to (C) in FIG. 1 described above, the parity data in RAID class 5 is stored in different independently programmable flash memory chips.
  • the mobile device often includes a small number of Dies due to factors such as volume. Typically, the mobile device includes 4 or 8 Dies. For each strip, at least one Die is required to store the check data, which has a large overhead on the storage space and reduces the effective utilization of the storage space.
  • a storage space in a flash memory device can be configured as a single-level cell (SLC).
  • SLC single-level cell
  • the performance is high, so when some data requires high performance or reliability, the data can be written to the storage space configured as the SLC.
  • SLC consumes a lot of space.
  • the prior art does not have a method that can reduce space overhead and improve data reliability.
  • the present application provides a data processing method, which is applied to a flash memory device composed of x (x is an integer greater than or equal to 1) independently programmable flash memory chips.
  • the first physical storage space of the flash memory device is used for
  • the first security level data block and the second security level data block are stored.
  • the first security level data block is composed of x independent programmable flash memory chips in a preset CPR form and a preset CPR level.
  • the security level data block includes at least one strip set.
  • the strip set is composed of m (m is an integer greater than or equal to 2) adjacent strips.
  • the strip set includes a check data group, and different strip sets.
  • the verification data set is located in different independently programmable flash memory chips.
  • the second security level data block is only used to store user data.
  • the second physical storage space of the flash memory device is used to store the second security level data block.
  • the security level is higher than the second security level.
  • the flash memory device dynamically allocates storage for the target data according to the security level of the target data indicated by the first identifier. Space and write the target data to the allocated storage space.
  • each stripe set in the data block of the first security level is composed of m adjacent strips, and each stripe set includes a check data group, that is, user data sharing in m adjacent strips
  • each strip includes at least one check data, which effectively reduces the storage space occupied by the check data and improves the utilization of the storage space.
  • the data block of the second security level is only used to store user data, that is, the data block of the second security level does not include check data. Compared with the prior art, the utilization rate of the storage space is also improved to a certain extent.
  • the first security level is higher than the second security level, and each stripe set in the data block of the first security level includes a check data group.
  • the existence of the check data group effectively ensures the reliability of the data. .
  • the flash memory device in this application dynamically allocates storage space for the target data according to the security level of the target data, which can not only ensure the reliability of the target data, but also effectively improve the utilization rate of the storage space.
  • the independent programmable flash memory chip constituting the flash memory device may be Die or Plane, which is not specifically limited in the embodiment of the present application.
  • FIG. 2 shows a hardware structure of a flash memory device in an embodiment of the present application.
  • the flash memory device in the embodiment of the present application includes a processor 20, a non-volatile storage medium (Non-Volatile Memory) 21, a front-end communication interface 22, a back-end communication interface 23, and a non-volatile storage medium controller. 24. System bus 25 and memory 26.
  • the processor 20, the non-volatile storage medium 21, the front-end communication interface 22, the back-end communication interface 23, the non-volatile storage medium controller 24, and the memory 26 are connected through a system bus 25.
  • the processor 20 is a control center of the flash memory device, and uses various interfaces and lines to connect various parts of the flash memory device.
  • the processor 20 may be a central processing unit (CPU), or may be one or more integrated circuits configured to implement the embodiments of the present application.
  • the processor 20 includes at least one CPU, and each CPU may be a single-core processor (Single-core processor) or a multi-core processor (Multi-core processor).
  • the non-volatile storage medium 21 includes x (x is an integer greater than or equal to 1) individually programmable flash memory chips 210.
  • the storage space of the x independently programmable flash memory chips 210 includes a first physical storage space and a second physical storage space.
  • the first physical storage space is a maximum storage space that is initially configured by the flash memory device and is used to store data of a first security level.
  • the flash memory device may store data blocks of a first security level and data blocks of a second security level.
  • the second physical storage space is used to store data blocks of a second security level, and the first security level is higher than the second security level.
  • the first physical storage space is used to store data blocks of a first security level and the second security level data blocks
  • the second physical storage space is used to store data blocks of a second security level
  • the first security level is higher than the second security level
  • the data block of the first security level is composed of x independent programmable flash memory chips in a preset CPR form and a preset CPR level.
  • the data block of the first security level includes at least one strip set, and each strip set is composed of m (m is an integer greater than or equal to 2) adjacent strips, and each strip set includes a check data Groups, the parity data sets of different stripe sets are located in different independently programmable flash chips.
  • the parity data in the parity data group is used for recovery of erroneous data.
  • the preset CPR level in the embodiment of the present application is similar to the above-mentioned RAID level, and the preset CPR level may be CPR 4, CPR 5, or CPR 6.
  • the verification data group includes two verification data.
  • the check data group includes one check data.
  • the preset CPR format is used to indicate that m adjacent slices include a parity data group.
  • Each stripe set in the data block of the first security level includes a parity data group, that is, user data in m adjacent stripes share a parity data group, compared with each stripe in the prior art
  • a parity data group that is, user data in m adjacent stripes share a parity data group, compared with each stripe in the prior art
  • the above m adjacent stripes belong to different physical pages, avoiding the problem of simultaneous damage of user data of different stripes, and improving the ability of the flash memory device to recover correct data.
  • the data block of the second security level does not include a check data group, and is only used to store user data.
  • each strip includes at least one check data, which effectively improves the utilization of the storage space.
  • the size of the first physical storage space, the preset CPR form, and the preset CPR level are all configured by the flash memory device according to the configuration information sent by the host.
  • the flash memory device allocates data blocks of the first security level or data blocks of the second security level in the first physical storage space according to demand to store data.
  • the embodiments of the present application do not specifically limit the distribution of the data blocks of the first security level and the data blocks of the second security level in the first physical storage space.
  • FIG. 3 is a schematic structural diagram of the non-volatile storage medium 21.
  • the non-volatile storage medium 21 is composed of four Dies (Die 0, Die 1, Die 2, and Die 3), and the data block A is composed of the four Dies using CPR 8x and CPR 5 methods.
  • CPR 8x is used to indicate that two adjacent slices include a parity data group, that is, strip 0 and strip 1 include a parity data group, and strip 2 and strip 3 include a parity data group And so on.
  • the preset CPR level is CPR 5, indicating that the verification data group includes a verification data.
  • d0 to d13 represent user data
  • the parity data group of strip 0 and strip 1 is P1
  • the parity data group of strip 2 and strip 3 is P2
  • P1 and P2 are located in different Dies.
  • FIG. 1 shows a data structure using a RAID 5 level distribution
  • FIG. 3 shows a data structure using a CPR 5 level distribution. It can be seen from FIG. 1 (C) and FIG. 3 that the amount of check data in the flash memory device of the present application is small, which effectively improves the utilization of the storage space.
  • the front-end communication interface 22 is used for communication between the flash memory device and other devices, such as for communication between the flash memory device and the host.
  • the front-end communication interface 22 may be a non-volatile memory host controller interface specification (Non-Volatile Memory Express, NVMe), or may be a Serial Advanced Technology Attachment (SATA), or may be Universal Flash Storage (Universal Flash Storage, UFS) and the like are not specifically limited in this embodiment of the present application.
  • the back-end communication interface 23 is used to communicate with the non-volatile storage medium 21.
  • the non-volatile storage medium controller 24 is used to control writing data in the non-volatile storage medium 21, and the non-volatile storage medium controller 24 may be an independent and single-function processor.
  • the system bus 25 is represented by only one thick line in FIG. 2, but it does not mean that there is only one bus or one type of bus.
  • the memory 26 is used to temporarily store operation data of the processor 20 and data exchanged with the non-volatile storage medium 21.
  • the memory 26 may be a Random Access Memory (RAM), a Read-Only Memory (ROM), or a Cache, which is not specifically limited in this embodiment of the present application.
  • each storage device in the storage system is equivalent to the aforementioned independently programmable flash memory chip.
  • the data processing method provided in this application can be applied to a communication system including a flash memory device and a host.
  • the communication system includes a flash memory device 40 and a host 41, and the flash memory device 40 communicates with the host 41.
  • the flash memory device 40 can respond to an input / output (IO) request issued by the host 41, for example, returning the data to be accessed requested by the read data request, or the data to be written in the write data request.
  • IO input / output
  • the communication system shown in FIG. 4 includes a single host. In practical applications, the communication system may also include multiple hosts.
  • the host 41 may be a client device, such as a computer, or may be a server.
  • the flash memory device 40 and the host 41 may be independently provided or integrated in the same device, which is not specifically limited in this application.
  • the device may be a terminal.
  • the flash memory device 40 may be regarded as a non-volatile memory inside the terminal
  • the host 41 may be regarded as a collection of other devices, such as a processor, other than the non-volatile memory inside the terminal.
  • the present application mainly uses the flash memory device 40 and the host 41 to be independently set as an example for description.
  • the flash memory device 40 and the host 41 may be connected in a wired manner, or may be connected in a wireless manner to form a remote storage system.
  • the host 41 is installed with at least one application program. Each of the at least one application is an application compatible with the system hosted by the host. During the running of any application, the host 41 may send a write data request to the flash memory device 40 so that the flash memory device 40 stores the data requested by the write data request; it may also send a read data request to the flash memory device 40 to facilitate the flash memory. The device 40 acquires the data to be read, and sends the data to be read to the host 41.
  • the host 41 includes an application layer 411, a file system layer 412, and a driver layer 413.
  • the application layer 411 is configured to send a write data request / read data request to the file system layer 412 according to actual needs, and correspondingly, it will also receive a write data response / read data response sent by the file system layer 412.
  • the file system layer 412 has the main functions of CPR registration, configuration, quota management, main service provision, and exception handling.
  • the driver layer 413 is responsible for transmitting a write data request including the first identifier, constructing a device specific vendor command (Device Specific Command), and the like.
  • FIG. 5 is a schematic flowchart of a data processing method according to an embodiment of the present application.
  • the data processing method may be applied to the communication system shown in FIG. 4.
  • the data processing method provided in the embodiment of the present application includes:
  • the host sends a write data request to the flash memory device to request writing of target data.
  • the host will generate a write data request for writing the target data, and send the write to the flash memory device Data request.
  • the flash memory device After receiving the write data request, the flash memory device parses the first identifier in the write data request.
  • the first identifier is used to indicate a security level of the target data.
  • the first identifier is specifically used to indicate that the security level of the target data is the first security level. If the value of the first identifier is a second preset value, the first identifier is specifically used to indicate that the security level of the target data is the second security level, and the first security level is higher than the second security level.
  • the flash memory device parses the first identifier in the write data request, and stores the target data according to the value of the first identifier.
  • the flash memory device stores the target data in the first physical storage space according to the first security level.
  • the flash memory device stores the target data in the first physical storage space.
  • the flash memory device stores the target data in the second physical storage space and / or the first physical storage space according to the second security level.
  • the flash memory device stores the target data Data blocks of the second security level of the second physical storage space and / or data blocks of the second security level of the first physical storage space.
  • the descriptions of the first physical storage space, the second physical storage space, the data blocks of the first security level, and the data blocks of the second security level may refer to the foregoing description, and will not be described in detail here.
  • the flash device parses the Security_flag in the write data request.
  • the flash memory device determines that the security level of the target data is the first security level, and then stores the target data in a data block of the first security level.
  • the flash memory device determines that the security level of the target data is the second level, and then stores the target data in a data block of the second security level.
  • the flash memory device writes the target data into a data block of a first security level of the first physical storage space.
  • the flash memory device writes the target data into a data block of a first security level of the first physical storage space.
  • the flash memory device determines whether there is a first security level data block in the first physical storage space that has been allocated and the remaining storage space is greater than zero (the data block is subsequently represented by the first data block).
  • the flash memory device determines the size of the remaining storage space of the first data block. If the size of the remaining storage space of the first data block is greater than the size of the storage space required to store the target data, the flash memory device writes the target data to the first data block, that is, the flash memory device writes the target data to the first physical storage space. A data block of the first security level that is allocated and has a remaining storage space that is larger than the storage space required for storing the target data. If the size of the remaining storage space of the first data block is smaller than the size of the storage space required to store the target data, the flash memory device writes the target data to the first data block and the newly allocated first security level in the first physical storage space.
  • a data block that is, a flash device writes target data to a first security level data block that is allocated in a first physical storage space and has a remaining storage space smaller than the size of the storage space required to store the target data, and the first physical storage space Newly allocated first security level data block.
  • the flash memory device writes the target data to the newly allocated data block of the first security level in the first physical storage space.
  • the flash memory device may cache the target data before writing the target data.
  • the flash memory device generates a check data group in each stripe set according to a preset CPR form and a preset CPR level, and caches each The parity data group in the stripe collection. In this way, if an error occurs in a certain user data during the process of writing the target data into the data block of the first security level, the flash memory device can recover according to the cached check data group and other user data in the stripe set. The correct user data is output to ensure the successful completion of the data writing process.
  • the flash memory device writes the target data into the data block of the first security level regardless of whether the first physical storage space has the first data block. Since m adjacent strips in the data block of the first security level share a parity data group, in this case, the data processing method provided in this application can effectively guarantee the reliability of the target data, and can also Effectively improve the utilization of storage space.
  • the flash memory device determines the size of the remaining storage space of the second physical storage space.
  • the first identifier is specifically used to indicate that the security level of the target data is the second security level.
  • the flash memory device needs to write the target data into a data block of the second security level.
  • the structure of the data block of the second security level is the structure of the data block B of FIG. 3 described above.
  • both the first physical storage space and the second physical storage space can be used to store data blocks of the second security level.
  • the security level of the target data is the second security level
  • the flash memory device preferentially writes the target data into the data block of the second security level of the second physical storage space. Therefore, if the value of the first identifier is the second preset value, the flash memory device first determines the size of the remaining storage space of the second physical storage space, so that the flash memory device determines the storage space for writing the target data.
  • the flash memory device If the size of the remaining storage space of the second physical storage space is greater than zero and less than the storage space required to store the target data, the flash memory device writes the target data to the remaining storage space of the second physical storage space and the first physical storage space. In the second security level of the data block.
  • the second physical storage space is only used to store data blocks of the second security level. If the size of the remaining storage space of the second physical storage space is greater than zero and smaller than the storage space required to store the target data, the second physical storage space is described. Of remaining storage space is not enough to store the target data. Therefore, the flash memory device also needs to write part of the target data into the data block of the second security level of the first physical storage space.
  • the data block of the second security level of the first physical storage space may be a data block of the second security level that has been allocated in the first physical storage space and the remaining storage space is greater than zero, or may be the first physical storage space.
  • the newly allocated data blocks of the second security level in the storage space may also be data blocks of the second security level that have been allocated in the first physical storage space and the remaining storage space is greater than zero, and the newly allocated data blocks in the first physical storage space.
  • the data block of the second security level is not specifically limited in this embodiment of the present application.
  • the flash memory device If the size of the remaining storage space of the second physical storage space is zero, the flash memory device writes the target data into a data block of a second security level of the first physical storage space.
  • the data block of the second security level of the first physical storage space is the same as the data block of the second security level of the first physical storage space involved in the above S504, and details are not described herein again.
  • the security level of the target data is the second security level
  • the remaining storage space of the second physical storage space is smaller than the storage space required to store the target data, that is, as described in S504 and S505
  • the flash device can write the target data to the data block of the first security level (the data block of the assigned first security level) Or newly allocated data block of the first security level).
  • the check data in the stripe set storing the target data may be junk data.
  • both the effective writing of the target data and the consistency of the data block structure in the first physical storage space can be ensured, which simplifies the processing logic of the flash memory device.
  • the flash memory device If the remaining storage space of the second physical storage space is greater than the storage space required to store the target data, the flash memory device writes the target data to the second physical storage space.
  • the flash memory device directly writes the target data into the data block of the second security level of the second physical storage space.
  • the data block of the second security level of the second physical storage space may be a data block of the second security level that has been allocated in the second physical storage space and the remaining storage space is greater than zero, or may be the second physical storage space.
  • the newly allocated data blocks of the second security level in the space may also be data blocks of the second security level that have been allocated in the second physical storage space and the remaining storage space is greater than zero, and newly allocated data blocks in the second physical storage space.
  • the data block of the second security level is not specifically limited in this embodiment of the present application.
  • the flash memory device writes the target data into a data block of the second security level. Since the data blocks of the second security level are only used to store user data, no check data group is stored, and the utilization rate of the data storage space is high. Although the data block of the second security level does not store the check data group, the reliability of the target data cannot be effectively guaranteed. However, since the second security level is lower than the first security level, in this case, the target data The reduction in reliability is tolerable.
  • the flash memory device After the flash memory device writes all the target data, it sends a write data response to the host to notify the host that the target data has been stored.
  • the flash device After the flash device stores the target data, it stores the correspondence between the physical block address (Physics Block Address, PBA) corresponding to the target data and the logical block address (Logical Block Address, LBA) corresponding to the target data, so as to facilitate
  • PBA Physical Block Address
  • LBA Logical Block Address
  • the data processing method provided in this embodiment of the present application further includes:
  • the host determines information such as a size of the first physical storage space, a CPR form, and a preset CPR level.
  • the host sends a configuration command including the size of the first physical storage space, a CPR form, and a preset CPR level to the flash memory device.
  • the flash memory device completes the initial configuration.
  • the flash memory device reserves the first physical storage space according to the size of the first physical storage space. During subsequent operations, the flash memory device allocates data blocks from the first physical storage space as needed to store data.
  • the host in the embodiment of the present application may also dynamically reserve the available storage space in the first physical storage space for each application in the at least one application.
  • Each application can occupy a certain size of the first physical storage space, effectively balancing the use of storage resources by each application.
  • the processor running the application program sends a registration request to the storage space management module in the host, requesting allocation of the available storage space in the first physical storage space.
  • the storage space management module reserves the size of the available storage space in the first physical storage space for the application, and sends the size of the available storage space to the processor running the application.
  • the available storage space registered by each application refers to the maximum storage space occupied by the application to store data of the first security level in the flash memory device. It can be known from the above description that the first physical storage space is a maximum storage space in the flash memory device for storing data of a first security level. In practical applications, the size of the available storage space registered by each application is smaller than the size of the first physical storage space.
  • the sum of the sizes of available storage spaces registered by all applications is less than or equal to the size of the first physical storage space.
  • the data processing method shown in FIG. 5 is described by using an example in which an application program in a host is running to write target data as an example. Therefore, the flash memory device in FIG. 5 writes a target in a first physical storage space.
  • the process of data essentially means that the flash memory device writes the target data in the first physical storage space based on the size of the available storage space of the application in the first physical storage space.
  • the flash memory device in response to a write data request, can write the target data into a data block of a first security level or a data block of a second security level.
  • the flash memory device in the embodiment of the present application may also read the target data in response to the read data request sent by the host, and use a preset Error Correcting Code (ECC) algorithm to detect the read target. Whether there is error data in the data. In this way, when the flash memory device determines that the read target data has no error data, the flash memory device sends the target data to the host.
  • ECC Error Correcting Code
  • the data processing method provided in the embodiment of the present application includes:
  • the host sends a read data request including the first LBA to the flash memory device.
  • the flash memory device determines a first PBA corresponding to the first LBA according to the first LBA.
  • S702 The flash memory device reads the target data according to the first PBA.
  • S703 The flash memory device detects whether there is erroneous data in the read target data according to a preset ECC algorithm.
  • the flash memory device performs a data recovery process.
  • the flash memory device reads the check data group in the stripe set to which the read target data belongs and the stripe Collect other user data in the collection, and recover the data that currently has errors.
  • the flash memory device sends the target data without error data to the host.
  • each stripe set in the data block of the first security level includes a check data group
  • the check data in the check data group is used for data recovery.
  • the flash memory device can use the check data group and other user data in the stripe set to which the read target data belongs to recover the currently errored data.
  • the flash memory device determines that data is in error or data is lost and cannot be recovered. Accordingly, the flash memory device sends a message to the host to indicate a data error or data loss.
  • the data processing method provided in the embodiments of the present application can also be applied to a terminal.
  • devices inside the terminal interact to implement writing or reading of target data.
  • the flash memory devices in FIG. 5, FIG. 6, and FIG. 7 described above can be regarded as a non-volatile memory inside the terminal, and the host can be regarded as a collection of devices other than the non-volatile memory inside the terminal.
  • the flash device and the host are integrated in the same device, which is the terminal.
  • the data processing method provided in the embodiments of the present application can effectively improve the utilization rate of storage space, and can also ensure the reliability of data to a certain extent.
  • An embodiment of the present application provides a flash memory device, which is configured to execute the steps performed by the flash memory device in the above data processing method.
  • the flash memory device provided in the embodiment of the present application may include a module corresponding to a corresponding step.
  • the functional modules of the flash memory device may be divided according to the foregoing method example.
  • each functional module may be divided corresponding to each function, or two or more functions may be integrated into one processing module.
  • the above integrated modules may be implemented in the form of hardware or software functional modules.
  • the division of the modules in the embodiments of the present application is schematic, and is only a logical function division. In actual implementation, there may be another division manner.
  • FIG. 8 illustrates a possible structural schematic diagram of the flash memory device involved in the foregoing embodiment.
  • the flash memory device 800 includes a communication module 80, a processing module 81, and a storage module 82.
  • the communication module 80 is used to support the flash memory device 800 to perform S500, S601, S700, S705, and / or other processes for the technology described herein.
  • the processing module 81 is used to support the flash memory device 800 to execute S501, S502, S503, S504, S505, S506, S602, S701, S702, S703, S704, and / or the technology described herein. Other processes.
  • the storage module 82 is used to store program code and data of the flash memory device.
  • An embodiment of the present application further provides a computer-readable storage medium.
  • the computer-readable storage medium has instructions stored therein, and when the computer-readable storage medium is run on a flash memory device, the flash memory device is caused to execute the method flow shown in the foregoing data write method embodiment. Steps performed by a flash device.
  • An embodiment of the present application provides a terminal.
  • the terminal includes a flash memory device and a processor, and the interaction between the flash memory device and the processor implements the foregoing data processing method. If the flash memory device 40 and the host 41 shown in FIG. 4 are integrated in the same device, the device may be a terminal.
  • all or part of them may be implemented by software, hardware, firmware, or any combination thereof.
  • a software program When implemented using a software program, it may appear in whole or in part in the form of a computer program product.
  • the computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions according to the embodiments of the present application are generated.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
  • the computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be from a website site, computer, server, or data center Transmission to another website site, computer, server or data center by wire (for example, coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (for example, infrared, wireless, microwave, etc.).
  • the computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, a data center, and the like that includes one or more available medium integration.
  • the usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state disk (Solid State Disk (SSD)), and the like.
  • a magnetic medium for example, a floppy disk, a hard disk, a magnetic tape
  • an optical medium for example, a DVD
  • a semiconductor medium for example, a solid state disk (Solid State Disk (SSD)
  • the disclosed apparatus and method may be implemented in other ways.
  • the device embodiments described above are only schematic.
  • the division of the modules or units is only a logical function division.
  • multiple units or components may be divided.
  • the combination can either be integrated into another device, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, which may be electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may be one physical unit or multiple physical units, that is, may be located in one place, or may be distributed to multiple different places. . Some or all of the units may be selected according to actual needs to achieve the objective of the solution of this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each of the units may exist separately physically, or two or more units may be integrated into one unit.
  • the above integrated unit may be implemented in the form of hardware or in the form of software functional unit.
  • the integrated unit When the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a readable storage medium.
  • the technical solution of the embodiments of the present application is essentially a part that contributes to the existing technology or all or part of the technical solution may be embodied in the form of a software product that is stored in a storage medium Included are several instructions for causing a device (which can be a single-chip microcomputer, a chip, etc.) or a processor to execute all or part of the steps of the method described in the embodiments of the present application.
  • the foregoing storage medium includes various media that can store program codes, such as a U disk, a mobile hard disk, a ROM, a RAM, a magnetic disk, or an optical disk.

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)
  • Computer Security & Cryptography (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)
  • Memory System (AREA)

Abstract

本申请实施例提供一种数据处理方法及装置,涉及存储技术领域,有效提高了存储空间的利用率。该方法应用于第一物理存储空间存储第一安全级别的数据块和第二安全级别的数据块,第二物理存储空间存储第二安全级别的数据块的闪存设备,第一安全级别的数据块中每个条带集合由m个相邻的条带组成,且包括一个校验数据组,第二安全级别的数据块仅用于存储用户数据。该方法包括:接收用于请求写入目标数据的写数据请求,并获取目标数据的安全级别;若目标数据的安全级别为第一安全级别,将目标数据写入第一物理存储空间;若目标数据的安全级别为第二安全级别,将目标数据写入第二物理存储空间,或将目标数据写入第二物理存储空间和第一物理存储空间。

Description

一种数据处理方法及装置 技术领域
本申请实施例涉及存储技术领域,尤其涉及一种数据处理方法及装置。
背景技术
独立NAND冗余阵列(Redundant Array of Independent NAND,RAIN)是将闪存设备内部的一个独立编程单位,如独立可编程闪存芯片Die或Plane(一个Die可以包括至少一个Plane),类比作一个独立的物理磁盘,并将多个独立可编程闪存芯片组合为一个阵列的技术。在上述阵列中,数据的存放是分条带(Strip)存放的,这样,可以将数据并行写入到多个独立可编程闪存芯片中,大大提升用户数据的写入速度,并且可以提供存储的冗余性,以提高数据的可靠性。
目前,每个条带均包括一个校验数据组,校验数据组包括至少一个校验数据,不同条带的校验数据组位于不同的独立可编程闪存芯片。也就是说,对于每个条带而言,需要至少一个独立可编程闪存芯片存储该条带中的校验数据。但是,对于体积较小的设备而言,这种存储方式导致存储空间的开销较大,存储空间的有效利用率较低。
发明内容
本申请实施例提供一种数据处理方法及装置,能够提高闪存设备存储空间的利用率。
为达到上述目的,本申请实施例采用如下技术方案:
第一方面,提供一种数据处理方法,该数据处理方法应用于非易失性存储介质(Non Volatile Memory)包括x(x为大于或等于1的整数)个独立可编程闪存芯片的闪存设备,该闪存设备的第一物理存储空间用于存储第一安全级别的数据块和第二安全级别的数据块,第二物理存储空间用于存储第二安全级别的数据块。这里,第一安全级别的数据块是由x个独立可编程闪存芯片采用预设可定制独立计算机闪存设备部分冗余阵列(Customizable Partial RAIN,CPR)形式和预设CPR级别的方式组成的,第一安全级别的数据块包括至少一个条带集合,条带集合由m(m为大于或等于2的整数)个相邻的条带组成,且包括一个校验数据组,不同的条带集合的校验数据组位于不同的独立可编程闪存芯片,预设CPR形式用于指示m个相邻的条带包括一个校验数据组。第二安全级别的数据块仅用于存储用户数据。第一安全级别高于第二安全级别。具体的,该数据处理方法包括:闪存设备接收用于请求写入目标数据的写数据请求,并根据该写数据请求,获取目标数据的安全级别,这样,若目标数据的安全级别为第一安全级别,则该闪存设备将目标数据写入上述第一物理存储空间;若目标数据的安全级别为第二安全级别,则该闪存设备将目标数据写入上述第二物理存储空间,或者,将目标数据写入第二物理存储空间和第一物理存储空间。
由于第一安全级别的数据块中每个条带集合由m个相邻的条带组成,且每个条带集合包括一个校验数据组,即m个相邻的条带中的用户数据共享一个校验数据组,相比于现有技术中每个条带均包括至少一个校验数据而言,有效的减少了校验数据占用 的存储空间,提高了存储空间的利用率。第二安全级别的数据块仅用于存储用户数据,即第二安全级别的数据块不包括校验数据,相比于现有技术,也在一定程度上提高了存储空间的利用率。
此外,第一安全级别高于第二安全级别,且第一安全级别的数据块中每个条带集合均包括一个校验数据组,该校验数据组的存在有效的保证了数据的可靠性。这样,本申请中的闪存设备根据目标数据的安全级别,为该目标数据动态分配存储空间,既可以保证目标数据的可靠性,又能有效提高存储空间的利用率。
可选的,在本申请的一种可能的实现方式中,闪存设备接收到的写数据请求包括用于指示目标数据的安全级别的第一标识。
本申请采用不同取值的第一标识具体指示目标数据的安全级别。
可选的,在本申请的另一种可能的实现方式中,若上述第一标识的取值为第一预设值,则该第一标识具体用于指示目标数据的安全级别为第一安全级别。相应的,上述“若目标数据的安全级别为第一安全级别,则闪存设备将目标数据写入第一物理存储空间”的方法为:闪存设备将目标数据写入第一物理存储空间中已分配、且剩余存储空间大于存储目标数据所需存储空间的大小的第一安全级别的数据块;或者,闪存设备将目标数据写入第一物理存储空间中新分配的第一安全级别的数据块;或者,闪存设备将目标数据写入第一物理存储空间中已分配、且剩余存储空间小于存储目标数据所需存储空间的大小的第一安全级别的数据块,以及第一物理存储空间中新分配的第一安全级别的数据块。
从上面描述可知,第一物理存储空间既可以存储第一安全级别的数据块,又可以存储第二安全级别的数据块,而第二物理存储空间仅用于存储第二安全级别的数据块,因此,在目标数据的安全级别为第一安全级别的情况下,闪存设备将目标数据写入第一物理存储空间的第一安全级别的数据块中。在实际使用中,闪存设备根据存储空间的实际使用情况将目标数据写入第一安全级别的数据块中。
可选的,在本申请的另一种可能的实现方式中,若上述第一标识的取值为第二预设值,则该第一标识具体用于指示目标数据的安全级别为第二安全级别。相应的,上述“若目标数据的安全级别为第二安全级别,则闪存设备将目标数据写入第二物理存储空间,或者,将目标数据写入第二物理存储空间和第一物理存储空间”的方法为:闪存设备确定第二物理存储空间的剩余存储空间的大小;若第二物理存储空间的剩余存储空间的大小大于存储目标数据所需存储空间的大小,则该闪存设备将目标数据写入第二物理存储空间;或者,若第二物理存储空间的剩余存储空间的大小大于零、且小于存储目标数据所需存储空间的大小,则该闪存设备将目标数据写入第二物理存储空间的剩余存储空间和第一物理存储空间的第二安全级别的数据块;或者,若第二物理存储空间的剩余存储空间的大小等于零,则该闪存设备将目标数据写入第一物理存储空间的第二安全级别的数据块。
在目标数据的安全级别为第二安全级别的场景中,闪存设备优先将该目标数据写入第二物理存储空间。在第二物理存储空间的剩余存储空间不足以存储目标数据的情况下,闪存设备将目标数据写入第二物理存储空间的剩余存储空间和第一物理存储空间中。
可选的,在本申请的另一种可能的实现方式中,上述m个相邻的条带属于不同的物理页,避免了不同条带的数据同时损坏的问题,提高了闪存设备恢复正确数据的能力。
可选的,在本申请的另一种可能的实现方式中,闪存设备还接收来自主机的配置命令,该配置命令包括第一物理存储空间的大小、CPR形式和预设CPR级别,这样,闪存设备会响应该配置命令,完成初始化配置。
本申请中的第一物理存储空间是指闪存设备中用于存储第一安全级别的数据块的最大存储空间。在实际应用中,闪存设备存储第一安全级别的数据所需要的存储空间的大小可能小于第一物理存储空间的大小。
第二方面,提供一种数据处理方法,应用于非易失性存储介质包括x(x为大于或等于1的整数)个独立可编程闪存芯片的闪存设备,该闪存设备在接收到包括用于指示目标数据的安全级别的第一标识的写数据请求后,根据第一标识指示的目标数据的安全级别,为目标数据动态分配存储空间,并将目标数据写入分配的存储空间。
可选的,在本申请的一种可能的实现方式中,闪存设备的第一物理存储空间用于存储第一安全级别的数据块,第一安全级别的数据块是由x个独立可编程闪存芯片采用预设可定制独立计算机闪存设备部分冗余阵列CPR形式和预设CPR级别的方式组成的,第一安全级别的数据块包括至少一个条带集合,条带集合由m(m为大于或等于2的整数)个相邻的条带组成,条带集合包括一个校验数据组,不同的条带集合的校验数据组位于不同的独立可编程闪存芯片,预设CPR形式用于指示m个相邻的条带包括一个校验数据组,m为大于或等于2的整数。若第一标识的取值为第一预设值,则该第一标识用于指示目标数据的安全级别为第一安全级别。在第一标识的取值为第一预设值得情况下,上述“根据第一标识指示的目标数据的安全级别,为目标数据动态分配存储空间,并将目标数据写入分配的存储空间”的方法为:闪存设备将目标数据写入第一物理存储空间中已分配、且剩余存储空间大于存储目标数据所需存储空间的大小的第一安全级别的数据块;或者,闪存设备将目标数据写入第一物理存储空间中新分配的第一安全级别的数据块;或者,闪存设备将目标数据写入第一物理存储空间中已分配、且剩余存储空间小于存储目标数据所需存储空间的大小的第一安全级别的数据块,以及第一物理存储空间中新分配的第一安全级别的数据块。
在目标数据的安全级别为第一安全级别的情况下,闪存设备将目标数据写入第一安全级别的数据块中。由于第一安全级别的数据块中每个条带集合由m个相邻的条带组成,且每个条带集合包括一个校验数据组,即m个相邻的条带中的用户数据共享一个校验数据组,相比于现有技术中每个条带均包括至少一个校验数据而言,有效的减少了校验数据占用的存储空间,提高了存储空间的利用率。
此外,第一安全级别的数据块中每个条带集合均包括一个校验数据组,该校验数据组的存在有效的保证了数据的可靠性。这样,本申请中的闪存设备根据目标数据的安全级别,为该目标数据动态分配存储空间,既可以保证目标数据的可靠性,又能有效提高存储空间的利用率。
可选的,在本申请的另一种可能的实现方式中,闪存设备的第二物理存储空间用于存储第二安全级别的数据块,第二安全级别的数据块仅用于存储用户数据。此外, 闪存设备的第一物理存储空间还用于存储第二安全级别的数据块,第二安全级别低于第一安全级别。若第一标识的取值为第二预设值,则该第一标识用于指示目标数据的安全级别为第二安全级别。在第一标识的取值为第二预设值的情况下,上述“根据第一标识指示的目标数据的安全级别,为目标数据动态分配存储空间,并将目标数据写入分配的存储空间”的方法为:闪存设备确定第二物理存储空间的剩余存储空间的大小;若第二物理存储空间的剩余存储空间的大小大于存储目标数据所需存储空间的大小,该闪存设备将目标数据写入第二物理存储空间;或者,若第二物理存储空间的剩余存储空间的大小大于零、且小于存储目标数据所需存储空间的大小,该闪存设备将目标数据写入第二物理存储空间的剩余存储空间和第一物理存储空间的第二安全级别的数据块;或者,若第二物理存储空间的剩余存储空间的大小等于零,该闪存设备将目标数据写入第一物理存储空间的第二安全级别的数据块。
第二安全级别的数据块仅用于存储用户数据,即第二安全级别的数据块不包括校验数据,相比于现有技术,在一定程度上提高了存储空间的利用率。
第三方面,提供一种数据处理方法,应用于包括闪存设备的终端,该闪存设备包括x(x为大于或等于1的整数)个独立可编程闪存芯片。具体的,终端的处理器向闪存设备发送包括第一标识的写数据请求,该写数据请求用于请求写入目标数据,第一标识用于指示目标数据的安全级别;在接收到写数据请求后,闪存设备根据第一标识指示的目标数据的安全级别,为目标数据动态分配存储空间,并将目标数据写入分配的存储空间。
可选的,在本申请的一种可能的实现方式中,闪存设备的第一物理存储空间用于存储第一安全级别的数据块,第一安全级别的数据块是由x个独立可编程闪存芯片采用预设可定制独立计算机闪存设备部分冗余阵列CPR形式和预设CPR级别的方式组成的,第一安全级别的数据块包括至少一个条带集合,条带集合由m(m为大于或等于2的整数)个相邻的条带组成,条带集合包括一个校验数据组,不同的条带集合的校验数据组位于不同的独立可编程闪存芯片,预设CPR形式用于指示m个相邻的条带包括一个校验数据组,m为大于或等于2的整数。若第一标识的取值为第一预设值,则该第一标识用于指示目标数据的安全级别为第一安全级别。在第一标识的取值为第一预设值得情况下,上述“闪存设备根据第一标识指示的目标数据的安全级别,为目标数据动态分配存储空间,并将目标数据写入分配的存储空间”的方法为:闪存设备将目标数据写入第一物理存储空间中已分配、且剩余存储空间大于存储目标数据所需存储空间的大小的第一安全级别的数据块;或者,闪存设备将目标数据写入第一物理存储空间中新分配的第一安全级别的数据块;或者,闪存设备将目标数据写入第一物理存储空间中已分配、且剩余存储空间小于存储目标数据所需存储空间的大小的第一安全级别的数据块,以及第一物理存储空间中新分配的第一安全级别的数据块。
在目标数据的安全级别为第一安全级别的情况下,闪存设备将目标数据写入第一安全级别的数据块中。由于第一安全级别的数据块中每个条带集合由m个相邻的条带组成,且每个条带集合包括一个校验数据组,即m个相邻的条带中的用户数据共享一个校验数据组,相比于现有技术中每个条带均包括至少一个校验数据而言,有效的减少了校验数据占用的存储空间,提高了存储空间的利用率。
此外,第一安全级别的数据块中每个条带集合均包括一个校验数据组,该校验数据组的存在有效的保证了数据的可靠性。这样,本申请中的闪存设备根据目标数据的安全级别,为该目标数据动态分配存储空间,既可以保证目标数据的可靠性,又能有效提高存储空间的利用率。
可选的,在本申请的另一种可能的实现方式中,闪存设备的第二物理存储空间用于存储第二安全级别的数据块,第二安全级别的数据块仅用于存储用户数据。此外,闪存设备的第一物理存储空间还用于存储第二安全级别的数据块,第二安全级别低于第一安全级别。若第一标识的取值为第二预设值,则该第一标识用于指示目标数据的安全级别为第二安全级别。在第一标识的取值为第二预设值的情况下,上述“闪存设备根据第一标识指示的目标数据的安全级别,为目标数据动态分配存储空间,并将目标数据写入分配的存储空间”的方法为:闪存设备确定第二物理存储空间的剩余存储空间的大小;若第二物理存储空间的剩余存储空间的大小大于存储目标数据所需存储空间的大小,该闪存设备将目标数据写入第二物理存储空间;或者,若第二物理存储空间的剩余存储空间的大小大于零、且小于存储目标数据所需存储空间的大小,该闪存设备将目标数据写入第二物理存储空间的剩余存储空间和第一物理存储空间的第二安全级别的数据块;或者,若第二物理存储空间的剩余存储空间的大小等于零,该闪存设备将目标数据写入第一物理存储空间的第二安全级别的数据块。
第二安全级别的数据块仅用于存储用户数据,即第二安全级别的数据块不包括校验数据,相比于现有技术,在一定程度上提高了存储空间的利用率。
可选的,在本申请的另一种可能的实现方式中,处理器还可以向闪存设备发送配置命令,该配置命令包括第一物理存储空间的大小、CPR形式和预设CPR级别的方式;相应的,闪存设备在接收到配置命令后,根据该配置命令,完成第一物理存储空间的初始化配置。
可选的,在本申请的另一种可能的实现方式中,处理器还可以为终端的至少一个应用程序中的每个应用程序动态分配第一物理存储空间的可用存储空间。这样,每个应用程序均能占用一定大小的第一物理存储空间,有效的均衡了各应用程序对存储资源的利用。
第四方面,提供一种闪存设备,该闪存设备包括存储模块、通信模块和处理模块。具体的,上述存储模块包括x个独立可编程闪存芯片,存储模块中的第一物理存储空间用于存储第一安全级别的数据块和第二安全级别的数据块,第一安全级别的数据块是由x个独立可编程闪存芯片采用预设可定制独立计算机闪存设备部分冗余阵列CPR形式和预设CPR级别的方式组成的,第一安全级别的数据块包括至少一个条带集合,条带集合由m个相邻的条带组成,条带集合包括一个校验数据组,不同的条带集合的校验数据组位于不同的独立可编程闪存芯片,预设CPR形式用于指示m个相邻的条带包括一个校验数据组,第二安全级别的数据块仅用于存储用户数据,存储模块中的第二物理存储空间用于存储第二安全级别的数据块,第一安全级别高于第二安全级别,x为大于或等于1的整数,m为大于或等于2的整数。上述通信模块,用于接收写数据请求,写数据请求用于请求写入目标数据。上述处理模块,用于根据上述通信模块接收到的写数据请求,获取目标数据的安全级别,以及用于若目标数据的安全级别为 第一安全级别,将目标数据写入上述存储模块的第一物理存储空间,以及用于若目标数据的安全级别为第二安全级别,将目标数据写入上述存储模块的第二物理存储空间,或者,将目标数据写入上述存储模块的第二物理存储空间和第一物理存储空间。
可选的,在本申请的一种可能的实现方式中,上述写数据请求包括用于指示目标数据的安全级别的第一标识。
可选的,在本申请的另一种可能的实现方式中,若第一标识的取值为第一预设值,第一标识具体用于指示目标数据的安全级别为第一安全级别。若目标数据的安全级别为第一安全级别,上述处理模块具体用于:将目标数据写入第一物理存储空间中已分配、且剩余存储空间大于存储目标数据所需存储空间的大小的第一安全级别的数据块;或者,将目标数据写入第一物理存储空间中新分配的第一安全级别的数据块;或者,将目标数据写入第一物理存储空间中已分配、且剩余存储空间小于存储目标数据所需存储空间的大小的第一安全级别的数据块,以及第一物理存储空间中新分配的第一安全级别的数据块。
可选的,在本申请的另一种可能的实现方式中,若第一标识的取值为第二预设值,第一标识具体用于指示目标数据的安全级别为第二安全级别。若目标数据的安全级别为第二安全级别,上述处理模块具体用于:确定第二物理存储空间的剩余存储空间的大小;若第二物理存储空间的剩余存储空间的大小大于存储目标数据所需存储空间的大小,将目标数据写入第二物理存储空间;或者,若第二物理存储空间的剩余存储空间的大小大于零、且小于存储目标数据所需存储空间的大小,将目标数据写入第二物理存储空间的剩余存储空间和第一物理存储空间的第二安全级别的数据块;或者,若第二物理存储空间的剩余存储空间的大小等于零,将目标数据写入第一物理存储空间的第二安全级别的数据块。
可选的,在本申请的另一种可能的实现方式中,上述m个相邻的条带属于不同的物理页。
可选的,在本申请的另一种可能的实现方式中,上述通信模块,还用于接收来自主机的配置命令,该配置命令包括第一物理存储空间的大小、CPR形式和预设CPR级别。上述处理模块,还用于响应于上述通信模块接收到的配置命令,完成初始化配置。
第五方面,提供一种闪存设备,该闪存设备包括存储模块、通信模块和处理模块。具体的,上述存储模块包括x个独立可编程闪存芯片,x为大于或等于1的整数。上述通信模块,用于接收包括第一标识的写数据请求,该写数据请求用于请求写入目标数据,第一标识用于指示目标数据的安全级别。上述处理模块,用于根据上述通信模块接收到的写数据请求中的第一标识指示的目标数据的安全级别,为目标数据动态分配存储空间,并将目标数据写入分配的存储空间。
可选的,在本申请的一种可能的实现方式中,上述存储模块的第一物理存储空间用于存储第一安全级别的数据块,第一安全级别的数据块是由x个独立可编程闪存芯片采用预设CPR形式和预设CPR级别的方式组成的,第一安全级别的数据块包括至少一个条带集合,条带集合由m个相邻的条带组成,条带集合包括一个校验数据组,不同的条带集合的校验数据组位于不同的独立可编程闪存芯片,预设CPR形式用于指示m个相邻的条带包括一个校验数据组,m为大于或等于2的整数。若第一标识的取 值为第一预设值,第一标识用于指示目标数据的安全级别为第一安全级别。在第一标识的取值为第一预设值的情况下,上述处理模块具体用于:将目标数据写入第一物理存储空间中已分配、且剩余存储空间大于存储目标数据所需存储空间的大小的第一安全级别的数据块;或者,将目标数据写入第一物理存储空间中新分配的第一安全级别的数据块;或者,将目标数据写入第一物理存储空间中已分配、且剩余存储空间小于存储目标数据所需存储空间的大小的第一安全级别的数据块,以及第一物理存储空间中新分配的第一安全级别的数据块。
可选的,在本申请的另一种可能的实现方式中,闪存设备的第二物理存储空间用于存储第二安全级别的数据块,第二安全级别的数据块仅用于存储用户数据,第一物理存储空间还用于存储第二安全级别的数据块,第二安全级别低于第一安全级别。若第一标识的取值为第二预设值,第一标识用于指示目标数据的安全级别为第二安全级别。在第一标识的取值为第二预设值的情况下,上述处理模块具体用于:确定第二物理存储空间的剩余存储空间的大小;若第二物理存储空间的剩余存储空间的大小大于存储目标数据所需存储空间的大小,将目标数据写入第二物理存储空间;或者,若第二物理存储空间的剩余存储空间的大小大于零、且小于存储目标数据所需存储空间的大小,将目标数据写入第二物理存储空间的剩余存储空间和第一物理存储空间的第二安全级别的数据块;或者,若第二物理存储空间的剩余存储空间的大小等于零,将目标数据写入第一物理存储空间的第二安全级别的数据块。
第六方面,提供一种闪存设备,该闪存设备包括:一个或多个处理器、非易失性存储介质和通信接口。所述非易失性存储介质、所述通信接口与所述一个或多个处理器连接;所述闪存设备通过所述通信接口与其他设备通信,所述非易失性存储介质用于存储计算机程序代码,所述计算机程序代码包括指令,当所述一个或多个处理器执行所述指令时,所述闪存设备执行如上述第一方面、第二方面及其各种可能的实现方式所述的数据处理方法。
第七方面,还提供一种计算机可读存储介质,该计算机可读存储介质中存储有指令;当其在上述第四方面或上述第五方面所述的闪存设备上运行时,使得该闪存设备执行如上述第一方面、第二方面及其各种可能的实现方式所述的数据处理方法。
第八方面,还提供一种包含指令的计算机程序产品,当其在上述第四方面或上述第五方面所述的闪存设备上运行时,使得该闪存设备执行如上述第一方面、第二方面及其各种可能的实现方式所述的数据处理方法。
在本申请中,上述闪存设备的名字对设备或功能模块本身不构成限定,在实际实现中,这些设备或功能模块可以以其他名称出现。只要各个设备或功能模块的功能和本申请类似,属于本申请权利要求及其等同技术的范围之内。
本申请中第四方面、第五方面、第六方面、第七方面、第八方面及其各种实现方式的具体描述,可以参考第一方面、第二方面及其各种实现方式中的详细描述;并且,第四方面、第五方面、第六方面、第七方面、第八方面及其各种实现方式的有益效果,可以参考第一方面、第二方面及其各种实现方式中的有益效果分析,此处不再赘述。
第九方面,提供一种终端,该终端包括处理器,以及如上述第四方面、第五方面及其各种可能的实现方式所述的闪存设备。该处理器,用于向闪存设备发送包括第一 标识的写数据请求,以便于闪存设备根据第一标识指示的目标数据的安全级别,为目标数据动态分配存储空间,这里,写数据请求用于请求写入目标数据。
可选的,在本申请的一种可能的实现方式中,上述处理器,还用于向闪存设备发送配置命令,以便于闪存设备根据该配置命令,完成闪存设备中第一物理存储空间的初始化配置,配置命令包括所述第一物理存储空间的大小、预设CPR形式和预设CPR级别的方式。
可选的,在本申请的另一种可能的实现方式中,上述处理器,还用于为终端的至少一个应用程序中的每个应用程序动态分配第一物理存储空间的可用存储空间。
第十方面,还提供一种计算机可读存储介质,该计算机可读存储介质中存储有指令;当其在上述九方面所述的终端上运行时,使得该终端执行如上述第三方面及其各种可能的实现方式所述的数据处理方法。
第十一方面,还提供一种包含指令的计算机程序产品,当其在上述九方面所述的终端上运行时,使得该终端执行如上述第三方面及其各种可能的实现方式所述的数据处理方法。
在本申请中,上述终端的名字对设备或功能模块本身不构成限定,在实际实现中,这些设备或功能模块可以以其他名称出现。只要各个设备或功能模块的功能和本申请类似,属于本申请权利要求及其等同技术的范围之内。
本申请中第九方面、第十方面、十一方面及其各种实现方式的具体描述,可以参考第三方面及其各种实现方式中的详细描述;并且,第九方面、第十方面、十一方面及其各种实现方式的有益效果,可以参考第三方面及其各种实现方式中的有益效果分析,此处不再赘述。
附图说明
图1为本申请实施例中不同级别RAID的数据结构示意图;
图2为本申请实施例中闪存设备的硬件结构示意图;
图3为本申请实施例中非易失性存储介质的结构示意图;
图4为本申请实施例中通信系统的结构示意图;
图5为本申请实施例中数据处理方法的流程示意图一;
图6为本申请实施例中数据处理方法的流程示意图二;
图7为本申请实施例中数据处理方法的流程示意图三;
图8为本申请实施例中闪存设备的结构示意图。
具体实施方式
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”和“第三”等是用于区别不同对象,而不是用于限定特定顺序。
在本申请实施例中,“示例性的”或者“例如”等词用于表示作例子、例证或说明。本申请实施例中被描述为“示例性的”或者“例如”的任何实施例或设计方案不应被解释为比其它实施例或设计方案更优选或更具优势。确切而言,使用“示例性的”或者“例如”等词旨在以具体方式呈现相关概念。
闪存(NAND Flash)是目前最为广泛使用的存储介质之一,它在众多领域都有着传统介质无法比拟的特点。例如:数据存储速度高、噪声小、节能、抗震、体积小等。
为了提高数据的可靠性,提出了独立磁盘冗余阵列(Redundant Array of Independent disks,RAID)技术。
RAID是一种把多个独立的物理磁盘(disk)组合起来形成的一个磁盘阵列,可以向用户主机提供比单个磁盘更高的存储性能,并可提供数据备份功能。多个独立的物理磁盘的组合方式可以采用RAID级别标识。
RAID技术经过不断的发展,现在已经拥有了从RAID 0到RAID 5的6种标准级别的RAID级别。另外,还有RAID 6、RAID 7、RAID 10(RAID 1与RAID 0的组合)、RAID 01(RAID 0与RAID 1的组合)等RAID级别。不同RAID级别代表着不同的存储性能、数据安全性和存储成本。
RAID 0即数据分条带技术,只需要2块以上的物理磁盘即可,成本低,可以提高整个磁盘的性能和吞吐量。RAID 0没有提供冗余或错误修复能力。
RAID 1是一种镜像磁盘阵列,其原理是将一块物理磁盘的数据以相同的位置指向另一物理磁盘的位置,能够把用户写入物理磁盘的数据百分之百地自动复制到另外一个物理磁盘上,以在成对的物理磁盘上产生互为备份的数据,当原始磁盘繁忙时,可直接从镜像磁盘中读取数据,当原始磁盘失效时,也可以自动切换到镜像磁盘上读写,而不需要重组失效的数据。不会造成业务中断,提供了数据安全保障,最大限度地保证了数据的可用性和可修复性。
示例性的,以4块物理磁盘(磁盘1、磁盘2、磁盘3、磁盘4)组成RAID 1的阵列为例,图1中的(A)示出了该阵列中数据的分布。其中,在图1中的(A)中,d0、d1、d2、d3、d4、d5分别表示用户数据,d0'为d0的备份数据,d1'为d1的备份数据,d2'为d2的备份数据,d3'为d3的备份数据,d4'为d4的备份数据,d5'为d5的备份数据。
RAID 4为带奇偶校验码的独立磁盘结构,具备一块独立的校验盘,该校验盘仅用于存储校验数据,而无法存储用户数据。在不同物理磁盘的同级用户数据通过异或(XOR)进行校验,校验得到的校验数据存储于校验盘。当某一物理磁盘发生故障,能够根据其他磁盘的数据完成数据恢复,提供了数据安全保障。
示例性的,以3块物理磁盘(磁盘1、磁盘2、磁盘3)组成的RAID 4的阵列为例,图1中的(B)示出了该阵列中数据的分布。在图1中的(B)中,磁盘3为校验盘,d0、d1、d2、d3、d4、d5分别表示用户数据,P1为d0和d1的校验数据,P2为d2和d3的校验数据,P3为d4和d5的校验数据。
RAID 5为分布式奇偶校验的独立磁盘结构。与RAID 4不同,RAID 5中的校验数据存储于不同的物理磁盘。当某一物理磁盘发生故障,RAID 5能够根据其他磁盘的数据完成数据恢复。
示例性的,以3块物理磁盘(磁盘1、磁盘2、磁盘3)组成的RAID 5的阵列为例,图1中的(C)示出了该阵列中数据的分布。在图1中的(C)中,d0、d1、d2、d3、d4、d5分别表示用户数据,P1为d0和d1的校验数据,P2为d2和d3的校验数据,P3为d4和d5的校验数据。
RAID 6为带有两种分布存储的奇偶校验码的独立磁盘结构,是在RAID 5的基础上,额外增加了一个校验位(Q)。RAID 6能够从磁盘阵列中的任意两个并发的磁盘 故障中完成数据恢复。
示例性的,以4块物理磁盘(磁盘1、磁盘2、磁盘3、磁盘4)组成的RAID 6的阵列为例,图1中的(D)示出了该阵列中数据的分布。在图1中的(D)中,d0、d1、d2、d3、d4、d5分别表示用户数据,P1和Q1均为d0和d1的校验数据,P2和Q2均为d2和d3的校验数据,P3和Q3均为d4和d5的校验数据。
需要说明的是,尽管图1中的(A)和(D)示出了四个磁盘,图1中的(B)和(C)示出了三个磁盘,在其他的实施方式中,根据RAID的版本不同,还可以包括更多或者更少的磁盘。
操作系统可以把磁盘阵列视为单一的逻辑存储单元或磁盘。通过将磁盘阵列划分为多个条带(Strip),可以将数据分布到多个磁盘,从而实现低延迟、高带宽,并且其中的部分磁盘毁坏后可以在一定程度上恢复数据。
上述图1中的(A)、图1中的(B)、图1中的(C)以及图1中的(D)各自包括有条带0、条带1和条带2,每个条带均包括至少一个校验数据。
在实际应用中,在不同RAID中,条带的数量不限定。
结合上述描述可知,RAID技术需要多个物理磁盘的组合。对于体积较小的设备,如智能手机、平板电脑、上网本等,RAID技术无法充分发挥作用。
对此,后续又出现了独立NAND冗余阵列(Redundant Array of Independent NAND,RAIN)技术。
RAIN技术是将闪存设备内部的一个独立编程单位,如独立可编程闪存芯片Die或Plane(一个Die可以包括至少一个Plane),类比作一个独立的物理磁盘,并将多个独立可编程闪存芯片组合为一个阵列的类RAID技术。常见的RAIN技术有类RAID4、类RAID 5等。
与上述图1中的(B)类似,类RAID 4中,有一个独立可编程闪存芯片专门用于存放校验数据。与上述图1中的(C)类似,类RAID 5中的校验数据存储于不同的独立可编程闪存芯片。
一般的,若上述独立可编程闪存芯片为Die,限于体积等因素,移动设备往往包括较少数量的Die,典型的,移动设备包括4个或8个Die。对于每个条带而言,需要至少一个Die用于存放校验数据,对存储空间的开销过大,降低存储空间的有效利用率。
除此之外,现有技术中,闪存设备中的某一存储空间可以被配置为单阶存储单元(Single-Level Cell,SLC),由于SLC的可擦写次数较多、可靠性和读写性能较高,因此,当某些数据需要较高的性能或可靠性时,可将该数据写到被配置为SLC的存储空间。但是,SLC的空间耗费较大。
综上所述,对于体积较小的设备而言,现有技术中不具备既能减小空间开销,又能提高数据可靠性的方法。
对此,本申请提供一种数据处理方法,该数据处理方法应用于由x(x为大于或等于1的整数)个独立可编程闪存芯片组成的闪存设备,闪存设备的第一物理存储空间用于存储第一安全级别的数据块和第二安全级别的数据块,该第一安全级别的数据块由x个独立可编程闪存芯片采用预设CPR形式和预设CPR级别的方式组成,第一安 全级别的数据块包括至少一个条带集合,条带集合由m(m为大于或等于2的整数)个相邻的条带组成,条带集合包括一个校验数据组,不同的条带集合的校验数据组位于不同的独立可编程闪存芯片,该第二安全级别的数据块仅用于存储用户数据,闪存设备的第二物理存储空间用于存储第二安全级别的数据块,第一安全级别高于第二安全级别。
具体的,闪存设备在接收到用于请求写入目标数据、包括用于指示目标数据的安全级别的写数据请求后,根据该第一标识指示的目标数据的安全级别,为目标数据动态分配存储空间,并将目标数据写入分配的存储空间。由于第一安全级别的数据块中每个条带集合由m个相邻的条带组成,且每个条带集合包括一个校验数据组,即m个相邻的条带中的用户数据共享一个校验数据组,相比于现有技术中每个条带均包括至少一个校验数据而言,有效的减少了校验数据占用的存储空间,提高了存储空间的利用率。第二安全级别的数据块仅用于存储用户数据,即第二安全级别的数据块不包括校验数据,相比于现有技术,也在一定程度上提高了存储空间的利用率。
此外,第一安全级别高于第二安全级别,且第一安全级别的数据块中每个条带集合均包括一个校验数据组,该校验数据组的存在有效的保证了数据的可靠性。这样,本申请中的闪存设备根据目标数据的安全级别,为该目标数据动态分配存储空间,既可以保证目标数据的可靠性,又能有效提高存储空间的利用率。
上述组成闪存设备的独立可编程闪存芯片可以为Die,也可以为Plane,本申请实施例对此不作具体限定。
图2示出了本申请实施例中闪存设备的硬件结构。如图2所示,本申请实施例中闪存设备包括处理器20、非易失性存储介质(Non Volatile Memory)21、前端通信接口22、后端通信接口23、非易失性存储介质控制器24、系统总线25以及内存26。处理器20、非易失性存储介质21、前端通信接口22、后端通信接口23、非易失性存储介质控制器24以及内存26通过系统总线25连接。
处理器20是闪存设备的控制中心,利用各种接口和线路连接闪存设备的各个部分。处理器20可以是中央处理器(Central Processing Unit,CPU),也可以是被配置成实施本申请实施例的一个或多个集成电路。示例性的,处理器20包括至少一个CPU,每一个CPU可以是一个单核处理器(Single-core processor),也可以是一个多核处理器(Multi-core processor)。
非易失性存储介质21包括x(x为大于或等于1的整数)个独立可编程闪存芯片210。x个独立可编程闪存芯片210的存储空间包括第一物理存储空间和第二物理存储空间。其中,第一物理存储空间为闪存设备初始化配置的用于存储第一安全级别的数据的最大存储空间。在该第一物理存储空间中,闪存设备可存储第一安全级别的数据块和第二安全级别的数据块。第二物理存储空间用于存储第二安全级别的数据块,第一安全级别高于第二安全级别。
第一物理存储空间用于存储第一安全级别的数据块和第二安全级别的数据块,第二物理存储空间用于存储第二安全级别的数据块,第一安全级别高于第二安全级别。
第一安全级别的数据块由x个独立可编程闪存芯片采用预设CPR形式和预设CPR级别的方式组成。第一安全级别的数据块包括至少一个条带集合,每个条带集合均由 m(m为大于或等于2的整数)个相邻的条带组成,每个条带集合包括一个校验数据组,不同的条带集合的校验数据组位于不同的独立可编程闪存芯片。校验数据组中的校验数据用于错误数据的恢复。本申请实施例中的预设CPR级别与上述RAID级别类似,预设CPR级别可以为CPR 4、CPR 5或CPR 6。在预设CPR级别为CPR 6的情况下,校验数据组包括两个校验数据。在预设CPR级别为CPR 4或CPR 5的情况下,校验数据组包括一个校验数据。预设CPR形式用于指示m个相邻的条带包括一个校验数据组。
第一安全级别的数据块中每个条带集合包括一个校验数据组,即m个相邻的条带中的用户数据共享一个校验数据组,相比于现有技术中每个条带均包括至少一个校验数据而言,有效的减少了校验数据占用的存储空间,提高了存储空间的利用率。
可选的,上述m个相邻的条带属于不同的物理页,避免了不同条带的用户数据同时损坏的问题,提高了闪存设备恢复正确数据的能力。
第二安全级别的数据块不包括校验数据组,仅用于存储用户数据。相比于现有技术中每个条带均包括至少一个校验数据而言,有效的提高了存储空间的利用率。
第一物理存储空间的大小、预设CPR形式以及预设CPR级别均为闪存设备根据主机发送的配置信息进行配置的。在实际应用中,闪存设备根据需求在第一物理存储空间中分配第一安全级别的数据块或第二安全级别的数据块,以存储数据。本申请实施例对第一物理存储空间中第一安全级别的数据块和第二安全级别的数据块的分布不作具体限定。
示例性的,图3是上述非易失性存储介质21的结构示意图。图3中,非易失性存储介质21由4个Die(Die 0、Die 1、Die 2、Die 3)组成,数据块A是由这4个Die采用CPR 8x和CPR 5的方式组成的。CPR 8x用于指示两个相邻的条带包括一个校验数据组,也就是说,条带0和条带1包括一个校验数据组,条带2和条带3包括一个校验数据组,以此类推。预设CPR级别为CPR 5,说明校验数据组包括一个校验数据。图3中,d0~d13均表示用户数据,条带0和条带1的校验数据组为P1,条带2和条带3的校验数据组为P2,P1和P2位于不同的Die。
上述图1的(C)表示采用RAID 5级别分布的数据结构,图3表示表示采用CPR5级别分布的数据结构。从图1的(C)和图3可以看出,本申请的闪存设备中校验数据的数量较少,有效的提高存储空间的利用率。
前端通信接口22用于闪存设备与其他设备通信,如用于闪存设备与主机通信。示例性的,前端通信接口22可以为非易失性内存主机控制器接口规范(Non-Volatile Memory express,NVMe),也可以为串行高级技术附件(Serial Advanced Technology Attachment,SATA),还可以为通用闪存存储(Universal Flash Storage,UFS)等,本申请实施例对此不作具体限定。
后端通信接口23用于与非易失性存储介质21通信。
非易失性存储介质控制器24用于控制在非易失性存储介质21中写入数据,该非易失性存储介质控制器24可以是一个独立的、且功能单一的处理器。
系统总线25在图2中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。
内存26用于暂时存储处理器20的运算数据,以及与非易失性存储介质21交换的数据。内存26可以为随机存储器(Random Access Memory,RAM),也可以为只读存储器(Read-Only Memory,ROM),还可以为高速缓存(Cache),本申请实施例对此不作具体限定。
需要说明的是,上述闪存设备也可以理解为包括多个存储设备的存储系统。这种情况下,存储系统中的每个存储设备相当于上述独立可编程闪存芯片。
本申请提供的数据处理方法可以适用于包括闪存设备和主机的通信系统。如图4所示,通信系统包括闪存设备40和主机41,闪存设备40与主机41通信。闪存设备40能够响应主机41下发的输入输出(Input/Output,IO)请求,例如:返回读数据请求所请求的待访问数据、写入写数据请求中的待写入数据。图4示出的通信系统包括单一的主机。在实际应用中,该通信系统也可以包括多个主机。
主机41可以是客户端设备,如计算机,也可以是服务器。这里,闪存设备40和主机41可以独立设置,也可以集成于同一设备,本申请对此不作具体限定。
若闪存设备40和主机41集成于同一设备,该设备可以为终端。在这种情况下,闪存设备40可以视为终端内部的非易失性存储器,主机41可以视为终端内部除非易失性存储器以外的其他器件的集合,如处理器。
为了便于理解,本申请主要以闪存设备40和主机41独立设置为例进行说明。
闪存设备40和主机41之间可以采用有线方式连接,也可以采用无线方式连接以形成远程存储的系统。
主机41安装有至少一个应用程序。该至少一个应用程序中的每个应用程序均为主机搭载的系统所兼容的应用程序。在任一应用程序的运行过程中,主机41可以向闪存设备40发送写数据请求,以便于闪存设备40存储该写数据请求所请求的数据;也可以向闪存设备40发送读数据请求,以便于闪存设备40获取待读取数据,并向主机41发送该待读取数据。
具体的,在软件层面,主机41包括应用层411、文件系统层412以及驱动层413。应用层411用于根据实际需求向文件系统层412发送写数据请求/读数据请求,相应的,还会接收文件系统层412发送的写数据响应/读数据响应。文件系统层412具备CPR的注册、配置、限额管理、主要服务提供、异常处理等主要功能。驱动层413负责传递包括第一标识的写数据请求,构造设备特定供应商命令(Device Specific Vendor Command)等。
闪存设备40的结构可以参考上述图2,这里不再进行详细赘述。
以下,结合上述图2示出的闪存设备、图3示出的非易失性存储介质、图4示出的通信系统对本申请提供的数据处理方法进行详细描述。
图5为本申请实施例中数据处理方法的一种流程示意图,该数据处理方法可以应用于图4示出的通信系统中。如图5所示,本申请实施例提供的数据处理方法包括:
S500、主机向闪存设备发送用于请求写入目标数据的写数据请求。
结合上述描述可知,在某一应用程序的运行过程中,若需要在闪存设备中写入目标数据,则该主机会生成用于请求写入目标数据的写数据请求,并向闪存设备发送该写数据请求。
S501、闪存设备接收到写数据请求后,解析写数据请求中的第一标识。
第一标识用于指示目标数据的安全级别。
可选的,若第一标识的取值为第一预设值,则该第一标识具体用于指示目标数据的安全级别为第一安全级别。若第一标识的取值为第二预设值,则该第一标识具体用于指示目标数据的安全级别为第二安全级别,第一安全级别高于第二安全级别。
具体的,闪存设备解析写数据请求中的第一标识,并根据第一标识的取值,存储目标数据。当第一标识的取值为第一预设值时,闪存设备根据第一安全级别将目标数据存储于第一物理存储空间,具体的,闪存设备将目标数据存储于第一物理存储空间的第一安全级别的数据块中。当第一标识的取值为第二预设值时,闪存设备根据第二安全级别将目标数据存储于第二物理存储空间和/或第一物理存储空间,具体的,闪存设备将目标数据存储于第二物理存储空间的第二安全级别的数据块和/或第一物理存储空间的第二安全级别的数据块中。这里,第一物理存储空间、第二物理存储空间、第一安全级别的数据块和第二安全级别的数据块的描述可参考上述描述,此处不再进行详细赘述。
示例性的,若第一标识为Security_flag,第一预设值为1,第二预设值为0。闪存设备解析写数据请求中的Security_flag。当Security_flag的取值为1时,闪存设备确定目标数据的安全级别为第一安全级别,则将目标数据存储于第一安全级别的数据块中。当Security_flag的取值为0时,闪存设备确定目标数据的安全级别为第二级别,则将目标数据存储于第二安全级别的数据块中。
S502、如果第一标识的取值为第一预设值,闪存设备将目标数据写入第一物理存储空间的第一安全级别的数据块中。
若第一标识的取值为第一预设值,则该第一标识具体用于指示目标数据的安全级别为第一安全级别。相应的,闪存设备将目标数据写入第一物理存储空间的第一安全级别的数据块中。
示例性的,第一安全级别的数据块的结构可以参考上述图3中数据块A的结构。
具体的,闪存设备确定第一物理存储空间中是否存在已分配、且剩余存储空间大于零的第一安全级别的数据块(后续将该数据块采用第一数据块表示)。
若第一物理存储空间中存在第一数据块,则闪存设备确定第一数据块的剩余存储空间的大小。若第一数据块的剩余存储空间的大小大于存储目标数据所需存储空间的大小,则闪存设备将目标数据写入该第一数据块,即闪存设备将目标数据写入第一物理存储空间中已分配、且剩余存储空间的大小大于存储目标数据所需存储空间的大小的第一安全级别的数据块。若第一数据块的剩余存储空间的大小小于存储目标数据所需存储空间的大小,则闪存设备将目标数据写入该第一数据块以及第一物理存储空间中新分配的第一安全级别的数据块,即闪存设备将目标数据写入第一物理存储空间中已分配、且剩余存储空间小于存储目标数据所需存储空间的大小的第一安全级别的数据块,以及第一物理存储空间中新分配的第一安全级别的数据块。
若第一物理存储空间中不存在第一数据块,则闪存设备将目标数据写入第一物理存储空间中新分配的第一安全级别的数据块。
可选的,闪存设备在写目标数据之前,还可缓存该目标数据,同时,闪存设备根 据预设CPR形式和预设CPR级别生成每个条带集合中的校验数据组,并缓存每个条带集合中的校验数据组。这样,若在将目标数据写入第一安全级别的数据块的过程中某一用户数据发生错误,则该闪存设备可根据已经缓存的校验数据组和条带集合中的其他用户数据,恢复出正确的用户数据,以保证写数据过程的顺利完成。
从上述描述可知,在目标数据的安全级别为第一安全级别的情况下,不论第一物理存储空间是否存在第一数据块,闪存设备均将目标数据写入第一安全级别的数据块中。由于第一安全级别的数据块中m个相邻的条带共享一个校验数据组,因此,在这种情况下,本申请提供的数据处理方法能够有效的保证目标数据的可靠性,还能有效提高存储空间的利用率。
S503、如果第一标识的取值为第二预设值,闪存设备确定第二物理存储空间的剩余存储空间的大小。
第一标识的取值为第二预设值时,该第一标识具体用于指示目标数据的安全级别为第二安全级别。这种情况下,闪存设备需要将目标数据写入第二安全级别的数据块中。第二安全级别的数据块的描述可以参考上述描述,此处不再进行详细赘述。
示例性的,第二安全级别的数据块的结构如上述图3的数据块B的结构。
从上面描述可知,第一物理存储空间和第二物理存储空间均可用于存储第二安全级别的数据块。在目标数据的安全级别为第二安全级别的情况下,闪存设备优先将该目标数据写入第二物理存储空间的第二安全级别的数据块中。因此,如果第一标识的取值为第二预设值,闪存设备先确定第二物理存储空间的剩余存储空间的大小,以便于闪存设备确定写入目标数据的存储空间。
S504、如果第二物理存储空间的剩余存储空间的大小大于零、且小于存储目标数据所需的存储空间,闪存设备将目标数据写入第二物理存储空间的剩余存储空间和第一物理存储空间的第二安全级别的数据块中。
第二物理存储空间仅用于存储第二安全级别的数据块,如果第二物理存储空间的剩余存储空间的大小大于零、且小于存储目标数据所需的存储空间,则说明第二物理存储空间的剩余存储空间不足以存储目标数据。因此,闪存设备还需要将目标数据的部分数据写入第一物理存储空间的第二安全级别的数据块中。
可选的,这里第一物理存储空间的第二安全级别的数据块可以为第一物理存储空间中已分配、且剩余存储空间大于零的第二安全级别的数据块,也可以为第一物理存储空间中新分配的第二安全级别的数据块,还可以为第一物理存储空间中已分配、且剩余存储空间大于零的第二安全级别的数据块,以及第一物理存储空间中新分配的第二安全级别的数据块,本申请实施例对此不作具体限定。
S505、如果第二物理存储空间的剩余存储空间的大小为零,闪存设备将目标数据写入第一物理存储空间的第二安全级别的数据块中。
这里第一物理存储空间的第二安全级别的数据块与上述S504中涉及到的第一物理存储空间的第二安全级别的数据块相同,此处不再进行详细赘述。
特殊的,实际应用中,在目标数据的安全级别为第二安全级别,第二物理存储空间的剩余存储空间的大小小于存储目标数据所需的存储空间的场景中,即在S504和S505所述的场景中,如果第一物理存储空间的剩余存储空间的大小大于当前所有应用 程序已注册的可用存储空间的大小总和(应用程序注册的可用存储空间的描述参考后续描述)、第一物理存储空间无可用的第二安全级别的数据块、且存在可用的第一安全级别的数据块,则闪存设备可将目标数据写入第一安全级别的数据块(已分配的第一安全级别的数据块或新分配的第一安全级别的数据块)中。此时,存储有目标数据的条带集合中的校验数据可以为垃圾数据。这样,既能保证目标数据的有效写入,又能保证第一物理存储空间中数据块结构的一致性,简化了闪存设备的处理逻辑。
S506、如果第二物理存储空间的剩余存储空间大于存储目标数据所需的存储空间,闪存设备将目标数据写入第二物理存储空间。
具体的,如果第二物理存储空间的剩余存储空间大于存储目标数据所需的存储空间,则闪存设备直接将目标数据写入第二物理存储空间的第二安全级别的数据块中。
可选的,第二物理存储空间的第二安全级别的数据块可以为第二物理存储空间中已分配、且剩余存储空间大于零的第二安全级别的数据块,也可以为第二物理存储空间中新分配的第二安全级别的数据块,还可以为第二物理存储空间中已分配、且剩余存储空间大于零的第二安全级别的数据块,以及第二物理存储空间中新分配的第二安全级别的数据块,本申请实施例对此不作具体限定。
从S503~S506的描述可知,若目标数据的安全级别为第二安全级别,则闪存设备将该目标数据写入第二安全级别的数据块中。由于第二安全级别的数据块仅用于存储用户数据,未存储校验数据组,数据存储空间的利用率较高。虽然第二安全级别的数据块未存储校验数据组,导致目标数据的可靠性不能得到有效保障,但是,由于第二安全级别低于第一安全级别,因此,在这种情况下,目标数据的可靠性的降低是可以容忍的。
后续,闪存设备将目标数据全部写入后,向主机发送写数据响应,用于通知主机目标数据已经存储。闪存设备在存储目标数据后,存储与该目标数据对应的物理块地址(Physics Block Address,PBA)以及与该目标数据对应的逻辑块地址(Logical Block Address,LBA)之间的对应关系,以便于闪存设备在接收到主机发送的读数据请求后,根据该对应关系,确定与该读数据请求中的LBA对应的PBA,进而根据确定出的PBA读取数据。
进一步地,在出厂或者恢复出厂配置的时候,主机和闪存设备均可完成初始化配置。结合图5,如图6所示,在S500之前,本申请实施例提供的数据处理方法还包括:
S600、主机确定第一物理存储空间的大小、CPR形式和预设CPR级别等信息。
S601、主机向闪存设备发送包括上述第一物理存储空间的大小、CPR形式和预设CPR级别的配置命令。
S602、响应于配置命令,闪存设备完成初始化配置。
具体的,响应于配置命令,闪存设备根据第一物理存储空间的大小,预留第一物理存储空间。在后续运行过程中,闪存设备根据需要从第一物理存储空间分配数据块,以存储数据。
可选的,在主机和闪存设备完成初始化配置后,本申请实施例中的主机还可以为至少一个应用程序中的每个应用程序动态预留第一物理存储空间中的可用存储空间,这样,每个应用程序均能占用一定大小的第一物理存储空间,有效的均衡了各应用程 序对存储资源的利用。具体的,应用程序在运行过程,运行该应用程序的处理器向主机中的存储空间管理模块发送注册请求,请求分配第一物理存储空间中的可用存储空间。在确定接受该注册请求后,存储空间管理模块为该应用程序预留第一物理存储空间中可用存储空间的大小,并将该可用存储空间的大小向运行该应用程序的处理器发送。
每个应用程序注册的可用存储空间是指该应用程序在闪存设备中存储第一安全级别的数据所占用的最大存储空间。从上面描述可知,第一物理存储空间为闪存设备中用于存储第一安全级别的数据的最大存储空间。实际应用中,每个应用程序注册的可用存储空间的大小均小于第一物理存储空间的大小。
此外,在实际应用中,所有应用程序注册的可用存储空间的大小总和小于或等于第一物理存储空间的大小。
图5示出的数据处理方法是以主机中的某一应用程序在运行过程中,请求写入目标数据为例进行说明的,因此,图5中闪存设备在第一物理存储空间中写入目标数据的过程实质上是指闪存设备基于该应用程序在第一物理存储空间中的可用存储空间的大小,在第一物理存储空间中写入目标数据。
从图5示出的实施例可以看出,响应于写数据请求,闪存设备可以将目标数据写入第一安全级别的数据块或第二安全级别的数据块。相应的,本申请实施例中的闪存设备还可以响应于主机发送的读数据请求,读取目标数据,并采用预设的错误检查和纠正(Error Correcting Code,ECC)算法检测读取到的目标数据是否存在错误数据,这样,当闪存设备确定读取到的目标数据不存在错误数据后,闪存设备向主机发送该目标数据。
具体的,如图7所示,本申请实施例提供的数据处理方法包括:
S700、主机向闪存设备发送包括第一LBA的读数据请求。
S701、响应于读数据请求,闪存设备根据第一LBA,确定与第一LBA对应的第一PBA。
S702、闪存设备根据第一PBA,读取目标数据。
S703、闪存设备根据预设的ECC算法检测读取到的目标数据是否存在错误数据。
S704、若闪存设备读取到的目标数据存在错误数据,则闪存设备执行数据恢复过程。
具体的,若上述第一PBA为某一第一安全级别的数据块的地址,则闪存设备读取所述读取到的目标数据所归属的条带集合中的校验数据组以及该条带集合中的其他用户数据,恢复当前出错的数据。相应的,在闪存设备恢复出当前出错的数据后,该闪存设备向主机发送不存在错误数据的目标数据。
容易理解的是,由于第一安全级别的数据块中每个条带集合均包括一个校验数据组,该校验数据组中的校验数据用于数据恢复,因此,在闪存设备确定读取到的目标数据存在错误数据后,该闪存设备可利用所述读取到的目标数据归属的条带集合中的校验数据组以及其他用户数据,恢复出当前出错的数据。
若上述第一PBA为某一第二安全级别的数据块的地址,则闪存设备确定数据出错或数据丢失,无法恢复。相应的,闪存设备向主机发送用于指示数据错误或数据丢失 的消息。
容易理解的是,由于第二安全级别的数据块仅用于存储用户数据,未存储校验数据,因此,在目标数据属于第二安全级别的数据块中的情况下,闪存设备无法恢复数据。
S705、若闪存设备读取到的目标数据不存在错误数据,则闪存设备向主机发送读取到的目标数据。
此外,本申请实施例提供的数据处理方法还可应用于终端,这样,终端内部的器件进行交互,实现目标数据的写入或读取。在这种场景中,上述图5、图6、图7中的闪存设备可视为终端内部的非易失性存储器,主机可视为终端内部除非易失性存储器以外的其他器件的集合。闪存设备和主机集成于同一设备,该设备为终端。
终端内部器件的交互过程可参考上述图5、图6或图7,此处不再进行详细赘述。
综上所述,本申请实施例提供的数据处理方法能够有效的提高存储空间的利用率,也能在一定程度上保证数据的可靠性。
本申请实施例提供一种闪存设备,该闪存设备用于执行以上数据处理方法中的闪存设备所执行的步骤。本申请实施例提供的闪存设备可以包括相应步骤所对应的模块。
本申请实施例可以根据上述方法示例对闪存设备进行功能模块的划分,例如,可以对应各个功能划分各个功能模块,也可以将两个或两个以上的功能集成在一个处理模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。本申请实施例中对模块的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
在采用对应各个功能划分各个功能模块的情况下,图8示出上述实施例中所涉及的闪存设备的一种可能的结构示意图。如图8所示,闪存设备800包括通信模块80、处理模块81和存储模块82。
其中,上述通信模块80用于支持该闪存设备800执行S500、S601、S700、S705,和/或用于本文所描述的技术的其它过程。
上述处理模块81用于支持该闪存设备800执行上述实施例中的S501、S502、S503、S504、S505、S506、S602、S701、S702、S703、S704,和/或用于本文所描述的技术的其它过程。
上述存储模块82用于存储该闪存设备的程序代码和数据。
需要说明的是,上述方法实施例涉及的各步骤的所有相关内容均可以援引到对应功能模块的功能描述,在此不再赘述。
本申请实施例还提供一种计算机可读存储介质,计算机可读存储介质中存储有指令,当其在闪存设备上运行时,使得闪存设备执行上述数据写入方法实施例所示的方法流程中闪存设备执行的各个步骤。
本申请实施例提供一种终端,该终端包括闪存设备和处理器,闪存设备和处理器之间的交互实现上述数据处理方法。若图4示出的闪存设备40和主机41集成于同一设备,则该设备可以为终端。
在上述实施例中,可以全部或部分的通过软件,硬件,固件或者其任意组合来实现。当使用软件程序实现时,可以全部或部分地以计算机程序产品的形式出现。所述 计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。该可用介质可以是磁性介质,(例如,软盘,硬盘、磁带)、光介质(例如,DVD)或者半导体介质(例如固态硬盘Solid State Disk(SSD))等。
通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个装置,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是一个物理单元或多个物理单元,即可以位于一个地方,或者也可以分布到多个不同地方。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该软件产品存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何在本申请揭露的技术范围内的变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。

Claims (29)

  1. 一种数据处理方法,其特征在于,应用于非易失性存储介质包括x个独立可编程闪存芯片的闪存设备,所述闪存设备的第一物理存储空间用于存储第一安全级别的数据块和第二安全级别的数据块,所述第一安全级别的数据块是由所述x个独立可编程闪存芯片采用预设可定制独立计算机闪存设备部分冗余阵列CPR形式和预设CPR级别的方式组成的,所述第一安全级别的数据块包括至少一个条带集合,所述条带集合由m个相邻的条带组成,所述条带集合包括一个校验数据组,不同的所述条带集合的校验数据组位于不同的所述独立可编程闪存芯片,所述预设CPR形式用于指示所述m个相邻的条带包括一个校验数据组,所述第二安全级别的数据块仅用于存储用户数据,所述闪存设备的第二物理存储空间用于存储所述第二安全级别的数据块,所述第一安全级别高于所述第二安全级别,x为大于或等于1的整数,m为大于或等于2的整数;
    所述数据处理方法包括:
    接收写数据请求,所述写数据请求用于请求写入目标数据;
    根据所述写数据请求,获取所述目标数据的安全级别;
    若所述目标数据的安全级别为所述第一安全级别,将所述目标数据写入所述第一物理存储空间;
    若所述目标数据的安全级别为所述第二安全级别,将所述目标数据写入所述第二物理存储空间,或者,将所述目标数据写入所述第二物理存储空间和所述第一物理存储空间。
  2. 根据权利要求1所述的数据处理方法,其特征在于,所述写数据请求包括用于指示所述目标数据的安全级别的第一标识。
  3. 根据权利要求2所述的数据处理方法,其特征在于,若所述第一标识的取值为第一预设值,所述第一标识具体用于指示所述目标数据的安全级别为所述第一安全级别;所述若所述目标数据的安全级别为所述第一安全级别,将所述目标数据写入所述第一物理存储空间,具体包括:
    将所述目标数据写入所述第一物理存储空间中已分配、且剩余存储空间大于存储所述目标数据所需存储空间的大小的所述第一安全级别的数据块;
    或者,
    将所述目标数据写入所述第一物理存储空间中新分配的所述第一安全级别的数据块;
    或者,
    将所述目标数据写入所述第一物理存储空间中已分配、且剩余存储空间小于存储所述目标数据所需存储空间的大小的所述第一安全级别的数据块,以及所述第一物理存储空间中新分配的所述第一安全级别的数据块。
  4. 根据权利要求2或3所述的数据处理方法,若所述第一标识的取值为第二预设值,所述第一标识具体用于指示所述目标数据的安全级别为所述第二安全级别;
    所述若所述目标数据的安全级别为所述第二安全级别,将所述目标数据写入所述第二物理存储空间,或者,将所述目标数据写入所述第二物理存储空间和所述第一物 理存储空间,具体包括:
    确定所述第二物理存储空间的剩余存储空间的大小;
    若所述第二物理存储空间的剩余存储空间的大小大于存储所述目标数据所需存储空间的大小,将所述目标数据写入所述第二物理存储空间;或者,若所述第二物理存储空间的剩余存储空间的大小大于零、且小于存储所述目标数据所需存储空间的大小,将所述目标数据写入所述第二物理存储空间的剩余存储空间和所述第一物理存储空间的所述第二安全级别的数据块;或者,若所述第二物理存储空间的剩余存储空间的大小等于零,将所述目标数据写入所述第一物理存储空间的所述第二安全级别的数据块。
  5. 根据权利要求1-4中任意一项所述的数据处理方法,其特征在于,
    所述m个相邻的条带属于不同的物理页。
  6. 根据权利要求1-5中任意一项所述的数据处理方法,其特征在于,所述数据处理方法还包括:
    接收来自主机的配置命令,所述配置命令包括所述第一物理存储空间的大小、所述CPR形式和预设CPR级别;
    响应于所述配置命令,完成初始化配置。
  7. 一种数据处理方法,其特征在于,应用于非易失性存储介质包括x个独立可编程闪存芯片的闪存设备,x为大于或等于1的整数,所述数据处理方法包括:
    接收包括第一标识的写数据请求,所述写数据请求用于请求写入目标数据,所述第一标识用于指示所述目标数据的安全级别;
    根据所述第一标识指示的所述目标数据的安全级别,为所述目标数据动态分配存储空间,并将所述目标数据写入分配的存储空间。
  8. 根据权利要求7所述的数据处理方法,其特征在于,所述闪存设备的第一物理存储空间用于存储第一安全级别的数据块,所述第一安全级别的数据块是由所述x个独立可编程闪存芯片采用预设可定制独立计算机闪存设备部分冗余阵列CPR形式和预设CPR级别的方式组成的,所述第一安全级别的数据块包括至少一个条带集合,所述条带集合由m个相邻的条带组成,所述条带集合包括一个校验数据组,不同的所述条带集合的校验数据组位于不同的所述独立可编程闪存芯片,所述预设CPR形式用于指示所述m个相邻的条带包括一个校验数据组,m为大于或等于2的整数;若所述第一标识的取值为第一预设值,所述第一标识用于指示所述目标数据的安全级别为所述第一安全级别;
    所述根据所述第一标识指示的所述目标数据的安全级别,为所述目标数据动态分配存储空间,并将所述目标数据写入分配的存储空间,具体包括:
    将所述目标数据写入所述第一物理存储空间中已分配、且剩余存储空间大于存储所述目标数据所需存储空间的大小的所述第一安全级别的数据块;
    或者,
    将所述目标数据写入所述第一物理存储空间中新分配的所述第一安全级别的数据块;
    或者,
    将所述目标数据写入所述第一物理存储空间中已分配、且剩余存储空间小于存储 所述目标数据所需存储空间的大小的所述第一安全级别的数据块,以及所述第一物理存储空间中新分配的所述第一安全级别的数据块。
  9. 根据权利要求8所述的数据处理方法,所述闪存设备的第二物理存储空间用于存储第二安全级别的数据块,所述第二安全级别的数据块仅用于存储用户数据,所述第一物理存储空间还用于存储所述第二安全级别的数据块,所述第二安全级别低于所述第一安全级别;若所述第一标识的取值为第二预设值,所述第一标识用于指示所述目标数据的安全级别为所述第二安全级别;
    所述根据所述第一标识指示的所述目标数据的安全级别,为所述目标数据动态分配存储空间,并将所述目标数据写入分配的存储空间,具体包括:
    确定所述第二物理存储空间的剩余存储空间的大小;
    若所述第二物理存储空间的剩余存储空间的大小大于存储所述目标数据所需存储空间的大小,将所述目标数据写入所述第二物理存储空间;或者,若所述第二物理存储空间的剩余存储空间的大小大于零、且小于存储所述目标数据所需存储空间的大小,将所述目标数据写入所述第二物理存储空间的剩余存储空间和所述第一物理存储空间的所述第二安全级别的数据块;或者,若所述第二物理存储空间的剩余存储空间的大小等于零,将所述目标数据写入所述第一物理存储空间的所述第二安全级别的数据块。
  10. 一种数据处理方法,其特征在于,应用于包括闪存设备的终端,所述闪存设备包括x个独立可编程闪存芯片,x为大于或等于1的整数,所述数据处理方法包括:
    所述终端的处理器向所述闪存设备发送包括第一标识的写数据请求,所述写数据请求用于请求写入目标数据,所述第一标识用于指示所述目标数据的安全级别;
    所述闪存设备根据所述第一标识指示的所述目标数据的安全级别,为所述目标数据动态分配存储空间,并将所述目标数据写入分配的存储空间。
  11. 根据权利要求10所述的数据处理方法,其特征在于,所述闪存设备的第一物理存储空间用于存储第一安全级别的数据块,所述第一安全级别的数据块是由所述x个独立可编程闪存芯片采用预设可定制独立计算机闪存设备部分冗余阵列CPR形式和预设CPR级别的方式组成的,所述第一安全级别的数据块包括至少一个条带集合,所述条带集合由m个相邻的条带组成,所述条带集合包括一个校验数据组,不同的所述条带集合的校验数据组位于不同的所述独立可编程闪存芯片,所述预设CPR形式用于指示所述m个相邻的条带包括一个校验数据组,m为大于或等于2的整数;若所述第一标识的取值为第一预设值,所述第一标识用于指示所述目标数据的安全级别为所述第一安全级别;
    所述闪存设备根据所述第一标识指示的所述目标数据的安全级别,为所述目标数据动态分配存储空间,并将所述目标数据写入分配的存储空间,具体包括:
    所述闪存设备将所述目标数据写入所述第一物理存储空间中已分配、且剩余存储空间大于存储所述目标数据所需存储空间的大小的所述第一安全级别的数据块;
    或者,
    所述闪存设备将所述目标数据写入所述第一物理存储空间中新分配的所述第一安全级别的数据块;
    或者,
    所述闪存设备将所述目标数据写入所述第一物理存储空间中已分配、且剩余存储空间小于存储所述目标数据所需存储空间的大小的所述第一安全级别的数据块,以及所述第一物理存储空间中新分配的所述第一安全级别的数据块。
  12. 根据权利要求11所述的数据处理方法,所述闪存设备的第二物理存储空间用于存储第二安全级别的数据块,所述第二安全级别的数据块仅用于存储用户数据,所述第一物理存储空间还用于存储所述第二安全级别的数据块,所述第二安全级别低于所述第一安全级别;若所述第一标识的取值为第二预设值,所述第一标识用于指示所述目标数据的安全级别为所述第二安全级别;
    所述闪存设备根据所述第一标识指示的所述目标数据的安全级别,为所述目标数据动态分配存储空间,并将所述目标数据写入分配的存储空间,具体包括:
    所述闪存设备确定所述第二物理存储空间的剩余存储空间的大小;
    若所述第二物理存储空间的剩余存储空间的大小大于存储所述目标数据所需存储空间的大小,所述闪存设备将所述目标数据写入所述第二物理存储空间;或者,若所述第二物理存储空间的剩余存储空间的大小大于零、且小于存储所述目标数据所需存储空间的大小,所述闪存设备将所述目标数据写入所述第二物理存储空间的剩余存储空间和所述第一物理存储空间的所述第二安全级别的数据块;或者,若所述第二物理存储空间的剩余存储空间的大小等于零,所述闪存设备将所述目标数据写入所述第一物理存储空间的所述第二安全级别的数据块。
  13. 根据权利要求11-12中任意一项所述的数据处理方法,其特征在于,所述数据处理方法还包括:
    所述处理器向所述闪存设备发送配置命令,所述配置命令包括所述第一物理存储空间的大小、预设可定制独立计算机闪存设备部分冗余阵列CPR形式和预设CPR级别的方式;
    所述闪存设备根据所述配置命令,完成所述第一物理存储空间的初始化配置。
  14. 根据权利要求11-13中任意一项所述的数据处理方法,其特征在于,所述数据处理方法还包括:
    所述处理器为所述终端的至少一个应用程序中的每个应用程序动态分配所述第一物理存储空间的可用存储空间。
  15. 一种闪存设备,其特征在于,所述闪存设备包括存储模块、通信模块和处理模块;其中,
    所述存储模块包括x个独立可编程闪存芯片,所述存储模块中的第一物理存储空间用于存储第一安全级别的数据块和第二安全级别的数据块,所述第一安全级别的数据块是由所述x个独立可编程闪存芯片采用预设可定制独立计算机闪存设备部分冗余阵列CPR形式和预设CPR级别的方式组成的,所述第一安全级别的数据块包括至少一个条带集合,所述条带集合由m个相邻的条带组成,所述条带集合包括一个校验数据组,不同的所述条带集合的校验数据组位于不同的所述独立可编程闪存芯片,所述预设CPR形式用于指示所述m个相邻的条带包括一个校验数据组,所述第二安全级别的数据块仅用于存储用户数据,所述存储模块中的第二物理存储空间用于存储所述第二安全级别的数据块,所述第一安全级别高于所述第二安全级别,x为大于或等于1 的整数,m为大于或等于2的整数;
    所述通信模块,用于接收写数据请求,所述写数据请求用于请求写入目标数据;
    所述处理模块,用于根据所述通信模块接收到的所述写数据请求,获取所述目标数据的安全级别,以及用于若所述目标数据的安全级别为所述第一安全级别,将所述目标数据写入所述存储模块的所述第一物理存储空间,以及用于若所述目标数据的安全级别为所述第二安全级别,将所述目标数据写入所述存储模块的所述第二物理存储空间,或者,将所述目标数据写入所述存储模块的所述第二物理存储空间和所述第一物理存储空间。
  16. 根据权利要求15所述的闪存设备,其特征在于,所述写数据请求包括用于指示所述目标数据的安全级别的第一标识。
  17. 根据权利要求16所述的闪存设备,其特征在于,若所述第一标识的取值为第一预设值,所述第一标识具体用于指示所述目标数据的安全级别为所述第一安全级别;若所述目标数据的安全级别为所述第一安全级别,所述处理模块具体用于:
    将所述目标数据写入所述第一物理存储空间中已分配、且剩余存储空间大于存储所述目标数据所需存储空间的大小的所述第一安全级别的数据块;
    或者,
    将所述目标数据写入所述第一物理存储空间中新分配的所述第一安全级别的数据块;
    或者,
    将所述目标数据写入所述第一物理存储空间中已分配、且剩余存储空间小于存储所述目标数据所需存储空间的大小的所述第一安全级别的数据块,以及所述第一物理存储空间中新分配的所述第一安全级别的数据块。
  18. 根据权利要求16或17所述的闪存设备,其特征在于,若所述第一标识的取值为第二预设值,所述第一标识具体用于指示所述目标数据的安全级别为所述第二安全级别;若所述目标数据的安全级别为所述第二安全级别,所述处理模块具体用于:
    确定所述第二物理存储空间的剩余存储空间的大小;
    若所述第二物理存储空间的剩余存储空间的大小大于存储所述目标数据所需存储空间的大小,将所述目标数据写入所述第二物理存储空间;或者,若所述第二物理存储空间的剩余存储空间的大小大于零、且小于存储所述目标数据所需存储空间的大小,将所述目标数据写入所述第二物理存储空间的剩余存储空间和所述第一物理存储空间的所述第二安全级别的数据块;或者,若所述第二物理存储空间的剩余存储空间的大小等于零,将所述目标数据写入所述第一物理存储空间的所述第二安全级别的数据块。
  19. 根据权利要求15-18中任意一项所述的闪存设备,其特征在于,
    所述m个相邻的条带属于不同的物理页。
  20. 根据权利要求15-19中任意一项所述的闪存设备,其特征在于,
    所述通信模块,还用于接收来自主机的配置命令,所述配置命令包括所述第一物理存储空间的大小、所述CPR形式和预设CPR级别;
    所述处理模块,还用于响应于所述通信模块接收到的所述配置命令,完成初始化配置。
  21. 一种闪存设备,其特征在于,所述闪存设备包括存储模块、通信模块和处理模块;其中,
    所述存储模块包括x个独立可编程闪存芯片,x为大于或等于1的整数;
    所述通信模块,用于接收包括第一标识的写数据请求,所述写数据请求用于请求写入目标数据,所述第一标识用于指示所述目标数据的安全级别;
    所述处理模块,用于根据所述通信模块接收到的所述写数据请求中的所述第一标识指示的所述目标数据的安全级别,为所述目标数据动态分配存储空间,并将所述目标数据写入分配的存储空间。
  22. 根据权利要求21所述的闪存设备,其特征在于,
    所述存储模块的第一物理存储空间用于存储第一安全级别的数据块,所述第一安全级别的数据块是由所述x个独立可编程闪存芯片采用预设可定制独立计算机闪存设备部分冗余阵列CPR形式和预设CPR级别的方式组成的,所述第一安全级别的数据块包括至少一个条带集合,所述条带集合由m个相邻的条带组成,所述条带集合包括一个校验数据组,不同的所述条带集合的校验数据组位于不同的所述独立可编程闪存芯片,所述预设CPR形式用于指示所述m个相邻的条带包括一个校验数据组,m为大于或等于2的整数;若所述第一标识的取值为第一预设值,所述第一标识用于指示所述目标数据的安全级别为所述第一安全级别;
    在所述第一标识的取值为所述第一预设值的情况下,所述处理模块具体用于:
    将所述目标数据写入所述第一物理存储空间中已分配、且剩余存储空间大于存储所述目标数据所需存储空间的大小的所述第一安全级别的数据块;
    或者,
    将所述目标数据写入所述第一物理存储空间中新分配的所述第一安全级别的数据块;
    或者,
    将所述目标数据写入所述第一物理存储空间中已分配、且剩余存储空间小于存储所述目标数据所需存储空间的大小的所述第一安全级别的数据块,以及所述第一物理存储空间中新分配的所述第一安全级别的数据块。
  23. 根据权利要求22所述的闪存设备,其特征在于,所述闪存设备的第二物理存储空间用于存储第二安全级别的数据块,所述第二安全级别的数据块仅用于存储用户数据,所述第一物理存储空间还用于存储所述第二安全级别的数据块,所述第二安全级别低于所述第一安全级别;若所述第一标识的取值为第二预设值,所述第一标识用于指示所述目标数据的安全级别为所述第二安全级别;
    在所述第一标识的取值为所述第二预设值的情况下,所述处理模块具体用于:
    确定所述第二物理存储空间的剩余存储空间的大小;
    若所述第二物理存储空间的剩余存储空间的大小大于存储所述目标数据所需存储空间的大小,将所述目标数据写入所述第二物理存储空间;或者,若所述第二物理存储空间的剩余存储空间的大小大于零、且小于存储所述目标数据所需存储空间的大小,将所述目标数据写入所述第二物理存储空间的剩余存储空间和所述第一物理存储空间的所述第二安全级别的数据块;或者,若所述第二物理存储空间的剩余存储空间的大 小等于零,将所述目标数据写入所述第一物理存储空间的所述第二安全级别的数据块。
  24. 一种闪存设备,其特征在于,所述闪存设备包括:一个或多个处理器、非易失性存储介质和通信接口;
    所述非易失性存储介质、所述通信接口与所述一个或多个处理器连接;所述闪存设备通过所述通信接口与其他设备通信,所述非易失性存储介质用于存储计算机程序代码,所述计算机程序代码包括指令,当所述一个或多个处理器执行所述指令时,所述闪存设备执行如权利要求1-6中任意一项所述的数据处理方法或者执行如权利要求7-9中任意一项所述的数据处理方法。
  25. 一种包含指令的计算机程序产品,其特征在于,当所述计算机程序产品在闪存设备上运行时,使得所述闪存设备执行如权利要求1-6中任意一项所述的数据处理方法或者执行如权利要求7-9中任意一项所述的数据处理方法。
  26. 一种计算机可读存储介质,包括指令,其特征在于,当所述指令在闪存设备上运行时,使得所述闪存设备执行如权利要求1-6中任意一项所述的数据处理方法或者执行如权利要求7-9中任意一项所述的数据处理方法。
  27. 一种终端,其特征在于,所述终端包括处理器,以及如权利要求15-20中任意一项所述的闪存设备或者如权利要求21-23中任意一项所述的闪存设备;其中,
    所述处理器,用于向所述闪存设备发送包括第一标识的写数据请求,以便于所述闪存设备根据所述第一标识指示的所述目标数据的安全级别,为所述目标数据动态分配存储空间,所述写数据请求用于请求写入目标数据。
  28. 根据权利要求27所述的终端,其特征在于,
    所述处理器,还用于向所述闪存设备发送配置命令,以便于所述闪存设备根据所述配置命令,完成所述闪存设备中第一物理存储空间的初始化配置,所述配置命令包括所述第一物理存储空间的大小、预设可定制独立计算机闪存设备部分冗余阵列CPR形式和预设CPR级别的方式。
  29. 根据权利要求27或28所述的终端,其特征在于,
    所述处理器,还用于为所述终端的至少一个应用程序中的每个应用程序动态分配所述第一物理存储空间的可用存储空间。
PCT/CN2018/097293 2018-07-26 2018-07-26 一种数据处理方法及装置 WO2020019267A1 (zh)

Priority Applications (3)

Application Number Priority Date Filing Date Title
PCT/CN2018/097293 WO2020019267A1 (zh) 2018-07-26 2018-07-26 一种数据处理方法及装置
US17/262,310 US11593000B2 (en) 2018-07-26 2018-07-26 Data processing method and apparatus
CN201880095798.9A CN112513804B (zh) 2018-07-26 2018-07-26 一种数据处理方法及装置

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2018/097293 WO2020019267A1 (zh) 2018-07-26 2018-07-26 一种数据处理方法及装置

Publications (1)

Publication Number Publication Date
WO2020019267A1 true WO2020019267A1 (zh) 2020-01-30

Family

ID=69182097

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/097293 WO2020019267A1 (zh) 2018-07-26 2018-07-26 一种数据处理方法及装置

Country Status (3)

Country Link
US (1) US11593000B2 (zh)
CN (1) CN112513804B (zh)
WO (1) WO2020019267A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112804003A (zh) * 2021-02-19 2021-05-14 上海剑桥科技股份有限公司 一种基于光模块通信的存储方法、系统及终端
US20210303733A1 (en) * 2018-12-11 2021-09-30 Micron Technology, Inc. Memory data security
CN115459974A (zh) * 2022-08-30 2022-12-09 广东省高峰科技有限公司 一种数据缓存方法
CN116257171A (zh) * 2021-12-10 2023-06-13 北京字跳网络技术有限公司 信息写入及读取方法、装置、存储介质和服务器

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11593000B2 (en) 2018-07-26 2023-02-28 Huawei Technologies Co., Ltd. Data processing method and apparatus
EP3814913B1 (en) * 2018-08-08 2024-10-09 Huawei Technologies Co., Ltd. Apparatus and method for providing one time programmable memory features in a hypervisor of a computing device
CN114415961B (zh) * 2022-01-21 2023-10-27 珠海奔图电子有限公司 Nand flash存储器的坏块处理方法、电子设备及存储介质
US11797183B1 (en) * 2022-06-27 2023-10-24 Western Digital Technologies, Inc. Host assisted application grouping for efficient utilization of device resources

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120084506A1 (en) * 2010-10-01 2012-04-05 John Colgrove Distributed multi-level protection in a raid array based storage system
CN103348326A (zh) * 2010-09-28 2013-10-09 净睿存储股份有限公司 Ssd环境中的适配raid
CN104267913A (zh) * 2014-10-20 2015-01-07 北京北亚时代科技有限公司 一种可动态异步调整raid级别的存储方法及存储系统
CN104657405A (zh) * 2013-11-15 2015-05-27 国际商业机器公司 用于归档数据的基于优先级的可靠性机制的方法和系统
CN105404469A (zh) * 2015-10-22 2016-03-16 浙江宇视科技有限公司 一种视频数据的存储方法和系统

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9632870B2 (en) * 2007-03-29 2017-04-25 Violin Memory, Inc. Memory system with multiple striping of raid groups and method for performing the same
CN103488583B (zh) 2013-09-09 2016-08-10 华中科技大学 一种高性能高可靠的固态盘实现方法
US9785575B2 (en) * 2014-12-30 2017-10-10 International Business Machines Corporation Optimizing thin provisioning in a data storage system through selective use of multiple grain sizes
CN106845289A (zh) * 2015-12-07 2017-06-13 国民技术股份有限公司 一种安全芯片及其非易失性存储控制装置、方法
JPWO2018138813A1 (ja) * 2017-01-25 2019-06-27 株式会社日立製作所 計算機システム
KR20180130140A (ko) * 2017-05-29 2018-12-07 에스케이하이닉스 주식회사 데이터 처리 시스템 및 데이터 처리 방법
US11748196B2 (en) * 2018-06-29 2023-09-05 International Business Machines Corporation Adaptive parity rotation for redundant arrays of independent disks
US10761738B2 (en) * 2018-07-13 2020-09-01 Seagate Technology Llc Raid performance by offloading tasks to expanders
US11593000B2 (en) * 2018-07-26 2023-02-28 Huawei Technologies Co., Ltd. Data processing method and apparatus

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103348326A (zh) * 2010-09-28 2013-10-09 净睿存储股份有限公司 Ssd环境中的适配raid
US20120084506A1 (en) * 2010-10-01 2012-04-05 John Colgrove Distributed multi-level protection in a raid array based storage system
CN104657405A (zh) * 2013-11-15 2015-05-27 国际商业机器公司 用于归档数据的基于优先级的可靠性机制的方法和系统
CN104267913A (zh) * 2014-10-20 2015-01-07 北京北亚时代科技有限公司 一种可动态异步调整raid级别的存储方法及存储系统
CN105404469A (zh) * 2015-10-22 2016-03-16 浙江宇视科技有限公司 一种视频数据的存储方法和系统

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20210303733A1 (en) * 2018-12-11 2021-09-30 Micron Technology, Inc. Memory data security
US11928246B2 (en) * 2018-12-11 2024-03-12 Micron Technology, Inc. Memory data security
CN112804003A (zh) * 2021-02-19 2021-05-14 上海剑桥科技股份有限公司 一种基于光模块通信的存储方法、系统及终端
CN116257171A (zh) * 2021-12-10 2023-06-13 北京字跳网络技术有限公司 信息写入及读取方法、装置、存储介质和服务器
CN115459974A (zh) * 2022-08-30 2022-12-09 广东省高峰科技有限公司 一种数据缓存方法

Also Published As

Publication number Publication date
CN112513804A (zh) 2021-03-16
US20210303181A1 (en) 2021-09-30
US11593000B2 (en) 2023-02-28
CN112513804B (zh) 2022-08-19

Similar Documents

Publication Publication Date Title
WO2020019267A1 (zh) 一种数据处理方法及装置
US11726688B2 (en) Storage system managing metadata, host system controlling storage system, and storage system operating method
US11281601B2 (en) Multi-device storage system with hosted services on peer storage devices
US10409511B1 (en) Multi-device storage system with distributed read/write processing
US10635529B2 (en) Parity offload for multiple data storage devices
KR101660150B1 (ko) 물리 페이지, 논리 페이지, 및 코드워드 대응
US8209587B1 (en) System and method for eliminating zeroing of disk drives in RAID arrays
US10146435B2 (en) Storage system and data write method
US10768838B2 (en) Storage apparatus and distributed storage system
US10089033B2 (en) Storage system
US10108359B2 (en) Method and system for efficient cache buffering in a system having parity arms to enable hardware acceleration
CN108628541B (zh) 一种文件存储的方法、装置及存储系统
WO2021017782A1 (zh) 分布式存储系统访问方法、客户端及计算机程序产品
US11704053B1 (en) Optimization for direct writes to raid stripes
US20220365692A1 (en) Techniques for storage management
EP3889785B1 (en) Stripe reconstruction method in storage system and striping server
WO2023102784A1 (zh) 数据存取方法、装置、磁盘控制器、磁盘和数据存储系统
CN110737395B (zh) I/o管理方法、电子设备和计算机可读存储介质
US20150019807A1 (en) Linearized dynamic storage pool
US20190042365A1 (en) Read-optimized lazy erasure coding
CN117591009A (zh) 一种数据管理方法、存储装置及服务器
EP3889778B1 (en) Distributed storage system and computer program product
WO2017212514A1 (ja) ストレージシステム及び記憶制御方法
US20240303114A1 (en) Dynamic allocation of capacity to namespaces in a data storage device
US20240362161A1 (en) Redundant Storage Across Namespaces with Dynamically Allocated Capacity in Data Storage Devices

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: 18927542

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18927542

Country of ref document: EP

Kind code of ref document: A1