Data writing method, controller, medium, and product
By using batch writing and preset time interval querying, the problem of NAND flash memory write failure was solved, ensuring that data is not lost and achieving reliable data storage.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-05
- Publication Date
- 2026-03-27
AI Technical Summary
NAND flash memory experienced write failures during use, resulting in data not being stored effectively.
A batch write method is adopted, which queries the write status at preset time intervals and requests new storage units when the write status fails, until all batches of write status are successful, ensuring that the data can be rewritten.
This achieves the goal of preventing data loss and ensuring that data can be successfully written to NAND flash memory without compromising write performance.
Smart Images

Figure CN121455863B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data processing, in particular to a data writing method, a controller, a medium and a product. BACKGROUND
[0002] In the related art, NAND flash memory will face the problem of adding new bad blocks in actual use. Specifically, some blocks in the NAND flash memory will fail to write. Once such a problem occurs, the corresponding block cannot be re-written after erasing, and the data already written into the NAND flash memory cannot be normally programmed, thereby causing the data to be unable to be effectively stored. SUMMARY
[0003] The present application aims to at least solve one of the technical problems existing in the prior art. To this end, the present application provides a data writing method, a controller, a medium and a product, which aims to process the write failure problem of the NAND flash memory and ensure that the data is not lost.
[0004] In a first aspect, the embodiments of the present application provide a data writing method, which comprises:
[0005] obtaining data to be written;
[0006] writing the data in batches according to a preset storage unit to a storage medium, the preset storage unit being a preset writing unit in the storage medium;
[0007] querying a write state of a target batch of data writing at a preset time interval;
[0008] when the write state is successful, continuing to write the data in batches according to the preset storage unit to the storage medium;
[0009] when the write state is failed, applying for a new storage unit and writing the data in batches according to the storage unit to the storage medium until the write state of all batches of data writing is successful.
[0010] According to some embodiments of the present application, the preset storage unit comprises an SLC super block, a TLC super block and a GC super block, and the querying of the write state of the target batch of data writing at the preset time interval comprises:
[0011] for the SLC super block, the write state of the target batch is queried before a first preset number of batches of data writing are written after the data writing of the target batch;
[0012] for the TLC super block, the write state of the target batch is queried before a second preset number of batches of data writing are written after the data writing of the target batch;
[0013] For the GC super block, after the data of the target batch is written, the write state of the target batch is queried before a third preset number of data batches are written;
[0014] The first preset number and the second preset number are both greater than or equal to 1, and the third preset number is greater than or equal to 0.
[0015] According to some embodiments of the present application, for the SLC super block, when the write state is failed, a new storage unit is applied, and the data is written into the storage medium in batches according to the storage unit, including:
[0016] When the write state is failed, the write state of a first preset number of data batches after the data of the target batch is written is obtained.
[0017] When the data write state is a completion state, a new first storage unit is applied, and the data of the successfully written batch, the completion written batch, and the target batch are recycled to write all the data into the storage medium in batches according to the first storage unit, wherein the first storage unit is a new SLC super block.
[0018] According to some embodiments of the present application, for the TLC super block, when the write state is failed, a new storage unit is applied, and the data is written into the storage medium in batches according to the storage unit, including:
[0019] When the write state is failed, the write state of a second preset number of data batches after the data of the target batch is written is obtained.
[0020] When the write state is a completion state, a new second storage unit is applied, and the data of the target batch with the failed write state is restored to write the data of the target batch with the failed write state into the storage medium according to the second storage unit, wherein the second storage unit is a new TLC super block.
[0021] According to some embodiments of the present application, for the GC super block, when the write state is failed, a new storage unit is applied, and the data is written into the storage medium in batches according to the storage unit, including:
[0022] When the write state is failed, a new third storage unit is applied.
[0023] The data of the successfully written batch and the target batch are recycled to write all the data into the storage medium in batches according to the third storage unit, wherein the third storage unit is a new GC super block.
[0024] According to some embodiments of the present application, the writing the data into the storage medium in batches according to the preset storage unit comprises:
[0025] calculating the data in each batch to obtain redundancy check data;
[0026] writing the redundancy check data and the data in each batch into the storage medium in batches according to the preset storage unit.
[0027] According to some embodiments of the present application, the recovering the data in the target batch with the failed writing state comprises:
[0028] obtaining a cache space, reading the data other than the target batch with the failed writing state and the redundancy check data, and storing them into the cache space;
[0029] performing reverse calculation on the read data and the redundancy check data to obtain the data in the target batch, and caching them into the cache space.
[0030] In a second aspect, the embodiments of the present application provide a controller, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the data writing method in the first aspect.
[0031] In a third aspect, the embodiments of the present application provide a computer readable storage medium, which stores computer executable instructions, and the computer executable instructions are used to perform the data writing method in the first aspect.
[0032] In a fourth aspect, the embodiments of the present application provide a computer program product, comprising a computer program or computer instructions, characterized in that the computer program or the computer instructions are stored in a computer readable storage medium, a processor of a computer device reads the computer program or the computer instructions from the computer readable storage medium, and the processor executes the computer program or the computer instructions, so that the computer device performs the data writing method in the first aspect.
[0033] According to the technical scheme of the embodiment of the application, at least the following beneficial effects are achieved: the application provides a data writing method, a controller, a medium and a product, which are applied to the technical field of data processing, and the method comprises the following steps: obtaining data to be written; writing the data to a storage medium in batches according to preset storage units, wherein the preset storage unit is a preset writing unit in the storage medium; querying a writing state of a data writing target batch according to a preset time interval; when the writing state is successful, continuing to write the data to the storage medium in batches according to the preset storage units; when the writing state is failed, applying for a new storage unit, and writing the data to the storage medium in batches according to the storage unit until the writing state of all batches of data is successful. In the case that the writing state is failed, the application can apply for a new storage unit, and write the data to the storage medium in batches according to the storage unit until the writing state of all batches of data is successful, so that the failed data can be re-written, and the data loss is avoided.
[0034] Additional aspects and advantages of the application will be set forth in part in the description which follows, and in part will become apparent to those skilled in the art upon examination of the following and / or can be learned by practice of the application. BRIEF DESCRIPTION OF DRAWINGS
[0035] The accompanying drawings are included to provide a further understanding of the technical scheme of the application, and constitute a part of the specification, and are used together with the embodiments of the application to explain the technical scheme of the application, and do not constitute a limitation on the technical scheme of the application.
[0036] Figure 1 is a flowchart of the data writing method provided by one embodiment of the application;
[0037] Figure 2 is Figure 1 is a flowchart of one sub-step of step S130 shown in
[0038] Figure 3 is Figure 1 is a flowchart of one sub-step of step S150 shown in
[0039] Figure 4 is Figure 1 is another flowchart of step S130 shown in
[0040] Figure 5 is Figure 1 is another flowchart of step S150 shown in
[0041] Figure 6 is Figure 1 is a flowchart of one sub-step of step S120 shown in
[0042] Figure 7 is Figure 5 is a flowchart of one sub-step of step S520 shown in
[0043] Figure 8 is Figure 1 another sub-step flowchart of step S130 shown in FIG. 13;
[0044] Figure 9 is Figure 1 another sub-step flowchart of step S150 shown in FIG. 14;
[0045] Figure 10 is a schematic diagram of a controller for performing a data writing method according to an embodiment of the present application. DETAILED DESCRIPTION
[0046] Embodiments of the present application are described in detail below with reference to the accompanying drawings. Examples of the embodiments are shown in the drawings, in which the same or similar components are denoted by the same or similar reference numerals, and therefore repeated description is omitted. The embodiments described below by reference to the drawings are examples for explaining the present application and should not be construed as limiting the present application.
[0047] In the description of the present application, it should be understood that the positional description, such as up, down, front, back, left, right, and the like, is based on the positional relationship shown in the drawings, and is only for the purpose of facilitating the description of the present application and simplifying the description, and therefore cannot be construed as indicating or implying that the device or element indicated must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be construed as limiting the present application.
[0048] In the description of the present application, the meaning of several is one or more, and the meaning of multiple is two or more. Greater than, less than, more than, and the like are understood as not including the number itself, and above, below, and the like are understood as including the number itself. If it is described as first, second, etc., it is only for the purpose of distinguishing technical features, and cannot be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated or the order of technical features indicated.
[0049] In the description of the present application, unless otherwise explicitly limited, the words such as setting, installing, connecting, and the like should be broadly understood, and those skilled in the art can reasonably determine the specific meaning of the above words in the present application in combination with the specific content of the technical solution.
[0050] In some cases, NAND flash memory may face the problem of adding new bad blocks in actual use. Specifically, some blocks in the NAND flash memory may fail to write. Once such a problem occurs, the corresponding block cannot be re-written after erasing, and for the data that has been written to the NAND flash memory, the programming operation cannot be normally completed, thereby causing the data to be unable to be effectively stored.
[0051] Based on the above, this application proposes a data writing method, controller, medium, and product, aiming to handle the write failure problem of NAND flash memory and ensure that data is not lost.
[0052] The various embodiments of the data writing method of this application will be further described below with reference to the accompanying drawings.
[0053] like Figure 1 As shown, Figure 1 This is a flowchart of a data writing method provided in one embodiment of this application; the data writing method may include, but is not limited to, steps S110, S120, S130, S140 and S150.
[0054] Step S110: Obtain the data to be written;
[0055] Step S120: Write the data into the storage medium in batches according to the preset storage units, where the preset storage units are the preset write units in the storage medium;
[0056] Step S130: Query the write status of data written to the target batch at preset time intervals;
[0057] Step S140: When the write status is successful, continue to write the data to the storage medium in batches according to the preset storage units;
[0058] Step S150: When the write status is failure, request a new storage unit and write the data to the storage medium in batches according to the storage unit until the write status of all batches of data is success.
[0059] In one embodiment, data to be written is acquired; the data is written to the storage medium in batches according to preset storage units, where the preset storage units are pre-defined write units within the storage medium; the write status of the target batch of data is queried at preset time intervals; if the write status is successful, the data continues to be written to the storage medium in batches according to the preset storage units; if the write status is failed, a new storage unit is requested, and the data is written to the storage medium in batches according to the storage unit, until the write status of all batches of data is successful. In the case of a write failure, this application can ensure that failed data can be rewritten and that no data is lost by requesting a new storage unit and writing the data to the storage medium in batches according to the storage unit until the write status of all batches of data is successful.
[0060] It is understandable that the storage medium is NAND flash memory, and the preset storage unit is the preset write unit in the NAND flash memory.
[0061] Understandably, the default storage unit can be an SLC superblock, a TLC superblock, or a GC superblock.
[0062] In addition, the preset storage unit includes an SLC super block, as shown in Figure 2 , Figure 2 is Figure 1 a sub-step flow chart of step S130; regarding the above-mentioned step S130, it can include but is not limited to step S210 and step S220.
[0063] Step S210, after the data of the target batch is written, before the first preset number of batches of data is written;
[0064] Step S220, querying the write state of the target batch.
[0065] It can be understood that, regarding the above-mentioned first preset number, it can be greater than or equal to 1, and can be set according to actual needs, and the embodiments of the present application do not make specific limitation thereto.
[0066] Exemplarily, for the SLC super block, the data to be written is sent to the page of the NAND flash memory, after the data of the target batch is written, the write state of this batch is not queried, and the next batch of data is continuously sent to the page of the NAND flash memory, and before the next batch of data is sent to the page of the NAND flash memory, the write state of the target batch is queried to control the data writing process according to the write state, so as to avoid the loss of data.
[0067] In addition, for the SLC super block, as shown in Figure 3 , Figure 3 is Figure 1 a sub-step flow chart of step S150; regarding the above-mentioned "when the write state is failed, a new storage unit is applied, and the data is written to the storage medium in batches according to the storage unit" in step S150, it can include but is not limited to step S310 and step S320.
[0068] Step S310, when the write state is failed, the write state of the first preset number of batches of data after the data of the target batch is written is acquired;
[0069] Step S320, when the data write state is a completion state, a new first storage unit is applied, and the data of the successfully written batch, the completed written batch and the target batch is recycled, so as to write all the data to the storage medium in batches according to the first storage unit, wherein the first storage unit is a new SLC super block.
[0070] It can be understood that, regarding the above-mentioned first preset number, it can be greater than or equal to 1, and can be set according to actual needs, and the embodiments of the present application do not make specific limitation thereto.
[0071] Exemplarily, when the target batch is the first batch, the data write state of the first preset number of batches after the data write of the target batch is acquired, i.e., the data write state of the second batch is acquired; for the SLC super block, when the write state of the target batch is a failure, the data write state of the second batch is acquired, and when the data write state of the second batch is a completion state, a new SLC super block is re-applied, and the data of the first batch and the second batch is recycled, so as to re-write all the data in batches according to the new SLC super block to the NAND flash memory.
[0072] Exemplarily, when the target batch is the second batch, i.e., when the data write state of the third batch is a completion state, a new SLC super block is re-applied, and the data of the first batch, the second batch and the third batch is recycled.
[0073] In addition, the preset storage unit includes a TLC super block, as shown in Figure 4 , Figure 4 is Figure 1 Another sub-step flowchart of step S130 is shown in
[0074] Step S410, after the data write of the target batch, before the interval of the second preset number of batches of data write;
[0075] Step S420, querying the write state of the target batch.
[0076] It can be understood that the above-mentioned second preset number can be greater than or equal to 1, and can be set according to actual needs, and the embodiments of the present application do not make specific limitations thereto.
[0077] Exemplarily, for the TLC super block, the data to be written is sent to the page of the NAND flash memory, after the data of the target batch is written, the write state of this batch is not queried, and the next batch of data is continuously sent to the page of the NAND flash memory, before the next batch of data is sent to the page of the NAND flash memory, the write state of the target batch is queried, so as to control the data write process according to the write state, to avoid data loss.
[0078] In addition, for the TLC super block, as shown in Figure 5 , Figure 5 is Figure 1 Another sub-step flowchart of step S150 is shown in
[0079] Step S510: When the write status is failed, obtain the data write status of the second preset number of batches after the data write of the target batch;
[0080] Step S520: When the write status is complete, request a new second storage unit and restore the data of the target batch whose write status is failed, so as to write the data of the target batch whose write status is failed into the storage medium according to the second storage unit, wherein the second storage unit is a new TLC superblock.
[0081] It is understood that the second preset quantity mentioned above can be greater than or equal to 1, and can be set according to actual needs. This application embodiment does not specifically limit it.
[0082] For example, when the target batch is the first batch, the data writing status of the second preset number of batches after the data writing of the target batch is obtained, which is to obtain the data writing status of the second batch; for TLC superblocks, if the write status of the target batch is failed, the data writing status of the second batch is obtained. If the data writing status of the second batch is completed, a new TLC superblock is re-applied for, and the data of the first batch is restored so that the data of the first batch is written to the NAND flash memory according to the new TLC superblock.
[0083] Additionally, for TLC superblocks, such as Figure 6 As shown, Figure 6 yes Figure 1 The flowchart of the sub-steps of step S120 is shown; the "writing data to the storage medium in batches according to the preset storage units" in step S120 may include, but is not limited to, steps S610 and S620.
[0084] Step S610: Calculate the redundancy check data for each batch of data;
[0085] Step S620: Write the redundant verification data and the data of each batch into the storage medium in batches according to the preset storage units.
[0086] It is understood that the aforementioned redundancy check data is RAID data, which can be set according to actual needs, and this application embodiment does not impose specific limitations on it.
[0087] For example, for a TLC superblock, the data for each batch is calculated to obtain RAID data, and then the data for each batch and the corresponding RAID data are written.
[0088] Additionally, for TLC superblocks, such as Figure 7 As shown, Figure 7 yes Figure 5The sub-step flowchart of step S520 is shown in the figure; as to the "recovering data of the target batch in the failed write state" in step S520, it can include but is not limited to step S710 and step S720.
[0089] Step S710, acquiring a cache space, reading data and redundancy check data other than the target batch in the failed write state, and storing to the cache space;
[0090] Step S720, performing reverse calculation through the read data and the redundancy check data to obtain the data of the target batch, and caching to the cache space.
[0091] It can be understood that the application can check whether the recovered data is valid through the stored mapping relationship, read the physical address information corresponding to the logical address of the data, and if the physical address information is the physical address of the recovered data, it is valid, otherwise it is invalid.
[0092] In addition, the preset storage unit includes a GC super block, such as Figure 8 as shown, Figure 8 is Figure 1 Another sub-step flowchart of step S130 is shown in the figure; as to the above-mentioned step S130, it can include but is not limited to step S810 and step S820.
[0093] Step S810, after the data of the target batch is written, before the third preset number of batches of data is written;
[0094] Step S820, querying the write state of the target batch.
[0095] It can be understood that as to the above-mentioned third preset number, it can be greater than or equal to 0, and can be set according to actual needs, and the application embodiments do not make specific limitation thereto.
[0096] Illustratively, for the GC super block, the data to be written is sent to the page of the NAND flash memory, after the data of the target batch is written, the write state of the target batch is queried to control the data writing process according to the write state, so as to avoid data loss.
[0097] In addition, for the GC super block, such as Figure 9 as shown, Figure 9 is Figure 1 Another sub-step flowchart of step S150 is shown in the figure; as to the "applying for a new storage unit and writing data in the storage unit by batch according to the storage unit when the write state is failed" in step S150, it can include but is not limited to step S910 and step S920.
[0098] Step S910, when the write state is failed, a new third storage unit is applied for;
[0099] Step S920, recycling the data of the successful write batch and the target batch to write all the data in the third storage unit batch by batch to the storage medium, wherein the third storage unit is a new GC super block.
[0100] For example, for the GC super block, when the third preset number is 0, the write state of the target batch is failed, a new GC super block is immediately re-applied, and the data of the successful write batch and the target batch is recycled (for example, the target batch is the third batch, that is, the data of the first batch, the second batch and the third batch needs to be recycled) to write all the data in the new GC super block batch by batch to the NAND flash.
[0101] Based on the data writing method of each of the above embodiments, the overall embodiment of the data writing method of the present application is proposed as follows.
[0102] The NAND flash supports multi-plane writing, cache writing, and interleaved writing under multi-chip enablement. Generally, a super block is composed of all physical blocks constituting a multi-plane and physical blocks corresponding to multiple chip enables (CEs); for example, when there are 2 chip enables (CEs) in the system, and each chip enable (CE) contains 4 planes, the super block is composed of 8 physical blocks, that is, the physical blocks corresponding to the respective 4 planes in each of the 2 chip enables (CEs) jointly constitute the super block. The writing modes of SLC super blocks and TLC super blocks are as follows with reference to Tables 1 and 2, and the specific writing modes are as follows:
[0103] Table 1
[0104]
[0105] Table 2
[0106]
[0107] The same background of Table 1 and Table 2 represents a page, each row is a parallel written strip, wherein each row of SLC super block is written in parallel to exist a write state, in the case of cache writing, the write state of the first row of data can be obtained before the third row of data is sent; each three rows of TLC super block are written in parallel to exist a write state, in the case of cache writing, the write state of the first three rows of data can be obtained before the seventh row of data is sent; the optimal writing mode is first interleaved writing, then multi-plane writing, and finally cache writing, taking SLC super block as an example, the writing order is: CE0Plane0-->CE1 Plane0-->CE0 Plane1-->CE1 Plane1-->CE0 Plane2-->CE1 Plane2-->CE0Plane3-->CE1 Plane3-->repeat the above sequence in the next row;
[0108] The number of buffer blocks required to meet the optimal writing performance of SLC super block needs to exist, that is, SLC super block can not release the buffer directly after writing data to the NAND flash, but release it after obtaining the write state, if there is a writing failure, the data in the buffer can be written again.
[0109] I. SLC super block writing failure processing flow:
[0110] 1. Send the data in the buffer to the page of the NAND flash, use the optimal performance writing process described above, and write a strip without waiting for the write state of the strip;
[0111] 2. Continue to send data to the page of the next strip until all pages of the next strip are full of data;
[0112] 3. Before sending data to the first page of the third strip, query the write state of the first strip;
[0113] a. If the returned write state is successful, release all page buffers of the first strip to receive new data;
[0114] b. If the returned write state is failure, wait for the data write state of the above two strips to be completed, and then reapply a new SLC super block to rewrite all data stored in the buffer according to the previous order;
[0115] 4. Repeat the above 1-3 process until the write state of all data is successful.
[0116] II. TLC super block writing failure processing flow:
[0117] One page in each stripe is selected to store the RAID data, and the data layout in Table 3 is used to write the valid data and the RAID data; the data in the buffer is sent to the page of the NAND flash memory, and the optimal performance write flow described above is used;
[0118] Table 3
[0119]
[0120] The steps are as follows:
[0121] 1. The RAID data is calculated for each page data before it is sent to the page of the NAND flash memory, and the new RAID data is calculated from the intermediate data of the RAID data calculated before and each page data until the final RAID data of all the page data in one stripe is calculated;
[0122] 2. After the data of each page buffer is sent to the page of the NAND flash memory, the buffer can be released immediately;
[0123] 3. All the page data of one stripe is sent to the page of the NAND flash memory in sequence, and the RAID data is sent in the last page of the stripe;
[0124] 4. After the word line (WL) of one TLC super block is written, the write state of the WL is not waited, wherein one WL in each block has three pages, and the writing of one super block of WL is equivalent to the writing of three stripes;
[0125] 5. According to the data writing sequence of the first WL, the data is continuously sent to the page of the next WL until all the pages of the next WL are filled with data;
[0126] 6. Before the data is sent to the first page of the third WL, the write state of the first WL is queried;
[0127] a. If the returned write state is success, the subsequent data is continuously written;
[0128] b. If the returned write state is failure, after the data write states of the above two WLs are completed, the failed data is restored, a new TLC super block is applied for, and the data is written again;
[0129] 7. The process is repeated until the write states of all the data are success.
[0130] The process of restoring the failed data is as follows:
[0131] 1. Apply buffer, read the data of the blocks in a stripe except the failed block, and store in the buffer;
[0132] 2. Calculate the data stored in the page of the failed block by reading the valid data and RAID data, and store in the buffer;
[0133] 3. Release the buffer storing the valid data and RAID data of the cached block;
[0134] 4. Repeat the above steps to recover the data stored in the page of the failed block in each stripe, and store in the buffer;
[0135] 5. Determine whether the recovered data stored in the buffer is valid according to the mapping relationship, and write the valid data into a new super block; wherein, the validity of the recovered data is checked according to the stored mapping relationship. The logical address of the read data corresponds to the physical address information. If the physical address information is the physical address of the recovered data, the data is valid, otherwise, the data is invalid. For example, the recovered data is stored in the address of block 10, page 100 of the WL where the write fails. If the physical address corresponding to the logical address recorded in the mapping relationship is also block 10, page 100, the recovered data is valid data (not overwritten by subsequent write data), and needs to be written again.
[0136] III. GC super block write failure processing flow:
[0137] Table 4 below is the data layout of the GC super block:
[0138] Table 4
[0139]
[0140] 1. Obtain the valid data in the source block, and store in the buffer;
[0141] 2. Write the data into a WL of the GC super block, and all the data stored in each stripe is valid data, i.e. no RAID data needs to be stored;
[0142] 3. After writing the WL, poll the write status of the WL until the write status is obtained;
[0143] a. If the returned write status is success, repeat the above GC steps to continue to recover new data;
[0144] b. If the returned write status is failure, apply a new GC super block, and write the data stored in the buffer again;
[0145] Repeat this process until all data write statuses are successful.
[0146] It is understandable that both SLC superblocks and TLC superblocks can be used as cache blocks for storage devices. TLC superblocks store RAID data, which means that some user data has been overwritten and invalidated. The valid data in both types of superblocks will eventually be recycled to GC superblocks through garbage collection. GC superblocks do not store RAID data, but this will not cause a decrease in the effective storage space of the storage device.
[0147] Meanwhile, the writing of SLC superblocks and TLC superblocks is completed in the writing mode with optimal writing performance, which will not affect the writing performance of SLC superblocks. At the same time, the programming time of a block in TLC is much longer than the data transfer time of a page, so the impact on the writing performance of TLC superblocks is minimal.
[0148] This application can handle write failures in NAND flash memory without compromising write performance or reducing the effective storage space of the storage device, and ensures that no data is lost.
[0149] Based on the data writing methods of the above embodiments, the following presents various embodiments of the controller, computer-readable storage medium, and computer program product of this application.
[0150] like Figure 10 As shown, Figure 10 This is a schematic diagram of a controller for performing a data writing method according to an embodiment of this application. The controller 700 implemented in this application includes: a processor 710, a memory 720, and a computer program stored in the memory 720 and executable on the processor 710, wherein... Figure 10 The example uses a processor 710 and a memory 720.
[0151] The processor 710 and memory 720 can be connected via a bus or other means. Figure 10 Taking the example of a connection between China and Israel via a bus.
[0152] The memory 720, as a non-transitory computer readable storage medium, can be used to store non-transitory software programs and non-transitory computer executable programs. In addition, the memory 720 can include a high-speed random access memory, and can also include a non-transitory memory such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state memory device. In some embodiments, the memory 720 can optionally include a memory 720 that is remotely arranged relative to the processor 710, and the remote memory 720 can be connected to the controller 700 through a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0153] Those skilled in the art can understand that, Figure 10 The device structure shown in the above-mentioned embodiments does not constitute a limitation on the controller 700, and can include more or fewer components than those shown, or combine certain components, or different component arrangements.
[0154] In Figure 10 In the controller 700 shown in the above-mentioned embodiments, the processor 710 can be used to call the control program stored in the memory 720, so as to implement the above-mentioned data writing method. Specifically, the non-transitory software programs and instructions required for implementing the data writing method of the above-mentioned embodiments are stored in the memory 720, and when executed by the processor 710, the data writing method of the above-mentioned embodiments is executed.
[0155] It is worth noting that since the controller 700 of the embodiments of the present application can execute the data writing method of any one of the above-mentioned embodiments, the specific implementation and technical effects of the controller 700 of the embodiments of the present application can refer to the specific implementation and technical effects of the data writing method of any one of the above-mentioned embodiments.
[0156] In addition, one embodiment of the present application also provides a computer readable storage medium, which stores computer executable instructions for executing the above-mentioned data writing method. Exemplarily, the method steps described above are executed. Figures 1 to 9
[0157] It is worth noting that since the computer readable storage medium of the embodiments of the present application can execute the data writing method of any one of the above-mentioned embodiments, the specific implementation and technical effects of the computer readable storage medium of the embodiments of the present application can refer to the specific implementation and technical effects of the data writing method of any one of the above-mentioned embodiments.
[0158] Furthermore, one embodiment of this application also provides a computer program product, including a computer program or computer instructions, which are stored in a computer-readable storage medium. A processor of a computer device reads the computer program or computer instructions from the computer-readable storage medium and executes the computer program or computer instructions, causing the computer device to perform the data writing method described above. Exemplarily, the above-described method is performed... Figures 1 to 9 The methods and steps in the text.
[0159] It is worth noting that, since the computer program product of this application embodiment can execute the data writing method of any of the above embodiments, the specific implementation method and technical effect of the computer program product of this application embodiment can refer to the specific implementation method and technical effect of the data writing method of any of the above embodiments.
[0160] It will be understood by those skilled in the art that all or some of the steps and systems in the methods disclosed above can be implemented as software, firmware, hardware, and suitable combinations thereof. Some or all of the physical components can be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software can be distributed on a computer-readable medium, which can include computer storage media (or non-transitory media) and communication media (or transient media). As is known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, as is known to those skilled in the art, communication media typically include computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.
[0161] It should be understood that, in the present application, "at least one" refers to one or more, and "multiple" refers to two or more. "And / or" is used to describe the association relationship of the associated objects, which means that there can be three relationships, for example, "A and / or B" can represent three cases of only A, only B, and A and B existing at the same time, where A and B can be singular or plural. The character " / " generally represents an "or" relationship between the associated objects before and after it. "At least one of the following" or similar expressions means any combination of these items, including any combination of single or multiple items. For example, at least one of a, b or c can represent a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0162] In several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of units is only a logical functional division, and actual implementation can have another division manner, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed units can be indirect coupling or communication connection between some interfaces, devices or units, which can be electrical, mechanical or other forms. The units described as separate components can be or can not be physically separated, and the components displayed as units can be or can not be physical units, that is, they can be located in one place, or can be distributed on multiple network units. Some or all units can be selected according to actual needs to achieve the purpose of the embodiment.
[0163] It should also be understood that the various embodiments provided by the embodiments of the present application can be combined in any way to achieve different technical effects.
[0164] The above is a specific description of the preferred embodiments of the present application, but the present application is not limited to the above embodiments. Those skilled in the art can make various equivalent modifications or replacements without departing from the spirit of the present application, and these equivalent modifications or replacements are all included in the scope defined by the claims of the present application.
Claims
1. A data writing method, characterized in that, The method includes: Get the data to be written; The data is written to the storage medium in batches according to preset storage units, wherein the preset storage units are preset writing units in the storage medium; Query the write status of data written to the target batch at preset time intervals; When the write status is successful, continue to write the data to the storage medium in batches according to the preset storage units; When the write status is failure, a new storage unit is requested, and the data is written to the storage medium in batches according to the storage unit until the write status of all batches of data is success. The preset storage unit includes an SLC superblock, a TLC superblock, and a GC superblock. The step of querying the write status of data written to the target batch at preset time intervals includes: For the SLC superblock, after the data of the target batch is written and before the data of the first preset number of batches is written, the write status of the target batch is queried. For the TLC superblock, after the data of the target batch is written and before the data of the second preset number of batches is written, the write status of the target batch is queried; For the GC superblock, after the data of the target batch is written and before the data of the third preset number of batches is written, the write status of the target batch is queried. Wherein, the first preset quantity and the second preset quantity are both greater than or equal to 1, and the third preset quantity is greater than or equal to 0; When the write status fails, a new storage unit is requested, and the data is written to the storage medium in batches according to the storage unit, including: For the SLC superblock, when the write status is failed, the write status of the first preset number of batches of data after the target batch of data is written is obtained; when the data write status is completed, a new first storage unit is requested, and the data of the successfully written batch, the completed write batch and the target batch are reclaimed, so that all the data are written to the storage medium in batches according to the first storage unit, wherein the first storage unit is a new SLC superblock. For the TLC superblock, when the write status is failed, the write status of the second preset number of batches of data after the write of the target batch of data is obtained; when the write status is completed, a new second storage unit is requested, and the data of the target batch with the write status failed is restored, so that the data of the target batch with the write status failed is written to the storage medium according to the second storage unit, wherein the second storage unit is a new TLC superblock. For the GC superblock, when the write status is failed, a new third storage unit is requested; the data of the successfully written batch and the target batch are reclaimed so that all the data is written to the storage medium in batches according to the third storage unit, wherein the third storage unit is a new GC superblock.
2. The method according to claim 1, characterized in that, The step of writing the data into the storage medium in batches according to preset storage units includes: The data for each batch is calculated to obtain redundancy check data; The redundant verification data and the data of each batch are written to the storage medium in batches according to the preset storage units.
3. The method according to claim 2, characterized in that, The step of restoring the data of the target batch whose write status has failed includes: Obtain cache space, read data other than the target batch whose write status is failed and the redundant verification data, and store them in the cache space; The target batch of data is obtained by performing reverse calculations on the read data and the redundant verification data, and then cached in the cache space.
4. A controller, characterized in that, include: A memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor, when executing the computer program, performs the data writing method as described in any one of claims 1 to 3.
5. A computer-readable storage medium, characterized in that: The device stores computer-executable instructions for performing the data writing method as described in any one of claims 1 to 3.
6. A computer program product, comprising a computer program or computer instructions, characterized in that, The computer program or the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer program or the computer instructions from the computer-readable storage medium and executes the computer program or the computer instructions, causing the computer device to perform the data writing method as described in any one of claims 1 to 3.
Citation Information
Patent Citations
Data writing method based on Nand Flash
CN103514097A
Hardware cache management data backup and quick recovery method and system
CN110287062A