Data writing method and device for solid-state disk, and solid-state disk
By judging the continuity of data block address in the cache control module of the solid-state drive and directly generating a mapping table, the problem of low write operation performance of solid-state drives is solved, and more efficient write operation performance is achieved.
Patent Information
- Application Number
- PCT/CN2024/095309
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-05-26
- Filing Date
- 2024-05-24
- Publication Date
- 2024-12-05
AI Technical Summary
During the write operation, the existing solid-state drives have poor write performance due to loop judgment and frequent access to DRAM.
By determining whether the data block address is continuous in the cache control module of the solid state drive, and directly generate a mapping table in the continuous situation, repeated loop judgments and DRAM access are avoided.
It improves the write operation performance of solid-state drives, reduces the number of cycle judgments and DRAM accesses, and improves the write operation efficiency.
Smart Images

Figure CN2024095309_05122024_PF_FP_ABST
Abstract
Description
Method for writing data into solid state hard disk, device thereof and solid state hard disk
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to a Chinese patent application filed with the Patent Office of China on May 26, 2023, with application number 202310607939.3 and entitled “Data Writing Method for Solid State Drive, Device Thereof and Solid State Drive”, the entire contents of which are incorporated herein by reference. Technical Field
[0003] The embodiments of the present application relate to the field of computers, and in particular, to a method for writing data to a solid-state hard disk, a device thereof, and a solid-state hard disk. Background Art
[0004] The data writing process of a solid-state drive (SSD) requires modifying the mapping table (L2P table) twice. The first time is when moving data from the host (HOST) to the cache area (Buffer) of the dynamic random access memory (DRAM) in the SSD. The data management (DM) module needs to point the L2P table to the buffer address where the data is located. The second time is after writing the data from the buffer to the flash memory (NAND flash). The data write processing (WM) module needs to point the L2P table to the NAND address.
[0005] In the related art, each time the DM module processes a piece of data, it generates a cache entry to record the buffer address and logical block address (LBA), and updates it to the L2P table. After processing the data of a cache control block (CCB), it is sent to the WM module to write the data to the NAND Flash and modify the table again. The WM traverses each cache entry in the CCB and then performs the table modification operation. In the above table modification operation, each time a cache entry is written, it is necessary to loop through each cache entry in the CCB, and each time it is necessary to read the LBA from the DRAM for comparison, and finally determine whether the LBA in the CCB is continuous. This large amount of loop judgment and access to DRAM greatly affects the performance of the write operation of the solid-state drive.
[0006] Summary of the Invention
[0007] The embodiments of the present application provide a method for writing data to a solid-state hard disk, a device thereof, and a solid-state hard disk, so as to at least solve the problem of poor write performance of solid-state hard disks in related technologies.
[0008] According to one embodiment of the present application, a method for writing data to a solid-state hard disk is provided, comprising: obtaining logical block addresses of multiple write data stored in a target cache module, the target cache module being located in a cache area of the solid-state hard disk; storing the multiple write data in the cache area in a solid-state storage unit of the solid-state hard disk; determining whether the logical block addresses of the multiple write data are continuous; if the determination result indicates that the logical block addresses of the multiple write data are continuous, obtaining physical block addresses of the multiple write data in the solid-state storage unit; generating a target mapping table based on the logical block addresses of the multiple write data and the physical block addresses of the multiple write data in the solid-state storage unit, the target mapping table being used to map the logical block addresses of the multiple write data to the physical block addresses in the solid-state storage unit.
[0009] In an exemplary embodiment, the logical block addresses of multiple write data stored in a target cache module are obtained, and the target cache module is located in a cache area of a solid-state drive, including: obtaining a data packet carried by a target command and the logical block address of each data in the data packet from a host; storing the data packet and the logical block addresses of multiple data in the data packet in at least one cache module in the cache area, and the at least one cache module includes a target cache module; obtaining the logical block addresses of multiple data stored in the target cache module.
[0010] In an exemplary embodiment, the above method also includes: splitting multiple data in the data packet in sequence to obtain multiple unpacked data; judging whether the logical block address of the target unpacked data is continuous with the logical block address of the previous unpacked data according to the splitting order of the multiple unpacked data, and obtaining a judgment result; generating a target mark parameter of the target cache module based on the judgment result, wherein the target mark parameter is used to indicate whether the logical block address of the target unpacked data is continuous with the logical block address of the previous unpacked data.
[0011] In an exemplary embodiment, according to the splitting order of multiple unpacked data, whether the logical block address of the target unpacked data is continuous with the logical block address of the previous unpacked data is determined to obtain a judgment result, including: according to the splitting order of multiple unpacked data, whether the logical block address of the Nth unpacked data is continuous with the logical block address of the N-1th unpacked data is determined to obtain a judgment result.
[0012] In an exemplary embodiment, based on the judgment result, a target mark parameter of the target cache module is generated, including: based on the judgment result, updating the previous mark parameter in the target cache module to the target mark parameter, wherein the previous mark parameter is used to indicate whether the logical block address of the N-1th unpacked data is continuous with the logical block address of the N-2th unpacked data.
[0013] In an exemplary embodiment, based on the judgment result, the previous mark parameter in the target cache module is updated to the target mark parameter, including: when a first judgment result is obtained, generating a first mark parameter based on the first judgment result, and updating the previous mark parameter to the first mark parameter, wherein the first judgment result is the judgment result obtained when the logical block address of the Nth unpacked data and the logical block address of the N-1th unpacked data are continuous; when a second judgment result is obtained, generating a second mark parameter based on the second judgment result, and updating the previous mark parameter to the second mark parameter, wherein the second judgment result is the judgment result obtained when the logical block address of the Nth unpacked data and the logical block address of the N-1th unpacked data are discontinuous.
[0014] In an exemplary embodiment, splitting the plurality of data in the data packet in sequence to obtain a plurality of unpacked data includes: splitting the plurality of data in the data packet in sequence to obtain a plurality of unpacked data of the same size.
[0015] In an exemplary embodiment, a data packet and the logical block addresses of multiple data in the data packet are stored in at least one cache module in a cache area, including: according to the splitting order of the multiple unpacked data, the unpacked data that meets a preset number and the logical block addresses of the unpacked data that meets a preset number in the multiple unpacked data are stored in the target cache module in sequence to obtain multiple write data.
[0016] In an exemplary embodiment, according to the splitting order of multiple unpacked data, the unpacked data that meets a preset number and the logical block addresses of the unpacked data that meet the preset number in the multiple unpacked data are stored in the target cache module in sequence to obtain multiple write data, including: storing the target unpacked data and the logical block addresses of the target unpacked data in the target cache module; judging whether the number of unpacked data currently stored in the target cache module meets the preset number; if the number of unpacked data currently stored in the target cache module does not meet the preset number, storing the next unpacked data of the target unpacked data and the logical block address of the next unpacked data in the target cache module according to the splitting order of the multiple unpacked data; if the number of unpacked data currently stored in the target cache module meets the preset number, stopping the storage operation in the target cache module to obtain a target cache module storing multiple write data.
[0017] In an exemplary embodiment, storing the data packet and the logical block addresses of multiple data in the data packet in at least one cache module in the cache area also includes: determining a preset number based on the storage capacity of the target cache module and the size of each unpacked data.
[0018] In an exemplary embodiment, according to the splitting order of multiple unpacked data, the target write data that meets a preset number and the logical block address of the target write data in the multiple unpacked data are stored in the target cache module in sequence to obtain multiple write data, including: after each splitting of the unpacked data, judging whether there is an available cache module in at least one cache module, wherein the available cache module is a cache module with available storage space; in the case that there is an available cache module in at least one cache module, determining the available cache module as the target cache module; storing the split current unpacked data and the logical block address of the current unpacked data in the target cache module to obtain the write data stored in the target cache module.
[0019] In an exemplary embodiment, according to the splitting order of multiple unpacked data, the target write data that meets the preset quantity and the logical block address of the target write data in the multiple unpacked data are stored in the target cache module in sequence to obtain multiple write data, and it also includes: when there is no available cache module in at least one cache module, an application request is generated; according to the application request, a new cache module is generated in the cache area to obtain the target cache module; the split current unpacked data is stored in the new cache module to obtain the write data stored in the target cache module.
[0020] In an exemplary embodiment, according to the splitting order of multiple unpacked data, the target write data that meets a preset number and the logical block addresses of the target write data in the multiple unpacked data are stored in the target cache module in sequence to obtain multiple write data, and it also includes: after generating a new cache module, initializing the new cache module to obtain the target cache module, wherein the target cache module has a first mark parameter, and the first mark parameter is used to indicate that the logical block addresses of the multiple write data are continuous.
[0021] In an exemplary embodiment, according to the splitting order of multiple unpacked data, whether the logical block address of the target unpacked data is continuous with the logical block address of the previous unpacked data is judged to obtain a judgment result, including: after storing the split target unpacked data and the logical block address of the target unpacked data into the target cache module, recording the relative offset parameter of the target unpacked data in the target cache module, wherein the relative offset parameter is represented as the number of unpacked data in the target cache module that is stored before the target unpacked data in the order; calculating the difference between the logical block address of the target unpacked data and the logical block address of the first unpacked data stored in the target cache module; judging whether the relative offset parameter is equal to the difference to obtain a judgment result.
[0022] In an exemplary embodiment, based on the judgment result, a target mark parameter of the target cache module is generated, including: when the relative offset parameter is equal to the difference value, a first mark parameter is generated, wherein the first mark parameter is used to indicate that the logical block addresses of multiple write data are continuous; when the relative offset parameter is not equal to the difference value, a second mark parameter is generated, wherein the second mark parameter is used to indicate that the logical block addresses of the first write data and the second write data among the multiple write data are discontinuous, and the first write data and the second write data are two unpacked data adjacent in the splitting order.
[0023] In an exemplary embodiment, determining whether the logical block addresses of the plurality of write data are continuous includes determining whether the target mark parameter indicates that the logical block addresses of the plurality of write data are continuous.
[0024] In an exemplary embodiment, determining whether a target mark parameter indicates that the logical block addresses of a plurality of write data are continuous includes: determining whether the target mark parameter satisfies a preset condition, wherein the preset condition includes one of the following: the target mark parameter is a first mark parameter, and the target mark parameter is a second mark parameter, wherein the first mark parameter is used to indicate that the logical block addresses of the plurality of write data are continuous, and the second mark parameter is used to indicate that the logical block addresses of the plurality of write data are discontinuous.
[0025] In an exemplary embodiment, the above method also includes: obtaining physical block addresses of multiple write data in the cache area; generating a first mapping table based on the logical block addresses of the multiple write data and the physical block addresses of the multiple write data in the cache area, and the first mapping table is used to map the logical block addresses of the multiple write data to the physical block addresses in the cache area.
[0026] In an exemplary embodiment, a target mapping table is generated based on the logical block addresses of multiple write data and the physical block addresses of multiple write data in the solid-state storage unit, including: updating the first mapping table based on the physical block addresses of the multiple write data in the solid-state storage unit to obtain the target mapping table.
[0027] According to another embodiment of the present application, a write operation device for a solid-state hard disk is provided, including: a first acquisition module, configured to acquire logical block addresses of multiple write data stored in a target cache module, the target cache module being located in a cache area of the solid-state hard disk; a storage module, configured to store the multiple write data in the cache area in a solid-state storage unit of the solid-state hard disk; a judgment module, configured to judge whether the logical block addresses of the multiple write data are continuous; a second acquisition module, configured to acquire physical block addresses of the multiple write data in the solid-state storage unit when the judgment result indicates that the logical block addresses of the multiple write data are continuous; a generation module, configured to generate a target mapping table based on the logical block addresses of the multiple write data and the physical block addresses of the multiple write data in the solid-state storage unit, the target mapping table being used to map the logical block addresses of the multiple write data to the physical block addresses in the solid-state storage unit.
[0028] According to another embodiment of the present application, a non-volatile readable storage medium is provided, in which a computer program is stored. The computer program is configured to execute the steps of any of the above method embodiments when running.
[0029] According to another embodiment of the present application, a solid-state drive is provided, comprising a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0030] Through the present application, after obtaining the logical block addresses of multiple write data stored in the target cache module and storing the multiple write data in the cache area in the solid-state storage unit of the solid-state drive, it is first determined whether the logical block addresses of the multiple write data are continuous. If the logical block addresses of the multiple write data are continuous, the physical block addresses of the multiple write data in the solid-state storage unit are then obtained. Based on the characteristics that the logical block addresses (LBAs) in a cache control module (CCB) during the write operation of the solid-state drive are continuous, and the characteristics that a data packet carried by a command needs to be split into multiple write data for processing during the write operation, it is possible to first identify whether the LBAs in a CCB are continuous. If they are continuous, there is no need to loop through each write data and its LBA in the CCB again, nor is it necessary to read the LBA from the dynamic random access memory (DRAM) for comparison each time. Instead, the LBA in the CCB can be used to directly generate the above-mentioned mapping table in one go. Therefore, it is possible to solve the problem in the related art that a large number of loop judgments and accesses to DRAM greatly affect the write operation performance of the solid-state drive, thereby achieving the effect of improving the write operation performance of the solid-state drive. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] FIG1 is a block diagram of the hardware structure of a solid-state hard disk that executes the method for writing data to the solid-state hard disk provided in an embodiment of the present application;
[0032] FIG2 is a flow chart of a method for writing data to a solid-state drive according to an embodiment of the present application;
[0033] FIG3 is a flow chart of another method for writing data to a solid-state drive according to an embodiment of the present application;
[0034] FIG4 is a structural block diagram of a write operation device for a solid-state drive according to an embodiment of the present application. DETAILED DESCRIPTION
[0035] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0036] It should be noted that the terms "first", "second", etc. in the description and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0037] The method embodiments provided in the embodiments of the present application can be executed in a solid-state drive. Figure 1 is a block diagram of the hardware structure of a solid-state drive in an embodiment of the present application. As shown in Figure 1, the solid-state drive may include one or more (only one is shown in Figure 1) processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the above-mentioned solid-state drive may also include a transmission device 106 and an input and output device 108 for communication functions. It can be understood by those skilled in the art that the structure shown in Figure 1 is only for illustration, and it does not limit the structure of the above-mentioned solid-state drive. For example, the solid-state drive may also include more or fewer components than those shown in Figure 1, or have a configuration different from that shown in Figure 1.
[0038] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the data writing method of the solid-state hard disk in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, implementing the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories can be connected to the solid-state hard disk via a network. Examples of the above-mentioned network include but are not limited to the Internet, corporate intranet, local area network, mobile communication network and combinations thereof.
[0039] The transmission device 106 is used to receive or send data via a network. Optional examples of the aforementioned network may include a wireless network provided by the communication provider of the solid-state drive. In one embodiment, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0040] In this embodiment, a method for writing data to the solid-state drive is provided. FIG2 is a flow chart of the method for writing data to the solid-state drive according to an embodiment of the present application. As shown in FIG2 , the flow chart includes the following steps:
[0041] Step S202, obtaining logical block addresses of a plurality of write data stored in a target cache module, where the target cache module is located in a cache area of the solid state drive;
[0042] Step S204, storing the plurality of write data in the cache area into the solid-state storage unit of the solid-state hard disk;
[0043] Step S206 , determining whether the logical block addresses of the plurality of written data are continuous;
[0044] Step S208 , when the determination result indicates that the logical block addresses of the plurality of write data are continuous, obtaining the physical block addresses of the plurality of write data in the solid-state storage unit;
[0045] In step S210 , a target mapping table is generated based on the logical block addresses of the plurality of write data and the physical block addresses of the plurality of write data in the solid-state storage unit. The target mapping table is used to map the logical block addresses of the plurality of write data to the physical block addresses in the solid-state storage unit.
[0046] It should be noted that the data writing method for a solid-state drive in this embodiment applies to sequential writing to the solid-state drive. Sequential writing can be understood as lining up the data to be processed and continuously writing it at an optimized speed. This typically achieves a relatively ideal sequential writing speed when writing large files. In general, sequential writing means that the solid-state drive writes data in the order in which the data is written, ensuring data continuity, manifested in short and continuous write times.
[0047] In related technologies, each time the Data Management (DM) module processes a piece of data, it generates a cache entry to record the buffer address and logical block address (LBA), and updates it to the L2P table, which maps logical addresses to physical addresses. After processing a cache control block (CCB) of data, the L2P table is sent to the Data Write Management (WM) module for writing data to the NAND flash memory and performing table modifications. The WM module traverses each cache entry in the CCB and performs table modifications.
[0048] Among them, when the DM module receives a write operation instruction, the DM module needs to divide the data volume in the data packet carried by the instruction into multiple 4KB, and send the LBA corresponding to one of the 4KB to the WM module each time. The WM module allocates a physical block address (PBA) to the LBA based on the received LBA, and then the WM module writes data in the NAND according to the PBA, and points the L2P table to the NAND address through the table modification operation.
[0049] However, each time a cache entry is written in the above table modification operation, it is necessary to loop through every cache entry in the CCB, and each time the LBA needs to be read from DRAM for comparison to finally determine whether the LBA in the CCB is continuous. This large number of loop judgments and DRAM accesses greatly affects the sequential write performance of the SSD.
[0050] Taking the NAND Flash architecture with triple-level cell (TLC) storage technology as an example, in SSDs, the smallest unit of data storage is a page. A page is typically 4KB in size, and several pages are grouped into blocks. A CCB can carry data equivalent to three pages, or twelve 4KB blocks. When the WM module updates the table, it iterates over every cache entry in the CCB. Consecutive LBAs can be updated in one go. However, even if the 12 LBAs in the CCB are contiguous, the process still requires twelve iterations, each of which requires reading the LBA from DRAM for comparison to determine whether the 12 LBAs are contiguous.
[0051] This embodiment, through steps S202 to S210, can first identify whether the LBAs in a cache control module (CCB) are continuous during the write operation of the solid-state drive, based on the fact that the logical block addresses (LBAs) in a cache control module (CCB) are continuous, and that the data packet carried by a command needs to be split into multiple write data for processing during the write operation. If they are continuous, there is no need to loop through each write data and its LBA in the CCB, nor is there a need to read the LBA from the dynamic random access memory (DRAM) for comparison each time. Instead, the LBA in the CCB can be used to directly generate the above-mentioned mapping table in one go. Therefore, the problem in the related art that a large number of loop judgments and accesses to DRAM greatly affect the write operation performance of the solid-state drive can be solved, thereby achieving the effect of improving the write operation performance of the solid-state drive.
[0052] In the above step S202 , logical block addresses of a plurality of write data stored in a target cache module are obtained, and the target cache module is located in a cache area of the solid state drive.
[0053] In some optional embodiments, the logical block addresses of multiple write data stored in the target cache module are obtained, and the target cache module is located in the cache area of the solid-state drive, including: obtaining a data packet carried by a target command and the logical block address of each data in the data packet from the host; storing the data packet and the logical block addresses of multiple data in the data packet in at least one cache module in the cache area, and the above-mentioned at least one cache module includes a target cache module; obtaining the logical block addresses of multiple data stored in the target cache module.
[0054] In some embodiments, the control unit in the SSD includes a DM module and a WM module. The host (HOST) sends a data packet carried by a target command to the DM module. The DM module can split the data packet carried by the instruction to obtain multiple 4KB data and the LBA of each 4KB data, and then store the 4KB data and its LBA in the cache area of the DRAM in the SSD in sequence. The cache area may include multiple CCBs, each CCB can carry 12 4k data, so that the LBA of multiple 4KB data stored in the CCB can be obtained through the WM module.
[0055] In some optional embodiments, the data writing method in this embodiment also includes: obtaining multiple physical block addresses of write data in the cache area; generating a first mapping table based on the logical block addresses of the multiple write data and the physical block addresses of the multiple write data in the cache area, the first mapping table being used to map the logical block addresses of the multiple write data to the physical block addresses in the cache area.
[0056] In some embodiments, the L2P table needs to be modified twice in the SSD data write process. The first time is when the data is moved from the HOST to the DRAM buffer in the solid-state drive. The DM module modifies the table to point the L2P table to the buffer address where the data is located, that is, to obtain the above-mentioned first mapping table for mapping the logical block addresses of multiple write data to the physical block addresses in the cache area.
[0057] In some optional embodiments, the data writing method in this embodiment also includes: splitting multiple data in the data packet in sequence to obtain multiple unpacked data; judging whether the logical block address of the target unpacked data is continuous with the logical block address of the previous unpacked data according to the splitting order of the multiple unpacked data, and obtaining a judgment result; generating a target mark parameter of the target cache module according to the judgment result, wherein the target mark parameter is used to indicate whether the logical block address of the target unpacked data is continuous with the logical block address of the previous unpacked data.
[0058] In some embodiments, the DM module can split the data packet carried by the instruction to obtain multiple unpacked data, and then determine whether the LBA of one unpacked data is continuous with the LBA of the previous unpacked data in the order of data splitting, so that the DM module can identify whether the LBA in a CCB is continuous during the unpacking process. After the DM module identifies it, it directly informs the WM module of the continuity of the LBA in the CCB through the mark parameter, so that when the WM module changes the table, it can first determine whether the LBA is continuous according to the above-mentioned mark parameter. If it is continuous, the WM module does not need to make a cyclic judgment again and can directly complete the table change at one time. Otherwise, the table is changed according to the method in the relevant technology to point the L2P table to the NAND address.
[0059] This embodiment adopts the above-mentioned optional implementation method, and optimizes the table modification scheme for writing SSD data, hiding a large number of loop judgments of the WM module in the unpacking processing flow of the DM module, thereby greatly reducing the number of loop judgments of the WM module and access to DRAM, alleviating the computing pressure of the WM module and improving the performance of sequential writing.
[0060] Exemplarily, the above target flag parameter is represented by adding a flag field in the CCB, and the newly added flag is used to indicate whether the LBA in the CCB is continuous; at the same time, a first_lba field is added in the CCB to record the LBA corresponding to the first data stored in the CCB.
[0061] In some optional implementations, splitting the multiple data in the data packet in sequence to obtain multiple unpacked data includes: splitting the multiple data in the data packet in sequence to obtain multiple unpacked data with the same size.
[0062] For example, the DM module can split the data packet carried by the instruction to obtain multiple 4KB data, and then determine whether the LBA of a 4KB data is continuous with the LBA of the previous 4KB data in the order of data splitting, so that the DM module can identify whether the LBA in a CCB is continuous during the process of unpacking and processing each 4k data.
[0063] In some optional embodiments, according to the splitting order of multiple unpacked data, it is determined whether the logical block address of the target unpacked data is continuous with the logical block address of the previous unpacked data, and a judgment result is obtained. Based on the judgment result, a target mark parameter of the target cache module is generated, including: according to the splitting order of multiple unpacked data, it is determined whether the logical block address of the Nth unpacked data is continuous with the logical block address of the N-1th unpacked data, and a judgment result is obtained. Based on the judgment result, the prior mark parameter in the target cache module is updated to the target mark parameter, wherein the prior mark parameter is used to indicate whether the logical block address of the N-1th unpacked data is continuous with the logical block address of the N-2th unpacked data.
[0064] In some embodiments, after the DM module splits the data packet to obtain multiple 4KB data, the 4KB data is stored in the CCB in sequence to complete the processing of a 4KB data. In the process of unpacking and processing each 4KB data, the DM module determines whether the LBA of a 4KB data is continuous with the LBA of the previous 4KB data in accordance with the order of data splitting, thereby generating different marking parameters based on whether they are continuous or not. Specifically, when the same CCB is allocated to multiple 4KB data, it is determined whether the LBA of the 4KB data is continuous with the LBA of the previous 4KB data to generate the marking parameters corresponding to the CCB, and when the CCB is not fully stored, the marking parameters of the CCB are updated at any time to obtain the above-mentioned target marking parameters.
[0065] In some embodiments, when the logical block address of the Nth unpacked data is continuous with the logical block address of the N-1th unpacked data, the obtained judgment result may be a first judgment result, so that a first marking parameter can be generated based on the first judgment result, and the previous marking parameter is updated to the first marking parameter; when the logical block address of the Nth unpacked data is discontinuous with the logical block address of the N-1th unpacked data, the obtained judgment result may be a second judgment result, so that a second marking parameter can be generated based on the second judgment result, and the previous marking parameter is updated to the second marking parameter.
[0066] For example, after the DM module moves the data packet from the HOST to the buffer, it starts to update the cache entry, modify the L2P table, and then judge the value of the flag corresponding to the CCB when storing multiple 4KB data in the CCB in sequence. After processing each 4KB data, it is necessary to judge whether the CCB has been fully stored. If it is full, it will be sent directly to the WM module. Otherwise, it will be sent to the WM module after it is full. When the WM module finishes writing the data and modifies the table, it first judges the flag in the CCB. If it is 1, 12 old PBAs can be read from the L2P table at one time. After generating a new PBA, the 12 new PBAs can be updated to the L2P table at one time. In this way, the WM module can reduce 12 loops and comparisons when processing each CCB, greatly reducing the computing pressure of the WM module.
[0067] Among them, if the value of the flag is 0, it means that the LBA in the CCB is no longer continuous, then the DM module will inform the WM module of the flag. If the WM module finds that the flag in the CCB is 0, it will continue to follow the table modification operation in the above-mentioned related technology, first looping and judging, and modifying the table once each time a maximum continuous LBA is found until all 12 4KB data tables are modified.
[0068] Among them, if the value of the flag is 1, it means that the LBA in the CCB is continuous. Then the DM module determines whether the LBA of a 4KB data is continuous with the LBA of the previous 4KB data according to the data splitting order. The first 4KB data in each CCB is used to apply for the CCB. The others do not need to be applied for. The CCB applied for by the first 4KB data is directly used, and they can be used in sequence. When the first CCB applies for the CCB, the flag corresponding to the CCB is set to 1. By default, it means that the LBAs of the 12 4KB data in the CCB are continuous. At the same time, the first_lba field in the DM module is set to the LBA corresponding to the first 4KB data. When allocating CCB for each 4KB data, if the LBA of the 4KB data is continuous with the LBA of the previous 4KB data, the flag corresponding to the CCB is still set to 1. If the LBA of the 4KB data is not continuous with the LBA of the previous 4KB data, the flag corresponding to the CCB is set to 0.
[0069] In some optional embodiments, a data packet and the logical block addresses of multiple data in the data packet are stored in at least one cache module in the cache area, including: according to the splitting order of the multiple unpacked data, the unpacked data that meets a preset number and the logical block addresses of the unpacked data that meets a preset number in the multiple unpacked data are stored in the target cache module in sequence to obtain multiple write data.
[0070] In some embodiments, after processing a 4KB data each time, the amount of 4KB data stored in the CCB can be used to determine whether the CCB is full. If it is full, it is sent directly to the WM module; otherwise, it is sent to the WM module after it is full.
[0071] In some optional embodiments, according to the splitting order of multiple unpacked data, the unpacked data that meets the preset number and the logical block addresses of the unpacked data that meet the preset number in the multiple unpacked data are stored in the target cache module in sequence to obtain multiple write data, including: storing the target unpacked data and the logical block addresses of the target unpacked data in the target cache module; judging whether the number of unpacked data currently stored in the target cache module meets the preset number; if the number of unpacked data currently stored in the target cache module does not meet the preset number, storing the next unpacked data of the target unpacked data and the logical block address of the next unpacked data in the target cache module according to the splitting order of the multiple unpacked data; if the number of unpacked data currently stored in the target cache module meets the preset number, stopping the storage operation in the target cache module to obtain a target cache module storing multiple write data.
[0072] In the above optional implementation, storing the data packet and the logical block addresses of multiple data in the data packet in at least one cache module in the cache area may also include: determining a preset number based on the storage capacity of the target cache module and the size of each unpacked data.
[0073] For example, a CCB can carry three pages of data, or twelve 4KB data items. Therefore, a preset number of 12 is set. After each 4KB data item is processed, the system checks whether the current CCB has reached 12 4KB data items. If not, the CCB is considered not full, and the next 4KB data item is sorted. Once the CCB is fully populated, the data is sent to the WM module. If the data item has reached 12 4KB data items, the system determines that the CCB is full and sends the data directly to the WM module.
[0074] In some optional embodiments, according to the splitting order of multiple unpacked data, the target write data that meets a preset number and the logical block address of the target write data in the multiple unpacked data are stored in the target cache module in sequence to obtain multiple write data, including: after each splitting of the unpacked data, judging whether there is an available cache module in at least one cache module, wherein the available cache module is a cache module with available storage space; in the case that there is an available cache module in at least one cache module, determining the available cache module as the target cache module; storing the split current unpacked data and the logical block address of the current unpacked data in the target cache module to obtain the write data stored in the target cache module.
[0075] In some embodiments, after splitting a 4KB data, it is determined whether there is an available CCB in the current cache area. If there is an available CCB, the existing CCB is directly used, and the relative offset of the 4KB data in the CCB is recorded, represented by cache_entry_offset, with a value selected from 0-11.
[0076] In some optional embodiments, according to the splitting order of multiple unpacked data, the target write data that meets a preset number and the logical block addresses of the target write data in the multiple unpacked data are stored in the target cache module in sequence to obtain multiple write data, and also include: when there is no available cache module in at least one cache module, generating an application request; according to the application request, generating a new cache module in the cache area to obtain the target cache module; storing the split current unpacked data in the new cache module to obtain the write data stored in the target cache module.
[0077] In the above optional embodiment, according to the splitting order of multiple unpacked data, the target write data that meets the preset number and the logical block addresses of the target write data in the multiple unpacked data are stored in the target cache module in sequence to obtain multiple write data. It can also include: after generating a new cache module, initializing the new cache module to obtain the target cache module, wherein the target cache module has a first marking parameter, and the first marking parameter is used to indicate that the logical block addresses of the multiple write data are continuous.
[0078] In some embodiments, after splitting a 4KB data block, a check is performed to determine whether there is an available CCB in the current buffer. If not, a new CCB is requested. Specifically, the first 4KB of data in each CCB is used to request a CCB, and the remaining CCBs do not need to be requested. The CCB requested for the first 4KB of data is directly used, and so on. When requesting a CCB for the first 4KB of data, a flag value is set to 1, indicating by default that the LBAs of the 12 4KB of data in the CCB are contiguous. At the same time, first_lba is set to the LBA corresponding to the first 4KB of data.
[0079] In some optional embodiments, according to the splitting order of multiple unpacked data, whether the logical block address of the target unpacked data is continuous with the logical block address of the previous unpacked data is determined to obtain a judgment result, including: after storing the split target unpacked data and the logical block address of the target unpacked data in the target cache module, recording the relative offset parameter of the target unpacked data in the target cache module, wherein the relative offset parameter is expressed as the number of unpacked data in the target cache module that is stored before the target unpacked data; calculating the difference between the logical block address of the target unpacked data and the logical block address of the first unpacked data stored in the target cache module; judging whether the relative offset parameter is equal to the difference to obtain a judgment result.
[0080] In the above optional embodiment, when the relative offset parameter is equal to the difference value, a first marking parameter is generated, wherein the first marking parameter is used to indicate that the logical block addresses of the multiple write data are continuous; when the relative offset parameter is not equal to the difference value, a second marking parameter is generated, wherein the second marking parameter is used to indicate that the logical block addresses of the first write data and the second write data among the multiple write data are discontinuous, and the first write data and the second write data are two unpacked data adjacent in the splitting order.
[0081] In some embodiments, when each 4KB of data is allocated to a CCB, the relative offset of the 4KB of data in the CCB is recorded, represented by cache_entry_offset, with a value selected from 0 to 11. The value of cache_entry_offset corresponding to the 4KB of data is determined. If the value of cache_entry_offset is 0, it indicates that the data is the first 4KB of data in the CCB. There is no need to determine continuity or modify the flag value. The CCB is directly determined to be full. If the value of cache_entry_offset is not 0, it indicates that the data is not the first 4KB of data in the CCB. At this time, you can subtract the LBA value recorded in the cache entry of the data from the value of first_lba, and compare the difference with cache_entry_offset. If they are equal, it means that the LBA is continuous with the previous 4KB data, and there is no need to modify the flag value. If they are not equal, clear the flag value corresponding to the CCB to 0, and then determine whether the CCB has been fully stored. If it is full, send it directly to the WM module, otherwise wait until it is full before sending it to the WM module.
[0082] In the above step S204 , the plurality of write data in the buffer area is stored in the solid-state storage unit of the solid-state hard disk.
[0083] In some embodiments, the L2P table needs to be modified twice in the SSD data writing process. The second time is to write the data from the buffer to the NAND, that is, the WM module allocates a PBA to the LBA based on the received LBA, and then the WM module writes the data in the NAND based on the PBA, and points the L2P table to the NAND address through the table modification operation.
[0084] In the above step S206 , it is determined whether the logical block addresses of the plurality of written data are continuous.
[0085] In some embodiments, the WM module determines whether the LBA in a CCB is continuous. If the LBA in a CCB is identified as continuous, there is no need to loop through each write data and its LBA in the CCB, nor is there a need to read the LBA from the dynamic random access memory (DRAM) for comparison every time. Instead, the LBA in the CCB can be used to directly generate the above-mentioned mapping table at one time. Otherwise, the L2P table can be pointed to the NAND address by modifying the table according to the method in the related art.
[0086] In some optional implementations, determining whether the logical block addresses of the plurality of write data are continuous includes determining whether the target mark parameter indicates that the logical block addresses of the plurality of write data are continuous.
[0087] In the above optional embodiment, determining whether the target mark parameter indicates that the logical block addresses of multiple write data are continuous includes: determining whether the target mark parameter satisfies a preset condition, wherein the preset condition includes one of the following: the target mark parameter is a first mark parameter, and the target mark parameter is a second mark parameter, wherein the above first mark parameter is used to indicate that the logical block addresses of multiple write data are continuous, and the above second mark parameter is used to indicate that the logical block addresses of multiple write data are discontinuous.
[0088] In some embodiments, the DM module identifies whether the LBA in a CCB is continuous during the process of unpacking and processing each 4KB of data. After identification, the continuity of the LBA in the CCB can be directly told to the WM module through the mark bit. When the WM module modifies the table, it first determines whether the LBA in the CCB is continuous based on the mark bit. If it is continuous, there is no need to loop through each write data and its LBA in the CCB again, nor is there any need to read the LBA from the dynamic random access memory (DRAM) for comparison every time. Instead, the LBA in the CCB can be used to directly generate a mapping table for pointing to the NAND address at one time. Otherwise, the table can be modified according to the method in the relevant technology.
[0089] In the above steps S208 and S210, when the judgment result indicates that the logical block addresses of the multiple write data are continuous, the physical block addresses of the multiple write data in the solid-state storage unit are obtained, and based on the logical block addresses of the multiple write data and the physical block addresses of the multiple write data in the solid-state storage unit, a target mapping table is generated, and the target mapping table is used to map the logical block addresses of the multiple write data to the physical block addresses in the solid-state storage unit.
[0090] In some optional embodiments, a target mapping table is generated based on the logical block addresses of multiple write data and the physical block addresses of multiple write data in the solid-state storage unit, including: updating the first mapping table based on the physical block addresses of multiple write data in the solid-state storage unit to obtain the target mapping table.
[0091] In some embodiments, the WM module assigns a PBA to the received LBA based on the LBA, and then writes data to the NAND based on the PBA. When the data is written and the table is modified, the WM module first determines the flag corresponding to the CCB. If it is 1, the 12 old PBAs can be directly read from the L2P table. After generating the new PBA, the 12 new PBAs can be updated to the L2P table. This reduces the WM module's processing time for each CCB by 12 loops and comparisons, greatly reducing the computational pressure of the WM module. If the WM module recognizes that the flag in the CCB is 0, it continues to perform the table modification operation described in the above-mentioned related art, first looping through and determining, and modifying the table once each time a maximum continuous LBA is found, until all 12 4k tables are modified.
[0092] This embodiment adopts the above-mentioned optional implementation method, so that the WM module can give priority to judging the flag transmitted by the DM module when modifying the table. If the flag is 1, the WM module can complete the table modification operation in one go without performing a cyclic judgment. Therefore, in a continuous write scenario, the WM module can save a large number of cyclic judgment times and access to DRAM, while reducing the time of holding the lock.
[0093] The following further illustrates the method for writing data to a solid-state drive in this embodiment with reference to an optional example, as shown in FIG3 , including the following steps:
[0094] 1) After splitting a 4KB data, determine whether there is an available CCB in the current cache area. If there is an available CCB, directly use the existing CCB and record the relative offset of the 4KB data in the CCB, represented by cache_entry_offset, with a value selected from 0-11.
[0095] 2) If there is no available CCB in the current cache area, a new CCB is applied for. That is, the first 4KB data in each CCB is used to apply for the CCB. No other applications are required. The first 4KB data is directly used and used in sequence. When applying for the CCB for the first 4KB data, the flag is initialized to 1. By default, it means that the 12 LBAs are continuous. At the same time, first_lba is initialized and cache_entry_offset is set to 0.
[0096] 3) When each 4KB data is allocated to a CCB, the relative offset of the 4KB data in the CCB is recorded, represented by cache_entry_offset, with a value of 0-11.
[0097] 4) After moving the data from the host to the buffer, start updating the cache entry, modifying the L2P table, and then check the flag value. If it is 0, it means that the LBA in the CCB is no longer continuous, and directly execute step 7). Otherwise, continue to step 5).
[0098] 5) Determine the cache_entry_offset value corresponding to the 4KB data. If the cache_entry_offset value is 0, it means that the data is the first 4KB data in the CCB. There is no need to determine the continuity and modify the flag value. Go directly to step 7). Otherwise, continue to step 6).
[0099] 6) If the value of cache_entry_offset is not 0, it means that the data is not the first 4KB of data in the CCB. At this time, it is necessary to subtract the LBA value recorded in the cache entry of the data from the value of first_lba, and compare the difference with cache_entry_offset. If they are equal, it means that they are continuous and there is no need to modify the flag value. If they are not equal, the flag value is cleared to 0.
[0100] 7) After processing a 4KB data each time, it is necessary to determine whether the CCB is full. If it is full, send it directly to the WM module; otherwise, wait until it is full before sending it.
[0101] 8) When the WM module finishes writing data and modifies the table, it first checks the flag in the CCB. If it is 1, it reads 12 PBAs from the L2P table at a time, generates new PBAs, and then updates the 12 new PBAs to the L2P table.
[0102] 9) If the WM module recognizes that the flag in the CCB is 0, it continues to follow the table modification operation in the relevant technology, first looping through and judging, and modifying the table once each time a maximum continuous LBA is found until all 12 4KB data tables are modified.
[0103] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the relevant technology, can be embodied in the form of a software product, which is stored in a non-volatile readable storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of each embodiment of the present application.
[0104] This embodiment also provides a write operation device for a solid-state drive, which is configured to implement the above-mentioned embodiments and optional implementations. Details already described will not be repeated. As used below, the term "module" may refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.
[0105] FIG4 is a structural block diagram of a write operation device for a solid-state drive according to an embodiment of the present application. As shown in FIG4 , the device includes:
[0106] A first acquisition module 32 is configured to acquire logical block addresses of a plurality of write data stored in a target cache module, the target cache module being located in a cache area of the solid state drive;
[0107] The storage module 34 is configured to store the plurality of write data in the cache area into a solid-state storage unit of the solid-state hard disk;
[0108] The first determination module 36 is configured to determine whether the logical block addresses of the plurality of written data are continuous;
[0109] The second acquisition module 38 is configured to acquire the physical block addresses of the plurality of write data in the solid-state storage unit when the determination result indicates that the logical block addresses of the plurality of write data are continuous;
[0110] The first generation module 40 is configured to generate a target mapping table based on the logical block addresses of multiple write data and the physical block addresses of multiple write data in the solid-state storage unit. The target mapping table is used to map the logical block addresses of multiple write data to the physical block addresses in the solid-state storage unit.
[0111] It should be noted that the above modules can be implemented through software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0112] Through the above-mentioned module, this embodiment can first identify whether the LBAs in a cache control module (CCB) are continuous during the write operation of the solid-state drive, based on the characteristics that the logical block address (LBA) in a cache control module (CCB) is continuous, and the characteristics that the data packet carried by a command needs to be split into multiple write data for processing during the write operation. If continuous, there is no need to loop through each write data and its LBA in the CCB again, nor is it necessary to read the LBA from the dynamic random access memory (DRAM) for comparison every time. Instead, the LBA in the CCB can be used to directly generate the above-mentioned mapping table in one go. Therefore, it can solve the problem in the related art that a large number of loop judgments and accesses to DRAM greatly affect the write operation performance of the solid-state drive, thereby achieving the effect of improving the write operation performance of the solid-state drive.
[0113] In some optional embodiments, the above-mentioned first acquisition module 32 includes: a first acquisition sub-module, which is configured to obtain the data packet carried by the target command and the logical block address of each data in the data packet from the host; a first storage sub-module, which is configured to store the data packet and the logical block addresses of multiple data in the data packet in at least one cache module in the cache area, and the at least one cache module includes a target cache module; a second acquisition sub-module, which is configured to obtain the logical block addresses of multiple data stored in the target cache module.
[0114] In some optional embodiments, the above-mentioned device in this embodiment also includes: a splitting module, which is configured to split multiple data in the data packet in sequence to obtain multiple unpacked data; a second judgment module, which is configured to judge whether the logical block address of the target unpacked data is continuous with the logical block address of the previous unpacked data according to the splitting order of the multiple unpacked data, and obtain a judgment result; a generation module, which is configured to generate a target mark parameter of the target cache module according to the judgment result, wherein the target mark parameter is used to indicate whether the logical block address of the target unpacked data is continuous with the logical block address of the previous unpacked data.
[0115] In some optional implementations, the second judgment module includes: judging whether the logical block address of the Nth unpacked data and the logical block address of the N-1th unpacked data are continuous according to the splitting order of the multiple unpacked data, to obtain a judgment result.
[0116] In some optional embodiments, the above-mentioned generation module includes: a first update sub-module, which is configured to update the prior mark parameter in the target cache module to the target mark parameter based on the judgment result, wherein the prior mark parameter is used to indicate whether the logical block address of the N-1th unpacked data is continuous with the logical block address of the N-2th unpacked data.
[0117] In some optional embodiments, the above-mentioned first update sub-module includes: a first generation sub-module, which is configured to generate a first marking parameter according to the first judgment result when a first judgment result is obtained, and update the previous marking parameter to the first marking parameter, wherein the first judgment result is a judgment result obtained when the logical block address of the Nth unpacked data and the logical block address of the N-1th unpacked data are continuous; a second generation sub-module, which is configured to generate a second marking parameter according to the second judgment result when a second judgment result is obtained, and update the previous marking parameter to the second marking parameter, wherein the second judgment result is a judgment result obtained when the logical block address of the Nth unpacked data and the logical block address of the N-1th unpacked data are not continuous.
[0118] In some optional implementations, the splitting module includes: splitting multiple data in the data packet in sequence to obtain multiple unpacked data with the same size.
[0119] In some optional embodiments, the above-mentioned first storage sub-module includes: a second storage sub-module, which is configured to store the unpacked data that meets a preset number of unpacked data and the logical block addresses that meet a preset number of unpacked data in the target cache module in sequence according to the splitting order of the multiple unpacked data, to obtain multiple write data.
[0120] In some optional embodiments, the above-mentioned second storage submodule includes: a third storage submodule, which is configured to store the target unpacked data and the logical block address of the target unpacked data in the target cache module; a first judgment submodule, which is configured to judge whether the number of unpacked data currently stored in the target cache module meets the preset number; a fourth storage submodule, which is configured to store the next unpacked data of the target unpacked data and the logical block address of the next unpacked data in the target cache module according to the splitting order of multiple unpacked data when the number of unpacked data currently stored in the target cache module does not meet the preset number; a stop submodule, which is configured to stop the storage operation in the target cache module when the number of unpacked data currently stored in the target cache module meets the preset number, thereby obtaining a target cache module storing multiple write data.
[0121] In some optional implementations, the first storage submodule further includes: determining a preset number according to the storage capacity of the target cache module and the size of each unpacked data.
[0122] In some optional embodiments, the above-mentioned second storage sub-module includes: a second judgment sub-module, which is configured to judge whether there is an available cache module in at least one cache module after each splitting of unpacked data, wherein the available cache module is a cache module with available storage space; a first determination sub-module, which is configured to determine that the available cache module is the target cache module when there is an available cache module in at least one cache module; a fifth storage sub-module, which is configured to store the split current unpacked data and the logical block address of the current unpacked data in the target cache module, and obtain the write data stored in the target cache module.
[0123] In some optional embodiments, the above-mentioned second storage sub-module also includes: a third generation sub-module, which is configured to generate an application request when there is no available cache module in at least one cache module; a fourth generation sub-module, which is configured to generate a new cache module in the cache area according to the application request to obtain a target cache module; and a sixth storage sub-module, which is configured to store the split current unpacked data in the new cache module to obtain write data stored in the target cache module.
[0124] In some optional embodiments, the above-mentioned second storage sub-module also includes: after generating a new cache module, initializing the new cache module to obtain a target cache module, wherein the target cache module has a first marking parameter, and the first marking parameter is used to indicate that the logical block addresses of multiple write data are continuous.
[0125] In some optional embodiments, the above-mentioned second judgment module includes: a recording submodule, which is configured to record the relative offset parameter of the target unpacked data in the target cache module after storing the split target unpacked data and the logical block address of the target unpacked data in the target cache module, wherein the relative offset parameter is expressed as the number of unpacked data stored in the target cache module before the target unpacked data; a calculation submodule, which is configured to calculate the difference between the logical block address of the target unpacked data and the logical block address of the first unpacked data stored in the target cache module; a third judgment submodule, which is configured to judge whether the relative offset parameter is equal to the difference to obtain a judgment result.
[0126] In some optional embodiments, the above-mentioned generation module includes: a fifth generation sub-module, which is configured to generate a first marking parameter when the relative offset parameter is equal to the difference value, wherein the first marking parameter is used to indicate that the logical block addresses of multiple write data are continuous; a sixth generation sub-module, which is configured to generate a second marking parameter when the relative offset parameter is not equal to the difference value, wherein the second marking parameter is used to indicate that the logical block addresses of the first write data and the second write data among the multiple write data are discontinuous, and the first write data and the second write data are two unpacked data adjacent in the splitting order.
[0127] In some optional implementations, the first determination module includes: a fourth determination submodule configured to determine whether the target mark parameter indicates that the logical block addresses of the plurality of write data are continuous.
[0128] In some optional embodiments, the above-mentioned fourth judgment submodule includes: a fifth judgment submodule, which is configured to determine whether the target mark parameter meets a preset condition, wherein the preset condition includes one of the following: the target mark parameter is a first mark parameter, and the target mark parameter is a second mark parameter, wherein the first mark parameter is used to indicate that the logical block addresses of multiple write data are continuous, and the second mark parameter is used to indicate that the logical block addresses of multiple write data are discontinuous.
[0129] In some optional embodiments, the above-mentioned device in this embodiment also includes: a third acquisition module, which is configured to obtain the physical block addresses of multiple write data in the cache area; a second generation module, which is configured to generate a first mapping table based on the logical block addresses of multiple write data and the physical block addresses of multiple write data in the cache area, and the first mapping table is used to map the logical block addresses of multiple write data to the physical block addresses in the cache area.
[0130] In an exemplary embodiment, the first generating module includes: updating the first mapping table according to the physical block addresses of the plurality of write data in the solid-state storage unit to obtain the target mapping table.
[0131] An embodiment of the present application further provides a non-volatile readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps of any of the above method embodiments when running.
[0132] In an exemplary embodiment, the non-volatile readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.
[0133] An embodiment of the present application further provides a solid-state hard disk, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any of the above method embodiments.
[0134] In an exemplary embodiment, the solid-state drive may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0135] For optional examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementations, and this embodiment will not be described in detail here.
[0136] Obviously, those skilled in the art should understand that the modules or steps of the present application described above can be implemented using a general-purpose computing device, they can be concentrated on a single computing device, or distributed across a network composed of multiple computing devices, they can be implemented using program code executable by the computing device, and thus, they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be performed in a different order than herein, or they can be fabricated into separate integrated circuit modules, or multiple modules or steps can be fabricated into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0137] The above are merely optional embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may be subject to various modifications and variations. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A method for writing data to a solid state hard disk, characterized in that: include: Acquire logical block addresses of a plurality of write data stored in a target cache module, wherein the target cache module is located in a cache area of the solid state drive; storing the plurality of write data in the cache area in a solid-state storage unit of the solid-state hard disk; Determining whether the plurality of logical block addresses of the written data are continuous; If the determination result indicates that the logical block addresses of the plurality of write data are continuous, obtaining the physical block addresses of the plurality of write data in the solid-state storage unit; A target mapping table is generated according to the logical block addresses of the plurality of write data and the physical block addresses of the plurality of write data in the solid-state storage unit, wherein the target mapping table is used to map the logical block addresses of the plurality of write data to the physical block addresses in the solid-state storage unit.
2. The method according to claim 1, characterized in that The acquiring of logical block addresses of a plurality of write data stored in a target cache module, wherein the target cache module is located in a cache area of the solid state drive, comprises: Obtaining a data packet carried by a target command and a logical block address of each data in the data packet from a host; storing the data packet and the logical block addresses of the plurality of data in the data packet in at least one cache module in the cache area, wherein the at least one cache module includes the target cache module; The logical block addresses of the plurality of data stored in the target cache module are obtained.
3. The method according to claim 2, characterized in that Also includes: Sequentially splitting the multiple data in the data packet to obtain multiple unpacked data; According to the splitting order of the plurality of unpacked data, determining whether the logical block address of the target unpacked data is continuous with the logical block address of the previous unpacked data, and obtaining the determination result; According to the determination result, a target mark parameter of the target cache module is generated, wherein the target mark parameter is used to indicate whether the logical block address of the target unpacked data is continuous with the logical block address of the previous unpacked data.
4. The method according to claim 3, characterized in that The step of determining whether the logical block address of the target unpacked data is continuous with the logical block address of the previous unpacked data according to the splitting order of the plurality of unpacked data, and obtaining the determination result comprises: According to the splitting order of the plurality of unpacked data, it is determined whether the logical block address of the Nth unpacked data is continuous with the logical block address of the N1th unpacked data to obtain the determination result.
5. The method according to claim 4, characterized in that Generating the target marking parameter of the target cache module according to the judgment result includes: According to the judgment result, the previous mark parameter in the target cache module is updated to the target mark parameter, wherein the previous mark parameter is used to indicate whether the logical block address of the N1th unpacked data is continuous with the logical block address of the N-2th unpacked data.
6. The method according to claim 5, characterized in that The updating, according to the judgment result, of the previous marking parameter in the target cache module to the target marking parameter comprises: In the case where a first judgment result is obtained, a first marking parameter is generated according to the first judgment result, and the previous marking parameter is updated to the first marking parameter, wherein the first judgment result is a judgment result obtained when the logical block address of the Nth unpacked data is continuous with the logical block address of the N1th unpacked data; When a second judgment result is obtained, a second marking parameter is generated according to the second judgment result, and the previous marking parameter is updated to the second marking parameter, wherein the second judgment result is a judgment result obtained when the logical block address of the Nth unpacked data is discontinuous with the logical block address of the N1th unpacked data.
7. The method according to claim 3, characterized in that Sequentially splitting the multiple data in the data packet to obtain the multiple unpacked data includes: The multiple data in the data packet are split in sequence to obtain the multiple depacketized data with the same size.
8. The method according to claim 3, characterized in that The storing of the data packet and the logical block addresses of the plurality of data in the data packet in at least one cache module in the cache area comprises: According to the splitting order of the multiple unpacked data, the unpacked data that meets the preset number among the multiple unpacked data and the logical block addresses of the unpacked data that meets the preset number are sequentially stored in the target cache module to obtain the multiple write data.
9. The method according to claim 8, characterized in that The step of sequentially storing the unpacked data that meets a preset number of the unpacked data and the logical block addresses of the unpacked data that meets the preset number of the unpacked data in the target cache module according to the splitting order of the multiple unpacked data to obtain the multiple write data includes: storing the target unpacked data and the logical block address of the target unpacked data in the target cache module; Determining whether the amount of unpacked data currently stored in the target cache module meets the preset amount; When the number of unpacked data currently stored in the target cache module does not meet the preset number, storing the next unpacked data of the target unpacked data and the logical block address of the next unpacked data in the target cache module according to the splitting order of the multiple unpacked data; When the number of unpacked data currently stored in the target cache module meets the preset number, the storage operation in the target cache module is stopped to obtain the target cache module storing the multiple write data.
10. The method according to claim 8, characterized in that The storing of the data packet and the logical block addresses of the plurality of data in the data packet in at least one cache module in the cache area further includes: The preset number is determined according to the storage capacity of the target cache module and the size of each of the unpacked data.
11. The method according to claim 8, characterized in that The method of sequentially storing the target write data that meets a preset number and the logical block addresses of the target write data in the target cache module according to the splitting order of the multiple unpacked data to obtain the multiple write data includes: After splitting out the unpacked data each time, determining whether there is an available cache module in the at least one cache module, wherein the available cache module is a cache module with available storage space; In the case where the available cache module exists in the at least one cache module, determining the available cache module as the target cache module; The split current unpacked data and the logical block address of the current unpacked data are stored in the target cache module to obtain the write data stored in the target cache module.
12. The method according to claim 11, characterized in that The method further comprises: storing the target write data that meets a preset number in the multiple unpacked data and the logical block addresses of the target write data in the target cache module in sequence according to the splitting order of the multiple unpacked data to obtain the multiple write data; In the case that the available cache module does not exist in the at least one cache module, generating an application request; According to the application request, a new cache module is generated in the cache area to obtain the target cache module; The split current unpacked data is stored in the new cache module to obtain the write data stored in the target cache module.
13. The method according to claim 12, characterized in that The step of sequentially storing the target write data that meets a preset number and the logical block addresses of the target write data in the target cache module according to the splitting order of the multiple unpacked data, and obtaining the multiple write data further includes: After the new cache module is generated, the new cache module is initialized to obtain the target cache module, wherein the target cache module has a first marking parameter, and the first marking parameter is used to indicate that the logical block addresses of the plurality of write data are continuous.
14. The method according to any one of claims 3 to 13, characterized in that The step of determining whether the logical block address of the target unpacked data is continuous with the logical block address of the previous unpacked data according to the splitting order of the plurality of unpacked data, and obtaining the determination result comprises: After storing the split target unpacked data and the logical block address of the target unpacked data in the target cache module, the relative offset parameter of the target unpacked data in the target cache module is recorded, wherein the relative offset parameter is represented by the target cache The number of unpacked data stored in the module that precedes the target unpacked data in order; Calculating a difference between a logical block address of the target unpacked data and a logical block address of the first unpacked data stored in the target cache module; It is determined whether the relative offset parameter is equal to the difference value to obtain the determination result.
15. The method according to claim 14, characterized in that Generating the target marking parameter of the target cache module according to the judgment result includes: In the case where the relative offset parameter is equal to the difference value, generating a first marking parameter, wherein the first marking parameter is used to indicate that the logical block addresses of the plurality of write data are continuous; When the relative offset parameter is not equal to the difference value, a second marking parameter is generated, wherein the second marking parameter is used to indicate that the logical block addresses of the first write data and the second write data among the multiple write data are discontinuous, and the first write data and the second write data are two unpacked data adjacent in the splitting sequence.
16. The method according to claim 15, characterized in that The determining whether the logical block addresses of the plurality of written data are continuous comprises: It is determined whether the target mark parameter indicates that the logical block addresses of the plurality of write data are continuous.
17. The method according to claim 16, characterized in that The determining whether the target mark parameter indicates that the logical block addresses of the plurality of write data are continuous includes: Determine whether the target marking parameter satisfies a preset condition, wherein the preset condition includes one of the following: the target marking parameter is a first marking parameter, and the target marking parameter is a second marking parameter, wherein the first marking parameter is used to indicate that the logical block addresses of the multiple write data are continuous, and the second marking parameter is used to indicate that the logical block addresses of the multiple write data are discontinuous.
18. The method according to claim 1, characterized in that Also includes: Obtaining physical block addresses of the plurality of write data in the cache area; A first mapping table is generated according to the logical block addresses of the plurality of write data and the physical block addresses of the plurality of write data in the cache area, wherein the first mapping table is used to map the logical block addresses of the plurality of write data to the physical block addresses in the cache area.
19. The method according to claim 18, characterized in that The generating a target mapping table according to the logical block addresses of the plurality of write data and the physical block addresses of the plurality of write data in the solid-state storage unit comprises: The first mapping table is updated according to the physical block addresses of the plurality of write data in the solid-state storage unit to obtain the target mapping table.
20. A write operation device for a solid state hard disk, characterized in that: include: A first acquisition module is configured to acquire a plurality of logical block addresses of write data stored in a target cache module, wherein the target cache module is located in a cache area of the solid state drive; A storage module, configured to store the plurality of write data in the cache area into a solid-state storage unit of the solid-state hard disk; A determination module, configured to determine whether the logical block addresses of the plurality of written data are continuous; A second acquisition module is configured to acquire physical block addresses of the plurality of write data in the solid-state storage unit when the judgment result indicates that the logical block addresses of the plurality of write data are continuous; A generation module is configured to generate a target mapping table based on the logical block addresses of the multiple write data and the physical block addresses of the multiple write data in the solid-state storage unit, wherein the target mapping table is used to map the logical block addresses of the multiple write data to the physical block addresses in the solid-state storage unit.
21. A non-volatile readable storage medium, characterized in that: The non-volatile readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 1 to 19 when executed by a processor.
22. A solid state drive comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the method described in any one of claims 1 to 19 are implemented.
Citation Information
Patent Citations
Array controller, solid state disk and data writing control method for solid state disk
CN107209719A
Solid state disk and address mapping method thereof
CN112486852A
Data writing method and device for solid state disk and solid state disk
CN116340198A
Cited By
Optical fiber communication data interaction processing method and device
CN119718680A
Construction method, device, storage device and electronic device for storing data in hard disk
CN119781698A
