Data storage method and electronic equipment

By using the correspondence between feature encoding and writing commands in video recording data storage technology, the data fragmentation problem is solved and the performance and life of the storage device are improved.

CN118915954APending Publication Date: 2024-11-08ZHONGSHAN JIANGBOLONG ELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310514138.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-05-08
Publication Date
2024-11-08

AI Technical Summary

Technical Problem

In video recording data storage technology, simple write commands from the host side and storage device lead to data fragmentation, affecting the writing performance and the service life of the storage device.

Method used

By generating feature encoding based on data attribute information on the host side, generating corresponding write commands, and writing data to the corresponding storage area according to feature encoding in the storage device, ensuring that the feature encoding corresponds one by one to avoid data fragmentation change.

Benefits of technology

It effectively avoids data fragmentation, improves the writing performance and service life of the storage device, ensures that data with different attributes are stored in different regions, and reduces the need for garbage collection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118915954A_ABST
    Figure CN118915954A_ABST
Patent Text Reader

Abstract

The invention discloses a data storage method and electronic equipment. The method comprises the following steps: acquiring to-be-written data; generating feature codes based on the attribute information of the to-be-written data, wherein the feature codes are in one-to-one correspondence with the attribute information; generating a write command based on the feature code; sending the write command and the corresponding to-be-written data to a storage device, so that the storage device receives the write command, and writes the to-be-written data into a storage area corresponding to a feature code based on the feature code in the write command; wherein the feature codes are in one-to-one correspondence with the storage areas. By means of the mode, the technical problem that the writing performance and the service life are affected by fragmentation of data stored in the storage device is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of storage, and in particular to a data storage method and an electronic device. Background Art

[0002] In the common video recording data storage technology, the host side only uses standard commands to write, and only retains the starting address and length of the data. When receiving data, the storage device can only simply identify the size of each data and perform simple data diversion by setting the data size threshold. When the host side receives multiple channels of video recording data, it will write the multiple channels of video recording data together, and the data stored in the storage device will be too fragmented, such as Figure 1 As shown, Figure 1 A schematic diagram of a two-way data writing. Fragmented storage causes the storage device to need to perform GC (garbage collection) continuously, which affects the smoothness of continuous writing performance and the service life of the storage device. Summary of the invention

[0003] The main purpose of the present application is to provide a data storage method and electronic device, which can solve the technical problem that the fragmentation of data stored in the storage device affects the writing performance and service life.

[0004] In order to solve the above technical problems, the first technical solution adopted by the present application is: to provide a data storage method. The method is applied to the host side, and the method includes: obtaining the data to be written; generating a feature code based on the attribute information of the data to be written, and the feature code corresponds to the attribute information one by one; generating a write command based on the feature code; sending the write command and the corresponding data to be written to the storage device, so that the storage device receives the write command, and writes the data to be written to the storage area corresponding to the feature code based on the feature code in the write command; wherein the feature code corresponds to the storage area one by one.

[0005] In order to solve the above technical problems, the second technical solution adopted by the present application is to provide a data storage method. The method is applied to a storage device, and the method includes: receiving a write command and corresponding data to be written, the write command is generated based on a feature code, the feature code is generated based on attribute information of the data to be written, and the feature code corresponds to the attribute information one by one; based on the feature code in the write command, the corresponding data to be written is written to a storage area corresponding to the feature code; wherein the feature code corresponds to the storage area one by one.

[0006] To solve the above technical problems, the third technical solution adopted by the present application is to provide a data storage method. The method is applied to a storage system, which includes a host end and a storage device, and the method includes: the host end obtains the data to be written; the host end generates a feature code based on the attribute information of the data to be written, and the feature code corresponds to the attribute information one by one; the host end generates a write command based on the feature code; the host end sends the write command and the corresponding data to be written to the storage device; the storage device receives the write command and the corresponding data to be written; the storage device writes the corresponding data to be written to the storage area corresponding to the feature code based on the feature code in the write command; wherein the feature code corresponds to the storage device one by one.

[0007] To solve the above technical problems, the fourth technical solution adopted by the present application is to provide an electronic device, which includes a memory and a processor, wherein the memory is used to store program data, and the program data can be executed by the processor to implement the method described in any of the above technical solutions.

[0008] The beneficial effect of the present application is: by generating a feature code according to the attribute information of the data to be written, the generated feature code corresponds to the attribute information one by one, and then generating a write command based on the feature code, so that the storage device receiving the write command can store the corresponding data to be written based on the feature code in the write command, and store it in the storage area corresponding to the feature code. Since the feature code and the storage area also correspond one by one, the data to be written with different attributes will be stored in different storage areas, and the fragmentation of the stored data will not occur, thus avoiding the influence of data fragmentation on the data writing performance of the storage device and improving the service life of the storage device. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0010] Figure 1 This is a 2-way data writing schematic;

[0011] Figure 2 This is a flow chart of the first embodiment of the data storage method of the present application;

[0012] Figure 3 This is a schematic diagram of 2-way data writing in the technical solution of this application;

[0013] Figure 4This is a flow chart of the second embodiment of the data storage method of the present application;

[0014] Figure 5 This is a flowchart of the third embodiment of the data storage method of the present application;

[0015] Figure 6 This is a flowchart of a fourth embodiment of the data storage method of the present application;

[0016] Figure 7 This is a flowchart of the fifth embodiment of the data storage method of the present application;

[0017] Figure 8 It is a schematic structural diagram of the first embodiment of the electronic device of the present application. DETAILED DESCRIPTION

[0018] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0019] The terms "first", "second", etc. in this application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.

[0020] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0021] Reference Figure 2 , Figure 2 This is a flow chart of the first embodiment of the data storage method of the present application. The method is applied to the host side and includes the following steps:

[0022] S11: Obtain the data to be written.

[0023] The data to be written is data acquired by the host end and needs to be written to the storage device for storage.

[0024] S12: Generate a feature code based on the attribute information of the data to be written, and the feature code corresponds to the attribute information one by one.

[0025] The attribute information of the data to be written is obtained, and the corresponding feature code is generated according to the attribute information. The feature code corresponds to the attribute information one by one, and different attribute information corresponds to different feature codes.

[0026] S13: Generate a write command based on the feature code.

[0027] Write the feature code into the write command.

[0028] S14: Sending a write command and corresponding data to be written to a storage device, so that the storage device receives the write command and writes the data to be written to a storage area corresponding to the feature code based on the feature code in the write command; wherein the feature code corresponds to the storage area one-to-one.

[0029] The write command and the data to be written corresponding to the command are sent to the storage device together. The storage device writes the data to be written into the corresponding storage area according to the feature code in the write command. Since the feature code corresponds to the storage area one by one, the data corresponding to different feature codes will be written into different storage areas. Therefore, the data to be written with different attribute information will be stored in different storage areas, and will not be stored in the same area, resulting in fragmentation of the stored data and affecting the data writing performance of the storage device. Figure 3 As shown, Figure 3 This is a schematic diagram of writing two paths of data in the technical solution of this application. During the data writing process, two paths of data are stored in different storage blocks respectively, storage block 1 only stores one path of data, and storage block 2 only stores two paths of data.

[0030] The storage area includes at least two minimum write units, which means that the data volume corresponding to the storage area includes the data volume corresponding to at least two minimum write units, and the data volume corresponding to the minimum write unit is the minimum data volume that the storage device needs to write in one write process. The data volume of the minimum write unit can be set according to actual data requirements or the actual situation of the storage device, and is not limited here.

[0031] Based on the technical solution of the present application, in actual situations, the storage area is an entire area formed by at least two adjacent minimum write units.

[0032] In some embodiments, the storage area can be a storage block or a bare chip (DIE), and the specific size can be set according to the actual usage. The technical solution of the present application stores data of different attribute information, such as data of different paths, in different storage blocks or bare chips, so as to achieve data division, avoid fragmentation of stored data, and improve the performance of the storage device.

[0033] In this embodiment, by generating a feature code according to the attribute information of the data to be written, the generated feature code corresponds to the attribute information one by one, and then a write command is generated based on the feature code, so that the storage device receiving the write command can store the corresponding data to be written based on the feature code in the write command, and store it in the storage area corresponding to the feature code. Since the feature code and the storage area also correspond one by one, the data to be written with different attributes will be stored in different storage areas, and the fragmentation of the stored data will not occur, thus avoiding the influence of data fragmentation on the data writing performance of the storage device and improving the service life of the storage device.

[0034] In one embodiment, the attribute to which the attribute information belongs may include at least one of the source of the data to be written, the data type, and the importance. Each attribute corresponds to at least two attribute information. For example, if the attribute is the data source, the attribute information may correspond to data source A, data source B, and data source C, etc. If the attribute is the importance, the attribute information may correspond to important, generally important, and unimportant, etc.

[0035] In one embodiment, generating feature codes based on attribute information of data to be written includes generating feature codes based on attribute information of at least one attribute. Feature codes can be generated based on attribute information of only one attribute, or based on attribute information of multiple attributes. For example, for the attribute of data source, the attribute information corresponds to data source A and data source B, and for the attribute of importance, the attribute information corresponds to important and unimportant, then there are four corresponding attribute information, data source A and important, data source A and unimportant, data source B and important, and data source B and unimportant. The host end can perform feature coding according to four different attribute information, so that the data to be written with the same attribute information can be stored in the same storage area to avoid data fragmentation. The host end can also perform feature coding only according to the data source attribute, so that the data to be written of data source A and data source B are stored in corresponding storage areas respectively to avoid data fragmentation.

[0036] Reference Figure 3 , Figure 3 This is a flow chart of the second embodiment of the data storage method of the present application. The method is a further extension of step S12, and includes the following steps:

[0037] S21: Receive a data diversion function start command.

[0038] For the execution of the above-mentioned step of generating characteristic codes, a data diversion function state command is set. The data diversion function state command includes a data diversion function start command and a data diversion function close command. When the command is on, the step of generating characteristic codes is executed to divert the data, and when the command is off, the step of generating characteristic codes is not executed, and the data is not diverted.

[0039] S22: In response to the data diversion function being enabled, obtaining attribute information of the data to be written.

[0040] When a data diversion function start command is received, attribute information of the data to be written is obtained for generating a feature code.

[0041] In one embodiment, the data offloading function status command is implemented by a FEATURE command, and may also be implemented by other function commands according to actual conditions, which is not limited here.

[0042] Reference Figure 4 , Figure 4 This is a flow chart of the third embodiment of the data storage method of the present application. The method is applied to a storage device and includes the following steps:

[0043] S31: receiving a write command and corresponding data to be written, wherein the write command is generated based on a feature code, and the feature code is generated based on attribute information of the data to be written, and the feature code corresponds to the attribute information one by one.

[0044] After receiving the write command, the corresponding data to be written is processed according to the write command.

[0045] S32: Based on the feature code in the write command, write the corresponding data to be written into the storage area corresponding to the feature code; wherein the feature code corresponds to the storage area one by one.

[0046] Since the write command contains a feature code, the feature code is generated based on the attribute information of the data to be written. The feature code corresponds to the attribute information one-to-one, and different attribute information corresponds to different feature codes. Therefore, a one-to-one storage area is set based on the feature code to store the data to be written with different attribute information in different storage areas.

[0047] Reference Figure 5 , Figure 5 This is a flow chart of the fourth embodiment of the data storage method of the present application. The method is a further extension of step S32, and includes the following steps:

[0048] S41: In response to the storage area corresponding to the feature code being full of useful data, obtaining an available storage area.

[0049] After obtaining the write command, further obtain the characteristic code in the write command. Determine whether the storage area corresponding to the characteristic code is full of data or full of useful data, and obtain the available storage area. The available storage area can be a storage area where data is stored, but the data is useless and can be deleted, or it can be an idle storage area where no data has been stored. The specific determination of the available storage area can be determined and set according to the actual usage.

[0050] S42: Align the available storage area with the feature code to store the to-be-written data corresponding to the feature code.

[0051] The newly acquired available storage area is matched with the characteristic code so as to be used for storing the to-be-written data corresponding to the characteristic code in the following.

[0052] When the available storage area is obtained and matched with the feature code, the previous storage area corresponding to the feature code is cancelled, so that the feature code and the storage area correspond one by one. In the correspondence list, the data is kept simple and easy to find by the storage device.

[0053] S43: Based on the feature code, the corresponding data to be written is written into the available storage area corresponding to the feature code.

[0054] After determining the available storage area, the data to be written is stored.

[0055] Reference Figure 6 , Figure 6 This is a flow chart of the fifth embodiment of the data storage method of the present application. The method is applied to a storage system and includes the following steps:

[0056] S51: The host obtains the data to be written.

[0057] The data to be written is data acquired by the host end and needs to be written to the storage device for storage.

[0058] S52: The host generates a feature code based on the attribute information of the data to be written, and the feature code corresponds to the attribute information one by one.

[0059] The attribute information of the data to be written is obtained, and the corresponding feature code is generated according to the attribute information. The feature code corresponds to the attribute information one by one, and different attribute information corresponds to different feature codes.

[0060] S53: The host generates a write command based on the feature code.

[0061] Write the feature code into the write command.

[0062] S54: The host sends the write command and the corresponding data to be written to the storage device.

[0063] S55: The storage device receives the write command and the corresponding data to be written.

[0064] S56: The storage device writes the corresponding data to be written into the storage area corresponding to the feature code based on the feature code in the write command; wherein the feature code corresponds to the storage device one-to-one.

[0065] The write command and the data to be written corresponding to the command are sent to the storage device together. The storage device writes the data to be written into the corresponding storage area according to the feature code in the write command. Since the feature code corresponds to the storage area one by one, the data to be written with different attribute information will be stored in different storage areas, not in the same area, resulting in fragmentation of the stored data and affecting the data writing performance of the storage device.

[0066] The same or similar steps can be described in the above embodiments and will not be described in detail here.

[0067] The data storage method of the present application is described in more detail by taking a specific embodiment as an example below.

[0068] The host defines a protocol mode, Multichannel video acceleration (MVA) protocol mode, and the host turns this mode on and off by setting FFEATURE. After turning on the MVA mode, the host will number each channel of video data and encode it into the reserved field of the write command. By passing different numbers, data diversion on the host side is achieved. After receiving the write command, the storage device diverts the data according to the different numbers in the write command, and the data with the same number will be stored in the same area. Using the above method can greatly reduce the fragmentation of data storage, reduce unnecessary garbage collection of storage devices, and improve the smoothness of continuous write performance and the service life of the storage device.

[0069] The reserved fields are unused fields in the command. For example, so far, there are many unused fields in the Write DMA Ext command 35h and most other standard write commands. These reserved fields can be used to execute the data storage method of the present application.

[0070] like Figure 7 As shown, Figure 7 This is a schematic structural diagram of the first embodiment of the electronic device of the present application.

[0071] The electronic device includes a processor 110 and a memory 120 .

[0072] The processor 110 controls the operation of the electronic device, and the processor 110 may also be referred to as a CPU (Central Processing Unit). The processor 110 may be an integrated circuit chip having the ability to process a signal sequence. The processor 110 may also be a general-purpose processor, a digital signal sequence processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0073] The memory 120 stores instructions and program data required for the operation of the processor 110. The memory 120 may include a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), or other media that can store program instructions.

[0074] The processor 110 is communicatively connected with the memory 120 to implement the method provided by any one of the first to fifth embodiments of the aforementioned data storage method of the present application and any possible combination thereof.

[0075] In summary, by generating a feature code according to the attribute information of the data to be written, the generated feature code corresponds to the attribute information one-to-one, and then a write command is generated based on the feature code, so that the storage device receiving the write command can store the corresponding data to be written based on the feature code in the write command, and store it in the storage area corresponding to the feature code. Since the feature code and the storage area also correspond one-to-one, the data to be written with different attributes will be stored in different storage areas, and the fragmentation of the stored data will not occur, thus avoiding the impact of data fragmentation on the data writing performance of the storage device and improving the service life of the storage device.

[0076] In the several embodiments provided in this application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only illustrative, for example, the division of the modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.

[0077] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0078] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0079] If the integrated units in the above other embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), disk or optical disk and other media that can store program codes.

[0080] The above descriptions are merely embodiments of the present application and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A data storage method, characterized in that: Applied to the host side, the method includes: Get the data to be written; Generate a feature code based on the attribute information of the data to be written, wherein the feature code corresponds to the attribute information one by one; generating a write command based on the feature code; Sending the write command and the corresponding data to be written to a storage device, so that the storage device receives the write command and writes the data to be written to a storage area corresponding to the feature code based on the feature code in the write command; The characteristic codes correspond to the storage areas one by one.

2. The method according to claim 1, characterized in that Before generating the feature code based on the attribute information of the data to be written, the method includes: Receive data diversion function start command; In response to the data diversion function being enabled, attribute information of the data to be written is obtained.

3. The method according to claim 2, characterized in that The data diversion function enabling command is implemented through the FEATURE command.

4. The method according to claim 1, characterized in that: The attribute to which the attribute information belongs may include at least one of the source, data type, and importance of the data to be written.

5. The method according to claim 4, characterized in that Each of the attributes corresponds to at least two pieces of attribute information.

6. The method according to claim 5, characterized in that The generating the feature code based on the attribute information of the data to be written includes: The feature code is generated based on the attribute information of at least one attribute.

7. A data storage method, characterized in that: Applied to a storage device, the method comprises: receiving a write command and corresponding data to be written, wherein the write command is generated based on a feature code, the feature code is generated based on attribute information of the data to be written, and the feature code corresponds to the attribute information in a one-to-one manner; Based on the feature code in the write command, write the corresponding data to be written into a storage area corresponding to the feature code; The characteristic codes correspond to the storage areas one by one.

8. The method according to claim 7, characterized in that The step of writing the corresponding data to be written into a storage area corresponding to the feature code based on the feature code in the write command comprises: In response to the storage area corresponding to the feature code being full of useful data, obtaining an available storage area; The available storage area is associated with the feature code to store the to-be-written data corresponding to the feature code; Based on the feature code, the corresponding data to be written is written into the available storage area corresponding to the feature code.

9. A data storage method, characterized in that: Applied to a storage system, the storage system includes a host end and a storage device, the method includes: The host end obtains the data to be written; The host generates a feature code based on the attribute information of the data to be written, wherein the feature code corresponds to the attribute information one by one; The host generates a write command based on the feature code; The host sends the write command and the corresponding data to be written to the storage device; The storage device receives a write command and corresponding data to be written; The storage device writes the corresponding data to be written into a storage area corresponding to the feature code based on the feature code in the write command; Therein, the characteristic codes correspond one to one with the storage devices.

10. An electronic device, characterized in that: The invention comprises a memory and a processor, wherein the memory is used to store program data, and the program data can be executed by the processor to implement the method according to any one of claims 1 to 9.