CN114237513A - File data memory, writing method, reading method and storage system - Google Patents

File data memory, writing method, reading method and storage system Download PDF

Info

Publication number
CN114237513A
CN114237513A CN202111558282.3A CN202111558282A CN114237513A CN 114237513 A CN114237513 A CN 114237513A CN 202111558282 A CN202111558282 A CN 202111558282A CN 114237513 A CN114237513 A CN 114237513A
Authority
CN
China
Prior art keywords
file
data
data storage
target
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202111558282.3A
Other languages
Chinese (zh)
Other versions
CN114237513B (en
Inventor
肖玉
张炼
卢晓霞
陈琛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sichuan Jiuzhou ATC Technology Co Ltd
Original Assignee
Sichuan Jiuzhou ATC Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sichuan Jiuzhou ATC Technology Co Ltd filed Critical Sichuan Jiuzhou ATC Technology Co Ltd
Priority to CN202111558282.3A priority Critical patent/CN114237513B/en
Priority claimed from CN202111558282.3A external-priority patent/CN114237513B/en
Publication of CN114237513A publication Critical patent/CN114237513A/en
Application granted granted Critical
Publication of CN114237513B publication Critical patent/CN114237513B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0604Improving or facilitating administration, e.g. storage management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0614Improving the reliability of storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/062Securing storage systems
    • G06F3/0622Securing storage systems in relation to access
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a file data memory, a writing method, a reading method and a storage system. The file data memory is provided with a file information area and a data memory area, wherein the data memory area comprises at least one data memory block; the file information area stores file information of a file, the file information directs at least one data storage block, and the data storage block stores file data of the file corresponding to the file information and state information of the data storage block. According to the method and the device, when the file data is written in, the target file is stored to the preset position according to the file information stored in the file information area and the state information of the data storage block stored in the data storage block, and the file information pointing to the corresponding file data is adjusted when the file data is read, so that the storage stability of the file data and the reading efficiency of the file data are improved when different types and different rights of files are stored.

Description

File data memory, writing method, reading method and storage system
Technical Field
The invention relates to the technical field of data storage, in particular to a file data storage, a writing method, a reading method and a storage system.
Background
With the development of electronic technology, the functions of electronic devices are more and more complex. The electronic device needs to read executable object code (binary code) from an electrically erasable/non-erasable memory device to load into a local memory and execute it sequentially before operating, thereby implementing various complex functions. In the electronic equipment comprising the operating system, besides the data loading on power, various data with different lengths can be stored and extracted in each working stage, so that a complex file system is established to manage the data files.
However, the conventional storage method does not consider space balance of disk writing, which results in short service life of a memory and low stability of file data storage, and meanwhile, when different types of file data are stored, different types of files often have different execution authorities. Therefore, how to improve the stability of file data storage and the efficiency of file data reading and writing is a technical problem that needs to be solved urgently.
The above is only for the purpose of assisting understanding of the technical aspects of the present invention, and does not represent an admission that the above is prior art.
Disclosure of Invention
The invention mainly aims to provide a file data memory, a writing method, a reading method and a storage system, and aims to solve the technical problems of stability of file data storage and low efficiency of reading and writing of file data of the existing file storage system.
In order to achieve the above object, the present invention provides a file data storage, wherein the file data storage is provided with a file information area and a data storage area, and the data storage area comprises at least one data storage block; the file information area stores file information of a file, the file information directs at least one data storage block, and the data storage block stores file data of the file corresponding to the file information and state information of the data storage block.
In the invention, the file information of the storage file is stored through the file information area, the file data and the state information of the data storage block are stored through the data storage block of the data storage area, so that the file data storage executes reading operation according to the file information, and executes storage operation according to the state information.
Optionally, the file includes a first file and a second file; wherein: the first file is a read-only file, and the file information of the first file comprises a file name and a storage address; the second file is a writable file, and the file information of the second file includes a file name, a file number, and a storage address.
In the invention, by storing the file name and the storage address of the read-only file and storing the file name, the file number and the storage address of the readable file, corresponding operation is executed according to the storage address when storage and reading are carried out.
Optionally, the file includes a first file and a second file; wherein: the first file is a read-only file, and the state information of the data storage block for storing the first file comprises the storage file length of the data storage block; the second file is a writable file, and the state information of the data storage block storing the second file comprises the storage file length of the data storage block and the writing times of the data storage block.
According to the method and the device, through the storage file length of the data storage block for storing the read-only file, the storage file length and the writing times of the data storage block for storing the readable file, the reading operation is executed according to the storage file length during reading, and the storage operation is executed according to the writing times during storing.
Further, in order to achieve the above object, the present invention also provides a file data writing method for a file data writing apparatus for writing file data to a file data storage as described above, the file data writing method comprising the steps of:
when a target file is received, identifying the file type of the file;
if the file type is a target file type, acquiring the file name of the target file, and judging whether an original file with the same file name is stored in the file data storage;
if yes, determining a target data storage block based on the state information of the data storage block, and moving the file data of the original file to the target data storage block;
otherwise, writing the file data of the target file into the file data memory, and adjusting the file data of the target file type stored in the data storage blocks in the file data memory, so that the file information of the file of each target file type directs the data storage blocks with the same number.
According to the method and the device, when the file data is written in, the target file is stored to the preset position according to the file information stored in the file information area and the state information of the data storage block stored in the data storage block, and the file information pointing to the corresponding file data is adjusted when the file data is read, so that the storage stability of the file data and the reading efficiency of the file data are improved when files with different types and different permissions are stored.
Optionally, the target file type is a writable file; if the file type is a target file type, acquiring a file name of the target file, and judging whether an original file with the same file name is stored in the file data storage, wherein the steps specifically comprise:
if the file type is a writable file, acquiring the file name of the target file;
and traversing the file information area of the file data memory, and matching the file names stored in the file information area to judge whether the original files with the same file names are stored in the file information area.
In the invention, when judging whether the same file is stored in the file data memory, the file name stored in the file information area can be matched according to the file name of the target file so as to select the operation of writing the target file, thereby avoiding repeated storage and improving the use efficiency of the file data memory.
Optionally, the status information of the data storage block includes the number of writing times of the data storage block, and the target data storage block is the data storage block with the smallest number of writing times.
When the file data is written, the file data is written into the data storage block with the minimum writing frequency in the file data storage, so that the use balance of the data storage block in the file data storage is kept, and the service life is prolonged.
Optionally, the step of writing the file data of the target file into the file data storage, and adjusting the file data of the target file type stored in the data storage blocks in the file data storage, so that the file information of the file of each target file type directs the same number of data storage blocks specifically includes:
writing the file data of the target file into the file data storage, and acquiring the file number of the target file type file in the file data storage;
determining the number of data storage blocks allocated to the file of each target file type based on the number of files;
and moving the file data of the files of the target file types according to the number of the data storage blocks so that the file information of the files of each target file type directs the data storage blocks of the same number.
In the invention, when the file data is written, the file number of the file of the target file type in the file data memory is acquired, and the data storage block corresponding to the file data is determined according to the file number, so that the use balance of the data storage block in the file data memory is ensured, and the service life is prolonged.
Further, in order to achieve the above object, the present invention also provides a file data reading method for a file data reading apparatus for reading file data to a file data storage as described above, the file data reading method comprising the steps of:
when a file reading instruction is received, judging whether a target file is stored in the file data storage;
if so, acquiring the file information of the target file, and reading the file data of the target file in at least one data storage block pointed by the file information.
When reading the file data, the invention firstly obtains the file information of the target file according to the reading instruction, then reads the file data according to the data storage block guided by the file information, and improves the reading efficiency of the file data by utilizing the division of the file information area and the data storage area of the file data storage.
Optionally, the file reading instruction includes a file name of the target file; the step of judging whether the file data storage stores the target file specifically comprises:
traversing a file information area of the file data memory to obtain a file name list stored in the file information area;
and inquiring the file name list, and determining whether the file name of the target file exists in the file name list.
In the invention, when judging whether the target file is stored, the file name list is inquired by traversing the file information area so as to judge whether the file to be read exists in the file data memory, and the file data reading efficiency is improved by utilizing the division of the file information area and the data storage area of the file data memory.
Optionally, the file information includes a storage address, and the step of obtaining the file information of the target file and reading the file data of the target file in at least one data storage block pointed by the file information specifically includes:
acquiring a storage address of the target file, and determining a data storage block for storing the target file according to the storage address;
and determining the file data of the target file based on the storage file length of the data storage block, and reading the file data.
In the invention, when reading the file data, the storage address of the target file stored in the file information area and the storage file length of the data storage block are acquired, the file data reading of the data storage block corresponding to the storage address is executed, and the file data reading efficiency is improved by utilizing the division of the file information area and the data storage area of the file data storage.
Further, in order to achieve the above object, the present invention also provides a file data writing apparatus including:
the identification module is used for identifying the file type of the file when the target file is received;
the first judging module is used for acquiring the file name of the target file if the file type is the target file type, and judging whether the original file with the same file name is stored in the file data storage;
the moving module is used for determining a target data storage block based on the state information of the data storage block and moving the file data of the original file to the target data storage block if the file data of the original file is in the target data storage block;
and the adjusting module is used for writing the file data of the target file into the file data memory and adjusting the file data of the target file type stored in the data storage block in the file data memory so as to lead the file information of the file of each target file type to guide the same number of data storage blocks.
Further, in order to achieve the above object, the present invention also provides a file data reading apparatus including:
the second judgment module is used for judging whether a target file is stored in the file data storage when a file reading instruction is received;
and if so, acquiring the file information of the target file, and reading the file data of the target file in at least one data storage block guided by the file information.
In addition, in order to achieve the above object, the present invention also provides a file data storage system including:
at least one file data store;
at least one file data writing device, the file data writing device comprising: a memory, a processor, and a file data writer stored on the memory and operable on the processor, the file data writer when executed by the processor implementing the steps of the file data writing method according to any one of claims 4 to 7;
at least one file data reading device, the file data reading device comprising: memory, processor and a file data reading program stored on the memory and executable on the processor, the file data reading program, when executed by the processor, implementing the steps of the file data reading method according to any one of claims 8 to 10.
Further, in order to achieve the above object, the present invention also provides a storage medium having stored thereon a file data writing program which, when executed by a processor, implements the steps of the file data writing method as described above.
In addition, in order to achieve the above object, the present invention also provides a storage medium having stored thereon a file data reading program which, when executed by a processor, implements the steps of the file data reading method as described above.
The embodiment of the invention provides a file data memory, a writing method, a reading method and a storage system. The file data memory is provided with a file information area and a data memory area, wherein the data memory area comprises at least one data memory block; the file information area stores file information of a file, the file information directs at least one data storage block, and the data storage block stores file data of the file corresponding to the file information and state information of the data storage block. According to the method and the device, when the file data is written in, the target file is stored to the preset position according to the file information stored in the file information area and the state information of the data storage block stored in the data storage block, and the file information pointing to the corresponding file data is adjusted when the file data is read, so that the storage stability of the file data and the reading efficiency of the file data are improved when different types and different rights of files are stored.
Drawings
FIG. 1 is a schematic structural diagram of a file data storage system according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of file data storage partitioning according to an embodiment of the present invention
FIG. 3 is a schematic structural diagram of a file data writing device and a file data reading device according to an embodiment of the present invention;
FIG. 4 is a flowchart illustrating a file data writing method according to an embodiment of the present invention;
FIG. 5 is a flowchart illustrating a file data reading method according to an embodiment of the present invention;
FIG. 6 is a block diagram of a file data writing apparatus according to an embodiment of the present invention;
fig. 7 is a block diagram of a file data reading apparatus according to an embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
With the development of electronic technology, the functions of electronic devices are more and more complex. The electronic device needs to read executable object code (binary code) from an electrically erasable/non-erasable memory device to load into a local memory and execute it sequentially before operating, thereby implementing various complex functions. In the electronic equipment comprising the operating system, besides the data loading on power, various data with different lengths can be stored and extracted in each working stage, so that a complex file system is established to manage the data files. However, the conventional storage method does not consider space balance of disk writing, which results in short service life of a memory and low stability of file data storage, and meanwhile, when different types of file data are stored, different types of files often have different execution authorities. Therefore, how to improve the stability of file data storage and the efficiency of file data reading and writing is a technical problem that needs to be solved urgently.
To solve this problem, various embodiments of the file data storage, the writing method, and the reading method of the present invention are proposed. According to the file data writing method provided by the invention, when the file data is written, the target file is stored to the preset position according to the file information stored in the file information area and the state information of the data storage block stored in the data storage block; according to the file data reading method provided by the invention, the file information pointing to the corresponding file data is adjusted when the file data is read, so that the stability of file data storage and the efficiency of file data reading are improved when different types and different authority files are stored.
An embodiment of the present invention provides a file data storage system, and referring to fig. 1, fig. 1 is a schematic structural diagram of the file data storage system according to the present invention.
In this embodiment, the file data storage system includes:
at least one file data storage 100;
at least one file data writing device 200, said file data writing device 200 comprising: the system comprises a memory, a processor and a file data writing program which is stored on the memory and can run on the processor, wherein the file data writing program realizes the step of a file data writing method when being executed by the processor;
at least one file data reading device 300, said file data reading device 300 comprising: the file data reading method comprises a memory, a processor and a file data reading program which is stored on the memory and can run on the processor, wherein the file data reading program realizes the steps of the file data reading method when being executed by the processor.
In this embodiment, the file data storage is provided with a file information area and a data storage area, and the data storage area comprises at least one data storage block; the file information area stores file information of a file, the file information directs at least one data storage block, and the data storage block stores file data of the file corresponding to the file information and state information of the data storage block.
In some embodiments, the file comprises a first file and a second file; wherein: the first file is a read-only file, and the file information of the first file comprises a file name and a storage address; the second file is a writable file, and the file information of the second file includes a file name, a file number, and a storage address.
In some embodiments, the file comprises a first file and a second file; wherein: the first file is a read-only file, and the state information of the data storage block for storing the first file comprises the storage file length of the data storage block; the second file is a writable file, and the state information of the data storage block storing the second file comprises the storage file length of the data storage block and the writing times of the data storage block.
As shown in fig. 2, specifically, the file data memory may be a FLASH memory, and the FLASH memory is divided into a file information area and a data storage area; the file information area stores file information such as file names, file numbers, storage addresses and the like of the first file and the second file, and is used for reading and writing file data in the file data storage according to the file information; the data storage area is divided into at least one data storage block for storing file data of the first file and the second file, a storage file length, and the number of writes of the data block.
Further, the first file may be a read-only file, for example, in an audio system of a civil aircraft, the first file is an audio file and a configuration file, the audio file and the configuration file are files pre-stored in the audio system, and the type of file is a read-only file and is not changeable; the second file is a log file which is a file which needs to be accessed at any time when the audio system runs, and the type of file is a writable file which can be read and taken.
In this embodiment, 1024KB may be allocated to the file information area and the data storage area which are divided into the FLASH memory, and the data storage area is divided into an audio data storage area with 20 blocks of 2048 kbytes, a configuration data storage area with 20 blocks of 2048 kbytes, and a log data storage area with 3200 blocks of 128 kbytes.
After the division, the file information area and the data storage area can be respectively initialized; the method comprises the following steps that initialization operation of a data storage area is carried out, an audio file and a configuration file are written into data blocks of the audio data storage area and the configuration data storage area respectively, and the first 4 bytes of each data block can be used for storing the length of the file; and initializing the file information area, and writing the file names, the storage addresses and the file number of the audio files and the configuration files into the file information area.
After initialization, if a writing action or a reading action of a second file is received, writing a log data storage area in the data storage area into a log file and state information of a data storage block in each log data storage area, wherein the state information comprises the length of the storage file and the writing times of the data storage block; and simultaneously, writing the file name, the storage address and the file number of the log file in the file information area to finish the operation process corresponding to the writing action or the reading action.
As will be readily understood, in the present embodiment, the file data memory is allocated and initialized in the file area, and is divided into the file information partition and the data storage partition, and the name, the category, the number, and the storage block (storage address) of the file used by the file information partition system; the data storage area stores the audio, configuration and log file data used by the application software, and the information such as the use identification and length of the file.
The embodiment provides a file data storage, wherein a first file and a second file are stored in different areas, a simple file read-write operation interface mode is provided, when a file data writing device executes a writing action or a file data reading device executes a reading action, the read-write efficiency of the files can be improved, meanwhile, by means of the arrangement of data storage blocks in different data storage areas, file data can be written in uniformly when the data are written in, the service life of a magnetic disk is prolonged, and the requirement on the stability of the file data is met.
Referring to fig. 3, fig. 3 is a schematic structural diagram of a file data writing device and a file data reading device according to an embodiment of the present invention.
The device may be a User Equipment (UE) such as a Mobile phone, smart phone, laptop, digital broadcast receiver, Personal Digital Assistant (PDA), tablet computer (PAD), handheld device, vehicular device, wearable device, computing device or other processing device connected to a wireless modem, Mobile Station (MS), or the like. The device may be referred to as a user terminal, portable terminal, desktop terminal, etc.
Generally, the apparatus comprises: at least one processor 301, a memory 302, and a file data writing and file data reading program stored on said memory and executable on said processor, said file data writing and file data reading program being configured to implement the steps of the file data writing and file data reading method as described previously.
The processor 301 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and so on. The processor 301 may be implemented in at least one hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array). The processor 301 may also include a main processor and a coprocessor, where the main processor is a processor for processing data in an awake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 301 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content required to be displayed on the display screen. The processor 301 may further include an AI (Artificial Intelligence) processor for processing related file data writing and file data reading operations, so that the file data writing and file data reading model may be trained autonomously, improving efficiency and accuracy.
Memory 302 may include one or more computer-readable storage media, which may be non-transitory. Memory 302 may also include high speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In some embodiments, a non-transitory computer readable storage medium in the memory 302 is used to store at least one instruction for execution by the processor 801 to implement the file data writing and file data reading methods provided by the method embodiments of the present application.
In some embodiments, the terminal may further include: a communication interface 303 and at least one peripheral device. The processor 301, the memory 302 and the communication interface 303 may be connected by a bus or signal lines. Various peripheral devices may be connected to communication interface 303 via a bus, signal line, or circuit board. Specifically, the peripheral device includes: at least one of radio frequency circuitry 304, a display screen 305, and a power source 306.
The communication interface 303 may be used to connect at least one peripheral device related to I/O (Input/Output) to the processor 301 and the memory 302. The communication interface 303 is used for receiving the movement tracks of the plurality of mobile terminals uploaded by the user and other data through the peripheral device. In some embodiments, processor 301, memory 302, and communication interface 303 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 301, the memory 302 and the communication interface 303 may be implemented on a single chip or circuit board, which is not limited in this embodiment.
The Radio Frequency circuit 304 is used for receiving and transmitting RF (Radio Frequency) signals, also called electromagnetic signals. The radio frequency circuit 304 communicates with a communication network and other communication devices through electromagnetic signals, so as to obtain the movement tracks and other data of a plurality of mobile terminals. The rf circuit 304 converts an electrical signal into an electromagnetic signal to transmit, or converts a received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 304 comprises: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and so forth. The radio frequency circuitry 304 may communicate with other terminals via at least one wireless communication protocol. The wireless communication protocols include, but are not limited to: metropolitan area networks, various generation mobile communication networks (2G, 3G, 4G, and 5G), Wireless local area networks, and/or WiFi (Wireless Fidelity) networks. In some embodiments, the rf circuit 304 may further include NFC (Near Field Communication) related circuits, which are not limited in this application.
The display screen 305 is used to display a UI (User Interface). The UI may include graphics, text, icons, video, and any combination thereof. When the display screen 305 is a touch display screen, the display screen 305 also has the ability to capture touch signals on or over the surface of the display screen 305. The touch signal may be input to the processor 301 as a control signal for processing. At this point, the display screen 305 may also be used to provide virtual buttons and/or a virtual keyboard, also referred to as soft buttons and/or a soft keyboard. In some embodiments, the display screen 305 may be one, the front panel of the electronic device; in other embodiments, the display screens 305 may be at least two, respectively disposed on different surfaces of the electronic device or in a folded design; in still other embodiments, the display screen 305 may be a flexible display screen disposed on a curved surface or a folded surface of the electronic device. Even further, the display screen 305 may be arranged in a non-rectangular irregular figure, i.e. a shaped screen. The Display screen 305 may be made of LCD (liquid crystal Display), OLED (Organic Light-Emitting Diode), and the like.
The power supply 306 is used to power various components in the electronic device. The power source 306 may be alternating current, direct current, disposable or rechargeable. When the power source 306 includes a rechargeable battery, the rechargeable battery may support wired or wireless charging. The rechargeable battery may also be used to support fast charge technology.
Those skilled in the art will appreciate that the configuration shown in fig. 1 does not constitute a limitation of the file data writing device and the file data reading device, and may include more or less components than those shown, or some components in combination, or a different arrangement of components.
Based on the embodiment of the file data storage system shown in fig. 1, an embodiment of the present invention provides a file data writing method, and referring to fig. 4, fig. 4 is a flowchart illustrating an embodiment of the file data writing method according to the present invention.
In this embodiment, the file data writing method is used for a file data writing device, and the file data writing method includes the following steps:
step S100, when the target file is received, identifying the file type of the file.
In practical application, if a received target file is written, the target file is usually a first file and a second file; the first file is a read-only file such as an audio file or a configuration file, and the second file is a writable file such as a log file.
Specifically, when the target file is received, identifying the file type of the target file, and if the target file is the first file, terminating the writing action; and if the target file is the second file, executing subsequent file data writing actions.
Step S200, if the file type is the target file type, obtaining the file name of the target file, and judging whether the original file with the same file name is stored in the file data storage.
Specifically, the target file type is a writable file, i.e., the second file. Therefore, if the file type is identified as the second file, the file name of the target file is acquired, and whether the original file with the same file name is recorded in the corresponding file information area is searched in the file data memory according to the file name.
Further, if the file type is the second file, the file name of the target file is acquired, the file information area of the file data storage is facilitated, and the file names stored in the file information area are matched to judge whether the original files with the same file names are stored in the file information area.
Step S300, if yes, determining a target data storage block based on the state information of the data storage block, and moving the file data of the original file to the target data storage block.
Specifically, the status information of the data storage block includes the number of writes of the data storage block. Therefore, if an original file with the same file name in the file data storage is judged, the target data storage block can be determined based on the writing times of the data storage block, and the file data of the original file can be moved to the target data storage block.
It should be noted that before moving the file data of the original file to the target data storage block, it is also necessary to determine whether the file is occupied, so as to prevent abnormal operation of the device caused by moving the file data.
In this embodiment, the target data storage block is a data storage block with the smallest write-in frequency or a data storage block with a smaller write-in frequency, and then when it is determined that the current target file is stored in the file storage region, the storage position of the data corresponding to the target file is adjusted, so that the file data of the target file is stored in the data storage block with the smallest write-in frequency or the smallest write-in frequency, frequent reading and writing in a certain region is avoided by writing the data blocks in a balanced manner, the practical life of the FLASH memory is prolonged, and the stability of file data storage is improved.
Step S400, otherwise, writing the file data of the target file into the file data memory, and adjusting the file data of the target file type stored in the data storage blocks in the file data memory, so that the file information of the file of each target file type can direct the same number of data storage blocks.
Specifically, if it is determined that the original file does not have the same file name in the file data storage, the file is a new file that needs to be stored.
At the moment, writing the file data of the target file into the file data memory, and acquiring the file number of the file of the target file type in the file data memory; determining the number of data storage blocks allocated to the file of each target file type based on the number of files; and moving the file data of the files of the target file types according to the number of the data storage blocks so that the file information of the files of each target file type directs the data storage blocks of the same number.
It is easy to understand that when a target file needs to be listed in the file data storage, the file data corresponding to the target file is written into the file storage area, the number of files stored in the current file storage area is judged, and then the corresponding file storage blocks are allocated to each file according to the number of files, so that the same number of data storage blocks are allocated to each file, a storage space with a proper storage size can be provided for each file, and the writing and reading efficiency of the file is improved.
In this embodiment, whether a target file is an existing file is determined by the file name stored in the file data storage, if the target file is an existing file, the file is moved to a data storage block with a small number of writing times, and if the target file is a new file, the data storage block in which each file stores file data is reallocated, so that a reasonable storage space is allocated to each file, and the read-write efficiency of the file is improved while the service life of a disk is prolonged.
Based on the embodiment of the file data storage system shown in fig. 1, an embodiment of the present invention provides a file data reading method, and referring to fig. 5, fig. 5 is a flowchart illustrating an embodiment of a file data reading method according to the present invention.
In this embodiment, the file data reading method is used for a file data reading device, and the file data reading method includes the following steps:
step S500, when receiving a file reading instruction, determining whether a target file is stored in the file data storage.
Specifically, in this embodiment, the file reading instruction includes a file name of the target file, and when the file reading instruction is received, whether the target file exists in the file data storage is determined, and the file name list stored in the file information area can be obtained by using the file information area of the file data storage, and then the file name list is queried to determine whether the file name list has the file name of the target file.
It is easy to understand that if the file name list has the file name of the target file, the subsequent file reading action may be executed, and if the file name does not have the file name of the target file, the file reading action is terminated.
Step S600, if yes, obtaining file information of the target file, and reading file data of the target file from at least one data storage block pointed by the file information.
Specifically, in this embodiment, the file information includes a storage address, so as to read file data of a target file, and a data storage block for storing the target file is determined according to the storage address by obtaining the storage address of the target file; and determining the file data of the target file based on the storage file length of the data storage block, and reading the file data.
It is easy to understand that before the step of reading the file data of the target file, whether the file is occupied or not needs to be checked, so as to prevent the inaccurate reading of the file data caused by the operation of the device.
In this embodiment, the file name of the target file is identified in the file information area, so as to determine whether the data storage area stores the file data of the target file, and the data storage block can be queried according to the file information corresponding to the file name, and the file data of the target file is read in the data storage block.
Referring to fig. 6, fig. 6 is a block diagram of a file data writing device according to an embodiment of the present invention.
As shown in fig. 6, the file data writing apparatus according to the embodiment of the present invention includes:
the identification module 10 is used for identifying the file type of the file when the target file is received;
a first determining module 20, configured to, if the file type is a target file type, obtain a file name of the target file, and determine whether an original file with the same file name is stored in the file data storage;
a moving module 30, configured to determine a target data storage block based on the state information of the data storage block if the file data of the original file is stored in the target data storage block;
and an adjusting module 40, configured to write the file data of the target file into the file data storage if the file data of the target file is not written, and adjust the file data of the target file type stored in the data storage block in the file data storage, so that the file information of the file of each target file type directs the same number of data storage blocks.
As an implementation manner, the target file type is a writable file, and the first determining module 20 is further configured to obtain a file name of the target file if the file type is a writable file; and traversing the file information area of the file data memory, and matching the file names stored in the file information area to judge whether the original files with the same file names are stored in the file information area.
In one embodiment, the status information of the data storage block includes the number of writes of the data storage block, and the target data storage block is the data storage block with the smallest number of writes.
As an implementation manner, the adjusting module 40 is further configured to write the file data of the target file into the file data storage, and obtain the file number of the file of the target file type in the file data storage; determining the number of data storage blocks allocated to the file of each target file type based on the number of files; and moving the file data of the files of the target file types according to the number of the data storage blocks so that the file information of the files of each target file type directs the data storage blocks of the same number.
In this embodiment, whether a target file is an existing file is determined by the file name stored in the file data storage, if the target file is an existing file, the file is moved to a data storage block with a small number of writing times, and if the target file is a new file, the data storage block in which each file stores file data is reallocated, so that a reasonable storage space is allocated to each file, and the read-write efficiency of the file is improved while the service life of a disk is prolonged.
Other embodiments or specific implementation manners of the file data writing device of the present invention may refer to the above method embodiments, and are not described herein again.
Referring to fig. 7, fig. 7 is a block diagram of a file data reading apparatus according to an embodiment of the present invention.
As shown in fig. 7, the file data reading apparatus according to the embodiment of the present invention includes:
a second judging module 50, configured to judge whether a target file is stored in the file data storage when a file reading instruction is received;
and a reading module 60, configured to, if yes, obtain file information of the target file, and read file data of the target file in at least one data storage block pointed by the file information.
As an implementation manner, the file reading instruction includes a file name of the target file, and the second determining module 50 is further configured to traverse a file information area of the file data storage to obtain a file name list stored in the file information area; and inquiring the file name list, and determining whether the file name of the target file exists in the file name list.
As an embodiment, the file information includes a storage address, and the reading module 60 is further configured to obtain the storage address of the target file, and determine, according to the storage address, a data storage block for storing the target file; and determining the file data of the target file based on the storage file length of the data storage block, and reading the file data.
In this embodiment, the file name of the target file is identified in the file information area, so as to determine whether the data storage area stores the file data of the target file, and the data storage block can be queried according to the file information corresponding to the file name, and the file data of the target file is read in the data storage block.
Other embodiments or specific implementation manners of the file data reading device of the present invention may refer to the above method embodiments, and are not described herein again.
In addition, an embodiment of the present invention further provides a storage medium, where a file data writing program is stored on the storage medium, and the file data writing program, when executed by a processor, implements the steps of the file data writing method described above. In addition, an embodiment of the present invention further provides a storage medium, where a file data reading program is stored on the storage medium, and the file data reading program, when executed by a processor, implements the steps of the file data reading method described above. Therefore, a detailed description thereof will be omitted.
In addition, the beneficial effects of the same method are not described in detail. For technical details not disclosed in embodiments of the computer-readable storage medium referred to in the present application, reference is made to the description of embodiments of the method of the present application. It is determined that, by way of example, the program instructions may be deployed to be executed on one computing device or on multiple computing devices at one site or distributed across multiple sites and interconnected by a communication network.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
It should be noted that the above-described embodiments of the apparatus are merely schematic, where the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. In addition, in the drawings of the embodiment of the apparatus provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, and may be specifically implemented as one or more communication buses or signal lines. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that the present invention may be implemented by software plus necessary general hardware, and may also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components and the like. Generally, functions performed by computer programs can be easily implemented by corresponding hardware, and specific hardware structures for implementing the same functions may be various, such as analog circuits, digital circuits, or dedicated circuits. However, the implementation of a software program is a more preferable embodiment for the present invention. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, where the computer software product is stored in a readable storage medium, such as a floppy disk, a usb disk, a removable hard disk, a Read-only memory (ROM), a random-access memory (RAM), a magnetic disk or an optical disk of a computer, and includes instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the methods according to the embodiments of the present invention.

Claims (10)

1. A file data memory is characterized in that the file data memory is provided with a file information area and a data storage area, and the data storage area comprises at least one data storage block; the file information area stores file information of a file, the file information directs at least one data storage block, and the data storage block stores file data of the file corresponding to the file information and state information of the data storage block.
2. The file data store of claim 1, wherein the file comprises a first file and a second file; wherein: the first file is a read-only file, and the file information of the first file comprises a file name and a storage address; the second file is a writable file, and the file information of the second file includes a file name, a file number, and a storage address.
3. The file data store of claim 1, wherein the file comprises a first file and a second file; wherein: the first file is a read-only file, and the state information of the data storage block for storing the first file comprises the storage file length of the data storage block; the second file is a writable file, and the state information of the data storage block storing the second file comprises the storage file length of the data storage block and the writing times of the data storage block.
4. A file data writing method for a file data writing apparatus for writing file data to a file data storage according to any one of claims 1 to 3, the file data writing method comprising the steps of:
when a target file is received, identifying the file type of the file;
if the file type is a target file type, acquiring the file name of the target file, and judging whether an original file with the same file name is stored in the file data storage;
if yes, determining a target data storage block based on the state information of the data storage block, and moving the file data of the original file to the target data storage block;
otherwise, writing the file data of the target file into the file data memory, and adjusting the file data of the target file type stored in the data storage blocks in the file data memory, so that the file information of the file of each target file type directs the data storage blocks with the same number.
5. The file data writing method according to claim 4, wherein the target file type is a writable file; if the file type is a target file type, acquiring a file name of the target file, and judging whether an original file with the same file name is stored in the file data storage, wherein the steps specifically comprise:
if the file type is a writable file, acquiring the file name of the target file;
and traversing the file information area of the file data memory, and matching the file names stored in the file information area to judge whether the original files with the same file names are stored in the file information area.
6. The file data writing method according to claim 5, wherein the status information of the data storage block includes a number of writes of the data storage block, and the target data storage block is the data storage block with the smallest number of writes.
7. The file data writing method according to claim 6, wherein the step of writing the file data of the target file into the file data storage, and adjusting the file data of the target file type stored in the data storage blocks in the file data storage, so that the file information of each file of the target file type directs the same number of data storage blocks, specifically comprises:
writing the file data of the target file into the file data storage, and acquiring the file number of the target file type file in the file data storage;
determining the number of data storage blocks allocated to the file of each target file type based on the number of files;
and moving the file data of the files of the target file types according to the number of the data storage blocks so that the file information of the files of each target file type directs the data storage blocks of the same number.
8. A file data reading method for a file data reading apparatus for reading file data to the file data storage according to any one of claims 1 to 3, the file data reading method comprising the steps of:
when a file reading instruction is received, judging whether a target file is stored in the file data storage;
if so, acquiring the file information of the target file, and reading the file data of the target file in at least one data storage block pointed by the file information.
9. The file data reading method according to claim 8, wherein the file reading instruction includes a file name of a target file; the step of judging whether the file data storage stores the target file specifically comprises:
traversing a file information area of the file data memory to obtain a file name list stored in the file information area;
and inquiring the file name list, and determining whether the file name of the target file exists in the file name list.
10. The method for reading file data according to claim 8, wherein the file information includes a storage address, the step of obtaining the file information of the target file and reading the file data of the target file in at least one of the data storage blocks pointed by the file information specifically includes:
acquiring a storage address of the target file, and determining a data storage block for storing the target file according to the storage address;
and determining the file data of the target file based on the storage file length of the data storage block, and reading the file data.
CN202111558282.3A 2021-12-17 File data storage, writing method, reading method and storage system Active CN114237513B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111558282.3A CN114237513B (en) 2021-12-17 File data storage, writing method, reading method and storage system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111558282.3A CN114237513B (en) 2021-12-17 File data storage, writing method, reading method and storage system

Publications (2)

Publication Number Publication Date
CN114237513A true CN114237513A (en) 2022-03-25
CN114237513B CN114237513B (en) 2024-07-02

Family

ID=

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106775488A (en) * 2016-12-27 2017-05-31 维沃移动通信有限公司 The storage method and mobile terminal of a kind of file
CN107239526A (en) * 2017-05-27 2017-10-10 河南思维轨道交通技术研究院有限公司 File system implementation method, scrap cleaning method, operating position localization method
CN107450859A (en) * 2017-08-14 2017-12-08 北京盛和大地数据科技有限公司 A kind of method and apparatus for reading file data
CN107665098A (en) * 2017-09-05 2018-02-06 联想(北京)有限公司 Information processing method, storage device and computer-readable storage medium
CN108664218A (en) * 2018-04-23 2018-10-16 浙江大华技术股份有限公司 A kind of SSD storage methods based on data characteristics, apparatus and system
CN109189772A (en) * 2018-08-21 2019-01-11 华清瑞达(天津)科技有限公司 File management method and system for no file system storage medium
CN109669621A (en) * 2017-10-13 2019-04-23 杭州海康威视***技术有限公司 A kind of file management method, file management system, electronic equipment and storage medium
CN110134645A (en) * 2019-04-15 2019-08-16 深圳市战音科技有限公司 File system memory management method, read method, managing device and reading device
CN111158948A (en) * 2019-12-30 2020-05-15 深信服科技股份有限公司 Data storage and verification method and device based on duplicate removal and storage medium
CN111723056A (en) * 2020-06-09 2020-09-29 北京青云科技股份有限公司 Small file processing method, device, equipment and storage medium
US20210034248A1 (en) * 2019-07-31 2021-02-04 EMC IP Holding Company LLC File layer to block layer communication for block organization in storage
CN112631516A (en) * 2020-12-22 2021-04-09 上海宏力达信息技术股份有限公司 FLASH file management system with service life management function

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106775488A (en) * 2016-12-27 2017-05-31 维沃移动通信有限公司 The storage method and mobile terminal of a kind of file
CN107239526A (en) * 2017-05-27 2017-10-10 河南思维轨道交通技术研究院有限公司 File system implementation method, scrap cleaning method, operating position localization method
CN107450859A (en) * 2017-08-14 2017-12-08 北京盛和大地数据科技有限公司 A kind of method and apparatus for reading file data
CN107665098A (en) * 2017-09-05 2018-02-06 联想(北京)有限公司 Information processing method, storage device and computer-readable storage medium
CN109669621A (en) * 2017-10-13 2019-04-23 杭州海康威视***技术有限公司 A kind of file management method, file management system, electronic equipment and storage medium
CN108664218A (en) * 2018-04-23 2018-10-16 浙江大华技术股份有限公司 A kind of SSD storage methods based on data characteristics, apparatus and system
CN109189772A (en) * 2018-08-21 2019-01-11 华清瑞达(天津)科技有限公司 File management method and system for no file system storage medium
CN110134645A (en) * 2019-04-15 2019-08-16 深圳市战音科技有限公司 File system memory management method, read method, managing device and reading device
US20210034248A1 (en) * 2019-07-31 2021-02-04 EMC IP Holding Company LLC File layer to block layer communication for block organization in storage
CN111158948A (en) * 2019-12-30 2020-05-15 深信服科技股份有限公司 Data storage and verification method and device based on duplicate removal and storage medium
CN111723056A (en) * 2020-06-09 2020-09-29 北京青云科技股份有限公司 Small file processing method, device, equipment and storage medium
CN112631516A (en) * 2020-12-22 2021-04-09 上海宏力达信息技术股份有限公司 FLASH file management system with service life management function

Similar Documents

Publication Publication Date Title
US11507299B2 (en) Method for processing data and electronic device supporting same
CN108415739B (en) Hook method and device for dynamic link library function and storage medium
CN110168487B (en) Touch control method and device
CN105718281B (en) A kind of touch screen firmware upgrade method and device
KR20100088210A (en) Apparatus and method for downloadin contents using movinand in portable terminal
CN112445766A (en) Terminal fragment sorting method and device and terminal
CN109582377A (en) BIOS option amending method, device, equipment and storage medium
CN103959199A (en) Power saving method and apparatus for first in first out (FIFO) memories
CN103761129A (en) Method of implementing SDIO (secure digital input/output) interface drive in Boot loader layer
CN114048168A (en) Electronic archive filing method, device, equipment, system and storage medium
CN111399874A (en) System upgrading method and device, storage medium and intelligent wearable device
CN112463199A (en) System upgrading method and terminal
US11853483B2 (en) Image processing method and apparatus for smart pen including pressure switches, and electronic device
CN104102560A (en) Method and device for testing system performance
EP3706003B1 (en) Electronic device and method for utilizing memory space thereof
US11086538B2 (en) Method and electronic device for initializing storage
US20230244406A1 (en) Electronic device and storage management method using same
CN111949145A (en) Intelligent pen image processing method and device and electronic equipment
CN114237513B (en) File data storage, writing method, reading method and storage system
CN111931600A (en) Intelligent pen image processing method and device and electronic equipment
CN114237513A (en) File data memory, writing method, reading method and storage system
CN113225234B (en) Asset detection method, device, terminal equipment and computer readable storage medium
CN107025058B (en) Information writing method and device of mobile terminal and mobile terminal
CN113272785A (en) Method for mounting file system, terminal equipment and storage medium
CN113888669A (en) Winding layout drawing method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant