WO2022204971A1 - 存储方法及存储控制器 - Google Patents

存储方法及存储控制器 Download PDF

Info

Publication number
WO2022204971A1
WO2022204971A1 PCT/CN2021/084068 CN2021084068W WO2022204971A1 WO 2022204971 A1 WO2022204971 A1 WO 2022204971A1 CN 2021084068 W CN2021084068 W CN 2021084068W WO 2022204971 A1 WO2022204971 A1 WO 2022204971A1
Authority
WO
WIPO (PCT)
Prior art keywords
data block
sector
data
length
storage controller
Prior art date
Application number
PCT/CN2021/084068
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/CN2021/084068 priority Critical patent/WO2022204971A1/zh
Priority to CN202180091008.1A priority patent/CN116802599A/zh
Publication of WO2022204971A1 publication Critical patent/WO2022204971A1/zh

Links

Images

Classifications

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

Definitions

  • the embodiments of the present application relate to the field of storage devices, and in particular, to a storage method and a storage controller.
  • E2E End to End, end-to-end
  • DIF Data Integrity Field
  • the E2E data protection technology is based on the fixed sector size for access and management. Specifically, a check field of fixed bytes is added after the data of each sector for integrity check.
  • a check field of fixed bytes is added after the data of each sector for integrity check.
  • the data written by the host side (which can also be understood as the host side) to the storage side is written with a fixed sector as the granularity.
  • the length of C is equal to the length of the sector.
  • the data C carries a DIF, and the DIF is used to verify the data C.
  • the storage end uses fixed sectors as the granularity for storage. Still referring to FIG. 1, illustratively, after the storage receives the data C and DIF, the data C and DIF are written into the sector.
  • the stored sectors also include data A and corresponding DIFs, and data B and corresponding DIFs.
  • the storage side verifies the data in the sector based on the DIF corresponding to the sector, and feeds back all the data of the sector and the corresponding DIF to the host side.
  • the storage may verify the data C based on the DIF corresponding to the sector to which the data C belongs, and output the data C and the DIF to the host after the verification is successful.
  • the host checks the data C based on the DIF to determine the correctness of the data C.
  • the present application provides a storage method and a storage controller.
  • the storage controller can implement byte-level read, write and verify, and can support end-to-end data protection while providing byte-level access.
  • an embodiment of the present application provides a storage method.
  • the method includes: the storage controller receives a first write instruction, where the first write instruction includes: first data, first data information and at least one check information; wherein the first data information indicates the start of the first data The address and the length of the first data; the storage controller separately checks the data blocks corresponding to each check information in the first data based on at least one check information; there is at least one length in the first data that is smaller than the sector length The data block, the sector length is the length of the sector in the storage medium coupled to the storage controller. In the case that all data blocks in the first data are successfully verified, the storage controller writes the first data into the storage medium based on the first data information.
  • the storage device side can provide a byte-level access interface for the host side.
  • the storage controller can implement end-to-end protection for the written data, and verify the byte-level data written each time, thereby ensuring the reliability of the byte-level data during transmission.
  • the storage controller can also store and manage data based on sector granularity. Therefore, while realizing byte-level access, end-to-end data protection can be achieved and data reliability can be improved.
  • the length of data written by the host each time may be greater than the sector length, equal to the sector length, or may be smaller than the sector length.
  • the length of at least one data block optionally exists in the data block of the first data is inconsistent with the sector length.
  • the check information may include check information such as CRC.
  • the storage controller sequentially writes the data into the corresponding sectors according to the sequence of the received data.
  • verifying the data blocks corresponding to each verification information in the first data respectively includes: the storage controller divides the first data into at least one data block, wherein each data block is divided into at least one data block. Each data block is in one-to-one correspondence with one check information. The storage controller verifies the at least one data block based on the at least one verification information.
  • the storage controller can verify the corresponding data block based on the verification information, so as to determine whether the first data is correctly transmitted during the transmission process between the host and the storage device.
  • the storage controller may divide the first data according to a preset division manner.
  • the preset division manner is consistent with the division manner of the host side.
  • At least one data block is in one-to-one correspondence with at least one check information.
  • the storage controller may perform an integrity check on the corresponding data block based on the check information.
  • dividing the first data into at least one data block includes: the storage controller dividing the first data according to the start address of the sector and the sector length is at least one data block; wherein, the start address of a single data block in the at least one data block is the same as or different from the start address of the sector.
  • the storage controller may divide the first data into at least one data block according to a preset division manner. to obtain the correspondence between at least one check information and at least one data block.
  • the at least one verification information received by the storage controller is arranged in sequence.
  • the storage device may determine the correspondence between the at least one data block and the at least one check information based on the order of the received check information.
  • the storage controller verifies the single data block based on the target verification information corresponding to the single data block;
  • the verification information belongs to at least one verification information.
  • the storage controller can perform sector granularity check on the data block. That is to say, when the start address and length of the data block are the same as the start address and length of the sector, the corresponding check information is checked at sector granularity.
  • the storage controller when the storage controller stores this type of data block, the data block is stored according to the sector. That is, data blocks are stored in one sector.
  • the data blocks corresponding to each verification information in the first data are verified respectively, including: When the starting address of the single data block is different from the starting address of the sector, and/or the length of the single data block is smaller than the sector length, the storage controller, based on the target parity information corresponding to the single data block, Perform verification; wherein, the target verification information belongs to at least one verification information.
  • the storage controller can perform byte-level check on the data block. That is, for data blocks that are not aligned with the sector, that is, the start address and/or length of the sector are not the same as the start address and sector length of the sector, the storage device can check the data block based on the check information. test.
  • the memory controller may store the data blocks that are not aligned with the sector in the cache, waiting for the next data writing.
  • the storage controller may store the data block at sector granularity.
  • the storage controller compares the single data block with the previously received data block or the next received data block.
  • the received data block is merged; wherein, the end address of the previously received data block is the same as the starting address of a single data block, and the starting address of the previous received data block is the same as the starting address of the sector; Or, the start address of the data block received next time is the same as the end address of a single data block, and the end address of the data block received next time is the same as the end address of the sector; and, the start address of the merged data block is the same.
  • the starting address is the same as the starting address of the sector, and the length of the merged data block is equal to the sector length; based on the target check information corresponding to the merged data block, the merged data block is checked; wherein, the target The verification information belongs to at least one verification information.
  • the memory controller can perform a merge check on data blocks that are not aligned with sectors.
  • the merge check refers to checking the data contained in the starting position to the current position of the sector to which the data block belongs based on the check information.
  • the storage controller may store the merged data block into one sector.
  • the storage controller may repeatedly perform the step of merge checking.
  • the storage device may store the combined data block into one sector.
  • an embodiment of the present application provides a storage method.
  • the method includes the storage controller receiving a first read instruction, the first read instruction includes first address information and first length information, the first address information is used to indicate the starting address of the first data to be read, the first The length information is used to indicate the length of the first data; wherein, the first data is located in at least one sector.
  • the storage controller verifies the data in the at least one sector based on the verification information corresponding to the at least one sector.
  • the storage controller When the data verification in at least one sector is successful, the storage controller outputs at least one data block in the first data and at least one corresponding verification information to the first device;
  • the length of the block is equal to the length of the sector, and the check information corresponding to a single data block is the check information corresponding to the sector to which the single data block belongs; if the length of a single data block is less than the sector length, the check information corresponding to a single data block is based on Generated from a single block of data.
  • the memory controller can provide byte-level read and write access interfaces.
  • the storage controller can verify data at sector granularity from multiple sectors in which data is stored based on the host's requirements.
  • the verified data is output to the host according to the starting address and length required by the host, and corresponding data and verification information. This provides end-to-end data protection while enabling byte-level read and write access.
  • the first device is a host.
  • the data length of the first data may be less than the sector length, may also be equal to the sector length, or may be greater than the sector length.
  • verifying the data in the at least one sector based on the verification information corresponding to the at least one sector includes: the storage controller responds to the received first read command, according to the start of the sector The address and the sector length divide the first data into at least one data block; wherein the start address of a single data block in the at least one data block is the same or different from the start address of the sector.
  • the storage controller verifies the sector to which the single data block belongs based on the verification information corresponding to the sector to which the single data block belongs.
  • the storage controller can divide the data to be read according to sector granularity.
  • the sector to which each data block belongs is checked to ensure the accuracy of the read data.
  • At least one data block in the first data and at least one corresponding verification information are output to the first data block.
  • a device comprising: when the verification of the sector to which the single data block belongs is successful, and the length of the single data block is equal to the sector length, the storage controller outputs the verification information corresponding to the single data block and the sector to which the single data block belongs to the first a device.
  • the data block is aligned with the sector, that is, the starting address and length of the data block are the same as the starting address and sector length of the sector, the data block is a data block with sector as the granularity, and the storage controller can The parity information corresponding to the data block and the sector is correspondingly output to the host without generating the parity information separately.
  • the storage controller compares at least one data block in the first data with at least one corresponding verification information
  • Outputting to the first device includes: when the verification of the sector to which the single data block belongs is successful, and the length of the first data block is less than the length of the sector, the storage controller generates verification information based on the single data block, and compares the single block with the length of the sector. The generated verification information is output to the first device.
  • the parity information of the sector is not applicable to the parity of the data block. That is to say, if the verification information of the data block and sector is transmitted to the host, the verification of the data block on the host side will fail. Therefore, the storage controller separately generates corresponding check information for such unaligned data blocks, so that the host segment can check the data blocks based on the check information corresponding to the data blocks, thereby realizing end-to-end protection.
  • an embodiment of the present application provides a storage controller.
  • the device includes a processor and an interface circuit, the processor is coupled to the storage medium through the interface circuit.
  • the processor may be configured to receive a first write instruction, where the first write instruction includes: first data, first data information and at least one check information; wherein the first data information indicates the first data The starting address of the first data and the length of the first data; based on the at least one check information, check the data blocks corresponding to each check information in the first data respectively; in the first data There is at least one data block whose length is less than the sector length, the sector length being the length of the sector in the storage medium coupled to the storage controller; all data blocks in the first data are successfully verified In this case, the first data is written into the storage medium based on the first data information.
  • the processor is specifically configured to: divide the first data into at least one data block, wherein each data block is in a one-to-one correspondence with a piece of check information; The at least one data block is checked.
  • the processor is specifically configured to: divide the first data into at least one data block according to the start address of the sector and the sector length; wherein, at least The start address of a single data block in a data block is the same or different from the start address of a sector.
  • the processor is specifically configured to: when the start address of the single data block is the same as the start address of the sector, and the length of the single data block is equal to the sector Length, based on the target verification information corresponding to the single data block, the single data block is verified; wherein, the target verification information belongs to at least one verification information.
  • the processor is specifically configured to: when the start address of the single data block is different from the start address of the sector, and/or, the start address of the single data block is If the length is less than the sector length, the single data block is verified based on the target verification information corresponding to the single data block; wherein, the target verification information belongs to at least one verification information.
  • the processor is specifically configured to: when the start address of the single data block is different from the start address of the sector, and/or, the start address of the single data block is If the length is less than the sector length, the single data block is merged with the previously received data block or the next received data block; wherein, the end address of the previously received data block is the same as the start address of the single data block, And the start address of the data block received last time is the same as the start address of the sector; or, the start address of the data block received next time is the same as the end address of a single data block, and the data received next time
  • the end address of the block is the same as the end address of the sector; and the start address of the merged data block is the same as the start address of the sector, and the length of the merged data block is equal to the sector length; based on the merged data
  • the target verification information corresponding to the block is used to verify the combined data block; wherein, the target verification information belongs to at least one
  • the third aspect and any implementation manner of the third aspect correspond to the first aspect and any implementation manner of the first aspect, respectively.
  • the technical effects corresponding to the third aspect and any implementation manner of the third aspect reference may be made to the technical effects corresponding to the first aspect and any implementation manner of the first aspect, which will not be repeated here.
  • an embodiment of the present application provides a storage controller, including a processor and an interface circuit, where the processor is coupled to a storage medium through the interface circuit.
  • the processor is used to receive a first read instruction, the first read instruction includes first address information and first length information, the first address information is used to indicate the starting address of the first data to be read, and the first length information is used to is used to indicate the length of the first data; wherein, the first data is located in at least one sector; in response to the received first read command, based on the check information corresponding to the at least one sector, the data in the at least one sector is processed.
  • Verification when the verification of data in at least one sector is successful, output at least one data block and corresponding at least one verification information in the first data to the first device; wherein, if the single data in the at least one data block is The length of the block is equal to the length of the sector, and the check information corresponding to a single data block is the check information corresponding to the sector to which the single data block belongs; if the length of a single data block is less than the sector length, the check information corresponding to a single data block is based on Generated from a single block of data.
  • the processor is specifically configured to: in response to the received first read instruction, according to the start address and sector length of the sector, The data is divided into at least one data block; wherein, the starting address of a single data block in at least one data block is the same or different from the starting address of the sector; based on the check information corresponding to the sector to which the single data block belongs, the single data block The sector to which the block belongs is checked.
  • the processor is specifically configured to: when the verification of the sector to which the single data block belongs is successful, and the length of the single data block is equal to the sector length, The check information corresponding to the block and the sector to which the single data block belongs is output to the first device.
  • the processor is specifically configured to: when the verification of the sector to which the single data block belongs is successful, and the length of the first data block is less than the sector length, based on the single data block
  • the data block generates check information, and outputs the single block and the generated check information to the first device.
  • the fourth aspect and any implementation manner of the fourth aspect correspond to the first aspect and any implementation manner of the first aspect, respectively.
  • the technical effects corresponding to the fourth aspect and any implementation manner of the fourth aspect reference may be made to the technical effects corresponding to the second aspect and any implementation manner of the second aspect, which will not be repeated here.
  • embodiments of the present application provide a computer-readable medium for storing a computer program, where the computer program includes instructions for executing the method in the first aspect or any possible implementation manner of the first aspect.
  • the fifth aspect and any implementation manner of the fifth aspect correspond to the first aspect and any implementation manner of the first aspect, respectively.
  • the technical effects corresponding to the fifth aspect and any implementation manner of the fifth aspect reference may be made to the technical effects corresponding to the first aspect and any implementation manner of the first aspect, which will not be repeated here.
  • embodiments of the present application provide a computer-readable medium for storing a computer program, where the computer program includes instructions for executing the method in the second aspect or any possible implementation manner of the second aspect.
  • the sixth aspect and any implementation manner of the sixth aspect correspond to the second aspect and any implementation manner of the second aspect, respectively.
  • the technical effects corresponding to the sixth aspect and any implementation manner of the sixth aspect reference may be made to the technical effects corresponding to the second aspect and any implementation manner of the second aspect, which will not be repeated here.
  • an embodiment of the present application provides a storage device, including a storage controller and a storage medium in the second aspect or any possible implementation manner of the second aspect.
  • an embodiment of the present application provides a storage device, including a storage controller and a storage medium in the fourth aspect or any possible implementation manner of the fourth aspect.
  • an embodiment of the present application provides a computer program, where the computer program includes instructions for executing the method in the first aspect or any possible implementation manner of the first aspect.
  • the ninth aspect and any implementation manner of the ninth aspect correspond to the first aspect and any implementation manner of the first aspect, respectively.
  • the technical effects corresponding to the ninth aspect and any implementation manner of the ninth aspect reference may be made to the technical effects corresponding to the first aspect and any implementation manner of the first aspect, which will not be repeated here.
  • an embodiment of the present application provides a computer program, where the computer program includes instructions for executing the method in the first aspect or any possible implementation manner of the first aspect.
  • the tenth aspect and any implementation manner of the tenth aspect correspond to the second aspect and any implementation manner of the second aspect, respectively.
  • Fig. 1 is the schematic diagram of the read-write mode exemplarily shown
  • FIG. 2 is a schematic structural diagram of an exemplary terminal
  • FIG. 3 is an exemplary schematic diagram of a processing flow on the host side
  • 4a to 4d are schematic diagrams of processing on the host side exemplarily shown;
  • FIG. 5 is an exemplary schematic diagram of a processing flow on the storage device side
  • 6a-6b are schematic diagrams of processing on the side of the storage device shown by way of example.
  • FIG. 7 is an exemplary schematic diagram of a processing flow on the host side
  • 8a to 8e are exemplary schematic diagrams of processing on the host side
  • FIG. 9 is an exemplary schematic diagram of a processing flow on the storage device side
  • 10a-10b are schematic diagrams of processing on the side of the storage device shown by way of example;
  • FIG. 11 is an exemplary schematic diagram of a processing flow on the host side
  • FIG. 13 is an exemplary schematic diagram of a processing flow on the storage device side
  • FIG. 14 is an exemplary schematic diagram of processing on the storage device side
  • FIG. 15 is an exemplary schematic diagram of processing on the storage device side
  • FIG. 16 is an exemplary schematic diagram of a processing flow on the storage device side
  • 17a-17b are schematic diagrams of processing on the host side shown by way of example.
  • FIG. 18 is a schematic structural diagram of an exemplarily shown device.
  • first and second in the description and claims of the embodiments of the present application are used to distinguish different objects, rather than to describe a specific order of the objects.
  • first target object, the second target object, etc. are used to distinguish different target objects, rather than to describe a specific order of the target objects.
  • words such as “exemplary” or “for example” are used to represent examples, illustrations or illustrations. Any embodiments or designs described in the embodiments of the present application as “exemplary” or “such as” should not be construed as preferred or advantageous over other embodiments or designs. Rather, the use of words such as “exemplary” or “such as” is intended to present the related concepts in a specific manner.
  • multiple processing units refers to two or more processing units; multiple systems refers to two or more systems.
  • FIG. 2 is a schematic structural diagram of an electronic device.
  • the electronic devices can be terminals, such as mobile phones, computers, notebook computers, and tablets, and can also be network devices, such as base stations and other devices that include storage.
  • FIG. 2 is a schematic structural diagram of an electronic device. In Figure 2:
  • the electronic device includes a host (Host) 200 and a storage device (Device) 210 .
  • the host side may also be referred to as a computer side, a processing side, etc., which is not limited in this application.
  • the device may also be referred to as a memory, a storage device, etc., which is not limited in this application.
  • the host 200 includes an application layer 201 and a driver layer 202 .
  • the storage device 210 may include at least one of the following types: a magnetic disk storage medium or other magnetic storage device, such as a solid state drive (Solid State Disk or Solid State Drive, SSD), or capable of carrying or storing instructions or data with A desired program code in a structured form and any other medium that can be accessed by a computer, but not limited thereto.
  • a magnetic disk storage medium or other magnetic storage device such as a solid state drive (Solid State Disk or Solid State Drive, SSD), or capable of carrying or storing instructions or data with A desired program code in a structured form and any other medium that can be accessed by a computer, but not limited thereto.
  • the storage device 210 may exist independently and be connected to the host 200 .
  • the storage device 210 can also be integrated with the host 200, for example, integrated in one chip.
  • the storage device 210 can store program codes for implementing the technical solutions of the embodiments of the present application, and is controlled and executed by the host 200, and various types of computer program codes that are executed can also be regarded as drivers of the host 200.
  • the host 200 is configured to execute computer program codes stored in the storage device 210, thereby implementing the technical solutions in the embodiments of the present application.
  • the storage device 210 may also be connected to the host 200 through an interface outside the chip.
  • the storage device 210 includes a controller 211 and a storage medium 215 .
  • the controller 211 includes a general-purpose central processing unit (Central Processing Unit, CPU) 212 , a static random-access memory (Static Random-Access Memory, SRAM) 213 and a Nand (flash memory) controller 214 .
  • CPU Central Processing Unit
  • SRAM static random-access memory
  • Nand flash memory
  • the controller 211 further includes one or more interfaces for connecting to the host 200 .
  • the function of carrying data transmission can be used for data transmission between the host 200 and the storage device 210 .
  • the CPU 212 is used for management and data interaction among various components.
  • STRAM 213 is an on-chip RAM space.
  • the Nand controller 214 is used to manage and control the storage medium.
  • the storage medium 215 is used to store data.
  • a hard disk storage medium or a memory such as an SSD includes sectors, where a sector refers to a divided area on a magnetic disk. Each track on the disk is equally divided into several arc segments, these arc segments are the sectors of the disk, and the read and write of the hard disk is based on sectors.
  • the length (that is, the capacity, which can also be understood as the amount of data that can be written) of a sector may be 512 bytes or 4096 bytes, etc., which is not limited in this application.
  • the sector information of the sector includes but is not limited to the start address and sector length of the sector.
  • the start address of the sector is optionally a logical block address (Logical Block Address, LBA) of the sector.
  • LBA Logical Block Address
  • the storage method in the embodiment of the present application optionally describes the data interaction between the host 200 and the storage device 210 , that is, the read-write mode.
  • FIG. 3 is an exemplary schematic diagram of a processing flow on the host side. Please refer to Figure 3, which includes:
  • the host can obtain DataX.
  • DataX may be received by the host through an antenna, or may be obtained through an input device, which is not limited in this application.
  • the length of DataX may be greater than the length of one sector in the storage medium, may also be less than the length of one sector in the storage medium, or may be equal to the length of one sector in the storage medium, which is not made in this application. limited.
  • the host can obtain the DataX and write the DataX into the storage medium by means of multiple writes as an example for description. In other embodiments, the host may also obtain the DataX in multiple times, and write the data in the DataX obtained each time into the storage medium. This application is not limited.
  • the host acquires the data block D0 written for the first time.
  • the host may write DataX to the storage device multiple times.
  • the data division manners in the embodiments of the present application are only schematic examples, and are not limited in the present application.
  • the host divides DataX to obtain the first write data.
  • the data information of the data written for the first time includes, but is not limited to: the starting address (hereinafter referred to as Offset information), the length (hereinafter referred to as Length information) and the index address information of the first written data.
  • the index address information is used to indicate that multiple pieces of data belong to the same index address information.
  • the index address information corresponding to the multiple write data divided by DataX is the same.
  • the starting address of the data written for the first time refers to the starting address in DataX, and its granularity is divided into bytes. For specific examples, please refer to the following.
  • the host and the storage controller may be preset with a division manner, the division manner of the host and the storage controller is the same, and the processing manner of the storage controller will be described in detail in the following flow.
  • the host divides the first write data with sector as the granularity. Specifically, take the length of the sector as 512 bytes as an example. As shown in FIG. 4c, exemplarily, the start address of data written for the first time is consistent with the start address of Sector 0. The length of the first write data is less than the sector length (for example, 512 bytes). Correspondingly, the data written for the first time is divided into one data block, that is, the data block D0.
  • the start address of D0 is the same as the start address of Sector0, and the data length of D0 is smaller than the sector length.
  • the storage controller writes data into the corresponding sectors in the order of the received data and sequentially using sectors as granularities. Therefore, according to the agreed writing method, the host can also determine the storage state of the current storage device and the current data, such as the storage space corresponding to DataX. That is to say, the host can obtain the current writing location information based on the agreed writing method.
  • the information such as the starting address of the data, the length of the data, the starting address of the sector, and the length of the sector in the embodiments of the present application are all illustrative examples, which are not limited in the present application.
  • the host may generate corresponding check information, that is, DIF, based on each data block.
  • DIF can be used to check the integrity of the corresponding data.
  • the DIF includes cyclic redundancy check (Cyclic Redundancy Check, CRC) check information, and other check information.
  • CRC Cyclic Redundancy Check
  • the host outputs the first write data and DIF0 to the storage device.
  • the host After obtaining the DIF corresponding to each data block, the host outputs the first write data and the corresponding DIF to the storage controller.
  • the host can send a first write instruction to the storage controller, optionally, the first write instruction includes but is not limited to: the first write data, DIF0, and the data information of the first write data.
  • the data information of the data written for the first time includes, but is not limited to, index address information, the starting address of the data written for the first time, and the data length.
  • the host outputs the data written for the first time and the generated DIF0 to the storage controller.
  • the host also outputs data information of the first write data to the storage controller (not shown in the figure).
  • FIG. 5 is an exemplary schematic diagram of a processing flow on the storage device side. Please refer to Figure 5, which includes:
  • the storage device receives the first write data and DIF0.
  • the storage controller receives the first write command input by the host, and can obtain the first write data, data information of the first write data, and DIF0 included in the first write command.
  • the storage controller receives the first written data and DIF0, and can obtain the corresponding starting address, data length and index address information of the first written data .
  • the storage device parses the data written for the first time according to the granularity of the sector, and obtains the data block D0.
  • the host and the storage controller are configured with the same partitioning manner.
  • the storage controller can obtain the data block D0 according to the same division method as that of the host.
  • the storage controller exemplarily divides the data written for the first time into data blocks D0 according to Sector0.
  • the specific division method can refer to the processing on the host side, and details are not repeated here.
  • the storage device detects whether D0 is aligned with the sector.
  • the storage controller may compare each data block in the acquired at least one data block with a corresponding sector.
  • the storage controller verifies the data block based on the corresponding DIF. This is illustrated in the examples below.
  • the storage controller performs data block check based on the corresponding DIF, and waits for the next written data. Or, after the data block check is performed based on the corresponding DIF, the storage controller fills the data, so that the data length of the filled data block is equal to the sector length.
  • the storage controller performs data block check based on the corresponding DIF, and waits for the next written data. Or, after the data block check is performed based on the corresponding DIF, the storage controller fills the data, so that the data length of the filled data block is equal to the sector length. Alternatively, the storage controller performs a merge check on the data block and waits for the next written data. Alternatively, the storage controller performs merge checking on the data blocks, and pads the data, so that the data length of the padding data blocks is equal to the sector length.
  • the start address of D0 is aligned with the start address of Sector0 (that is, the same), and the data length of D0 is smaller than the sector length, it can be determined that D0 and Sector0 are not aligned, and execute S204.
  • the storage controller checks the D0 based on the DIF0 to detect the integrity of the D0 transmitted from the host to the storage controller.
  • the storage controller may feed back failure information to the host.
  • the storage controller stores D0 in the cache.
  • FIG. 7 is a schematic diagram of a processing flow of an exemplary host. Please refer to Figure 7, which includes:
  • the host acquires the data blocks D1, D2, and D3 written for the second time.
  • the host may write data to the storage device multiple times. As shown in FIG. 8a, exemplarily, the host may continue to acquire data in DataX to store the data to the storage device through the second write.
  • the data written for the second time is shown in Figure 8a, wherein the data length of the data written for the second time and the data length of the data written for the first time may be the same or different, which is not limited in this application.
  • the starting address of the second writing data is the same as the ending address of the first writing data, that is, the first writing data and the second writing data are continuous.
  • the host divides the second write data into at least one data block according to a preset division manner.
  • the storage controller exemplarily divides the second write data with sector granularity to obtain at least one data block, including: D1, D2 and D3.
  • the start address of D1 is the same as the end address of the first write data, and the end address of D1 is the same as the end address of Sector0.
  • the start address of D2 is the same as the end address of D1, and it can also be understood that the start address of D2 is the same as the end address of Sector0, or the start address of D2 is the same as the start address of Sector1.
  • the data length of D2 is equal to the sector length. That is, D2 is aligned with Sector1.
  • the start address of D3 is the same as the end address of D2. It can also be understood that the start address of D3 is the same as the start address of Sector2, or the end address of D3 and Sector1 is the same. Also, the data length of D3 is smaller than the sector length. That is, D3 is not aligned with Sector3.
  • the host generates DIF1 corresponding to D1, DIF2 corresponding to D2, and DIF3 corresponding to D3.
  • the host may generate a corresponding DIF1 based on D1.
  • a corresponding DIF2 is generated based on D2, and a corresponding DIF3 is generated based on D3.
  • DIF1 is used to perform integrity check on D1
  • DIF2 is used to perform integrity check on D2
  • DIF3 is used to perform integrity check on D3.
  • DFI1 is used to perform integrity check on D0 and D1, that is, DIF1 is generated based on D0 and D1.
  • DIF2 is used to check the integrity of D2
  • DIF3 is used to check the integrity of D3.
  • Sector0 in this embodiment of the present application is only divided into two data blocks, D0 and D1. If Sector0 includes more data blocks, the DIF generated each time is used for the data block corresponding to the start address of Sector0 Check the integrity of the current data block. For example, as shown in Figure 8d, if the first write of the host divides Sector0 into D0, the second write divides Sector0 into D1, and the current third write divides Sector0 into D2, the generated DIF1 It is used to check the integrity of D0 ⁇ D2.
  • the host outputs the second write data and DIF1, DIF2, and DIF3 to the storage device.
  • the host optionally sends a second write instruction to the storage device, and the write instruction includes but is not limited to: second write data, second write data Data information and DIF1, DIF2, DIF3, the host outputs the second write data and DIF1, DIF2, DIF3 to the storage controller.
  • the lengths of DIF1-DIF3 are equal, and the host can output DIF1-DIF3 to the storage controller in sequence, so that the storage controller can obtain the correspondence between DIF1-DIF3 and data blocks.
  • the data information of the second write data includes, but is not limited to: the index address information of the second write data, the start address of the second write data, and the data length of the second write data.
  • the index address information of the second write data is the same as the index address information of the first write data
  • the start address of the second write data is the same as the end address of the first write data.
  • FIG. 9 is an exemplary schematic diagram of a processing flow on the storage device side. Please refer to Figure 9, which includes:
  • the storage device receives the second write data and DIF1, DIF2, and DIF3.
  • the storage controller may acquire the second write data, the data information of the second write data, and DIF1, DIF2, and DIF3.
  • the storage controller may determine that the index address information of the second write data is the same as the index address information of the first write data, that is, the second write data is the same as the first write data.
  • a write data belongs to the same data (ie DataX).
  • the start address of the data written in the second time is the same as the end address of the data written in the first time, that is, the data written in the second time and the data written in the first time are continuous data.
  • the storage device parses the second written data according to the granularity of the sector, and obtains data blocks D1, D2 and D3.
  • the storage controller splices the first write data and the second write data as continuous data.
  • the storage controller may divide the first write data and the second write data according to sector granularity.
  • the storage controller may divide the second write data into at least one data block according to sector granularity, including: D1, D2, and D3.
  • D1, D2, and D3 may refer to the above, which will not be repeated here.
  • the storage device detects whether D1, D2, and D3 are aligned with the sector.
  • the memory controller detects whether D1 is aligned with the sector. Exemplarily, as shown in FIG. 10b, the start address of D1 is different from the start address of Sector0, and the data length and sector length are also different, that is, D1 and Sector0 are not aligned. Execute S405.
  • the memory controller detects whether D2 is aligned with the sector.
  • the start address of D2 is the same as the start address of Sector1
  • the data length of D2 is equal to the sector length, that is, D2 is aligned with Sector1, and S404 is executed.
  • the memory controller detects whether D3 is aligned with the sector.
  • the start address of D3 is the same as the start address of Sector2, and the data length of D3 is smaller than the sector length, that is, D3 is not aligned with Sector2, and S405 is executed.
  • the storage device performs verification based on the data block.
  • the storage controller may perform verification on D2 based on DIF2. It can also be understood that since D2 is aligned with the Sector, the verification process is performed at sector granularity. .
  • the storage device performs merge verification on the data block and the data block in the same sector, or performs verification based on the data block.
  • the storage controller After the storage controller verifies D0, it waits for the next writing of data.
  • the memory controller can determine that D1 and D0 belong to the same Sector based on the start position of D1 (that is, the start position of D1 is in Sector0), and the start address of D1 and the end address of D0 The same, that is, D1 and D0 are continuous data.
  • the DIF1 generated by the host can be divided into two ways. One is that DIF1 is only used to verify D1. The other is that DIF1 is used to check all the data between the starting position of the Sector and the current data block, as shown in Figure 8c or Figure 8d. Correspondingly, the host and the storage controller can agree on a DIF generation manner, so that the storage controller can verify the corresponding data block based on the DIF.
  • the memory controller can verify D1 based on DIF1.
  • the storage controller can determine the difference between D1 and D1 based on the starting address of D1, the starting address and data length of D0.
  • D0 is continuous data and belongs to the same Sector (ie Sector0).
  • the start address of D0 is the same as that of Sector0.
  • the memory controller can determine that DIF1 is used to verify D0 and D1.
  • the storage controller can verify D0 and D1 based on DIF1.
  • the storage controller detects that the start address of D3 is the same as the start address of Sector2, and the data length of D3 is smaller than the sector length, that is, D3 and Sector2 are not aligned.
  • the storage controller may verify D3 based on the granularity of the data block, that is, verify D3 based on DIF3, and execute S406, that is, wait for the next written data.
  • D3 is not aligned with the Sector, and it can wait for the next written data to determine whether there is data belonging to the same Sector as D3.
  • S204 For a specific description, reference may be made to S204, which will not be repeated here.
  • FIG. 11 is an exemplary schematic diagram of a processing flow on the host side. Please refer to Figure 11, including:
  • the host obtains the data block D4 written for the third time.
  • the host may perform the third write process based on DataX. Specifically, the host can obtain the third write data.
  • the start address of the data written in the third time is the same as the end address of the data written in the second time
  • the end address of the data written in the third time is the end address of DataX.
  • the host is divided according to sector granularity, and the data block D4 is obtained.
  • the specific acquisition method can refer to the above, and will not be repeated here.
  • the start address of D4 is the same as the end address of the second write data.
  • the host generates DIF4 corresponding to D4.
  • DIF4 can be used to check D4.
  • DIF4 can be used to check D4 and D3.
  • D1 please refer to the description of D1, which will not be repeated here.
  • the host outputs the third write data and DIF4 to the storage device.
  • the host outputs a third write command to the storage controller.
  • the third write instruction includes, but is not limited to: the third write data, the data information of the third write data, and DIF4.
  • the data information of the third write data includes, but is not limited to: index address information of the third write data, start address of the third write data, and data length of the third write data.
  • the index address of the data written for the third time is the same as the index address information of the data written for the first time and the index address information of the data written for the second time.
  • the start address of the data written in the third time is the same as the end address of the data written in the second time.
  • FIG. 13 is an exemplary schematic diagram of a processing flow on the storage device side. Please refer to Figure 13, including:
  • the storage device receives the third write data and DIF4.
  • the storage controller receives the third write instruction, and obtains the third write data, the data information of the third write data, and DIF4.
  • the storage device parses the data written for the third time according to the granularity of the sector, and obtains a data block D4.
  • the storage controller may obtain the data block D4 according to the granularity of the sector.
  • the start address of D4 is the same as the end address of D3.
  • the storage device detects whether D4 is aligned with the sector.
  • the start address of D4 is different from the start address of Sector2, and the length of D4 is also different from the sector length of Sector2, that is, D4 and Sector3 are not aligned.
  • the storage device performs merge verification on the data block and the data block in the same sector, or performs verification based on the data block.
  • the storage controller may verify D4 in a manner agreed with the host.
  • the storage controller may verify D4 based on DIF4.
  • the memory controller may verify D3 and D4 based on DIF4. The specific details are similar to the processing of D1, and are not repeated here.
  • the memory controller may wait for the next write instruction.
  • the storage controller Complete the Sector data. For example, as shown in FIG. 14, the storage controller will add dummy data (which may be called invalid data) at the end of D4 according to the start address and sector length of Sector2.
  • the storage controller after the storage controller waits for a set period of time, if it does not receive a write command sent by the host, the storage controller fills up the sector data, as shown in FIG. 14 .
  • the storage controller may store data to the storage medium according to sector granularity.
  • the storage controller determines, based on the start addresses and data lengths of D0 and D1, that the combined data length of D0 and D1 is equal to the sector length.
  • the storage controller stores D0 and D1 in Sector0 in the storage medium.
  • the starting address of D0 is the same as the starting address of Sector0, and the data length after combining D0 and D1 is equal to the sector length.
  • the storage controller determines that the data length of D2 is equal to the sector length based on the start address and data length of D2.
  • the storage controller stores D2 in Sector1 in the storage medium.
  • the starting address of D2 is the same as the starting address of Sector1, and the data length of D2 is equal to the sector length.
  • the storage controller stores D3 and D4 and the null data in Sector2 based on the total length of D3 and D4 and the supplemented null data.
  • the starting address of D3 is the same as the starting address of Sector2, and the total length of D3, D4 and the null data is equal to the sector length.
  • the verification methods of the storage controller are divided into data block-based verification, sum, sector-based verification (that is, the above-mentioned merge verification test method). Therefore, when storing, based on different verification methods, the storage of DIF is also different.
  • the storage medium stores DIFs corresponding to each data block, including: DIF0, DIF1, DIF2, DIF3, and DIF4.
  • the storage medium can generate the corresponding DIF based on the stored data of each sector.
  • the memory controller may generate a new DIF, such as DIF1', based on the sector data of Sector0, ie, including D0 and D1, and generate a new DIF, such as DIF3', based on D3 and D4.
  • the DIFs stored in the storage medium include: DIF1', DIF2 and DIF3'.
  • the DIFs stored in the storage medium include: DIF1, DIF2 and DIF4.
  • the DIF may be stored in the same sector as the corresponding data block.
  • the DIF can also be stored in other areas independently, which is not limited in this application.
  • the embodiment of the present application further provides a byte-level reading method, wherein the reading method in the embodiment of the present application supports E2E verification.
  • the reading modes in the embodiments of the present application will be described in detail below with reference to specific embodiments.
  • FIG. 16 is a flowchart of a processing manner of an exemplary storage device. Please refer to Figure 16, which includes:
  • the storage device receives a first read instruction input by the host.
  • the host may determine the data to be read in response to the received user instruction. and output the first read command to the storage controller.
  • the first read instruction includes, but is not limited to: the starting address of the data to be read, the data length L, and index address information.
  • the storage device searches for the data to be read based on the first read instruction.
  • the storage controller may search for the corresponding sector based on the obtained index address information of the data to be read. And further based on the starting address of the data to be read and the data length L, the data to be read is found.
  • the storage controller finds the data to be read based on the index address information and the start address and data length L of the data to be read.
  • the data to be read covers Sector0, Sector1 and Sector2.
  • S703 The storage device divides the data to be read into at least one data block according to sector granularity.
  • the storage controller may divide the data to be read into multiple data blocks according to sector granularity. Including: Dx, Dy and Dz.
  • the start address of Dx is the same as the start address of the data to be read, and the end address of Dx is the same as the end address of Sector0.
  • the start address of Dy is the same as the start address of Sector1
  • the end address of Dy is the same as the end address of Sector1.
  • the start address of Dz is the same as the start address of Sector2, and the end address of Dz is the same as the end address of the data to be read.
  • the storage device verifies the data in the sector to which each data block belongs.
  • the storage controller performs verification at the granularity of sectors.
  • Dx belongs to Sector0, and the storage controller verifies all data in Sector0.
  • Dy belongs to Sector1, and the storage controller verifies all data in Sector1.
  • Dz belongs to Sector2, and the storage controller verifies all data in Sector2.
  • the storage controller may verify all data in Sector0 based on DIF1 corresponding to Sector0. And check all the data in Sector1 based on DIF2 corresponding to Sector1. And, check all data in Sector2 based on DIF4 corresponding to Sector2.
  • the storage controller when the storage controller stores data, due to its different verification methods, its storage methods are also different.
  • the storage medium stores D0 and DIF0 corresponding to D0, and DIF1 corresponding to D1.
  • the storage controller may perform verification at the granularity of data blocks. For example, based on the start address and data length of Dx and the start address and data length of D1, the memory controller determines that Dx is included in D1, that is, the start address of Dx is within D1, and the data length of Dx is less than or equal to D1 data length. Then, the storage controller can verify D1 based on DIF1 without verifying Sector0. Of course, if Dx covers D0 and D1, D1 can be verified based on DIF1, and D0 can be verified based on DIF0.
  • the storage controller if any of the foregoing data blocks or sectors fails to be verified, the storage controller returns a read failure message to the host.
  • S705 is performed.
  • the storage device outputs the data block and the corresponding DIF to the host.
  • the storage controller outputs the data to be read to the host with the granularity of bytes. Specifically, the storage controller detects whether each data block is aligned with the sector. In one example, for a data block that is not aligned with a sector, the storage controller may generate a corresponding DIF based on the data block, and output the data block and the corresponding DIF to the host. In another example, if the data block is aligned with the sector, the storage controller outputs the data block (that is, the data in the sector) and the DIF corresponding to the sector to the host.
  • the start address of Dx is different from the start address of Sector0
  • the data length of Dx is different from the sector length of Sector0, that is, Dx and Sector0 are not aligned.
  • the storage controller may generate a DIF based on Dx, denoted as DIFx.
  • the start address of Dy is the same as the start address of Sector1, and the data length of Dy is the same as that of Sector1. That is, Dy is aligned with Sector1.
  • the DIF corresponding to Dy is the DIF corresponding to Sector1 (ie, DIF2).
  • the start address of Dx is the same as the start address of Sector2, and the data length of Dx is smaller than the sector length of Sector2. That is, Dz is not aligned with Sector2.
  • the storage controller may generate a DIF based on Dz, denoted as DIFz.
  • the memory controller may output the data to be read and DIFx, DIF2 and DIFz to the host. It can be understood that the division of data blocks is logical processing, and only generates corresponding DIFs. The principle is similar to that of writing, and the storage controller outputs the data to be read instead of the divided data blocks.
  • the host can divide the data to be read according to the division method of FIG. 17b to obtain Dx, Dy and Dz.
  • Dx can be verified based on DIFx.
  • Dy is checked.
  • DIFz Dz is checked.
  • the verification is successful, the host can perform subsequent processing on the data to be read.
  • the host reads the data to be read from the storage control device again. It should be noted that, for the specific details of the host side, reference may be made to the above-mentioned related content of the storage device side, which will not be repeated here.
  • the storage device includes corresponding hardware structures and/or software modules for performing each function.
  • the embodiments of the present application can be implemented in hardware or a combination of hardware and computer software. Whether a function is performed by hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each particular application, but such implementations should not be considered beyond the scope of this application.
  • the storage device may be divided into functional modules according to the foregoing method examples.
  • each functional module may be divided corresponding to each function, or two or more functions may be integrated into one processing module.
  • the above-mentioned integrated modules can be implemented in the form of hardware, and can also be implemented in the form of software function modules. It should be noted that, the division of modules in the embodiments of the present application is schematic, and is only a logical function division, and there may be other division manners in actual implementation.
  • FIG. 18 shows a schematic block diagram of an electronic device 1800 according to an embodiment of the present application.
  • the electronic device may include: a processor 1801 , a transceiver/transceiver pin 1802 , and optionally, a memory 1803 .
  • the processor 1801 can be used to execute the steps performed by the processor and the memory in each method of the foregoing embodiments, and control the receiving pins to receive signals, and control the transmitting pins to transmit signals.
  • bus system 1804 includes a power bus, a control bus and a status signal bus in addition to a data bus.
  • bus system 1804 includes a power bus, a control bus and a status signal bus in addition to a data bus.
  • bus system 1804 the various buses are labeled as bus system 1804 in the figure.
  • the memory 1803 may be used for storing instructions in the foregoing method embodiments.
  • embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and the computer program includes at least a piece of code, and the at least piece of code can be executed by an electronic device to control The electronic device is used to implement the above method embodiments.
  • an embodiment of the present application further provides a computer program, which is used to implement the above method embodiments when the computer program is executed by an electronic device.
  • the program may be stored in whole or in part on a storage medium packaged with the processor, or may be stored in part or in part in a memory not packaged with the processor.
  • an embodiment of the present application further provides a processor, and the processor is used to implement the above method embodiments.
  • the above-mentioned processor may be a chip.
  • the steps of the method or algorithm described in conjunction with the disclosure of the embodiments of this application may be implemented in a hardware manner, or may be implemented in a manner in which a processor executes software instructions.
  • Software instructions can be composed of corresponding software modules, and software modules can be stored in random access memory (Random Access Memory, RAM), flash memory, read only memory (Read Only Memory, ROM), erasable programmable read only memory ( Erasable Programmable ROM, EPROM), Electrically Erasable Programmable Read-Only Memory (Electrically EPROM, EEPROM), registers, hard disk, removable hard disk, CD-ROM, or any other form of storage medium known in the art.
  • RAM Random Access Memory
  • ROM read only memory
  • EPROM erasable programmable read only memory
  • registers hard disk, removable hard disk, CD-ROM, or any other form of storage medium known in the art.
  • An exemplary storage medium is coupled to the processor, such that the processor can read information from, and write information to, the storage medium.
  • the storage medium can also be an integral part of the processor.
  • the processor and storage medium may reside in an ASIC.
  • the ASIC may be located in a network device.
  • the processor and storage medium may also exist in the network device as discrete components.
  • Computer-readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another.
  • a storage medium can be any available medium that can be accessed by a general purpose or special purpose computer.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Signal Processing For Digital Recording And Reproducing (AREA)

Abstract

本申请实施例提供了一种存储方法及存储控制器。该方法包括:接收以字节为粒度的写入数据,并对写入数据进行校验。以及,将校验成功后的数据,以扇区粒度进行存储。从而实现一种字节级的读写方式,使得存储设备可与其它设备之间按照不同的字节长度进行数据交互,从而使得读写方式更加灵活。

Description

存储方法及存储控制器 技术领域
本申请实施例涉及存储设备领域,尤其涉及一种存储方法及存储控制器。
背景技术
目前,高可靠存储的实现通常依赖于E2E(End to End,端到端)数据保护技术,以确保从主机端到存储设备端的数据的可靠性。E2E数据保护技术要求存储设备支持DIF(Data Integrity Field,数据完整性校验字段)功能,以使得主机端与存储设备端可基于DIF对对应的数据进行校验。
E2E数据保护技术均是基于固定扇区大小进行访问与管理的,具体为在每个扇区的数据后增加固定字节的校验字段,以进行完整性校验。示例性的,如图1所示,主机端(也可以理解为主机端)向存储端写入的数据是以固定扇区为粒度写入的,例如,主机向存储输入数据C,其中,数据C的长度等于扇区的长度。并且,数据C携带DIF,DIF用于对数据C进行校验。相应的,存储端是以固定扇区为粒度进行存储的。仍参照图1,示例性的,存储接收到数据C和DIF后,将数据C和DIF写入扇区。其中,存储的扇区中还包括数据A及对应的DIF,以及,数据B和对应的DIF。当主机端需要读取数据时,存储端基于扇区对应的DIF对该扇区内的数据进行校验,并将该扇区的全部数据和对应的DIF反馈至主机端。例如,仍参照图1,存储可基于数据C所属扇区对应的DIF,对数据C进行校验,并在校验成功后,将数据C和DIF输出至主机。相应的,主机基于DIF对数据C进行校验,以确定数据C的正确性。
发明内容
为了解决上述技术问题,本申请提供一种存储方法及存储控制器。在该方法中,存储控制器可实现字节粒度的读写和校验,在提供字节级访问的同时,可支持端到端数据保护。
第一方面,本申请实施例提供一种存储方法。该方法包括:存储控制器接收第一写入指令,第一写入指令包括:第一数据、第一数据信息和至少一个校验信息;其中,第一数据信息指示了第一数据的起始地址以及第一数据的长度;存储控制器基于至少一个校验信息,对第一数据中与每个校验信息对应的数据块分别进行校验;第一数据中存在至少一个长度小于扇区长度的数据块,扇区长度为耦合至存储控制器的存储介质中的扇区的长度。在第一数据中的所有数据块校验成功的情形下,存储控制器基于第一数据信息,将第一数据中写入存储介质中。
本申请中,第一数据在划分数据块时,是以字节级的粒度划分的。即划分后的数据块中可以包括长度小于扇区长度的数据块。也可以理解为,第一数据并不是与扇区为粒度对齐的,第一数据的起始位置和/或结尾位置可以是在扇区中的任一位置。而非像现有 技术一样,统一以扇区长度进行数据块的划分,这样,存储设备端可为主机端提供字节级的访问接口。并且,存储控制器可以对写入数据实现端到端保护,对每次写入的字节级数据进行校验,从而保证字节级数据在传输过程中的可靠性。以及,存储控制器还可以基于扇区粒度对数据进行存储和管理。从而在实现字节级访问的同时,可以实现端到端数据保护,提高数据的可靠性。
示例性的,主机每次写入的数据的长度可以大于扇区长度、等于扇区长度,还可以小于扇区长度。对应的,第一数据的数据块中可选地存在至少一个数据块的长度是与扇区长度不一致的。
示例性的,校验信息可以包括CRC等校验信息。
示例性的,存储控制器按照接收到的数据的顺序,将数据依次写入对应的扇区。
根据第一方面,基于至少一个校验信息,对第一数据中与每个校验信息对应的数据块分别进行校验,包括:存储控制器将第一数据划分为至少一个数据块,其中每个数据块分别与一个校验信息一一对应。存储控制器基于至少一个校验信息,对至少一个数据块进行校验。
这样,存储控制器可基于校验信息,对对应的数据块进行校验,以确定主机与存储设备的传输过程中,第一数据是否正确传输。
示例性的,存储控制器可按照预设的划分方式,对第一数据进行划分。
示例性的,预设的划分方式与主机端的划分方式是一致的。
示例性的,至少一个数据块与至少一个校验信息一一对应。
示例性的,存储控制器可基于校验信息,对对应的数据块进行完整性校验。
根据第一方面,或者以上第一方面的任意一种实现方式,将第一数据划分为至少一个数据块,包括:存储控制器根据扇区的起始地址和扇区长度,将第一数据划分为至少一个数据块;其中,至少一个数据块中的单一数据块的起始地址与扇区的起始地址相同或不同。
这样,存储控制器可按照预设的划分方式,将第一数据划分为至少一个数据块。以获取至少一个校验信息与至少一个数据块之间的对应关系。
示例性的,存储控制器接收到的至少一个校验信息是按照顺序排列的。相应的,存储设备可基于接收到的校验信息的顺序,确定至少一个数据块与至少一个校验信息之间的对应关系。
根据第一方面,或者以上第一方面的任意一种实现方式,基于至少一个校验信息,对第一数据中与每个校验信息对应的数据块分别进行校验,包括:当单一数据块的起始地址与扇区的起始地址相同,且单一数据块的长度等于扇区长度,存储控制器基于单一数据块对应的目标校验信息,对单一数据块进行校验;其中,目标校验信息属于至少一个校验信息。
这样,存储控制器可对数据块进行扇区粒度的校验。也就是说,当数据块的起始地 址与长度与扇区的起始地址与扇区长度相同时,其所对应的校验信息则是以扇区粒度进行校验的。
示例性的,对于起始地址与长度与扇区的起始地址和扇区长度相同的数据块,存储控制器在存储该类数据块时,数据块是按照扇区存储的。即,数据块存储在一个扇区中。
根据第一方面,或者以上第一方面的任意一种实现方式,基于所述至少一个校验信息,对所述第一数据中与每个校验信息对应的数据块分别进行校验,包括:当单一数据块的起始地址与扇区的起始地址不相同,和/或,单一数据块的长度小于扇区长度,存储控制器基于单一数据块对应的目标校验信息,对单一数据块进行校验;其中,目标校验信息属于至少一个校验信息。
这样,存储控制器可对数据块进行字节级的校验。也就是说,针对未与扇区对齐,即,起始地址和/或长度与扇区的起始地址和扇区长度不相同的数据块,存储设备可基于校验信息,对数据块进行校验。
示例性的,存储控制器可将未与扇区对齐的数据块存储在缓存中,以等待下一次写入数据。
示例性的,若在预定时长内未接收到写入数据,存储控制器可以扇区粒度,存储该数据块。
根据第一方面,或者以上第一方面的任意一种实现方式,基于所述至少一个校验信息,对所述第一数据中与每个校验信息对应的数据块分别进行校验,包括:当单一数据块的起始地址与扇区的起始地址不相同,和/或,单一数据块的长度小于扇区长度,存储控制器将单一数据块与前一次接收到的数据块或者下一次接收到的数据块合并;其中,前一次接收到的数据块的结尾地址与单一数据块的起始地址相同,且前一次接收到的数块的起始地址与扇区的起始地址相同;或者,下一次接收到的数据块的起始地址与单一数据块的结尾地址相同,且下一次接收到的数据块的结尾地址与扇区的结尾地址相同;并且,合并后的数据块的起始地址与扇区的起始地址相同,且合并后的数据块的长度等于扇区长度;基于合并后的数据块对应的目标校验信息,对合并后的数据块进行校验;其中,目标校验信息属于至少一个校验信息。
这样,存储控制器可将未与扇区对齐的数据块进行合并校验。示例性的,合并校验是指基于校验信息,对该数据块所属的扇区的起始位置到当前位置包含的数据进行校验。
示例性的,若合并后的数据块的长度等于扇区长度,存储控制器可将合并后的数据块存储到一个扇区中。
示例性的,若合并后的数据块的长度小于扇区长度,存储控制器可重复执行合并校验的步骤。或者,若在预定时长内未接收到写入数据,存储设备可将合并后的数据块存储到一个扇区中。
第二方面,本申请实施例提供一种存储方法。该方法包括存储控制器接收第一读取指令,第一读取指令包括第一地址信息和第一长度信息,第一地址信息用于指示需要读 取的第一数据的起始地址,第一长度信息用于指示第一数据的长度;其中,第一数据位于至少一个扇区。存储控制器响应于接收到的第一读取指令,基于至少一个扇区对应的校验信息,对至少一个扇区中的数据进行校验。当至少一个扇区中的数据校验成功,存储控制器将第一数据中的至少一个数据块与对应的至少一个校验信息输出至第一设备;其中,若至少一个数据块中的单一数据块的长度等于扇区长度,单一数据块对应的校验信息为单一数据块所属扇区对应的校验信息;若单一数据块的长度小于扇区长度,单一数据块对应的校验信息为基于单一数据块生成的。
这样,存储控制器可提供字节级的读写访问接口。存储控制器可基于主机的需求,从存储数据的多个扇区中,以扇区粒度对数据进行校验。并且,将校验后的数据,按照主机需求的起始地址与长度,将对应的数据以及校验信息输出至主机。从而在实现字节级读写访问的同时,提供端到端数据保护。
示例性的,第一设备为主机。
示例性的,第一数据的数据长度可以小于扇区长度,也可以等于扇区长度,还可以大于扇区长度。
根据第二方面,基于至少一个扇区对应的校验信息,对至少一个扇区中的数据进行校验,包括:存储控制器响应于接收到的第一读取指令,根据扇区的起始地址和扇区长度,将第一数据划分为至少一个数据块;其中,至少一个数据块中的单一数据块的起始地址与扇区的起始地址相同或不同。存储控制器基于单一数据块所属扇区对应的校验信息,对单一数据块所属扇区进行校验。
这样,存储控制器可将待读取数据,按照扇区粒度进行划分。并对各数据块所属的扇区进行校验,从而保证读取数据的准确性。
根据第二方面,或者以上第二方面的任意一种实现方式,当至少一个扇区中的数据校验成功,将第一数据中的至少一个数据块与对应的至少一个校验信息输出至第一设备,包括:当对单一数据块所属扇区校验成功,且单一数据块的长度等于扇区长度,存储控制器将单一数据块和单一数据块所属扇区对应的校验信息输出至第一设备。
这样,当数据块与扇区对齐,即数据块的起始地址与长度与扇区的起始地址和扇区长度相同,则该数据块是以扇区为粒度的数据块,存储控制器可将该数据块与扇区对应的校验信息,对应输出至主机,而无需单独生成校验信息。
根据第二方面,或者以上第二方面的任意一种实现方式,当至少一个扇区中的数据校验成功,存储控制器将第一数据中的至少一个数据块与对应的至少一个校验信息输出至第一设备,包括:当对单一数据块所属扇区校验成功,且第一数据块的长度小于扇区长度,存储控制器基于单一数据块生成校验信息,并将单一数块与生成的校验信息输出至第一设备。
示例性的,对于未与扇区对齐的数据块,扇区的校验信息不适用于数据块的校验。也就是说,若将数据块与扇区的校验信息传输至主机,则主机端对该数据块的校验会失 败。因此,存储控制器为该类未对齐的数据块单独生成对应的校验信息,以使得主机段可基于数据块对应的校验信息,对数据块进行校验,从而实现端到端保护。
第三方面,本申请实施例提供一种存储控制器。该设备包括处理器以及接口电路,处理器通过接口电路耦合至存储介质。处理器可用于接收第一写入指令,所述第一写入指令包括:第一数据、第一数据信息和至少一个校验信息;其中,所述第一数据信息指示了所述第一数据的起始地址以及所述第一数据的长度;基于所述至少一个校验信息,对所述第一数据中与每个校验信息对应的数据块分别进行校验;所述第一数据中存在至少一个长度小于扇区长度的数据块,所述扇区长度为耦合至所述存储控制器的存储介质中的扇区的长度;在所述第一数据中的所有数据块校验成功的情形下,基于所述第一数据信息,将所述第一数据中写入所述存储介质中。
根据第三方面,处理器,具体用于:将所述第一数据划分为至少一个数据块,其中每个数据块分别与一个校验信息一一对应;基于所述至少一个校验信息,对所述至少一个数据块进行校验。
根据第三方面,或者以上第三方面的任意一种实现方式,处理器,具体用于:根据扇区的起始地址和扇区长度,将第一数据划分为至少一个数据块;其中,至少一个数据块中的单一数据块的起始地址与扇区的起始地址相同或不同。
根据第三方面,或者以上第三方面的任意一种实现方式,处理器,具体用于:当单一数据块的起始地址与扇区的起始地址相同,且单一数据块的长度等于扇区长度,基于单一数据块对应的目标校验信息,对单一数据块进行校验;其中,目标校验信息属于至少一个校验信息。
根据第三方面,或者以上第三方面的任意一种实现方式,处理器,具体用于:当单一数据块的起始地址与扇区的起始地址不相同,和/或,单一数据块的长度小于扇区长度,基于单一数据块对应的目标校验信息,对单一数据块进行校验;其中,目标校验信息属于至少一个校验信息。
根据第三方面,或者以上第三方面的任意一种实现方式,处理器,具体用于:当单一数据块的起始地址与扇区的起始地址不相同,和/或,单一数据块的长度小于扇区长度,将单一数据块与前一次接收到的数据块或者下一次接收到的数据块合并;其中,前一次接收到的数据块的结尾地址与单一数据块的起始地址相同,且前一次接收到的数块的起始地址与扇区的起始地址相同;或者,下一次接收到的数据块的起始地址与单一数据块的结尾地址相同,且下一次接收到的数据块的结尾地址与扇区的结尾地址相同;并且,合并后的数据块的起始地址与扇区的起始地址相同,且合并后的数据块的长度等于扇区长度;基于合并后的数据块对应的目标校验信息,对合并后的数据块进行校验;其中, 目标校验信息属于至少一个校验信息。
第三方面以及第三方面的任意一种实现方式分别与第一方面以及第一方面的任意一种实现方式相对应。第三方面以及第三方面的任意一种实现方式所对应的技术效果可参见上述第一方面以及第一方面的任意一种实现方式所对应的技术效果,此处不再赘述。
第四方面,本申请实施例提供一种存储控制器,包括处理器以及接口电路,所述处理器通过所述接口电路耦合至存储介质。处理器用于接收第一读取指令,第一读取指令包括第一地址信息和第一长度信息,第一地址信息用于指示需要读取的第一数据的起始地址,第一长度信息用于指示第一数据的长度;其中,第一数据位于至少一个扇区;响应于接收到的第一读取指令,基于至少一个扇区对应的校验信息,对至少一个扇区中的数据进行校验;当至少一个扇区中的数据校验成功,将第一数据中的至少一个数据块与对应的至少一个校验信息输出至第一设备;其中,若至少一个数据块中的单一数据块的长度等于扇区长度,单一数据块对应的校验信息为单一数据块所属扇区对应的校验信息;若单一数据块的长度小于扇区长度,单一数据块对应的校验信息为基于单一数据块生成的。
根据第四方面,或者以上第四方面的任意一种实现方式,处理器,具体用于:响应于接收到的第一读取指令,根据扇区的起始地址和扇区长度,将第一数据划分为至少一个数据块;其中,至少一个数据块中的单一数据块的起始地址与扇区的起始地址相同或不同;基于单一数据块所属扇区对应的校验信息,对单一数据块所属扇区进行校验。
根据第四方面,或者以上第四方面的任意一种实现方式,处理器,具体用于:当对单一数据块所属扇区校验成功,且单一数据块的长度等于扇区长度,将单一数据块和单一数据块所属扇区对应的校验信息输出至第一设备。
根据第四方面,或者以上第四方面的任意一种实现方式,处理器,具体用于:当对单一数据块所属扇区校验成功,且第一数据块的长度小于扇区长度,基于单一数据块生成校验信息,并将单一数块与生成的校验信息输出至第一设备。
第四方面以及第四方面的任意一种实现方式分别与第一方面以及第一方面的任意一种实现方式相对应。第四方面以及第四方面的任意一种实现方式所对应的技术效果可参见上述第二方面以及第二方面的任意一种实现方式所对应的技术效果,此处不再赘述。
第五方面,本申请实施例提供了一种计算机可读介质,用于存储计算机程序,该计算机程序包括用于执行第一方面或第一方面的任意可能的实现方式中的方法的指令。
第五方面以及第五方面的任意一种实现方式分别与第一方面以及第一方面的任意一种实现方式相对应。第五方面以及第五方面的任意一种实现方式所对应的技术效果可参见上述第一方面以及第一方面的任意一种实现方式所对应的技术效果,此处不再赘述。
第六方面,本申请实施例提供了一种计算机可读介质,用于存储计算机程序,该计算机程序包括用于执行第二方面或第二方面的任意可能的实现方式中的方法的指令。
第六方面以及第六方面的任意一种实现方式分别与第二方面以及第二方面的任意一种实现方式相对应。第六方面以及第六方面的任意一种实现方式所对应的技术效果可参见上述第二方面以及第二方面的任意一种实现方式所对应的技术效果,此处不再赘述。
第七方面,本申请实施例提供一种存储设备,包括第二方面或第二方面的任意可能的实现方式中的存储控制器和存储介质。
第八方面,本申请实施例提供一种存储设备,包括第四方面或第四方面的任意可能的实现方式中的存储控制器和存储介质。
第九方面,本申请实施例提供了一种计算机程序,该计算机程序包括用于执行第一方面或第一方面的任意可能的实现方式中的方法的指令。
第九方面以及第九方面的任意一种实现方式分别与第一方面以及第一方面的任意一种实现方式相对应。第九方面以及第九方面的任意一种实现方式所对应的技术效果可参见上述第一方面以及第一方面的任意一种实现方式所对应的技术效果,此处不再赘述。
第十方面,本申请实施例提供了一种计算机程序,该计算机程序包括用于执行第一方面或第一方面的任意可能的实现方式中的方法的指令。
第十方面以及第十方面的任意一种实现方式分别与第二方面以及第二方面的任意一种实现方式相对应。第十方面以及第十方面的任意一种实现方式所对应的技术效果可参见上述第二方面以及第二方面的任意一种实现方式所对应的技术效果,此处不再赘述。
附图说明
图1为示例性示出的读写方式示意图;
图2为示例性示出的终端的结构示意图;
图3为示例性示出的主机侧的处理流程示意图;
图4a~图4d为示例性示出的主机侧的处理示意图;
图5为示例性示出的存储设备侧的处理流程示意图;
图6a~图6b为示例性示出的存储设备侧的处理示意图;
图7为示例性示出的主机侧的处理流程示意图;
图8a~图8e为示例性示出的主机侧的处理示意图;
图9为示例性示出的存储设备侧的处理流程示意图;
图10a~图10b为示例性示出的存储设备侧的处理示意图;
图11为示例性示出的主机侧的处理流程示意图;
图12a~图12b为示例性示出的主机侧的处理示意图;
图13为示例性示出的存储设备侧的处理流程示意图;
图14为示例性示出的存储设备侧的处理示意图;
图15为示例性示出的存储设备侧的处理示意图;
图16为示例性示出的存储设备侧的处理流程示意图;
图17a~图17b为示例性示出的主机侧的处理示意图;
图18为示例性示出的装置的结构示意图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。
本申请实施例的说明书和权利要求书中的术语“第一”和“第二”等是用于区别不同的对象,而不是用于描述对象的特定顺序。例如,第一目标对象和第二目标对象等是用于区别不同的目标对象,而不是用于描述目标对象的特定顺序。
在本申请实施例中,“示例性的”或者“例如”等词用于表示作例子、例证或说明。本申请实施例中被描述为“示例性的”或者“例如”的任何实施例或设计方案不应被解释为比其它实施例或设计方案更优选或更具优势。确切而言,使用“示例性的”或者“例如”等词旨在以具体方式呈现相关概念。
在本申请实施例的描述中,除非另有说明,“多个”的含义是指两个或两个以上。例如,多个处理单元是指两个或两个以上的处理单元;多个系统是指两个或两个以上的系统。
本申请实施例中的存储方法可应用于电子设备,电子设备可以是终端、例如手机、电脑、笔记本电脑、平板,还可以是网络设备,例如基站等包括存储的设备。图2是一种电子设备的结构示意图。在图2中:
电子设备包括主机(Host)200与存储设备(Device)210。可选地,主机端也可以称为计算机端、处理端等,本申请不做限定。可选地,设备也可以称为存储器、存储设备等,本申请不做限定。
示例性的,主机200包括应用层201和驱动层202。
示例性的,存储设备210可以包括如下至少一种类型:磁盘存储介质或者其他磁存储设备,例如固态驱动器(Solid State Disk或Solid State Drive,SSD),或者能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。
存储设备210可以是独立存在,与主机200相连。可选的,存储设备210也可以和主机200集成在一起,例如集成在一个芯片之内。其中,存储设备210能够存储执行本申请实施例的技术方案的程序代码,并由主机200来控制执行,被执行的各类计算机程 序代码也可被视为是主机200的驱动程序。例如,主机200用于执行存储设备210中存储的计算机程序代码,从而实现本申请实施例中的技术方案。可选的,存储设备210还可以在芯片之外,通过接口与主机200相连。
示例性的,存储设备210包括控制器211与存储介质215。示例性的,控制器211包括通用中央处理器(Central Processing Unit,CPU)212、静态随机存取存储器(Static Random-Access Memory,SRAM)213以及Nand(闪存)控制器214。
示例性的,控制器211还包括一个或多个接口,用于连接主机200。以及,承载数据传输的功能,可用于主机200与存储设备210之间的数据传输。
示例性的,CPU212,用于各部件之间的管理和数据交互。
示例性的,STRAM213为片内RAM空间。
示例性的,Nand控制器214,用于管理和控制存储介质。
示例性的,存储介质215,用于存储数据。示例性的,硬盘存储介质或SSD等存储器上包括扇区,其中,扇区是指磁盘上划分的区域。磁盘上的每个磁道被等分为若干个弧段,这些弧段便是磁盘的扇区,硬盘的读写以扇区为基本单位。示例性的,扇区的长度(即容量,也可以理解为可以写入的数据量)可以为512字节或4096字节等,本申请不做限定。示例性的,扇区的扇区信息包括但不限于扇区的起始地址与扇区长度。示例性的,扇区的起始地址可选地为扇区的逻辑区块地址(Logical Block Address,LBA)。
本申请实施例中的存储方法可选地是对主机200与存储设备210之间的数据交互,即读写方式进行说明。
图3为示例性示出的主机侧的处理流程示意图。请参照图3,具体包括:
S101,主机获取待写入数据DATA(数据)X。
示例性的,如图4a所示,主机可获取到DataX。可选地,DataX可以是主机通过天线接收到的,也可以是通过输入设备获取到的,本申请不做限定。
示例性的,DataX的长度可以大于存储介质中的一个扇区的长度,也可以小于存储介质中的一个扇区的长度,还可以是等于存储介质中的一个扇区的长度,本申请不做限定。
需要说明的是,本申请实施例中,以主机可获取到DataX,并通过多次写入的方式将DataX写入存储介质为例进行说明。在其他实施例中,主机也可以分多次获取到DataX,并将每次获取到的DataX中的数据写入存储介质。本申请不做限定。
S102,主机获取第一次写入的数据块D0。
示例性的,在本申请实施例中,主机可将DataX分多次写入存储设备。本申请实施例中的数据划分方式仅为示意性举例,本申请不做限定。
举例说明,如图4b所示,示例性的,主机将DataX进行划分,获取第一次写入数据。可选地,第一次写入数据的数据信息包括但不限于:第一次写入数据的起始地址(以下称为Offset信息)、长度(以下称为Length信息)以及索引地址信息。其中,索引地址信息用于指示多个数据属于同一个索引地址信息。例如,DataX划分后的多次写入数据所对应的索引地址信息是相同的。示例性的,第一次写入数据的起始地址是指在DataX中的起始地址,其粒度是以字节划分,具体示例可参照下文。
示例性的,在本申请实施例中,主机与存储控制器可预设有划分方式,主机与存储控制器的划分方式是相同,存储控制器的处理方式将在下面的流程中详细说明。
举例说明,主机以扇区为粒度,将第一次写入数据进行划分。具体的,以扇区的长度为512bytes为例。如图4c所示,示例性的,第一次写入数据的起始地址与Sector(扇区)0的起始地址一致。第一次写入数据的长度小于扇区长度(例如为512bytes)。相应的,将第一次写入数据划分为一个数据块,即数据块D0。
示例性的,D0的起始地址与Sector0的起始地址相同,且D0的数据长度小于扇区长度。
需要说明的是,在本申请实施例中,存储控制器是按照接收到的数据的顺序,依次以扇区为粒度,将数据写入对应的扇区。因此,按照该约定的写入方式,主机同样即可确定当前存储设备的存储状态,以及当前的数据,例如DataX对应的存储空间。也就是说,主机可基于约定的写入方式,获取当前写入位置信息。
进一步需要说明的是,本申请实施例中的数据的起始地址、数据的长度以及扇区的起始地址、扇区长度等信息均为示意性举例,本申请不做限定。
S103,主机生成对应于D0的DIF0。
示例性的,主机获取到划分后的数据块后,可基于各数据块生成对应的校验信息,即DIF。示例性的,DIF可用于校验对应的数据的完整性。示例性的,DIF包括循环冗余校验(Cyclic Redundancy Check,CRC)校验信息,以及其他校验信息。DIF的具体生成方式可参照已有技术,本申请不做限定。
S104,主机将第一次写入数据与DIF0输出至存储设备。
示例性的,主机获取到各数据块对应的DIF后,将第一次写入数据输与对应的DIF输出至存储控制器。
示例性的,主机可向存储控制器发送第一写入指令,可选地,第一写入指令中包括但不限于:第一次写入数据、DIF0、第一次写入数据的数据信息。其中,第一次写入数据的数据信息包括但不限于:索引地址信息、第一次写入数据的起始地址以及数据长度。
举例说明,如图4d所示,示例性的,主机将第一次写入数据以及生成的DIF0输出至存储控制器。示例性的,主机还向存储控制器输出第一次写入数据的数据信息(图中未示出)。
图5为示例性示出的存储设备端的处理流程示意图。请参照图5,具体包括:
S201,存储设备接收第一次写入数据和DIF0。
示例性的,存储控制器接收主机输入的第一写入指令,可获取到第一写入指令中包括的第一次写入数据、第一写入数据的数据信息以及DIF0。
举例说明,如图6a所示,示例性的,存储控制器接收到第一次写入数据以及DIF0,并可获取到对应的第一次写入数据的起始地址、数据长度以及索引地址信息。
S202,存储设备按照Sector粒度,对第一次写入数据进行解析,得到数据块D0。
示例性的,如上文所述,主机与存储控制器配置有相同的划分方式。相应的,在本步骤中,存储控制器可按照与主机相同的划分方式,得到数据块D0。
举例说明的,如图6b所示,示例性的,存储控制器按照Sector0,将第一次写入数据划分为数据块D0。具体划分方式可参照主机侧的处理,此处不再赘述。
S203,存储设备检测D0是否与Sector对齐。
示例性的,在本申请实施例中,存储控制器可将获取到的至少一个数据块中的每个数据块与对应的Sector进行比较。
一个示例中,若数据块的起始地址与Sector的起始地址相同,并且数据块长度与Sector的扇区长度相同,则存储控制器基于对应的DIF对该数据块进行校验,具体示例将在下面的实施例中说明。
另一个示例中,若数据块的起始地址与Sector的起始地址相同,而数据块的长度小于Sector的扇区长度。则存储控制器基于对应的DIF进行数据块校验,并等待下一次写入的数据。或者,存储控制器基于对应的DIF进行数据块校验后,将数据补齐,使得补齐后的数据块的数据长度等于扇区长度。
又一个示例中,若数据块的起始地址与Sector的起始地址不相同,且数据块的长度小于Sector的扇区长度。则存储控制器基于对应的DIF进行数据块校验,并等待下一次写入的数据。或者,存储控制器基于对应的DIF进行数据块校验后,将数据补齐,使得补齐后的数据块的数据长度等于扇区长度。或者,存储控制器对数据块进行合并校验,并等待下一次写入的数据。或者,存储控制器对数据块进行合并校验,并将数据补齐,使得补齐后的数据块的数据长度等于扇区长度。数据块的起始地址与Sector的起始地址不相同的实施例,将在下文中详细说明。
举例说明,请继续参照图6b,示例性的,D0的起始地址与Sector0的起始地址对齐(即相同),而D0的数据长度小于扇区长度,即可确定D0与Sector0未对齐,执行S204。
S204,基于DIF0对D0进行校验,并等待下一次写入的数据。
示例性的,存储控制器基于DIF0对D0进行校验,以检测主机向存储控制器传输的D0的完整性。
一个示例中,若D0校验失败,则存储控制器可向主机反馈失败信息。
另一个示例中,若D0校验成功,则等待下一次写入的数据。可选地,存储控制器将D0存储到缓存中。
图7为示例性示出的主机的处理流程示意图。请参照图7,具体包括:
S301,主机获取第二次写入的数据块D1、D2、D3。
示例性的,如上文所述,主机可将数据分多次写入至存储设备。如图8a所示,示例性的,主机可继续获取DataX中的数据,以通过第二次写入将数据存储至存储设备。示例性的,第二次写入的数据如图8a所示,其中,第二次写入数据的数据长度与第一次写入数据的数据长度可以相同,也可以不同,本申请不做限定。示例性的,第二次写入数据的起始地址与第一次写入数据的结尾地址相同,也就是说,第一次写入数据与第二次写入数据是连续的。
示例性的,主机按照预设划分方式,将第二次写入数据划分为至少一个数据块。举例说明,如图8b所示,示例性的,存储控制器以Sector粒度对第二次写入数据进行划分, 得到至少一个数据块,包括:D1、D2和D3。
仍参照图8b,示例性的,D1的起始地址与第一次写入数据的结尾地址相同,且D1的结尾地址与Sector0的结尾地址相同。
示例性的,D2的起始地址与D1的结尾地址相同,也可以理解为,D2的起始地址与Sector0的结尾地址相同,或者是,D2的起始地址与Sector1的起始地址相同。并且,D2的数据长度等于扇区长度。即,D2与Sector1对齐。
示例性的,D3的起始地址与D2的结尾地址相同,也可以理解为,D3的起始地址与Sector2的起始地址相同,或者,D3与Sector1的结尾地址相同。并且,D3的数据长度小于扇区长度。即,D3与Sector3未对齐。
S302,主机生成对应于D1的DIF1,对应于D2的DIF2,对应于D3的DIF3。
示例性的,如图8b所示,主机可基于D1,生成对应的DIF1。基于D2生成对应的DIF2,以及,基于D3生成对应的DIF3。
在一种可能的实现方式中,DIF1用于对D1进行完整性校验,DIF2用于对D2进行完整性校验,DIF3用于对D3进行完整性校验。
在另一种可能的实现方式中,如图8c所示,DFI1用于对D0和D1进行完整性校验,即,DIF1是基于D0和D1生成的。DIF2用于对D2进行完整性校验,DIF3用于对D3进行完整性校验。
需要说明的是,本申请实施例中的Sector0仅划分为D0和D1两个数据块,若Sector0包括更多的数据块,则每次生成的DIF用于对Sector0的起始地址对应的数据块至当前数据块进行完整性校验。举例说明,如图8d所示,若主机的第一次写入将Sector0划分为D0,第二次写入将Sector0划分为D1,当前第三次写入将Sector0划分为D2,则生成的DIF1用于对D0~D2进行完整性校验。
S303,主机将第二次写入数据与DIF1、DIF2、DIF3输出至存储设备。
示例性的,如图8e所示,示例性的,主机可选地向存储设备发送第二写入指令,写入指令包括但不限于:第二次写入数据、第二次写入数据的数据信息以及DIF1、DIF2、DIF3,主机将第二次写入数据和DIF1、DIF2、DIF3输出至存储控制器。可选地,DIF1~DIF3的长度相等,主机可将DIF1~DIF3按照顺序输出至存储控制器,以使得存储控制器可获取到DIF1~DIF3与数据块的对应关系。
示例性,第二次写入数据的数据信息包括但不限于:第二次写入数据的索引地址信息、第二次写入数据的起始地址以及第二次写入数据的数据长度。其中,第二次写入数据的索引地址信息与第一次写入数据的索引地址信息相同,第二次写入数据的起始地址与第一次写入数据的结尾地址相同。
图9为示例性示出的存储设备端的处理流程示意图。请参照图9,具体包括:
S401,存储设备接收第二次写入数据和DIF1、DIF2、DIF3。
示例性的,如图10a所示,存储控制器响应于接收到的第二写入指令,可获取到第二次写入数据、第二次写入数据的数据信息以及DIF1、DIF2、DIF3。
示例性的,存储控制器基于第二次写入数据的索引地址信息,可确定第二次写入数据与第一次写入数据的索引地址信息相同,即,第二次写入数据与第一次写入数据属于 同一个数据(即DataX)。并且,第二次写入数据的起始地址与第一次写入数据的结尾地址相同,即,第二次写入数据与第一次写入数据是连续数据。
S402,存储设备按照Sector粒度,对第二次写入数据进行解析,得到数据块D1、D2和D3。
示例性的,请参照图10b,存储控制器基于第二次写入数据的起始地址与第一次写入数据的结尾地址,将第一次写入数据与第二次写入数据拼接为连续数据。存储控制器可将第一次写入数据与第二次写入数据按照Sector粒度进行划分。
示例性的,存储控制器可按照Sector粒度,将第二次写入数据划分为至少一个数据块,包括:D1、D2、D3。其中,D1、D2、D3的描述可参照上文,此处不再赘述。
S403,存储设备检测D1、D2、D3是否与Sector对齐。
示例性的,如上文所述,基于数据块的不同,其后续的处理方式也不相同,下面结合D1~D3进行举例说明。
一个示例中,存储控制器检测D1与Sector是否对齐。示例性的,如图10b所示,D1的起始地址与Sector0的起始地址不相同,其数据长度与扇区长度也不相同,即,D1与Sector0未对齐。执行S405。
另一个示例中,存储控制器检测D2与Sector是否对齐。示例性的,如图10b所示,D2的起始地址与Sector1的起始地址相同,并且,D2的数据长度等于扇区长度,即,D2与Sector1对齐,执行S404。
又一个示例中,存储控制器检测D3与Sector是否对齐。示例性的,如图10b所示,D3的起始地址与Sector2的起始地址相同,而D3的数据长度小于扇区长度,即D3与Sector2未对齐,执行S405。
S404,存储设备基于数据块进行校验。
示例性的,如上文所述,D2与Sector对齐,则存储控制器可基于DIF2对D2进行校验,也可以理解为,由于D2与Sector对齐,该校验过程是以扇区粒度进行校验。
S405,存储设备将数据块与同一扇区内的数据块进行合并校验,或者,基于数据块进行校验。
示例性的,如上文所述,存储控制器对D0进行校验后,等待下一次写入数据。在本次写入操作时,存储控制器可基于D1的起始位置(即D1的起始位置在Sector0中)确定D1与D0属于同一个Sector,并且,D1的起始地址与D0的结尾地址相同,即D1与D0是连续的数据。
如上文所述,主机生成的DIF1的方式分为两种,一种为DIF1仅用于对D1进行校验。另一种为DIF1用于对Sector的起始位置至当前数据块之间的所有数据进行校验,如图8c或图8d所示。相应的,主机可以与存储控制器约定DIF的生成方式,以使得存储控制器可基于DIF对对应的数据块进行校验。
一个示例中,若主机与存储控制器约定DIF的校验方式是基于数据块粒度的校验,即,DIF1仅用于对D1进行校验。则,存储控制器可基于DIF1对D1进行校验。
另一个示例中,若主机与存储控制器约定的DIF的校验方式是合并校验方式,则,存储控制器可基于D1的起始地址,以及D0的起始地址和数据长度,确定D1与D0是 连续的数据,且属于同一个Sector(即Sector0)。并且,D0的起始地址与Sector0的起始地址相同。则,存储控制器可确定DIF1用于对D0和D1进行校验。相应的,存储控制器可基于DIF1,对D0和D1进行校验。
请继续参照图10b,示例性的,存储控制器检测到D3的起始地址与Sector2的起始地址相同,而D3的数据长度小于扇区长度,即,D3与Sector2未对齐。示例性的,存储控制器可基于数据块粒度,对D3进行校验,即,基于DIF3对D3进行校验,并执行S406,即等待下一次写入的数据。
S406,等待下一次写入的数据。
示例性的,D3与Sector未对齐,可等待下一次写入的数据,以确定是否存在与D3属于同一个Sector的数据。具体描述可参照S204,此处不再赘述。
图11为示例性示出的主机侧的处理流程示意图。请参照图11,具体包括:
S501,主机获取第三次写入的数据块D4。
示例性的,如图12a所示,主机可基于DataX,执行第三次写入过程。具体的,主机可获取第三次写入数据。其中,第三次写入数据的起始地址与第二次写入数据的结尾地址相同,并且,第三次写入数据的结尾地址为DataX的结尾地址。
S502,主机生成对应于D4的DIF4。
示例性的,如图12b所示,主机按照Sector粒度进行划分,获取到数据块D4。具体获取方式可参照上文,此处不再赘述。
示例性的,D4的起始地址与第二次写入数据的结尾地址相同。
示例性的,主机生成对应于D4的DIF4。一个示例中,DIF4可用于对D4进行校验。另一个示例中,DIF4可用于对D4和D3进行校验。具体细节可参照D1的描述,此处不再赘述。
S503,主机将第三次写入数据与DIF4输出至存储设备。
示例性,主机向存储控制器输出第三写入指令。示例性的,第三写入指令包括但不限于:第三次写入数据、第三次写入数据的数据信息以及DIF4。示例性的,第三次写入数据的数据信息包括但不限于:第三次写入数据的索引地址信息、第三次写入数据的起始地址以及第三次写入数据的数据长度。其中,第三次写入数据的索引地址与第一次写入数据的索引地址信息和第二次写入数据的索引地址信息相同。并且,第三次写入数据的起始地址与第二次写入数据的结尾地址相同。
图13为示例性示出的存储设备端的处理流程示意图。请参照图13,具体包括:
S601,存储设备接收第三次写入数据和DIF4。
示例性的,存储控制器接收到第三写入指令,并获取到第三次写入数据、第三次写入数据的数据信息以及DIF4。
S602,存储设备按照Sector粒度,对第三次写入数据进行解析,得到数据块D4。
示例性的,如图14所示,存储控制器可按照Sector粒度,获取到数据块D4。具体划分方式可参照上文,此处不再赘述。示例性的,D4的起始地址与D3的结尾地址相同。
S603,存储设备检测D4是否与Sector对齐。
示例性的,仍参照图14,D4的起始地址与Sector2的起始地址不同,且D4的长度与Sector2的扇区长度也不相同,即,D4与Sector3未对齐。
S604,存储设备将数据块与同一扇区内的数据块进行合并校验,或者,基于数据块进行校验。
示例性的,如上文所述,存储控制器可按照与主机约定的方式,对D4进行校验。一个示例中,存储控制器可基于DIF4,对D4进行校验。另一个示例中,存储控制器可基于DIF4,对D3和D4进行校验。具体细节与D1的处理类似,此处不再赘述。
S605,存储设备等待设定的时长后,补充空数据,并将Data写入对应的Sector。
示例性的,存储控制器可等待下一次写入指令。一个示例中,若下一次写入指令中指示的数据的索引地址信息与第三次写入数据(或第一次数据、第二次写入数据)的索引地址信息不相同,则存储控制器将Sector数据补齐。例如,如图14所示,存储控制器按照Sector2的起始地址和扇区长度,将在D4的末尾补充空数据(可以称为无效数据)。
另一个示例中,存储控制器等待设定的时长后,若未接收到主机发送的写入指令,则存储控制器将Sector数据补齐,如图14所示。
示例性的,如图15所示,存储控制器可按照Sector粒度,将数据存储至存储介质。示例性的,存储控制器基于D0和D1的起始地址和数据长度,确定D0和D1合并后的数据长度等于扇区长度。示例性的,存储控制器将D0和D1存储至存储介质中的Sector0。其中,D0的起始地址与Sector0的起始地址相同,D0和D1合并后的数据长度等于扇区长度。
仍参照图15,示例性的,存储控制器基于D2的起始地址与数据长度,确定D2的数据长度等于扇区长度。示例性的,存储控制器将D2存储至存储介质中的Sector1。其中,D2的起始地址与Sector1的起始地址相同,并且,D2的数据长度等于扇区长度。
请继续参照图15,示例性的,存储控制器基于D3和D4以及补充后的空数据的总长度,将D3和D4以及空数据存储至Sector2。其中,D3的起始地址与Sector2的起始地址相同,并且,D3、D4以及空数据的总长度等于扇区长度。
在一种可能的实现方式中,如上文所述,存储控制器的校验方式分为以数据块为粒度的校验,和,以Sector为粒度的校验(即上文所述的合并校验方式)。因此,在存储时,基于不同的校验方式,DIF的存储也不相同。
一个示例中,若存储控制器是基于数据块为粒度的校验。则,存储介质存储各数据块对应的DIF,包括:DIF0、DIF1、DIF2、DIF3以及DIF4。
另一个示例中,若存储控制器是基于数据块为粒度的校验。则,存储介质可基于存储后的各扇区数据,生成对应的DIF。例如,存储控制器可基于Sector0的扇区数据,即包括D0和D1,生成新的DIF,例如DIF1’,并基于D3和D4生成新的DIF,例如DIF3’。示例性的,存储介质存储的DIF包括:DIF1’、DIF2以及DIF3’。
又一个示例中,若存储控制器是基于Sector为粒度的校验。则,存储介质存储的DIF包括:DIF1、DIF2和DIF4。
可选地,DIF可与对应的数据块存储至相同的扇区。可选地,DIF也可以单独存储至其它区域,本申请不做限定。
本申请实施例还提供一种字节级的读取方式,其中,本申请实施例中的读取方式支持E2E校验。下面结合具体实施例,对本申请实施例中的读取方式进行详细说明。
图16为示例性示出的存储设备的处理方式流程图。请参照图16,具体包括:
S701,存储设备接收主机输入的第一读取指令。
示例性的,主机可响应于接收到的用户指令,确定需要读取的数据。并向存储控制器输出第一读取指令。示例性的,第一读取指令包括但不限于:待读取数据的起始地址、数据长度L以及索引地址信息。
S702,存储设备基于第一读取指令,查找待读取数据。
示例性的,存储控制器响应于接收到的第一读取指令,可基于获取到的待读取数据的索引地址信息,查找到对应的Sector。并进一步基于待读取数据的起始地址与数据长度L,查找到待读取数据。
举例说明,如图17a所示,示例性的,存储控制器基于索引地址信息以及待读取数据的起始地址和数据长度L,查找到待读取数据。其中,待读取数据覆盖Sector0、Sector1和Sector2。
S703,存储设备按照Sector粒度,将待读取数据划分为至少一个数据块。
示例性的,如图17b所示,存储控制器可将待读取数据,按照Sector粒度划分为多个数据块。包括:Dx、Dy和Dz。
示例性的,Dx的起始地址与待读取数据的起始地址相同,Dx的结尾地址与Sector0的结尾地址相同。
示例性的,Dy的起始地址与Sector1的起始地址相同,Dy的结尾地址与Sector1的结尾地址相同。
示例性的,Dz的起始地址与Sector2的起始地址相同,Dz的结尾地址与待读取数据的结尾地址相同。
S704,存储设备对各数据块所属Sector中的数据进行校验。
示例性的,存储控制器以Sector为粒度进行校验。举例说明,如图17b所示,Dx属于Sector0,存储控制器对Sector0中的全部数据进行校验。Dy属于Sector1,存储控制器对Sector1中的全部数据进行校验。Dz属于Sector2,存储控制器对Sector2中的全部数据进行校验。示例性的,存储控制器可基于Sector0对应的DIF1,对Sector0中的全部数据进行校验。并基于Sector1对应的DIF2对Sector1中的全部数据进行校验。以及,基于Sector2对应的DIF4对Sector2中的全部数据进行校验。
在一种可能的实现方式中,如上文所述,存储控制器在存储数据时,由于其校验方式不同,其存储方式也不相同。例如,如上文所述,存储介质存储有D0以及D0对应的DIF0,和D1对应的DIF1。示例性的,存储控制器可以数据块为粒度进行校验。例如,存储控制器基于Dx的起始地址和数据长度,以及D1的起始地址和数据长度,确定Dx包含于D1,即Dx的起始地址在D1内,且Dx的数据长度小于或等于D1的数据长度。则,存储控制器可基于DIF1对D1进行校验,而无需对Sector0进行校验。当然,若Dx覆盖D0和D1,则可基于DIF1对D1进行校验,并基于DIF0对D0进行校验。
一个示例中,若上述任一数据块或Sector校验失败,则存储控制器向主机返回读取失败消息。
另一个示例中,若全部数据块或Sector校验成功,则执行S705。
S705,存储设备将数据块和对应的DIF输出至主机。
示例性的,在本申请实施例中,存储控制器以字节为粒度,将待读取数据输出至主机。具体的,存储控制器检测各数据块是否与Sector对齐。一个示例中,对于未与Sector对齐的数据块,存储控制器可基于数据块生成对应的DIF,并将数据块以及对应的DIF输出至主机。另一个示例中,若数据块与Sector对齐,则存储控制器将该数据块(即Sector内的数据)以及Sector对应的DIF输出至主机。
举例说明,仍参照图17b,示例性的,Dx的起始地址与Sector0的起始地址不同,且Dx的数据长度与Sector0的扇区长度不同,即,Dx与Sector0未对齐。示例性的,存储控制器可基于Dx,生成DIF,记为DIFx。
示例性的,Dy的起始地址与Sector1的起始地址相同,且Dy的数据长度与Sector1的数据长度相同。即,Dy与Sector1对齐。示例性的,Dy对应的DIF,即为Sector1对应的DIF(即DIF2)。
示例性的,Dx的起始地址与Sector2的起始地址相同,而Dx的数据长度小于Sector2的扇区长度。即,Dz与Sector2未对齐。示例性的,存储控制器可基于Dz,生成DIF,记为DIFz。
示例性的,存储控制器可将待读取数据以及DIFx、DIF2和DIFz输出至主机。可以理解为,数据块的划分为逻辑处理,仅为生成对应的DIF,其原理与写入时类似,存储控制器输出的是待读取数据,而非划分后的数据块。
相应的,主机接收到待读取数据后,可按照图17b的划分方式,将待读取数据进行划分,以获取Dx、Dy以及Dz。并可基于DIFx对Dx进行校验。基于DIF2,对Dy进行校验。以及,基于DIFz,对Dz进行校验。一个示例中,若校验成功,则主机可对待读取数据进行后续的处理。另一个示例中,若校验失败,则主机再次从存储控制设备读取待读取数据。需要说明的是,主机侧的具体细节可参照上文存储设备侧的相关内容,此处不再赘述。
上述主要从各个网元之间交互的角度对本申请实施例提供的方案进行了介绍。可以理解的是,存储设备为了实现上述功能,其包含了执行各个功能相应的硬件结构和/或软件模块。本领域技术人员应该很容易意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,本申请实施例能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
本申请实施例可以根据上述方法示例对存储设备进行功能模块的划分,例如,可以对应各个功能划分各个功能模块,也可以将两个或两个以上的功能集成在一个处理模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。 需要说明的是,本申请实施例中对模块的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
图18示出了本申请实施例的一种电子设备1800的示意性框图。电子设备可以包括:处理器1801和收发器/收发管脚1802,可选地,还包括存储器1803。该处理器1801可用于执行前述的实施例的各方法中的处理器和存储器所执行的步骤,并控制接收管脚接收信号,以及控制发送管脚发送信号。
电子设备1800的各个组件通过总线1804耦合在一起,其中总线系统1804除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。但是为了清楚说明起见,在图中将各种总线都标为总线系统1804。
可选地,存储器1803可以用于前述方法实施例中的存储指令。
应理解,电子设备1800中的各个元件的上述和其它管理操作和/或功能分别为了实现前述各个方法的相应步骤,为了简洁,在此不再赘述。
其中,上述方法实施例涉及的各步骤的所有相关内容均可以援引到对应功能模块的功能描述,在此不再赘述。
其中,上述方法实施例涉及的各步骤的所有相关内容均可以援引到对应功能模块的功能描述,在此不再赘述。
基于相同的技术构思,本申请实施例还提供一种计算机可读存储介质,该计算机可读存储介质存储有计算机程序,该计算机程序包含至少一段代码,该至少一段代码可由电子设备执行,以控制电子设备用以实现上述方法实施例。
基于相同的技术构思,本申请实施例还提供一种计算机程序,当该计算机程序被电子设备执行时,用以实现上述方法实施例。
所述程序可以全部或者部分存储在与处理器封装在一起的存储介质上,也可以部分或者全部存储在不与处理器封装在一起的存储器上。
基于相同的技术构思,本申请实施例还提供一种处理器,该处理器用以实现上述方法实施例。上述处理器可以为芯片。
结合本申请实施例公开内容所描述的方法或者算法的步骤可以硬件的方式来实现,也可以是由处理器执行软件指令的方式来实现。软件指令可以由相应的软件模块组成,软件模块可以被存放于随机存取存储器(Random Access Memory,RAM)、闪存、只读存储器(Read Only Memory,ROM)、可擦除可编程只读存储器(Erasable Programmable ROM,EPROM)、电可擦可编程只读存储器(Electrically EPROM,EEPROM)、寄存器、硬盘、移动硬盘、只读光盘(CD-ROM)或者本领域熟知的任何其它形式的存储介质中。一种示例性的存储介质耦合至处理器,从而使处理器能够从该存储介质读取信息,且可向该存储介质写入信息。当然,存储介质也可以是处理器的组成部分。处理器和存储介质可以位于ASIC中。另外,该ASIC可以位于网络设备中。当然,处理器和存储介质也可以作为分立组件存在于网络设备中。
本领域技术人员应该可以意识到,在上述一个或多个示例中,本申请实施例所描述的功能可以用硬件、软件、固件或它们的任意组合来实现。当使用软件实现时,可以将这些功能存储在计算机可读介质中或者作为计算机可读介质上的一个或多个指令或代码 进行传输。计算机可读介质包括计算机存储介质和通信介质,其中通信介质包括便于从一个地方向另一个地方传送计算机程序的任何介质。存储介质可以是通用或专用计算机能够存取的任何可用介质。
上面结合附图对本申请的实施例进行了描述,但是本申请并不局限于上述的具体实施方式,上述的具体实施方式仅仅是示意性的,而不是限制性的,本领域的普通技术人员在本申请的启示下,在不脱离本申请宗旨和权利要求所保护的范围情况下,还可做出很多形式,均属于本申请的保护之内。
上面结合附图对本申请的实施例进行了描述,但是本申请并不局限于上述的具体实施方式,上述的具体实施方式仅仅是示意性的,而不是限制性的,本领域的普通技术人员在本申请的启示下,在不脱离本申请宗旨和权利要求所保护的范围情况下,还可做出很多形式,均属于本申请的保护之内。

Claims (24)

  1. 一种存储方法,其特征在于,包括:
    存储控制器接收第一写入指令,所述第一写入指令包括:第一数据、第一数据信息和至少一个校验信息;其中,所述第一数据信息指示了所述第一数据的起始地址以及所述第一数据的长度;
    所述存储控制器基于所述至少一个校验信息,对所述第一数据中与每个校验信息对应的数据块分别进行校验;所述第一数据中存在至少一个长度小于扇区长度的数据块,所述扇区长度为耦合至所述存储控制器的存储介质中的扇区的长度;
    在所述第一数据中的所有数据块校验成功的情形下,所述存储控制器基于所述第一数据信息,将所述第一数据中写入所述存储介质中。
  2. 根据权利要求1所述的方法,其特征在于,所述基于所述至少一个校验信息,对所述第一数据中与每个校验信息对应的数据块分别进行校验,包括:
    所述存储控制器将所述第一数据划分为至少一个数据块,其中每个数据块分别与一个校验信息一一对应;
    所述存储控制器基于所述至少一个校验信息,对所述至少一个数据块进行校验。
  3. 根据权利要求2所述的方法,其特征在于,所述将所述第一数据划分为所述至少一个数据块,包括:
    所述存储控制器根据扇区的起始地址和扇区长度,将所述第一数据划分为所述至少一个数据块;其中,所述至少一个数据块中的单一数据块的起始地址与扇区的起始地址相同或不同。
  4. 根据权利要求3所述的方法,其特征在于,所述基于所述至少一个校验信息,对所述第一数据中与每个校验信息对应的数据块分别进行校验,包括:
    当单一数据块的起始地址与所述扇区的起始地址相同,且所述单一数据块的长度等于所述扇区长度,所述存储控制器基于所述单一数据块对应的目标校验信息,对所述单一数据块进行校验;其中,所述目标校验信息属于所述至少一个校验信息。
  5. 根据权利要求3所述的方法,其特征在于,所述基于所述至少一个校验信息,对所述第一数据中与每个校验信息对应的数据块分别进行校验,包括:
    当单一数据块的起始地址与所述扇区的起始地址不相同,和/或,所述单一数据块的长度小于所述扇区长度,所述存储控制器基于所述单一数据块对应的目标校验信息,对所述单一数据块进行校验;其中,所述目标校验信息属于所述至少一个校验信息。
  6. 根据权利要求3所述的方法,其特征在于,所述基于所述至少一个校验信息,对所述第一数据中与每个校验信息对应的数据块分别进行校验,包括:
    当单一数据块的起始地址与所述扇区的起始地址不相同,和/或,所述单一数据块的长度小于所述扇区长度,所述存储控制器将所述单一数据块与前一次接收到的数据块或者下一次接收到的数据块合并;其中,所述前一次接收到的数据块的结尾地址与所述单一数据块的起始地址相同,且所述前一次接收到的数块的起始地址与所述扇区的起始地址相同;或者,所述下一次接收到的数据块的起始地址与所述单一数据块的结尾地址相同,且所述下一次接收到的数据块的结尾地址与所述扇区的结尾地址相同;并且,合并后的数据块的起始地址与所述扇区的起始地址相同,且所述合并后的数据块的长度等于所述扇区长度;
    所述存储控制器基于所述合并后的数据块对应的目标校验信息,对所述合并后的数据块进行校验;其中,所述目标校验信息属于所述至少一个校验信息。
  7. 一种存储方法,其特征在于,包括:
    存储控制器接收第一读取指令,所述第一读取指令包括第一地址信息和第一长度信息,所述第一地址信息用于指示需要读取的第一数据的起始地址,所述第一长度信息用于指示所述第一数据的长度;其中,所述第一数据位于耦合至所述存储控制器的存储介质中的至少一个扇区;
    所述存储控制器响应于接收到的所述第一读取指令,基于所述至少一个扇区对应的校验信息,对所述至少一个扇区中的数据进行校验;
    当所述至少一个扇区中的数据校验成功,所述存储控制器将所述第一数据中的至少一个数据块与对应的至少一个校验信息输出至第一设备;其中,若所述至少一个数据块中的单一数据块的长度等于所述扇区的扇区长度,所述单一数据块对应的校验信息为所述单一数据块所属扇区对应的校验信息;若所述单一数据块的长度小于所述扇区长度,所述单一数据块对应的校验信息为基于所述单一数据块生成的。
  8. 根据权利要求7所述的方法,其特征在于,所述基于所述至少一个扇区对应的校验信息,对所述至少一个扇区中的数据进行校验,包括:
    所述存储控制器响应于接收到的所述第一读取指令,根据扇区的起始地址和扇区长度,将所述第一数据划分为所述至少一个数据块;其中,所述至少一个数据块中的单一数据块的起始地址与扇区的起始地址相同或不同;
    所述存储控制器基于所述单一数据块所属扇区对应的校验信息,对所述单一数据块所属扇区进行校验。
  9. 根据权利要求8所述的方法,其特征在于,所述当所述至少一个扇区中的数据校验成功,将所述第一数据中的至少一个数据块与对应的至少一个校验信息输出至第一设备,包括:
    当对所述单一数据块所属扇区校验成功,且所述单一数据块的长度等于所述扇区长度,所述存储控制器将所述单一数据块和所述单一数据块所属扇区对应的校验信息输出至所述第一设备。
  10. 根据权利要求8所述的方法,其特征在于,所述当所述至少一个扇区中的数据校验成功,将所述第一数据中的至少一个数据块与对应的至少一个校验信息输出至第一设备,包括:
    当对所述单一数据块所属扇区校验成功,且所述第一数据块的长度小于所述扇区长度,所述存储控制器基于所述单一数据块生成校验信息,并将所述单一数据块与生成的校验信息输出至所述第一设备。
  11. 一种存储控制器,其特征在于,包括:处理器以及接口电路,所述处理器通过所述接口电路耦合至存储介质;
    所述处理器,用于:
    接收第一写入指令,所述第一写入指令包括:第一数据、第一数据信息和至少一个校验信息;其中,所述第一数据信息指示了所述第一数据的起始地址以及所述第一数据的长度;
    基于所述至少一个校验信息,对所述第一数据中与每个校验信息对应的数据块分别进行校验;所述第一数据中存在至少一个长度小于扇区长度的数据块,所述扇区长度为耦合至所述存储控制器的存储介质中的扇区的长度;
    在所述第一数据中的所有数据块校验成功的情形下,基于所述第一数据信息,将所述第一数据中写入所述存储介质中。
  12. 根据权利要求11所述的存储控制器,其特征在于,所述处理器,具体用于:
    将所述第一数据划分为至少一个数据块,其中每个数据块分别与一个校验信息一一对应;
    基于所述至少一个校验信息,对所述至少一个数据块进行校验。
  13. 根据权利要求12所述的存储控制器,其特征在于,所述处理器,具体用于:
    根据扇区的起始地址和扇区长度,将所述第一数据划分为所述至少一个数据块;其中,所述至少一个数据块中的单一数据块的起始地址与扇区的起始地址相同或不同。
  14. 根据权利要求13所述的存储控制器,其特征在于,所述处理器,具体用于:
    当单一数据块的起始地址与所述扇区的起始地址相同,且所述单一数据块的长度等于所述扇区长度,基于所述单一数据块对应的目标校验信息,对所述单一数据块进行校验;其中,所述目标校验信息属于所述至少一个校验信息。
  15. 根据权利要求13所述的存储控制器,其特征在于,所述处理器,具体用于:
    当单一数据块的起始地址与所述扇区的起始地址不相同,和/或,所述单一数据块的长度小于所述扇区长度,基于所述单一数据块对应的目标校验信息,对所述单一数据块进行校验;其中,所述目标校验信息属于所述至少一个校验信息。
  16. 根据权利要求13所述的存储控制器,其特征在于,所述处理器,具体用于:
    当单一数据块的起始地址与所述扇区的起始地址不相同,和/或,所述单一数据块的长度小于所述扇区长度,将所述单一数据块与前一次接收到的数据块或者下一次接收到的数据块合并;其中,所述前一次接收到的数据块的结尾地址与所述单一数据块的起始地址相同,且所述前一次接收到的数块的起始地址与所述扇区的起始地址相同;或者,所述下一次接收到的数据块的起始地址与所述单一数据块的结尾地址相同,且所述下一次接收到的数据块的结尾地址与所述扇区的结尾地址相同;并且,合并后的数据块的起始地址与所述扇区的起始地址相同,且所述合并后的数据块的长度等于所述扇区长度;
    基于所述合并后的数据块对应的目标校验信息,对所述合并后的数据块进行校验;其中,所述目标校验信息属于所述至少一个校验信息。
  17. 一种存储控制器,其特征在于,包括:处理器以及接口电路,所述处理器通过所述接口电路耦合至存储介质;
    所述处理器,用于:
    接收第一读取指令,所述第一读取指令包括第一地址信息和第一长度信息,所述第一地址信息用于指示需要读取的第一数据的起始地址,所述第一长度信息用于指示所述第一数据的长度;其中,所述第一数据位于所述存储介质中的至少一个扇区;
    响应于接收到的所述第一读取指令,基于所述至少一个扇区对应的校验信息,对所述至少一个扇区中的数据进行校验;
    当所述至少一个扇区中的数据校验成功,将所述第一数据中的至少一个数据块与对应的至少一个校验信息输出至第一设备;其中,若所述至少一个数据块中的单一数据块的长度等于所述扇区的扇区长度,所述单一数据块对应的校验信息为所述单一数据块所属扇区对应的校验信息;若所述单一数据块的长度小于所述扇区长度,所述单一数据块对应的校验信息为基于所述单一数据块生成的。
  18. 根据权利要求17所述的存储控制器,其特征在于,所述处理器,具体用于:
    响应于接收到的所述第一读取指令,根据扇区的起始地址和扇区长度,将所述第一数据划分为所述至少一个数据块;其中,所述至少一个数据块中的单一数据块的起始地址与扇区的起始地址相同或不同;
    基于所述单一数据块所属扇区对应的校验信息,对所述单一数据块所属扇区进行校验。
  19. 根据权利要求18所述的存储控制器,其特征在于,所述处理器,具体用于:
    当对所述单一数据块所属扇区校验成功,且所述单一数据块的长度等于所述扇区长度,将所述单一数据块和所述单一数据块所属扇区对应的校验信息输出至所述第一存储控制器。
  20. 根据权利要求18所述的存储控制器,其特征在于,所述处理器,具体用于:
    当对所述单一数据块所属扇区校验成功,且所述第一数据块的长度小于所述扇区长度,基于所述单一数据块生成校验信息,并将所述单一数据块与生成的校验信息输出至所述第一设备。
  21. 一种计算机可读存储介质,其特征在于,包括计算机程序,其特征在于,当所述计算机程序在电子设备上运行时,使得所述电子设备执行如权利要求1-6中任意一项所述的存储方法。
  22. 一种计算机可读存储介质,其特征在于,包括计算机程序,其特征在于,当所述计算机程序在电子设备上运行时,使得所述电子设备执行如权利要求7-10中任意一项所述的存储方法。
  23. 一种存储设备,其特征在于,包括如权利要求11至16所述的存储控制器和存储介质。
  24. 一种存储设备,其特征在于,包括如权利要求17至20所述的存储控制器和存储介质。
PCT/CN2021/084068 2021-03-30 2021-03-30 存储方法及存储控制器 WO2022204971A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2021/084068 WO2022204971A1 (zh) 2021-03-30 2021-03-30 存储方法及存储控制器
CN202180091008.1A CN116802599A (zh) 2021-03-30 2021-03-30 存储方法及存储控制器

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2021/084068 WO2022204971A1 (zh) 2021-03-30 2021-03-30 存储方法及存储控制器

Publications (1)

Publication Number Publication Date
WO2022204971A1 true WO2022204971A1 (zh) 2022-10-06

Family

ID=83455404

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/084068 WO2022204971A1 (zh) 2021-03-30 2021-03-30 存储方法及存储控制器

Country Status (2)

Country Link
CN (1) CN116802599A (zh)
WO (1) WO2022204971A1 (zh)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101086724A (zh) * 2006-06-07 2007-12-12 普天信息技术研究院 存储卡可变长多块数据传输方法
US8006027B1 (en) * 2008-09-11 2011-08-23 Western Digital Technologies, Inc. Method of staging small writes on a large sector disk drive
CN105528183A (zh) * 2016-01-26 2016-04-27 华为技术有限公司 一种存储数据的方法及存储设备
CN110956284A (zh) * 2019-11-15 2020-04-03 苏州浪潮智能科技有限公司 一种产品信息的可靠性维护方法、系统、设备及存储介质
CN111158948A (zh) * 2019-12-30 2020-05-15 深信服科技股份有限公司 基于去重的数据存储与校验方法、装置及存储介质
CN111273862A (zh) * 2020-01-16 2020-06-12 上海依图网络科技有限公司 数据存储方法及其装置、可读介质和系统
CN112083880A (zh) * 2020-08-20 2020-12-15 厦门市美亚柏科信息安全研究所有限公司 一种手机系统文件在线修改方法、装置及存储介质

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101086724A (zh) * 2006-06-07 2007-12-12 普天信息技术研究院 存储卡可变长多块数据传输方法
US8006027B1 (en) * 2008-09-11 2011-08-23 Western Digital Technologies, Inc. Method of staging small writes on a large sector disk drive
CN105528183A (zh) * 2016-01-26 2016-04-27 华为技术有限公司 一种存储数据的方法及存储设备
CN110956284A (zh) * 2019-11-15 2020-04-03 苏州浪潮智能科技有限公司 一种产品信息的可靠性维护方法、系统、设备及存储介质
CN111158948A (zh) * 2019-12-30 2020-05-15 深信服科技股份有限公司 基于去重的数据存储与校验方法、装置及存储介质
CN111273862A (zh) * 2020-01-16 2020-06-12 上海依图网络科技有限公司 数据存储方法及其装置、可读介质和系统
CN112083880A (zh) * 2020-08-20 2020-12-15 厦门市美亚柏科信息安全研究所有限公司 一种手机系统文件在线修改方法、装置及存储介质

Also Published As

Publication number Publication date
CN116802599A (zh) 2023-09-22

Similar Documents

Publication Publication Date Title
US7036066B2 (en) Error detection using data block mapping
TWI514139B (zh) 實體頁、邏輯頁及碼字對應
EP2811392B1 (en) Method and device for reducing read delay
US20090113235A1 (en) Raid with redundant parity
TWI396202B (zh) 錯誤校正控制器及其快閃記憶體晶片系統與錯誤校正方法
US9411537B2 (en) Embedded multimedia card (EMMC), EMMC system including the EMMC, and method of operating the EMMC
JP5464528B2 (ja) 同時読み出し及び書き込みメモリ動作を実行する方法及び装置
CN112513804B (zh) 一种数据处理方法及装置
JP2004280556A (ja) 情報記憶装置および情報処理システム
US8301981B2 (en) Data access method for flash memory and storage system and controller thereof
US20080072119A1 (en) Allowable bit errors per sector in memory devices
CN111538460A (zh) Raid功能实现方法及相关装置
KR20210039171A (ko) 메모리 시스템을 포함하는 데이터 처리 시스템에서 동작 정보를 송수신하는 방법 및 장치
US7552249B2 (en) Direct memory access circuit and disk array device using same
US7921265B2 (en) Data access method, channel adapter, and data access control device
US11101822B1 (en) Data writing method, memory control circuit unit and memory storage apparatus
WO2021088368A1 (zh) 一种存储器的修复方法及装置
JP2009199266A (ja) データ転送制御装置、データ整合性判定方法及び記憶制御装置
CN114579163A (zh) 一种磁盘固件升级方法、计算装置及系统
WO2022204971A1 (zh) 存储方法及存储控制器
CN111913668A (zh) 一种ip复用下检纠查存储器数据准确性的方法
CN112905107A (zh) 数据存储装置及其操作方法
US9367393B2 (en) Storage control apparatus and storage control method
CN115129509A (zh) 一种数据传输方法、装置、介质
US20120166686A1 (en) Method, apparatus and system for aggregating interrupts of a data transfer

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

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 202180091008.1

Country of ref document: CN

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21933653

Country of ref document: EP

Kind code of ref document: A1