Data storage method, electronic device, and storage medium

By employing page-aligned compression technology and time-triggered mechanisms in vehicle data storage methods, the problems of write amplification and data loss in solid-state drives (SSDs) have been solved, extending hard drive lifespan and improving data storage reliability.

CN117435124BActive Publication Date: 2025-11-11HUAWEI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210837667.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-15
Publication Date
2025-11-11
Estimated Expiration
2042-07-15

AI Technical Summary

Technical Problem

Solid-state drives (SSDs) in vehicles suffer from write amplification, which shortens their lifespan and increases the risk of data loss when the vehicle suddenly loses power, thus increasing maintenance costs and the risk of information loss.

Method used

The data to be stored is compressed using page alignment to form compressed blocks whose length is an integer multiple of the solid-state drive's storage page. The data is written to disk after it has accumulated to a certain length, and a time-triggered mechanism is used to ensure that the data is stored in a timely manner.

Benefits of technology

It reduces write amplification in solid-state drives, extends their lifespan, reduces the risk of data loss, reduces I/O resource burden, and improves data storage reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117435124B_ABST
    Figure CN117435124B_ABST
Patent Text Reader

Abstract

This application provides a data storage method, an electronic device, and a computer-readable storage medium. The method includes: acquiring a first segment of data to be stored, determining that the first segment of data to be stored is longer than a first length; compressing the first segment of data to be stored in a page-aligned manner to obtain a first compressed block; acquiring an i-th segment of data to be stored, determining that the length of the uncompressed data of the (i-1)-th segment of data to be stored and the length of the i-th segment of data to be stored are longer than a first length; compressing the i-th segment of data to be stored and the uncompressed data of the (i-1)-th segment of data to be stored in a page-aligned manner to obtain an i-th compressed block; wherein the page alignment method ensures that the length of each compressed block is D times the storage capacity of each storage page; determining that the sum of the lengths of the first to i compressed blocks is greater than or equal to a second length; and storing the first to i compressed blocks to the storage medium. This application can ensure timely write-to-disk storage of the data to be stored and can reduce write amplification of the storage medium.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of terminal technology, and in particular to a data storage method, electronic device, and computer-readable storage medium. Background Technology

[0002] Intelligent driving technology is a hot topic in vehicle engineering. Intelligent driving vehicles include an in-vehicle computer (or "vehicle computer"), which can act as the "brain" of the vehicle, responsible for monitoring, recording, and controlling the vehicle's operating status.

[0003] Some in-vehicle infotainment systems adopt the eMMC (Embedded Multi Media Card) specification, using solid-state drives (SSDs) as their non-volatile storage media (i.e., the in-vehicle infotainment system's hard drive). Compared to other forms of storage media (such as hard disk drives), using SSDs as the in-vehicle infotainment system's hard drive can enable faster read and write speeds, thereby improving the overall performance of the infotainment system.

[0004] Based on the working principle of solid-state drives (SSDs), they inherently exhibit write amplification. This means that the actual amount of data written to an SSD may be several times the effective amount of data written. Since the total number of write cycles per storage cell of an SSD is limited (e.g., 100,000), write amplification shortens the SSD's lifespan. When the SSD's lifespan is significantly shorter than the vehicle's end-of-life (typically 10 years or more, with national regulations limiting it to a maximum of 15 years), users will need to frequently replace the vehicle's hard drive, increasing vehicle maintenance costs.

[0005] Furthermore, the operating environment of in-vehicle infotainment systems is highly unpredictable. For example, a sudden vehicle shutdown can cause a power outage for the system. When the system suddenly loses power, some data may not be stored on the hard drive in time, leading to data loss. Summary of the Invention

[0006] Some embodiments of this application provide a data storage method, an electronic device, and a computer-readable storage medium. The following describes this application from multiple aspects, and the embodiments and beneficial effects of the following aspects can be referred to each other.

[0007] In a first aspect, this application provides a data storage method for an electronic device, the electronic device including a storage medium comprising a plurality of storage pages; the method comprising: acquiring a first segment of data to be stored, determining that the length of the first segment of data to be stored is greater than or equal to a first length; compressing at least a portion of the first segment of data to be stored in a page-aligned manner to obtain a first compressed block; acquiring an i-th segment of data to be stored, determining that the sum of the uncompressed data of the (i-1)-th segment of data to be stored and the length of the i-th segment of data to be stored is greater than or equal to a first length, where i is a positive integer greater than or equal to 2; compressing at least a portion of the first segment of data to be stored in a page-aligned manner to obtain a first compressed block; acquiring an i-th segment of data to be stored, determining that the sum of the lengths of the uncompressed data of the (i-1)-th segment of data to be stored and the length of the i-th segment of data to be stored is greater than or equal to a first length, where i is a positive integer greater than or equal to 2; and compressing at least a portion of the first segment of data to be stored in a page-aligned manner. At least a portion of the data to be stored in segment i and the uncompressed data of segment i-1 to be stored are compressed to obtain the i-th compressed block; wherein, the page alignment method is such that the length of each compressed block is an integer multiple of the first storage length, the first storage length is D times the storage capacity of each storage page, and D is a positive integer; if a preset storage condition is satisfied, the data to be stored is stored in the storage medium; wherein, if the preset storage condition is satisfied, storing the data to be stored in the specified storage location includes: if the sum of the lengths of the first to i compressed blocks is greater than or equal to the second length, the first to i compressed blocks are stored in the storage medium.

[0008] According to the embodiments of this application, not only can the data to be stored be written to disk in a timely manner, but the write amplification factor of the storage medium (e.g., solid-state drive) can also be reduced to extend the service life of the storage medium, while also reducing the burden on the I / O resources of electronic devices.

[0009] In some implementations, at least a portion of the first segment of data to be stored is compressed in a page-aligned manner to obtain a first compressed block. This includes: starting from the header of the first segment of data to be stored, sequentially compressing N consecutive segments of the first segment of data to be stored one by one to obtain N sub-compressed blocks, where N is a positive integer greater than or equal to 2, wherein the length of the first to (N-1)th sub-compressed blocks is a first storage length; comparing the length of the Nth sub-compressed block with the first storage length, if the length of the Nth sub-compressed block is less than the first storage length, then combining the first to (N-1)th sub-compressed blocks as the first compressed block; if the length of the Nth sub-compressed block is equal to the first storage length, then combining the first to Nth sub-compressed blocks as the first compressed block.

[0010] In some implementations, at least a portion of the data in the first segment of data to be stored is compressed in a page-aligned manner to obtain a first compressed block, including: compressing all the data in the first segment of data to be stored to obtain an initial compressed block; determining whether the length of the initial compressed block is an integer multiple of a first storage length, and if so, using the initial compressed block as the first compressed block; if not, dividing the initial compressed block into a first sub-block and a second sub-block, and using the first sub-block as the first compressed block, wherein the first sub-block is located at the beginning of the initial compressed block, the length of the first sub-block is an integer multiple of the first storage length, and the length of the second sub-block is less than the first storage length.

[0011] In some implementations, the first compressed block includes a title portion and a content portion, the title portion having a preset fixed length, and the content portion including compressed data of at least a portion of the first segment of data to be stored.

[0012] In some implementations, D = 5 to P, where P is the number of storage pages contained in each storage block of the solid-state drive. According to the embodiments of this application, page alignment is used to compress the data to be stored. In this way, the compressed block can occupy exactly an integer number of storage pages, thereby making full use of the storage space of the storage medium and reducing the write amplification factor of the storage medium.

[0013] In some implementations, the first length is 0.1 to 0.5 times the bandwidth of the I / O data bus of the electronic device; and / or, the second length is 0.1 to 0.4 times the bandwidth of the I / O data bus of the electronic device.

[0014] According to the embodiments of this application, the compression rate of the data to be stored can be improved, and frequent occupation of I / O resources can be avoided, thus reducing the burden on I / O resources.

[0015] In some embodiments, determining that a preset storage condition is met and storing the data to be stored in a designated storage location further includes: determining that the difference between the current time and the preset storage start time is greater than or equal to a first duration, and storing the first to i compressed blocks and additional compressed blocks in the designated storage location. The additional compressed blocks are compressed blocks obtained by compressing the data to be stored that was not compressed into the compressed blocks. The embodiments of this application can further ensure timely data storage.

[0016] In some implementations, the second length is 0.1 to 0.2 times the product of the bandwidth of the electronic device's I / O data bus and the first duration.

[0017] Secondly, embodiments of this application provide a data storage method for an electronic device, the electronic device including a storage medium, the storage medium including a plurality of storage pages; the method includes: acquiring data to be stored, determining that the sum of the length of the data to be stored and the length of legacy data in the electronic device is greater than a first length, the legacy data being uncompressed data to be stored; compressing the data to be stored and the legacy data in a page-aligned manner to obtain a compressed block to be stored; the page alignment manner such that the length of the compressed block is an integer multiple of the first storage length, the first storage length being D times the storage capacity of each storage page, where D is a positive integer; determining that a preset storage condition is met, storing the data to be stored in the storage medium, otherwise, returning to the step of acquiring the data to be stored until the preset storage condition is met; wherein, determining that the preset storage condition is met, storing the data to be stored in a specified storage location includes: determining that the total length of the obtained compressed block is greater than a second length, and storing the obtained compressed block in the storage medium.

[0018] Thirdly, embodiments of this application provide an electronic device, including: a memory for storing instructions executable by one or more processors of the electronic device; and a processor capable of executing the method of any embodiment of the first aspect of this application when the processor executes the instructions in the memory. The beneficial effects achievable through the third aspect can be referred to for the beneficial effects of the method provided by any embodiment of the first aspect, and will not be repeated here.

[0019] Fourthly, embodiments of this application provide a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform any embodiment of the first aspect of this application. The beneficial effects achievable through the fourth aspect can be referenced to the beneficial effects of any embodiment of the first aspect, and will not be repeated here. Attached Figure Description

[0020] Figure 1 This paper illustrates an exemplary application scenario of the data storage method provided in the embodiments of this application;

[0021] Figure 2 A schematic diagram of the storage data setting interface provided in an embodiment of this application is shown;

[0022] Figure 3 An exemplary structural diagram of the vehicle infotainment system provided in an embodiment of this application is shown;

[0023] Figure 4 An exemplary structural diagram of a solid-state drive provided in an embodiment of this application is shown;

[0024] Figure 5 A schematic diagram of the storage settings interface provided in an embodiment of this application is shown;

[0025] Figure 6An exemplary flow of the data storage method provided in the embodiments of this application is shown. Figure 1 ;

[0026] Figure 7 This illustration shows a schematic diagram of the method for obtaining data to be stored provided in an embodiment of this application;

[0027] Figure 8 An exemplary structural diagram of the compression block provided in an embodiment of this application is shown;

[0028] Figure 9 An exemplary flow diagram of the block alignment compression method provided in this application embodiment is shown. Figure 1 ;

[0029] Figure 10 This illustration shows a method for forming a compression block according to an embodiment of this application. Figure 1 ;

[0030] Figure 11 An exemplary flow diagram of the block alignment compression method provided in this application embodiment is shown. Figure 2 ;

[0031] Figure 12 This illustration shows a method for forming a compression block according to an embodiment of this application. Figure 2 ;

[0032] Figure 13 This illustration shows a schematic diagram of the method for forming the data to be written to disk provided in an embodiment of this application;

[0033] Figure 14 An exemplary flow of the data storage method provided in the embodiments of this application is shown. Figure 2 ;

[0034] Figure 15 A block diagram of an electronic device provided in an embodiment of this application is shown;

[0035] Figure 16 A schematic diagram of the structure of a System on Chip (SoC) provided in an embodiment of this application is shown. Detailed Implementation

[0036] The specific embodiments of this application will be described in detail below with reference to the accompanying drawings.

[0037] This application provides a data storage method for an electronic device, which includes a non-volatile storage medium with "pages" as storage units. The method provided by this application stores data in the storage medium of the electronic device in a "page-aligned" manner, thereby reducing the write amplification factor of the storage medium and improving its lifespan. Furthermore, this application also ensures that data is stored in the storage medium in a timely manner to avoid data loss. In the following examples, a solid-state drive (SSD) is used as an example of a non-volatile storage medium for an electronic device, but this application is not limited to this. In other embodiments, the non-volatile storage medium can also be other forms, such as flash memory.

[0038] In this application, the electronic device can be a device of various forms, such as mobile devices such as in-vehicle systems, laptops, wearable devices, and personal digital assistants (PDAs), or fixed devices such as servers, desktop computers, and machine tool main control computers. This application does not limit the types of devices.

[0039] Furthermore, electronic devices can be used in various settings such as vehicles, factories, ships, mines, aircraft, civil / industrial buildings, and amusement facilities; this application does not limit the applications.

[0040] The following text will use the vehicle's infotainment system as an example of an electronic device.

[0041] Figure 1 An exemplary application scenario of this embodiment is illustrated. (Reference) Figure 1 The in-vehicle infotainment system 100 is installed inside the vehicle. During vehicle operation, the system not only provides user interaction functions, such as voice calls and navigation, but also monitors and controls the vehicle's operating status. For example, it can acquire various operational data (e.g., vehicle speed, steering data, battery level, road condition images), and control the vehicle's operation (e.g., controlling acceleration performance). In other words, the in-vehicle infotainment system 100 can be understood as the vehicle's "brain," responsible for maintaining its normal operation.

[0042] During vehicle operation, it is desirable to store some important data (such as vehicle operating status data) to analyze the vehicle's operating status, thereby promptly identifying potential vehicle defects and optimizing vehicle performance.

[0043] In this document, the data to be stored is referred to as "data to be stored". The data type of the data to be stored is not limited in this application. For example, the data to be stored may be one or more of the following: vehicle operating status data, navigation data, multimedia data, and radio voice data. The source of the data to be stored may be data collected by peripheral devices of the vehicle infotainment system 100 (e.g., vehicle sensors), data downloaded by the vehicle infotainment system 100 via a network (e.g., a 5G network), or data obtained by the vehicle infotainment system 100 through computation (e.g., the recognition result obtained by the vehicle infotainment system 100 from recognizing the user's voice), etc.

[0044] In some examples, the type of data to be stored can be set by the vehicle manufacturer; for example, the manufacturer might set data collected by specific sensors (e.g., road image sensors, vehicle speed sensors) as the data to be stored. In other examples, the data to be stored can be set by the application; for example, a navigation application might set its own acquired map data as the data to be stored. In still other examples, the data to be stored can be set by the user; for example, reference data... Figure 2 Users can set "road condition image data" and "radio voice data" as data to be stored through the storage data setting interface 10 provided by the vehicle system 100.

[0045] After receiving data to be stored, the vehicle's infotainment system 100 first stores the data in its main memory (RAM). When the vehicle's infotainment system 100 is powered off, the data in RAM is lost. Therefore, it is necessary to promptly transfer the data to be stored from the vehicle's RAM to its solid-state drive (SSD) (also known as "writing the data to disk") to ensure reliable storage.

[0046] In some implementations, the timing of data write-to-disk is configured by the operating system. For example, when the operating system determines that the current memory usage rate is higher than a set threshold (e.g., 70%), it writes the data to be stored to disk to free up memory space; or, when the operating system determines that the currently running applications include applications with high memory usage (e.g., navigation applications), it writes the data to be stored to disk to ensure the normal operation of the current applications.

[0047] In this implementation, the timing of writing the data to disk is highly uncertain, and timely writing of the data cannot be guaranteed. For example, when a vehicle suddenly stalls due to emergency braking, the operating system may not write the data to disk for an extended period, resulting in data loss.

[0048] In other implementations, when the electronic device receives the data to be stored, it compresses the data. If the length of the compressed data is an integer multiple of the page size of the solid-state drive (e.g., 4K), the compressed data is written to disk; otherwise, the compressed data is processed before being written to disk (e.g., the compressed data is written to disk using header alignment or tail alignment).

[0049] This implementation method can minimize the write amplification factor of the solid-state drive. However, it cannot guarantee timely data write-to-disk or data compression ratio.

[0050] To address this, this application provides a data storage method that ensures timely data write-to-disk while minimizing the write amplification factor of the solid-state drive (SSD). Specifically, in this embodiment, whenever the accumulated length of the data to be stored reaches length L1 (first length accumulation), the electronic device compresses the data to be stored in a page-aligned manner to obtain multiple compressed blocks C. The length of each compressed block C is an integer multiple of a set length L0, which is an integer multiple of the storage capacity of the SSD's storage page. When the total length of the multiple compressed blocks C reaches length L2 (second length accumulation), the vehicle system 100 writes the multiple compressed blocks C to disk as a whole. This not only ensures timely data write-to-disk processing but also reduces the write amplification factor of the SSD, extending its lifespan and reducing the burden on I / O resources.

[0051] In other implementations, a time-triggered disk write-to-disk mechanism is also included. That is, the electronic device automatically performs a data write-to-disk operation every set duration ΔT (as the first duration) to further ensure timely data write-to-disk and avoid data loss.

[0052] The following describes specific embodiments of this application. In the following embodiments, the vehicle-mounted system 100 is used as an example of an electronic device, but it is understood that this application is not limited thereto. In other embodiments, the electronic device may be a device used in factories, ships, mines, aircraft, or other similar locations.

[0053] Figure 3 An exemplary structural diagram of the vehicle infotainment system 100 is shown. (Reference) Figure 3The vehicle infotainment system 100 includes a processor 110, memory 120, an input / output (I / O) bus, a mobile communication module 130, a wireless communication module 140, and a solid-state drive 150. The mobile communication module 130, wireless communication module 140, and solid-state drive 150 are connected to the processor 110 and memory 120 via the I / O bus. Additionally, the vehicle infotainment system 100 can also connect to one or more functional units of the vehicle (e.g., power management module, various status sensors, etc.) via the I / O bus. In this document, the devices connected to the vehicle infotainment system 100's I / O bus and the vehicle's functional units (e.g., vehicle speed sensors) are referred to as peripheral devices (or I / O devices) of the vehicle infotainment system 100.

[0054] It is understood that the connection relationships between the modules illustrated in this embodiment are merely illustrative and do not constitute a structural limitation on the vehicle infotainment system 100. In other embodiments of this application, the vehicle infotainment system 100 may also adopt different connection methods or combinations of multiple connection methods as described in the above embodiments.

[0055] Each I / O device and the vehicle infotainment system 100 can communicate via the I / O bus. For example, I / O devices can upload message data to the vehicle infotainment system 100 via the I / O bus (e.g., the road condition image sensor can upload the collected road condition image data to the vehicle infotainment system 100), and the vehicle infotainment system 100 can send control commands to each I / O device via the I / O bus (e.g., the vehicle infotainment system 100 can send a command to the vehicle power management module to enter energy-saving mode).

[0056] I / O buses can be Peripheral Component Interconnect (PCI) buses, Inter-integrated Circuit (I2C) buses, Inter-integrated Circuit Sound (I2S) buses, Pulse Code Modulation (PCM) buses, Universal Asynchronous Receiver / Transmitter (UART) buses, etc.

[0057] The I / O bus can include a control bus, an address bus, and a data bus. The maximum amount of data exchanged between the I / O device and the vehicle infotainment system 100 per unit time (1 second) is determined by the bandwidth of the I / O data bus. The bandwidth of the I / O data bus is the amount of data (in bytes) that can be transmitted on the data bus per unit time, and it is related to the clock frequency and bit width of the data bus. For example, when the clock frequency of the I / O data bus is 2MHz and the bit width is 32 bits, the bandwidth of the I / O data bus = 32bit × 2MHz ÷ 8 = 8MB / s.

[0058] Memory 120 can be used to store computer executable program code, including instructions. Memory 120 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback, image playback, etc.), etc. The data storage area may store data created during the use of the vehicle system 100 (such as audio data, phonebook, etc.). In addition, memory 120 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the vehicle system 100 by running instructions stored in memory 120 and / or instructions stored in memory located in the processor.

[0059] The mobile communication module 130 can provide wireless communication solutions, including 2G / 3G / 4G / 5G, for use on the vehicle infotainment system 100. The mobile communication module 130 may include at least one filter, switch, power amplifier, low-noise amplifier (LNA), etc. The mobile communication module 130 can receive electromagnetic waves through the antenna of the vehicle infotainment system 100, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 130 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via the antenna. In some embodiments, at least some functional modules of the mobile communication module 130 may be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 130 and at least some modules of the processor 110 may be housed in the same device.

[0060] The vehicle infotainment system 100 can communicate with a cloud server via a mobile communication module. For example, after acquiring the vehicle's data to be stored, the vehicle infotainment system 100 can upload the data to the cloud server for storage via the mobile communication module.

[0061] The wireless communication module 140 can provide solutions for wireless communication applications on the vehicle infotainment system 100, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. The wireless communication module 140 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna of the vehicle infotainment system 100, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to the processor 110. The wireless communication module 140 can also receive signals to be transmitted from the processor 110, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via the antenna of the vehicle infotainment system 100.

[0062] Solid-state drive 150 is a non-volatile storage medium in the vehicle infotainment system 100, and the system can store data to be stored in it. Compared with other types of storage media (e.g., hard disk drives), solid-state drive 150 can achieve faster read and write speeds, thus improving the performance of the vehicle infotainment system 100. However, due to the structural characteristics of solid-state drive 150, it inherently exhibits write amplification. Figure 4 Please provide an explanation.

[0063] Figure 4 An exemplary structural diagram of a solid-state drive 150 is shown. (Reference) Figure 4 A solid-state drive (SSD) consists of B blocks, each block comprising P pages. Typically, a page size ranges from 512 bytes to 4KB, and a block consists of 32 to 128 pages. For ease of understanding, the following explanation will use an example where each page is 4KB and each block consists of 64 pages.

[0064] The SSD 150 is based on flash memory technology. Each block can be viewed as a flash memory chip. Before each write operation to a block, the data in the block must be erased, and a single erase operation will clear all data in the block. Since the block usually originally stored valid data, to ensure that the original data in the block is not lost, the SSD 150 will move the original data to other blocks.

[0065] For example, block 1 stores 40KB of raw data (denoted as data_b1). When 5KB of new data needs to be written to block 1, the SSD 150 needs to move the raw data data_b1 from block 1 to a new block. Typically, the SSD 150 will move the raw data in block 1 (i.e., data_b1) along with the raw data in other blocks (e.g., block 2) to a new block (e.g., block 3) to free up several blank blocks (this mechanism is the SSD's garbage collection mechanism). Assuming the raw data in block 2 is data_b2 (20KB in size), the SSD 150 needs to first write the raw data (i.e., data_b1 and data_b2) from blocks 1 and 2 to block 3, then erase blocks 1 and 2, and finally write 5KB of new data to block 1. In this example, to write 5KB of new data to SSD 150, SSD 150 actually writes 65KB of data, which is 13 times the effective write amount. This phenomenon is known as write amplification of SSD 150. In this example, the write amplification factor of SSD 150 is 13.

[0066] Each block of the SSD 150 has a limited number of write cycles (e.g., 100,000). Beyond this limit, no more data can be written to that block. Therefore, write amplification reduces the lifespan of the SSD 150. When the lifespan of the SSD 150 is significantly less than the vehicle's end-of-life, users will need to replace the SSD 150 frequently, increasing vehicle maintenance costs.

[0067] The following combination Figure 4 The structural diagram illustrates the data storage method provided in this embodiment. The data storage method provided in this embodiment can be automatically started and executed when the vehicle infotainment system 100 is powered on, or it can be started and executed based on user commands. For example, refer to... Figure 5 (a) Users can access the settings interface by clicking the "Storage" option in the settings menu 20. Figure 5 (b) shows the storage settings interface 30. After the user checks the "Whether to enable storage optimization" checkbox 40, the vehicle system 100 can start executing the data storage method provided in this embodiment.

[0068] Figure 6 This is an exemplary flowchart illustrating a data storage method provided in one embodiment of this application. (See also...) Figure 6 The data storage method provided in this embodiment includes the following steps:

[0069] S110: The vehicle system 100 acquires the data to be stored, D1 (as the first segment of data to be stored).

[0070] In this embodiment, the data to be stored can be of various types, such as data reported by I / O devices, data downloaded from the network, and data obtained by the vehicle system 100 (e.g., the recognition result obtained by the vehicle system 100 from recognizing the user's voice). The following will use data reported by I / O devices as an example for introduction.

[0071] When the vehicle infotainment system 100 is powered on, each I / O device (e.g., an image sensor) can report the collected data to the vehicle infotainment system 100. After receiving message data from the I / O devices, the vehicle infotainment system 100 can generate data to be stored. In some examples, the vehicle infotainment system 100 can directly use the received I / O device message data as data to be stored; in other examples, the vehicle infotainment system 100 can perform certain processing on the I / O device message data (e.g., adding additional information such as source and length to the message data) and then use the processed message data as data to be stored. After generating (or "acquiring") the data to be stored, the vehicle infotainment system 100 stores the data in the vehicle infotainment system 100's memory 120.

[0072] The vehicle-mounted system 100 can periodically receive message data from various I / O devices. For example, refer to... Figure 7 The vehicle infotainment system 100 receives message data from the vehicle speed sensor at time t1, message data from the direction sensor at time t2, and message data from the image sensor at time t3. The vehicle infotainment system 100 can generate data to be stored, Data1, Data2, and Data3, respectively, based on these message data. Furthermore, since the time it takes for the vehicle infotainment system 100 to process the message data into data to be stored (e.g., adding additional information to the message data) is very short (e.g., on the order of microseconds), it can be ignored. In this paper, the time when the vehicle infotainment system 100 receives the message data is considered as the time when the vehicle infotainment system 100 acquires the data to be stored. For example, time t1 is considered as the time when the data to be stored, Data1, is acquired.

[0073] In some embodiments, the time when the vehicle-mounted system 100 receives a message is the time when the vehicle-mounted system 100 completely receives the message. The vehicle-mounted system 100 can determine whether a message has been completely received according to preset rules. For example, in some examples, the message has a preset fixed length (e.g., 1KB). In this example, when the length of the message received by the vehicle-mounted system 100 is equal to the preset fixed length, it is determined that the message has been completely received. In other examples, the message has a fixed format frame header and frame trailer (e.g., the frame header is a fixed character "0011" and the frame trailer is a fixed character "1100"). In this example, when the vehicle-mounted system 100 detects the frame header and frame trailer of the message, it is determined that the message has been completely received.

[0074] In other embodiments, the data to be stored may also include data downloaded from the network, data obtained by the vehicle system 100, etc. In this embodiment, the vehicle system 100 can determine the time of acquiring the data to be stored based on the type of data to be stored. For example, for data downloaded from the network, the vehicle system 100 can use the time of receiving the complete network data packet as the time of acquiring the data to be stored; for data obtained by calculation, the vehicle system 100 can use the time of completion of the calculation as the time of acquiring the data to be stored.

[0075] S120: The vehicle system 100 determines whether the length of the data D1 to be stored is greater than or equal to the length L1 (as the first length).

[0076] Each segment of data to be stored may include multiple message data. (Reference) Figure 7 The data to be stored, D1, includes data Data1, Data2, and Data3. After each acquisition of I / O device message data (e.g., at time t1, time t2, and time t3), the vehicle-mounted system 100 determines whether the total length of the acquired data to be stored, D1, is greater than or equal to length L1. If the total length of the data to be stored, D1, is greater than or equal to length L1, step S130 is executed to compress the data to be stored; otherwise, step S110 is returned to continue acquiring the data to be stored, D1.

[0077] In other words, length L1 is the threshold for triggering the vehicle system 100 to compress the data D1 to be stored. When the length of the data D1 to be stored is less than length L1, the vehicle system 100 will not compress the data D1 to be stored. It can be understood that data compression is a more refined way to re-encode repetitive segments / redundant data in the original data to reduce the amount of compressed data. Therefore, the longer the original data, the higher the probability of repetitive segments appearing in the original data, and the higher the compression ratio of the compressed file. Therefore, compared to compressing the data to be compressed line by line (for example, compressing Data1, Data2, and Data3 included in the data D1 to be stored separately), this embodiment can improve the compression ratio of the data to be stored by setting the length threshold L1 to trigger data compression, thereby reducing the amount of data written to the solid-state drive 150 and improving the lifespan of the solid-state drive 150.

[0078] This embodiment does not limit the specific value of the length L1. In some embodiments, the length L1 is positively correlated with the bandwidth of the I / O data bus. For example, the length L1 is 0.1 to 0.5 times the bandwidth of the I / O data bus (e.g., 0.1 times, 0.2 times, etc.). In this way, for the vehicle infotainment system 100 with strong I / O communication capabilities, the length L1 can be set as large as possible to increase the threshold for triggering data compression, thereby achieving the highest possible compression ratio.

[0079] For ease of understanding, the following explanation will use a length L1 = 1024KB as an example. (Reference) Figure 7 At time t3, the vehicle system 100 acquires data to be stored, data1, data2, and data3, with lengths of 85KB, 66KB, and 2250KB respectively. Therefore, the length of data D1 (2401KB) is greater than the length L1 (1024KB). Therefore, after time t3, the vehicle system 100 begins to execute step S130 to compress the data D1 to be stored.

[0080] S130: The vehicle system 100 compresses the data to be stored D1 in a page-aligned manner to obtain a compressed block C1. The page alignment method ensures that the length of the compressed block obtained after compressing the data to be stored is an integer multiple of the storage length L0 (as the first storage length). The storage length L0 is D times the storage capacity of each storage page of the solid-state drive 150, where D is a positive integer.

[0081] In this embodiment, page alignment is used to compress the data to be stored. This ensures that the compressed block occupies an exact integer number of storage pages, thus fully utilizing the storage space of the solid-state drive 150 and reducing its write amplification factor. In this document, the compressed block obtained using the page alignment method is denoted as "compressed block C". Different compressed blocks C are identified by a serial number at the end; for example, compressed block C1 represents the compressed block obtained from data D1 to be stored, and compressed block C2 represents the compressed block obtained from data D2 to be stored. It is understood that when using page alignment for compression, a portion of the data to be stored may not be compressed into compressed block C.

[0082] Furthermore, the length of the compressed block C is an integer multiple of the storage length L0, and the storage length L0 is D times the storage capacity (i.e., page size) of the storage pages of the solid-state drive 150. It can be understood that when D equals P (as mentioned above, P is the number of storage pages contained in each storage block), each compressed block C occupies exactly an integer number of storage blocks, thus maximizing the control of the write amplification factor of the solid-state drive 150. However, setting D equal to P results in a larger size for the compressed block C, which increases the burden on the memory 120 during the compression process; furthermore, a significant amount of data to be stored may not be compressed into the compressed block C. Therefore, in some examples, D can be less than P. In this embodiment, D is any value between 5 and P, for example, 5, 8, 20, etc.

[0083] This embodiment does not limit the compression algorithm. For example, the compression algorithm can be Huffman compression, LZW algorithm, run-length encoding algorithm, etc.

[0084] The following describes an exemplary method for compressing the data D1 to be compressed. For ease of understanding, the structure of the compressed block C is first introduced.

[0085] Figure 8 An exemplary structure of compression block C is shown. (Reference) Figure 8 The compressed block C consists of a header section and a content section. The header section includes the identifier of the compressed block (or "flag") and the size of the content section (called "size"). The content section contains the compressed data to be stored (called "content").

[0086] The header portion of compressed block C has a preset fixed length b. For example, the flag and size fields are each 1 byte (i.e., length b = 2B). The flag is used to uniquely identify compressed block C; for example, the flag could be the generation sequence number or generation time of compressed block C. The size is the size of the content portion. It can be understood that the value of size is equal to the length of compressed block C minus the length of the header portion b. For example, when the length of compressed block C is 64KB, the value of size is 64KB - 2B; when the length of compressed block C is 96KB, the value of size is 96KB - 2B. It should be noted that in other embodiments, compressed block C may not include a header portion.

[0087] This application does not limit the specific method for compressing the data D1 to be stored, as long as the data D1 is compressed in a page-aligned manner. Two specific examples are given below.

[0088] For Example 1, refer to Figure 9 and Figure 10 In this example, the process of compressing the data D1 to be stored by the vehicle's infotainment system 100 includes the following steps:

[0089] S131: Starting from the header of the data to be stored D1, the vehicle-mounted system 100 sequentially compresses N consecutive segments of the data to be stored D1 to obtain N sub-compressed blocks. The lengths of the 1st to the (N-1th)th sub-compressed blocks are equal to the storage length L0 (assumed to be 32KB), and the length of the Nth sub-compressed block is less than or equal to the storage length L0. Figure 10 In the example given, the length of the Nth sub-compressed block is less than L0.

[0090] Specifically, refer to Figure 10The vehicle-mounted system 100 compresses the data in the data to be stored, starting from the beginning of the data D1, until a compressed block C1-1' of length L0-b is formed (the portion of the data D1 compressed into compressed block C1-1' is segment 1 of the data D1). Then, a header portion of length b is added before compressed block C1-1', thus forming sub-compressed block C1-1. The length of sub-compressed block C1-1 is L0. The value of the header flag can be determined according to preset rules; for example, the flag value of compressed block C1 is determined to be 0001 based on the generation sequence number of compressed block C1. The value of the header size can be determined in subsequent steps (after determining the length of compressed block C1, which will be explained later).

[0091] Then, the vehicle-mounted unit 100 compresses the data after segment 1 until a compressed block C1-2 of length L0 is formed. The portion of the data D1 to be stored that is compressed into compressed block C1-2 is segment 2. The vehicle-mounted unit 100 continues to compress the data after segment 2 until a compressed block C1-3 of length L0 is formed. The data D1 to be stored is compressed into compressed block C1-3 as segment 3; ...; repeating the above steps until the vehicle-mounted unit 100 has completely compressed the data D1 to be stored. At this point, the vehicle-mounted unit 100 compresses the data D1 to be stored into N sub-compressed blocks, and the lengths of the 1st to the (N-1th)th sub-compressed blocks are respectively equal to the storage length L0. In this embodiment, the value of N is not limited, and N can be any integer greater than 2.

[0092] In other embodiments, the header portion may not be included in the compressed block C. When the header portion is not included in the compressed block C, simply set the length b to 0. In this case, the sub-compressed block C1-1' obtained by compressing fragment 1 is the sub-compressed block C1-1.

[0093] S132: The vehicle system 100 determines whether the length of the Nth sub-compression block is less than the length L0. If yes, then proceed to step S133; otherwise, proceed to step S134.

[0094] S133: The vehicle unit 100 combines sub-compression blocks C1-1 to C1-(N-1) to form compression block C1.

[0095] Since the length of the Nth sub-compression block is less than the length L0, the Nth sub-compression block cannot achieve "page alignment". Therefore, the vehicle system 100 combines sub-compression blocks C1-1 to C1-(N-1) to form compression block C1, so that compression block C1 can achieve page alignment (i.e., the length of compression block C1 is an integer multiple of the length L0).

[0096] In addition, the vehicle system 100 can determine the value of the title part size based on the total length of the compression block C1-1' to the compression block C1-(N-1). It can be understood that the value of size is L0×(N-1)-b.

[0097] The data in segment N is the uncompressed data that is not included in compression block C1. In this paper, this part of the data is referred to as the uncompressed data D1-r of the data to be stored D1. This part of the data will be compressed together with the data to be stored D2 subsequently acquired by the vehicle system 100 (the details will be introduced in step S160).

[0098] S134: The vehicle unit 100 combines sub-compression blocks C1-1 to C1-N to form compression block C1.

[0099] Since the length of the Nth sub-compression block is equal to the length L0, the combination of sub-compression blocks C1-1 to C1-N can achieve page alignment. Therefore, the vehicle system 100 combines sub-compression blocks C1-1 to C1-N to form compression block C1.

[0100] Additionally, the vehicle-mounted unit 100 can determine the value of the title section size based on the total length of compression blocks C1-1' to C1-N. Unlike step S133, when the length of the Nth sub-compression block is equal to the length L0, the value of size is L0×Nb.

[0101] It is understandable that when the length of the Nth sub-compression block is equal to the length L0, all the data in the data to be stored D1 can be compressed into the compression block C1.

[0102] For example two, refer to Figure 11 and Figure 12 In this example, the process of compressing the data D1 to be stored includes the following steps:

[0103] S135: Compress all data in the data to be stored, D1, to obtain compressed block C1-S.

[0104] Specifically, refer to Figure 12 All data in the storage data D1 is compressed, resulting in compressed block C1-S'. A header section of length b is added before compressed block C1-S' to form compressed block C1-S (as the initial compressed block). The size of the header section can be determined in a subsequent step (after determining the length of compressed block C1, which will be explained later).

[0105] In some embodiments, the header portion may not be included in the compressed block C. When the compressed block C does not include the header portion, simply setting the length b to 0 is sufficient. In this case, the compressed block C1-S' obtained by compressing the data D1 to be compressed is the compressed block C1-S.

[0106] S136: Determine whether the length of the compressed block C1-S is an integer multiple of the length L0. If yes, proceed to step S137; otherwise, proceed to step S138. Figure 12 In the example shown, the length of the compressed block C1-S is not an integer multiple of L0.

[0107] S137: Use compressed block C1-S as compressed block C1. When the length of compressed block C1-S is an integer multiple of the length L0, compressed block C1-S can achieve "page alignment". Therefore, compressed block C1-S is used as compressed block C1.

[0108] S138: Divide the compressed block C1-S into sub-block C1-S1 (as the first sub-block) and sub-block C1-S2 (as the second sub-block), wherein sub-block C1-S1 is located at the head of the compressed block C1-S, the length of sub-block C1-S1 is an integer multiple of L0, and the length of sub-block C1-S2 is less than L0.

[0109] In other words, after dividing the compressed block C1-S, sub-block C1-S1 is a compressed block that can achieve "page alignment", while sub-block C1-S2 is a compressed block that does not fill a "full page".

[0110] S139: Use compressed blocks C1-S1 as compressed block C1. Since compressed blocks C1-S1 are compressed blocks that can achieve "page alignment", using them as compressed block C1 can reduce the write amplification factor of the SSD 150.

[0111] Additionally, the data corresponding to the data to be stored D1 and sub-blocks C1-S2 is the data that has not been compressed into the compressed block C1. In this document, this part of the data is referred to as the uncompressed data D1-r of the data to be stored D1. This part of the data will be compressed together with the data to be stored D2 subsequently acquired by the vehicle system 100 (details will be introduced in step S160).

[0112] S140: Obtain the data to be stored, Di (as the i-th segment of data to be stored), where i is counted starting from 2. The following first describes the case where i = 2, i.e., the data to be stored, D2.

[0113] refer to Figure 6 After compressing the data D1 to be stored, the vehicle system 100 continues to acquire the data D2 to be stored. The method by which the vehicle system 100 acquires the data D2 to be stored is essentially the same as the method for acquiring the data D1, therefore, the description in step S110 is provided and will not be repeated here. For example, refer to... Figure 7 At time t4, the vehicle's infotainment system 100 acquires message data from the road condition image sensor and generates data to be stored, Data4, based on the message data.

[0114] S150: Determine whether the sum of the lengths of the uncompressed data D(i-1)-r of the data to be stored D(i-1) and the data Di to be stored exceeds the length L1. If it exceeds, proceed to step S170; if it does not exceed, return to step S150 to continue obtaining the data Di to be stored.

[0115] Assuming the length of the uncompressed data D1-r of the data to be stored D1 is 120KB, and the length of the newly acquired data Data4 to be stored is 1900KB, the sum of the lengths of the uncompressed data D1-r of the data to be stored D1 and the length of the data D2 to be stored (120KB + 1900KB = 2020KB) exceeds the length L1 (assumed to be 1024KB). Therefore, the vehicle system 100 continues to execute step S170.

[0116] S160: Compress the uncompressed data D(i-1)-r and the data Di to be stored in a page-aligned manner to obtain compressed block Ci.

[0117] That is, the vehicle system 100 combines the uncompressed data D(i-1)-r of the data to be stored D(i-1) with the data Di to be stored to form a new data Di', wherein the uncompressed data D(i-1)-r is located at the beginning of the new data block Di'. Then, the vehicle system 100 compresses the new data Di' using a page-aligned method to obtain a compressed block Ci.

[0118] Taking i=2 as an example, the vehicle system 100 combines the uncompressed data D1-r of the data to be stored D1 with the data D2 to be stored to obtain new data D2', where the uncompressed data D1-r is located at the beginning of data block D2'. Then, the vehicle system 100 compresses the new data D2' using page alignment to obtain compressed block C2.

[0119] The method of compressing data D2' using page alignment is essentially the same as the method of compressing data D1 to be stored in step S130, so the description in step S130 can be referred to, and will not be repeated here. It can be understood that after compressing data D2', compressed block C2 can be obtained. In some embodiments, the data to be stored D2 may contain data that is not compressed into compressed block C2; this part of the data is the uncompressed data D2-r of the data to be stored D2.

[0120] S170: Determine whether the length of compressed blocks C1 to Ci is greater than or equal to length L2 (as the second length). If yes, proceed to step S190 to drop compressed blocks C1 to Ci onto the disk; otherwise, return to step S140 to continue acquiring more compressed blocks C until the total length of compressed blocks C is greater than or equal to L2.

[0121] In other words, in this embodiment, each compressed block C is not written to disk immediately after acquisition. Instead, a batch of compressed blocks C (including multiple compressed blocks C) is written to disk together only after the total length of the compressed blocks C exceeds length L2. This setting avoids the long-term occupation of I / O resources (e.g., the time for processor 110 to process I / O data, I / O bus bandwidth resources, etc.) due to frequent data writing to disk, thus reducing the burden on I / O resources.

[0122] This embodiment does not limit the value of length L2. In some embodiments, length L2 is positively correlated with the bandwidth of the I / O data bus. For example, length L2 is 0.1 to 0.4 times the bandwidth of the I / O data bus, such as 0.1 times, 0.2 times, etc. That is to say, for the vehicle system 100 with strong I / O communication capabilities, since the compression block C can be quickly written to the disk, the length L2 can be set to a larger value to minimize the frequent occupation of I / O resources.

[0123] Taking i=2 as an example. If the total length of compressed block C1 and compressed block C2 is above length L2, then step S180 is executed to put compressed block C1 and compressed block C2 onto the disk; otherwise, step S140 is executed to continue to obtain new compressed blocks C3, C4, ..., until the total length of the obtained compressed blocks C is above L2.

[0124] S180: Store compressed blocks C1 to Ci in solid-state drive 150 (as an example of a specified storage location).

[0125] refer to Figure 13 According to steps S110 to S170 above, multiple compressed blocks C (compressed block C1, compressed block C2, ..., compressed block Ci, where i is a positive integer greater than or equal to 2) can be obtained, and the total length of compressed blocks C1 to Ci is greater than L2. At this time, the vehicle system 100 transfers compressed blocks C1 to Ci from memory 120 to solid-state drive 150 to write compressed blocks C1 to Ci to the disk. After the vehicle system 100 writes compressed blocks C1 to Ci to the disk, compressed blocks C1 to Ci can be deleted from memory 120.

[0126] In summary, this embodiment provides a data storage method. When the cumulative length of the data to be stored in the memory 120 reaches length L1 (first length accumulation), the data to be stored is compressed in a page-aligned manner to obtain multiple compressed blocks C (compressed block C1, compressed block C2, ..., compressed block Ci). When the total length of the multiple compressed blocks C reaches L2 (second length accumulation), the vehicle system 100 writes the multiple compressed blocks C to disk as a whole.

[0127] That is, in this embodiment, the data to be stored is written to disk in a two-stage length accumulation method. With this setting, the following technical effects can be achieved simultaneously: (1) Whenever the cumulative total length of compressed block C reaches length L2, the vehicle unit 100 can write each compressed block C to disk in a timely manner. Compared with other embodiments, the method of controlling the writing to disk based on the memory 120 occupancy rate can ensure the timely writing of data to disk and avoid data loss due to sudden power failure of the vehicle unit 100; (2) Writing the data to be stored to disk in a page-aligned manner can reduce the write amplification factor of the solid-state drive 150 and extend the service life of the solid-state drive 150; (3) When the total length of compressed block C reaches length L2, one or more compressed blocks C are written to disk as a whole, thereby avoiding frequent occupation of I / O resources and reducing the burden on I / O resources.

[0128] This embodiment is an exemplary description of the technical solution of this application, and those skilled in the art can make other modifications.

[0129] For example, in this embodiment, when the total length of compressed blocks C accumulates to more than L2, the vehicle system 100 stores compressed blocks C1 to Ci in the solid-state drive 150. This application is not limited to this. In other embodiments, the vehicle system 100 may also store compressed blocks C1 to Ci in a cloud server communicatively connected to the vehicle system 100.

[0130] Specifically, the vehicle-mounted unit 100 can determine the storage location of compressed blocks C1 to Ci based on the current communication rate K with the cloud server. In some examples, when the current communication rate is greater than or equal to rate K0 (as the first rate), the vehicle-mounted unit 100 uploads compressed blocks C1 to Ci to the cloud server. In this example, the vehicle-mounted unit 100 may not store compressed blocks C1 to Ci in the solid-state drive 150 to reduce the amount of data written to the solid-state drive 150 and extend its service life. In other examples, when the current communication rate K is less than rate K0, the vehicle-mounted unit 100 stores compressed blocks C1 to Ci in the solid-state drive 150 to ensure that the data is stored in a timely manner. After network conditions improve (e.g., after the communication rate between the vehicle-mounted unit 100 and the cloud server is greater than rate K0), the vehicle-mounted unit 100 then uploads compressed blocks C1 to Ci to the cloud server. After the vehicle's infotainment system 100 uploads compressed blocks C1 to Ci to the cloud server, it can delete compressed blocks C1 to Ci stored in the solid-state drive 150.

[0131] This embodiment does not limit the specific value of the rate K. For example, the rate K can be empirically set to 700 Mbps to 1000 Mbps. The current communication rate between the vehicle infotainment system 100 and the cloud server can be obtained through testing. For example, the vehicle infotainment system 100 can send a test message of a preset size (e.g., 1 MB) to the cloud server. After receiving the test message, the cloud server sends a reply message of a preset size (e.g., 0.5 MB) to the vehicle infotainment system 100. The vehicle infotainment system 100 calculates the current communication rate between itself and the cloud server based on the time interval (e.g., T1) from the start of sending the test message to the receipt of the reply message. For example, the current communication rate is 2 × (1 MB + 0.5 MB) / T1.

[0132] The above describes some data storage methods provided by embodiments of this application. In the above embodiments, when the total length of all compressed blocks C exceeds the length L2, the vehicle unit 100 is triggered to write the data to disk (hereinafter referred to as the "data volume trigger condition"). When the amount of data to be stored is small, it may take a long time to trigger the vehicle unit 100 to write the data to disk. To this end, this application also provides another data storage method, in which the conditions for triggering data writing to disk include not only the data volume trigger condition but also the time trigger condition (the vehicle unit 100 automatically performs data writing to disk once every set time ΔT) to further ensure timely data writing to disk. A detailed description follows.

[0133] refer to Figure 14 In some embodiments of this application, the data storage method includes:

[0134] S210: The vehicle system 100 starts timer M at time t0 (as the storage start time), and the timing duration of timer M is ΔT (as the first duration, for example, 2s, 5s).

[0135] Time t0 can be any time. In some embodiments, time t0 can be the time when the vehicle system 100 begins to execute the data storage method provided in this embodiment.

[0136] S220: The vehicle's infotainment system 100 acquires the data to be stored and compresses it using page alignment.

[0137] After acquiring the data to be stored, the vehicle infotainment system 100 compresses the data using a page-aligned method. The method for compressing the data is described in steps S110 to S170 above and will not be repeated here. After compressing the data, the vehicle infotainment system 100 obtains multiple compressed blocks C.

[0138] S230: Vehicle system 100 determines whether the total length of the compression block C exceeds the length L2.

[0139] After acquiring a new compressed block C, the vehicle system 100 determines whether the total length of the currently acquired compressed block C exceeds the length L2. If it does, it means that the data volume trigger condition for data writing to disk has been met, and the vehicle system 100 executes step S240 to write each compressed block C to disk; if it does not exceed the limit, it executes step S250 to further determine whether the time trigger condition for data writing to disk has been met.

[0140] S240: The vehicle system 100 stores each compressed block C in a designated storage location.

[0141] When the data volume trigger condition is met, the vehicle infotainment system 100 stores each compressed block C in a designated storage location. The designated storage location can be a solid-state drive 150 and / or a cloud server that is communicatively connected to the vehicle infotainment system 100.

[0142] In some examples, when the current communication rate K between the vehicle infotainment system 100 and the cloud server is greater than or equal to the rate K0 (as the first rate), the vehicle infotainment system 100 uploads each compressed block C to the cloud server; in other examples, when the current communication rate K between the vehicle infotainment system 100 and the cloud server is less than the rate K0, the vehicle infotainment system 100 stores each compressed block C in the solid-state drive 150 to ensure that the data is stored in a timely manner.

[0143] After storing each compressed block C, the vehicle system 100 restarts the timer M (i.e., executes step S270) so that the timer M starts counting again.

[0144] S250: The vehicle system 100 determines whether the timing period of timer M has expired. If the timing period of timer M has expired, it means that the time trigger condition for data write-to-disk has been met (i.e., the difference between the current time and time t0 is greater than ΔT), and the vehicle system 100 executes step S260 to write the data to be stored to disk; otherwise, the vehicle system 100 returns to execute step S220 to continue to obtain the data to be stored.

[0145] S260: The vehicle infotainment system 100 stores each compressed block C and additional compressed blocks in a designated storage location.

[0146] That is, when the time-triggered condition for data write-to-disk is met, the vehicle system 100 not only stores each compressed block C, but also stores the portion of the data to be stored that has not been compressed into compressed blocks C (referred to as the uncompressed data to be stored). Specifically, the vehicle system 100 compresses the uncompressed data to be stored to generate compressed block A (referred to as the "additional compressed block"). Then, the vehicle system 100 stores each compressed block C and compressed block A together. It can be understood that when the time-triggered condition is met, the vehicle system 100 may not write to disk in a "page-aligned" manner (i.e., the total length of compressed block C and compressed block A may not be an integer multiple of the length L0).

[0147] The vehicle infotainment system 100 can store compressed block C and compressed block A in a designated storage location. The designated storage location can be a solid-state drive 150 and / or a cloud server that is communicatively connected to the vehicle infotainment system 100. The specific method for setting the designated storage location is essentially the same as in step S240, so it can be referred to the description of step S240 and will not be repeated here.

[0148] S270: The vehicle infotainment system 100 restarts timer M. After each data storage operation (e.g., after executing steps S250 and S260), the vehicle infotainment system 100 restarts timer M to begin the next storage timing cycle.

[0149] In summary, this embodiment provides a data storage method, including two trigger conditions for data write-to-disk: a data volume trigger condition and a time trigger condition. When either trigger condition is met, the vehicle-mounted system will execute the write-to-disk action. Therefore, this embodiment can further ensure timely data write-to-disk and prevent data loss due to sudden power outages of the vehicle-mounted system.

[0150] This embodiment does not limit the value of the timing duration ΔT of timer M. In some embodiments, the timing duration ΔT is determined empirically, for example, it is set to 1s to 5s (e.g., 2s). In this embodiment, automatic data write-to-disk is triggered every 2s. In other embodiments, to ensure page alignment during write-to-disk, the timing duration ΔT is associated with the length L2. Specifically, the length L2 is as small as possible compared to the product of the I / O data bus bandwidth and the timing duration t; for example, the length L2 is 0.1 to 0.2 times the product of the I / O data bus bandwidth and the timing duration t.

[0151] Now for reference Figure 15 The diagram shows a block diagram of an electronic device 400 according to one embodiment of the present application. The electronic device 400 may include one or more processors 401 coupled to a controller hub 403. In at least one embodiment, the controller hub 403 communicates with the processor 401 via a multi-branch bus such as a Front Side Bus (FSB), a point-to-point interface such as a QuickPath Interconnect (QPI), or a similar connection 406. The processor 401 executes instructions controlling general types of data processing operations. In one embodiment, the controller hub 403 includes, but is not limited to, a Graphics & Memory Controller Hub (GMCH) (not shown) and an Input / Output Hub (IOH) (which may be on a separate chip) (not shown), wherein the GMCH includes memory and a graphics controller and is coupled to the IOH.

[0152] Electronic device 400 may also include a coprocessor 402 and a memory 404 coupled to a controller hub 403. Alternatively, one or both of the memory and GMCH may be integrated within the processor (as described in this application), with memory 404 and coprocessor 402 directly coupled to processor 401 and controller hub 403, which is located on a single chip with IOH.

[0153] Memory 404 may be, for example, Dynamic Random Access Memory (DRAM), Phase Change Memory (PCM), or a combination of both. Memory 404 may include one or more tangible, non-transitory computer-readable media for storing data and / or instructions. The computer-readable storage medium stores instructions, specifically, temporary and permanent copies of those instructions. The instructions may include, when executed by at least one of the processors, causing the electronic device 400 to perform, as... Figure 6 , Figure 9 , Figure 11 , Figure 14 The instructions for the method are shown. When the instructions are executed on a computer, the computer performs the data storage method disclosed in the embodiments of this application.

[0154] In one embodiment, coprocessor 402 is a dedicated processor, such as, for example, a high-throughput MIC (Many Integrated Core) processor, a network or communication processor, a compression engine, a graphics processor, a GPGPU (General-purpose computing on graphics processing units), or an embedded processor, etc. Optional properties of coprocessor 402 are indicated by dashed lines. Figure 15 middle.

[0155] In one embodiment, electronic device 400 may further include a network interface (NIC, Network Interface Controller) 406. Network interface 406 may include a transceiver for providing a radio interface for electronic device 400 to communicate with any other suitable device (such as a front-end module, antenna, etc.). In various embodiments, network interface 406 may be integrated with other components of electronic device 400. Network interface 406 can implement the functions of the communication unit in the above embodiments.

[0156] Electronic device 400 may further include input / output (I / O) devices 405. I / O 405 may include: a user interface designed to enable a user to interact with electronic device 400; a peripheral component interface designed to enable peripheral components to also interact with electronic device 400; and / or sensors designed to determine environmental conditions and / or location information related to electronic device 400.

[0157] It is worth noting that, Figure 15 This is merely an example. That is, although... Figure 15The electronic device 400 shown includes multiple devices such as a processor 401, a controller hub 403, and a memory 404. However, in practical applications, devices using the methods of this application may include only a portion of the devices in the electronic device 400. For example, it may include only the processor 401 and the network interface 406. Figure 15 The properties of the optional devices are shown by dashed lines.

[0158] Now for reference Figure 16 The diagram shown is a block diagram of a SoC (System on Chip) 500 according to an embodiment of this application. Figure 16 In the diagram, similar components share the same reference numerals. Additionally, dashed boxes are an optional feature for more advanced SoCs. Figure 16 In this SoC 500, the following components are included: an interconnect unit 550 coupled to the processor 510; a system proxy unit 580; a bus controller unit 590; an integrated memory controller unit 540; a group or one or more coprocessors 520, which may include integrated graphics logic, an image processor, an audio processor, and a video processor; a static random-access memory (SRAM) unit 530; and a direct memory access (DMA) unit 560. In one embodiment, the coprocessor 520 includes a dedicated processor, such as, for example, a network or communication processor, a compression engine, a GPGPU (General-purpose computing on graphics processing units), a high-throughput MIC processor, or an embedded processor.

[0159] Static Random Access Memory (SRAM) cell 530 may include one or more tangible, non-transitory computer-readable media for storing data and / or instructions. The computer-readable storage medium stores instructions, specifically, temporary and permanent copies of those instructions. These instructions may include, when executed by at least one of the processors, causing the SoC implementation to... Figure 6 , Figure 9 , Figure 11 , Figure 14 The instructions for the method are shown. When the instructions are executed on a computer, the computer performs the data storage method disclosed in the embodiments of this application.

[0160] In this document, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Furthermore, in this embodiment, the values ​​of each data range include endpoints. For example, A = 10~50 means that A can be 10 or 50.

[0161] All methods and implementations of this application can be implemented in the form of software, magnetic files, firmware, etc.

[0162] Program code can be applied to input instructions to perform the functions described herein and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of this application, the processing system includes any system having a processor such as, for example, a digital signal processor (DSP), a microcontroller, an application-specific integrated circuit (ASIC), or a microprocessor.

[0163] The program code can be implemented using a high-level procedural language or an object-oriented programming language to communicate with the processing system. Assembly language or machine language can also be used when needed. In fact, the mechanisms described in this paper are not limited to any particular programming language. In either case, the language can be a compiled language or an interpreted language.

[0164] One or more aspects of at least one embodiment can be implemented by representational instructions stored on a computer-readable storage medium, the instructions representing various logics in a processor, which, when read by a machine, cause the machine to create logic for performing the techniques described herein. These representations, referred to as “Intellectual Property (IP) cores,” can be stored on a tangible computer-readable storage medium and provided to multiple customers or production facilities for loading into manufacturing machines that actually manufacture the logic or processor.

[0165] In some cases, an instruction translator can be used to translate instructions from a source instruction set to a target instruction set. For example, an instruction translator can transform (e.g., using static binary transformation, including dynamically compiled dynamic binary transformation), morph, emulate, or otherwise translate instructions into one or more other instructions that will be processed by the core. Instruction translators can be implemented in software, hardware, firmware, or a combination thereof. Instruction translators can be on the processor, off the processor, or partially on and partially off the processor.

Claims

1. A data storage method for an electronic device, the electronic device comprising a storage medium, the storage medium comprising a plurality of storage pages; characterized in that, The method includes: Obtain the first segment of data to be stored, and determine that the length of the first segment of data to be stored is greater than or equal to the first length; At least a portion of the first segment of data to be stored is compressed in a page-aligned manner to obtain the first compressed block; Obtain the i-th segment of data to be stored, and determine that the sum of the length of the uncompressed data of the (i-1)-th segment of data to be stored and the length of the i-th segment of data to be stored is greater than or equal to the first length, where i is a positive integer greater than or equal to 2; At least a portion of the data to be stored in the i-th segment and the uncompressed data in the (i-1)-th segment are compressed in a page-aligned manner to obtain the i-th compressed block; wherein, the page alignment method makes the length of each compressed block an integer multiple of a first storage length, the first storage length being D times the storage capacity of each storage page, where D is a positive integer; Once the preset storage conditions are met, the data to be stored is stored in the storage medium. The step of determining that the preset storage conditions are met and storing the data to be stored in the specified storage location includes: determining that the sum of the lengths of the first to i compressed blocks is greater than or equal to the second length, and storing the first to i compressed blocks in the storage medium.

2. The method according to claim 1, characterized in that, At least a portion of the first segment of data to be stored is compressed in a page-aligned manner to obtain a first compressed block, including: Starting from the beginning of the first segment of data to be stored, N consecutive segments of the first segment of data to be stored are compressed one by one to obtain N sub-compressed blocks, where N is a positive integer greater than 2, and the length of the first to the (N-1)th sub-compressed blocks is the first storage length. Compare the length of the Nth sub-compressed block with the first storage length. If the length of the Nth sub-compressed block is less than the first storage length, then the combination of the 1st to the (N-1th)th sub-compressed blocks is taken as the 1st compressed block. If the length of the Nth sub-compressed block is equal to the first storage length, then the combination of the 1st to the Nth sub-compressed blocks is taken as the 1st compressed block.

3. The method according to claim 1, characterized in that, At least a portion of the first segment of data to be stored is compressed in a page-aligned manner to obtain a first compressed block, including: All data in the first segment of data to be stored is compressed to obtain an initial compressed block; Determine whether the length of the initial compressed block is an integer multiple of the first storage length. If yes, then the initial compressed block is used as the first compressed block. If no, then the initial compressed block is divided into a first sub-block and a second sub-block, and the first sub-block is used as the first compressed block. The first sub-block is located at the head of the initial compressed block, the length of the first sub-block is an integer multiple of the first storage length, and the length of the second sub-block is less than the first storage length.

4. The method according to any one of claims 1 to 3, characterized in that, The first compressed block includes a title portion and a content portion. The title portion has a preset fixed length, and the content portion includes compressed data of at least a portion of the data to be stored in the first segment.

5. The method according to any one of claims 1 to 3, characterized in that, The storage medium is a solid-state drive (SSD); where D = 5~P, and P is the number of storage pages contained in each storage block of the SSD.

6. The method according to any one of claims 1 to 3, characterized in that, The first length is 0.1 to 0.5 times the bandwidth of the I / O data bus of the electronic device; and / or, The second length is 0.1 to 0.4 times the bandwidth of the I / O data bus of the electronic device.

7. The method according to any one of claims 1 to 3, characterized in that, The step of determining that the preset storage conditions are met and storing the data to be stored in the storage medium further includes: If the difference between the current time and the preset storage start time is greater than a first duration, the first to i compressed blocks and additional compressed blocks are stored in the storage medium. The additional compressed blocks are compressed blocks obtained by compressing the data to be stored that has not been compressed into the compressed blocks.

8. The method according to claim 7, characterized in that, The second length is 0.1 to 0.2 times the product of the bandwidth of the I / O data bus of the electronic device and the first duration.

9. An electronic device, characterized in that, include: A memory for storing instructions executed by one or more processors of the electronic device; The processor, when executing the instructions in the memory, can perform the method according to any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed on a computer, cause the computer to perform the method described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Block consolidation in a direct-mapped flash storage system

    CN110023896A

  • Data storage method and device, air conditioner and storage medium

    CN110389723A