Data writing method and device, equipment and storage medium
By extracting and padding the initial data when a misalignment of the starting logical address is detected, the problem of frequent writing and low reading efficiency of small data fragments is solved, achieving more efficient data writing and improving the smoothness of the system.
Patent Information
- Application Number
- CN202410529823.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-29
- Publication Date
- 2024-11-08
AI Technical Summary
In existing technologies, frequent write and read operations on small data fragments lead to low data writing efficiency and affect system smoothness.
When a misalignment of the starting logical address is detected, the complete initial data is extracted and padded to avoid subsequent read operations. The initial data is directly used to padded the data that is misaligned at the ending logical address.
It improves data writing efficiency, especially in the random writing performance of small data fragments, thereby increasing IOPS.
Smart Images

Figure CN118915960A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of storage technology, and in particular to a data writing method, device, equipment and storage medium. Background Art
[0002] Flash Memory is an electrically erasable programmable read-only memory that has the characteristics of non-volatility, fast read and write speed, shock resistance, and small size. It is widely used in mobile devices, computers, scientific research / medical equipment and other fields.
[0003] Due to the physical characteristics of flash memory, data is written from the host to the flash memory in pages. If the amount of data to be written is less than one page, the data that is currently less than one page needs to be padded and then written to the flash memory. These data with an amount close to one page are called small fragment data.
[0004] Flash memory is generally installed in storage devices. When the host's operating system is running, it will continuously read or write system operation files, logs, and software from the storage device. Generally speaking, the reading and writing of small fragments of data accounts for a large proportion, so the reading and writing performance of small fragments of data can directly affect the smoothness of system operation.
[0005] In the current technology, whenever it is detected that a small fragment of data needs to be supplemented, read, modify, and write operations are performed in the storage device to supplement the data that is less than one page. In particular, when a small fragment of data needs to be supplemented twice, two data reads are required. In the actual use of the storage device, data writing is performed frequently, and this method of data writing affects the efficiency of data writing. Summary of the invention
[0006] The following is a summary of the subject matter described in detail herein. This summary is not intended to limit the scope of the claims.
[0007] The embodiments of the present invention provide a data writing method, apparatus, device and storage medium, which can improve the efficiency of data writing by extracting complete initial data when the first misaligned data needs to be padded, so that when the second misaligned data needs to be padded, the initial data can be directly used to padded the second misaligned data without reading the data again.
[0008] In a first aspect, an embodiment of the present application provides a data writing method, the method comprising: obtaining a logical mapping unit; obtaining first unaligned data, the first unaligned data being data with an unknown writing length and an unaligned starting logical address; extracting initial data according to the first unaligned data and the logical mapping unit, and padding the first unaligned data based on the initial data; writing the padded first unaligned data into a cache to obtain second unaligned data, the second unaligned data being data with an unaligned ending logical address; padding the second unaligned data based on the initial data to obtain aligned data; and writing the aligned data into a memory.
[0009] In a second aspect, an embodiment of the present application provides a data writing device, comprising: an acquisition module, used to acquire a logical mapping unit, and acquire first unaligned data, wherein the first unaligned data is data with an unknown write length and an unaligned starting logical address; a first padding module, used to extract initial data according to the first unaligned data and the logical mapping unit, and pad the first unaligned data based on the initial data; a cache module, used to write the padded first unaligned data into a cache to obtain second unaligned data, wherein the second unaligned data is data with an unaligned ending logical address; a second padding module, used to pad the second unaligned data based on the initial data to obtain aligned data; and a writing module, used to write the aligned data into a memory.
[0010] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the data writing method of the first aspect when executing the computer program.
[0011] In a fourth aspect, an embodiment of the present application provides a storage medium, which is a computer-readable storage medium, and the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute: the data writing method of the first aspect.
[0012] The embodiments of the present application provide a data writing method, apparatus, device and storage medium, by obtaining a logical mapping unit and a first unaligned data, the first unaligned data is data with an unknown write length and an unaligned starting logical address, extracting initial data according to the first unaligned data and the logical mapping unit, and padding the first unaligned data based on the initial data, in the case of an unknown write length, pre-extracting the complete initial data, and then writing the padded first unaligned data into a cache to obtain second unaligned data, the second unaligned data is data with an unaligned ending logical address, padding the second unaligned data based on the initial data to obtain aligned data, after determining that the ending logical address is unaligned, directly using the pre-extracted initial data to pad the data without spending extra time to read the data again, thereby improving the efficiency of data writing, and finally writing the aligned data into a memory.
[0013] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The present application is further described below with reference to the accompanying drawings and embodiments, wherein:
[0015] Figure 1 A flowchart of a data writing method provided in one embodiment of the present application;
[0016] Figure 2 yes Figure 1 A specific method flow chart of step S200;
[0017] Figure 3 yes Figure 1 A specific method flow chart of step S300;
[0018] Figure 4 yes Figure 1 A specific method flow chart of step S400;
[0019] Figure 5 yes Figure 4 A specific method flow chart of step S420;
[0020] Figure 6 This is a first experimental data comparison diagram of a data writing method provided by an embodiment of the present application;
[0021] Figure 7 This is a second experimental data comparison chart of the data writing method provided in one embodiment of the present application. DETAILED DESCRIPTION
[0022] In the following description, specific details such as specific system structures, technologies, etc. are proposed for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the embodiments of the present application can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from hindering the description of the embodiments of the present application.
[0023] It should be noted that although a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than that in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0024] It should also be understood that the references to "one embodiment" or "some embodiments" described in the specification of the embodiments of the present application mean that one or more embodiments of the embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Thus, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0025] Below, some terms in this application are explained to facilitate understanding by those skilled in the art.
[0026] Logical Block Address (LBA): It is a common mechanism for describing the block where data is located on a computer storage device. LBA can refer to a data block or a data block referred to by an address.
[0027] Start logical address (Start LBA): refers to the starting position of the sector, the first LBA sector number.
[0028] End logical address (End LBA): refers to the end position of the sector, the last LBA sector number.
[0029] IOPS (Input / Output Operations Per Second): IOPS is a measurement method used to test the performance of computer storage devices, which can be regarded as the number of reads and writes per second.
[0030] Flash memory is a long-life non-volatile memory. It is widely used in daily life due to its small size, light weight, easy to carry, and fast speed, such as mobile phones, computers and many other mobile storage devices. With the development of the data age, various manufacturers are committed to further improving the data transmission speed.
[0031] In storage device products equipped with flash memory, due to the physical characteristics of flash memory, data is written to the flash memory in pages. If the amount of data to be written to the flash memory is less than one page, the data to be written must be padded according to the minimum mapping unit managed by the algorithm, and then the padded data is written to the flash memory. These data amounts close to one page are called small fragment data.
[0032] When the operating system is actually running, system operation files, logs, and software currently being used by users are continuously written and read from the storage device. The reading and writing of small fragments of data account for a large proportion, and therefore many situations will occur where data needs to be filled in. The performance processing of reading and writing small fragments of data can directly affect the smoothness of the system. How to improve the write and read workload throughput per second (IOPS) of small fragments of data is a problem that needs to be solved.
[0033] In the prior art, when it is accurately determined that the starting logical address is not aligned, the missing data is extracted to perform a filling operation, and when it is determined that the ending logical address is not aligned, the missing data is extracted again to perform a filling operation. However, in the actual use of the storage device, data is frequently written, and multiple read operations will lead to a decrease in write efficiency, affecting the smoothness of the system.
[0034] Based on this, the present application provides a data writing method, apparatus, device and storage medium, by extracting complete initial data when the first misaligned data needs to be filled, that is, when the starting logical address is misaligned, so that when the second misaligned data needs to be filled, that is, when the ending logical address is misaligned, the initial data can be directly used to fill the second misaligned data without the need to read the data again, which can effectively improve the efficiency of data writing.
[0035] The following is combined with Figure 1 , and further elaborate on the relevant technologies.
[0036] like Figure 1 As shown, Figure 1 is a flow chart of a data writing method provided in an embodiment of the present application. The data writing method in this embodiment includes at least but is not limited to the following steps:
[0037] Step S100: obtaining a logical mapping unit;
[0038] In some embodiments, obtaining the logical mapping unit includes obtaining a minimum unit of logical address mapping. In other words, the logical mapping unit represents a minimum mapping unit.
[0039] In some embodiments, the minimum unit of logical address mapping is generally 4KB (Ki lo Bytes). In the storage protocol, the common representation is that, assuming the storage capacity of a storage device is n*512Bytes, the device can be logically divided into LBA 0 to LBA N-1 512Bytes. Under the management of the algorithm, the data volume of the minimum mapping unit will be defined, and all logical bytes will be divided into the minimum mapping unit for management. The current mainstream minimum mapping unit data volume size is 4KB.
[0040] In some embodiments, data to be written must be aligned to the logical mapping unit before being written into the flash memory.
[0041] Step S200: Acquire first unaligned data, where the first unaligned data is data with an unknown write length and an unaligned start logical address;
[0042] In some embodiments, the present application is applicable to a storage device equipped with flash memory. Before writing data from the storage device to the flash memory, it is necessary to first determine whether the data to be written is aligned data. If it is unaligned data, it must be padded to form aligned data before the data can be written to the flash memory.
[0043] In some embodiments, Figure 2 FIG. 1 is a specific flow chart of step S200, which specifically includes:
[0044] Step S210: receiving a write command, the write command including a starting logical address;
[0045] In some embodiments, the write command is a random write command.
[0046] In some embodiments, the host's operating system sends a write command to the storage device to indicate that data needs to be written to the storage device. Generally speaking, the parameters of the storage write instruction include a starting logical address (Start LBA) and a write length (Length). The starting logical address indicates which sector the data starts to be written from, that is, the address of the first sector. The ending logical address (End LBA) can be calculated based on the starting logical address and the write length. The ending logical address indicates which sector the data will eventually be written to after being written, that is, the address of the last sector. The calculation method of the ending logical address is: ending logical address = starting logical address + (write length - 1).
[0047] In some other embodiments, in the protocol specifications of emmc and SD, it is also possible to allow a storage write command to include only a starting logical address without pre-specifying a write length. The write command described in this application does not include a write length.
[0048] Step S220: performing alignment judgment on the starting logical address according to the logical mapping unit, if the starting logical address is not aligned with the logical mapping unit, determining the data corresponding to the starting logical address as the first unaligned data;
[0049] In some embodiments, a storage write command is regarded as starting to write from a certain logical mapping unit, and the sector position where the writing ends may be in the same logical mapping unit or in another logical mapping unit.
[0050] In some embodiments, according to the difference between the starting logical address and the ending logical address, the alignment result of the starting logical address is divided into two cases: alignment and misalignment, and the alignment result of the ending logical address is also divided into two cases: alignment and misalignment.
[0051] In some embodiments, the logic mapping unit includes a plurality of standard logic mapping units, and a single logic mapping unit can control hard disk sectors through a plurality of standard logical addresses.
[0052] In an embodiment of the present application, the starting logical address is aligned and compared with the logical mapping unit to obtain the number of standard logical addresses included in a single logical mapping unit. The calculation method is to divide the starting logical address by the number of standard logical addresses. If there is no remainder, it is determined that the starting logical address is aligned with the logical mapping unit. If there is a remainder, it is determined that the starting logical address is not aligned with the logical mapping unit, and the data corresponding to the starting logical address is determined as the first unaligned data.
[0053] In some embodiments, the logical mapping unit is 4KB, and 8 512-Byte hard disk sectors are controlled by 8 standard logical addresses. Therefore, when determining whether the starting logical address is aligned with the logical mapping unit, the starting logical address is divided by 8 for calculation.
[0054] Step S300: extracting initial data according to the first misaligned data and the logical mapping unit, and completing the first misaligned data based on the initial data;
[0055] In some embodiments, Figure 3 FIG. 1 is a specific flow chart of step S300, which specifically includes the following steps:
[0056] Step S310: Obtain the standard length of the logical mapping unit;
[0057] Step S320: Reading initial data having the same length as the standard length by calling a read command according to the starting logical address of the first unaligned data.
[0058] In step S310 and step S320, the extracted initial data is a piece of completely aligned data, and according to the minimum mapping unit, the length of the initial data is the same as the standard length.
[0059] In some embodiments, the starting logical address of the first unaligned data is unaligned, and the missing data is called front-end missing data, and the initial data and the first unaligned data are in a corresponding relationship. In other words, the initial data is the original data, and the first unaligned data is actually the data that needs to be updated, so by extracting part of the initial data corresponding to the front-end missing data from the complete initial data, and filling the first unaligned data according to the part of the initial data, the starting logical address of the first unaligned data is aligned with the logical mapping unit, so that the integrity of the written data can be guaranteed.
[0060] In some embodiments, by executing a read command, namely a NAND-flash read command, the corresponding initial data is read according to the starting logical address of the first unaligned data, so that the complete initial data can be read out in advance for use in subsequent determination of the end logical address misalignment.
[0061] Step S400: writing the padded first misaligned data into the cache to obtain second misaligned data, where the second misaligned data is data ending the misalignment of the logical address;
[0062] In some embodiments, Figure 4 FIG. 4 is a specific flow chart of step S400, which specifically includes the following steps:
[0063] Step S410: writing the padded first misaligned data into the cache to obtain cache data;
[0064] In some embodiments, the padded first unaligned data is continuously written into the cache starting from the current starting logical address until a stop write command is received, then the cache stops receiving data and determines the received data as cache data.
[0065] Step S420: Obtain the end logical address of the cache data;
[0066] In some embodiments, before the data is finally written into the flash memory, it must be ensured that the starting logical address and the ending logical address of the data are aligned, and after the data is written into the cache, the length of the written data is already determined. Figure 5 FIG. 4 is a specific flow chart of step S420, which specifically includes the following steps:
[0067] Step S421: Obtain the write length of the cache data;
[0068] Step S422: Calculate the starting logical address and the write length to obtain the ending logical address.
[0069] In step S421 and step S422, after the data is written into the cache, the write length of the cache data can be read, and the end logical address can be calculated based on the starting logical address and the write length by the formula: end logical address = starting logical address + (write length - 1).
[0070] Step S430: performing alignment judgment on the end logical address according to the logical mapping unit, if the end logical address is not aligned with the logical mapping unit, determining the cached data as second unaligned data.
[0071] In some embodiments, the alignment determination method of the end logical address is the same as the alignment determination method of the start logical address. The end logical address is aligned with the logical mapping unit for comparison. If the end logical address is aligned with the logical mapping unit, it means that the start logical address and the end logical address of the cached data are both aligned with the logical mapping unit. At this time, the cached data is a complete data that meets the writing standard, so the cached data can be directly written into the flash memory; if the end logical address is not aligned with the logical mapping unit, the unaligned cached data is determined as the second unaligned data, and its missing data is called back-end missing data.
[0072] Step S500: Filling the second misaligned data based on the initial data to obtain aligned data;
[0073] In an embodiment of the present application, when determining that the starting logical address is not aligned with the logical mapping unit, the complete initial data has been extracted in advance. Therefore, after determining that the ending logical address is not aligned with the logical mapping unit, the partial initial data corresponding to the missing data of the back end can be directly extracted from the complete initial data, and the second misaligned data can be completed according to the partial initial data, so that the ending logical address of the second misaligned data is aligned with the logical mapping unit, without spending time again to read the missing part of the initial data, which can effectively improve IOPS.
[0074] In some embodiments, because the write command includes a starting logical address and the write length is unknown, the end logical address cannot be calculated in advance when determining whether the starting logical address is aligned with the logical mapping unit for the first time, and thus it is impossible to determine whether the end logical address is aligned with the logical mapping unit. In the current technology, if it is determined that the starting logical address is not aligned with the logical mapping unit, only the initial data corresponding to the front-end missing data is read, while in the present application, the complete initial data is read out while determining that the starting logical address is not aligned with the logical mapping unit, so as to facilitate the subsequent completion of the back-end missing data and improve the writing performance of small fragments of data.
[0075] Step S600: writing the alignment data into the memory.
[0076] In some embodiments, data whose start logical address and end logical address are both aligned with the logical mapping unit is called aligned data, and the data writing operation is completed by writing the aligned data from the cache into the flash memory.
[0077] In some embodiments, Figure 6 and Figure 7 As shown, two experimental data comparison diagrams of the data writing method provided in the embodiment of the present application are shown, where pre-filed=0 indicates data without reading the complete initial data, and pre-filed=1 indicates data with the complete initial data pre-read.
[0078] in, Figure 6 This is a test comparison chart using 4KB random write. Figure 7 This is a test comparison chart using 512Bytes random write. The test time is 20 minutes, and the average IOPS is recorded every 30 seconds. It can be seen from the experimental data comparison chart that the use of the data writing method of the present application does not affect the performance of 4KB random write, but in the 512Bytes random write performance, the method of pre-reading the complete initial data used in the present application is 3 to 6 percentage points higher in IOPS than the method without pre-reading the complete initial data. This shows that using the method of the present application for data writing can improve the random writing efficiency of non-continuous small fragments of data.
[0079] An embodiment of the present application also provides a device for writing data, which specifically includes an acquisition module, a first padding module, a cache module, a second misaligned module and a writing module, wherein the acquisition module is used to acquire a logical mapping unit, and is also used to acquire first misaligned data, the first misaligned data being data with an unknown write length and misaligned logical addresses; the first padding module is used to extract initial data according to the first misaligned data and the logical mapping unit, and pad the first misaligned data based on the initial data; the cache module is used to write the padded first misaligned data into a cache to obtain second misaligned data, the second misaligned data being data that ends the misalignment of logical addresses; the second misaligned module is used to pad the second misaligned data based on the initial data to obtain aligned data; and the writing module is used to write the aligned data into a memory.
[0080] The specific content has been described in detail in the embodiment of the above data writing method, so it will not be repeated in this embodiment.
[0081] An embodiment of the present application further provides an electronic device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor is capable of executing the computer program to implement the data writing method as described above.
[0082] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via 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 combinations thereof.
[0083] The non-transitory software program and instructions required to implement the image processing method of the above embodiment are stored in the memory, and when executed by the processor, the data writing method of the above embodiment is executed.
[0084] The network element embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place, or they may be distributed on multiple network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0085] An embodiment of the present application further provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute the data writing method of the above embodiment.
[0086] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via 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 combinations thereof.
[0087] The mobile communication device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0088] It will be appreciated by those skilled in the art that all or some of the steps and systems in the disclosed method above may be implemented as software, firmware, hardware and appropriate combinations thereof. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor or a microprocessor, or may be implemented as hardware, or may be implemented as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or a non-transitory medium) and a communication medium (or a temporary medium). As known to those skilled in the art, the term computer storage medium 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 include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that may be used to store desired information and may be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0089] The above is a specific description of the preferred implementation of the present application, but the present application is not limited to the above-mentioned implementation mode. Technical personnel familiar with the field can also make various equivalent deformations or substitutions without violating the spirit of the present application. These equivalent deformations or substitutions are all included in the scope defined by the claims of the present application.
Claims
1. A data writing method, characterized in that: include: Get the logical mapping unit; Acquire first unaligned data, where the first unaligned data is data with unknown write length and unaligned start logical address; extracting initial data according to the first unaligned data and the logical mapping unit, and completing the first unaligned data based on the initial data; Writing the padded first misaligned data into the cache to obtain second misaligned data, where the second misaligned data is data ending the misalignment of the logical address; Filling the second misaligned data based on the initial data to obtain aligned data; The alignment data is written to a memory.
2. A data writing method according to claim 1, characterized in that: The step of obtaining the first unaligned data comprises the following steps: receiving a write command, wherein the write command includes a starting logical address; An alignment judgment is performed on the start logical address according to the logic mapping unit. If the start logical address is not aligned with the logic mapping unit, data corresponding to the start logical address is determined as first unaligned data.
3. A data writing method according to claim 1, characterized in that: The extracting of initial data according to the first unaligned data and the logical mapping unit comprises the steps of: Obtaining the standard length of the logical mapping unit; According to the starting logical address of the first unaligned data, initial data having the same length as the standard length is read by calling a read command.
4. A data writing method according to claim 1, characterized in that: The method of writing the padded first misaligned data into the cache to obtain the second misaligned data comprises the steps of: Writing the padded first unaligned data into a cache to obtain cache data; Obtaining an end logical address of the cached data; An alignment judgment is performed on the end logical address according to the logical mapping unit, and if the end logical address is not aligned with the logical mapping unit, the cache data is determined as second unaligned data.
5. A data writing method according to claim 4, characterized in that: The step of writing the padded first misaligned data into a cache to obtain cache data comprises the following steps: The padded first misaligned data is continuously written into the cache until a stop writing command is received, then the writing of data into the cache is stopped, and the data in the cache is determined as the cache data.
6. A data writing method according to claim 4, characterized in that: The step of obtaining the end logical address of the cache data comprises the following steps: Obtaining the write length of the cache data; The starting logical address and the writing length are calculated to obtain an ending logical address.
7. A data writing method according to claim 4, characterized in that: The obtaining of the logical mapping unit comprises the steps of: obtaining a minimum unit of the logical address mapping, wherein the minimum unit of the logical address mapping comprises 4kb.
8. A data writing device, characterized in that: include: An acquisition module, used for acquiring a logical mapping unit, and acquiring first unaligned data, wherein the first unaligned data is data with an unknown write length and an unaligned start logical address; A first padding module, configured to extract initial data according to the first misaligned data and the logical mapping unit, and pad the first misaligned data based on the initial data; A cache module, used for writing the padded first misaligned data into the cache to obtain second misaligned data, where the second misaligned data is data for ending the misalignment of the logical address; A second padding module, used for padding the second misaligned data based on the initial data to obtain aligned data; A writing module is used to write the alignment data into a memory.
9. An electronic device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the data writing method according to any one of claims 1 to 7 when executing the computer program.
10. A storage medium, the storage medium being a computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute: the data writing method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Memory storage device, memory controller thereof and data writing method
CN103544118A
Unaligned data coalescing
CN103733183A
Memory storage device, memory controller thereof, and method for writing data thereof
US20140013030A1
Performing sub-logical page write operations in non-volatile random access memory (NVRAM) using pre-populated read-modify-write (RMW) buffers
US20210278996A1
