CN109669622B - File management method, file management device, electronic equipment and storage medium - Google Patents

File management method, file management device, electronic equipment and storage medium Download PDF

Info

Publication number
CN109669622B
CN109669622B CN201710951224.4A CN201710951224A CN109669622B CN 109669622 B CN109669622 B CN 109669622B CN 201710951224 A CN201710951224 A CN 201710951224A CN 109669622 B CN109669622 B CN 109669622B
Authority
CN
China
Prior art keywords
file
block
information
ssd
data area
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
CN201710951224.4A
Other languages
Chinese (zh)
Other versions
CN109669622A (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.)
Hangzhou Hikvision System Technology Co Ltd
Original Assignee
Hangzhou Hikvision System 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 Hangzhou Hikvision System Technology Co Ltd filed Critical Hangzhou Hikvision System Technology Co Ltd
Priority to CN201710951224.4A priority Critical patent/CN109669622B/en
Publication of CN109669622A publication Critical patent/CN109669622A/en
Application granted granted Critical
Publication of CN109669622B publication Critical patent/CN109669622B/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/061Improving I/O performance
    • G06F3/0611Improving I/O performance in relation to response time
    • 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/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0629Configuration or reconfiguration 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/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 embodiment of the invention provides a file management method, a file management device, electronic equipment and a storage medium, wherein the method comprises the following steps: obtaining an identifier of a file to be read from an SSD; searching file storage position information corresponding to the identification of the file to be read in a database of an operating system with a file system; positioning a block used for storing a file to be read in the SSD according to the SSD information and the block information recorded in the searched file storage position information; and reading the file to be read from the positioned block according to the file storage information recorded in the searched file storage position information. According to the embodiment of the invention, the file to be written does not need to be read based on the storage path, so that the reading speed of the file to be read is increased.

Description

File management method, file management device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of data storage technologies, and in particular, to a file management method, a file management apparatus, an electronic device, and a storage medium.
Background
A Solid State Drive (SSD) is a storage device for storing data, and compared with a conventional hard disk, the SSD has characteristics of fast read/write speed, low power consumption, high reliability, and the like, and is gradually used by more and more electronic devices. When the SSD is mounted on the electronic device, the operating system running on the electronic device usually performs file management on the SSD, for example, the windows operating system or linux operating system running on the electronic device performs file management on the SSD.
In the process of file management on an SSD by an existing operating system, for example, when a file stored in an SSD is read, a storage path of the file to be read in the SSD needs to be determined first, and the file can be read at the determined storage path. The storage path is the storage location information of the file determined by the existing operating system with the file system.
Although the file management method based on the storage path is adopted by the file system of the operating system, the file management method can be used for file management of the SSD mounted on the electronic device, but when the file management method is applied to a scene requiring frequent file operations, for example, a scene requiring real-time reading of a large number of files, such as mass picture recognition, the file system of the operating system needs to determine the storage paths of a plurality of files at the same time, and then reads the files in the SSD based on the determined storage paths, which often takes a long time, and causes a decrease in the reading speed of the files.
Disclosure of Invention
Embodiments of the present invention provide a file management method, a file management apparatus, an electronic device, and a storage medium, so as to achieve the purpose of increasing the reading speed of a file in an SSD. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention provides a file management method, which is applied to an electronic device, where the electronic device is mounted with a solid state disk SSD, and the SSD has an SSD file system and an operating system own file system, and the SSD file system includes: a system index area and a data area; the system index area is used for storing SSD information and data area information, the data area is divided into blocks with the same size, and each block comprises: the device comprises a block index area and a block data area, wherein the block index area of one block is used for recording file storage information of a file stored in the block data area of the block; the operating system is provided with a file system, and the file system is used for operating the file system of the operating system operated by the electronic equipment; the operating system is provided with a database in a file system, the database is used for recording the corresponding relation between the identification of the file stored in the block data area of each block of the data area and the file storage position information, and the file storage position information of one file comprises: SSD information of the SSD in which the file is stored, block information of a block to which a block data area for storing the file belongs, and file storage information of the file; the file management method comprises the following steps:
obtaining an identifier of a file to be read from an SSD;
searching file storage position information corresponding to the identification of the file to be read in a database of the self-contained file system of the operating system;
positioning a block used for storing the file to be read in the SSD according to the SSD information and the block information recorded in the searched file storage position information;
and reading the file to be read from the positioned block according to the file storage information recorded in the searched file storage position information.
Optionally, when more than one block is located, the reading the file to be read from the located block according to the file storage information recorded in the file storage location information includes:
according to the file storage information recorded in the file storage position information, respectively reading data belonging to the file to be read from each positioned block;
and merging the read data to obtain the file to be read.
Optionally, the file management method further includes:
obtaining a file to be written in the SSD;
generating an identifier of the file to be written, and determining a block for storing the file to be written as a first block through the SSD file system;
storing the file to be written into a block data area of the first block, obtaining file storage information of the file to be written, and storing the obtained file storage information into a block index area of the first block;
generating file storage position information of the file to be written according to the file storage information of the file to be written, the block information of the first block and SSD information of the SSD to which the first block belongs;
and storing the corresponding relation between the identifier of the file to be written and the generated file storage position information into a database of the operating system with a file system.
Optionally, the data area information includes: the usage status of each block;
after the storing the file to be written to the block data area of the first block, the file management method further includes:
judging whether the current use state of the first block is a full write state;
if so, updating the use state of the first block recorded in the data area information to a full write state;
if not, updating the use state of the first block recorded in the data area information to a written state when the pre-writing state is an unwritten state, wherein the pre-writing state is: and storing the file to be written to the use state of the first block before the file to be written is stored in the block data area of the first block.
Optionally, the system index area includes: a system main index area and a system standby index area;
the system main index area is used for storing SSD information and data area information;
and the system standby index area is used for storing the backup information of the system main index area.
Optionally, the block index area of one block includes: a block main index area of the block and a block standby index area of the block;
a block main index area of a block for recording file storage information of a file stored in the block data area of the block;
and the block spare index area of one block is used for storing backup information of the block main index area of the block.
In a second aspect, an embodiment of the present invention provides a file management apparatus, which is applied to an electronic device, where the electronic device is mounted with a solid state disk SSD, and the SSD has an SSD file system and an operating system own file system, and the SSD file system includes: a system index area and a data area; the system index area is used for storing SSD information and data area information, the data area is divided into blocks with the same size, and each block comprises: the device comprises a block index area and a block data area, wherein the block index area of one block is used for recording file storage information of a file stored in the block data area of the block; the operating system is provided with a file system, and the file system is used for operating the file system of the operating system operated by the electronic equipment; the operating system is provided with a database in a file system, the database is used for recording the corresponding relation between the identification of the file stored in the block data area of each block of the data area and the file storage position information, and the file storage position information of one file comprises: SSD information of the SSD in which the file is stored, block information of a block to which a block data area for storing the file belongs, and file storage information of the file; the file management apparatus includes:
the device comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring an identifier of a file to be read, which is to be read from the SSD;
the searching module is used for searching file storage position information corresponding to the identification of the file to be read in a database of the self-contained file system of the operating system;
the positioning module is used for positioning a block in the SSD, which is used for storing the file to be read, according to the SSD information and the block information recorded in the searched file storage position information;
and the reading module is used for reading the file to be read from the positioned block according to the file storage information recorded in the searched file storage position information.
Optionally, when more than one block is located, the reading module is specifically configured to:
according to the file storage information recorded in the file storage position information, respectively reading data belonging to the file to be read from each positioned block;
and merging the read data to obtain the file to be read.
Optionally, the file management apparatus further includes:
the second acquisition module is used for acquiring a file to be written in the SSD;
the determining module is used for generating an identifier of the file to be written, and determining a block for storing the file to be written as a first block through the SSD file system;
the first storage module is used for storing the file to be written into the block data area of the first block, acquiring file storage information of the file to be written and storing the acquired file storage information into the block index area of the first block;
the generating module is used for generating file storage position information of the file to be written according to the file storage information of the file to be written, the block information of the first block and SSD information of the SSD to which the first block belongs;
and the second storage module is used for storing the corresponding relation between the identifier of the file to be written and the generated file storage position information into a database of the self-contained file system of the operating system.
Optionally, the data area information includes: the usage status of each block;
the file management apparatus further includes:
the judging module is used for judging whether the current use state of the first block is a full-written state;
the judging module comprises:
the first updating submodule is used for updating the use state of the first block recorded in the data area information into a full-written state when the judgment module judges that the first block is in the full-written state;
a second updating sub-module, configured to update the usage status of the first block recorded in the data area information to a written status when the pre-write status is an unwritten status when the determination module determines that the usage status of the first block is not the unwritten status, where the pre-write status is: and storing the file to be written to the use state of the first block before the file to be written is stored in the block data area of the first block.
Optionally, the system index area includes: a system main index area and a system standby index area;
the system main index area is used for storing SSD information and data area information;
and the system standby index area is used for storing the backup information of the system main index area.
Optionally, the block index area of one block includes: a block main index area of the block and a block standby index area of the block;
a block main index area of a block for recording file storage information of a file stored in the block data area of the block;
and the block spare index area of one block is used for storing backup information of the block main index area of the block.
In a third aspect, an embodiment of the present invention provides an electronic device, where the electronic device is mounted with a solid state disk SSD, and the SSD has an SSD file system and an operating system self-contained file system, and the SSD file system includes: a system index area and a data area; the system index area is used for storing SSD information and data area information, the data area is divided into blocks with the same size, and each block comprises: the device comprises a block index area and a block data area, wherein the block index area of one block is used for recording file storage information of a file stored in the block data area of the block; the operating system is provided with a file system, and the file system is used for operating the file system of the operating system operated by the electronic equipment; the operating system is provided with a database in a file system, the database is used for recording the corresponding relation between the identification of the file stored in the block data area of each block of the data area and the file storage position information, and the file storage position information of one file comprises: SSD information of the SSD in which the file is stored, block information of a block to which a block data area for storing the file belongs, and file storage information of the file, the electronic device further includes: the system comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
the memory is used for storing a computer program;
the processor is used for executing the program stored in the memory and executing the following steps:
obtaining an identifier of a file to be read from an SSD;
searching file storage position information corresponding to the identification of the file to be read in a database of the self-contained file system of the operating system;
positioning a block used for storing the file to be read in the SSD according to the SSD information and the block information recorded in the searched file storage position information;
and reading the file to be read from the positioned block according to the file storage information recorded in the searched file storage position information.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, where an electronic device mounts a solid state disk SSD, and the SSD has an SSD file system and an operating system self-contained file system, and the SSD file system includes: a system index area and a data area; the system index area is used for storing SSD information and data area information, the data area is divided into blocks with the same size, and each block comprises: the device comprises a block index area and a block data area, wherein the block index area of one block is used for recording file storage information of a file stored in the block data area of the block; the operating system is provided with a file system, and the file system is used for operating the file system of the operating system operated by the electronic equipment; the operating system is provided with a database in a file system, the database is used for recording the corresponding relation between the identification of the file stored in the block data area of each block of the data area and the file storage position information, and the file storage position information of one file comprises: SSD information of an SSD in which the file is stored, block information of a block to which a block data area for storing the file belongs, and file storage information of the file, a computer program stored in the computer-readable storage medium, the computer program being executed by a processor to:
obtaining an identifier of a file to be read from an SSD;
searching file storage position information corresponding to the identification of the file to be read in a database of the self-contained file system of the operating system;
positioning a block used for storing the file to be read in the SSD according to the SSD information and the block information recorded in the searched file storage position information;
and reading the file to be read from the positioned block according to the file storage information recorded in the searched file storage position information.
According to the file management method, the file management device, the electronic device and the storage medium provided by the embodiment of the invention, when the electronic device is hung with the SSD, the SSD has the SSD file system different from the operating system self-contained file system and the operating system self-contained file system, the operating system self-contained file system is provided with the database, the database records the file storage position information of the file stored in the block data area of the block, after the electronic device acquires the identifier of the file to be read from the SSD, the electronic device can directly position the block in the SSD, which is used for storing the file to be read, by searching the file storage position information corresponding to the identifier of the file to be read in the database, and directly read the file to be read from the positioned block. Therefore, compared with the prior art, when the scheme provided by the embodiment of the invention is applied to realize file reading, the reading position of the file to be read is determined by the file storage position information in the database of the file system carried by the operating system, and the determined reading position is a block contained in the block data area in the SSD file system, and the storage path of the file to be read does not need to be determined, namely the file to be written does not need to be read based on the storage path, so that the reading speed of the file to be read is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a schematic diagram of the area division of an SSD according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a file management method according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of another area division of an SSD according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of another area division of an SSD according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of a fourth area division of an SSD according to an embodiment of the present invention;
fig. 6 is a schematic diagram illustrating block group division in a fourth area division structure of an SSD according to an embodiment of the present invention;
FIG. 7 is a schematic structural diagram of a file management apparatus according to an embodiment of the present invention;
FIG. 8 is a schematic structural diagram of a file management apparatus according to an embodiment of the present invention;
FIG. 9 is a schematic structural diagram of a determining module in the file management apparatus according to the embodiment of the present invention;
fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The embodiment of the invention provides a file management method, which is applied to electronic equipment, wherein the electronic equipment can be a server or other types of electronic equipment.
The electronic device is mounted with SSDs, and as shown in fig. 1, each SSD may have two file systems, namely an SSD file system and an operating system own file system, where OF-FS is used to represent the operating system own file system.
The electronic device can mount only one SSD and also can mount more than one SSD, and when the SSD is mounted, each SSD is provided with two file systems, namely an SSD file system and an operating system self-contained file system.
The SSD file system includes: a system Index area and a data area, referring to fig. 1, wherein the system main Index area and the system standby Index area constitute a system Index area, Index is used to represent the system main Index area, and binder is used to represent the system standby Index area; block 1, block 2 … … block n constitute a data area.
The system index area is used for storing SSD information and data area information; the data area is divided into blocks of the same size, each block including: a block index area and a block data area, referring to fig. 1, where i1 and i2 … … in are block index areas of corresponding block 1 and block 2 … … block n; d1 and D2 … … Dn are block data areas of the corresponding block 1 and block 2 … … block n.
The data area in the SSD file system is used for storing file data;
the block index area of a block is used for recording the file storage information of the file stored in the block data area of the block.
The operating system is provided with a file system for operating the operating system of the electronic equipment, and the operating system is provided with a database. In addition, in the area of the operating system with the file system, an application program which needs to use the operating system with the file system can also be operated.
The database can be used for recording the corresponding relation between the identification of the file stored in the block data area of each block of the data area and the file storage position information.
Wherein the file storage location information of the one file includes: SSD information of the SSD in which the file is stored, block information of a block to which a block data area for storing the file belongs, and file storage information of the file.
Specifically, the SSD information may include information such as an ID, a total storage capacity, and an available space of the SSD.
The block information of the block to which the block data area for storing the file belongs may include various attribute information of the block, such as the current use state of the block, the block number of the block in the data area, and the like.
The file storage information of the file may include information such as a file ID (identity) of the stored file, a file size, a file position offset, and a file storage time. The file position offset may be understood as: the offset of the starting storage location of the file in the block relative to the starting address of the block. For example, if block 1 stores file a, the block index area of block 1 may include the file ID, the file size, the file location offset, and the file storage time of file a; if the block 2 stores the file B, the block index area of the block 2 may include the file ID, the file size, the file position offset, and the file storage time of the file B; block 3 stores file C, the block index area of block 3 may contain the file ID, file size, file location offset, and file storage time of file C.
The data area information may include information such as the size of each block in the data area, the number of blocks, and usage status information for each block. The use state information of the block may be understood as: information indicating a current usage state of the block, which can be divided into, from the viewpoint of data storage: an unwritten state, a written state, and a fully written state.
The unwritten state can be understood as: the status of no files yet stored;
the fully written state can be understood as: a state where a file has been stored and there is no free storage space;
the written state can be understood as: there is a state where a file has been stored but there is still free storage space.
As can be seen from the above description, the information such as the ID of the SSD in the SSD information, the total storage capacity, and the block size and the number of blocks in the data area information is not changed while the SSD stores the file, and the available space in the SSD information and the usage status of each block in the data area information may change with the storage of the file, so that the SSD information and the data area information may be set during formatting the SSD, where the available space in the SSD information and the usage status of each block in the data area information set during the formatting process are only initial values.
When formatting the SSD, a part of the area of the SSD may be formatted into an area having a file system of the operating system itself, and then the remaining area may be formatted into an area having a file system of the SSD.
Specifically, in the process of formatting the above remaining area of the SSD into an area having the SSD file system, besides the SSD needs to be formatted in the conventional sense, it is also necessary to determine a system index area, a data area, and a block index area and a block data area of each block in the data area in the SSD file system, and set the SSD information and the data area information stored in the system index area.
The size of the system index area, the size of each block in the data area and the size of the block index area in each block can be preset;
the initial value of the available space in the SSD information may be determined by first determining the total storage capacity of the SSD and the space size of the area in which the operating system has been formatted by its own file system, and then taking the difference between the two as the initial value of the available space;
since no file is stored in each block of the data area during formatting, the initial value of the use state of each block may be set as: an unwritten state;
the number of blocks in the data area information may be calculated in the following manner:
subtracting the space size of the area with the self-contained file system of the operating system from the total storage space to obtain a first difference value, and subtracting the size of the system index area from the obtained first difference value to obtain a second difference value;
and dividing the obtained second difference value by the size of each block in the preset data area, and taking the quotient obtained after the division as the number of the blocks in the data area.
As shown in fig. 2, the file management method provided in the embodiment of the present invention includes the following steps:
s101, obtaining an identifier of a file to be read from the SSD.
The identifier of the file to be read in the embodiment of the invention can be used for distinguishing the file from other files to be read, namely, the identifier of the file to be read only corresponds to one file to be read. For example, the Identifier may be a Unique ID (identification number), or may be a set of Unique strings (e.g., UUID (universal Unique Identifier)).
It is easily understood that the identifier may be generated during the process of writing the file to be written into the SSD, and in the process of generating the identifier, the identifier may further include an ID of the SSD into which the file to be written has been written. Accordingly, when it is necessary to determine an SSD storing the file to be read from among the plurality of SSDs, the determination may be based on the ID of the SSD in the above identification.
S102, searching file storage position information corresponding to the identification of the file to be read in a database of the file system of the operating system.
As can be seen from the foregoing, the operating system has a database in its own file system, and the database is used to record the correspondence between the identifier of the file stored in the block data area of each block of the data area and the file storage location information.
Specifically, after writing a file into the SSD and generating an identifier corresponding to the file, the identifier of the file, the file storage location information of the file, and the correspondence between the identifier of the file and the file storage location information of the file may be stored in the database. Therefore, the electronic equipment can search the file storage position information corresponding to the identification of the file to be read according to the information stored in the database.
As an optional implementation manner, the identifier of the file to be read may be a UUID, and the UUID is different from the existing step-by-step file searching manner based on the file storage path to read the file, but the file storage location information corresponding to the UUID may be directly searched in the database of the file system of the operating system itself according to the corresponding relationship between the UUID and the file storage location information.
The file storage location information may generally store SSD information of the SSD of the file, block information of a block to which a block data area for storing the file belongs, file storage information of the file, and the like; the file storage information may generally record: file identification of the file, size of the file, position offset of the file, and the like. As can be seen, the file storage location information includes information recorded in the file storage information, and may further include: the ID of the SSD where the file is located, the block number of the first block, and other information.
As an optional implementation manner of the embodiment of the present invention, a correspondence between a file to be read and file storage location information of the file may be determined by whether the file storage location information includes an identifier of the file to be read. For example, in a plurality of file storage location information in a database of an operating system with a file system, if a file identifier in certain file storage location information is the same as an identifier of a file to be read, it is indicated that the file storage location information and the file to be read have a corresponding relationship; otherwise, it indicates that the corresponding relationship between the file storage location information and the file to be read does not exist. Through the process of the embodiment, the file storage position information corresponding to the file to be read can be determined from the file storage position information in the database of the file system of the operating system.
S103, positioning a block in the SSD for storing the file to be read according to the SSD information and the block information recorded in the searched file storage position information.
As described above, the file storage location information includes corresponding SSD information and block information, and may specifically record information such as an ID of the SSD where the file is located, and a block number of the first block. Through the information, the block for storing the file to be read can be positioned in the SSD.
As an optional implementation manner, after determining file storage location information corresponding to an identifier of a file to be read, the process of locating a block in the SSD, where the block is used to store the file to be read, may specifically be: and reading the block number in the block information and the ID of the SSD in the determined file storage position information, and directly positioning and storing the block of the file to be read in the SSD through the block number, so that the file is read.
As an optional implementation manner, when the identifier of the file to be read is a UUID, since the UUID already contains an ID of the SSD into which the file to be written has been written, the SSD in which the file to be read is located may be directly determined by the UUID. Accordingly, after determining file storage location information corresponding to the UUID of the file to be read, the process of locating the block in the SSD for storing the file to be read may specifically be: in the determined file storage position information, the block number in the block information is directly read, and the block of the file to be read is directly positioned and stored in the SSD through the block number, so that the file is read.
And S104, reading the file to be read from the positioned block according to the file storage information recorded in the searched file storage position information.
As described above, the file storage information is used to record information such as the identifier of the file, the size of the file, and the position offset of the file, so that after the file to be read is located in the block, the file to be read in the block can be read by using the file storage information.
As an optional implementation manner of the embodiment of the present invention, when more than one block is located, in the embodiment of the present invention, when the file to be read is read, data belonging to the file to be read may be read from each located block according to file storage information recorded in the obtained file storage location information, and the read data may be subjected to merging processing to obtain the file to be read.
According to the file management method provided by the embodiment of the invention, when the electronic equipment is hung with the SSD, the SSD has the SSD file system different from the operating system self-contained file system and the operating system self-contained file system, the operating system self-contained file system is provided with the database, the database records the file storage position information of the file stored in the block data area of the block, after the electronic equipment acquires the identifier of the file to be read from the SSD, the electronic equipment can directly position the block in the SSD, which is used for storing the file to be read, by searching the file storage position information corresponding to the identifier of the file to be read in the database, and directly read the file to be read from the positioned block. Therefore, compared with the prior art, when the scheme provided by the embodiment of the invention is applied to realize file reading, the reading position of the file to be read is determined by the file storage position information in the database of the file system carried by the operating system, and the determined reading position is a block contained in the block data area in the SSD file system, and the storage path of the file to be read does not need to be determined, namely the file to be written does not need to be read based on the storage path, so that the reading speed of the file to be read is improved.
In addition to reading a file from the SSD, a file may also be written into the SSD, and in an implementation manner of the present invention, a process of writing a file to be written into the SSD may be:
and step A, obtaining a file to be written in the SSD.
In this embodiment of the present invention, the file to be written is a file to be written in the SSD, and the file may include: a picture format file, a text format file, an audio format file, a video format file, and the like. It is easy to understand that there are many ways to obtain the file to be written, for example, the file to be written may be obtained through a file writing request sent by an application program, and the file to be written stored in the cloud database may also be actively searched.
And step B, generating an identifier of the file to be written, and determining a block for storing the file to be written as a first block through the SSD file system.
And after the file to be written is obtained, the electronic equipment generates a unique identifier of the file so as to distinguish the file from other files. As can be seen from the foregoing, the data area of an SSD can be divided into a plurality of blocks having the same size, so that one block for storing a file to be written can be determined by the SSD file system, and the determined block is taken as the first block. Specifically, the SSD file system may allocate a block in a data area for a file to be written to store the file to be written.
As an optional implementation manner, when one electronic device mounts a plurality of SSDs, the electronic device may select one of the SSDs to store a file to be written according to SSD information stored in each SSD system index area, such as an ID of the SSD. Illustratively, when one electronic device mounts 3 SSDs, the IDs of the 3 SSDs are 001A, 002B, and 003C, respectively, the electronic device may randomly select the SSD with the ID of 002B as the SSD storing the file to be written, and allocate a block in one data area to store the file to be written through the file management system of the SSD; or one SSD can be selected as the SSD for storing the file to be written based on the format of the current file to be written.
Since the obtained files may have different sizes, the first block allocated by the SSD file system may be one or a plurality of blocks. That is, when the size of a file is larger than the size of a block in the data area, a plurality of blocks may be allocated for the file for storing the file. For example, a file having a size of 80MB and a block having a size of 64MB, the file management system may allocate 2 blocks for storing the file.
And step C, storing the file to be written into the block data area of the first block, obtaining the file storage information of the file to be written, and storing the obtained file storage information into the block index area of the first block.
In the embodiment of the invention, after the first block is allocated to the file to be written, the file can be stored in the block data area of the first block when the preparation for storing the file to be written is indicated. After the file to be written is stored, file storage information of the file, such as a file ID, a file size, a file location offset, a file storage time, and the like, may be acquired and stored in the block index area of the first block. By storing the storage information of the file in the block index area, the index information of the file can be established in the block for storing the file, so that the storage condition of the file can be conveniently checked later, and the use convenience of the file management method provided by the embodiment of the invention is improved.
Optionally, a plurality of files to be written, which are allocated to the first block, can be sequentially stored in the block data area of the first block, so that the sequential writing performance advantage of the SSD can be utilized, the storage speed of the plurality of files can be increased, and the file storage efficiency can be improved.
And step D, after the stored file storage information of the file to be written is obtained, the embodiment of the invention can also generate the file storage position information corresponding to the file. As described above, the file storage location information typically includes file storage information of the file, block information of the first block, and SSD information of the SSD to which the first block belongs. The block information of the first block may contain various attribute information of the first block, such as a current use state of the first block, a block number of the first block in the data area, and the like. The file storage location information may include: the file ID of the file, the size of the file, the position offset of the file, the ID of the SSD where the file is located, the block number of the first block, and the like.
As an optional implementation manner, on the basis of the above implementation manner, after the file to be written is stored in the SSD, the file storage location information may also be fed back to the application program that sends the file write request, so that a user of the application program can know that the file to be written is stored in the SSD, and can also know information such as the storage location of the file, the file ID, and the like, thereby facilitating the user to search for the file in the future. Illustratively, the file storage location information may be fed back to the application sending the file write request in the form of a URL (Uniform Resource Locator), and the URL address may contain information such as an ID of the SSD, information of a block where the file is located (e.g., a block number of the first block), a file location offset, a file size, a file ID, and the like.
And E, storing the corresponding relation between the identification of the file to be written and the generated file storage position information into a database of the operating system with the file system.
In the embodiment of the present invention, after the identifier of the file to be written and the file storage location information of the file to be written are generated, since the file storage location information of the file to be written also includes the identifier of the file to be written, the file storage location information to be written including the relationship of the identifier of the file to be written can be used as the correspondence between the identifier of the file to be written and the generated file storage location information, and the correspondence can be stored in the database of the file system of the operating system itself. When the file to be read is read, the file storage location information corresponding to the identifier of the file to be read can be found from the file storage location information in the database with the file system of the operating system.
In the process of writing the file to be written in the SSD of the embodiment of the present invention, after the electronic device obtains the file to be written, the identifier of the file is generated, the block for storing the file to be written is determined by the SSD file system, and the file to be written is directly stored in the determined block.
As an optional implementation manner of the embodiment of the present invention, the data area information may further include a use status of each block. The use state of a block may be an unwritten state, a written state, and a fully written state. The unwritten state indicates that the data in the block is empty, and the data can be written; the written state indicates that the block stores data and the data can still be written again; the write full status indicates that the data stored in the block is full and that no more data can be written. After the file to be written is stored in the first block, the state of the first block may change, and therefore, the use state of the first block needs to be updated in combination with the use states of the first block before and after the file to be written is stored, so that it is ensured that the use state of the first block is correctly stored.
After a file to be written is stored in a first block, two conditions may exist, wherein in the first condition, the first block is in a full-written state; in case two, the first block is in an unfilled state. According to the two situations, whether the use state of the first block is the full-written state or not can be judged, and then the use state of the first block is updated in different modes according to the judgment result.
Alternatively, the specific updating process may be that, if the current usage state of the first block is a write-full state, the usage state of the first block recorded in the data area information may be updated to the write-full state; if the current use state of the first block is the non-full-written state and the pre-write state is the non-written state, indicating that the use state of the first block is not yet storing data before the file to be written is stored in the block data area of the first block, the use state of the first block recorded in the data area information may be updated to the written state.
In addition, when the current use state of the first block is an incomplete write state and the pre-write state is a written state, which indicates that a file to be written is stored in the block data area of the first block before the file to be written is stored, the first block has a stored file, the use state of the first block is a written state, and after the file to be written is stored, the first block still has a free space.
As an alternative implementation of the embodiment of the present invention, as shown in fig. 3, the system index area may be only partially formed. That is, the SSD information and the data area information are directly stored in the system index area, and the system index area may be the system main index area in fig. 1.
Corresponding to the above embodiment, as another optional embodiment of the present invention, the system index area may be composed of two parts, that is, the system index area may be divided into: a system main index area and a system standby index area. The system comprises a system main index area, a data area and a data area, wherein the system main index area is used for storing SSD information and data area information; the system spare index area is used for storing backup information of the system main index area, namely, the system spare index area is used as a backup of the system main index area and is also used for storing SSD information and data area information. The system standby index area of the embodiment of the invention stores the backup information of the system main index area, so that when the system main index area fails, the data in the system main index area can be recovered through the backup information in the system standby index area, thereby improving the data security of the SSD.
As an alternative implementation manner of the embodiment of the present invention, as shown in fig. 3, the block index area of one block may be only partially formed. That is, the file storage information of the file stored in the block data area of a block is directly recorded in the block index area of the block, and the block index area at this time may be the block main index area in fig. 1.
Corresponding to the above embodiment, as another optional embodiment of the present invention, the block index area of one block may be composed of two parts, that is, the block index area may be divided into: a block primary index region of the block and a block secondary index region of the block. The block main index area is used for recording file storage information of a file stored in the block data area of the block; and a block spare index area for storing backup information of the block main index area of the block, that is, the block spare index area serves as a backup of the block main index area and is also used for recording file storage information of files stored in the block data area of the block, referring to fig. 1, where Bi1 and Bi2 … … Bin are the block spare index areas of the corresponding block 1 and block 2 … … block n. In the block backup index area of the embodiment of the invention, because the backup information of the block main index area of the block is stored, when the block main index area is damaged, the data in the block main index area can be recovered through the backup information of the block backup index area, thereby improving the data security of the SSD.
As an optional implementation manner of the embodiment of the present invention, as shown in fig. 4, when the SSD is divided into areas, the block index areas of the respective blocks in the data area may be centrally disposed in the block main index area, that is, the block main index area is divided into a plurality of areas with the same size, and each block data area corresponds to one area with the same size in the block main index area, so that the block index areas of the respective blocks are centrally managed. Referring to fig. 4, the block main index area is divided into n areas, where block data area 1 corresponds to area 1 in the block index area, block data area 2 corresponds to area 2 in the block index area, block data area n corresponds to area n in the block index area, and areas 1, 2 … … are equal in size.
As can be seen from the above, the SSD may be composed of at least three areas, each area may correspond to a chip particle, and the chip particles corresponding to the various areas may be different, and the area where the operating system own file system is located, the system main index area, the block main index area, and the data area are located in the SSD may be determined according to the importance levels of the area where the operating system own file system is located, the system main index area, the block main index area, and the data area, and the security level of the chip particle. For example, the region with the highest importance level in the region where the operating system with the file system is located, the system main index region, the block main index region and the data region is set to the region with the highest security level of the chip granule.
Specifically, the above chip particles may be SLC (Single-Level Cell) chip particles, MLC (Multi-Level Cell) chip particles, or TLC (triple-Level Cell) chip particles, and the like, where the security Level of the SLC chip particles is higher than that of the MLC chip particles and the TLC chip particles. Since the frequency of frequent reading and writing of the system main index area and the block main index area is generally higher than the frequency of frequent reading and writing of the data area, the importance levels of the system main index area and the block main index area can be considered to be the same and higher than the importance level of the data area, in this case, the system main index area and the block main index area can be arranged in an area with a higher security level of the chipset, for example, an area formed by SLC chipset, and the data area can be arranged in an area with a lower security level of the chipset, for example, an area formed by MLC or TLC chipset, so that the system main index area and the block main index area can be determined according to the importance levels of the respective areas and the security level of the chipset, and the system main index area and the block main index area have low production cost while ensuring data security. Or, the area where the own file system of the operating system is located can be set in the areas with different chip particle security levels according to the actual data security requirement. For example, if the data security requirement on the area where the operating system own file system is located is high, the area where the operating system own file system is located may be set to an area with a higher security level of chip particles, for example, an area formed by SLC chip particles; if the data security requirement on the area where the operating system self-contained file system is located is not high, the area where the operating system self-contained file system is located can be set in an area with a low chip particle security level, for example, an area formed by MLC or TLC chip particles, so that the operating system self-contained file system can be flexibly set in areas with different security levels according to the actual security requirements of different areas.
As an optional implementation manner of the embodiment of the present invention, as shown in fig. 5 and fig. 6, the block main index area may further be composed of a plurality of block groups, and each block group may further include a plurality of areas. For example, the chunk main index area is composed of chunk 1, chunk 2 … … chunk n, where chunk 1 includes region 1 and region 2 … … region n. By dividing the block main index area into a plurality of block groups, each block group can process the file storage information of one type of file, for example, the file storage information of a video file is processed in the block group 1, and the file storage information of an image file is processed in the block group 2, so that when a technician needs to search the file storage information of a certain file, the file can be directly searched from the block group corresponding to the file type, and the searching efficiency of the file storage information is improved.
Corresponding to the above method embodiment, the embodiment of the present invention also provides a corresponding device embodiment.
As shown in fig. 7, an embodiment of the present invention provides a file management apparatus, where the apparatus is mounted with a solid state disk SSD, the SSD has an SSD file system and an operating system self-contained file system, and the SSD file system includes: a system index area and a data area; the system index area is used for storing SSD information and data area information, the data area is divided into blocks with the same size, and each block comprises: the device comprises a block index area and a block data area, wherein the block index area of one block is used for recording file storage information of a file stored in the block data area of the block; the operating system is provided with a file system, and the file system is used for operating the file system of the operating system operated by the electronic equipment; the operating system is provided with a database in a file system, the database is used for recording the corresponding relation between the identification of the file stored in the block data area of each block of the data area and the file storage position information, and the file storage position information of one file comprises: SSD information of the SSD in which the file is stored, block information of a block to which a block data area for storing the file belongs, and file storage information of the file; the device includes:
the first obtaining module 201 is configured to obtain an identifier of a file to be read, which is to be read from the SSD.
The searching module 202 is configured to search, in a database of a file system of an operating system, file storage location information corresponding to an identifier of a file to be read.
And the positioning module 203 is configured to position a block in the SSD, which is used for storing the file to be read, according to the SSD information and the block information recorded in the searched file storage location information.
And the reading module 204 is configured to read a file to be read from the located block according to the file storage information recorded in the searched file storage location information.
Optionally, when more than one block is located, the reading module 204 is specifically configured to: according to the file storage information recorded in the file storage position information, respectively reading data belonging to the file to be read from each positioned block; and merging the read data to obtain a file to be read.
In the file management apparatus provided in the embodiment of the present invention, when the electronic device is mounted with the SSD, the SSD has an SSD file system different from the operating system own file system and the operating system own file system, and the operating system own file system is provided with the database in which the file storage location information of the file stored in the block data area of the block is recorded, and after the electronic device acquires the identifier of the file to be read from the SSD, the file management apparatus can directly locate the block in the SSD, which is used for storing the file to be read, by searching for the file storage location information corresponding to the identifier of the file to be read in the database, and directly read the file to be read from the located block. Therefore, compared with the prior art, when the scheme provided by the embodiment of the invention is applied to realize file reading, the reading position of the file to be read is determined by the file storage position information in the database of the file system carried by the operating system, and the determined reading position is a block contained in the block data area in the SSD file system, and the storage path of the file to be read does not need to be determined, namely the file to be written does not need to be read based on the storage path, so that the reading speed of the file to be read is improved.
As shown in fig. 8, as an optional implementation manner of the embodiment of the present invention, on the basis of the above apparatus embodiment, the file management apparatus according to the embodiment of the present invention may further include:
the second obtaining module 205 is configured to obtain a file to be written into the SSD.
The determining module 206 is configured to generate an identifier of a file to be written, and determine, as a first block, a block for storing the file to be written through the SSD file system.
The first storage module 207 is configured to store the file to be written in the block data area of the first block, obtain file storage information of the file to be written, and store the obtained file storage information in the block index area of the first block.
The generating module 208 is configured to generate file storage location information of the file to be written according to the file storage information of the file to be written, the block information of the first block, and SSD information of the SSD to which the first block belongs.
The second storage module 209 is configured to store the correspondence between the identifier of the file to be written and the generated file storage location information in a database of the operating system own file system.
Optionally, the data area information includes: the usage status of each block;
the file management apparatus of the embodiment of the present invention may further include:
a judging module 2010, configured to judge whether a current usage state of the first block is a full-written state;
as shown in fig. 9, the determining module 2010 includes:
the first updating submodule 20101 is used for updating the use state of the first block recorded in the data area information to a full write state when the judgment module judges that the first block is in the full write state;
a second updating submodule 20102, configured to update the usage state of the first block recorded in the data area information to a written state when the pre-write state is an unwritten state and the determination result of the determining module is negative, where the pre-write state is: and storing the file to be written into the use state of the first block before the block data area of the first block.
Optionally, the system index area includes: a system main index area and a system standby index area;
the system main index area is used for storing SSD information and data area information;
and the system standby index area is used for storing the backup information of the system main index area.
Optionally, the block index area of one block includes: a block main index area of the block and a block standby index area of the block;
a block main index area of a block for recording file storage information of a file stored in the block data area of the block;
and the block spare index area of one block is used for storing backup information of the block main index area of the block.
An embodiment of the present invention further provides an electronic device, as shown in fig. 10, the electronic device includes a processor 301, a communication interface 302, a memory 303, and a communication bus 304, where the processor 301, the communication interface 302, and the memory 303 complete mutual communication through the communication bus 304,
a memory 303 for storing a computer program;
the processor 301, when executing the program stored in the memory 303, is configured to implement the following steps of the file management method according to the embodiment of fig. 2 and the other embodiments of the method described above:
obtaining an identifier of a file to be read from an SSD;
searching file storage position information corresponding to the identification of the file to be read in a database of an operating system with a file system;
positioning a block used for storing the file to be read in the SSD according to the SSD information and the block information recorded in the searched file storage position information;
and reading the file to be read from the positioned block according to the file storage information recorded in the searched file storage position information.
According to the electronic device provided by the embodiment of the invention, when the electronic device is hung with the SSD, the SSD has the SSD file system different from the operating system self-contained file system and the operating system self-contained file system, the operating system self-contained file system is provided with the database, the database records the file storage position information of the file stored in the block data area of the block, after the electronic device acquires the identifier of the file to be read from the SSD, the electronic device can directly position the block in the SSD for storing the file to be read by searching the file storage position information corresponding to the identifier of the file to be read in the database, and directly read the file to be read from the positioned block. Therefore, compared with the prior art, when the scheme provided by the embodiment of the invention is applied to realize file reading, the reading position of the file to be read is determined by the file storage position information in the database of the file system carried by the operating system, and the determined reading position is a block contained in the block data area in the SSD file system, and the storage path of the file to be read does not need to be determined, namely the file to be written does not need to be read based on the storage path, so that the reading speed of the file to be read is improved.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component.
An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, so as to implement the following steps of the file management method according to the embodiment of fig. 2 and the other embodiments of the method described above:
obtaining an identifier of a file to be read from an SSD;
searching file storage position information corresponding to the identification of the file to be read in a database of an operating system with a file system;
positioning a block used for storing the file to be read in the SSD according to the SSD information and the block information recorded in the searched file storage position information;
and reading the file to be read from the positioned block according to the file storage information recorded in the searched file storage position information.
In the computer-readable storage medium provided in the embodiment of the present invention, when the electronic device is mounted with the SSD, the SSD has an SSD file system different from an operating system own file system and the operating system own file system, and the operating system own file system is provided with the database in which file storage location information of a file stored in the block data area of the block is recorded, and after the electronic device obtains an identifier of a file to be read from the SSD, the electronic device can directly locate the block in the SSD, which is used for storing the file to be read, by searching for the file storage location information corresponding to the identifier of the file to be read, and directly read the file to be read from the located block. Therefore, compared with the prior art, when the scheme provided by the embodiment of the invention is applied to realize file reading, the reading position of the file to be read is determined by the file storage position information in the database of the file system carried by the operating system, and the determined reading position is a block contained in the block data area in the SSD file system, and the storage path of the file to be read does not need to be determined, namely the file to be written does not need to be read based on the storage path, so that the reading speed of the file to be read is improved.
For the apparatus/electronic device/storage medium embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to part of the description of the method embodiment.
It should be noted that the device, the electronic device, and the storage medium according to the embodiments of the present invention are respectively a device, an electronic device, and a storage medium to which the dynamic contention window adjustment method based on the random game theory is applied, and all embodiments of the dynamic contention window adjustment method based on the random game theory are applicable to the device, the electronic device, and the storage medium, and can achieve the same or similar beneficial effects.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the apparatus embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (14)

1. The file management method is applied to electronic equipment, wherein the electronic equipment is provided with a Solid State Disk (SSD) which is provided with an SSD file system and an operating system self-contained file system, and the SSD file system comprises the following steps: a system index area and a data area; the system index area is used for storing SSD information and data area information, the data area is divided into blocks with the same size, and each block comprises: the device comprises a block index area and a block data area, wherein the block index area of one block is used for recording file storage information of a file stored in the block data area of the block; the operating system is provided with a file system, and the file system is used for operating the file system of the operating system operated by the electronic equipment; the operating system is provided with a database in a file system, the database is used for recording the corresponding relation between the identification of the file stored in the block data area of each block of the data area and the file storage position information, and the file storage position information of one file comprises: SSD information of the SSD in which the file is stored, block information of a block to which a block data area for storing the file belongs, and file storage information of the file; the method comprises the following steps:
obtaining an identifier of a file to be read from an SSD;
searching file storage position information corresponding to the identification of the file to be read in a database of the self-contained file system of the operating system;
positioning a block used for storing the file to be read in the SSD according to the SSD information and the block information recorded in the searched file storage position information;
and reading the file to be read from the positioned block according to the file storage information recorded in the searched file storage position information.
2. The file management method according to claim 1, wherein when more than one block is located, said reading the file to be read from the located block according to the file storage information recorded in the file storage location information comprises:
according to the file storage information recorded in the file storage position information, respectively reading data belonging to the file to be read from each positioned block;
and merging the read data to obtain the file to be read.
3. The file management method according to claim 1, characterized in that the method further comprises:
obtaining a file to be written in the SSD;
generating an identifier of the file to be written, and determining a block for storing the file to be written as a first block through the SSD file system;
storing the file to be written into a block data area of the first block, obtaining file storage information of the file to be written, and storing the obtained file storage information into a block index area of the first block;
generating file storage position information of the file to be written according to the file storage information of the file to be written, the block information of the first block and SSD information of the SSD to which the first block belongs;
and storing the corresponding relation between the identifier of the file to be written and the generated file storage position information into a database of the operating system with a file system.
4. The file management method according to claim 3, wherein said data area information includes: the usage status of each block;
after the storing the file to be written to the block data area of the first block, the method further comprises:
judging whether the current use state of the first block is a full write state;
if so, updating the use state of the first block recorded in the data area information to a full write state;
if not, updating the use state of the first block recorded in the data area information to a written state when the pre-writing state is an unwritten state, wherein the pre-writing state is: and storing the file to be written to the use state of the first block before the file to be written is stored in the block data area of the first block.
5. The file management method according to claim 3 or 4, wherein the system index area includes: a system main index area and a system standby index area;
the system main index area is used for storing SSD information and data area information;
and the system standby index area is used for storing the backup information of the system main index area.
6. The file management method according to claim 3 or 4, wherein the block index area of one block comprises: a block main index area of the block and a block standby index area of the block;
a block main index area of a block for recording file storage information of a file stored in the block data area of the block;
and the block spare index area of one block is used for storing backup information of the block main index area of the block.
7. The file management device is applied to an electronic device, wherein the electronic device is mounted with a Solid State Disk (SSD), the SSD has an SSD file system and an operating system self-contained file system, and the SSD file system comprises: a system index area and a data area; the system index area is used for storing SSD information and data area information, the data area is divided into blocks with the same size, and each block comprises: the device comprises a block index area and a block data area, wherein the block index area of one block is used for recording file storage information of a file stored in the block data area of the block; the operating system is provided with a file system, and the file system is used for operating the file system of the operating system operated by the electronic equipment; the operating system is provided with a database in a file system, the database is used for recording the corresponding relation between the identification of the file stored in the block data area of each block of the data area and the file storage position information, and the file storage position information of one file comprises: SSD information of the SSD in which the file is stored, block information of a block to which a block data area for storing the file belongs, and file storage information of the file; the device comprises:
the device comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring an identifier of a file to be read, which is to be read from the SSD;
the searching module is used for searching file storage position information corresponding to the identification of the file to be read in a database of the self-contained file system of the operating system;
the positioning module is used for positioning a block in the SSD, which is used for storing the file to be read, according to the SSD information and the block information recorded in the searched file storage position information;
and the reading module is used for reading the file to be read from the positioned block according to the file storage information recorded in the searched file storage position information.
8. The file management apparatus according to claim 7, wherein when more than one block is located, the reading module is specifically configured to:
according to the file storage information recorded in the file storage position information, respectively reading data belonging to the file to be read from each positioned block;
and merging the read data to obtain the file to be read.
9. The file management apparatus according to claim 7, wherein said apparatus further comprises:
the second acquisition module is used for acquiring a file to be written in the SSD;
the determining module is used for generating an identifier of the file to be written, and determining a block for storing the file to be written as a first block through the SSD file system;
the first storage module is used for storing the file to be written into the block data area of the first block, acquiring file storage information of the file to be written and storing the acquired file storage information into the block index area of the first block;
the generating module is used for generating file storage position information of the file to be written according to the file storage information of the file to be written, the block information of the first block and SSD information of the SSD to which the first block belongs;
and the second storage module is used for storing the corresponding relation between the identifier of the file to be written and the generated file storage position information into a database of the self-contained file system of the operating system.
10. The file management apparatus according to claim 9, wherein said data area information includes: the usage status of each block;
the device further comprises:
the judging module is used for judging whether the current use state of the first block is a full-written state;
the judging module comprises:
the first updating submodule is used for updating the use state of the first block recorded in the data area information into a full-written state when the judgment module judges that the first block is in the full-written state;
a second updating sub-module, configured to update the usage status of the first block recorded in the data area information to a written status when the pre-write status is an unwritten status when the determination module determines that the usage status of the first block is not the unwritten status, where the pre-write status is: and storing the file to be written to the use state of the first block before the file to be written is stored in the block data area of the first block.
11. The file management apparatus according to claim 9 or 10, wherein the system index area includes: a system main index area and a system standby index area;
the system main index area is used for storing SSD information and data area information;
and the system standby index area is used for storing the backup information of the system main index area.
12. The file management apparatus according to claim 9 or 10, wherein the block index area of one block comprises: a block main index area of the block and a block standby index area of the block;
a block main index area of a block for recording file storage information of a file stored in the block data area of the block;
and the block spare index area of one block is used for storing backup information of the block main index area of the block.
13. An electronic device, wherein the electronic device is mounted with a Solid State Disk (SSD), and the SSD has an SSD file system and an operating system owned file system, and the SSD file system comprises: a system index area and a data area; the system index area is used for storing SSD information and data area information, the data area is divided into blocks with the same size, and each block comprises: the device comprises a block index area and a block data area, wherein the block index area of one block is used for recording file storage information of a file stored in the block data area of the block; the operating system is provided with a file system, and the file system is used for operating the file system of the operating system operated by the electronic equipment; the operating system is provided with a database in a file system, the database is used for recording the corresponding relation between the identification of the file stored in the block data area of each block of the data area and the file storage position information, and the file storage position information of one file comprises: SSD information of the SSD in which the file is stored, block information of a block to which a block data area for storing the file belongs, and file storage information of the file, the electronic device further includes: a processor and a memory, wherein the memory is configured to store a computer program;
the processor, when executing the program stored in the memory, is adapted to carry out the method steps of any of claims 1-6.
14. A computer-readable storage medium, wherein the electronic device is mounted with a Solid State Disk (SSD), the SSD having an SSD file system and an operating system self-contained file system, the SSD file system comprising: a system index area and a data area; the system index area is used for storing SSD information and data area information, the data area is divided into blocks with the same size, and each block comprises: the device comprises a block index area and a block data area, wherein the block index area of one block is used for recording file storage information of a file stored in the block data area of the block; the operating system is provided with a file system, and the file system is used for operating the file system of the operating system operated by the electronic equipment; the operating system is provided with a database in a file system, the database is used for recording the corresponding relation between the identification of the file stored in the block data area of each block of the data area and the file storage position information, and the file storage position information of one file comprises: SSD information of the SSD in which the file is stored, block information of the blocks to which the block data area for storing the file belongs, file storage information of the file, the computer readable storage medium having stored therein a computer program which, when executed by a processor, implements the method steps of any of claims 1-6.
CN201710951224.4A 2017-10-13 2017-10-13 File management method, file management device, electronic equipment and storage medium Active CN109669622B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710951224.4A CN109669622B (en) 2017-10-13 2017-10-13 File management method, file management device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710951224.4A CN109669622B (en) 2017-10-13 2017-10-13 File management method, file management device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN109669622A CN109669622A (en) 2019-04-23
CN109669622B true CN109669622B (en) 2022-04-05

Family

ID=66139975

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710951224.4A Active CN109669622B (en) 2017-10-13 2017-10-13 File management method, file management device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN109669622B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110221782A (en) * 2019-06-06 2019-09-10 重庆紫光华山智安科技有限公司 Video file processing method and processing device
CN110727639B (en) * 2019-10-08 2023-09-19 深圳市网心科技有限公司 Fragment data reading method, electronic device, system and medium
CN111061683B (en) * 2019-12-30 2023-03-21 成都定为电子技术有限公司 Method and device for storing and operating data stream at high speed
CN111309678B (en) * 2020-02-22 2023-01-03 呼和浩特市奥祥电力自动化有限公司 Data circular storage method and network message recording and analyzing device
CN113362489A (en) * 2020-03-06 2021-09-07 联合汽车电子有限公司 Method for creating vehicle measurement file, electronic device, and storage medium
CN111767213B (en) * 2020-06-18 2024-04-05 北京同邦卓益科技有限公司 Database check point testing method and device, electronic equipment and storage medium
CN111797102A (en) * 2020-07-06 2020-10-20 亿度慧达教育科技(北京)有限公司 Data writing method and device and electronic equipment

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104035891A (en) * 2014-06-26 2014-09-10 福州大学 Android mobile terminal data security protection system
CN104834650A (en) * 2014-02-12 2015-08-12 清华大学 Method and system for generating effective query tasks

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101364218A (en) * 2007-08-10 2009-02-11 深圳市锐明视讯技术有限公司 Hard disk video recorder file systems and checking method thereof
CN100541454C (en) * 2007-12-14 2009-09-16 东软集团股份有限公司 A kind of data cache method and system
US8793228B2 (en) * 2009-01-14 2014-07-29 Stmicroelectronics Pvt. Ltd. File system including a file header area and a file data area
WO2011055976A2 (en) * 2009-11-03 2011-05-12 (주)피스페이스 Apparatus and method for managing a file in a distributed storage system
CN101819602A (en) * 2010-05-07 2010-09-01 北京飞天诚信科技有限公司 Method for implementing data file engine
CN107133334B (en) * 2017-05-15 2020-01-14 成都优孚达信息技术有限公司 Data synchronization method based on high-bandwidth storage system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104834650A (en) * 2014-02-12 2015-08-12 清华大学 Method and system for generating effective query tasks
CN104035891A (en) * 2014-06-26 2014-09-10 福州大学 Android mobile terminal data security protection system

Also Published As

Publication number Publication date
CN109669622A (en) 2019-04-23

Similar Documents

Publication Publication Date Title
CN109669622B (en) File management method, file management device, electronic equipment and storage medium
US11474972B2 (en) Metadata query method and apparatus
US11853549B2 (en) Index storage in shingled magnetic recording (SMR) storage system with non-shingled region
CN109669621B (en) File management method, file management system, electronic device and storage medium
CN105069048A (en) Small file storage method, query method and device
CN108932257B (en) Multi-dimensional data query method and device
CN108614837B (en) File storage and retrieval method and device
CN110888837B (en) Object storage small file merging method and device
CN111061752B (en) Data processing method and device and electronic equipment
CN103324533A (en) distributed data processing method, device and system
CN110147203B (en) File management method and device, electronic equipment and storage medium
CN111638853A (en) Data storage method and device, storage cluster, gateway equipment and main equipment
CN115756955A (en) Data backup and data recovery method and device and computer equipment
CN106844491B (en) Temporary data writing and reading method and device
CN109669623B (en) File management method, file management device, electronic equipment and storage medium
CN110688065A (en) Storage space management method, system, electronic equipment and storage medium
CN109271097B (en) Data processing method, data processing device and server
CN113157600A (en) Space allocation method of shingled hard disk, file storage system and server
CN111984650A (en) Storage method, system and related device of tree structure data
CN115437579B (en) Metadata management method and device, computer equipment and readable storage medium
CN110795031A (en) Data deduplication method, device and system based on full flash storage
CN107704208B (en) Method, device and medium for repairing metadata
CN107908500B (en) Bad block identification method and device
CN109508140B (en) Storage resource management method and device, electronic equipment and system
CN114089924B (en) Block chain account book data storage system and method

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
GR01 Patent grant