WO2019072088A1 - 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
WO2019072088A1
WO2019072088A1 PCT/CN2018/107594 CN2018107594W WO2019072088A1 WO 2019072088 A1 WO2019072088 A1 WO 2019072088A1 CN 2018107594 W CN2018107594 W CN 2018107594W WO 2019072088 A1 WO2019072088 A1 WO 2019072088A1
Authority
WO
WIPO (PCT)
Prior art keywords
block
file
ssd
information
written
Prior art date
Application number
PCT/CN2018/107594
Other languages
French (fr)
Chinese (zh)
Inventor
汪渭春
林鹏
王伟
Original Assignee
杭州海康威视系统技术有限公司
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 杭州海康威视系统技术有限公司 filed Critical 杭州海康威视系统技术有限公司
Publication of WO2019072088A1 publication Critical patent/WO2019072088A1/en

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
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • 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
    • 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]

Definitions

  • This application relates to the field of data storage technology.
  • SSD Solid State Drive
  • a file management system that is run by the operating system of the electronic device, for example, a Windows operating system running through an electronic device or a file management system provided by the Linux operating system. File management of SSDs.
  • the file management system provided by the existing operating system in the file management process for the SSD for example, writing a file in the SSD, first needs to determine the storage path of the file to be written in the SSD, and then write the file to be written. At the determined storage path.
  • the storage path is the storage location information of the file determined by the file management system provided by the existing operating system.
  • file management system provided by the operating system adopts the foregoing storage path-based file management method
  • file management can be performed on the SSD mounted on the electronic device, but the above file management method is applied to a scenario in which a relatively frequent file operation is required.
  • a large number of file real-time write operations such as massive image recognition
  • the file system of the operating system needs to simultaneously determine the storage paths of multiple files, and then write the file based on the determined storage path. It often takes more time, causing the file to write at a slower rate.
  • the present application provides a file management method, a file management apparatus, an electronic device, and a storage medium to achieve the purpose of improving the writing speed of a file in an SSD.
  • the specific technical solutions are as follows:
  • the embodiment of the present application provides a file management method, which is applied to an electronic device, where the electronic device is mounted with a solid state hard disk SSD, and the SSD has an SSD file system, where the SSD file system includes: a system index area and data. a system index area for storing SSD information and data area information, the data area being divided into at least one block, each block comprising: a block index area and a block data area, and a block index area of one block is used for recording
  • the file storage information of the file stored in the block data area of the block the file management method includes:
  • the data area is divided into the same block size
  • Determining, by the SSD file system, a block for storing the file to be written, as the first block includes:
  • the file management method further includes:
  • the data area information includes: a usage status of each block
  • the file management method further includes:
  • the usage state of the first block recorded in the data area information is updated to the written state, wherein the pre-write state is: And storing the file to be written to a use state of the first block before the block data area of the first block.
  • the system index area includes: a system primary index area and a system backup index area;
  • the system main index area is configured to store SSD information and data area information
  • the system backup index area is used to store backup information of the system main index area.
  • the block index area of one block includes: a block main index area of the block and a block backup index area of the block;
  • a block main index area of a block for recording file storage information of a file stored in a block data area of the block
  • a block backup index area of a block for storing backup information of a block main index area of the block for storing backup information of a block main index area of the block.
  • the file management method further includes:
  • the file to be read is read from the located block based on the file storage information recorded in the obtained file storage location information.
  • the reading the to-be-read file from the located block according to the file storage information recorded in the obtained file storage location information includes:
  • the read data is merged to obtain the file to be read.
  • the embodiment of the present application provides a file management apparatus, which is applied to an electronic device, where the electronic device is mounted with a solid state hard disk SSD, and the SSD has an SSD file system, and the SSD file system includes: a system index area and data. a system index area for storing SSD information and data area information, the data area being divided into at least one block, each block comprising: a block index area and a block data area, and a block index area of one block is used for recording
  • the file storage information of the file stored in the block data area of the block the file management device includes:
  • Obtaining a module configured to obtain a file to be written to be written into the SSD
  • a determining module configured to determine, by the SSD file system, a block for storing the file to be written as a first block
  • a storage module configured to store the file to be written into a block data area of the first block, obtain file storage information of the file to be written, and store the obtained file storage information to the first The block index area of the block.
  • the data area is divided into the same block size; the determining module is specifically configured to:
  • the file management apparatus further includes:
  • a generating module 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 the SSD information of the SSD to which the first block belongs.
  • the data area information includes: a usage status of each block
  • the file management device further includes:
  • a determining module configured to determine whether a current usage state of the first block is a full state
  • the determining module includes:
  • a first update submodule configured to update a usage status of the first block recorded in the data area information to a full state when the determining module determines to be YES;
  • a second update submodule configured to: when the determining module determines to be no, when the pre-write state is an unwritten state, update the usage status of the first block recorded in the data area information to be written a state, wherein the pre-write state is: a usage state of the first block before storing the file to be written to a block data area of the first block.
  • the system index area includes: a system primary index area and a system backup index area;
  • the system main index area is configured to store SSD information and data area information
  • the system backup index area is used to store backup information of the system main index area.
  • the block index area of one block includes: a block main index area of the block and a block backup index area of the block;
  • a block main index area of a block for recording file storage information of a file stored in a block data area of the block
  • a block backup index area of a block for storing backup information of a block main index area of the block for storing backup information of a block main index area of the block.
  • the file management apparatus further includes:
  • a reading module configured to obtain file storage location information of a file to be read to be read from the SSD; and to locate the SSD to be read in the positioning SSD according to the SSD information and the block information recorded in the obtained file storage location information a block of the file; the file to be read is read from the located block according to the file storage information recorded in the obtained file storage location information.
  • the reading module is specifically configured to:
  • the read data is merged to obtain the file to be read.
  • an embodiment of the present application provides an electronic device, where the electronic device is mounted with a solid state hard disk SSD, and the SSD has an SSD file system, where the SSD file system includes: a system index area and a data area, and the system index The area is used for storing SSD information and data area information, the data area is divided into blocks of the same size, each block includes: a block index area and a block data area, and a block index area of one block is used to record block data of the block And storing, by the communication device, the file, the electronic device further comprising Communication between
  • the memory is configured to store a computer program
  • the processor when executing the program stored on the memory, performs the following steps:
  • an embodiment of the present application provides an electronic device, where the electronic device is mounted with a solid state hard disk SSD, and the SSD has an SSD file system, where the SSD file system includes: a system index area and a data area, and the system index The area is used for storing SSD information and data area information, the data area is divided into at least one block, each block includes: a block index area and a block data area, and a block index area of one block is used to record a block data area of the block
  • the file storage information of the stored file the electronic device further comprising: a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete each other through the communication bus Communication;
  • the memory is configured to store a computer program
  • the processor when executing the program stored on the memory, performs the following steps:
  • the embodiment of the present application provides a computer readable storage medium, which is a storage medium in an electronic device, where the electronic device is mounted with a solid state hard disk SSD, and the SSD has an SSD file system.
  • the SSD file system includes: a system index area for storing SSD information and data area information, the data area is divided into blocks of the same size, each block includes: a block index area and a block data area, a block index area of one block for recording file storage information of a file stored in a block data area of the block, the computer readable storage medium storing therein a computer program, the computer program being executed by the processor :
  • the embodiment of the present application provides a computer readable storage medium, which is a storage medium in an electronic device, where the electronic device is mounted with a solid state hard disk SSD, and the SSD has an SSD file system.
  • the SSD file system includes: a system index area for storing SSD information and data area information, the data area is divided into at least one block, each block includes: a block index area and a block A data area, a block index area of a block for recording file storage information of a file stored in a block data area of the block, the computer readable storage medium storing a computer program, the computer program being executed by the processor as follows:
  • the SSD itself has an SSD file system different from the operating system's own file system when the electronic device is mounted with the SSD. After the electronic device obtains the file to be written, the identifier of the file is generated and passed.
  • the above-mentioned SSD file system determines a block for storing a file to be written, and directly stores the file to be written into the above-mentioned determined block. It can be seen that the file storage is implemented by using the solution provided by the embodiment of the present application.
  • the file system of the SSD itself determines the storage location of the file, and the determined storage location is the block included in the block data area of the SSD file system, without determining the storage path of the file to be written, that is, no need
  • the file to be written is written based on the storage path, thereby increasing the writing speed of the file to be written.
  • FIG. 1 is a schematic diagram of area division of an SSD according to an embodiment of the present application.
  • FIG. 2 is a schematic flowchart of a file management method according to an embodiment of the present application.
  • FIG. 3 is a schematic diagram of another area division of an SSD according to an embodiment of the present application.
  • FIG. 4 is a schematic structural diagram of a file management apparatus according to an embodiment of the present disclosure.
  • FIG. 5 is another schematic structural diagram of a file management apparatus according to an embodiment of the present application.
  • FIG. 6 is a schematic structural diagram of a determining module in a file management apparatus according to an embodiment of the present disclosure
  • FIG. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
  • the embodiment of the present application provides a file management method, which is applied to an electronic device, and the electronic device may be a server, and may of course be other types of electronic devices.
  • the above-mentioned electronic device is mounted with an SSD. Specifically, only one SSD can be mounted, or more than one SSD can be mounted. Each SSD mounted on the electronic device has an SSD file system.
  • the SSD file system includes: a system index area and a data area.
  • the system index area only includes the system main index area.
  • the system index area includes the system primary index area and the system backup index area.
  • the system backup index area is used to store the backup information of the system main index area, and the backup information stored in the system backup index area can be used to recover the data of the system main index area.
  • the location of the system primary index area and the system backup index area in the SSD can be customized.
  • the system main index area and the system backup index area can be set adjacent to each other, and the system main index area and the system backup index area can be set to a custom length.
  • the system main index area and the system backup index area constitute a system index area
  • Index is used to represent the system main index area
  • Bindex is used to represent the system backup index area
  • block 1, block 2, ... block n constitute data Area.
  • the system main index area is set at the start position in the SSD area
  • the system backup index area is set at the end position in the SSD area. That is, the system main index area and the system backup index area are farthest apart in the SSD area. In this case, when the main index area of the system is damaged, the impact of the system backup index area is small, and the data in the system main index area can be restored through the system backup index area, thereby improving the security of the data stored in the SSD. Sex.
  • the system index area is used to store the SSD information and the data area information; the data area is divided into at least one block, and the size of each block may be the same or different, and is not limited herein.
  • Each block includes a block index area and a block data area. Referring to FIG. 1, wherein i1, i2, . . . in is the block index area of the corresponding block 1, block 2, ... block n; D1, D2, ..., Dn are the blocks of the corresponding block 1, block 2, ... block n Data area.
  • the block index area may be classified into the following two cases according to the type of the index area included.
  • the block index area includes only the block main index area.
  • the block index area includes a block main index area and a block spare index area.
  • the block backup index area is used to store the backup information of the block main index area, and the data stored in the block main index area can be restored by using the backup information stored in the block backup index area.
  • the position of the block main index area and the block backup index area in the area where the block is located can be customized.
  • the block main index area and the block backup index area may be adjacent to each other, and the block main index area and the block backup index area may be set to a custom length.
  • a block main index area and a block spare index area constitute a block index area.
  • the block main index area is set at the start position in the area where the block is located, and the block backup index area is set at the end position in the area where the block is located, that is, the block main index area and the block backup index area are farthest apart in the block area. .
  • the primary index area of the block is damaged, the impact of the block backup index area is small, and the data of the block main index area can be restored by the block backup index area, thereby improving the storage of each block in the SSD. The security of the data.
  • the block index area of one block is used to record file storage information of files stored in the block data area of the block.
  • the file storage information may include at least one of a file ID (identity, identification number), a file size, a file location offset, and a file storage time of the stored file.
  • a file ID identity, identification number
  • a file size size
  • a file location offset a file storage time of the stored file.
  • the above file position offset can be understood as: the offset of the starting storage location of the file in the block relative to the starting address of the block.
  • the block index area of block 1 may include file ID, file size, file position offset, and file storage time of file A; block 2 stores file B, and block index of block 2
  • the area may include the file ID of the file B, the file size, the file position offset, and the file storage time; if the file C is stored in the block 3, the block index area of the block 3 may include the file ID, the file size, and the file position of the file C. Shift, file storage time.
  • the SSD information may include at least one of ID, total storage capacity, available space, and the like of the SSD.
  • the available space in the SSD information is the free storage space in the SSD.
  • the data area information may include at least one of a size of each block in the data area, a number of blocks, and usage status information of each block.
  • the usage status information of the foregoing block can be understood as: information for indicating the current usage status of the block. From the perspective of data storage, the current usage status of the block can be divided into: an unwritten state, a written state, and Full status.
  • the current state of use of the block in the state information is not limited to the above three states, and may include other states, which are not limited herein.
  • the unwritten state can be understood as the state in which no files have been stored.
  • the full state can be understood as a state in which a file has been stored and there is no free storage space.
  • the written state can be understood as a state in which a file has been stored but there is still free storage space.
  • the information 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 can be kept unchanged during the SSD storage file, and the SSD information
  • the available space in the space, the usage status of each block in the data area information may change with the storage of the file. Therefore, the SSD information and the data area information can be set in the process of formatting the SSD, wherein each of the available space and the data area information in the SSD information set in the formatting process
  • the usage status of the block is the initial value.
  • the block index area and the block data area of one block 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 may be preset.
  • the initial value of the available space in the SSD information can be set to the total storage capacity of the SSD or the total spare storage space.
  • the initial value of the usage status of each block can be set to: unwritten state.
  • the number of blocks in the data area information can be calculated by the following methods:
  • the total storage space is subtracted from the size of the system index area to obtain a difference; the obtained difference is divided by the size of each block in the preset data area, and the obtained quotient is divided into blocks in the data area. The number.
  • the file management method provided by the embodiment of the present application includes the following steps:
  • the file to be written is a file to be written into the SSD, and the file may include at least one of a picture format file, a text format file, an audio format file, and a video format file. It is easy to understand that the file to be written can be obtained in various ways, for example, by a file write request sent by the application; and the file to be written stored in the cloud database can be actively searched. Illustratively, if an image processing application sends a picture file to an electronic device, the electronic device can receive the file as a file to be written.
  • S102 Generate an identifier of the file to be written, and determine, by the SSD file system, a block for storing the file to be written as the first block.
  • the electronic device can generate a unique identifier of the file to distinguish the file from other files.
  • the data area of one SSD can be divided into multiple blocks, so that one or more blocks for storing the file to be written can be determined by the SSD file system, and the determined block is taken as the first Piece.
  • the SSD file system may allocate a block in a data area for the file to be written to store the file to be written.
  • the first of the first block in this application is only used to separate one block from another, and does not indicate any order or priority between the blocks.
  • the electronic device may select one or more SSDs for storage by using SSD information stored in each SSD system index area, such as an SSD ID.
  • the method for selecting an SSD for storing a file to be written may be various: randomly selected, according to a format of a file to be written, and the like. Exemplarily, when an electronic device mounts three SSDs, the IDs of the three SSDs are 001A, 002B, and 003C, respectively, and the electronic device can randomly select the SSD with the ID 002B as the SSD for storing the file to be written, and pass The file management system of the SSD allocates blocks in a data area for storing files to be written. Alternatively, an SSD may be selected as the SSD for storing the file to be written based on the format of the file to be currently written.
  • the first block allocated by the SSD file system may be one or more. That is, when the size of one file is larger than the size of one block in the data area, a plurality of blocks can be allocated for the file for storing the file. For example, if a file has a size of 80MB and a block has a size of 64MB, the file management system can allocate 2 blocks for storing the file.
  • the file to be written may be stored in the block data area of the first block.
  • the electronic device can acquire file storage information such as a file ID, a file size, a file position offset, a file storage time, and the like, and store the information in the block of the first block. Index area.
  • a plurality of files to be written allocated to the first block may be sequentially stored to the block data area of the first block, thereby being able to utilize the sequential write performance advantage of the SSD to speed up storage of multiple files. Improve file storage efficiency.
  • the embodiment of the present application may further generate file storage location information corresponding to the file to be written.
  • the file storage location information generally includes file storage information of the file to be written, block information of the first block, and SSD information of the SSD to which the first block belongs, and the file storage location information may further include other information than the above three types of information. This is not limited here.
  • the block information of the first block may contain various attribute information of the first block, such as the current use state of the first block, the block number of the first block in the data area, and the like.
  • the file storage location information may include: a file ID of the file to be written, a size of the file to be written, a position offset of the file to be written, an ID of the SSD where the file to be written is located, and a block of the first block. At least one of the information such as the number.
  • the application may be fed back to the file to which the file is written, and the file storage location information may be sent, so that the user of the application knows that the file to be written has been stored.
  • the storage location, the file ID, and the like of the file to be written can also be known, so that the user can find the file to be written in the future.
  • the file storage location information may be fed back to the application that sends the file write request in the form of a URL (Uniform Resource Locator), where the URL address may include, for example, the ID of the SSD and the block where the file is located. At least one of information (for example, a block number of the first block), a file position offset, a file size, a file ID, and the like.
  • the data area information may further include a usage status of each block.
  • the usage state of each block may be any one of a state of an unwritten state, a written state, and a full state.
  • the unwritten state indicates that the data in the block is empty and data can be written.
  • the written status indicates that data is stored in the block and the data can still be written.
  • the full state indicates that the data stored in the block is full and no more data can be written.
  • the state of the first block may change. Therefore, it is required to update the use state of the first block in combination with the use state of the first block before and after storing the file to be written, thereby This makes it possible to correctly store the usage state in which the first block is located.
  • the first block When the file to be written is stored in the first block, there may be two cases. In the first case, the first block is in the full state; in the second case, the first block is in the unfilled state. According to the above two situations, it may be determined whether the usage state of the first block is a full state, and then the usage state of the first block is updated in a different manner according to the determination result.
  • an implementation manner of the update process may be: if the current usage status of the first block is a full state, the usage status of the first block recorded in the data area information may be updated to a full state. If the current use state of the first block is an unfilled state, and the state before the write is an unwritten state, indicating that the file to be written is stored in the block data area of the first block, the use state of the first block is The data has not been stored yet.
  • the usage status of the first block recorded in the data area information may be updated to the written state; if the storage is to be written After the first block of the file has no free storage space, the usage status of the first block recorded in the data area information can be updated to the full state.
  • the first block when the current use state of the first block is the unfilled state, and the pre-write state is the written state, the first block has been stored before the file to be written is stored in the block data area of the first block. File, the first block is in the written state, and after storing the file to be written, there is still free space in the first block. In this case, the usage state of the first block remains unchanged and remains written. Into the state.
  • the system index area may be composed only of a part.
  • the system index area includes only the system main index area. That is, the SSD information and the data area information are directly stored in the system index area, and the system index area at this time may be the system main index area in FIG.
  • 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 The system is in the index area.
  • the system primary index area is used for storing SSD information and data area information;
  • the system backup index area is used for storing backup information of the system main index area, that is, the system backup index area is used as a backup of the system main index area, and is also used.
  • SSD information and data area information For storing SSD information and data area information.
  • the system backup index area of the embodiment of the present application since the backup information of the system main index area is stored, when the system main index area fails, the data in the system main index area can be performed through the backup information in the system backup index area. Restore, thereby improving the data security of the SSD.
  • the block index area of one block may be composed only of a part.
  • the block index area includes only the block main index area. That is, the file storage information of the file stored in the block data area of the block is directly recorded in the block index area of one block, and the block index area at this time may be the block main index area in FIG.
  • 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 main index area of the block and The block is indexed by the block.
  • the block main index area is used to record file storage information of a file stored in the block data area of the block;
  • the block backup index area is used to store backup information of the block main index area of the block, that is, the block backup index area is used as The backup of the main index area of the block is also used to record the file storage information of the file stored in the data area of the block.
  • Bin are the corresponding block 1, block 2, block n
  • the data in the main index area of the block may be backed up by the backup information of the block backup index area when the block main index area is damaged. Restore to improve the data security of the SSD.
  • the file data in the SSD can also be read, and the file data to be read can be referred to as a file to be read.
  • the file to be read in the SSD may be read by using the generated file storage location information.
  • the SSD of the file to be read may be determined by the ID of the SSD in the file location information, and then the block number of the block in which the file is located may be Positioning the block where the file to be read is located in the SSD; and further reading the file to be read in the block data area of the located block by the size of the file and the position offset of the file in the file storage location information .
  • the file to be read is taken as an example of the file to be written in the above embodiment.
  • a file storage location information corresponding to the file is generated, where the file storage location information includes corresponding SSD information and block information, and the file may be recorded.
  • Information such as the ID of the SSD, the block number of the first block, and the like.
  • the file storage location information may further include file storage information, wherein the file storage information may record information such as a file ID of the file, a size of the file, a position offset of the file, and the like, and thus, The file to be written is read from the above-located block by the file storage information recorded in the file storage location information.
  • the embodiment of the present application can directly locate the block where the file to be read is located through the SSD information and the block information in the file storage location information corresponding to the file, and then record the location information in the file storage location.
  • the file storage information reads the file to be read from the located block, and does not need to read the file based on the file storage path, thereby improving the reading speed of the file.
  • a plurality of blocks may be allocated for the file for storing the file. Accordingly, when reading the file, there may also be cases where more than one block is located.
  • the embodiment of the present application may further store the information according to the file recorded in the obtained file storage location information.
  • the data belonging to the file to be read is read from each of the located blocks, and the read data can be combined to obtain the file to be read.
  • the SSD includes six blocks, namely: block 1, block 2, block 3, block 4, block 5, and block 6, wherein the located block storing the file to be read includes block 1, block 2, and Block 3, wherein block 1 stores a first portion of the file to be read, block 2 stores a second portion of the file to be read, and block 3 stores a third portion of the file to be read, the first portion, the second portion, and The third part combines to form the file to be read.
  • the file may be stored from the file stored in the file storage location information, wherein the obtained file storage information indicates The storage location of the first portion in block 1, the storage location of the second portion in block 2, and the storage location of the third portion in block 3 are derived.
  • the file storage information the first part of the file to be read can be read from the block 1, the second part of the file to be read is read from the block 2, and the file to be read is read from the block 3.
  • the first part, the second part and the third part are combined to obtain the file to be read.
  • the SSD itself has an SSD file system different from the operating system's own file system when the electronic device is mounted with the SSD, and the identifier of the file is generated after the electronic device acquires the file to be written. And determining, by using the foregoing SSD file system, a block for storing a file to be written, and directly storing the file to be written into the determined block, as shown in the prior art, applying the solution provided by the embodiment of the present application.
  • the storage location of the file is determined by the file system owned by the SSD, and the determined storage location is a block included in the block data area in the SSD file system, without determining the storage path of the file to be written. That is, it is not necessary to write a file to be written based on the storage path, thereby increasing the writing speed of the file to be written.
  • the embodiment of the present application also provides a corresponding device embodiment.
  • the embodiment of the present application provides a file management apparatus, which is mounted with a solid state hard disk SSD, and the SSD has an SSD file system, wherein the SSD file system includes: a system index area and a data area, and the system index area is used.
  • the data area is divided into at least one block, each block includes: a block index area and a block data area, and a block index area of one block is used to record a file stored in the block data area of the block.
  • the file stores information
  • the device includes:
  • the obtaining module 201 is configured to obtain a file to be written to be written into the SSD.
  • the determining module 202 is configured to determine, by the SSD file system, a block for storing the file to be written as the first block.
  • a storage module 203 configured to store the file to be written into a block data area of the first block, obtain file storage information of the file to be written, and store the obtained file storage information to the first A block index area of a block.
  • the data area is divided into the same block size; the determining module 202 is specifically configured to:
  • the SSD when the electronic device is mounted with the SSD, the SSD itself has an SSD file system different from the operating system's own file system, and after the electronic device acquires the file to be written, the identifier of the file is generated. And determining, by using the foregoing SSD file system, a block for storing a file to be written, and directly storing the file to be written into the determined block, as shown in the prior art, applying the solution provided by the embodiment of the present application.
  • the storage location of the file is determined by the file system owned by the SSD, and the determined storage location is a block included in the block data area in the SSD file system, without determining the storage path of the file to be written. That is, it is not necessary to write a file to be written based on the storage path, thereby increasing the writing speed of the file to be written.
  • the file management apparatus in the embodiment of the present application may further include:
  • a generating module 204 configured to generate, according to the file storage information of the file to be written, the block information of the first block, and the SSD information of the SSD to which the first block belongs, file storage location information of the file to be written .
  • the data area information may include: a usage status of each block;
  • the determining module 205 is configured to determine whether the current use state of the first block is a full state.
  • the system index area includes: a system primary index area and a system backup index area;
  • the system backup index area is used to store backup information of the system's main index area.
  • the block index area of one block includes: a block main index area of the block and a block backup index area of the block; a block main index area of one block, used to record a file of the file stored in the block data area of the block Storage information; a block backup index area of a block for storing backup information of the block main index area of the block.
  • the file management apparatus of the embodiment of the present application further includes:
  • the reading module 206 is configured to obtain file storage location information of the file to be read to be read from the SSD; and locate the file to be read in the SSD according to the SSD information and the block information recorded in the obtained file storage location information. a block; the file to be read is read from the located block according to the file storage information recorded in the obtained file storage location information.
  • the foregoing reading module 206 may be specifically configured to:
  • the data belonging to the file to be read is respectively read from the located blocks; the read data is merged to obtain the file to be read:
  • the determining module 205 further includes:
  • the first update submodule 2051 is configured to update the usage status of the first block recorded in the data area information to the full state when the determination module 205 determines YES.
  • the second update sub-module 2052 is configured to: when the determining module 205 determines to be no, update the usage status of the first block recorded in the data area information to the written state when the pre-write state is the unwritten state, where The pre-write state is: the usage state of the first block before storing the file to be written to the block data area of the first block.
  • the file management apparatus can generate file storage location information through the generation module 204, so that the user can find the file later; and the system backup index area can be used in the system backup index area when the system primary index area is damaged.
  • the backup information is used to restore the data in the main index area of the system, thereby ensuring the data security of the SSD; through the block backup index area, when the block main index area is damaged, the backup information of the block backup index area is used to block the main index area of the block. The data in the data is restored to ensure the data security of the SSD.
  • the embodiment of the present application further provides an electronic device.
  • the electronic device includes a processor 301, a communication interface 302, a memory 303, and a communication bus 304.
  • the processor 301, the communication interface 302, and the memory 303 communicate.
  • Bus 304 completes communication with each other,
  • a memory 303 configured to store a computer program
  • the processor 301 is configured to implement the following steps of the file management method according to the foregoing embodiment of FIG. 2 and the foregoing method embodiments when executing the program stored in the memory 303:
  • the file to be written is stored in the block data area of the first block, and the file storage information of the file to be written is obtained, and the obtained file storage information is stored in the block index area of the first block.
  • the electronic device when the electronic device is mounted with the SSD, the SSD itself has an SSD file system different from the operating system's own file system, and after the electronic device acquires the file to be written, the identifier of the file is generated. And determining, by using the foregoing SSD file system, the block for storing the file to be written, and directly storing the file to be written into the determined block, as shown in the prior art, applying the solution provided by the embodiment of the present application.
  • the file system of the SSD itself determines the storage location of the file, and the determined storage location is the block included in the block data area of the SSD file system, without determining the storage path of the file to be written, That is, it is not necessary to write a file to be written based on the storage path, thereby increasing the writing speed of the file to be written.
  • the embodiment of the present application further provides an electronic device, where the electronic device includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete communication with each other through the communication bus.
  • a memory for storing a computer program
  • the processor when used to execute the program stored in the memory, implements the following steps of the file management method as described in the foregoing embodiment of FIG. 2 and the other method embodiments:
  • the file to be written is stored in the block data area of the first block, and the file storage information of the file to be written is obtained, and the obtained file storage information is stored in the block index area of the first block.
  • the communication bus mentioned in the above electronic device may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus.
  • PCI Peripheral Component Interconnect
  • EISA Extended Industry Standard Architecture
  • the communication bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only one thick line is shown in the figure, but it does not mean that there is only one bus or one type of bus.
  • the communication interface is used for communication between the above electronic device and other devices.
  • the memory may include a random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage.
  • the memory may also be at least one storage device located away from the aforementioned processor.
  • the above processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (Network Processor, NP for short), or a digital signal processor (DSP). , Application Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware component.
  • CPU central processing unit
  • NP Network Processor
  • DSP digital signal processor
  • ASIC Application Specific Integrated Circuit
  • FPGA Field-Programmable Gate Array
  • the embodiment of the present application further provides a computer readable storage medium.
  • the computer readable storage medium stores a computer program for implementing the following steps of the file management method according to the foregoing embodiment of FIG. 2 and the foregoing other method embodiments. :
  • the file to be written is stored in the block data area of the first block, and the file storage information of the file to be written is obtained, and the obtained file storage information is stored in the block index area of the first block.
  • the computer-readable storage medium provided by the embodiment of the present invention, when the electronic device is mounted with the SSD, the SSD itself has an SSD file system different from the operating system's own file system, and the electronic device generates the file after the electronic device acquires the file to be written. And the foregoing SSD file system determines the block for storing the file to be written, and directly stores the file to be written into the determined block, as shown in the embodiment of the present application.
  • the storage location of the file is determined by the file system owned by the SSD, and the determined storage location is the block included in the block data area in the SSD file system, without determining the storage of the file to be written.
  • the path that is, the need to write the file to be written based on the storage path, thereby increasing the writing speed of the file to be written.
  • the embodiment of the present application further provides a computer readable storage medium.
  • the computer readable storage medium stores a computer program for implementing the following steps of the file management method according to the foregoing embodiment of FIG. 2 and the foregoing other method embodiments. :
  • the file to be written is stored in the block data area of the first block, and the file storage information of the file to be written is obtained, and the obtained file storage information is stored in the block index area of the first block.
  • the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment.
  • the apparatus, the electronic device, and the storage medium of the embodiment of the present application are respectively the apparatus, the electronic device, and the storage medium applying the dynamic competition window adjustment method based on the random game theory, and the dynamic competition window based on the random game theory. All embodiments of the adjustment method are applicable to the device, the electronic device, and the storage medium, and all achieve the same or similar benefits.

Abstract

A file management method, a file management device, electronic equipment and storage medium, wherein the method comprises: obtaining a file to be written of a solid state drive (SSD) to be written; generating an identification for the file to be written and determining, by means of an SSD file system, a block for storing the file to be written and using said block as a first block; storing the file to be written to 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 to a block index area of the first block. When storing files by applying the solution provided in the embodiments of the present application, it is not necessary to write the file to be written on the basis of a storage path, thus the speed of writing the file to be written is increased.

Description

一种文件管理方法、文件管理装置、电子设备及存储介质File management method, file management device, electronic device and storage medium
本申请要求于2017年10月13日提交中国专利局、申请号为201710951379.8发明名称为“一种文件管理方法、文件管理装置、电子设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese Patent Application entitled "A Document Management Method, File Management Device, Electronic Device and Storage Medium" filed on October 13, 2017 by the Chinese Patent Office, Application No. 201710951379.8, the entire contents of which is hereby incorporated by reference. This is incorporated herein by reference.
技术领域Technical field
本申请涉及数据存储技术领域。This application relates to the field of data storage technology.
背景技术Background technique
SSD(Solid State Drive,固态硬盘)是一种用于存储数据的存储设备,与传统硬盘相比,由于其具有读写速度快、功耗低、可靠性高等特点,逐渐被越来越多的电子设备使用。SSD在挂载到电子设备上时,通常由电子设备所运行操作系统自带的文件管理系统对其进行文件管理,例如,通过电子设备运行的windows操作系统或linux操作系统自带的文件管理系统对SSD进行文件管理。SSD (Solid State Drive) is a storage device for storing data. Compared with traditional hard disks, it has more and more features due to its fast read/write speed, low power consumption and high reliability. Use of electronic equipment. When an SSD is mounted on an electronic device, it is usually managed by a file management system that is run by the operating system of the electronic device, for example, a Windows operating system running through an electronic device or a file management system provided by the Linux operating system. File management of SSDs.
现有操作系统自带的文件管理系统在对SSD进行文件管理过程中,例如,在SSD中写入一个文件,需要先确定要写入文件在SSD中的存储路径,再将要写入文件写入所确定的存储路径处。上述存储路径即为,现有操作系统自带的文件管理系统所确定的该文件的存储位置信息。The file management system provided by the existing operating system in the file management process for the SSD, for example, writing a file in the SSD, first needs to determine the storage path of the file to be written in the SSD, and then write the file to be written. At the determined storage path. The storage path is the storage location information of the file determined by the file management system provided by the existing operating system.
虽然操作系统自带的文件管理系统采用上述基于存储路径的文件管理方法,能够对挂载到电子设备上的SSD进行文件管理,但是上述文件管理方法应用在需要进行较为频繁的文件操作的场景时,例如海量图片识别等需要进行大量文件实时写入操作的场景,由于操作系统自带的文件系统需要同时确定多个文件各自的存储路径,再基于所确定的存储路径对文件进行写入操作,往往会花费较多时间,造成文件的写入速度下降。Although the file management system provided by the operating system adopts the foregoing storage path-based file management method, file management can be performed on the SSD mounted on the electronic device, but the above file management method is applied to a scenario in which a relatively frequent file operation is required. For example, a large number of file real-time write operations, such as massive image recognition, because the file system of the operating system needs to simultaneously determine the storage paths of multiple files, and then write the file based on the determined storage path. It often takes more time, causing the file to write at a slower rate.
发明内容Summary of the invention
本申请提供了一种文件管理方法、文件管理装置、电子设备及存储介质,以实现在SSD中提高文件的写入速度的目的。具体技术方案如下:The present application provides a file management method, a file management apparatus, an electronic device, and a storage medium to achieve the purpose of improving the writing speed of a file in an SSD. The specific technical solutions are as follows:
第一方面,本申请实施例提供了一种文件管理方法,应用于电子设备, 所述电子设备挂载有固态硬盘SSD,SSD具有SSD文件系统,所述SSD文件系统包括:系统索引区和数据区,所述系统索引区用于存储SSD信息和数据区信息,所述数据区被划分为至少一个块,每一个块包括:块索引区和块数据区,一个块的块索引区用于记录该块的块数据区所存储文件的文件存储信息,所述文件管理方法包括:In a first aspect, the embodiment of the present application provides a file management method, which is applied to an electronic device, where the electronic device is mounted with a solid state hard disk SSD, and the SSD has an SSD file system, where the SSD file system includes: a system index area and data. a system index area for storing SSD information and data area information, the data area being divided into at least one block, each block comprising: a block index area and a block data area, and a block index area of one block is used for recording The file storage information of the file stored in the block data area of the block, the file management method includes:
获得待写入SSD的待写入文件;Obtaining a file to be written to be written to the SSD;
通过所述SSD文件系统确定用于存储所述待写入文件的块,作为第一块;Determining, by the SSD file system, a block for storing the file to be written as a first block;
将所述待写入文件存储至所述第一块的块数据区,并获得所述待写入文件的文件存储信息,将所获得的文件存储信息存储至所述第一块的块索引区。And storing the file to be written into the block data area of the first block, and 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 .
可选地,所述数据区被划分所得到的块大小相同;Optionally, the data area is divided into the same block size;
所述通过所述SSD文件系统确定用于存储所述待写入文件的块,作为第一块,包括:Determining, by the SSD file system, a block for storing the file to be written, as the first block, includes:
生成所述待写入文件的标识,并通过所述SSD文件系统确定用于存储所述待写入文件的块,作为第一块。Generating an identifier of the file to be written, and determining, by the SSD file system, a block for storing the file to be written as the first block.
可选地,所述文件管理方法还包括:Optionally, the file management method further includes:
根据所述待写入文件的文件存储信息、所述第一块的块信息以及所述第一块所属SSD的SSD信息,生成所述待写入文件的文件存储位置信息。And generating 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 the SSD information of the SSD to which the first block belongs.
可选地,所述数据区信息包括:各个块的使用状态;Optionally, the data area information includes: a 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:
判断所述第一块的当前使用状态是否为写满状态;Determining whether the current use state of the first block is a full state;
若为是,将所述数据区信息中记录的所述第一块的使用状态更新为写满状态;If yes, updating the usage status of the first block recorded in the data area information to a full state;
若为否,在写入前状态为未写入状态时,将所述数据区信息中记录的所述第一块的使用状态更新为已写入状态,其中,所述写入前状态为:将所述待写入文件存储至所述第一块的块数据区之前所述第一块的使用状态。If not, when the pre-write state is the unwritten state, the usage state of the first block recorded in the data area information is updated to the written state, wherein the pre-write state is: And storing the file to be written to a use state of the first block before the block data area of the first block.
可选地,所述系统索引区包括:系统主索引区和系统备索引区;Optionally, the system index area includes: a system primary index area and a system backup index area;
所述系统主索引区,用于存储SSD信息和数据区信息;The system main index area is configured to store SSD information and data area information;
所述系统备索引区,用于存储所述系统主索引区的备份信息。The system backup index area is used to store 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 backup index area of the block;
一个块的块主索引区,用于记录该块的块数据区所存储文件的文件存储信息;a block main index area of a block for recording file storage information of a file stored in a block data area of the block;
一个块的块备索引区,用于存储该块的块主索引区的备份信息。A block backup index area of a block for storing backup information of a block main index area of the block.
可选地,所述文件管理方法还包括:Optionally, the file management method further includes:
获得待从SSD读取的待读取文件的文件存储位置信息;Obtaining file storage location information of the file to be read to be read from the SSD;
根据所获得文件存储位置信息中记录的SSD信息以及块信息,定位SSD中用于存储所述待读取文件的块;And locating a block in the SSD for storing the file to be read according to the SSD information and the block information recorded in the obtained file storage location information;
根据所获得文件存储位置信息中记录的文件存储信息,从定位到的块中读取所述待读取文件。The file to be read is read from the located block based on the file storage information recorded in the obtained file storage location information.
可选地,当定位到一个以上块时,所述根据所获得文件存储位置信息中记录的文件存储信息,从定位到的块中读取所述待读取文件,包括:Optionally, when the one or more blocks are located, the reading the to-be-read file from the located block according to the file storage information recorded in the obtained file storage location information includes:
根据所获得文件存储位置信息中记录的文件存储信息,分别从定位到的各个块中读取属于所述待读取文件的数据;Reading data belonging to the file to be read from each of the located blocks according to the file storage information recorded in the obtained file storage location information;
对读取到的数据进行合并处理,获得所述待读取文件。The read data is merged to obtain the file to be read.
第二方面,本申请实施例提供了一种文件管理装置,应用于电子设备,所述电子设备挂载有固态硬盘SSD,SSD具有SSD文件系统,所述SSD文件系统包括:系统索引区和数据区,所述系统索引区用于存储SSD信息和数据区信息,所述数据区被划分为至少一个块,每一个块包括:块索引区和块数据区,一个块的块索引区用于记录该块的块数据区所存储文件的文件存储信息,所述文件管理装置包括:In a second aspect, the embodiment of the present application provides a file management apparatus, which is applied to an electronic device, where the electronic device is mounted with a solid state hard disk SSD, and the SSD has an SSD file system, and the SSD file system includes: a system index area and data. a system index area for storing SSD information and data area information, the data area being divided into at least one block, each block comprising: a block index area and a block data area, and a block index area of one block is used for recording The file storage information of the file stored in the block data area of the block, the file management device includes:
获取模块,用于获得待写入SSD的待写入文件;Obtaining a module, configured to obtain a file to be written to be written into the SSD;
确定模块,用于通过所述SSD文件系统确定用于存储所述待写入文件的块,作为第一块;a determining module, configured to determine, by the SSD file system, a block for storing the file to be written as a first block;
存储模块,用于将所述待写入文件存储至所述第一块的块数据区,并获得所述待写入文件的文件存储信息,将所获得的文件存储信息存储至所述第一块的块索引区。a storage module, configured to store the file to be written into a block data area of the first block, obtain file storage information of the file to be written, and store the obtained file storage information to the first The block index area of the block.
可选地,所述数据区被划分所得到的块大小相同;所述确定模块具体用于:Optionally, the data area is divided into the same block size; the determining module is specifically configured to:
生成所述待写入文件的标识,并通过所述SSD文件系统确定用于存储所述待写入文件的块,作为第一块。Generating an identifier of the file to be written, and determining, by the SSD file system, a block for storing the file to be written as the first block.
可选地,所述文件管理装置还包括:Optionally, the file management apparatus further includes:
生成模块,用于根据所述待写入文件的文件存储信息、所述第一块的块信息以及所述第一块所属SSD的SSD信息,生成所述待写入文件的文件存储位置信息。And a generating module, 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 the SSD information of the SSD to which the first block belongs.
可选地,所述数据区信息包括:各个块的使用状态;Optionally, the data area information includes: a usage status of each block;
所述文件管理装置还包括:The file management device further includes:
判断模块,用于判断所述第一块的当前使用状态是否为写满状态;a determining module, configured to determine whether a current usage state of the first block is a full state;
所述判断模块包括:The determining module includes:
第一更新子模块,用于当判断模块判断为是时,将所述数据区信息中记录的所述第一块的使用状态更新为写满状态;a first update submodule, configured to update a usage status of the first block recorded in the data area information to a full state when the determining module determines to be YES;
第二更新子模块,用于当判断模块判断为否时,在写入前状态为未写入状态时,将所述数据区信息中记录的所述第一块的使用状态更新为已写入状态,其中,所述写入前状态为:将所述待写入文件存储至所述第一块的块数据区之前所述第一块的使用状态。a second update submodule, configured to: when the determining module determines to be no, when the pre-write state is an unwritten state, update the usage status of the first block recorded in the data area information to be written a state, wherein the pre-write state is: a usage state of the first block before storing the file to be written to a block data area of the first block.
可选地,所述系统索引区包括:系统主索引区和系统备索引区;Optionally, the system index area includes: a system primary index area and a system backup index area;
所述系统主索引区,用于存储SSD信息和数据区信息;The system main index area is configured to store SSD information and data area information;
所述系统备索引区,用于存储所述系统主索引区的备份信息。The system backup index area is used to store 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 backup index area of the block;
一个块的块主索引区,用于记录该块的块数据区所存储文件的文件存储信息;a block main index area of a block for recording file storage information of a file stored in a block data area of the block;
一个块的块备索引区,用于存储该块的块主索引区的备份信息。A block backup index area of a block for storing backup information of a block main index area of the block.
可选地,所述文件管理装置还包括:Optionally, the file management apparatus further includes:
读取模块,用于获得待从SSD读取的待读取文件的文件存储位置信息;根据所获得文件存储位置信息中记录的SSD信息以及块信息,定位SSD中用于存储所述待读取文件的块;根据所获得文件存储位置信息中记录的文件存储信息,从定位到的块中读取所述待读取文件。a reading module, configured to obtain file storage location information of a file to be read to be read from the SSD; and to locate the SSD to be read in the positioning SSD according to the SSD information and the block information recorded in the obtained file storage location information a block of the file; the file to be read is read from the located block according to the file storage information recorded in the obtained file storage location information.
可选地,当定位到一个以上块时,所述读取模块具体用于:Optionally, when more than one block is located, the reading module is specifically configured to:
根据所获得文件存储位置信息中记录的文件存储信息,分别从定位到的各个块中读取属于所述待读取文件的数据;Reading data belonging to the file to be read from each of the located blocks according to the file storage information recorded in the obtained file storage location information;
对读取到的数据进行合并处理,获得所述待读取文件。The read data is merged to obtain the file to be read.
第三方面,本申请实施例提供了一种电子设备,所述电子设备挂载有固态硬盘SSD,SSD具有SSD文件系统,所述SSD文件系统包括:系统索引区和数据区,所述系统索引区用于存储SSD信息和数据区信息,所述数据区被划分为大小相同的块,每一个块包括:块索引区和块数据区,一个块的块索引区用于记录该块的块数据区所存储文件的文件存储信息,所述电子设备还包括:包括处理器、通信接口、存储器和通信总线,其中,所述处理器、所述通信接口、所述存储器通过所述通信总线完成相互间的通信;In a third aspect, an embodiment of the present application provides an electronic device, where the electronic device is mounted with a solid state hard disk SSD, and the SSD has an SSD file system, where the SSD file system includes: a system index area and a data area, and the system index The area is used for storing SSD information and data area information, the data area is divided into blocks of the same size, each block includes: a block index area and a block data area, and a block index area of one block is used to record block data of the block And storing, by the communication device, the file, the electronic device further comprising Communication between
所述存储器,用于存放计算机程序;The memory is configured to store a computer program;
所述处理器,用于执行存储器上所存放的程序时,执行以下步骤:The processor, when executing the program stored on the memory, performs the following steps:
获得待写入SSD的待写入文件;Obtaining a file to be written to be written to the SSD;
生成所述待写入文件的标识,并通过所述SSD文件系统确定用于存储所述待写入文件的块,作为第一块;Generating an identifier of the file to be written, and determining, by the SSD file system, a block for storing the file to be written as a first block;
将所述待写入文件存储至所述第一块的块数据区,并获得所述待写入文件的文件存储信息,将所获得的文件存储信息存储至所述第一块的块索引区。And storing the file to be written into the block data area of the first block, and 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 .
第四方面,本申请实施例提供了一种电子设备,所述电子设备挂载有固态硬盘SSD,SSD具有SSD文件系统,所述SSD文件系统包括:系统索引区和数据区,所述系统索引区用于存储SSD信息和数据区信息,所述数据区被划分为至少一个块,每一个块包括:块索引区和块数据区,一个块的块索引区用于记录该块的块数据区所存储文件的文件存储信息,所述电子设备还包括:包括处理器、通信接口、存储器和通信总线,其中,所述处理器、所述通信接口、所述存储器通过所述通信总线完成相互间的通信;In a fourth aspect, an embodiment of the present application provides an electronic device, where the electronic device is mounted with a solid state hard disk SSD, and the SSD has an SSD file system, where the SSD file system includes: a system index area and a data area, and the system index The area is used for storing SSD information and data area information, the data area is divided into at least one block, each block includes: a block index area and a block data area, and a block index area of one block is used to record a block data area of the block The file storage information of the stored file, the electronic device further comprising: a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete each other through the communication bus Communication;
所述存储器,用于存放计算机程序;The memory is configured to store a computer program;
所述处理器,用于执行存储器上所存放的程序时,执行以下步骤:The processor, when executing the program stored on the memory, performs the following steps:
获得待写入SSD的待写入文件;Obtaining a file to be written to be written to the SSD;
通过所述SSD文件系统确定用于存储所述待写入文件的块,作为第一块;Determining, by the SSD file system, a block for storing the file to be written as a first block;
将所述待写入文件存储至所述第一块的块数据区,并获得所述待写入文件的文件存储信息,将所获得的文件存储信息存储至所述第一块的块索引区。And storing the file to be written into the block data area of the first block, and 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 .
第五方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质为电子设备中的存储介质,所述电子设备挂载有固态硬盘SSD,SSD具有SSD文件系统,所述SSD文件系统包括:系统索引区和数据区,所述系统索引区用于存储SSD信息和数据区信息,所述数据区被划分为大小相同的块,每一个块包括:块索引区和块数据区,一个块的块索引区用于记录该块的块数据区所存储文件的文件存储信息,所述计算机可读存储介质内存储有计算机程序,所述计算机程序被处理器执行以下步骤:In a fifth aspect, the embodiment of the present application provides a computer readable storage medium, which is a storage medium in an electronic device, where the electronic device is mounted with a solid state hard disk SSD, and the SSD has an SSD file system. The SSD file system includes: a system index area for storing SSD information and data area information, the data area is divided into blocks of the same size, each block includes: a block index area and a block data area, a block index area of one block for recording file storage information of a file stored in a block data area of the block, the computer readable storage medium storing therein a computer program, the computer program being executed by the processor :
获得待写入SSD的待写入文件;Obtaining a file to be written to be written to the SSD;
生成所述待写入文件的标识,并通过所述SSD文件系统确定用于存储所述待写入文件的块,作为第一块;Generating an identifier of the file to be written, and determining, by the SSD file system, a block for storing the file to be written as a first block;
将所述待写入文件存储至所述第一块的块数据区,并获得所述待写入文件的文件存储信息,将所获得的文件存储信息存储至所述第一块的块索引区。And storing the file to be written into the block data area of the first block, and 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 .
第六方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质为电子设备中的存储介质,所述电子设备挂载有固态硬盘SSD,SSD具有SSD文件系统,所述SSD文件系统包括:系统索引区和数据区,所述系统索引区用于存储SSD信息和数据区信息,所述数据区被划分为至少一个块,每一个块包括:块索引区和块数据区,一个块的块索引区用于记录该块的块数据区所存储文件的文件存储信息,所述计算机可读存储介质内存储有计算机程序,所述计算机程序被处理器执行以下步骤:In a sixth aspect, the embodiment of the present application provides a computer readable storage medium, which is a storage medium in an electronic device, where the electronic device is mounted with a solid state hard disk SSD, and the SSD has an SSD file system. The SSD file system includes: a system index area for storing SSD information and data area information, the data area is divided into at least one block, each block includes: a block index area and a block A data area, a block index area of a block for recording file storage information of a file stored in a block data area of the block, the computer readable storage medium storing a computer program, the computer program being executed by the processor as follows:
获得待写入SSD的待写入文件;Obtaining a file to be written to be written to the SSD;
通过所述SSD文件系统确定用于存储所述待写入文件的块,作为第一块;Determining, by the SSD file system, a block for storing the file to be written as a first block;
将所述待写入文件存储至所述第一块的块数据区,并获得所述待写入文件的文件存储信息,将所获得的文件存储信息存储至所述第一块的块索引区。And storing the file to be written into the block data area of the first block, and 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 .
由上述的技术方案可见,由于电子设备挂载有SSD时,SSD自身具有不同于操作系统自带文件系统的SSD文件系统,在电子设备获取待写入文件后,生成该文件的标识,并通过上述SSD文件系统确定用于存储待写入文件的块,直接将待写入文件存储至上述所确定的块中,可见,相比于现有技术,应用本申请实施例提供的方案实现文件存储时,是由SSD自身具有的文件系统确定文件的存储位置的,且所确定的存储位置为SSD文件系统中块数据区所包含的块,而无需确定待写入文件的存储路径,也就是无需基于存储路径写入待写入文件,从而提高了待写入文件的写入速度。It can be seen from the above technical solution that the SSD itself has an SSD file system different from the operating system's own file system when the electronic device is mounted with the SSD. After the electronic device obtains the file to be written, the identifier of the file is generated and passed. The above-mentioned SSD file system determines a block for storing a file to be written, and directly stores the file to be written into the above-mentioned determined block. It can be seen that the file storage is implemented by using the solution provided by the embodiment of the present application. When the file system of the SSD itself determines the storage location of the file, and the determined storage location is the block included in the block data area of the SSD file system, without determining the storage path of the file to be written, that is, no need The file to be written is written based on the storage path, thereby increasing the writing speed of the file to be written.
附图说明DRAWINGS
为了更清楚地说明本申请实施例和现有技术的技术方案,下面对实施例和现有技术中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present application and the technical solutions of the prior art, the following description of the embodiments and the drawings used in the prior art will be briefly introduced. Obviously, the drawings in the following description are only Some embodiments of the application may also be used to obtain other figures from those of ordinary skill in the art without departing from the scope of the invention.
图1为本申请实施例的SSD的区域划分示意图;1 is a schematic diagram of area division of an SSD according to an embodiment of the present application;
图2为本申请实施例提供的文件管理方法的一种流程示意图;2 is a schematic flowchart of a file management method according to an embodiment of the present application;
图3为本申请实施例的SSD的另一种区域划分示意图;FIG. 3 is a schematic diagram of another area division of an SSD according to an embodiment of the present application; FIG.
图4为本申请实施例提供的文件管理装置的一种结构示意图;FIG. 4 is a schematic structural diagram of a file management apparatus according to an embodiment of the present disclosure;
图5为本申请实施例提供的文件管理装置的另一种结构示意图;FIG. 5 is another schematic structural diagram of a file management apparatus according to an embodiment of the present application;
图6为本申请实施例提供的文件管理装置中判断模块的结构示意图;FIG. 6 is a schematic structural diagram of a determining module in a file management apparatus according to an embodiment of the present disclosure;
图7为本申请实施例提供的电子设备的结构示意图。FIG. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
具体实施方式Detailed ways
为使本申请的目的、技术方案、及优点更加清楚明白,以下参照附图并举实施例,对本申请进一步详细说明。显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the objects, technical solutions, and advantages of the present application more comprehensible, the present application will be further described in detail below with reference to the accompanying drawings. It is apparent that the described embodiments are only a part of the embodiments of the present application, and not all of them. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present application without departing from the inventive scope are the scope of the present application.
本申请实施例提供了一种文件管理方法,该文件管理方法应用于电子设备,上述电子设备可以是服务器,当然也可以是其它类型的电子设备。The embodiment of the present application provides a file management method, which is applied to an electronic device, and the electronic device may be a server, and may of course be other types of electronic devices.
上述电子设备挂载有SSD,具体的,可以仅仅挂载一个SSD,也可以挂载一个以上的SSD,电子设备所挂载的各SSD均具有SSD文件系统。其中SSD文件系统包括:系统索引区和数据区。The above-mentioned electronic device is mounted with an SSD. Specifically, only one SSD can be mounted, or more than one SSD can be mounted. Each SSD mounted on the electronic device has an SSD file system. The SSD file system includes: a system index area and a data area.
根据系统索引区所包括的索引区的类型,可以分为以下两种情况。第一种情况,系统索引区只包括系统主索引区。According to the type of the index area included in the system index area, the following two cases can be classified. In the first case, the system index area only includes the system main index area.
第二种情况,系统索引区包括系统主索引区和系统备索引区。系统备索引区用于存储系统主索引区的备份信息,利用系统备索引区所存储的备份信息可以对系统主索引区的数据进行恢复。其中,系统主索引区和系统备索引区在SSD中的位置可以自定义设定。例如,可以将系统主索引区和系统备索引区相邻设置,还可以将系统主索引区和系统备索引区间隔自定义长度进行设置。In the second case, the system index area includes the system primary index area and the system backup index area. The system backup index area is used to store the backup information of the system main index area, and the backup information stored in the system backup index area can be used to recover the data of the system main index area. The location of the system primary index area and the system backup index area in the SSD can be customized. For example, the system main index area and the system backup index area can be set adjacent to each other, and the system main index area and the system backup index area can be set to a custom length.
参考图1,其中系统主索引区和系统备索引区组成了系统索引区,Index用以表示系统主索引区,Bindex用以表示系统备索引区;块1、块2……块n组成了数据区。系统主索引区设置在SSD区域中的起始位置,系统备索引区设置在SSD区域中的结束位置,即可以认为,系统主索引区和系统备索引区在SSD区域中相距最远。这种情况下,当系统主索引区受损后,系统备索引区的影响较小,进而可以通过系统备索引区再对系统主索引区的数据进行恢复,提 高了SSD中所存储数据的安全性。Referring to FIG. 1, the system main index area and the system backup index area constitute a system index area, Index is used to represent the system main index area, Bindex is used to represent the system backup index area; block 1, block 2, ... block n constitute data Area. The system main index area is set at the start position in the SSD area, and the system backup index area is set at the end position in the SSD area. That is, the system main index area and the system backup index area are farthest apart in the SSD area. In this case, when the main index area of the system is damaged, the impact of the system backup index area is small, and the data in the system main index area can be restored through the system backup index area, thereby improving the security of the data stored in the SSD. Sex.
其中,上述系统索引区用于存储SSD信息和数据区信息;数据区被划分为至少一个块,其中,各块的大小可以相同,也可以不同,在此不作限定。每一个块包括:块索引区和块数据区。参考图1,其中i1、i2……in即为对应的块1、块2……块n的块索引区;D1、D2……Dn即为对应的块1、块2……块n的块数据区。The system index area is used to store the SSD information and the data area information; the data area is divided into at least one block, and the size of each block may be the same or different, and is not limited herein. Each block includes a block index area and a block data area. Referring to FIG. 1, wherein i1, i2, . . . in is the block index area of the corresponding block 1, block 2, ... block n; D1, D2, ..., Dn are the blocks of the corresponding block 1, block 2, ... block n Data area.
其中,块索引区可以根据所包括的索引区的类型,分为以下两种情况。第一种情况,块索引区只包括块主索引区。第二种情况,块索引区包括块主索引区和块备索引区。其中,块备索引区用于存储块主索引区的备份信息,利用块备索引区所存储的备份信息可以对块主索引区的数据进行恢复。The block index area may be classified into the following two cases according to the type of the index area included. In the first case, the block index area includes only the block main index area. In the second case, the block index area includes a block main index area and a block spare index area. The block backup index area is used to store the backup information of the block main index area, and the data stored in the block main index area can be restored by using the backup information stored in the block backup index area.
其中,块主索引区和块备索引区在块所在区域中的位置可以自定义设定。例如,可以将块主索引区和块备索引区相邻设置,还可以将块主索引区和块备索引区间隔自定义长度进行设置。The position of the block main index area and the block backup index area in the area where the block is located can be customized. For example, the block main index area and the block backup index area may be adjacent to each other, and the block main index area and the block backup index area may be set to a custom length.
参考图1,其中块主索引区和块备索引区组成了块索引区。块主索引区设置在块所在区域中的起始位置,块备索引区设置在块所在区域中的结束位置,即可以认为,块主索引区和块备索引区在块所在区域中相距最远。这种情况下,当块主索引区受损后,块备索引区的影响较小,进而可以通过块备索引区再对块主索引区的数据进行恢复,提高了SSD中每一个块所存储数据的安全性。Referring to FIG. 1, a block main index area and a block spare index area constitute a block index area. The block main index area is set at the start position in the area where the block is located, and the block backup index area is set at the end position in the area where the block is located, that is, the block main index area and the block backup index area are farthest apart in the block area. . In this case, when the primary index area of the block is damaged, the impact of the block backup index area is small, and the data of the block main index area can be restored by the block backup index area, thereby improving the storage of each block in the SSD. The security of the data.
一个块的块索引区用于记录该块的块数据区所存储文件的文件存储信息。The block index area of one block is used to record file storage information of files stored in the block data area of the block.
具体的,上述文件存储信息,可以包括所存储文件的文件ID(identity,身份标识号)、文件大小、文件位置偏移量、文件存储时间等信息中的至少一种。其中,上述文件位置偏移量可以理解为:文件在块中的起始存储位置相对于块的起始地址的偏移量。例如,块1存储有文件A,则块1的块索引区可以包含文件A的文件ID、文件大小、文件位置偏移量、文件存储时间;块2存储有文件B,则块2的块索引区可以包含文件B的文件ID、文件大小、文件位置偏移量、文件存储时间;块3存储有文件C,则块3的块索引区可以包含文件C的文件ID、文件大小、文件位置偏移量、文件存储时间。Specifically, the file storage information may include at least one of a file ID (identity, identification number), a file size, a file location offset, and a file storage time of the stored file. Wherein, the above file position offset can 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 file ID, file size, file position offset, and file storage time of file A; block 2 stores file B, and block index of block 2 The area may include the file ID of the file B, the file size, the file position offset, and the file storage time; if the file C is stored in the block 3, the block index area of the block 3 may include the file ID, the file size, and the file position of the file C. Shift, file storage time.
上述SSD信息,可以包括该SSD的ID、总存储容量、可用空间等信息中的至少一种。其中,SSD信息中的可用空间即为该SSD中的空余存储空间。The SSD information may include at least one of ID, total storage capacity, available space, and the like of the SSD. The available space in the SSD information is the free storage space in the SSD.
上述数据区信息,可以包括该数据区中各个块的大小、块的个数以及每个块的使用状态信息等信息中的至少一种。其中,上述块的使用状态信息可以理解为:用于表示块的当前使用状态的信息,从数据存储的角度来讲,块的当前使用状态可以划分为:未写入状态、已写入状态和写满状态。使用状态信息中所表示的块的当前使用状态并不仅限于以上三种状态,还可以包括其他状态,在此不做限定。The data area information may include at least one of a size of each block in the data area, a number of blocks, and usage status information of each block. The usage status information of the foregoing block can be understood as: information for indicating the current usage status of the block. From the perspective of data storage, the current usage status of the block can be divided into: an unwritten state, a written state, and Full status. The current state of use of the block in the state information is not limited to the above three states, and may include other states, which are not limited herein.
未写入状态可以理解为:还未存储有任何文件的状态。The unwritten state can be understood as the state in which no files have been stored.
写满状态可以理解为:已存储有文件且没有空余存储空间的状态。The full state can be understood as a state in which a file has been stored and there is no free storage space.
已写入状态可以理解为:已存储有文件但还存在空余存储空间的状态。The written state can be understood as a state in which a file has been stored but there is still free storage space.
综合以上可以看出,上述SSD信息中的SSD的ID、总存储容量以及数据区信息中的块大小、块的个数等信息在SSD存储文件的过程中是可以保持不变的,而SSD信息中的可用空间、数据区信息中的每个块的使用状态可能会随着文件的存储发生变化。因此,可以在对SSD进行格式化的过程中,对上述SSD信息以及数据区信息进行设定,其中,在格式化过程中所设定的SSD信息中的可用空间、数据区信息中的每个块的使用状态为初始值。In summary, it can be seen that the information 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 can be kept unchanged during the SSD storage file, and the SSD information The available space in the space, the usage status of each block in the data area information may change with the storage of the file. Therefore, the SSD information and the data area information can be set in the process of formatting the SSD, wherein each of the available space and the data area information in the SSD information set in the formatting process The usage status of the block is the initial value.
具体地,对具有上述SSD文件系统的SSD进行格式化的过程中,除了需要对SSD进行传统意义上的格式化外,还需要确定SSD文件系统中的系统索引区、数据区、数据区中每一块的块索引区和块数据区,设置系统索引区中存储的SSD信息和数据区信息。Specifically, in the process of formatting an SSD having the above SSD file system, in addition to formatting in the traditional sense of the SSD, it is necessary to determine each of the system index area, the data area, and the data area in the SSD file system. The block index area and the block data area of one block 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 may be preset.
SSD信息中的可用空间的初始值可以设置为SSD的总存储容量或者总的空余存储空间。The initial value of the available space in the SSD information can be set to the total storage capacity of the SSD or the total spare storage space.
由于格式化过程中数据区的每一块中还未存储文件,所以每一块的使用状态的初始值可以设置为:未写入状态。Since no file has been stored in each block of the data area during formatting, the initial value of the usage status of each block can be set to: unwritten state.
数据区信息中块的个数,具体可以通过以下方式计算得到:The number of blocks in the data area information can be calculated by the following methods:
将总存储空间与系统索引区的大小相减,获得差值;将所获得差值与预先设定的数据区中每个块的大小相除,并将相除后所得商作为数据区中块的个数。The total storage space is subtracted from the size of the system index area to obtain a difference; the obtained difference is divided by the size of each block in the preset data area, and the obtained quotient is divided into blocks in the data area. The number.
如图2所示,本申请实施例提供的文件管理方法,包括以下步骤:As shown in FIG. 2, the file management method provided by the embodiment of the present application includes the following steps:
S101,获得待写入SSD的待写入文件。S101. Obtain a file to be written to be written to the SSD.
本申请实施例中,待写入文件为待写入SSD中的文件,该文件可以包括:图片格式文件、文本格式文件、音频格式文件、视频格式文件等文件中的至少一种。容易理解的是,待写入文件的获得途径可以有多种,例如可以通过应用程序发送的文件写入请求获得;还可以主动地查找存储于云端数据库中的待写入文件。示例性地,如果某个图像处理应用程序向电子设备发送一个图片文件,则电子设备可以接收该文件,并将其作为待写入文件。In the embodiment of the present application, the file to be written is a file to be written into the SSD, and the file may include at least one of a picture format file, a text format file, an audio format file, and a video format file. It is easy to understand that the file to be written can be obtained in various ways, for example, by a file write request sent by the application; and the file to be written stored in the cloud database can be actively searched. Illustratively, if an image processing application sends a picture file to an electronic device, the electronic device can receive the file as a file to be written.
S102,生成待写入文件的标识,并通过SSD文件系统确定用于存储待写入文件的块,作为第一块。S102. Generate an identifier of the file to be written, and determine, by the SSD file system, a block for storing the file to be written as the first block.
当获得待写入文件后,电子设备可以生成一个该文件唯一的标识,以将该文件与其他文件进行区分。由前述内容可知,一个SSD的数据区可以被划分为多个块,因此可以通过该SSD文件系统,确定用于存储待写入文件的一个或多个块,并将所确定的块作为第一块。具体地,SSD文件系统可以为待写入文件分配一个数据区中的块,用以存储该待写入文件。其中,本申请中第一块的第一仅仅用来将一个块与其他的块分开来,而不表示这些块之间存在任何顺序或者优先级。After obtaining the file to be written, the electronic device can generate a unique identifier of the file to distinguish the file from other files. It can be seen from the foregoing that the data area of one SSD can be divided into multiple blocks, so that one or more blocks for storing the file to be written can be determined by the SSD file system, and the determined block is taken as the first Piece. Specifically, the SSD file system may allocate a block in a data area for the file to be written to store the file to be written. The first of the first block in this application is only used to separate one block from another, and does not indicate any order or priority between the blocks.
作为一种可选的实施方式,当一台电子设备挂载多个SSD时,电子设备可以通过各SSD系统索引区存储的SSD信息,如SSD的ID,选择其中一个或多个SSD用于存储待写入文件。其中,选择用于存储待写入文件的SSD的方式可以有多种:随机选择、根据待写入文件的格式等方式。示例性地,当一台电子设备挂载3个SSD时,3个SSD的ID分别为001A、002B和003C,电子设备可以随机选择ID为002B的SSD作为存储待写入文件的SSD,并通过该SSD的文件管理系统,分配一个数据区中的块用以存储待写入文件。或者还可以基于当前 待写入文件的格式,选择一个SSD作为存储待写入文件的SSD。As an optional implementation manner, when an electronic device mounts multiple SSDs, the electronic device may select one or more SSDs for storage by using SSD information stored in each SSD system index area, such as an SSD ID. The file to be written. The method for selecting an SSD for storing a file to be written may be various: randomly selected, according to a format of a file to be written, and the like. Exemplarily, when an electronic device mounts three SSDs, the IDs of the three SSDs are 001A, 002B, and 003C, respectively, and the electronic device can randomly select the SSD with the ID 002B as the SSD for storing the file to be written, and pass The file management system of the SSD allocates blocks in a data area for storing files to be written. Alternatively, an SSD may be selected as the SSD for storing the file to be written based on the format of the file to be currently written.
由于所获得的文件可以具有不同的大小,因此,SSD文件系统所分配的第一块可以为一个,也可以为多个。也就是,当一个文件的大小大于数据区中一个块的大小时,则可以为该文件分配多个块用于存储该文件。例如,一个文件的大小为80MB,一个块的大小为64MB,则文件管理系统可以分配2个块用于存储该文件。Since the obtained files can have different sizes, the first block allocated by the SSD file system may be one or more. That is, when the size of one file is larger than the size of one block in the data area, a plurality of blocks can be allocated for the file for storing the file. For example, if a file has a size of 80MB and a block has a size of 64MB, the file management system can allocate 2 blocks for storing the file.
S103,将待写入文件存储至第一块的块数据区,并获得待写入文件的文件存储信息,将所获得的文件存储信息存储至第一块的块索引区。S103. Store the file to be written into the block data area of the first block, and obtain file storage information of the file to be written, and store the obtained file storage information into the block index area of the first block.
本申请实施例中,当为待写入文件分配第一块后,表明已经做好存储该待写入文件的准备,便可以将该待写入文件存储至第一块的块数据区中。待写入文件被存储后,电子设备可以获取该待写入文件的诸如文件ID、文件大小、文件位置偏移量、文件存储时间等文件存储信息,并将这些信息存储至第一块的块索引区。通过将该待写入文件的文件存储信息存储至块索引区,能够在存储该待写入文件的块中建立该待写入文件的索引信息,便于往后查看该待写入文件的存储情况,提高本申请实施例的文件管理方法的使用便利性。In the embodiment of the present application, after the first block is allocated for the file to be written, indicating that the preparation for storing the file to be written is ready, the file to be written may be stored in the block data area of the first block. After the file to be written is stored, the electronic device can acquire file storage information such as a file ID, a file size, a file position offset, a file storage time, and the like, and store the information in the block of the first block. Index area. By storing the file storage information of the file to be written in the block index area, the index information of the file to be written can be established in the block storing the file to be written, so as to conveniently view the storage condition of the file to be written later. The use convenience of the file management method of the embodiment of the present application is improved.
可选地,还可将多个分配至第一块的待写入文件按顺序存储至第一块的块数据区,从而能够利用SSD的顺序写入性能优势,加快对多个文件的存储速度,提升文件存储效率。Optionally, a plurality of files to be written allocated to the first block may be sequentially stored to the block data area of the first block, thereby being able to utilize the sequential write performance advantage of the SSD to speed up storage of multiple files. Improve file storage efficiency.
作为本申请实施例一种可选的实施方式,在获取已被存储的待写入文件的文件存储信息后,本申请实施例还可以生成该待写入文件对应的文件存储位置信息。文件存储位置信息中通常包括该待写入文件的文件存储信息、第一块的块信息以及第一块所属SSD的SSD信息,文件存储位置信息还可以包括除以上三种信息以外的其他信息,在此不作限定。第一块的块信息可以包含第一块的多种属性信息,例如第一块的当前使用状态、第一块在数据区中的块号等。文件存储位置信息可以包括:该待写入文件的文件ID、该待写入文件的大小、该待写入文件的位置偏移量、该待写入文件所在SSD的ID、第一块的块号等信息中的至少一种。As an optional implementation manner of the embodiment of the present application, after acquiring the file storage information of the file to be written, the embodiment of the present application may further generate file storage location information corresponding to the file to be written. The file storage location information generally includes file storage information of the file to be written, block information of the first block, and SSD information of the SSD to which the first block belongs, and the file storage location information may further include other information than the above three types of information. This is not limited here. The block information of the first block may contain various attribute information of the first block, such as the current use state of the first block, the block number of the first block in the data area, and the like. The file storage location information may include: a file ID of the file to be written, a size of the file to be written, a position offset of the file to be written, an ID of the SSD where the file to be written is located, and a block of the first block. At least one of the information such as the number.
在上述实施方式的基础上,在待写入文件存储至SSD后,还可以向发送文件写入请求的应用程序反馈文件存储位置信息,从而使应用程序的使用者获知待写入文件已被存储至SSD,同时还能够获知该待写入文件的存储位置、文件ID等信息,便于用户日后查找该待写入文件。示例性地,可以以URL(Uniform Resource Locator,统一资源定位器)的形式向发送文件写入请求的应用程序反馈该文件存储位置信息,该URL地址中可以包含例如SSD的ID、文件所在块的信息(例如第一块的块号)、文件位置偏移量、文件大小、文件ID等信息中的至少一种。On the basis of the foregoing embodiment, after the file to be written is stored in the SSD, the application may be fed back to the file to which the file is written, and the file storage location information may be sent, so that the user of the application knows that the file to be written has been stored. To the SSD, the storage location, the file ID, and the like of the file to be written can also be known, so that the user can find the file to be written in the future. Exemplarily, the file storage location information may be fed back to the application that sends the file write request in the form of a URL (Uniform Resource Locator), where the URL address may include, for example, the ID of the SSD and the block where the file is located. At least one of information (for example, a block number of the first block), a file position offset, a file size, a file ID, and the like.
作为本申请实施例一种可选的实施方式,数据区信息还可以包括各个块的使用状态。每一个块的使用状态可以为未写入状态、已写入状态和写满状态等状态中的任一种。未写入状态表明块中的数据为空,可以写入数据。已写入状态表明块中存储有数据,仍可以再写入数据。写满状态表明块中存储的数据已满,无法再写入数据。在待写入文件存储至第一块后,第一块的状态可能会发生改变,因此需要结合第一块在存储待写入文件前后的使用状态,对第一块的使用状态进行更新,从而使得正确地存储第一块所处的使用状态。As an optional implementation manner of the embodiment of the present application, the data area information may further include a usage status of each block. The usage state of each block may be any one of a state of an unwritten state, a written state, and a full state. The unwritten state indicates that the data in the block is empty and data can be written. The written status indicates that data is stored in the block and the data can still be written. The full state indicates that the data stored in the block is full and 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. Therefore, it is required to update the use state of the first block in combination with the use state of the first block before and after storing the file to be written, thereby This makes it possible to correctly store the usage state in which the first block is located.
当待写入文件存储至第一块后,可能存在两种情况,情况一,第一块处于写满状态;情况二,第一块处于未写满状态。根据上述两种情况,可以先判断第一块的使用状态是否为写满状态,再根据判断结果采用不同的方式对第一块的使用状态进行更新。When the file to be written is stored in the first block, there may be two cases. In the first case, the first block is in the full state; in the second case, the first block is in the unfilled state. According to the above two situations, it may be determined whether the usage state of the first block is a full state, and then the usage state of the first block is updated in a different manner according to the determination result.
可选地,更新过程的一种实现方式可以为,如果第一块的当前使用状态为写满状态,则可以将数据区信息中记录的第一块的使用状态更新为写满状态。如果第一块的当前使用状态为未写满状态,且在写入前状态为未写入状态时,表明待写入文件存储至第一块的块数据区之前,第一块的使用状态为还未存储数据,若在存储待写入文件后第一块仍存在空余存储空间,则可以将数据区信息中记录的第一块的使用状态更新为已写入状态;若在存储待写入文件后第一块没有空余存储空间,则可以将数据区信息中记录的第一块的使用状态更新为写满状态。Optionally, an implementation manner of the update process may be: if the current usage status of the first block is a full state, the usage status of the first block recorded in the data area information may be updated to a full state. If the current use state of the first block is an unfilled state, and the state before the write is an unwritten state, indicating that the file to be written is stored in the block data area of the first block, the use state of the first block is The data has not been stored yet. If there is still free storage space in the first block after storing the file to be written, the usage status of the first block recorded in the data area information may be updated to the written state; if the storage is to be written After the first block of the file has no free storage space, the usage status of the first block recorded in the data area information can be updated to the full state.
另外,当第一块的当前使用状态为未写满状态,而上述写入前状态为已写入状态,说明待写入文件存储至第一块的块数据区之前,第一块已存储有 文件,第一块的使用状态为已写入状态,而存储待写入文件后,第一块仍然还存在空余空间,这种情况下,第一块的使用状态保持不变,依然为已写入状态。In addition, when the current use state of the first block is the unfilled state, and the pre-write state is the written state, the first block has been stored before the file to be written is stored in the block data area of the first block. File, the first block is in the written state, and after storing the file to be written, there is still free space in the first block. In this case, the usage state of the first block remains unchanged and remains written. Into the state.
作为本申请实施例一种可选的实施方式,如图3所示,系统索引区可以仅仅由一部分构成,此时,系统索引区仅包括系统主索引区。也就是,系统索引区中直接存储了SSD信息和数据区信息,此时的系统索引区即可以为图1中的系统主索引区。As an optional implementation manner of the embodiment of the present application, as shown in FIG. 3, the system index area may be composed only of a part. In this case, the system index area includes only the system main index area. That is, the SSD information and the data area information are directly stored in the system index area, and the system index area at this time may be the system main index area in FIG.
与上述实施方式相对应,作为本申请实施例另一种可选的实施方式,如图1所示,系统索引区可以由两部分构成,也就是系统索引区可以分为:系统主索引区和系统备索引区。其中,系统主索引区,用于存储SSD信息和数据区信息;系统备索引区,用于存储系统主索引区的备份信息,也就是,系统备索引区作为系统主索引区的备份,也用于存储SSD信息和数据区信息。本申请实施例的系统备索引区,由于存储有系统主索引区的备份信息,因此可以在系统主索引区出现故障时,通过系统备索引区中的备份信息对系统主索引区中的数据进行恢复,从而提高SSD的数据安全性。Corresponding to the foregoing embodiment, as another optional implementation manner of the embodiment of the present application, as shown in FIG. 1, 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 The system is in the index area. The system primary index area is used for storing SSD information and data area information; the system backup index area is used for storing backup information of the system main index area, that is, the system backup 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. In the system backup index area of the embodiment of the present application, since the backup information of the system main index area is stored, when the system main index area fails, the data in the system main index area can be performed through the backup information in the system backup index area. Restore, thereby improving the data security of the SSD.
作为本申请实施例一种可选的实施方式,一个块的块索引区可以仅仅由一部分构成,此时,块索引区仅包括块主索引区。也就是,一个块的块索引区中直接记录该块的块数据区所存储文件的文件存储信息,此时的块索引区即可以为图1中的块主索引区。As an optional implementation manner of the embodiment of the present application, the block index area of one block may be composed only of a part. In this case, the block index area includes only the block main index area. That is, the file storage information of the file stored in the block data area of the block is directly recorded in the block index area of one block, and the block index area at this time may be the block main index area in FIG.
与上述实施方式相对应,作为本申请实施例另一种可选的实施方式,一个块的块索引区可以由两部分构成,也就是块索引区可以分为:该块的块主索引区和该块的块备索引区。其中,块主索引区用于记录该块的块数据区所存储文件的文件存储信息;块备索引区,用于存储该块的块主索引区的备份信息,也就是,块备索引区作为块主索引区的备份,也用于记录块的数据区所存储文件的文件存储信息,参考图1,其中Bi1、Bi2……Bin即为对应的块1、块2……块n的块备索引区,其中,n为正整数。本申请实施例的块备份索引区,由于存储有该块的块主索引区的备份信息,因此可以在块主索引区损坏时,通过块备份索引区的备份信息对块主索引区中的数据进行恢复,从而提高SSD的数据安全性。Corresponding to the above embodiment, as another optional implementation manner of the embodiment of the present application, 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 main index area of the block and The block is indexed by the block. The block main index area is used to record file storage information of a file stored in the block data area of the block; the block backup index area is used to store backup information of the block main index area of the block, that is, the block backup index area is used as The backup of the main index area of the block is also used to record the file storage information of the file stored in the data area of the block. Referring to FIG. 1, Bi1, Bi2, ..., Bin are the corresponding block 1, block 2, block n The index area, where n is a positive integer. In the block backup index area of the embodiment of the present application, since the backup information of the block main index area of the block is stored, the data in the main index area of the block may be backed up by the backup information of the block backup index area when the block main index area is damaged. Restore to improve the data security of the SSD.
作为本申请实施例一种可选的实施方式,还可以读取SSD中的文件数据,可以将需要读取的文件数据称为待读取文件。As an optional implementation manner of the embodiment of the present application, the file data in the SSD can also be read, and the file data to be read can be referred to as a file to be read.
可选地,可以利用所生成的文件存储位置信息读取SSD中的待读取文件。Optionally, the file to be read in the SSD may be read by using the generated file storage location information.
在需要从SSD中读取待读取文件的情况下,可以通过该文件存储位置信息中的SSD的ID,先确定待读取文件所在的SSD,再通过该文件所在的块的块号,在SSD中定位待读取文件所在的块;进而通过文件存储位置信息中,该文件的大小和该文件的位置偏移量,在所定位的块的块数据区中,读取待读取的文件。In the case that the file to be read is to be read from the SSD, the SSD of the file to be read may be determined by the ID of the SSD in the file location information, and then the block number of the block in which the file is located may be Positioning the block where the file to be read is located in the SSD; and further reading the file to be read in the block data area of the located block by the size of the file and the position offset of the file in the file storage location information .
以待读取文件为上述实施方式中的待写入文件为例进行说明。The file to be read is taken as an example of the file to be written in the above embodiment.
如上文所述,待写入文件写入SSD后,会生成一个与该文件对应的文件存储位置信息,其中,该文件存储位置信息中包含相应的SSD信息以及块信息,具体可以记录该文件所在SSD的ID、第一块的块号等信息。通过上述信息,能够在SSD中,定位用于存储该待写入文件的块。如上文所述,文件存储位置信息中还可以包含文件存储信息,其中,文件存储信息中可以记录有该文件的文件ID、该文件的大小、该文件的位置偏移量等信息,因此,可以通过文件存储位置信息中记录的文件存储信息,从上述定位到的块中读取待写入文件。As described above, after the file to be written is written into the SSD, a file storage location information corresponding to the file is generated, where the file storage location information includes corresponding SSD information and block information, and the file may be recorded. Information such as the ID of the SSD, the block number of the first block, and the like. With the above information, it is possible to locate a block for storing the file to be written in the SSD. As described above, the file storage location information may further include file storage information, wherein the file storage information may record information such as a file ID of the file, a size of the file, a position offset of the file, and the like, and thus, The file to be written is read from the above-located block by the file storage information recorded in the file storage location information.
本申请实施例在读取SSD中的文件时,可以直接通过与该文件对应的文件存储位置信息中的SSD信息以及块信息,定位待读取文件所在的块,再通过文件存储位置信息中记录的文件存储信息,从定位到的块中读取待读取文件,无需基于文件存储路径读取文件,从而提高文件的读取速度。When reading the file in the SSD, the embodiment of the present application can directly locate the block where the file to be read is located through the SSD information and the block information in the file storage location information corresponding to the file, and then record the location information in the file storage location. The file storage information reads the file to be read from the located block, and does not need to read the file based on the file storage path, thereby improving the reading speed of the file.
在前述实施例中,当一个文件的大小大于数据区中一个块的大小时,则可以为该文件分配多个块用于存储该文件。相应地,在读取该文件时,同样可能存在定位到一个以上块的情况。In the foregoing embodiment, when the size of one file is larger than the size of one block in the data area, a plurality of blocks may be allocated for the file for storing the file. Accordingly, when reading the file, there may also be cases where more than one block is located.
作为本申请实施例一种可选的实施方式,当定位到一个以上块时,本申请实施例在读取待读取文件时,还可以根据所获得文件存储位置信息中记录的文件存储信息,分别从定位到的各个块中读取属于待读取文件的数据,并可以对读取到的数据进行合并处理,获得待读取文件。As an optional implementation manner of the embodiment of the present application, when the file to be read is read, the embodiment of the present application may further store the information according to the file recorded in the obtained file storage location information. The data belonging to the file to be read is read from each of the located blocks, and the read data can be combined to obtain the file to be read.
例如,SSD中包括6个块,分别为:块1、块2、块3、块4、块5和块6,其 中,所定位到的存储待读取文件的块包括块1、块2和块3,其中,块1中存储待读取文件的第一部分,块2中存储待读取文件的第二部分,块3中存储待读取文件的第三部分,第一部分、第二部分和第三部分合起来构成该待读取文件。在定位到SSD中用于存储该待读取文件的块为块1、块2和块3之后,可以从文件存储位置信息中记录的文件存储信息,其中,所获取到的文件存储信息中指示出第一部分在块1中的存储位置、第二部分在块2中的存储位置以及第三部分在块3中的存储位置。根据该文件存储信息可以从块1中读取到待读取文件的第一部分,从块2中读取到待读取文件的第二部分,从块3中读取到待读取文件的第三部分,在读取到第一部分、第二部分和第三部分之后,将第一部分、第二部分和第三部分进行合并处理,即可以得到该待读取文件。For example, the SSD includes six blocks, namely: block 1, block 2, block 3, block 4, block 5, and block 6, wherein the located block storing the file to be read includes block 1, block 2, and Block 3, wherein block 1 stores a first portion of the file to be read, block 2 stores a second portion of the file to be read, and block 3 stores a third portion of the file to be read, the first portion, the second portion, and The third part combines to form the file to be read. After the block for storing the file to be read in the SSD is the block 1, the block 2, and the block 3, the file may be stored from the file stored in the file storage location information, wherein the obtained file storage information indicates The storage location of the first portion in block 1, the storage location of the second portion in block 2, and the storage location of the third portion in block 3 are derived. According to the file storage information, the first part of the file to be read can be read from the block 1, the second part of the file to be read is read from the block 2, and the file to be read is read from the block 3. In the three parts, after the first part, the second part and the third part are read, the first part, the second part and the third part are combined to obtain the file to be read.
本申请实施例提供的文件管理方法,由于电子设备挂载有SSD时,SSD自身具有不同于操作系统自带文件系统的SSD文件系统,在电子设备获取待写入文件后,生成该文件的标识,并通过上述SSD文件系统确定用于存储待写入文件的块,直接将待写入文件存储至上述所确定的块中,可见,相比于现有技术,应用本申请实施例提供的方案实现文件存储时,是由SSD自身具有的文件系统确定文件的存储位置的,且所确定的存储位置为SSD文件系统中块数据区所包含的块,而无需确定待写入文件的存储路径,也就是无需基于存储路径写入待写入文件,从而提高了待写入文件的写入速度。In the file management method provided by the embodiment of the present application, the SSD itself has an SSD file system different from the operating system's own file system when the electronic device is mounted with the SSD, and the identifier of the file is generated after the electronic device acquires the file to be written. And determining, by using the foregoing SSD file system, a block for storing a file to be written, and directly storing the file to be written into the determined block, as shown in the prior art, applying the solution provided by the embodiment of the present application. When the file storage is implemented, the storage location of the file is determined by the file system owned by the SSD, and the determined storage location is a block included in the block data area in the SSD file system, without determining the storage path of the file to be written. That is, it is not necessary to write a file to be written based on the storage path, thereby increasing the writing speed of the file to be written.
相应于上面的方法实施例,本申请实施例还提供了相应的装置实施例。Corresponding to the above method embodiment, the embodiment of the present application also provides a corresponding device embodiment.
如图4所示,本申请实施例提供了一种文件管理装置,该装置挂载有固态硬盘SSD,SSD具有SSD文件系统,其中SSD文件系统包括:系统索引区和数据区,系统索引区用于存储SSD信息和数据区信息,数据区被划分为至少一个块,每一个块包括:块索引区和块数据区,一个块的块索引区用于记录该块的块数据区所存储文件的文件存储信息,该装置包括:As shown in FIG. 4, the embodiment of the present application provides a file management apparatus, which is mounted with a solid state hard disk SSD, and the SSD has an SSD file system, wherein the SSD file system includes: a system index area and a data area, and the system index area is used. For storing SSD information and data area information, the data area is divided into at least one block, each block includes: a block index area and a block data area, and a block index area of one block is used to record a file stored in the block data area of the block. The file stores information, and the device includes:
获取模块201,用于获得待写入SSD的待写入文件。The obtaining module 201 is configured to obtain a file to be written to be written into the SSD.
确定模块202,用于通过所述SSD文件系统确定用于存储所述待写入文件的块,作为第一块。The determining module 202 is configured to determine, by the SSD file system, a block for storing the file to be written as the first block.
存储模块203,用于将所述待写入文件存储至所述第一块的块数据区,并获得所述待写入文件的文件存储信息,将所获得的文件存储信息存储至所述第一块的块索引区。a storage module 203, configured to store the file to be written into a block data area of the first block, obtain file storage information of the file to be written, and store the obtained file storage information to the first A block index area of a block.
可选地,所述数据区被划分所得到的块大小相同;所述确定模块202具体用于:Optionally, the data area is divided into the same block size; the determining module 202 is specifically configured to:
生成所述待写入文件的标识,并通过所述SSD文件系统确定用于存储所述待写入文件的块,作为第一块。Generating an identifier of the file to be written, and determining, by the SSD file system, a block for storing the file to be written as the first block.
本申请实施例提供的文件管理装置,由于电子设备挂载有SSD时,SSD自身具有不同于操作系统自带文件系统的SSD文件系统,在电子设备获取待写入文件后,生成该文件的标识,并通过上述SSD文件系统确定用于存储待写入文件的块,直接将待写入文件存储至上述所确定的块中,可见,相比于现有技术,应用本申请实施例提供的方案实现文件存储时,是由SSD自身具有的文件系统确定文件的存储位置的,且所确定的存储位置为SSD文件系统中块数据区所包含的块,而无需确定待写入文件的存储路径,也就是无需基于存储路径写入待写入文件,从而提高了待写入文件的写入速度。In the file management apparatus provided by the embodiment of the present application, when the electronic device is mounted with the SSD, the SSD itself has an SSD file system different from the operating system's own file system, and after the electronic device acquires the file to be written, the identifier of the file is generated. And determining, by using the foregoing SSD file system, a block for storing a file to be written, and directly storing the file to be written into the determined block, as shown in the prior art, applying the solution provided by the embodiment of the present application. When the file storage is implemented, the storage location of the file is determined by the file system owned by the SSD, and the determined storage location is a block included in the block data area in the SSD file system, without determining the storage path of the file to be written. That is, it is not necessary to write a file to be written based on the storage path, thereby increasing the writing speed of the file to be written.
如图5所示,作为本申请实施例一种可选的实施方式,在上述装置实施例的基础上,本申请实施例的文件管理装置还可以包括:As shown in FIG. 5, as an optional implementation manner of the embodiment of the present application, the file management apparatus in the embodiment of the present application may further include:
生成模块204,用于根据所述待写入文件的文件存储信息、所述第一块的块信息以及所述第一块所属SSD的SSD信息,生成所述待写入文件的文件存储位置信息。a generating module 204, configured to generate, according to the file storage information of the file to be written, the block information of the first block, and the SSD information of the SSD to which the first block belongs, file storage location information of the file to be written .
可选地,数据区信息可以包括:各个块的使用状态;Optionally, the data area information may include: a usage status of each block;
本申请实施例的文件管理装置还包括:The file management apparatus of the embodiment of the present application further includes:
判断模块205,用于判断第一块的当前使用状态是否为写满状态。The determining module 205 is configured to determine whether the current use state of the first block is a full state.
可选地,系统索引区包括:系统主索引区和系统备索引区;Optionally, the system index area includes: a system primary index area and a system backup index area;
系统主索引区,用于存储SSD信息和数据区信息;a system main index area for storing SSD information and data area information;
系统备索引区,用于存储系统主索引区的备份信息。The system backup index area is used to store backup information of the system's main index area.
可选地,一个块的块索引区包括:该块的块主索引区和该块的块备索引区;一个块的块主索引区,用于记录该块的块数据区所存储文件的文件存储信息;一个块的块备索引区,用于存储该块的块主索引区的备份信息。Optionally, the block index area of one block includes: a block main index area of the block and a block backup index area of the block; a block main index area of one block, used to record a file of the file stored in the block data area of the block Storage information; a block backup index area of a block for storing backup information of the block main index area of the block.
可选地,本申请实施例的文件管理装置还包括:Optionally, the file management apparatus of the embodiment of the present application further includes:
读取模块206,用于获得待从SSD读取的待读取文件的文件存储位置信息;根据所获得文件存储位置信息中记录的SSD信息以及块信息,定位SSD中用于存储待读取文件的块;根据所获得文件存储位置信息中记录的文件存储信息,从定位到的块中读取所述待读取文件。The reading module 206 is configured to obtain file storage location information of the file to be read to be read from the SSD; and locate the file to be read in the SSD according to the SSD information and the block information recorded in the obtained file storage location information. a block; the file to be read is read from the located block according to the file storage information recorded in the obtained file storage location information.
可选地,当定位到一个以上块时,上述读取模块206具体可以用于:Optionally, when the one or more blocks are located, the foregoing reading module 206 may be specifically configured to:
根据所获得文件存储位置信息中记录的文件存储信息,分别从定位到的各个块中读取属于待读取文件的数据;对读取到的数据进行合并处理,获得所述待读取文件:And according to the file storage information recorded in the obtained file storage location information, the data belonging to the file to be read is respectively read from the located blocks; the read data is merged to obtain the file to be read:
可选地,如图6所示,判断模块205还包括:Optionally, as shown in FIG. 6, the determining module 205 further includes:
第一更新子模块2051,用于判断模块205判断为是时,将数据区信息中记录的第一块的使用状态更新为写满状态。The first update submodule 2051 is configured to update the usage status of the first block recorded in the data area information to the full state when the determination module 205 determines YES.
第二更新子模块2052,用于判断模块205判断为否时,在写入前状态为未写入状态时,将数据区信息中记录的第一块的使用状态更新为已写入状态,其中,写入前状态为:将待写入文件存储至第一块的块数据区之前第一块的使用状态。The second update sub-module 2052 is configured to: when the determining module 205 determines to be no, update the usage status of the first block recorded in the data area information to the written state when the pre-write state is the unwritten state, where The pre-write state is: the usage state of the first block before storing the file to be written to the block data area of the first block.
本申请实施例提供的文件管理装置,通过生成模块204,能够生成文件存储位置信息,便于用户日后查找该文件;通过系统备索引区,可以在系统主索引区损坏时,通过系统备索引区中的备份信息对系统主索引区中的数据进行恢复,从而保障SSD的数据安全性;通过块备索引区,能够在块主索引区损坏时,通过块备份索引区的备份信息对块主索引区中的数据进行恢复,从而保障SSD的数据安全性。The file management apparatus provided by the embodiment of the present invention can generate file storage location information through the generation module 204, so that the user can find the file later; and the system backup index area can be used in the system backup index area when the system primary index area is damaged. The backup information is used to restore the data in the main index area of the system, thereby ensuring the data security of the SSD; through the block backup index area, when the block main index area is damaged, the backup information of the block backup index area is used to block the main index area of the block. The data in the data is restored to ensure the data security of the SSD.
本申请实施例还提供了一种电子设备,如图7所示,电子设备包括处理器301、通信接口302、存储器303和通信总线304,其中,处理器301,通信接口302,存储器303通过通信总线304完成相互间的通信,The embodiment of the present application further provides an electronic device. As shown in FIG. 7, the electronic device includes a processor 301, a communication interface 302, a memory 303, and a communication bus 304. The processor 301, the communication interface 302, and the memory 303 communicate. Bus 304 completes communication with each other,
存储器303,用于存放计算机程序;a memory 303, configured to store a computer program;
处理器301,用于执行存储器303上所存放的程序时,实现如上述图2实施例及上述其它方法实施例所述的文件管理方法的如下步骤:The processor 301 is configured to implement the following steps of the file management method according to the foregoing embodiment of FIG. 2 and the foregoing method embodiments when executing the program stored in the memory 303:
获得待写入SSD的待写入文件;Obtaining a file to be written to be written to the SSD;
生成待写入文件的标识,并通过SSD文件系统确定用于存储待写入文件的块,作为第一块;Generating an identifier of the file to be written, and determining, by the SSD file system, a block for storing the file to be written as the first block;
将待写入文件存储至第一块的块数据区,并获得待写入文件的文件存储信息,将所获得的文件存储信息存储至第一块的块索引区。The file to be written is stored in the block data area of the first block, and the file storage information of the file to be written is obtained, and the obtained file storage information is stored in the block index area of the first block.
本申请实施例提供的电子设备,由于电子设备挂载有SSD时,SSD自身具有不同于操作系统自带文件系统的SSD文件系统,在电子设备获取待写入文件后,生成该文件的标识,并通过上述SSD文件系统确定用于存储待写入文件的块,直接将待写入文件存储至上述所确定的块中,可见,相比于现有技术,应用本申请实施例提供的方案实现文件存储时,是由SSD自身具有的文件系统确定文件的存储位置的,且所确定的存储位置为SSD文件系统中块数据区所包含的块,而无需确定待写入文件的存储路径,也就是无需基于存储路径写入待写入文件,从而提高了待写入文件的写入速度。The electronic device provided by the embodiment of the present application, when the electronic device is mounted with the SSD, the SSD itself has an SSD file system different from the operating system's own file system, and after the electronic device acquires the file to be written, the identifier of the file is generated. And determining, by using the foregoing SSD file system, the block for storing the file to be written, and directly storing the file to be written into the determined block, as shown in the prior art, applying the solution provided by the embodiment of the present application. When the file is stored, the file system of the SSD itself determines the storage location of the file, and the determined storage location is the block included in the block data area of the SSD file system, without determining the storage path of the file to be written, That is, it is not necessary to write a file to be written based on the storage path, thereby increasing the writing speed of the file to be written.
本申请实施例还提供了一种电子设备,电子设备包括处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过通信总线完成相互间的通信,The embodiment of the present application further provides an electronic device, where the electronic device includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete communication with each other through the communication bus.
存储器,用于存放计算机程序;a memory for storing a computer program;
处理器,用于执行存储器上所存放的程序时,实现如上述图2实施例及上述其它方法实施例所述的文件管理方法的如下步骤:The processor, when used to execute the program stored in the memory, implements the following steps of the file management method as described in the foregoing embodiment of FIG. 2 and the other method embodiments:
获得待写入SSD的待写入文件;Obtaining a file to be written to be written to the SSD;
通过SSD文件系统确定用于存储待写入文件的块,作为第一块;Determining, by the SSD file system, a block for storing a file to be written as the first block;
将待写入文件存储至第一块的块数据区,并获得待写入文件的文件存储信息,将所获得的文件存储信息存储至第一块的块索引区。The file to be written is stored in the block data area of the first block, and the file storage information of the file to be written is obtained, and the obtained file storage information is stored in the block index area of the first block.
上述电子设备提到的通信总线可以是外设部件互连标准(Peripheral Component Interconnect,简称PCI)总线或扩展工业标准结构(Extended Industry Standard Architecture,简称EISA)总线等。该通信总线可以分为地址总线、数据总线、控制总线等。为便于表示,图中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The communication bus mentioned in the above electronic device may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The communication bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only one thick line is shown in the figure, but it does not mean that there is only one bus or one type of bus.
通信接口用于上述电子设备与其他设备之间的通信。The communication interface is used for communication between the above electronic device and other devices.
存储器可以包括随机存取存储器(Random Access Memory,简称RAM),也可以包括非易失性存储器(non-volatile memory),例如至少一个磁盘存储器。可选的,存储器还可以是至少一个位于远离前述处理器的存储装置。The memory may include a random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
上述的处理器可以是通用处理器,包括中央处理器(Central Processing Unit,简称CPU)、网络处理器(Network Processor,简称NP)等;还可以是数字信号处理器(Digital Signal Processing,简称DSP)、专用集成电路(Application Specific Integrated Circuit,简称ASIC)、现场可编程门阵列(Field-Programmable Gate Array,简称FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。The above processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (Network Processor, NP for short), or a digital signal processor (DSP). , Application Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware component.
本申请实施例还提供了一种计算机可读存储介质,计算机可读存储介质内存储有计算机程序,用以实现如上述图2实施例及上述其它方法实施例所述的文件管理方法的如下步骤:The embodiment of the present application further provides a computer readable storage medium. The computer readable storage medium stores a computer program for implementing the following steps of the file management method according to the foregoing embodiment of FIG. 2 and the foregoing other method embodiments. :
获得待写入SSD的待写入文件;Obtaining a file to be written to be written to the SSD;
生成待写入文件的标识,并通过SSD文件系统确定用于存储待写入文件的块,作为第一块;Generating an identifier of the file to be written, and determining, by the SSD file system, a block for storing the file to be written as the first block;
将待写入文件存储至第一块的块数据区,并获得待写入文件的文件存储信息,将所获得的文件存储信息存储至第一块的块索引区。The file to be written is stored in the block data area of the first block, and the file storage information of the file to be written is obtained, and the obtained file storage information is stored in the block index area of the first block.
本申请实施例提供的计算机可读存储介质,由于电子设备挂载有SSD时,SSD自身具有不同于操作系统自带文件系统的SSD文件系统,在电子设备获取 待写入文件后,生成该文件的标识,并通过上述SSD文件系统确定用于存储待写入文件的块,直接将待写入文件存储至上述所确定的块中,可见,相比于现有技术,应用本申请实施例提供的方案实现文件存储时,是由SSD自身具有的文件系统确定文件的存储位置的,且所确定的存储位置为SSD文件系统中块数据区所包含的块,而无需确定待写入文件的存储路径,也就是无需基于存储路径写入待写入文件,从而提高了待写入文件的写入速度。The computer-readable storage medium provided by the embodiment of the present invention, when the electronic device is mounted with the SSD, the SSD itself has an SSD file system different from the operating system's own file system, and the electronic device generates the file after the electronic device acquires the file to be written. And the foregoing SSD file system determines the block for storing the file to be written, and directly stores the file to be written into the determined block, as shown in the embodiment of the present application. When the file is implemented, the storage location of the file is determined by the file system owned by the SSD, and the determined storage location is the block included in the block data area in the SSD file system, without determining the storage of the file to be written. The path, that is, the need to write the file to be written based on the storage path, thereby increasing the writing speed of the file to be written.
本申请实施例还提供了一种计算机可读存储介质,计算机可读存储介质内存储有计算机程序,用以实现如上述图2实施例及上述其它方法实施例所述的文件管理方法的如下步骤:The embodiment of the present application further provides a computer readable storage medium. The computer readable storage medium stores a computer program for implementing the following steps of the file management method according to the foregoing embodiment of FIG. 2 and the foregoing other method embodiments. :
获得待写入SSD的待写入文件;Obtaining a file to be written to be written to the SSD;
通过SSD文件系统确定用于存储待写入文件的块,作为第一块;Determining, by the SSD file system, a block for storing a file to be written as the first block;
将待写入文件存储至第一块的块数据区,并获得待写入文件的文件存储信息,将所获得的文件存储信息存储至第一块的块索引区。The file to be written is stored in the block data area of the first block, and the file storage information of the file to be written is obtained, and the obtained file storage information is stored in the block index area of the first block.
对于装置/电子设备/计算机可读存储介质实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。For the device/electronic device/computer readable storage medium embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment.
需要说明的是,本申请实施例的装置、电子设备及存储介质分别是应用上述基于随机博弈理论的动态竞争窗口调整方法的装置、电子设备及存储介质,则上述基于随机博弈理论的动态竞争窗口调整方法的所有实施例均适用于该装置、电子设备及存储介质,且均能达到相同或相似的有益效果。It should be noted that the apparatus, the electronic device, and the storage medium of the embodiment of the present application are respectively the apparatus, the electronic device, and the storage medium applying the dynamic competition window adjustment method based on the random game theory, and the dynamic competition window based on the random game theory. All embodiments of the adjustment method are applicable to the device, the electronic device, and the storage medium, and all achieve the same or similar benefits.
需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that, in this context, relational terms such as first and second are used merely to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply these entities or operations. There is any such actual relationship or order between them. Furthermore, the term "comprises" or "comprises" or "comprises" or any other variations thereof is intended to encompass a non-exclusive inclusion, such that a process, method, article, or device that comprises a plurality of elements includes not only those elements but also Other elements, or elements that are inherent to such a process, method, item, or device. An element that is defined by the phrase "comprising a ..." does not exclude the presence of additional equivalent elements in the process, method, item, or device that comprises the element.
本说明书中的各个实施例均采用相关的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于文件管理装置实施例、电子设备以及计算机可读存储介质而言,由于其基本相似于文件管理方法实施例,所以描述的比较简单,相关之处参见文件管理方法实施例的部分说明即可。The various embodiments in the present specification are described in a related manner, and the same or similar parts between the various embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the file management device embodiment, the electronic device, and the computer readable storage medium, since it is basically similar to the file management method embodiment, the description is relatively simple, and the relevant portion refers to the partial description of the file management method embodiment. can.
以上所述仅为本申请的较佳实施例而已,并不用以限制本申请,凡在本申请的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本申请保护的范围之内。The above is only the preferred embodiment of the present application, and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc., which are made within the spirit and principles of the present application, should be included in the present application. Within the scope of protection.

Claims (20)

  1. 一种文件管理方法,其特征在于,应用于电子设备,所述电子设备挂载有固态硬盘SSD,SSD具有SSD文件系统,所述SSD文件系统包括:系统索引区和数据区,所述系统索引区用于存储SSD信息和数据区信息,所述数据区被划分为至少一个块,每一个块包括:块索引区和块数据区,一个块的块索引区用于记录该块的块数据区所存储文件的文件存储信息,所述方法包括:A file management method is characterized in that it is applied to an electronic device, the electronic device is mounted with a solid state hard disk SSD, and the SSD has an SSD file system, and the SSD file system includes: a system index area and a data area, and the system index The area is used for storing SSD information and data area information, the data area is divided into at least one block, each block includes: a block index area and a block data area, and a block index area of one block is used to record a block data area of the block The file of the stored file stores information, and the method includes:
    获得待写入SSD的待写入文件;Obtaining a file to be written to be written to the SSD;
    通过所述SSD文件系统确定用于存储所述待写入文件的块,作为第一块;Determining, by the SSD file system, a block for storing the file to be written as a first block;
    将所述待写入文件存储至所述第一块的块数据区,并获得所述待写入文件的文件存储信息,将所获得的文件存储信息存储至所述第一块的块索引区。And storing the file to be written into the block data area of the first block, and 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 .
  2. 根据权利要求1所述的文件管理方法,其特征在于,所述数据区被划分所得到的块大小相同;The file management method according to claim 1, wherein the block size obtained by dividing the data area is the same;
    所述通过所述SSD文件系统确定用于存储所述待写入文件的块,作为第一块,包括:Determining, by the SSD file system, a block for storing the file to be written, as the first block, includes:
    生成所述待写入文件的标识,并通过所述SSD文件系统确定用于存储所述待写入文件的块,作为第一块。Generating an identifier of the file to be written, and determining, by the SSD file system, a block for storing the file to be written as the first block.
  3. 根据权利要求1或2所述的文件管理方法,其特征在于,所述方法还包括:The file management method according to claim 1 or 2, wherein the method further comprises:
    根据所述待写入文件的文件存储信息、所述第一块的块信息以及所述第一块所属SSD的SSD信息,生成所述待写入文件的文件存储位置信息。And generating 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 the SSD information of the SSD to which the first block belongs.
  4. 根据权利要求1或2所述的文件管理方法,其特征在于,所述数据区信息包括:各个块的使用状态;The file management method according to claim 1 or 2, wherein the data area information comprises: a use status of each block;
    在所述将所述待写入文件存储至所述第一块的块数据区之后,所述方法还包括:After the storing the file to be written to the block data area of the first block, the method further includes:
    判断所述第一块的当前使用状态是否为写满状态;Determining whether the current use state of the first block is a full state;
    若为是,将所述数据区信息中记录的所述第一块的使用状态更新为写满 状态;If yes, updating the usage status of the first block recorded in the data area information to a full state;
    若为否,在写入前状态为未写入状态时,将所述数据区信息中记录的所述第一块的使用状态更新为已写入状态,其中,所述写入前状态为:将所述待写入文件存储至所述第一块的块数据区之前所述第一块的使用状态。If not, when the pre-write state is the unwritten state, the usage state of the first block recorded in the data area information is updated to the written state, wherein the pre-write state is: And storing the file to be written to a use state of the first block before the block data area of the first block.
  5. 根据权利要求1-4任一项所述的文件管理方法,其特征在于,所述系统索引区包括:系统主索引区和系统备索引区;The file management method according to any one of claims 1 to 4, wherein the system index area comprises: a system main index area and a system backup index area;
    所述系统主索引区,用于存储SSD信息和数据区信息;The system main index area is configured to store SSD information and data area information;
    所述系统备索引区,用于存储所述系统主索引区的备份信息。The system backup index area is used to store backup information of the system main index area.
  6. 根据权利要求1-4任一项所述的文件管理方法,其特征在于,一个块的块索引区包括:该块的块主索引区和该块的块备索引区;The file management method according to any one of claims 1 to 4, wherein a block index area of a block includes: a block main index area of the block and a block backup index area of the block;
    一个块的块主索引区,用于记录该块的块数据区所存储文件的文件存储信息;a block main index area of a block for recording file storage information of a file stored in a block data area of the block;
    一个块的块备索引区,用于存储该块的块主索引区的备份信息。A block backup index area of a block for storing backup information of a block main index area of the block.
  7. 根据权利要求3所述的文件管理方法,其特征在于,所述方法还包括:The file management method according to claim 3, wherein the method further comprises:
    获得待从SSD读取的待读取文件的文件存储位置信息;Obtaining file storage location information of the file to be read to be read from the SSD;
    根据所获得文件存储位置信息中记录的SSD信息以及块信息,定位SSD中用于存储所述待读取文件的块;And locating a block in the SSD for storing the file to be read according to the SSD information and the block information recorded in the obtained file storage location information;
    根据所获得文件存储位置信息中记录的文件存储信息,从定位到的块中读取所述待读取文件。The file to be read is read from the located block based on the file storage information recorded in the obtained file storage location information.
  8. 根据权利要求7所述的文件管理方法,其特征在于,当定位到一个以上块时,所述根据所获得文件存储位置信息中记录的文件存储信息,从定位到的块中读取所述待读取文件,包括:The file management method according to claim 7, wherein when the one or more blocks are located, the reading the read from the located block according to the file storage information recorded in the obtained file storage location information Read the file, including:
    根据所获得文件存储位置信息中记录的文件存储信息,分别从定位到的各个块中读取属于所述待读取文件的数据;Reading data belonging to the file to be read from each of the located blocks according to the file storage information recorded in the obtained file storage location information;
    对读取到的数据进行合并处理,获得所述待读取文件。The read data is merged to obtain the file to be read.
  9. 一种文件管理装置,其特征在于,应用于电子设备,所述电子设备挂载有固态硬盘SSD,SSD具有SSD文件系统,所述SSD文件系统包括:系统索引区和数据区,所述系统索引区用于存储SSD信息和数据区信息,所述数据区被划分为至少一个块,每一个块包括:块索引区和块数据区,一个块的块索引区用于记录该块的块数据区所存储文件的文件存储信息,所述装置包括:A file management apparatus is characterized in that it is applied to an electronic device, the electronic device is mounted with a solid state hard disk SSD, and the SSD has an SSD file system, and the SSD file system includes: a system index area and a data area, the system index The area is used for storing SSD information and data area information, the data area is divided into at least one block, each block includes: a block index area and a block data area, and a block index area of one block is used to record a block data area of the block The file storage information of the stored file, the device includes:
    获取模块,用于获得待写入SSD的待写入文件;Obtaining a module, configured to obtain a file to be written to be written into the SSD;
    确定模块,用于通过所述SSD文件系统确定用于存储所述待写入文件的块,作为第一块;a determining module, configured to determine, by the SSD file system, a block for storing the file to be written as a first block;
    存储模块,用于将所述待写入文件存储至所述第一块的块数据区,并获得所述待写入文件的文件存储信息,将所获得的文件存储信息存储至所述第一块的块索引区。a storage module, configured to store the file to be written into a block data area of the first block, obtain file storage information of the file to be written, and store the obtained file storage information to the first The block index area of the block.
  10. 根据权利要求9所述的文件管理装置,其特征在于,所述数据区被划分所得到的块大小相同;所述确定模块具体用于:The file management apparatus according to claim 9, wherein the data area is divided into the same block size; the determining module is specifically configured to:
    生成所述待写入文件的标识,并通过所述SSD文件系统确定用于存储所述待写入文件的块,作为第一块。Generating an identifier of the file to be written, and determining, by the SSD file system, a block for storing the file to be written as the first block.
  11. 根据权利要求9或10所述的文件管理装置,其特征在于,所述装置还包括:The file management device according to claim 9 or 10, wherein the device further comprises:
    生成模块,用于根据所述待写入文件的文件存储信息、所述第一块的块信息以及所述第一块所属SSD的SSD信息,生成所述待写入文件的文件存储位置信息。And a generating module, 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 the SSD information of the SSD to which the first block belongs.
  12. 根据权利要求9或10所述的文件管理装置,其特征在于,所述数据区信息包括:各个块的使用状态;The file management apparatus according to claim 9 or 10, wherein the data area information comprises: a use status of each block;
    所述装置还包括:The device also includes:
    判断模块,用于判断所述第一块的当前使用状态是否为写满状态;a determining module, configured to determine whether a current usage state of the first block is a full state;
    所述判断模块包括:The determining module includes:
    第一更新子模块,用于当判断模块判断为是时,将所述数据区信息中记 录的所述第一块的使用状态更新为写满状态;a first update submodule, configured to: when the determining module determines to be YES, update the usage status of the first block recorded in the data area information to a full state;
    第二更新子模块,用于当判断模块判断为否时,在写入前状态为未写入状态时,将所述数据区信息中记录的所述第一块的使用状态更新为已写入状态,其中,所述写入前状态为:将所述待写入文件存储至所述第一块的块数据区之前所述第一块的使用状态。a second update submodule, configured to: when the determining module determines to be no, when the pre-write state is an unwritten state, update the usage status of the first block recorded in the data area information to be written a state, wherein the pre-write state is: a usage state of the first block before storing the file to be written to a block data area of the first block.
  13. 根据权利要求9-12任一项所述的文件管理装置,其特征在于,所述系统索引区包括:系统主索引区和系统备索引区;The file management device according to any one of claims 9 to 12, wherein the system index area comprises: a system main index area and a system backup index area;
    所述系统主索引区,用于存储SSD信息和数据区信息;The system main index area is configured to store SSD information and data area information;
    所述系统备索引区,用于存储所述系统主索引区的备份信息。The system backup index area is used to store backup information of the system main index area.
  14. 根据权利要求9-12任一项所述的文件管理装置,其特征在于,一个块的块索引区包括:该块的块主索引区和该块的块备索引区;The file management apparatus according to any one of claims 9 to 12, wherein the block index area of one block comprises: a block main index area of the block and a block backup index area of the block;
    一个块的块主索引区,用于记录该块的块数据区所存储文件的文件存储信息;a block main index area of a block for recording file storage information of a file stored in a block data area of the block;
    一个块的块备索引区,用于存储该块的块主索引区的备份信息。A block backup index area of a block for storing backup information of a block main index area of the block.
  15. 根据权利要求11所述的文件管理装置,其特征在于,所述装置还包括:The file management device according to claim 11, wherein the device further comprises:
    读取模块,用于获得待从SSD读取的待读取文件的文件存储位置信息;根据所获得文件存储位置信息中记录的SSD信息以及块信息,定位SSD中用于存储所述待读取文件的块;根据所获得文件存储位置信息中记录的文件存储信息,从定位到的块中读取所述待读取文件。a reading module, configured to obtain file storage location information of a file to be read to be read from the SSD; and to locate the SSD to be read in the positioning SSD according to the SSD information and the block information recorded in the obtained file storage location information a block of the file; the file to be read is read from the located block according to the file storage information recorded in the obtained file storage location information.
  16. 根据权利要求15所述的文件管理装置,其特征在于,当定位到一个以上块时,所述读取模块具体用于:The file management apparatus according to claim 15, wherein when the one or more blocks are located, the reading module is specifically configured to:
    根据所获得文件存储位置信息中记录的文件存储信息,分别从定位到的各个块中读取属于所述待读取文件的数据;Reading data belonging to the file to be read from each of the located blocks according to the file storage information recorded in the obtained file storage location information;
    对读取到的数据进行合并处理,获得所述待读取文件。The read data is merged to obtain the file to be read.
  17. 一种电子设备,其特征在于,所述电子设备挂载有固态硬盘SSD,SSD 具有SSD文件系统,所述SSD文件系统包括:系统索引区和数据区,所述系统索引区用于存储SSD信息和数据区信息,所述数据区被划分为大小相同的块,每一个块包括:块索引区和块数据区,一个块的块索引区用于记录该块的块数据区所存储文件的文件存储信息,所述电子设备还包括:处理器和存储器,其中,所述存储器,用于存放计算机程序;An electronic device, wherein the electronic device is mounted with a solid state hard disk SSD, the SSD has an SSD file system, the SSD file system includes: a system index area and a data area, and the system index area is used to store SSD information. And data area information, the data area is divided into blocks of the same size, each block includes: a block index area and a block data area, and a block index area of one block is used to record a file of a file stored in the block data area of the block Storing information, the electronic device further includes: a processor and a memory, wherein the memory is configured to store a computer program;
    所述处理器,用于执行存储器上所存放的程序时,实现权利要求2-8任一项所述的方法步骤。The processor, when used to execute a program stored on a memory, implements the method steps of any one of claims 2-8.
  18. 一种电子设备,其特征在于,所述电子设备挂载有固态硬盘SSD,SSD具有SSD文件系统,所述SSD文件系统包括:系统索引区和数据区,所述系统索引区用于存储SSD信息和数据区信息,所述数据区被划分为至少一个块,每一个块包括:块索引区和块数据区,一个块的块索引区用于记录该块的块数据区所存储文件的文件存储信息,所述电子设备还包括:处理器和存储器,其中,所述存储器,用于存放计算机程序;An electronic device, characterized in that the electronic device is mounted with a solid state hard disk SSD, the SSD has an SSD file system, the SSD file system includes: a system index area and a data area, and the system index area is used to store SSD information. And data area information, the data area is divided into at least one block, each block includes: a block index area and a block data area, and a block index area of one block is used to record file storage of files stored in the block data area of the block Information, the electronic device further includes: a processor and a memory, wherein the memory is configured to store a computer program;
    所述处理器,用于执行存储器上所存放的程序时,实现权利要求1-8任一项所述的方法步骤。The processor, when used to execute a program stored on a memory, implements the method steps of any one of claims 1-8.
  19. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质为电子设备中的存储介质,所述电子设备挂载有固态硬盘SSD,SSD具有SSD文件系统,所述SSD文件系统包括:系统索引区和数据区,所述系统索引区用于存储SSD信息和数据区信息,所述数据区被划分为大小相同的块,每一个块包括:块索引区和块数据区,一个块的块索引区用于记录该块的块数据区所存储文件的文件存储信息,所述计算机可读存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现权利要求2-8任一项所述的方法步骤。A computer readable storage medium, wherein the computer readable storage medium is a storage medium in an electronic device, the electronic device is mounted with a solid state drive SSD, the SSD has an SSD file system, and the SSD file system includes a system index area for storing SSD information and data area information, the data area being divided into blocks of the same size, each block including: a block index area and a block data area, one block a block index area for recording file storage information of a file stored in a block data area of the block, the computer readable storage medium storing a computer program, wherein the computer program is executed by the processor to implement any of claims 2-8 A method step as described.
  20. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质为电子设备中的存储介质,所述电子设备挂载有固态硬盘SSD,SSD具有SSD文件系统,所述SSD文件系统包括:系统索引区和数据区,所述系统索引区用于存储SSD信息和数据区信息,所述数据区被划分为至少一个块,每一个块包括:块索引区和块数据区,一个块的块索引区用于记录该块的块数据区所存储文件的文件存储信息,所述计算机可读存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现权利要求1-8任一项所述的方法步骤。A computer readable storage medium, wherein the computer readable storage medium is a storage medium in an electronic device, the electronic device is mounted with a solid state drive SSD, the SSD has an SSD file system, and the SSD file system includes a system index area for storing SSD information and data area information, the data area being divided into at least one block, each block including: a block index area and a block data area, one block a block index area for recording file storage information of a file stored in a block data area of the block, the computer readable storage medium storing a computer program, wherein the computer program is executed by the processor to implement any one of claims 1-8 The method steps described in the item.
PCT/CN2018/107594 2017-10-13 2018-09-26 File management method, file management device, electronic equipment and storage medium WO2019072088A1 (en)

Applications Claiming Priority (2)

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

Publications (1)

Publication Number Publication Date
WO2019072088A1 true WO2019072088A1 (en) 2019-04-18

Family

ID=66100386

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/107594 WO2019072088A1 (en) 2017-10-13 2018-09-26 File management method, file management device, electronic equipment and storage medium

Country Status (2)

Country Link
CN (1) CN109669623B (en)
WO (1) WO2019072088A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111382122B (en) * 2020-03-11 2024-01-30 杭州涂鸦信息技术有限公司 File management system and method for multi-path network camera sub-equipment
CN113190507B (en) * 2021-05-14 2022-06-03 杭州海康威视数字技术股份有限公司 Index information synchronization method and device and electronic equipment

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1619533A (en) * 2003-11-17 2005-05-25 鸿富锦精密工业(深圳)有限公司 Flash memory document management system and method
CN101178693A (en) * 2007-12-14 2008-05-14 沈阳东软软件股份有限公司 Data cache method and system

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103514260B (en) * 2013-08-13 2016-12-28 中国科学技术大学苏州研究院 Internal storage log file system and its implementation
US9952808B2 (en) * 2015-03-26 2018-04-24 International Business Machines Corporation File system block-level tiering and co-allocation
US9665287B2 (en) * 2015-09-18 2017-05-30 Alibaba Group Holding Limited Data deduplication using a solid state drive controller
CN107203532B (en) * 2016-03-16 2021-03-16 阿里巴巴集团控股有限公司 Index system construction method, search realization method and device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1619533A (en) * 2003-11-17 2005-05-25 鸿富锦精密工业(深圳)有限公司 Flash memory document management system and method
CN101178693A (en) * 2007-12-14 2008-05-14 沈阳东软软件股份有限公司 Data cache method and system

Also Published As

Publication number Publication date
CN109669623A (en) 2019-04-23
CN109669623B (en) 2021-09-03

Similar Documents

Publication Publication Date Title
US11799959B2 (en) Data processing method, apparatus, and system
US11216187B2 (en) Data writing and reading method and apparatus, and distributed object storage cluster
US11409703B2 (en) File versions within content addressable storage
US11461027B2 (en) Deduplication-aware load balancing in distributed storage systems
US20140297603A1 (en) Method and apparatus for deduplication of replicated file
CN109669622B (en) File management method, file management device, electronic equipment and storage medium
US20150143065A1 (en) Data Processing Method and Apparatus, and Shared Storage Device
WO2017185579A1 (en) Method and apparatus for data storage
CN105069048A (en) Small file storage method, query method and device
JP2014513338A5 (en) Method, computer readable storage medium and system for optimal compression of a virtual disk
US10552089B2 (en) Data processing for managing local and distributed storage systems by scheduling information corresponding to data write requests
US20150161154A1 (en) Files having unallocated portions within content addressable storage
CN110888837B (en) Object storage small file merging method and device
WO2019218976A1 (en) Data processing method and apparatus, and computer-readable storage medium
US20200301944A1 (en) Method and apparatus for storing off-chain data
WO2018233630A1 (en) Fault discovery
WO2019072250A1 (en) Document management method, document management system, electronic device and storage medium
WO2019076102A1 (en) Data rollback method and system, device, and computer readable storage medium
US10515055B2 (en) Mapping logical identifiers using multiple identifier spaces
WO2019072088A1 (en) File management method, file management device, electronic equipment and storage medium
US20210157513A1 (en) Data reading method, apparatus, and system, and distributed system
CN109144403B (en) Method and equipment for switching cloud disk modes
US10922277B1 (en) Logging file system metadata changes using a single log hold per cached block of metadata
US10684786B2 (en) Methods for performing global deduplication on data blocks and devices thereof
US20140181237A1 (en) Server and method for storing data

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18867068

Country of ref document: EP

Kind code of ref document: A1