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

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

Info

Publication number
CN114237513B
CN114237513B CN202111558282.3A CN202111558282A CN114237513B CN 114237513 B CN114237513 B CN 114237513B CN 202111558282 A CN202111558282 A CN 202111558282A CN 114237513 B CN114237513 B CN 114237513B
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.)
Active
Application number
CN202111558282.3A
Other languages
Chinese (zh)
Other versions
CN114237513A (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
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

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 memory system. The file data storage is provided with a file information area and a data storage area, wherein the data storage area comprises at least one data storage block; the file information area stores file information of files, the file information guides at least one data storage block, and the data storage block stores file data of the files 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, 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 when the file data is read, the file information pointing to the corresponding file data is adjusted, so that the stability of file data storage and the efficiency of file data reading are improved when files with different types and different authorities are stored.

Description

File data storage, writing method, reading method and storage system
Technical Field
The present invention relates to the field of data storage technologies, and 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 becoming more and more complex. The electronic device needs to read executable object codes (binary codes) from the electrically erasable/non-erasable storage device before operation, load the executable object codes into a local memory and sequentially execute the executable object codes, thereby realizing various complex functions. In an electronic device including an operating system, in addition to powering on and loading data, various data with different lengths are stored and extracted at each working stage, so that a complex file system is established to manage data files.
However, the traditional storage mode does not consider the space balance of disk writing, so that the service life of a memory is short, the storage stability of file data is not high, meanwhile, when different types of file data are stored, different execution authorities of different types of files often appear, the traditional storage mode for establishing a directory index has strong universality, and the writing and reading efficiency of the files is low. 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.
The foregoing is provided merely for the purpose of facilitating understanding of the technical solutions of the present invention and is not intended to represent an admission that the foregoing 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 file data reading and writing efficiency of the existing file storage system.
In order to achieve the above object, the present invention provides a file data storage device, the file data storage device being provided with a file information area and a data storage area, the data storage area including at least one data storage block; the file information area stores file information of files, the file information guides at least one data storage block, and the data storage block stores file data of the files corresponding to the file information and state information of the data storage block.
In the invention, file information of a stored file is stored through a file information area, file data and state information of a data storage block are stored through a data storage block of a data storage area, so that the file data storage performs a reading operation according to the file information, and a storing operation is performed 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 comprises file names, file quantity and storage addresses.
In the invention, by storing the file name and the storage address of the read-only file and storing the file name, the number of files and the storage address of the readable file, corresponding operations are executed according to the storage address when the storage and the 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 for storing the second file comprises the storage file length of the data storage block and the writing times of the data storage block.
In the invention, the reading operation is executed according to the length of the storage file when the reading is carried out, and the storage operation is executed according to the writing times when the storing is carried out by the length of the storage file of the data storage block for storing the read-only file and the length of the storage file and the writing times of the data storage block for storing the readable file.
In addition, 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 memory as described above, the file data writing method comprising the steps of:
when receiving a target file, 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 the file data memory stores the original file with the same file name;
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 same number of data storage blocks.
According to the method and the device, 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, and when the file data is read, the file information pointing to the corresponding file data is adjusted, so that the stability of file data storage and the efficiency of file data reading are improved when files of different types and different authorities 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 method specifically comprises the following steps:
If the file type is a writable file, acquiring the file name of the target file;
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 when the target file is written, thereby avoiding repeated storage and improving the use efficiency of the file data memory.
Optionally, the state information of the data storage block includes the writing times of the data storage block, and the target data storage block is the data storage block with the minimum writing times.
In the invention, when writing the file data, the file data is written into the data storage block with the minimum writing times in the file data storage, so that the use balance of the data storage block in the file data storage is maintained, 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 block of 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 memory to obtain the number of files of the target file type in the file data memory;
determining the number of data storage blocks allocated for each file of the target file type based on the number of files;
And moving file data of the files of the target file types according to the number of the data storage blocks so that file information of the files of each target file type guides the same number of the data storage blocks.
In the invention, when writing in file data, the number of files of a target file type in the file data memory is obtained, and the data storage blocks corresponding to the file data are determined according to the number of files, so that the use balance of the data storage blocks 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 memory 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 memory;
if yes, acquiring file information of the target file, and reading file data of the target file in at least one data storage block guided by the file information.
In the invention, when the file data is read, the file information of the target file is acquired according to the reading instruction, then the file data is read according to the data storage block guided by the file information, and the file information area and the data storage area of the file data storage are divided, so that the file data reading efficiency is improved.
Optionally, the file reading instruction includes a file name of the target file; the step of judging whether the file data memory stores the target file specifically includes:
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 guided 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 file data of the target file based on the stored file length of the data storage block, and reading the file data.
In the invention, when the file data is read, the storage address of the target file stored in the file information area and the storage file length of the data storage block are obtained, the file data of the data storage block corresponding to the storage address is read, 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.
In addition, in order to achieve the above object, the present invention also provides a file data writing apparatus comprising:
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 file data memory stores the original file with the same file name or not;
the moving module is used for determining a target data storage block based on the state information of the data storage block if yes, and moving the file data of the original file to 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 blocks in the file data memory so that the file information of the file of each target file type guides the same number of data storage blocks.
In addition, in order to achieve the above object, the present invention also provides a document data reading apparatus including:
the second judging module is used for judging whether the target file is stored in the file data memory or not when a file reading instruction is received;
And the reading module is used for acquiring the file information of the target file if the target file is 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: the file data writing device comprises a memory, a processor and a file data writing program which is stored in the memory and can run on the processor, wherein the file data writing program realizes the steps of the file data writing method when being executed by the processor;
At least one document data reading device, the document data reading device comprising: the file data reading device comprises a memory, a processor and a file data reading program which is stored in 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 addition, 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 storage is provided with a file information area and a data storage area, wherein the data storage area comprises at least one data storage block; the file information area stores file information of files, the file information guides at least one data storage block, and the data storage block stores file data of the files 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, 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 when the file data is read, the file information pointing to the corresponding file data is adjusted, so that the stability of file data storage and the efficiency of file data reading are improved when files with different types and different authorities are stored.
Drawings
FIG. 1 is a schematic diagram of a file data storage system according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of the partitioning of a data memory in accordance with an embodiment of the present invention
FIG. 3 is a schematic 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 an embodiment of a method for writing file data according to the present invention;
FIG. 5 is a flowchart illustrating an embodiment of a method for reading file data according to the present invention;
FIG. 6 is a block diagram illustrating a file data writing apparatus according to an embodiment of the present invention;
fig. 7 is a block diagram of a file data reading device according to an embodiment of the present invention.
The achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
With the development of electronic technology, the functions of electronic devices are becoming more and more complex. The electronic device needs to read executable object codes (binary codes) from the electrically erasable/non-erasable storage device before operation, load the executable object codes into a local memory and sequentially execute the executable object codes, thereby realizing various complex functions. In an electronic device including an operating system, in addition to powering on and loading data, various data with different lengths are stored and extracted at each working stage, so that a complex file system is established to manage data files. However, the traditional storage mode does not consider the space balance of disk writing, so that the service life of a memory is short, the storage stability of file data is not high, meanwhile, when different types of file data are stored, different execution authorities of different types of files often appear, the traditional storage mode for establishing a directory index has strong universality, and the writing and reading efficiency of the files is low. 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.
In order to solve this problem, various embodiments of the file data storage, writing method, reading method of the present invention are presented. According to the file data writing method, when writing file data, a target file is stored to a preset position according to file information stored in a file information area and state information of a data storage block stored in a data storage block; according to the file data reading method, when the file data is read, the file information pointing to the corresponding file data is adjusted, so that the stability of file data storage and the efficiency of file data reading are improved when files with different types and different authorities 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 of the present invention.
In this embodiment, the file data storage system includes:
at least one file data store 100;
At least one file data writing apparatus 200, the file data writing apparatus 200 comprising: the device comprises a memory, a processor and a file data writing program which is stored in the memory and can run on the processor, wherein the file data writing program realizes the steps of a file data writing method when being executed by the processor;
At least one file data reading device 300, the file data reading device 300 comprising: the file data reading device comprises a memory, a processor and a file data reading program which is stored in the memory and can run on the processor, wherein the file data reading program realizes the steps of a file data reading method when being executed by the processor.
In this embodiment, the file data memory is provided with a file information area and a data memory area, and the data memory area includes at least one data memory block; the file information area stores file information of files, the file information guides at least one data storage block, and the data storage block stores file data of the files corresponding to the file information and state information of the data storage block.
In some embodiments, 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 comprises file names, file quantity and storage addresses.
In some embodiments, 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 for 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, in particular, the file data memory may be a FLASH memory, which 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 writing times of the data blocks.
Further, the first file may be a read-only file, for example, in an audio system of a civil aviation passenger plane, the first file is an audio file and a configuration file, the audio file and the configuration file are files stored in the audio system in advance, and the type of files are read-only files and cannot be changed; the second file is a log file, the log file is a file which needs to be accessed at any time when the audio system operates, and the type of file is a writable file and readable.
In this embodiment, the file information area and the data storage area divided for the FLASH memory may be 1024KB, and the data storage area is divided into an audio data storage area of 20 blocks 2048 kbytes, a configuration data storage area of 20 blocks 2048 kbytes, and a log data storage area of 3200 blocks 128 kbytes.
After the division, the file information area and the data storage area can be initialized respectively; the method comprises the steps of initializing a data storage area, writing an audio file and a configuration file into data blocks of the audio data storage area and the configuration data storage area respectively, wherein the first 4 bytes of each data block can be used for storing the file length; and initializing the file information area, and writing the file names, the storage addresses and the file numbers of the audio files and the configuration files into the file information area.
After initialization, if a writing action or a reading action for the second file is received, writing the log data storage area in the data storage area into the log file and state information of the data storage blocks 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 blocks; meanwhile, in the file information area, the file name, the storage address and the number of the files of the log file are written in, and the operation process corresponding to the writing action or the reading action is completed.
It is easy to understand that in this embodiment, the file data memory is divided into the file information partition and the data storage partition by performing the file area allocation and initialization on the file data memory, 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 three types of file data, namely audio frequency, configuration and log, used by application software, and information such as use identification and length of files.
The embodiment provides a file data memory, by storing a first file and a second file in different areas, a compact 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 a file can be improved, meanwhile, by utilizing the arrangement of data storage blocks in different data storage areas, file data can be uniformly written when data is written, the service life of a disk is prolonged, and the requirement of file data stability 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 Mobile phone, a smart phone, a notebook computer, a digital broadcast receiver, a Personal Digital Assistant (PDA), a tablet computer (PAD), or other User Equipment (UE), a handheld device, an in-vehicle device, a wearable device, a computing device, or other processing device connected to a wireless modem, a Mobile Station (MS), or the like. The device may be referred to as a user terminal, portable terminal, desktop terminal, etc.
Generally, an 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 above.
Processor 301 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like. The processor 301 may be implemented in at least one hardware form of DSP (DIGITAL SIGNAL Processing), FPGA (Field-Programmable gate array), PLA (Programmable Logic Array ). Processor 301 may also include a main processor, which is a processor for processing data in an awake state, also referred to as a CPU (Central ProcessingUnit ), and a coprocessor; a coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 301 may integrate a GPU (Graphics Processing Unit, image processor) for rendering and drawing of content required to be displayed by the display screen. The processor 301 may also include an AI (ARTIFICIAL INTELLIGENCE ) processor for handling relevant file data writing and file data reading operations so that the file data writing and file data reading models may be self-training learning, 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 memory 302 is used to store at least one instruction for execution by 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 optionally 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. The respective peripheral devices may be connected to the communication interface 303 through 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 supply 306.
The communication interface 303 may be used to connect at least one peripheral device associated with an I/O (Input/Output) to the processor 301 and the memory 302. The communication interface 303 is used to receive the movement tracks of the plurality of mobile terminals and other data uploaded by the user 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, either or both of the processor 301, the memory 302, and the communication interface 303 may be implemented on separate chips or circuit boards, which is not limited in this embodiment.
The Radio Frequency circuit 304 is configured to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 304 communicates with a communication network and other communication devices through electromagnetic signals, so that movement trajectories and other data of a plurality of mobile terminals can be acquired. The radio frequency circuit 304 converts an electrical signal into an electromagnetic signal for transmission, or converts a received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 304 includes: antenna systems, RF transceivers, one or more amplifiers, tuners, oscillators, digital signal processors, codec chipsets, subscriber identity module cards, and so forth. The radio frequency circuitry 304 may communicate with other terminals via at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to: metropolitan area networks, various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks, and/or WiFi (WIRELESS FIDELITY ) networks. In some embodiments, the radio frequency circuit 304 may further include NFC (NEAR FIELD Communication) related circuits, which is not limited by the present 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 305 is a touch screen, the display 305 also has the ability to collect touch signals at or above the surface of the display 305. The touch signal may be input as a control signal to the processor 301 for processing. At this point, the display 305 may also be used to provide virtual buttons and/or virtual keyboards, also referred to as soft buttons and/or soft keyboards. In some embodiments, the display 305 may be one, the front panel of an electronic device; in other embodiments, the display screen 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 305 may be a flexible display disposed on a curved surface or a folded surface of the electronic device. Even more, the display screen 305 may be arranged in an irregular pattern other than rectangular, i.e., a shaped screen. The display 305 may be made of LCD (LiquidCrystal Display ), OLED (Organic Light-Emitting Diode) or other materials.
The power supply 306 is used to power the various components in the electronic device. The power source 306 may be alternating current, direct current, disposable or rechargeable. When the power source 306 comprises a rechargeable battery, the rechargeable battery may support wired or wireless charging. The rechargeable battery may also be used to support fast charge technology.
It will be appreciated by those skilled in the art that the structure 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 illustrated, or may combine certain components, or may be arranged in different components.
Based on the embodiment of the file data storage system shown in fig. 1, the embodiment of the invention provides a file data writing method, and referring to fig. 4, fig. 4 is a flow chart of the embodiment of the file data writing method of the invention.
In this embodiment, the method for writing file data is used for a device for writing file data, and the method for writing file data includes the following steps:
step S100, when receiving the target file, identifying the file type of the file.
In practical application, if the received target file is written, the target file is usually a first file and a second file; wherein 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 receiving the target file, 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 the subsequent file data writing action.
Step S200, if the file type is the target file type, acquiring the file name of the target file, and judging whether the file data storage stores the original file with the same file name.
Specifically, the target file type is a writable file, i.e., a second file. Therefore, if the file type is identified as the second file, the file name of the target file is obtained, 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 obtained, the file information area of the file data memory is facilitated, and the file names stored in the file information area are matched to judge whether the original files with the same file name are stored in the file information area.
And step S300, if so, 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 state information of the data storage block includes the number of writes of the data storage block. Therefore, if the 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.
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 minimum writing frequency or a data storage block with the small writing frequency, so that when the current target file is judged to be stored in the file storage area, 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 small writing frequency or the minimum writing frequency, frequent reading and writing of a certain area are avoided by means of uniformly writing the data block, the service life of the FLASH memory is prolonged, and the stability of storing the file data 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 directs the same number of data storage blocks.
Specifically, if it is determined that the file data memory does not have the original file with the same file name, the file is a new file to be stored.
At this time, writing the file data of the target file into the file data memory to obtain the number of files of the target file type in the file data memory; determining the number of data storage blocks allocated for each file of the target file type based on the number of files; and moving file data of the files of the target file types according to the number of the data storage blocks so that file information of the files of each target file type guides the same number of the data storage blocks.
It is easy to understand that when the 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, then the number of files stored in the current file storage area is judged, and further corresponding file storage blocks are allocated to each file according to the number of files, so that the same number of data storage blocks allocated to each file is met, 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, the file name stored in the file data is stored, whether the target file is an existing file is determined, if the target file is an existing file, the file is moved to a data storage block with fewer writing times, if the target file is a new file, the data storage block storing the file data of each file is redistributed, and further a reasonable storage space is allocated for each file, so that the read-write efficiency of the file is improved, and the service life of the disk is prolonged.
Based on the embodiment of the file data storage system shown in fig. 1, the embodiment of the invention provides a file data reading method, and referring to fig. 5, fig. 5 is a flow chart of the embodiment of the file data reading method of the invention.
In this embodiment, the method for reading file data is used for a file data reading device, and the method for reading file data includes the following steps:
step S500, when receiving a file reading instruction, judging whether a target file is stored in the file data memory.
Specifically, in this embodiment, the file reading instruction includes a file name of the target file, and further when the file reading instruction is received, it is determined whether the target file exists in the file data storage, and whether the file name of the target file exists in the file name list is determined by searching the file name list after the file name list stored in the file information area is obtained by facilitating the file information area of the file data storage.
It is easy to understand that if the file name of the target file is in the file name list, the subsequent file reading action can be executed, and if the file name of the target file is not in the file name list, the file reading action is terminated.
And step S600, if yes, acquiring file information of the target file, and reading file data of the target file in at least one data storage block guided by the file information.
Specifically, in this embodiment, the file information includes a storage address, and further, file data of a target file is read, and a data storage block for storing the target file may be determined according to the storage address by acquiring the storage address of the target file; and determining file data of the target file based on the stored 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, it is also necessary to check whether the file is occupied, so as to prevent inaccurate file data reading 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 file data of the target file is stored in the data storage area, 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 illustrating an embodiment of a file data writing apparatus according to the present invention.
As shown in fig. 6, a file data writing device according to an embodiment of the present invention includes:
an identification module 10, configured to identify a file type of a target file when the target file is received;
A first judging module 20, configured to obtain a file name of the target file if the file type is the target file type, and judge 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 yes, and move the file data of the original file to the target data storage block;
And the adjustment module 40 is configured to write the file data of the target file into the file data storage, and adjust the file data of the target file type stored in the data storage block of 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; 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.
As one embodiment, the state information of the data storage block includes a number of writing times of the data storage block, and the target data storage block is the data storage block with the minimum number of writing times.
As one embodiment, the adjustment module 40 is further configured to write the file data of the target file into the file data storage, and obtain the number of files of the target file type in the file data storage; determining the number of data storage blocks allocated for each file of the target file type based on the number of files; and moving file data of the files of the target file types according to the number of the data storage blocks so that file information of the files of each target file type guides the same number of the data storage blocks.
In this embodiment, the file name stored in the file data is stored, whether the target file is an existing file is determined, if the target file is an existing file, the file is moved to a data storage block with fewer writing times, if the target file is a new file, the data storage block storing the file data of each file is redistributed, and further a reasonable storage space is allocated for each file, so that the read-write efficiency of the file is improved, and the service life of the 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 illustrating an embodiment of a document data reading apparatus according to the present invention.
As shown in fig. 7, a file data reading apparatus according to an embodiment of the present invention includes:
a second judging module 50, configured to judge whether a target file is stored in the file data memory when a file reading instruction is received;
And the reading module 60 is 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 guided by the file information.
As one embodiment, the file reading instruction includes a file name of the target file, and the second judging module 50 is further configured to traverse the 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 one 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 a data storage block storing the target file according to the storage address; and determining file data of the target file based on the stored 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 file data of the target file is stored in the data storage area, 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 implementations 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, the embodiment of the invention also provides a storage medium, wherein the storage medium stores a file data writing program, and the file data writing program realizes the steps of the file data writing method when being executed by a processor. In addition, the embodiment of the invention also provides a storage medium, wherein the storage medium stores a file data reading program, and the file data reading program realizes the steps of the file data reading method when being executed by a processor. Therefore, a detailed description will not be given here.
In addition, the description of the beneficial effects of the same method is omitted. For technical details not disclosed in the embodiments of the computer-readable storage medium according to the present application, please refer to the description of the method embodiments of the present application. As an 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.
Those skilled in the art will appreciate that implementing all or part of the above-described methods may be accomplished by way of computer programs, which may be stored on a computer-readable storage medium, and which, when executed, may comprise the steps 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 (Random AccessMemory, RAM), or the like.
It should be further noted that the above-described apparatus embodiments are merely illustrative, and that the units described as separate units may or may not be physically separate, and that units shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. In addition, in the drawings of the embodiment of the device provided by the invention, the connection relation between the modules represents that the modules have communication connection, and can be specifically implemented as one or more communication buses or signal lines. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the present invention may be implemented by means of software plus necessary general purpose hardware, or of course by means of special purpose hardware including application specific integrated circuits, special purpose CPUs, special purpose memories, special purpose components, etc. Generally, functions performed by computer programs can be easily implemented by corresponding hardware, and specific hardware structures for implementing the same functions can be varied, such as analog circuits, digital circuits, or dedicated circuits. But a software program implementation is a preferred embodiment for many more of the cases of the present invention. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product 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, randomAccessMemory), a magnetic disk or an optical disk of a computer, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments of the present invention.

Claims (5)

1. 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 files, the file information guides at least one data storage block, and the data storage block stores file data of the files corresponding to the file information and state information of the data storage block;
the file data writing method based on the file data storage comprises the following steps:
when receiving a target file, 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 the file data memory stores the original file with the same file name;
The method specifically comprises the following steps: if the file type is a writable file, acquiring the file name of the target file; traversing a file information area of the file data memory, and matching file names stored in the file information area to judge whether original files with the same file names are stored in the file information area;
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; the state information of the data storage block comprises the writing times of the data storage block, and the target data storage block is the data storage block with the minimum writing times;
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 same number of data storage blocks;
The method specifically comprises the following steps: writing the file data of the target file into the file data memory to obtain the number of files of the target file type in the file data memory; determining the number of data storage blocks allocated for each file of the target file type based on the number of files; according to the number of the data storage blocks, moving file data of the files of the target file types so that file information of the files of each target file type guides the same number of the data storage blocks;
The file data reading method based on the file data memory comprises the following steps:
when a file reading instruction is received, judging whether a target file is stored in the file data memory;
if yes, acquiring file information of the target file, and reading file data of the target file in at least one data storage block guided by the file information.
2. The file data store of claim 1, wherein the files comprise 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 comprises file names, file quantity and storage addresses.
3. The file data store of claim 1, wherein the files comprise 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 for storing the second file comprises the storage file length of the data storage block and the writing times of the data storage block.
4. The file data store of claim 1, wherein the file read instruction includes a file name of a target file; the step of judging whether the file data memory stores the target file specifically includes:
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.
5. The file data storage according to claim 1, wherein 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 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 file data of the target file based on the stored file length of the data storage block, and reading the file data.
CN202111558282.3A 2021-12-17 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 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 2021-12-17 File data storage, writing method, reading method and storage system

Publications (2)

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

Family

ID=80758764

Family Applications (1)

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

Country Status (1)

Country Link
CN (1) CN114237513B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109189772A (en) * 2018-08-21 2019-01-11 华清瑞达(天津)科技有限公司 File management method and system for no file system storage medium
CN112631516A (en) * 2020-12-22 2021-04-09 上海宏力达信息技术股份有限公司 FLASH file management system with service life management function

Family Cites Families (10)

* 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
CN107239526B (en) * 2017-05-27 2020-11-13 河南思维轨道交通技术研究院有限公司 File system implementation method, defragmentation method and operation position positioning method
CN107450859B (en) * 2017-08-14 2024-01-16 北京盛和大地数据科技有限公司 Method and device for reading file data
CN107665098B (en) * 2017-09-05 2020-12-18 联想(北京)有限公司 Information processing method, storage device, and computer storage medium
CN109669621B (en) * 2017-10-13 2021-05-25 杭州海康威视***技术有限公司 File management method, file management system, electronic device and storage medium
CN108664218A (en) * 2018-04-23 2018-10-16 浙江大华技术股份有限公司 A kind of SSD storage methods based on data characteristics, apparatus and system
CN110134645B (en) * 2019-04-15 2023-07-11 深圳市战音科技有限公司 File system storage management method, file system storage reading method, file system storage management device and file system storage reading device
US11513739B2 (en) * 2019-07-31 2022-11-29 EMC IP Holding Company LLC File layer to block layer communication for block organization in storage
CN111158948B (en) * 2019-12-30 2024-04-09 深信服科技股份有限公司 Data storage and verification method and device based on deduplication and storage medium
CN111723056B (en) * 2020-06-09 2024-04-30 北京青云科技股份有限公司 Small file processing method, device, equipment and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109189772A (en) * 2018-08-21 2019-01-11 华清瑞达(天津)科技有限公司 File management method and system for no file system storage medium
CN112631516A (en) * 2020-12-22 2021-04-09 上海宏力达信息技术股份有限公司 FLASH file management system with service life management function

Also Published As

Publication number Publication date
CN114237513A (en) 2022-03-25

Similar Documents

Publication Publication Date Title
KR102619954B1 (en) Method for processing data and electronic device for supporting the same
US20180364909A1 (en) Apparatus and method to share host system ram with mass storage memory ram
CN112883036B (en) Index creation method, device, storage server and storage medium
US8615624B2 (en) Methods, apparatuses, and computer program products for enhancing memory erase functionality
CN103959199A (en) Power saving method and apparatus for first in first out (FIFO) memories
CN112445766A (en) Terminal fragment sorting method and device and terminal
CN114048168A (en) Electronic archive filing method, device, equipment, system and storage medium
CN116842307B (en) Data processing method, device, equipment, chip and storage medium
CN103383637A (en) Control method and device for screen background display
CN114416723B (en) Data processing method, device, equipment and storage medium
CN114237513B (en) File data storage, writing method, reading method and storage system
CN104102560A (en) Method and device for testing system performance
US20230244406A1 (en) Electronic device and storage management method using same
CN111931600A (en) Intelligent pen image processing method and device and electronic equipment
CN111930249A (en) Intelligent pen image processing method and device and electronic equipment
US10331334B2 (en) Multiple transparent annotation layers for use within a graphical user interface
CN113784216B (en) Video clamping and recognizing method and device, terminal equipment and storage medium
CN112069015B (en) Instruction execution method and device for instruction simulator, terminal equipment and storage medium
CN113272785A (en) Method for mounting file system, terminal equipment and storage medium
CN114385077A (en) FPGA signal modulation and demodulation dynamic reconstruction method, device, system and storage medium
CN115269517A (en) File management method, device, storage medium and terminal
CN113888669A (en) Winding layout drawing method, device, equipment and storage medium
CN111723123B (en) Track prediction method, track prediction device, electronic equipment and storage medium
CN112230809B (en) Method, device and storage medium for selecting computer program codes
CN107402715B (en) Data moving method and device, memory and terminal

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