WO2023141987A1 - File reading method and apparatus - Google Patents

File reading method and apparatus Download PDF

Info

Publication number
WO2023141987A1
WO2023141987A1 PCT/CN2022/074786 CN2022074786W WO2023141987A1 WO 2023141987 A1 WO2023141987 A1 WO 2023141987A1 CN 2022074786 W CN2022074786 W CN 2022074786W WO 2023141987 A1 WO2023141987 A1 WO 2023141987A1
Authority
WO
WIPO (PCT)
Prior art keywords
target
data
file
pointers
address
Prior art date
Application number
PCT/CN2022/074786
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 华为技术有限公司
Priority to PCT/CN2022/074786 priority Critical patent/WO2023141987A1/en
Priority to CN202280004002.0A priority patent/CN116830096A/en
Publication of WO2023141987A1 publication Critical patent/WO2023141987A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/14Details of searching files based on file metadata

Definitions

  • the present application relates to the field of computer information technology, in particular to a file reading method and device.
  • flash memory has become the mainstream storage medium instead of disk to meet the fast storage requirements of large amounts of data.
  • the sequential write feature of Log Structured File Systems is very friendly to flash memory, showing good random write performance. Since the log-structured file system has a sequential writing feature, file data is frequently created, updated, and deleted, which will result in discontinuous logical addresses of multiple data blocks storing file data.
  • the processor when reading data from a file, the processor first reads the logical address of the data block storing the data from the storage medium, and then sends the logical address of the data block storing the data to the storage medium, so that the storage medium Read data according to the logical address of the data block where the data is stored and return the read data to the processor. Based on this, when the logical addresses of multiple data blocks storing data are continuous, the processor only needs to send the logical address of the first data block and the length of the read data to the storage medium once to read the data from the storage medium. When the logical addresses of multiple data blocks storing data are discontinuous, the processor needs to send the discontinuous logical addresses of the data blocks to the storage medium multiple times to read data from the storage medium.
  • the processor needs to send the discontinuous logical addresses of the data blocks to the storage medium multiple times, which increases the number of interactions between the processor and the storage medium and reduces the time required for reading files. data performance.
  • the present application provides a file reading method and device, which are used to solve the problem that when reading file data, the number of interactions between a processor and a storage medium increases, and the performance of reading file data decreases.
  • the present application provides a file reading method applied to a storage controller, including: obtaining a file reading request from a processor through a file reading interface; wherein, the file reading request carries the Logical address, start offset address and the length of the target data, the target data is at least a part of data in the target file, the target index node is the index node of the target file, and the start offset address is used for Indicate the start position of the target data in the target file, and the target index node is used to indicate the data in the target file; according to the logical address of the target index node, the start offset address and the target data length of , reading the target data from the target file and sending the target data to the processor.
  • the file read request carries the logical address of the target index node, the start offset address, and the length of the target data
  • the target index node is used to indicate the data in the target file
  • the target data is at least a part of the data in the target file
  • the start The offset address is used to indicate the starting position of the target data in the target file. Therefore, after the storage controller receives the file read request, it can determine the data of the target file indicated in the target inode according to the logical address of the target inode , and read the target data from the target file according to the data of the target file, the start offset address and the length of the target data.
  • the processor when the processor reads the target data from the target file, the processor only needs to send a file read request carrying the logical address of the target inode, the start offset address and the length of the target data to the storage controller, namely Allows the storage controller to return target data to the processor based on a file read request.
  • the processor when reading the target data from the target file, the processor only needs to send a file read request to the storage controller.
  • the target index node indicates an address list of the target file, where the address list of the target file includes a one-to-one correspondence between multiple offset addresses and multiple data block logical addresses ;
  • reading the target data from the target file includes: determining the target index node according to the logical address The target index node; according to the length of the target data and the start offset address, and in combination with the address list of the target file indicated by the target index node, determine the logical address of the data block corresponding to the target data; according to The logical address of the data block corresponding to the target data is used to read the target data.
  • the target index node includes multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer; the priority of the pointers is from high to The lower order is: the plurality of direct pointers, the plurality of first-level indirect pointers, the plurality of second-level indirect pointers, and the at least one third-level indirect pointer; according to the order of priority from high to low, At least one of the multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer is used to indicate the address list of the target file.
  • the logical address of the data block includes: according to the length of the target data and the start offset address, and based on the multiple direct pointers, the multiple primary indirect pointers, the multiple secondary indirect pointers, or the multiple an address list of the target file indicated by at least one of the at least one three-level indirect pointer, and determine the logical address of the data block corresponding to the target data.
  • the data of the target file is stored in the target index node; according to the logical address of the target index node, the starting offset address and the length of the target data, from the target file
  • Reading the target data includes: determining the target index node according to the logical address of the target index node; according to the start offset address and the length of the target data, from the The target data is read from data in the target file.
  • the target index node includes multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer; the priority of the pointers is from high to The lower order is: the plurality of direct pointers, the plurality of first-level indirect pointers, the plurality of second-level indirect pointers, and the at least one third-level indirect pointer; when the size of the target file is less than or equal to In the case of the first preset value: the multiple direct pointers are used to store the data of the target file; according to the starting offset address and the length of the target data, from the target index node Reading the target data from the stored data of the target file includes: reading from the data of the target file stored in the plurality of direct pointers according to the start offset address and the length of the target data the target data.
  • the present application provides a file reading method applied to a processor, including: sending a file reading request to the storage controller through a file reading interface; wherein, the file reading request carries a target index node The logical address, the start offset address and the length of the target data, the target data is at least a part of the data in the target file, the target index node is the index node of the target file, and the start offset address is used In order to indicate the starting position of the target data in the target file, the target index node is used to indicate the data in the target file; receiving the returned by the storage controller in response to the file read request the target data.
  • the present application provides a file reading device, which is applied to a storage controller, including: an obtaining module, configured to obtain a file reading request from a processor through a file reading interface; wherein, the file reading request carry the logical address of the target index node, the start offset address and the length of the target data, the target data is at least a part of data in the target file, the target index node is the index node of the target file, and the start The offset address is used to indicate the starting position of the target data in the target file, and the target index node is used to indicate the data in the target file; the reading module is configured to The logical address, the start offset address and the length of the target data are used to read the target data from the target file; the sending module is used to send the target data to the processor.
  • an obtaining module configured to obtain a file reading request from a processor through a file reading interface
  • the file reading request carry the logical address of the target index node, the start offset address and the length of the target data
  • the target data is at
  • the target index node indicates an address list of the target file, where the address list of the target file includes a one-to-one correspondence between multiple offset addresses and multiple data block logical addresses ;
  • the reading module is specifically configured to determine the target index node according to the logical address of the target index node; according to the length of the target data and the starting offset address, combined with the target index node indication
  • the address list of the target file determine the logical address of the data block corresponding to the target data; read the target data according to the logical address of the data block corresponding to the target data.
  • the target index node includes multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer; the priority of the pointers is from high to The lower order is: the plurality of direct pointers, the plurality of first-level indirect pointers, the plurality of second-level indirect pointers, and the at least one third-level indirect pointer; according to the order of priority from high to low, At least one of the multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer is used to indicate the address list of the target file.
  • the reading module is specifically configured to, according to the length of the target data and the start offset address, based on the multiple direct pointers, the multiple first The pointer, the address list of the target file indicated by at least one of the multiple secondary indirect pointers or the at least one tertiary indirect pointer determines the logical address of the data block corresponding to the target data.
  • the target index node stores the data of the target file;
  • the reading module is specifically configured to determine the target index node according to the logical address of the target index node; according to the Read the target data from the data of the target file stored in the target index node according to the start offset address and the length of the target data.
  • the target index node includes multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer; the priority of the pointers is from high to The lower order is: the plurality of direct pointers, the plurality of first-level indirect pointers, the plurality of second-level indirect pointers, and the at least one third-level indirect pointer; when the size of the target file is less than or equal to
  • the multiple direct pointers are used to store the data of the target file; the reading module is specifically configured to, according to the starting offset address and the length of the target data, The target data is read from the data of the target file stored in the plurality of direct pointers.
  • the present application provides a file reading device, which is applied to a processor, including: a sending module, configured to send a file reading request to the storage controller through a file reading interface; wherein, the file reading The request carries the logical address of the target index node, the start offset address and the length of the target data, the target data is at least a part of data in the target file, the target index node is the index node of the target file, and the start The starting offset address is used to indicate the starting position of the target data in the target file, and the target index node is used to indicate the data in the target file; the receiving module is used to receive the storage controller response The target data returned by the file read request.
  • a sending module configured to send a file reading request to the storage controller through a file reading interface
  • the file reading The request carries the logical address of the target index node, the start offset address and the length of the target data
  • the target data is at least a part of data in the target file
  • the target index node is the index node of
  • the present application provides a computer-readable storage medium, including a computer program.
  • the computer program When the computer program is executed on a storage controller or a processor, the storage controller executes any one of the above-mentioned steps in the first aspect.
  • the present application provides a computer program, which is used to execute the method described in any one of the first aspect or the second aspect when the computer program is executed by a storage controller or a processor.
  • the present application provides an electronic device, including: a processor and a storage controller, wherein; the storage controller is configured to execute the method described in any one of the first aspect; and the processor is configured to execute the second method described in the aspect.
  • FIG. 1 shows a schematic diagram of writing a file A (FileA) into a storage medium in a sequential writing manner
  • FIG. 2 shows a schematic diagram of updating data in File A (FileA) by sequential writing
  • FIG. 3 is a schematic structural diagram of an electronic device provided in an embodiment of the present application.
  • FIG. 4 is a schematic flow diagram of a file reading method provided in an embodiment of the present application.
  • Fig. 5 is a schematic diagram of the file reading interface provided by the embodiment of the present application.
  • FIG. 6 is a schematic flow diagram of a storage controller reading target data provided by an embodiment of the present application.
  • FIG. 7 is a schematic structural diagram of a target index node provided by an embodiment of the present application.
  • FIG. 8 is a first schematic flow diagram of reading target data provided by the embodiment of the present application.
  • FIG. 9 is a second schematic flow diagram of reading target data provided by the embodiment of the present application.
  • FIG. 10 is the third schematic flow chart of reading target data provided by the embodiment of the present application.
  • FIG. 11 is the fourth schematic flow diagram of reading target data provided by the embodiment of the present application.
  • FIG. 12 is a first structural schematic diagram of a document reading device provided by an embodiment of the present application.
  • FIG. 13 is a second structural schematic diagram of the document reading device provided by the embodiment of the present application.
  • At least one (item) means one or more, and “multiple” means two or more.
  • “And/or” is used to describe the association relationship of associated objects, indicating that there can be three types of relationships, for example, “A and/or B” can mean: only A exists, only B exists, and A and B exist at the same time , where A and B can be singular or plural.
  • the character “/” generally indicates that the contextual objects are an “or” relationship.
  • At least one of the following” or similar expressions refer to any combination of these items, including any combination of single or plural items.
  • At least one item (piece) of a, b or c can mean: a, b, c, "a and b", “a and c", “b and c", or "a and b and c ", where a, b, c can be single or multiple.
  • the log-structured file system is used to manage the file data stored in the storage medium.
  • the storage medium includes, but is not limited to, a storage medium with sequential write characteristics such as a flash memory.
  • the sequential write characteristic of the storage medium means that when performing a write operation on the storage medium, data is written in the order in which the physical addresses of the data blocks in the storage medium are from small to large.
  • the write operation includes but is not limited to writing file data into a storage medium, writing updated file data into a storage medium, and the like.
  • file data is stored in multiple data blocks in a storage medium, and the number of multiple data blocks storing file data is determined by the size of the file data and the capacity of a single data block.
  • a file's metadata is stored in a node.
  • the metadata of a file includes, but is not limited to, the owner of the file, the read, write, and execute permissions of the file, and the time stamp of the file.
  • a node storing metadata of a file is determined as an index node of the file.
  • the index node of the file not only stores the metadata of the file, but is also used to store the data of the file or store the address list of the file, etc.
  • the address list of the file includes a one-to-one correspondence between multiple offset addresses and multiple data block logical addresses.
  • the data stored in the multiple data blocks indicated by the multiple data block logical addresses is the data of the file, and the multiple offset addresses Each offset address in is used to indicate the position of the data stored in the data block indicated by the logical address of the corresponding data block in the file.
  • the index node of the file may also have at least one associated node. If the file's index node cannot completely accommodate the file's address list, the address list not accommodated in the file's index node is stored in at least one associated node of the file's index node.
  • the sequential writing feature of the log file structure system refers to writing data into unoccupied data blocks according to the order of physical addresses of the data blocks in the storage medium from small to large.
  • FIG. 1 shows a schematic diagram of writing a file A (FileA) into a storage medium in a sequential writing manner.
  • Figure 1(a) is used to indicate the address list in the index node (inode) of file A (File A).
  • the address list includes three offset addresses Offset1 ⁇ Offset3 and three data block logical addresses LBA1 ⁇ LBA3 of file A, wherein the three offset addresses Offset1 ⁇ Offset3 correspond to the three data block logical addresses LBA1 ⁇ LBA3 one by one,
  • FIG. 1(b) is used to indicate the one-to-one mapping relationship between three offset addresses Offset1-Offset3 of file A and three logical addresses LBA1-LBA3 of data blocks.
  • FIG. 1(c) is used to indicate the one-to-one mapping relationship between logical addresses LBA1-LBA5 of data blocks and physical addresses PPN1-PPN5 of data blocks.
  • the data of file A is divided into three parts, and the three parts of data are stored in three data blocks in sequence according to the sequence of the positions of the three data parts in file A, and the physical data of the three data blocks
  • the addresses (that is, the physical addresses of the data blocks) are PPN1-PPN3.
  • the logical addresses of the three data blocks storing the data of file A are LBA1-LBA3.
  • three offset addresses Offset1-Offset3 of the file A are generated.
  • the three offset addresses Offset1-Offset3 are in one-to-one correspondence with the three data blocks storing the data of the file A, wherein the offset addresses are used to indicate the position of the data stored in the corresponding data block in the file A.
  • the address list of file A is constructed (as shown in Figure 1(a)), and the address list of file A Stored in the index node (inode) of file A.
  • FIG. 2 shows a schematic diagram of updating data in File A (FileA) in a sequential writing manner.
  • File A File A
  • FIG. 2 shows a schematic diagram of updating data in File A (FileA) in a sequential writing manner.
  • the process of updating the data at the positions indicated by the offset addresses Offset1 ⁇ Offset2 by sequential writing is as follows:
  • the data at the position indicated by the offset address Offset2 is updated, and the updated data is written into the data block whose physical address is PPN4.
  • the mapping relationship indicated in FIG. 2( c ) it can be known that the logical address of the data block storing the updated data is LBA4.
  • FIG. 2( b ) the mapping relationship between the logical address LBA4 of the data block and the offset address Offset2 is established, and the established mapping relationship is updated into the address list of file A.
  • the logical address of the data block corresponding to the offset address Offset2 is changed from LBA2 to LBA4.
  • the data at the position indicated by the offset address Offset1 is updated, and the updated data is written into the data block whose physical address is PPN5.
  • the mapping relationship indicated in FIG. 2( c ) it can be known that the logical address of the data block storing the updated data is LBA5.
  • FIG. 2( b ) the mapping relationship between the logical address of the data block LBA5 and the offset address Offset1 is established, and the established mapping relationship is updated to the address list of file A.
  • the logical address of the data block corresponding to the offset address Offset1 is changed from LBA1 to LBA5.
  • the logical addresses of the data blocks corresponding to the offset addresses Offset1-Offset3 are LBA5, LBA4, and LBA3 in sequence.
  • the result of sorting the logical addresses of the corresponding data blocks is LBA5 ⁇ LBA3.
  • LBA5 ⁇ LBA3 are continuous, LBA5 ⁇ LBA3 are not in the order from small to large Therefore, the logical addresses LBA5-LBA3 of the data blocks corresponding to the offset addresses Offset1-Offset3 are discontinuous.
  • the offset addresses are read in ascending order. Therefore, if the logical addresses of multiple data blocks corresponding to multiple offset addresses of the file are continuous, that is, after sorting the logical addresses of the corresponding multiple data blocks according to the order of the offset addresses of the file from small to large, the sorted multiple The logical addresses of the data blocks are continuous and arranged in ascending order, so in the prior art, the process of reading the target data in the file is:
  • the processor sends the logical address of the inode of the file to the storage controller in the storage medium.
  • the storage controller in the storage medium determines the physical address of the index node according to the logical address of the index node of the file, obtains the address list of the file according to the physical address of the index node, and feeds back the address list of the file to the processor.
  • the processor determines the logical address of the data block corresponding to the starting offset address according to the address list of the file, and sends the logical address of the data block corresponding to the starting offset address and the length of the target data to the storage controller in the storage medium.
  • the starting offset address is used to indicate the starting position of the target data in the file.
  • the storage controller in the storage medium reads the data in the data block sequentially from the data block indicated by the data block logical address corresponding to the start offset address until the length of the read data block is equal to the length of the target data, The read data is determined as target data, and the target data is sent to the processor.
  • the processor when reading data corresponding to offset addresses Offset1 ⁇ Offset3 in file A, the processor only needs to determine the offset address Offset1 (that is, the starting offset address) corresponding to The data block logical address LBA1, and the data length corresponding to the data block logical address LBA1 and offset addresses Offset1-Offset3 are sent to the storage controller in the storage medium.
  • the storage controller in the storage medium reads the data in the data block sequentially backward from the data block indicated by the data block logical address LBA1, that is, reads the data in the data block indicated by the data block logical address LBA1 ⁇ LBA3, to Obtain the data corresponding to the offset addresses Offset1 ⁇ Offset3.
  • the processor sends the logical address of the inode of the file to the storage controller in the storage medium.
  • the storage controller in the storage medium determines the physical address of the index node according to the logical address of the index node of the file, obtains the address list of the file according to the physical address of the index node, and feeds back the address list of the file to the processor.
  • the processor determines the logical addresses of multiple discontinuous data blocks corresponding to the target data, and divides the logical addresses of multiple discontinuous data blocks corresponding to the target data into sent to the storage controller of the storage medium.
  • the storage controller in the storage medium reads the target data according to the logical addresses of multiple discontinuous data blocks corresponding to the target data, and sends the target data to the processor, wherein the logical addresses of the multiple discontinuous data blocks corresponding to the target data Target data is stored in the indicated data block.
  • the processor when reading the data corresponding to offset addresses Offset1 ⁇ Offset3 in file A, the processor needs to determine the data block logical addresses LBA5, LBA4, and LBA3 corresponding to offset addresses Offset1 ⁇ Offset3, and then, First send the logical address LBA5 of the data block to the storage controller in the storage medium, then send the logical address LBA4 of the data block to the storage controller in the storage medium, and finally send the logical address LBA3 of the data block to the storage controller in the storage medium storage controller.
  • the storage controller in the storage medium reads the data in the data blocks indicated by the data block logical addresses LBA5 , LBA4 , and LBA3 to obtain the data corresponding to the offset addresses Offset1 ⁇ Offset3.
  • the processor when reading the target data in the file, the processor only needs to send The logical address of the data block corresponding to the start offset address and the length of the target data are sufficient.
  • the processor needs to send the logical addresses of multiple data blocks corresponding to the target data multiple times. To the storage controller in the storage medium, the number of interactions between the processor and the storage medium is increased, resulting in a decrease in file reading performance, and at the same time increasing the overhead of the processor.
  • the present application provides an electronic device, which uses a log-structured file system to manage file data.
  • Log-structured file systems include but are not limited to F2FS, Btrfs, zoneFs, etc.
  • Electronic devices include but are not limited to mobile phones, computers, e-readers, etc.
  • the electronic device includes a processor 310 and a memory 320 .
  • the processor 310 is configured to read the target data in the target file from the memory 320 .
  • the target data can be at least a part of the data in the target file, that is, the target data can be a part of the data in the target file, or all the data in the target file.
  • the processor 310 includes, but is not limited to, a central processing unit (CPU), a microcontroller (MCU), a digital signal processor (DSP), a neural processing unit (NPU), or a microprocessor.
  • CPU central processing unit
  • MCU microcontroller
  • DSP digital signal processor
  • NPU neural processing unit
  • microprocessor a microprocessor
  • the memory 320 may be, for example, a memory in the electronic device, or an external memory connected to the electronic device.
  • the storage includes but is not limited to storage media with sequential write characteristics such as flash memory.
  • the memory 320 includes a memory controller 321 .
  • the processor 310 is configured to send a file read request to the storage controller 321, and receive target data obtained by the storage controller 321 according to the file read request.
  • the storage controller 321 is configured to receive and respond to the file read request, read the target file to obtain target data, and send the target data to the processor 310 .
  • the processor 310 when reading target data, the processor 310 only needs to send a file read request to the storage controller 321 once, which reduces the number of interactions between the storage controller 321 and the processor 310, that is, reduces the interaction between the storage controller 320 and the processing. The number of interactions between processors 310 improves file reading performance and reduces processor 310 overhead.
  • FIG. 4 is a schematic flowchart of a file reading method provided by an embodiment of the present application. As shown in Figure 4, the file reading method includes the following steps:
  • the processor 310 sends a file reading request to the storage controller 321 through the file reading interface 501.
  • the file read request carries the logical address of the target inode, the start offset address and the length of the target data.
  • the target data is at least a part of data in the target file.
  • the target index node is the index node of the target file, and the starting offset address is used to indicate the starting position of the target data in the target file.
  • the file reading interface is shown as 501 in FIG. 5 .
  • the target inode is used to indicate the data in the target file.
  • the target index node may indicate the data in the target file by storing the data of the target file, and the target index node may also indicate the data of the target file by indicating the address list of the target file.
  • the address list of the target file includes a one-to-one correspondence between a plurality of offset addresses and a plurality of data block logical addresses, and the data stored in the plurality of data blocks indicated by the plurality of data block logical addresses is the data of the target file.
  • Each of the offset addresses is used to indicate the location of the data stored in the data block indicated by the logical address of the corresponding data block in the target file.
  • the storage controller 321 receives a file reading request through the file reading interface 501.
  • the storage controller 321 reads the target data from the target file in response to the file read request. Specifically, the target data is read from the target file according to the logical address of the target index node carried in the file read request, the start offset address, and the length of the target data.
  • the storage controller 321 sends the target data to the processor 310.
  • the processor 310 receives the target data.
  • the file read request carries the logical address of the target index node, the start offset address, and the length of the target data
  • the target index node is used to indicate the data in the target file
  • the target data is at least a part of the data in the target file
  • the start The offset address is used to indicate the starting position of the target data in the target file. Therefore, after the storage controller 321 receives the file read request, it can determine the address of the target file indicated in the target index node according to the logical address of the target index node. data, and read the target data from the target file according to the data of the target file, the start offset address and the length of the target data.
  • the processor 310 when the processor 310 reads the target data from the target file, the processor 310 only needs to send the file read file carrying the logical address of the target inode, the start offset address and the length of the target data to the storage controller 321.
  • the request means that the storage controller 321 returns the target data to the processor 310 based on the file read request.
  • the processor 310 when reading the target data from the target file, the processor 310 only needs to send a file read request to the storage controller 321. Compared with the prior art, it is not necessary to consider whether the logical addresses of multiple data blocks storing data are continuous.
  • step 403 includes but are not limited to the following two:
  • step 403 if the target index node indicates the data of the target file by indicating the address list of the target file, the implementation steps of step 403 are as shown in Figure 6:
  • the storage controller 321 determines the target index node according to the logical address of the target index node.
  • the physical address of the target index node is determined according to the logical address of the target index node, and the target index node is determined according to the physical address of the target index node.
  • the storage controller 321 determines the logical address of the data block corresponding to the target data according to the length and the start offset address of the target data and in combination with the address list of the target file indicated by the target inode.
  • the storage controller 321 reads the target data according to the logical address of the data block corresponding to the target data.
  • Step 602 and step 603, for example, can be realized through the following steps:
  • the storage controller 321 uses the starting offset address as the offset address to be compared, matches the offset address to be compared with the offset address in the address list of the target file, and matches the offset address to be compared.
  • the logical address of the data block corresponding to the offset address is determined as the logical address of the data block corresponding to the offset address to be compared.
  • the storage controller 321 determines the physical address of the data block corresponding to the offset address to be compared according to the logical address of the data block corresponding to the offset address to be compared, and reads the data block indicated by the physical address of the data block corresponding to the offset address to be compared.
  • the data in the data block, the read data is sent to the processor 310 .
  • the determined logical address of the data block corresponding to the offset address to be compared is the logical address of the data block corresponding to the target data
  • the data sent to the processor 310 is the target data
  • step 602 will be described according to the structure of the log-structured file system and the target inode.
  • a log-structured file system uses three types of nodes, index nodes, direct nodes, and indirect nodes.
  • An index node for example, a target index node
  • An index node in a log-structured file system includes two main parts: a metadata (metadata) part and a data block addressing part.
  • the data block addressing part includes multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer.
  • the priority order of pointers from high to low is: multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer.
  • At least one of multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer is used to indicate the file (such as the target file) address list. That is, first indicate the address list of the file (such as the target file) through the pointer with the highest priority (such as multiple direct pointers), if the pointer with the highest priority cannot fully indicate the address list of the file, you can increase the priority by increasing Pointers to collectively indicate a list of addresses for object files.
  • Direct pointer the address array directly pointing to the data block in the index node.
  • First-level indirect pointer the index node records multiple first-level indirect pointers, and multiple first-level indirect pointers indicate the addresses of multiple direct nodes, and each direct node directly points to multiple data block addresses.
  • the index node records multiple secondary indirect pointers, multiple secondary indirect pointers indicate the addresses of multiple indirect nodes, each indirect node saves the nid (identification) of the direct node, and each direct node points to Multiple data block addresses.
  • the three-level indirect pointer the index node records at least one three-level indirect pointer
  • each three-level indirect pointer indicates the address of an indirect node
  • each three-level indirect pointer records multiple two-level indirect pointers, that is, each three-level indirect pointer
  • Multiple secondary indirect pointers are recorded in the indirect node indicated by the indirect pointer.
  • Each secondary indirect pointer indicates the address of an indirect node
  • the indirect node indicated by each secondary indirect pointer stores the direct node nid, and each direct node points to multiple data block addresses.
  • the direct node indicated by the first-level indirect pointer in the index node can be understood as the associated node of the target index node, and similarly, the indirect node indicated by the second-level indirect pointer and the third-level indirect pointer in the index node can also be understood as the association node of the target index node node.
  • step 602 can be: according to the length of the target data and the start offset address, and based on multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, or at least one third-level indirect
  • the address list of the target file indicated by at least one item of the pointer determines the logical address of the data block corresponding to the target data.
  • the implementation of step 602 will be described in detail according to the size of the target file and different locations indicated by the starting offset address. Since the first preset value to the fourth preset value will be involved in the description process, and the first preset value ⁇ the second preset value ⁇ the third preset value ⁇ the fourth preset value, therefore, first The first preset value to the fourth preset value are described.
  • the first preset value to the fourth preset value can be set according to parameters such as the maximum value of data represented by the address list that can be indicated by each pointer, or the maximum value of data that can be stored by multiple direct pointers. In this way, according to the size of the target file and in combination with the indication principle of the data of the target file or the address list of the target file, it can be determined that the address list of the target file or the data of the target file are stored in those pointers.
  • the first preset value is determined. In this way, when the target file ⁇ the first preset value, the data of the target file is stored in multiple direct pointers. Like this, When reading the target data in the target file, the target data is read from multiple direct pointers to improve the efficiency of data reading.
  • the second preset value determines whether the first preset value ⁇ the size of the target file ⁇ the second preset value. If the first preset value ⁇ the size of the target file ⁇ the second preset value, then pass Multiple direct pointers point to a list of addresses of object files.
  • the third preset value is determined according to factors such as the maximum value of data indicated by the largest address list that can be indicated by the multiple direct pointers and the multiple first-level indirect pointers. In this way, if the second preset value ⁇ the size of the target file ⁇ the third preset value, multiple direct pointers and multiple first-level indirect pointers can be used to indicate the address list of the target file.
  • the fourth preset value is determined according to factors such as a maximum value of data indicated by a maximum address list that can be indicated by multiple direct pointers, multiple first-level indirect pointers, and multiple second-level indirect pointers. In this way, if the third preset value ⁇ the size of the target file ⁇ the fourth preset value, the address list of the target file is indicated by multiple direct pointers, multiple first-level indirect pointers, and multiple second-level indirect pointers. If the fourth preset value ⁇ the size of the target file, the address list of the target file is indicated by multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers and at least one third-level indirect pointer.
  • step 602 can be determined according to the size of the target file and the starting offset address.
  • the specific process is as follows:
  • step 602 If the first preset value ⁇ the size of the target file ⁇ the second preset value, the implementation process of step 602 is as follows:
  • the logical address of the data block corresponding to the target data is determined.
  • step 602 If the starting offset address ⁇ the second preset value, the implementation process of step 602 is as follows:
  • the logical address of the data block corresponding to the target data is determined.
  • step 602 If the second preset value ⁇ start offset address ⁇ the third preset value, then the implementation process of step 602 is as follows:
  • the logical address of the data block corresponding to the target data is determined.
  • step 602 If the starting offset address ⁇ the second preset value, the implementation process of step 602 is as follows:
  • multiple first-level indirect pointers and multiple second-level indirect pointers determine the logical address of the data block corresponding to the target data .
  • step 602 If the second preset value ⁇ start offset address ⁇ the third preset value, then the implementation process of step 602 is as follows:
  • the logical address of the data block corresponding to the target data is determined.
  • step 602 the implementation process of step 602 is as follows: according to the length of the target data and the start offset address, and based on the multiple secondary indirect pointers indicated The address list of the target file determines the logical address of the data block corresponding to the target data.
  • step 602 If the starting offset address ⁇ the second preset value, the implementation process of step 602 is as follows:
  • step 602 If the second preset value ⁇ start offset address ⁇ the third preset value, then the implementation process of step 602 is as follows:
  • the length and starting offset address of the target data determines the data block corresponding to the target data logical address.
  • step 602 If the third preset value ⁇ start offset address ⁇ the fourth preset value, the implementation process of step 602 is as follows:
  • step 602 If the fourth preset value ⁇ start offset address, the implementation process of step 602 is as follows:
  • the logical address of the data block corresponding to the target data is determined.
  • the principle of determining the logical address of the data block corresponding to the target data in the address list of the target file indicated by various pointers is the same as that described above.
  • the principle of shifting the logical address of the data block corresponding to the address is similar and will not be repeated here.
  • the first preset value it is possible to flexibly determine where to start matching the address list according to the size of the target file and the starting offset address, thereby improving the matching efficiency.
  • step 403 if the target index node indicates the data of the target file by storing the data of the target file, the implementation steps of step 403 are as follows:
  • the target index node is determined according to the logical address of the target index node. The specific implementation process has been described above and will not be repeated here. Then, according to the start offset address and the length of the target data, the target data is read from the data of the target file stored in the target index node.
  • the target index node includes multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer.
  • the priority order of pointers from high to low is: multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer.
  • multiple direct pointers are used to store the data of the target file. Then, according to the start offset address and the length of the target data, the realization process of reading the target data from the data of the target file stored in the target index node is as follows:
  • the target data is read from the data of the target file stored in the multiple direct pointers.
  • the file read request carries the logical address of the target index node, the length of the target data, and the starting offset address.
  • an index node (such as a target index node) includes a metadata (metadata) part and a data block addressing part.
  • the data block addressing part includes 929 direct pointers, two first-level indirect pointers, two second-level indirect pointers, and one third-level indirect pointer.
  • 929 direct pointers store the physical addresses of 929 block data.
  • Two first-level indirect pointers indicate the addresses of two direct nodes, where 2*1018 blocks of data can be saved.
  • the two secondary indirect pointers indicate the addresses of the two indirect nodes, and the two indirect nodes store the nid of the direct node, where 2*1018*1018 blocks of data are stored.
  • a third-level indirect pointer indicates the address of an indirect node
  • the indirect node indicated by the third-level indirect pointer stores the address of the indirect node indicated by the second-level indirect pointer
  • the indirect node indicated by the second-level indirect pointer stores the nid of the direct node , 1018*1018*1018 pages of data can be saved here.
  • the first default value is 3716B
  • the second default value is 3716KB
  • the third default value is 11860KB.
  • the fourth preset value is 8302452KB.
  • the address list of the target file is indicated by 929 direct pointers, two first-level indirect pointers, two second-level indirect pointers and one third-level indirect pointer.
  • the process of the storage controller reading the target data can be as follows:
  • the storage controller determines the target inode according to the logical address of the target inode. Then, the storage controller obtains the target data from the inline data in the target index node according to the start offset address and the length of the target data, and sends the target data to the processor.
  • the storage controller determines the target index node according to the logical address of the target index node.
  • the storage controller uses the starting offset address as the offset address to be compared.
  • the storage controller matches the offset address to be compared with the offset address in the address list of the target file indicated by the 929 direct pointers in the target index node, so as to determine the data block logic corresponding to the offset address to be compared address.
  • the storage controller determines the physical address of the data block corresponding to the offset address to be compared according to the logical address of the data block corresponding to the offset address to be compared.
  • the storage controller reads data from the data block indicated by the physical address of the data block corresponding to the offset address to be compared, and sends the read data to the processor.
  • the storage controller judges whether the length of the data sent to the processor is equal to the length of the target data, if yes, execute 807, and if not, execute 808.
  • the storage controller stops reading the target data.
  • the storage controller updates the offset address to be compared, and repeats steps 803-806 based on the updated offset address to be compared.
  • the update of the offset address to be compared may be adding one to the current offset address to be compared.
  • the data sent to the processor is object data.
  • the determined logical address of the data block corresponding to the offset address to be compared is the logical address of the data block corresponding to the target data.
  • the process of the storage controller reading the target data is similar to the principle shown in Figure 8, that is, the starting offset address is determined as the offset address to be compared, and the 929 direct pointers indicate the Start matching in the address list of the object file.
  • the difference is that if no offset address matching the updated offset address to be compared is found in the address list of the target files indicated by the 929 direct pointers, then the target files indicated by the two first-level indirect pointers in the address list of .
  • the storage controller determines the target index node according to the logical address of the target index node.
  • the storage controller uses the starting offset address as the offset address to be compared.
  • the storage controller determines the direct node according to the two first-level indirect pointers in the target index node.
  • the storage controller matches the offset address to be compared with the offset address in the address list of the target file stored in the direct node, so as to determine the logical address of the data block corresponding to the offset address to be compared.
  • the storage controller determines the physical address of the data block corresponding to the offset address to be compared according to the logical address of the data block corresponding to the offset address to be compared.
  • the storage controller reads data from the data block indicated by the physical address of the data block corresponding to the offset address to be compared, and sends the read data to the processor.
  • the storage controller judges whether the length of the data sent to the processor is equal to the length of the target data, if yes, go to 908, if not, go to 909.
  • the storage controller stops reading the target data.
  • the storage controller updates the offset address to be compared, and repeats steps 904-907 based on the updated offset address to be compared.
  • the process of the storage controller reading the target data is similar to the principle shown in Figure 8, that is, the starting offset address is determined as the offset address to be compared, and the 929 direct pointers indicate the The logical address of the data block starting to match the offset address to be compared in the address list of the target file. The difference is that if no offset address matching the updated offset address to be compared is found in the address list of the target files indicated by the 929 direct pointers, then the target files indicated by the two first-level indirect pointers in the address list of . If no offset address matching the updated offset address to be compared is found in the address lists of the target files indicated by the two first-level indirect pointers, then in the address lists of the target files indicated by the two second-level indirect pointers in the search.
  • the process of the storage controller reading the target data is similar to the principle shown in Figure 9, that is, the start offset address is determined as the offset address to be compared, and the two levels The logical address of the data block starting to match the offset address to be compared in the address list of the target file indicated by the indirect pointer. The difference is that if no offset address matching the updated offset address to be compared is found in the address list of the target file indicated by the two first-level indirect pointers, then the two second-level indirect pointers indicate Lookup in the address list of the object file.
  • the storage controller determines the target index node according to the logical address of the target index node.
  • the storage controller uses the starting offset address as the offset address to be compared.
  • the storage controller determines the indirect node according to the two secondary indirect pointers in the target index node, and determines the nid of the direct node from the indirect nodes.
  • the storage controller matches the offset address to be compared with the offset address in the address list of the target file stored in the direct node (determined according to the nid of the direct node), so as to determine the data corresponding to the offset address to be compared block logical address.
  • the storage controller determines the physical address of the data block corresponding to the offset address to be compared according to the logical address of the data block corresponding to the offset address to be compared.
  • the storage controller reads data from the data block indicated by the physical address of the data block corresponding to the offset address to be compared, and sends the read data to the processor.
  • the storage controller judges whether the length of the data sent to the processor is equal to the length of the target data, if yes, execute 1008, if not, execute 1009.
  • the storage controller stops reading the target data.
  • the storage controller updates the offset address to be compared, and repeats steps 1004-1007 based on the updated offset address to be compared.
  • the process of the storage controller reading the target data is similar to the principle shown in Figure 8, that is, the starting offset address is determined as the offset address to be compared, and the 929 direct pointers indicate the The logical address of the data block starting to match the offset address to be compared in the address list of the target file. The difference is that if no offset address matching the updated offset address to be compared is found in the address list of the target files indicated by the 929 direct pointers, then the target files indicated by the two first-level indirect pointers in the address list of .
  • the process of the storage controller reading the target data is similar to the principle shown in Figure 9, that is, the starting offset address is determined as the offset address to be compared, and the two first-level The logical address of the data block starting to match the offset address to be compared in the address list of the target file indicated by the indirect pointer.
  • the two second-level indirect pointers indicate Lookup in the address list of the object file. If no offset address matching the updated offset address to be compared is found in the address list of the target file indicated by the two second-level indirect pointers, then in the address list of the target file indicated by a third-level indirect pointer find.
  • the process of the storage controller reading the target data is similar to the principle shown in Figure 10, that is, the start offset address is determined as the offset address to be compared, and the two secondary The logical address of the data block starting to match the offset address to be compared in the address list of the target file indicated by the indirect pointer. If no offset address matching the updated offset address to be compared is found in the address list of the target file indicated by the two second-level indirect pointers, then in the address list of the target file indicated by a third-level indirect pointer find.
  • the storage controller determines the target index node according to the logical address of the target index node.
  • the storage controller uses the starting offset address as the offset address to be compared.
  • the storage controller determines the indirect node according to the three-level indirect pointer in the target index node, determines the address of the indirect node stored in the indirect node from the determined indirect node, and obtains the nid of the direct node according to the address of the indirect node.
  • the storage controller matches the offset address to be compared with the offset address in the address list of the target file stored in the direct node (determined according to the direct node nid), so as to determine the data block corresponding to the offset address to be compared logical address.
  • the storage controller determines the physical address of the data block corresponding to the offset address to be compared according to the logical address of the data block corresponding to the offset address to be compared.
  • the storage controller reads data from the data block indicated by the physical address of the data block corresponding to the offset address to be compared, and sends the read data to the processor.
  • the storage controller judges whether the length of the data sent to the processor is equal to the length of the target data, if yes, execute 1108, if not, execute 1109.
  • the storage controller stops reading the target data.
  • the storage controller updates the offset address to be compared, and repeats steps 1104-1107 based on the updated offset address to be compared.
  • the address list of the target file indicated by the indirect pointer refers to the address list of the target file stored in the direct node finally pointed by the indirect pointer.
  • Indirect nodes include but are not limited to first-level indirect pointers, second-level indirect pointers, and third-level indirect pointers.
  • the present application also provides a file reading device, which is applied to a storage controller.
  • the device 1200 may include: an obtaining module 1201, a reading module 1202, and a sending module 1203, wherein:
  • Obtaining module 1201 configured to obtain a file read request from a processor through a file read interface; wherein, the file read request carries a logical address of a target index node, a starting offset address, and a length of target data, and the The target data is at least a part of data in the target file, the target index node is the index node of the target file, and the starting offset address is used to indicate the starting position of the target data in the target file, The target index node is used to indicate the data in the target file; the reading module 1202 is used to read the data from the target file according to the logical address of the target index node, the starting offset address and the length of the target data. Read the target data; a sending module 1203, configured to send the target data to the processor.
  • the target index node indicates an address list of the target file, where the address list of the target file includes a one-to-one correspondence between multiple offset addresses and multiple data block logical addresses ;
  • the reading module 1202 is specifically configured to determine the target index node according to the logical address of the target index node; according to the length of the target data and the start offset address, combined with the target index node
  • the indicated address list of the target file determines the logical address of the data block corresponding to the target data; and reads the target data according to the logical address of the data block corresponding to the target data.
  • the target index node includes multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer; the priority of the pointers is from high to The lower order is: the plurality of direct pointers, the plurality of first-level indirect pointers, the plurality of second-level indirect pointers, and the at least one third-level indirect pointer; according to the order of priority from high to low, At least one of the multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer is used to indicate the address list of the target file.
  • the reading module 1202 is specifically configured to, according to the length of the target data and the start offset address, and based on the multiple direct pointers, the multiple primary The indirect pointer, the address list of the target file indicated by at least one of the plurality of second-level indirect pointers or the at least one third-level indirect pointer determines the logical address of the data block corresponding to the target data.
  • the target index node stores the data of the target file;
  • the reading module 1202 is specifically configured to determine the target index node according to the logical address of the target index node; For the start offset address and the length of the target data, the target data is read from data of the target file stored in the target index node.
  • the target index node includes multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer; the priority of the pointers is from high to The lower order is: the plurality of direct pointers, the plurality of first-level indirect pointers, the plurality of second-level indirect pointers, and the at least one third-level indirect pointer; when the size of the target file is less than or equal to
  • the plurality of direct pointers are used to store the data of the target file;
  • the reading module 1202 is specifically configured to use the starting offset address and the length of the target data , reading the target data from the data of the target file stored in the plurality of direct pointers.
  • the present application further provides a file reading device, which is applied to a processor.
  • the device 1300 may include: a sending module 1301 and a receiving module 1302, wherein:
  • the sending module 1301 is configured to send a file read request to the storage controller through a file read interface; wherein, the file read request carries the logical address of the target index node, the starting offset address and the length of the target data,
  • the target data is at least a part of data in the target file
  • the target index node is the index node of the target file
  • the start offset address is used to indicate the start of the target data in the target file
  • the location, the target index node is used to indicate the data in the target file
  • the receiving module 1302 is used to receive the target data returned by the storage controller in response to the file read request.
  • the present application also provides a computer-readable storage medium.
  • a computer program is stored in the computer storage medium.
  • the storage controller executes any one of the above-mentioned storage controllers.
  • the present application also provides a computer-readable storage medium, and a computer program is stored in the computer storage medium, and when the computer program is executed on a processor, the processor is made to perform any one of the method embodiments performed by the above-mentioned processor. technical solutions.
  • the present application also provides a computer program product, which, when the computer program is executed by the storage controller, causes the storage controller to execute the technical solution of any one of the method embodiments performed by the storage controller above.
  • the present application also provides a computer program product, which, when the computer program is executed by a processor, causes the processor to execute the technical solution of any one of the method embodiments executed by the processor above.
  • the present application also provides a chip, including a processor and a storage controller, where the processor is configured to execute the steps executed by the above-mentioned processor, and the storage controller is configured to execute the steps executed by the above-mentioned storage controller.
  • the chip may further include a communication interface.
  • the communication interface may be an input/output interface, a pin, or an input/output circuit.
  • each step of the above-mentioned method embodiment can be completed by an integrated logic circuit of hardware in the network card or an instruction in the form of software.
  • the processor can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other possible Program logic devices, discrete gate or transistor logic devices, discrete hardware components.
  • a general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like.
  • the steps of the methods disclosed in the embodiments of the present application may be directly implemented by a hardware coded processor, or executed by a combination of hardware and software modules in the coded processor.
  • the software module can be located in a mature storage medium in the field such as random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, register.
  • the storage medium is located in the memory, and the processor reads the information in the memory, and completes the steps of the above method in combination with its hardware.
  • the disclosed systems, devices and methods may be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components can be combined or May be integrated into another system, or some features may be ignored, or not implemented.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
  • the functions described above are realized in the form of software function units and sold or used as independent products, they can be stored in a computer-readable storage medium.
  • the technical solution of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions are used to make a computer device (personal computer, server, or network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (read-only memory, ROM), random access memory (random access memory, RAM), magnetic disk or optical disc and other media that can store program codes. .

Abstract

Provided in the present application is a file reading method, which is applied to a storage controller. The method comprises: obtaining a file reading request from a processor by means of a file reading interface, wherein the file reading request carries a logic address of a target index node, a start offset address and the length of target data, the target data is at least part of data in a target file, the target index node is an index node of the target file, the start offset address is used for indicating a start location of the target data in the target file, and the target index node is used for indicating data in the target file; reading the target data from the target file according to the logic address of the target index node, the start offset address and the length of the target data; and sending the target data to the processor. By means of the present application, the number of interactions between a processor and a storage controller is reduced, thereby improving the file reading performance.

Description

文件读取方法和装置File reading method and device 技术领域technical field
本申请涉及计算机信息技术领域,具体涉及一种文件读取方法和装置。The present application relates to the field of computer information technology, in particular to a file reading method and device.
背景技术Background technique
在大数据时代背景下,应大量数据的快速存储需求,闪存替代磁盘成为主流的存储介质。In the context of the big data era, flash memory has become the mainstream storage medium instead of disk to meet the fast storage requirements of large amounts of data.
日志结构文件系统(Log Structured File Systems)的顺序写特性对闪存很友好,表现为良好的随机写性能。由于日志结构文件系统具有顺序写特征,因此,文件数据频繁地创建、更新和删除,会导致存储文件数据的多个数据块逻辑地址出现不连续的情况。The sequential write feature of Log Structured File Systems is very friendly to flash memory, showing good random write performance. Since the log-structured file system has a sequential writing feature, file data is frequently created, updated, and deleted, which will result in discontinuous logical addresses of multiple data blocks storing file data.
在现有技术中,从文件中读取数据时,处理器先从存储介质中读取存储数据的数据块逻辑地址,然后,将存储数据的数据块逻辑地址发送至存储介质,以使存储介质根据存储数据的数据块逻辑地址读取数据并将读取的数据返回给处理器。基于此,在存储数据的多个数据块逻辑地址连续时,处理器仅需一次性向存储介质发送第一个数据块逻辑地址和读取的数据的长度即可从存储介质中读取数据,在存储数据的多个数据块逻辑地址不连续时,处理器需要分多次向存储介质发送不连续的数据块逻辑地址方可从存储介质中读取数据。显然,在存储数据的多个数据块逻辑地址不连续时,处理器需分多次向存储介质发送不连续的数据块逻辑地址,增加了处理器与存储介质的交互次数,降低了读取文件数据的性能。In the prior art, when reading data from a file, the processor first reads the logical address of the data block storing the data from the storage medium, and then sends the logical address of the data block storing the data to the storage medium, so that the storage medium Read data according to the logical address of the data block where the data is stored and return the read data to the processor. Based on this, when the logical addresses of multiple data blocks storing data are continuous, the processor only needs to send the logical address of the first data block and the length of the read data to the storage medium once to read the data from the storage medium. When the logical addresses of multiple data blocks storing data are discontinuous, the processor needs to send the discontinuous logical addresses of the data blocks to the storage medium multiple times to read data from the storage medium. Obviously, when the logical addresses of multiple data blocks storing data are discontinuous, the processor needs to send the discontinuous logical addresses of the data blocks to the storage medium multiple times, which increases the number of interactions between the processor and the storage medium and reduces the time required for reading files. data performance.
发明内容Contents of the invention
本申请提供了一种文件读取方法和装置,用于解决读取文件数据时,处理器与存储介质的交互次数增加,读取文件数据的性能降低的问题。The present application provides a file reading method and device, which are used to solve the problem that when reading file data, the number of interactions between a processor and a storage medium increases, and the performance of reading file data decreases.
第一方面,本申请提供一种文件读取方法,应用于存储控制器,包括:通过文件读取接口获得来自处理器的文件读取请求;其中,所述文件读取请求携带目标索引节点的逻辑地址、起始偏移地址和目标数据的长度,所述目标数据为目标文件中的至少一部分数据,所述目标索引节点为所述目标文件的索引节点,所述起始偏移地址用于指示所述目标数据在所述目标文件中的起始位置,所述目标索引节点用于指示所述目标文件中的数据;根据所述目标索引节点的逻辑地址、起始偏移地址和目标数据的长度,从所述目标文件中读取所述目标数据将所述目标数据发送至所述处理器。In a first aspect, the present application provides a file reading method applied to a storage controller, including: obtaining a file reading request from a processor through a file reading interface; wherein, the file reading request carries the Logical address, start offset address and the length of the target data, the target data is at least a part of data in the target file, the target index node is the index node of the target file, and the start offset address is used for Indicate the start position of the target data in the target file, and the target index node is used to indicate the data in the target file; according to the logical address of the target index node, the start offset address and the target data length of , reading the target data from the target file and sending the target data to the processor.
由于文件读取请求携带目标索引节点的逻辑地址、起始偏移地址和目标数据的长度,且目标索引节点用于指示目标文件中的数据,目标数据为目标文件中的至少一部分数据,起始偏移地址用于指示目标数据在目标文件中的起始位置,因此,在存储控制器接收到文件读取请求后,能够根据目标索引节点的逻辑地址确定目标索引节点中指示的目标文件的数据,并根据目标文件的数据、起始偏移地址和目标数据的长度从目标文件中读取目标数据。基于此,在处理器从目标文件中读取目标数据时,处理器仅需向存储控制器发送携带 目标索引节点的逻辑地址、起始偏移地址和目标数据的长度的文件读取请求,即可使存储控制器基于文件读取请求向处理器返回目标数据。显然,在从目标文件中读取目标数据时,处理器仅需向存储控制器发送文件读取请求,相比于现有技术,无需考虑存储数据的多个数据块逻辑地址是否连续,以及在存储数据的多个数据块逻辑地址不连续时,也无需处理器分多次向存储控制器发送不连续的数据块逻辑地址,降低了处理器和存储控制器的交互次数,提高了文件读取的性能。Since the file read request carries the logical address of the target index node, the start offset address, and the length of the target data, and the target index node is used to indicate the data in the target file, the target data is at least a part of the data in the target file, and the start The offset address is used to indicate the starting position of the target data in the target file. Therefore, after the storage controller receives the file read request, it can determine the data of the target file indicated in the target inode according to the logical address of the target inode , and read the target data from the target file according to the data of the target file, the start offset address and the length of the target data. Based on this, when the processor reads the target data from the target file, the processor only needs to send a file read request carrying the logical address of the target inode, the start offset address and the length of the target data to the storage controller, namely Allows the storage controller to return target data to the processor based on a file read request. Obviously, when reading the target data from the target file, the processor only needs to send a file read request to the storage controller. Compared with the prior art, there is no need to consider whether the logical addresses of multiple data blocks storing data are continuous, and when When the logical addresses of multiple data blocks storing data are discontinuous, there is no need for the processor to send discontinuous logical addresses of data blocks to the storage controller multiple times, which reduces the number of interactions between the processor and the storage controller and improves file reading. performance.
在一种可能的实现方式中,所述目标索引节点指示所述目标文件的地址列表,其中,所述目标文件的地址列表包括多个偏移地址和多个数据块逻辑地址的一一对应关系;所述根据所述目标索引节点的逻辑地址、起始偏移地址和目标数据的长度,从所述目标文件中读取所述目标数据包括:根据所述目标索引节点的逻辑地址确定所述目标索引节点;根据所述目标数据的长度和所述起始偏移地址,并结合所述目标索引节点指示的所述目标文件的地址列表,确定所述目标数据对应的数据块逻辑地址;根据所述目标数据对应的数据块逻辑地址,读取所述目标数据。In a possible implementation manner, the target index node indicates an address list of the target file, where the address list of the target file includes a one-to-one correspondence between multiple offset addresses and multiple data block logical addresses ; According to the logical address of the target index node, the start offset address and the length of the target data, reading the target data from the target file includes: determining the target index node according to the logical address The target index node; according to the length of the target data and the start offset address, and in combination with the address list of the target file indicated by the target index node, determine the logical address of the data block corresponding to the target data; according to The logical address of the data block corresponding to the target data is used to read the target data.
在一种可能的实现方式中,所述目标索引节点包括多个直接指针、多个一级间接指针、多个二级间接指针、至少一个三级间接指针;所述指针的优先级由高到低的顺序依次为:所述多个直接指针、所述多个一级间接指针、所述多个二级间接指针、所述至少一个三级间接指针;按照优先级由高到低的顺序,所述多个直接指针、多个一级间接指针、多个二级间接指针、至少一个三级间接指针中的至少一项用于指示所述目标文件的地址列表。In a possible implementation manner, the target index node includes multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer; the priority of the pointers is from high to The lower order is: the plurality of direct pointers, the plurality of first-level indirect pointers, the plurality of second-level indirect pointers, and the at least one third-level indirect pointer; according to the order of priority from high to low, At least one of the multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer is used to indicate the address list of the target file.
在一种可能的实现方式中所述根据所述目标数据的长度和所述起始偏移地址,并结合所述目标索引节点指示的所述目标文件的地址列表,确定所述目标数据对应的数据块逻辑地址包括:根据所述目标数据的长度和所述起始偏移地址,并基于所述多个直接指针、所述多个一级间接指针、所述多个二级间接指针或所述至少一个三级间接指针中的至少一项所指示的目标文件的地址列表,确定所述目标数据对应的数据块逻辑地址。In a possible implementation manner, according to the length of the target data and the start offset address, combined with the address list of the target file indicated by the target inode, determine the address corresponding to the target data The logical address of the data block includes: according to the length of the target data and the start offset address, and based on the multiple direct pointers, the multiple primary indirect pointers, the multiple secondary indirect pointers, or the multiple an address list of the target file indicated by at least one of the at least one three-level indirect pointer, and determine the logical address of the data block corresponding to the target data.
在一种可能的实现方式中所述目标索引节点中存储所述目标文件的数据;所述根据所述目标索引节点的逻辑地址、起始偏移地址和目标数据的长度,从所述目标文件中读取所述目标数据包括:根据所述目标索引节点的逻辑地址确定所述目标索引节点;根据所述起始偏移地址和所述目标数据的长度,从所述目标索引节点中存储的所述目标文件的数据中读取所述目标数据。In a possible implementation manner, the data of the target file is stored in the target index node; according to the logical address of the target index node, the starting offset address and the length of the target data, from the target file Reading the target data includes: determining the target index node according to the logical address of the target index node; according to the start offset address and the length of the target data, from the The target data is read from data in the target file.
在一种可能的实现方式中,所述目标索引节点包括多个直接指针、多个一级间接指针、多个二级间接指针、至少一个三级间接指针;所述指针的优先级由高到低的顺序依次为:所述多个直接指针、所述多个一级间接指针、所述多个二级间接指针、所述至少一个三级间接指针;在所述目标文件的大小小于或等于第一预设值的情况下:所述多个直接指针用于存储所述目标文件的数据;所述根据所述起始偏移地址和所述目标数据的长度,从所述目标索引节点中存储的所述目标文件的数据中读取所述目标数据包括:根据所述起始偏移地址和所述目标数据的长度,从所述多个直接指针中存储的目标文件的数据中读取所述目标数据。In a possible implementation manner, the target index node includes multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer; the priority of the pointers is from high to The lower order is: the plurality of direct pointers, the plurality of first-level indirect pointers, the plurality of second-level indirect pointers, and the at least one third-level indirect pointer; when the size of the target file is less than or equal to In the case of the first preset value: the multiple direct pointers are used to store the data of the target file; according to the starting offset address and the length of the target data, from the target index node Reading the target data from the stored data of the target file includes: reading from the data of the target file stored in the plurality of direct pointers according to the start offset address and the length of the target data the target data.
第二方面,本申请提供一种文件读取方法,应用于处理器,包括:通过文件读取接口向所述存储控制器发送文件读取请求;其中,所述文件读取请求携带目标索引节点的逻辑 地址、起始偏移地址和目标数据的长度,所述目标数据为目标文件中的至少一部分数据,所述目标索引节点为所述目标文件的索引节点,所述起始偏移地址用于指示所述目标数据在所述目标文件中的起始位置,所述目标索引节点用于指示所述目标文件中的数据;接收所述存储控制器响应于所述文件读取请求返回的所述目标数据。In a second aspect, the present application provides a file reading method applied to a processor, including: sending a file reading request to the storage controller through a file reading interface; wherein, the file reading request carries a target index node The logical address, the start offset address and the length of the target data, the target data is at least a part of the data in the target file, the target index node is the index node of the target file, and the start offset address is used In order to indicate the starting position of the target data in the target file, the target index node is used to indicate the data in the target file; receiving the returned by the storage controller in response to the file read request the target data.
第三方面,本申请提供一种文件读取装置,应用于存储控制器,包括:获得模块,用于通过文件读取接口获得来自处理器的文件读取请求;其中,所述文件读取请求携带目标索引节点的逻辑地址、起始偏移地址和目标数据的长度,所述目标数据为目标文件中的至少一部分数据,所述目标索引节点为所述目标文件的索引节点,所述起始偏移地址用于指示所述目标数据在所述目标文件中的起始位置,所述目标索引节点用于指示所述目标文件中的数据;读取模块,用于根据所述目标索引节点的逻辑地址、起始偏移地址和目标数据的长度,从所述目标文件中读取所述目标数据;发送模块,用于将所述目标数据发送至所述处理器。In a third aspect, the present application provides a file reading device, which is applied to a storage controller, including: an obtaining module, configured to obtain a file reading request from a processor through a file reading interface; wherein, the file reading request carry the logical address of the target index node, the start offset address and the length of the target data, the target data is at least a part of data in the target file, the target index node is the index node of the target file, and the start The offset address is used to indicate the starting position of the target data in the target file, and the target index node is used to indicate the data in the target file; the reading module is configured to The logical address, the start offset address and the length of the target data are used to read the target data from the target file; the sending module is used to send the target data to the processor.
在一种可能的实现方式中,所述目标索引节点指示所述目标文件的地址列表,其中,所述目标文件的地址列表包括多个偏移地址和多个数据块逻辑地址的一一对应关系;所述读取模块,具体用于根据所述目标索引节点的逻辑地址确定所述目标索引节点;根据所述目标数据的长度和所述起始偏移地址,并结合所述目标索引节点指示的所述目标文件的地址列表,确定所述目标数据对应的数据块逻辑地址;根据所述目标数据对应的数据块逻辑地址,读取所述目标数据。In a possible implementation manner, the target index node indicates an address list of the target file, where the address list of the target file includes a one-to-one correspondence between multiple offset addresses and multiple data block logical addresses ; The reading module is specifically configured to determine the target index node according to the logical address of the target index node; according to the length of the target data and the starting offset address, combined with the target index node indication The address list of the target file, determine the logical address of the data block corresponding to the target data; read the target data according to the logical address of the data block corresponding to the target data.
在一种可能的实现方式中,所述目标索引节点包括多个直接指针、多个一级间接指针、多个二级间接指针、至少一个三级间接指针;所述指针的优先级由高到低的顺序依次为:所述多个直接指针、所述多个一级间接指针、所述多个二级间接指针、所述至少一个三级间接指针;按照优先级由高到低的顺序,所述多个直接指针、多个一级间接指针、多个二级间接指针、至少一个三级间接指针中的至少一项用于指示所述目标文件的地址列表。In a possible implementation manner, the target index node includes multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer; the priority of the pointers is from high to The lower order is: the plurality of direct pointers, the plurality of first-level indirect pointers, the plurality of second-level indirect pointers, and the at least one third-level indirect pointer; according to the order of priority from high to low, At least one of the multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer is used to indicate the address list of the target file.
在一种可能的实现方式中,所述读取模块,具体用于根据所述目标数据的长度和所述起始偏移地址,并基于所述多个直接指针、所述多个一级间接指针、所述多个二级间接指针或所述至少一个三级间接指针中的至少一项所指示的目标文件的地址列表,确定所述目标数据对应的数据块逻辑地址。In a possible implementation manner, the reading module is specifically configured to, according to the length of the target data and the start offset address, based on the multiple direct pointers, the multiple first The pointer, the address list of the target file indicated by at least one of the multiple secondary indirect pointers or the at least one tertiary indirect pointer determines the logical address of the data block corresponding to the target data.
在一种可能的实现方式中,所述目标索引节点中存储所述目标文件的数据;所述读取模块,具体用于根据所述目标索引节点的逻辑地址确定所述目标索引节点;根据所述起始偏移地址和所述目标数据的长度,从所述目标索引节点中存储的所述目标文件的数据中读取所述目标数据。In a possible implementation manner, the target index node stores the data of the target file; the reading module is specifically configured to determine the target index node according to the logical address of the target index node; according to the Read the target data from the data of the target file stored in the target index node according to the start offset address and the length of the target data.
在一种可能的实现方式中,所述目标索引节点包括多个直接指针、多个一级间接指针、多个二级间接指针、至少一个三级间接指针;所述指针的优先级由高到低的顺序依次为:所述多个直接指针、所述多个一级间接指针、所述多个二级间接指针、所述至少一个三级间接指针;在所述目标文件的大小小于或等于第一预设值的情况下:所述多个直接指针用于存储所述目标文件的数据;所述读取模块,具体用于根据所述起始偏移地址和所述目标数据的长度,从所述多个直接指针中存储的目标文件的数据中读取所述目标数据。In a possible implementation manner, the target index node includes multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer; the priority of the pointers is from high to The lower order is: the plurality of direct pointers, the plurality of first-level indirect pointers, the plurality of second-level indirect pointers, and the at least one third-level indirect pointer; when the size of the target file is less than or equal to In the case of the first preset value: the multiple direct pointers are used to store the data of the target file; the reading module is specifically configured to, according to the starting offset address and the length of the target data, The target data is read from the data of the target file stored in the plurality of direct pointers.
第四方面,本申请提供一种文件读取装置,应用于处理器,包括:发送模块,用于通 过文件读取接口向所述存储控制器发送文件读取请求;其中,所述文件读取请求携带目标索引节点的逻辑地址、起始偏移地址和目标数据的长度,所述目标数据为目标文件中的至少一部分数据,所述目标索引节点为所述目标文件的索引节点,所述起始偏移地址用于指示所述目标数据在所述目标文件中的起始位置,所述目标索引节点用于指示所述目标文件中的数据;接收模块,用于接收所述存储控制器响应于所述文件读取请求返回的所述目标数据。In a fourth aspect, the present application provides a file reading device, which is applied to a processor, including: a sending module, configured to send a file reading request to the storage controller through a file reading interface; wherein, the file reading The request carries the logical address of the target index node, the start offset address and the length of the target data, the target data is at least a part of data in the target file, the target index node is the index node of the target file, and the start The starting offset address is used to indicate the starting position of the target data in the target file, and the target index node is used to indicate the data in the target file; the receiving module is used to receive the storage controller response The target data returned by the file read request.
第五方面,本申请提供一种计算机可读存储介质,包括计算机程序,所述计算机程序在存储控制器或处理器上被执行时,使得所述存储控制器执行第一方面中任一项所述的方法,或使得所述处理器执行第二方面所述的方法。In a fifth aspect, the present application provides a computer-readable storage medium, including a computer program. When the computer program is executed on a storage controller or a processor, the storage controller executes any one of the above-mentioned steps in the first aspect. The method described above, or causing the processor to execute the method described in the second aspect.
第六方面,本申请提供一种计算机程序,当所述计算机程序被存储控制器或处理器执行时,用于执行第一方面或第二方面中任一项所述的方法。In a sixth aspect, the present application provides a computer program, which is used to execute the method described in any one of the first aspect or the second aspect when the computer program is executed by a storage controller or a processor.
第七方面,本申请提供一种电子设备,包括:处理器和存储控制器,其中;所述存储控制器用于执行第一方面中任一项所述的方法;所述处理器用于执行第二方面所述的方法。In a seventh aspect, the present application provides an electronic device, including: a processor and a storage controller, wherein; the storage controller is configured to execute the method described in any one of the first aspect; and the processor is configured to execute the second method described in the aspect.
附图说明Description of drawings
图1示出了采用顺序写的方式将文件A(FileA)写入存储介质的示意图;FIG. 1 shows a schematic diagram of writing a file A (FileA) into a storage medium in a sequential writing manner;
图2示出了采用顺序写的方式将文件A(FileA)中的数据进行更新的示意图;FIG. 2 shows a schematic diagram of updating data in File A (FileA) by sequential writing;
图3为本申请实施例提供的电子设备的结构示意图;FIG. 3 is a schematic structural diagram of an electronic device provided in an embodiment of the present application;
图4为本申请实施例提供的文件读取方法的流程示意图;FIG. 4 is a schematic flow diagram of a file reading method provided in an embodiment of the present application;
图5本申请实施例提供的文件读取接口的示意图;Fig. 5 is a schematic diagram of the file reading interface provided by the embodiment of the present application;
图6为本申请实施例提供的存储控制器读取目标数据的流程示意图;FIG. 6 is a schematic flow diagram of a storage controller reading target data provided by an embodiment of the present application;
图7为本申请实施例提供的目标索引节点的结构示意图;FIG. 7 is a schematic structural diagram of a target index node provided by an embodiment of the present application;
图8为本申请实施例提供的读取目标数据的流程示意图一;FIG. 8 is a first schematic flow diagram of reading target data provided by the embodiment of the present application;
图9为本申请实施例提供的读取目标数据的流程示意图二;FIG. 9 is a second schematic flow diagram of reading target data provided by the embodiment of the present application;
图10为本申请实施例提供的读取目标数据的流程示意图三;FIG. 10 is the third schematic flow chart of reading target data provided by the embodiment of the present application;
图11为本申请实施例提供的读取目标数据的流程示意图四;FIG. 11 is the fourth schematic flow diagram of reading target data provided by the embodiment of the present application;
图12为本申请实施例提供的文件读取装置的结构示意图一;FIG. 12 is a first structural schematic diagram of a document reading device provided by an embodiment of the present application;
图13为本申请实施例提供的文件读取装置的结构示意图二。FIG. 13 is a second structural schematic diagram of the document reading device provided by the embodiment of the present application.
具体实施方式Detailed ways
下面将结合附图,对本申请中的技术方案进行描述。The technical solution in this application will be described below with reference to the accompanying drawings.
为使本申请的目的、技术方案和优点更加清楚,下面将结合本申请中的附图,对本申请中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the accompanying drawings in this application. Obviously, the described embodiments are part of the embodiments of this application , but not all examples. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of this application.
本申请的说明书实施例和权利要求书及附图中的术语“第一”、“第二”等仅用于区分描述的目的,而不能理解为指示或暗示相对重要性,也不能理解为指示或暗示顺序。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如, 包含了一系列步骤或单元。方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。、The terms "first" and "second" in the description, embodiments, claims and drawings of the present application are only used for the purpose of distinguishing descriptions, and cannot be interpreted as indicating or implying relative importance, nor can they be interpreted as indicating or imply order. Furthermore, the terms "comprising" and "having", as well as any variations thereof, are intended to cover a non-exclusive inclusion, for example, a series of steps or elements are included. A method, system, product or device is not necessarily limited to those steps or elements explicitly listed, but may include other steps or elements not explicitly listed or inherent to the process, method, product or device. ,
应当理解,在本申请中,“至少一个(项)”是指一个或者多个,“多个”是指两个或两个以上。“和/或”,用于描述关联对象的关联关系,表示可以存在三种关系,例如,“A和/或B”可以表示:只存在A,只存在B以及同时存在A和B三种情况,其中A,B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。“以下至少一项(个)”或其类似表达,是指这些项中的任意组合,包括单项(个)或复数项(个)的任意组合。例如,a,b或c中的至少一项(个),可以表示:a,b,c,“a和b”,“a和c”,“b和c”,或“a和b和c”,其中a,b,c可以是单个,也可以是多个。It should be understood that in this application, "at least one (item)" means one or more, and "multiple" means two or more. "And/or" is used to describe the association relationship of associated objects, indicating that there can be three types of relationships, for example, "A and/or B" can mean: only A exists, only B exists, and A and B exist at the same time , where A and B can be singular or plural. The character "/" generally indicates that the contextual objects are an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one item (piece) of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c ", where a, b, c can be single or multiple.
日志结构文件系统用于对存储介质中存储的文件数据进行管理。存储介质包括但不限于闪存等具有顺序写特性的存储介质。存储介质的顺序写特性指在对存储介质执行写操作时,按照存储介质中的数据块的物理地址由小到大的顺序将数据写入。The log-structured file system is used to manage the file data stored in the storage medium. The storage medium includes, but is not limited to, a storage medium with sequential write characteristics such as a flash memory. The sequential write characteristic of the storage medium means that when performing a write operation on the storage medium, data is written in the order in which the physical addresses of the data blocks in the storage medium are from small to large.
需要说明的是,写操作包括但不限于将文件数据写入存储介质中、将更新后的文件数据写入存储介质中等。It should be noted that the write operation includes but is not limited to writing file data into a storage medium, writing updated file data into a storage medium, and the like.
在基于日志结构文件系统的文件管理方式中,文件数据存储在存储介质中的多个数据块中,存储文件数据的多个数据块的数量由文件数据的大小和单个数据块的容量确定。文件的元数据存储在一个节点中。文件的元数据包括但不限于文件的所有者、文件的读、写、执行权限、文件的时间戳等。将存储文件的元数据的节点确定为文件的索引节点。In a file management method based on a log-structured file system, file data is stored in multiple data blocks in a storage medium, and the number of multiple data blocks storing file data is determined by the size of the file data and the capacity of a single data block. A file's metadata is stored in a node. The metadata of a file includes, but is not limited to, the owner of the file, the read, write, and execute permissions of the file, and the time stamp of the file. A node storing metadata of a file is determined as an index node of the file.
文件的索引节点不仅存储文件的元数据,还用于存储文件的数据或者存储文件的地址列表等。文件的地址列表包括多个偏移地址和多个数据块逻辑地址的一一对应关系,多个数据块逻辑地址所指示的多个数据块中存储的数据为文件的数据,多个偏移地址中的每个偏移地址用于指示对应的数据块逻辑地址所指示的数据块中存储的数据在文件中的位置。The index node of the file not only stores the metadata of the file, but is also used to store the data of the file or store the address list of the file, etc. The address list of the file includes a one-to-one correspondence between multiple offset addresses and multiple data block logical addresses. The data stored in the multiple data blocks indicated by the multiple data block logical addresses is the data of the file, and the multiple offset addresses Each offset address in is used to indicate the position of the data stored in the data block indicated by the logical address of the corresponding data block in the file.
需要说明的是,文件的索引节点还可以具有至少一个关联节点。若文件的索引节点无法完全容纳文件的地址列表,则将未被容纳在文件的索引节点中的地址列表存储在文件的索引节点的至少一个关联节点中。It should be noted that the index node of the file may also have at least one associated node. If the file's index node cannot completely accommodate the file's address list, the address list not accommodated in the file's index node is stored in at least one associated node of the file's index node.
日志文件结构系统的顺序写特性指按照存储介质中数据块的物理地址从小到大的顺序,将数据写入未被占用的数据块中。The sequential writing feature of the log file structure system refers to writing data into unoccupied data blocks according to the order of physical addresses of the data blocks in the storage medium from small to large.
图1示出了采用顺序写的方式将文件A(FileA)写入存储介质的示意图。图1(a)用于指示文件A(File A)的索引节点(inode)中的地址列表。该地址列表包括文件A的三个偏移地址Offset1~Offset3和三个数据块逻辑地址LBA1~LBA3,其中,三个偏移地址Offset1~Offset3和三个数据块逻辑地址LBA1~LBA3一一对应,对应关系如图1(a)所示。图1(b)用于指示文件A的三个偏移地址Offset1~Offset3与三个数据块逻辑地址LBA1~LBA3的一一映射关系。图1(c)用于指示数据块逻辑地址LBA1~LBA5与数据块物理地址PPN1~PPN5的一一映射关系。FIG. 1 shows a schematic diagram of writing a file A (FileA) into a storage medium in a sequential writing manner. Figure 1(a) is used to indicate the address list in the index node (inode) of file A (File A). The address list includes three offset addresses Offset1~Offset3 and three data block logical addresses LBA1~LBA3 of file A, wherein the three offset addresses Offset1~Offset3 correspond to the three data block logical addresses LBA1~LBA3 one by one, The corresponding relationship is shown in Figure 1(a). FIG. 1(b) is used to indicate the one-to-one mapping relationship between three offset addresses Offset1-Offset3 of file A and three logical addresses LBA1-LBA3 of data blocks. FIG. 1(c) is used to indicate the one-to-one mapping relationship between logical addresses LBA1-LBA5 of data blocks and physical addresses PPN1-PPN5 of data blocks.
由图1可知,文件A的数据被划分为三份,按照三份数据在文件A中的位置的先后顺序,将该三份数据依次存储在三个数据块中,该三个数据块的物理地址(即数据块物理地址)为PPN1~PPN3。由图1(c)所指示的映射关系可知,存储文件A的数据的三个数 据块逻辑地址为LBA1~LBA3。根据每个数据块中存储的数据在文件A中的位置,生成文件A的三个偏移地址Offset1~Offset3。三个偏移地址Offset1~Offset3与存储文件A的数据的三个数据块一一对应,其中,偏移地址用于指示对应的数据块中存储的数据在文件A中的位置。建立文件A的三个偏移地址Offset1~Offset3与三个数据块逻辑地址LBA1~LBA3的一一映射关系(如图1(b)所示),其中,数据块逻辑地址指示的数据块中存储的数据在文件A中的位置由数据块逻辑地址对应的偏移地址指示。根据文件A的三个偏移地址Offset1~Offset3与三个数据块逻辑地址LBA1~LBA3的一一映射关系构建文件A的地址列表(如图1(a)所示),将文件A的地址列表存储在文件A的索引节点(inode)中。It can be seen from Figure 1 that the data of file A is divided into three parts, and the three parts of data are stored in three data blocks in sequence according to the sequence of the positions of the three data parts in file A, and the physical data of the three data blocks The addresses (that is, the physical addresses of the data blocks) are PPN1-PPN3. From the mapping relationship indicated in Figure 1(c), it can be known that the logical addresses of the three data blocks storing the data of file A are LBA1-LBA3. According to the position of the data stored in each data block in the file A, three offset addresses Offset1-Offset3 of the file A are generated. The three offset addresses Offset1-Offset3 are in one-to-one correspondence with the three data blocks storing the data of the file A, wherein the offset addresses are used to indicate the position of the data stored in the corresponding data block in the file A. Establish a one-to-one mapping relationship between the three offset addresses Offset1~Offset3 of file A and the logical addresses LBA1~LBA3 of the three data blocks (as shown in Figure 1(b)), wherein the data block indicated by the logical address of the data block is stored in The position of the data in file A is indicated by the offset address corresponding to the logical address of the data block. According to the one-to-one mapping relationship between the three offset addresses Offset1~Offset3 of file A and the logical addresses LBA1~LBA3 of three data blocks, the address list of file A is constructed (as shown in Figure 1(a)), and the address list of file A Stored in the index node (inode) of file A.
显然,在图1中,存储文件A的数据的三个数据块逻辑地址是连续的。Obviously, in FIG. 1, the logical addresses of the three data blocks storing the data of file A are continuous.
图2示出了采用顺序写的方式将文件A(FileA)中的数据进行更新的示意图。在图2中,采用顺序写的方式对偏移地址Offset1~Offset2所指示的位置上的数据进行更新的过程如下:FIG. 2 shows a schematic diagram of updating data in File A (FileA) in a sequential writing manner. In Figure 2, the process of updating the data at the positions indicated by the offset addresses Offset1~Offset2 by sequential writing is as follows:
对偏移地址Offset2所指示的位置上的数据进行更新,并将更新后的数据写入物理地址为PPN4的数据块中。根据图2(c)指示的映射关系可知,存储更新后的数据的数据块逻辑地址为LBA4。在图2(b)中建立数据块逻辑地址LBA4与偏移地址Offset2的映射关系,以及将建立的映射关系更新到文件A的地址列表中。如图2(a)所示,偏移地址Offset2对应的数据块逻辑地址从LBA2变更为LBA4。The data at the position indicated by the offset address Offset2 is updated, and the updated data is written into the data block whose physical address is PPN4. According to the mapping relationship indicated in FIG. 2( c ), it can be known that the logical address of the data block storing the updated data is LBA4. In FIG. 2( b ), the mapping relationship between the logical address LBA4 of the data block and the offset address Offset2 is established, and the established mapping relationship is updated into the address list of file A. As shown in FIG. 2(a), the logical address of the data block corresponding to the offset address Offset2 is changed from LBA2 to LBA4.
对偏移地址Offset1所指示的位置上的数据进行更新,并将更新后的数据写入物理地址为PPN5的数据块中。根据图2(c)指示的映射关系可知,存储更新后的数据的数据块逻辑地址为LBA5。在图2(b)中建立数据块逻辑地址为LBA5与偏移地址Offset1的映射关系,以及将建立的映射关系更新到文件A的地址列表中。如图2(a)所示,偏移地址Offset1对应的数据块逻辑地址从LBA1变更为LBA5。The data at the position indicated by the offset address Offset1 is updated, and the updated data is written into the data block whose physical address is PPN5. According to the mapping relationship indicated in FIG. 2( c ), it can be known that the logical address of the data block storing the updated data is LBA5. In FIG. 2( b ), the mapping relationship between the logical address of the data block LBA5 and the offset address Offset1 is established, and the established mapping relationship is updated to the address list of file A. As shown in FIG. 2(a), the logical address of the data block corresponding to the offset address Offset1 is changed from LBA1 to LBA5.
由上可知,由于采用了顺序写的方式,因此,对偏移地址Offset1~Offset2所指示的位置上的数据进行更新时,不是将更新后的数据写入原来的数据块中,而是将更新后的数据依次写入未被占用的数据块中。It can be seen from the above that due to the sequential writing method, when updating the data at the positions indicated by the offset addresses Offset1~Offset2, the updated data is not written into the original data block, but the updated The subsequent data are sequentially written into unoccupied data blocks.
显然,在对偏移地址Offset1~Offset2所指示的位置上的数据更新后,偏移地址Offset1~Offset3对应的数据块逻辑地址依次为LBA5、LBA4、LBA3。根据偏移地址Offset1~Offset3由小到大的顺序对对应的数据块逻辑地址排序后的结果为LBA5~LBA3,由于LBA5~LBA3虽然是连续的,但是LBA5~LBA3不是按照由小到大的顺序排列,因此,偏移地址Offset1~Offset3对应的数据块逻辑地址LBA5~LBA3是不连续的。Obviously, after updating the data at the positions indicated by the offset addresses Offset1-Offset2, the logical addresses of the data blocks corresponding to the offset addresses Offset1-Offset3 are LBA5, LBA4, and LBA3 in sequence. According to the order of offset addresses Offset1~Offset3 from small to large, the result of sorting the logical addresses of the corresponding data blocks is LBA5~LBA3. Although LBA5~LBA3 are continuous, LBA5~LBA3 are not in the order from small to large Therefore, the logical addresses LBA5-LBA3 of the data blocks corresponding to the offset addresses Offset1-Offset3 are discontinuous.
由于读取文件中的目标数据时,按照偏移地址由小到大的顺序读取。因此,若文件的多个偏移地址对应的多个数据块逻辑地址连续,即按照文件的偏移地址由小到大的顺序对对应的多个数据块逻辑地址排序后,排序后的多个数据块逻辑地址是连续的且按照由小到大的顺序排列,则在现有技术中,读取文件中的目标数据的过程为:When reading the target data in the file, the offset addresses are read in ascending order. Therefore, if the logical addresses of multiple data blocks corresponding to multiple offset addresses of the file are continuous, that is, after sorting the logical addresses of the corresponding multiple data blocks according to the order of the offset addresses of the file from small to large, the sorted multiple The logical addresses of the data blocks are continuous and arranged in ascending order, so in the prior art, the process of reading the target data in the file is:
处理器向存储介质中的存储控制器发送文件的索引节点的逻辑地址。存储介质中的存储控制器根据文件的索引节点的逻辑地址确定索引节点的物理地址,根据索引节点的物理地址获得文件的地址列表,将文件的地址列表反馈给处理器。处理器根据文件的地址列表 确定起始偏移地址对应的数据块逻辑地址,并将起始偏移地址对应的数据块逻辑地址和目标数据的长度发送至存储介质中的存储控制器。起始偏移地址用于指示目标数据在文件中的起始位置。存储介质中的存储控制器从起始偏移地址对应的数据块逻辑地址所指示的数据块开始依次向后读取数据块中的数据,直至读取的数据块的长度等于目标数据的长度,将读取的数据确定为目标数据,将目标数据发送至处理器。The processor sends the logical address of the inode of the file to the storage controller in the storage medium. The storage controller in the storage medium determines the physical address of the index node according to the logical address of the index node of the file, obtains the address list of the file according to the physical address of the index node, and feeds back the address list of the file to the processor. The processor determines the logical address of the data block corresponding to the starting offset address according to the address list of the file, and sends the logical address of the data block corresponding to the starting offset address and the length of the target data to the storage controller in the storage medium. The starting offset address is used to indicate the starting position of the target data in the file. The storage controller in the storage medium reads the data in the data block sequentially from the data block indicated by the data block logical address corresponding to the start offset address until the length of the read data block is equal to the length of the target data, The read data is determined as target data, and the target data is sent to the processor.
例如,在图1的基础上,读取文件A中的偏移地址Offset1~Offset3对应的数据时,处理器仅需根据文件A的地址列表确定偏移地址Offset1(即起始偏移地址)对应的数据块逻辑地址LBA1,并将数据块逻辑地址LBA1和偏移地址Offset1~Offset3对应的数据的长度发送至存储介质中的存储控制器中即可。存储介质中的存储控制器从数据块逻辑地址LBA1所指示的数据块开始向后依次读取数据块中的数据,即读取数据块逻辑地址LBA1~LBA3所指示的数据块中的数据,以得到偏移地址Offset1~Offset3对应的数据。For example, on the basis of Figure 1, when reading data corresponding to offset addresses Offset1~Offset3 in file A, the processor only needs to determine the offset address Offset1 (that is, the starting offset address) corresponding to The data block logical address LBA1, and the data length corresponding to the data block logical address LBA1 and offset addresses Offset1-Offset3 are sent to the storage controller in the storage medium. The storage controller in the storage medium reads the data in the data block sequentially backward from the data block indicated by the data block logical address LBA1, that is, reads the data in the data block indicated by the data block logical address LBA1~LBA3, to Obtain the data corresponding to the offset addresses Offset1~Offset3.
若文件的多个偏移地址对应的多个数据块逻辑地址不连续,则在现有技术中,读取文件中的目标数据的过程为:If the logical addresses of multiple data blocks corresponding to the multiple offset addresses of the file are discontinuous, then in the prior art, the process of reading the target data in the file is:
处理器向存储介质中的存储控制器发送文件的索引节点的逻辑地址。存储介质中的存储控制器根据文件的索引节点的逻辑地址确定索引节点的物理地址,根据索引节点的物理地址获得文件的地址列表,将文件的地址列表反馈给处理器。处理器根据文件的地址列表并结合起始偏移地址和目标数据的长度,确定目标数据对应的不连续的多个数据块逻辑地址,将目标数据对应的不连续的多个数据块逻辑地址分次发送至存储介质的存储控制器中。存储介质中的存储控制器根据目标数据对应的不连续的多个数据块逻辑地址读取目标数据,并将目标数据发送至处理器,其中,目标数据对应的不连续的多个数据块逻辑地址所指示的数据块中存储有目标数据。The processor sends the logical address of the inode of the file to the storage controller in the storage medium. The storage controller in the storage medium determines the physical address of the index node according to the logical address of the index node of the file, obtains the address list of the file according to the physical address of the index node, and feeds back the address list of the file to the processor. According to the address list of the file and combined with the start offset address and the length of the target data, the processor determines the logical addresses of multiple discontinuous data blocks corresponding to the target data, and divides the logical addresses of multiple discontinuous data blocks corresponding to the target data into sent to the storage controller of the storage medium. The storage controller in the storage medium reads the target data according to the logical addresses of multiple discontinuous data blocks corresponding to the target data, and sends the target data to the processor, wherein the logical addresses of the multiple discontinuous data blocks corresponding to the target data Target data is stored in the indicated data block.
例如,在图2的基础上,读取文件A中的偏移地址Offset1~Offset3对应的数据时,处理器需要确定偏移地址Offset1~Offset3对应的数据块逻辑地址LBA5、LBA4、LBA3,然后,先将数据块逻辑地址LBA5发送至存储介质中的存储控制器,然后,再将数据块逻辑地址LBA4发送至存储介质中的存储控制器,最后,将数据块逻辑地址LBA3发送至存储介质中的存储控制器。存储介质中的存储控制器读取数据块逻辑地址LBA5、LBA4、LBA3所指示的数据块中的数据,以得到偏移地址Offset1~Offset3对应的数据。For example, on the basis of Figure 2, when reading the data corresponding to offset addresses Offset1~Offset3 in file A, the processor needs to determine the data block logical addresses LBA5, LBA4, and LBA3 corresponding to offset addresses Offset1~Offset3, and then, First send the logical address LBA5 of the data block to the storage controller in the storage medium, then send the logical address LBA4 of the data block to the storage controller in the storage medium, and finally send the logical address LBA3 of the data block to the storage controller in the storage medium storage controller. The storage controller in the storage medium reads the data in the data blocks indicated by the data block logical addresses LBA5 , LBA4 , and LBA3 to obtain the data corresponding to the offset addresses Offset1˜Offset3.
显然,在现有技术中,若文件的多个偏移地址对应的多个数据块逻辑地址连续,则在读取文件中的目标数据时,处理器仅需向存储介质中的存储控制器发送起始偏移地址对应的数据块逻辑地址和目标数据的长即可。但是,若文件的多个偏移地址对应的多个数据块逻辑地址不连续,则在读取文件中的目标数据时,处理器需分多次将目标数据对应的多个数据块逻辑地址发送至存储介质中的存储控制器,增加了处理器和存储介质之间的交互次数,导致文件读取性能下降,同时还增加了处理器的开销。Obviously, in the prior art, if the logical addresses of multiple data blocks corresponding to the multiple offset addresses of the file are continuous, when reading the target data in the file, the processor only needs to send The logical address of the data block corresponding to the start offset address and the length of the target data are sufficient. However, if the logical addresses of multiple data blocks corresponding to multiple offset addresses of the file are discontinuous, when reading the target data in the file, the processor needs to send the logical addresses of multiple data blocks corresponding to the target data multiple times. To the storage controller in the storage medium, the number of interactions between the processor and the storage medium is increased, resulting in a decrease in file reading performance, and at the same time increasing the overhead of the processor.
为了解决上述技术问题,本申请提供了一种电子设备,该电子设备采用日志结构文件系统对文件数据进行管理。日志结构文件系统包括但不限于F2FS、Btrfs、zoneFs等。电子设备包括但不限于手机、电脑、电子阅读器等。如图3所示,电子设备包括处理器310和存储器320。其中,处理器310用于从存储器320中读取目标文件中的目标数据。目标 数据可以为目标文件中的至少一部分数据,即目标数据可以为目标文件中的一部分数据,也可以为目标文件中的全部数据。In order to solve the above technical problems, the present application provides an electronic device, which uses a log-structured file system to manage file data. Log-structured file systems include but are not limited to F2FS, Btrfs, zoneFs, etc. Electronic devices include but are not limited to mobile phones, computers, e-readers, etc. As shown in FIG. 3 , the electronic device includes a processor 310 and a memory 320 . Wherein, the processor 310 is configured to read the target data in the target file from the memory 320 . The target data can be at least a part of the data in the target file, that is, the target data can be a part of the data in the target file, or all the data in the target file.
处理器310包括但不限于中央处理单元(CPU)、微控制器(MCU)、数字信号处理器(DSP)、神经处理单元(NPU)或微处理器等。The processor 310 includes, but is not limited to, a central processing unit (CPU), a microcontroller (MCU), a digital signal processor (DSP), a neural processing unit (NPU), or a microprocessor.
存储器320例如可以为电子设备中的存储器,还可以为与电子设备连接的外部存储器。存储器包括但不限于闪存等具有顺序写特性的存储介质。存储器320包括存储控制器321。The memory 320 may be, for example, a memory in the electronic device, or an external memory connected to the electronic device. The storage includes but is not limited to storage media with sequential write characteristics such as flash memory. The memory 320 includes a memory controller 321 .
处理器310用于向存储控制器321发送文件读取请求,以及,接收存储控制器321根据文件读取请求获得的目标数据。The processor 310 is configured to send a file read request to the storage controller 321, and receive target data obtained by the storage controller 321 according to the file read request.
存储控制器321用于接收并响应于文件读取请求,对目标文件进行读取,以获得目标数据,以及,将目标数据发送至处理器310。The storage controller 321 is configured to receive and respond to the file read request, read the target file to obtain target data, and send the target data to the processor 310 .
显然,在读取目标数据时,处理器310仅向存储控制器321发送一次文件读取请求即可,降低了存储控制器321和处理器310之间的交互次数,即降低了存储器320与处理器310之间的交互次数,提高了文件读取性能,降低了处理器310的开销。Obviously, when reading target data, the processor 310 only needs to send a file read request to the storage controller 321 once, which reduces the number of interactions between the storage controller 321 and the processor 310, that is, reduces the interaction between the storage controller 320 and the processing. The number of interactions between processors 310 improves file reading performance and reduces processor 310 overhead.
在下文中,对本申请提供的文件读取方法进行详细的说明。In the following, the file reading method provided by this application will be described in detail.
图4为本申请实施例提供的文件读取方法的流程示意图。如图4所示,该文件读取方法包括如下步骤:FIG. 4 is a schematic flowchart of a file reading method provided by an embodiment of the present application. As shown in Figure 4, the file reading method includes the following steps:
401.处理器310通过文件读取接口501向存储控制器321发送文件读取请求。401. The processor 310 sends a file reading request to the storage controller 321 through the file reading interface 501.
文件读取请求携带目标索引节点的逻辑地址、起始偏移地址和目标数据的长度。目标数据为目标文件中的至少一部分数据。目标索引节点为目标文件的索引节点,起始偏移地址用于指示目标数据在目标文件中的起始位置。文件读取接口如图5中的501所示。The file read request carries the logical address of the target inode, the start offset address and the length of the target data. The target data is at least a part of data in the target file. The target index node is the index node of the target file, and the starting offset address is used to indicate the starting position of the target data in the target file. The file reading interface is shown as 501 in FIG. 5 .
目标索引节点用于指示目标文件中的数据。具体的,目标索引节点可以通过存储目标文件的数据指示目标文件中的数据,目标索引节点还可以通过指示目标文件的地址列表指示目标文件的数据。其中,目标文件的地址列表包括多个偏移地址和多个数据块逻辑地址的一一对应关系,多个数据块逻辑地址所指示的多个数据块中存储的数据为目标文件的数据,多个偏移地址中的每个偏移地址用于指示对应的数据块逻辑地址所指示的数据块中存储的数据在目标文件中的位置。The target inode is used to indicate the data in the target file. Specifically, the target index node may indicate the data in the target file by storing the data of the target file, and the target index node may also indicate the data of the target file by indicating the address list of the target file. Wherein, the address list of the target file includes a one-to-one correspondence between a plurality of offset addresses and a plurality of data block logical addresses, and the data stored in the plurality of data blocks indicated by the plurality of data block logical addresses is the data of the target file. Each of the offset addresses is used to indicate the location of the data stored in the data block indicated by the logical address of the corresponding data block in the target file.
402.存储控制器321通过文件读取接口501接收文件读取请求。402. The storage controller 321 receives a file reading request through the file reading interface 501.
403.存储控制器321响应于文件读取请求,从目标文件中读取目标数据。具体的,根据文件读取请求中携带的目标索引节点的逻辑地址、起始偏移地址和目标数据的长度,从目标文件中读取目标数据。403. The storage controller 321 reads the target data from the target file in response to the file read request. Specifically, the target data is read from the target file according to the logical address of the target index node carried in the file read request, the start offset address, and the length of the target data.
404.存储控制器321向处理器310发送目标数据。404. The storage controller 321 sends the target data to the processor 310.
405.处理器310接收目标数据。405. The processor 310 receives the target data.
由于文件读取请求携带目标索引节点的逻辑地址、起始偏移地址和目标数据的长度,且目标索引节点用于指示目标文件中的数据,目标数据为目标文件中的至少一部分数据,起始偏移地址用于指示目标数据在目标文件中的起始位置,因此,在存储控制器321接收到文件读取请求后,能够根据目标索引节点的逻辑地址确定目标索引节点中指示的目标文件的数据,并根据目标文件的数据、起始偏移地址和目标数据的长度从目标文件中读取目 标数据。基于此,在处理器310从目标文件中读取目标数据时,处理器310仅需向存储控制器321发送携带目标索引节点的逻辑地址、起始偏移地址和目标数据的长度的文件读取请求,即可使存储控制器321基于文件读取请求向处理器310返回目标数据。显然,在从目标文件中读取目标数据时,处理器310仅需向存储控制器321发送文件读取请求,相比于现有技术,无需考虑存储数据的多个数据块逻辑地址是否连续,以及在存储数据的多个数据块逻辑地址不连续时,也无需处理器310分多次向存储控制器321发送不连续的数据块逻辑地址,降低了处理器310和存储控制器321的交互次数,提高了文件读取的性能。Since the file read request carries the logical address of the target index node, the start offset address, and the length of the target data, and the target index node is used to indicate the data in the target file, the target data is at least a part of the data in the target file, and the start The offset address is used to indicate the starting position of the target data in the target file. Therefore, after the storage controller 321 receives the file read request, it can determine the address of the target file indicated in the target index node according to the logical address of the target index node. data, and read the target data from the target file according to the data of the target file, the start offset address and the length of the target data. Based on this, when the processor 310 reads the target data from the target file, the processor 310 only needs to send the file read file carrying the logical address of the target inode, the start offset address and the length of the target data to the storage controller 321. The request means that the storage controller 321 returns the target data to the processor 310 based on the file read request. Obviously, when reading the target data from the target file, the processor 310 only needs to send a file read request to the storage controller 321. Compared with the prior art, it is not necessary to consider whether the logical addresses of multiple data blocks storing data are continuous. And when the logical addresses of a plurality of data blocks storing data are discontinuous, there is no need for the processor 310 to send the discontinuous data block logical addresses to the storage controller 321 multiple times, which reduces the number of interactions between the processor 310 and the storage controller 321 , which improves the performance of file reading.
步骤403的具体实现步骤包括但不限于以下两种:The specific implementation steps of step 403 include but are not limited to the following two:
第一种,若目标索引节点通过指示目标文件的地址列表指示目标文件的数据,则步骤403的实现步骤如图6所示:First, if the target index node indicates the data of the target file by indicating the address list of the target file, the implementation steps of step 403 are as shown in Figure 6:
601.存储控制器321根据目标索引节点的逻辑地址确定目标索引节点。601. The storage controller 321 determines the target index node according to the logical address of the target index node.
具体的,根据目标索引节点的逻辑地址确定目标索引节点的物理地址,根据目标索引节点的物理地址确定目标索引节点。Specifically, the physical address of the target index node is determined according to the logical address of the target index node, and the target index node is determined according to the physical address of the target index node.
602.存储控制器321根据目标数据的长度和起始偏移地址,并结合目标索引节点指示的目标文件的地址列表,确定目标数据对应的数据块逻辑地址。602. The storage controller 321 determines the logical address of the data block corresponding to the target data according to the length and the start offset address of the target data and in combination with the address list of the target file indicated by the target inode.
603.存储控制器321根据目标数据对应的数据块逻辑地址,读取目标数据。603. The storage controller 321 reads the target data according to the logical address of the data block corresponding to the target data.
步骤602和步骤603例如可以通过下述步骤实现:Step 602 and step 603, for example, can be realized through the following steps:
首先,存储控制器321将起始偏移地址作为待比对偏移地址,将待比对偏移地址与目标文件的地址列表中的偏移地址进行匹配,将与待比对偏移地址匹配的偏移地址对应的数据块逻辑地址确定为待比对偏移地址对应的数据块逻辑地址。First, the storage controller 321 uses the starting offset address as the offset address to be compared, matches the offset address to be compared with the offset address in the address list of the target file, and matches the offset address to be compared The logical address of the data block corresponding to the offset address is determined as the logical address of the data block corresponding to the offset address to be compared.
然后,存储控制器321根据待比对偏移地址对应的数据块逻辑地址确定待比对偏移地址对应的数据块物理地址,读取待比对偏移地址对应的数据块物理地址所指示的数据块中的数据,将读取的数据发送至处理器310。Then, the storage controller 321 determines the physical address of the data block corresponding to the offset address to be compared according to the logical address of the data block corresponding to the offset address to be compared, and reads the data block indicated by the physical address of the data block corresponding to the offset address to be compared. The data in the data block, the read data is sent to the processor 310 .
最后,确定发送至处理器310的数据的长度是否等于目标数据的长度,若否,则对待比对偏移地址进行更新,并根据更新后的待比对偏移地址重复上述过程,直至发送至处理器310的数据的长度等于目标数据的长度,若是,则停止对目标文件的读取。待比对偏移地址的更新包括但不限于对待比对偏移地址加一。Finally, determine whether the length of the data sent to the processor 310 is equal to the length of the target data, if not, update the offset address to be compared, and repeat the above process according to the updated offset address to be compared until sent to The length of the data in the processor 310 is equal to the length of the target data, if so, stop reading the target file. Updating the offset address to be compared includes, but not limited to, adding one to the offset address to be compared.
需要说明的是,在上述方式中,确定的待比对偏移地址对应的数据块逻辑地址为目标数据对应的数据块逻辑地址,发送至处理器310的数据为目标数据。It should be noted that, in the above method, the determined logical address of the data block corresponding to the offset address to be compared is the logical address of the data block corresponding to the target data, and the data sent to the processor 310 is the target data.
下面,根据日志结构文件系统和目标索引节点的结构对步骤602进行说明。Next, step 602 will be described according to the structure of the log-structured file system and the target inode.
例如,日志结构文件系统使用三种节点,分别为索引节点、直接节点和间接节点。日志结构文件系统中的索引节点(例如目标索引节点)包括两个主要部分,分别为:元数据(metadata)部分和数据块寻址部分。其中,数据块寻址部分包括多个直接指针、多个一级间接指针、多个二级间接指针、至少一个三级间接指针。其中,指针的优先级由高到低的顺序依次为:多个直接指针、多个一级间接指针、多个二级间接指针、至少一个三级间接指针。For example, a log-structured file system uses three types of nodes, index nodes, direct nodes, and indirect nodes. An index node (for example, a target index node) in a log-structured file system includes two main parts: a metadata (metadata) part and a data block addressing part. Wherein, the data block addressing part includes multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer. Wherein, the priority order of pointers from high to low is: multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer.
按照优先级由高到低的顺序,多个直接指针、多个一级间接指针、多个二级间接指针、 至少一个三级间接指针中的至少一项用于指示文件(例如目标文件)的地址列表。即,先通过优先级最高的指针(例如多个直接指针)指示文件(例如目标文件)的地址列表,若优先级最高的指针无法完全指示文件的地址列表,则可以通过增加优先级次之的指针,以共同指示目标文件的地址列表。According to the order of priority from high to low, at least one of multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer is used to indicate the file (such as the target file) address list. That is, first indicate the address list of the file (such as the target file) through the pointer with the highest priority (such as multiple direct pointers), if the pointer with the highest priority cannot fully indicate the address list of the file, you can increase the priority by increasing Pointers to collectively indicate a list of addresses for object files.
下面,对上述指针的含义进行说明。Next, the meaning of the above-mentioned pointers will be described.
直接指针:索引节点内直接指向数据块的地址数组。Direct pointer: the address array directly pointing to the data block in the index node.
一级间接指针:索引节点记录了多个一级间接指针,多个一级间接指针指示了多个直接节点的地址,每个直接节点直接指向多个数据块地址。First-level indirect pointer: the index node records multiple first-level indirect pointers, and multiple first-level indirect pointers indicate the addresses of multiple direct nodes, and each direct node directly points to multiple data block addresses.
二级间接指针,索引节点记录了多个二级间接指针,多个二级间接指针指示了多个间接节点的地址,每个间接节点中保存直接节点的nid(标识),每个直接节点指向多个数据块地址。Secondary indirect pointers, the index node records multiple secondary indirect pointers, multiple secondary indirect pointers indicate the addresses of multiple indirect nodes, each indirect node saves the nid (identification) of the direct node, and each direct node points to Multiple data block addresses.
三级间接指针,索引节点记录了至少一个三级间接指针,每个三级间接指针指示了一个间接节点的地址,每个三级间接指针记录了多个二级间接指针,即每个三级间接指针指示的间接节点中记录了多个二级间接指针。每个二级间接指针指示了一个间接节点的地址,每个二级间接指针指示的间接节点中保存直接节点nid,每个直接节点指向多个数据块地址。The three-level indirect pointer, the index node records at least one three-level indirect pointer, each three-level indirect pointer indicates the address of an indirect node, each three-level indirect pointer records multiple two-level indirect pointers, that is, each three-level indirect pointer Multiple secondary indirect pointers are recorded in the indirect node indicated by the indirect pointer. Each secondary indirect pointer indicates the address of an indirect node, the indirect node indicated by each secondary indirect pointer stores the direct node nid, and each direct node points to multiple data block addresses.
显然,索引节点中一级间接指针指示的直接节点可以理解为目标索引节点的关联节点,同样,索引节点中二级间接指针和三级间接指针指示的间接节点也可以理解为目标索引节点的关联节点。Obviously, the direct node indicated by the first-level indirect pointer in the index node can be understood as the associated node of the target index node, and similarly, the indirect node indicated by the second-level indirect pointer and the third-level indirect pointer in the index node can also be understood as the association node of the target index node node.
基于此,步骤602的具体实现过程可以为:根据目标数据的长度和起始偏移地址,并基于多个直接指针、多个一级间接指针、多个二级间接指针或至少一个三级间接指针中的至少一项所指示的目标文件的地址列表,确定目标数据对应的数据块逻辑地址。具体的,将根据目标文件的大小和起始偏移地址所指示的不同位置,对步骤602的实现方式进行详细说明。由于在说明的过程中会涉及到第一预设值至第四预设值,且第一预设值<第二预设值<第三预设值<第四预设值,因此,先对第一预设值至第四预设值进行说明。Based on this, the specific implementation process of step 602 can be: according to the length of the target data and the start offset address, and based on multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, or at least one third-level indirect The address list of the target file indicated by at least one item of the pointer determines the logical address of the data block corresponding to the target data. Specifically, the implementation of step 602 will be described in detail according to the size of the target file and different locations indicated by the starting offset address. Since the first preset value to the fourth preset value will be involved in the description process, and the first preset value<the second preset value<the third preset value<the fourth preset value, therefore, first The first preset value to the fourth preset value are described.
由于按照优先级由高到低的顺序,多个直接指针、多个一级间接指针、多个二级间接指针、至少一个三级间接指针中的至少一项用于指示目标文件的地址列表。或者多个直接指针用于存储目标文件的数据。因此,可以根据每种指针能够指示的地址列表所表示的数据的最大值,或者多个直接指针能够存储的数据的最大值等参数,设置第一预设值至第四预设值。这样,就可以根据目标文件的大小并结合上述目标文件的数据或者目标文件的地址列表的指示原则,确定目标文件的地址列表或者目标文件的数据存储在那些指针中。具体的:According to the descending order of priority, at least one of multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer is used to indicate the address list of the target file. Or multiple direct pointers are used to store the data of the object file. Therefore, the first preset value to the fourth preset value can be set according to parameters such as the maximum value of data represented by the address list that can be indicated by each pointer, or the maximum value of data that can be stored by multiple direct pointers. In this way, according to the size of the target file and in combination with the indication principle of the data of the target file or the address list of the target file, it can be determined that the address list of the target file or the data of the target file are stored in those pointers. specific:
根据多个直接指针能够存储的数据的最大值等因素,确定第一预设值,这样,在目标文件≤第一预设值时,将目标文件的数据存储在多个直接指针中,这样,在读取目标文件中的目标数据时,从多个直接指针中读取目标数据,提高数据读取的效率。According to factors such as the maximum value of the data that can be stored by multiple direct pointers, the first preset value is determined. In this way, when the target file≤the first preset value, the data of the target file is stored in multiple direct pointers. Like this, When reading the target data in the target file, the target data is read from multiple direct pointers to improve the efficiency of data reading.
根据多个直接指针能够容纳的最大地址列表所指示的数据的最大值等因素,确定第二预设值,这样,若第一预设值<目标文件的大小≤第二预设值,则通过多个直接指针指示目标文件的地址列表。According to factors such as the maximum value of the data indicated by the largest address list that can be accommodated by multiple direct pointers, determine the second preset value. In this way, if the first preset value<the size of the target file≤the second preset value, then pass Multiple direct pointers point to a list of addresses of object files.
根据多个直接指针和多个一级间接指针能够指示的最大地址列表所指示的数据的最大值等因素,确定第三预设值。这样,若第二预设值<目标文件的大小≤第三预设值,则可以通过多个直接指针和多个一级间接指针指示目标文件的地址列表。The third preset value is determined according to factors such as the maximum value of data indicated by the largest address list that can be indicated by the multiple direct pointers and the multiple first-level indirect pointers. In this way, if the second preset value<the size of the target file≤the third preset value, multiple direct pointers and multiple first-level indirect pointers can be used to indicate the address list of the target file.
根据多个直接指针、多个一级间接指针和多个二级间接指针能够指示的最大地址列表所指示的数据的最大值等因素,确定第四预设值。这样,若第三预设值<目标文件的大小≤第四预设值,则通过多个直接指针、多个一级间接指针和多个二级间接指针指示目标文件的地址列表。若第四预设值<目标文件的大小,则通过多个直接指针、多个一级间接指针、多个二级间接指针和至少一个三级间接指针指示目标文件的地址列表。The fourth preset value is determined according to factors such as a maximum value of data indicated by a maximum address list that can be indicated by multiple direct pointers, multiple first-level indirect pointers, and multiple second-level indirect pointers. In this way, if the third preset value<the size of the target file≤the fourth preset value, the address list of the target file is indicated by multiple direct pointers, multiple first-level indirect pointers, and multiple second-level indirect pointers. If the fourth preset value<the size of the target file, the address list of the target file is indicated by multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers and at least one third-level indirect pointer.
基于此,可以根据目标文件的大小和起始偏移地址确定步骤602的具体实现过程。具体过程如下:Based on this, the specific implementation process of step 602 can be determined according to the size of the target file and the starting offset address. The specific process is as follows:
若第一预设值<目标文件的大小≤第二预设值,则步骤602的实现过程如下:If the first preset value<the size of the target file≤the second preset value, the implementation process of step 602 is as follows:
根据目标数据的长度和起始偏移地址,并基于多个直接指针所指示的目标文件的地址列表,确定目标数据对应的数据块逻辑地址。According to the length of the target data and the starting offset address, and based on the address list of the target file indicated by the multiple direct pointers, the logical address of the data block corresponding to the target data is determined.
在第二预设值<目标文件的大小≤第三预设值的情况下:In the case of the second preset value<the size of the target file≤the third preset value:
若起始偏移地址≤第二预设值,则步骤602的实现过程如下:If the starting offset address≤the second preset value, the implementation process of step 602 is as follows:
根据目标数据的长度和起始偏移地址,并基于多个直接指针和多个一级间接指针所指示的目标文件的地址列表,确定目标数据对应的数据块逻辑地址。According to the length of the target data and the starting offset address, and based on the address list of the target file indicated by the multiple direct pointers and the multiple first-level indirect pointers, the logical address of the data block corresponding to the target data is determined.
若第二预设值<起始偏移地址≤第三预设值,则步骤602的实现过程如下:If the second preset value<start offset address≤the third preset value, then the implementation process of step 602 is as follows:
根据目标数据的长度和起始偏移地址,并基于多个一级间接指针所指示的目标文件的地址列表,确定目标数据对应的数据块逻辑地址。According to the length of the target data and the starting offset address, and based on the address list of the target file indicated by multiple first-level indirect pointers, the logical address of the data block corresponding to the target data is determined.
在第二预设值<第三预设值<目标文件的大小≤第四预设值的情况下:In the case of the second preset value<the third preset value<the size of the target file≤the fourth preset value:
若起始偏移地址≤第二预设值,则步骤602的实现过程如下:If the starting offset address≤the second preset value, the implementation process of step 602 is as follows:
根据目标数据的长度和起始偏移地址,并基于多个直接指针、多个一级间接指针和多个二级间接指针所指示的目标文件的地址列表,确定目标数据对应的数据块逻辑地址。According to the length and start offset address of the target data, and based on the address list of the target file indicated by multiple direct pointers, multiple first-level indirect pointers and multiple second-level indirect pointers, determine the logical address of the data block corresponding to the target data .
若第二预设值<起始偏移地址≤第三预设值,则步骤602的实现过程如下:If the second preset value<start offset address≤the third preset value, then the implementation process of step 602 is as follows:
根据目标数据的长度和起始偏移地址,并基于多个一级间接指针和多个二级间接指针所指示的目标文件的地址列表,确定目标数据对应的数据块逻辑地址。According to the length of the target data and the starting offset address, and based on the address list of the target file indicated by the multiple first-level indirect pointers and the multiple second-level indirect pointers, the logical address of the data block corresponding to the target data is determined.
若第三预设值<起始偏移地址≤第四预设值,则步骤602的实现过程如下:根据目标数据的长度和起始偏移地址,并基于多个二级间接指针所指示的目标文件的地址列表,确定目标数据对应的数据块逻辑地址。If the third preset value<start offset address≤the fourth preset value, then the implementation process of step 602 is as follows: according to the length of the target data and the start offset address, and based on the multiple secondary indirect pointers indicated The address list of the target file determines the logical address of the data block corresponding to the target data.
在第二预设值<第三预设值<第四预设值<目标文件的大小的情况下:In the case of the second preset value<the third preset value<the fourth preset value<the size of the target file:
若起始偏移地址≤第二预设值,则步骤602的实现过程如下:If the starting offset address≤the second preset value, the implementation process of step 602 is as follows:
根据目标数据的长度和起始偏移地址,并基于多个直接指针、多个一级间接指针、多个二级间接指针和至少一个三级间接指针所指示的目标文件的地址列表,确定目标数据对应的数据块逻辑地址。Determine the target according to the length and start offset address of the target data, and based on the address list of the target file indicated by multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer The logical address of the data block corresponding to the data.
若第二预设值<起始偏移地址≤第三预设值,则步骤602的实现过程如下:If the second preset value<start offset address≤the third preset value, then the implementation process of step 602 is as follows:
根据目标数据的长度和起始偏移地址,并基于多个一级间接指针、多个二级间接指针和至少一个三级间接指针所指示的目标文件的地址列表,确定目标数据对应的数据块逻辑 地址。According to the length and starting offset address of the target data, and based on the address list of the target file indicated by multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer, determine the data block corresponding to the target data logical address.
若第三预设值<起始偏移地址≤第四预设值,则步骤602的实现过程如下:If the third preset value<start offset address≤the fourth preset value, the implementation process of step 602 is as follows:
根据目标数据的长度和起始偏移地址,并基于多个二级间接指针和至少一个三级间接指针所指示的目标文件的地址列表,确定目标数据对应的数据块逻辑地址;Determine the logical address of the data block corresponding to the target data according to the length of the target data and the starting offset address, and based on the address list of the target file indicated by a plurality of secondary indirect pointers and at least one third-level indirect pointer;
若第四预设值<起始偏移地址,则步骤602的实现过程如下:If the fourth preset value<start offset address, the implementation process of step 602 is as follows:
根据目标数据的长度和起始偏移地址,并基于至少一个三级间接指针所指示的目标文件的地址列表,确定目标数据对应的数据块逻辑地址。According to the length of the target data and the start offset address, and based on the address list of the target file indicated by at least one third-level indirect pointer, the logical address of the data block corresponding to the target data is determined.
需要说明的是,根据目标数据的长度和起始偏移地址在各种指针所指示的目标文件的地址列表中确定目标数据对应的数据块逻辑地址的原理与上文中描述的确定待比对偏移地址对应的数据块逻辑地址的原理相似,此处不再赘述。It should be noted that, according to the length of the target data and the starting offset address, the principle of determining the logical address of the data block corresponding to the target data in the address list of the target file indicated by various pointers is the same as that described above. The principle of shifting the logical address of the data block corresponding to the address is similar and will not be repeated here.
显然,通过设置第一预设值至第四预设值,可以根据目标文件的大小和起始偏移地址的不同,灵活的确定从什么位置开始进行地址列表的匹配,提高了匹配效率。Obviously, by setting the first preset value to the fourth preset value, it is possible to flexibly determine where to start matching the address list according to the size of the target file and the starting offset address, thereby improving the matching efficiency.
第二种,若目标索引节点通过存储目标文件的数据指示目标文件的数据,则步骤403的实现步骤如下所示:Second, if the target index node indicates the data of the target file by storing the data of the target file, the implementation steps of step 403 are as follows:
首先,根据目标索引节点的逻辑地址确定目标索引节点。具体实现过程已经在上文中进行了说明,此处不再赘述。然后,根据起始偏移地址和目标数据的长度,从目标索引节点中存储的目标文件的数据中读取目标数据。First, the target index node is determined according to the logical address of the target index node. The specific implementation process has been described above and will not be repeated here. Then, according to the start offset address and the length of the target data, the target data is read from the data of the target file stored in the target index node.
例如,若目标索引节点包括多个直接指针、多个一级间接指针、多个二级间接指针、至少一个三级间接指针。指针的优先级由高到低的顺序依次为:多个直接指针、多个一级间接指针、多个二级间接指针、至少一个三级间接指针。且在目标文件的大小≤第一预设值的情况下,多个直接指针用于存储目标文件的数据。则根据起始偏移地址和目标数据的长度,从目标索引节点中存储的目标文件的数据中读取目标数据的实现过程如下所示:For example, if the target index node includes multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer. The priority order of pointers from high to low is: multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer. And when the size of the target file≤the first preset value, multiple direct pointers are used to store the data of the target file. Then, according to the start offset address and the length of the target data, the realization process of reading the target data from the data of the target file stored in the target index node is as follows:
根据起始偏移地址和目标数据的长度,从多个直接指针中存储的目标文件的数据中读取目标数据。According to the start offset address and the length of the target data, the target data is read from the data of the target file stored in the multiple direct pointers.
需要说明的是,目标索引节点的结构和第一预设值已经在上文中进行说明,此处不再赘述。It should be noted that the structure of the target index node and the first preset value have been described above, and will not be repeated here.
下面,以日志结构文件系统为F2FS,如图7所示的目标索引节点为例,对存储控制器根据文件读取请求中携带的信息读取目标数据的过程进行说明。In the following, taking the log-structured file system as F2FS and the target index node shown in FIG. 7 as an example, the process of the storage controller reading the target data according to the information carried in the file read request will be described.
文件读取请求携带目标索引节点的逻辑地址、目标数据的长度和起始偏移地址。The file read request carries the logical address of the target index node, the length of the target data, and the starting offset address.
F2FS使用三种节点,分别为索引节点(例如目标索引节点)、直接节点和间接节点。如图7所示,索引节点(例如目标索引节点)包括元数据(metadata)部分和数据块寻址部分。其中,数据块寻址部分包括929个直接指针,两个一级间接指针,两个二级间接指针,一个三级间接指针。F2FS uses three types of nodes, which are index nodes (such as target index nodes), direct nodes, and indirect nodes. As shown in FIG. 7 , an index node (such as a target index node) includes a metadata (metadata) part and a data block addressing part. Among them, the data block addressing part includes 929 direct pointers, two first-level indirect pointers, two second-level indirect pointers, and one third-level indirect pointer.
929个直接指针保存了929个block数据的物理地址。929 direct pointers store the physical addresses of 929 block data.
两个一级间接指针指示了两个直接节点的地址,这里可以保存2*1018个block的数据。Two first-level indirect pointers indicate the addresses of two direct nodes, where 2*1018 blocks of data can be saved.
两个二级间接指针指示了两个间接节点的地址,两个间接节点保存了直接节点的nid,这里保存了2*1018*1018个block的数据。The two secondary indirect pointers indicate the addresses of the two indirect nodes, and the two indirect nodes store the nid of the direct node, where 2*1018*1018 blocks of data are stored.
一个三级间接指针指示了一个间接节点的地址,三级间接指针指示的间接节点保存了二级间接指针指示的间接节点的地址,二级间接指针指示的间接节点中保存的是直接节点的nid,这里可以保存1018*1018*1018个页的数据。A third-level indirect pointer indicates the address of an indirect node, the indirect node indicated by the third-level indirect pointer stores the address of the indirect node indicated by the second-level indirect pointer, and the indirect node indicated by the second-level indirect pointer stores the nid of the direct node , 1018*1018*1018 pages of data can be saved here.
在此基础上,可以得到如下计算公式:On this basis, the following calculation formula can be obtained:
4KB*(923+2*1018+2*1018 x 1018+1*1018*1018*1018)=3.93TB4KB*(923+2*1018+2*1018 x 1018+1*1018*1018*1018)=3.93TB
通过上述公式可知,F2FS单个文件最多保存3.93TB数据。From the above formula, it can be seen that a single F2FS file can save up to 3.93TB of data.
由上可知,第一预设值为3716B,第二预设值为3716KB,第三预设值为11860KB。第四预设值为8302452KB。It can be seen from the above that the first default value is 3716B, the second default value is 3716KB, and the third default value is 11860KB. The fourth preset value is 8302452KB.
若目标文件的大小≤3716B(即第一预设值),则将目标文件的数据存储在929个直接指针中,如图7所示,此时929个直接指针可以称为inline data。If the size of target file≤3716B (being first default value), then the data of target file is stored in 929 direct pointers, as shown in Figure 7, now 929 direct pointers can be called inline data.
若3716B<目标文件的大小≤3716KB,则通过929个直接指针指示目标文件的地址列表。If 3716B<the size of the target file≤3716KB, then indicate the address list of the target file through 929 direct pointers.
若3176KB<目标文件文件的大小≤11860KB,则通过929个直接指针和两个一级间接指针指示目标文件的地址列表。If 3176KB<the size of the target file≤11860KB, then indicate the address list of the target file through 929 direct pointers and two first-level indirect pointers.
若11860KB<目标文件文件的大小≤8302452KB,则通过929个直接指针、两个一级间接指针和两个二级间接指针指示目标文件的地址列表。If 11860KB<the size of the target file≤8302452KB, then indicate the address list of the target file through 929 direct pointers, two first-level indirect pointers and two second-level indirect pointers.
若目标文件的大小>8302452KB,则通过929个直接指针、两个一级间接指针、两个二级间接指针和一个三级间接指针指示目标文件的地址列表。If the size of the target file is >8302452KB, the address list of the target file is indicated by 929 direct pointers, two first-level indirect pointers, two second-level indirect pointers and one third-level indirect pointer.
在此基础上,下面将基于不同大小的目标文件和指示不同位置的起始偏移地址,对读取目标数据的过程进行说明。On this basis, the process of reading target data will be described below based on target files of different sizes and start offset addresses indicating different locations.
若目标文件的大小≤3716B(即第一预设值),则存储控制器读取目标数据的过程可以如下所示:If the size of the target file is less than or equal to 3716B (i.e. the first preset value), the process of the storage controller reading the target data can be as follows:
首先,存储控制器根据目标索引节点的逻辑地址确定目标索引节点。然后,存储控制器根据起始偏移地址和目标数据的长度从目标索引节点中的inline data中获得目标数据,以及将目标数据发送至处理器。First, the storage controller determines the target inode according to the logical address of the target inode. Then, the storage controller obtains the target data from the inline data in the target index node according to the start offset address and the length of the target data, and sends the target data to the processor.
若3716B<目标文件的大小≤3716KB,则如图8所示,存储控制器读取目标数据的过程可以如下所示:If 3716B<target file size≤3716KB, as shown in Figure 8, the process of the storage controller reading target data can be as follows:
801.存储控制器根据目标索引节点的逻辑地址确定目标索引节点。801. The storage controller determines the target index node according to the logical address of the target index node.
802.存储控制器将起始偏移地址作为待比对偏移地址。802. The storage controller uses the starting offset address as the offset address to be compared.
803.存储控制器将待比对偏移地址与目标索引节点中的929个直接指针指示的目标文件的地址列表中的偏移地址进行匹配,以确定待比对偏移地址对应的数据块逻辑地址。803. The storage controller matches the offset address to be compared with the offset address in the address list of the target file indicated by the 929 direct pointers in the target index node, so as to determine the data block logic corresponding to the offset address to be compared address.
804.存储控制器根据待比对偏移地址对应的数据块逻辑地址确定待比对偏移地址对应的数据块物理地址。804. The storage controller determines the physical address of the data block corresponding to the offset address to be compared according to the logical address of the data block corresponding to the offset address to be compared.
805.存储控制器从待比对偏移地址对应的数据块物理地址指示的数据块中读取数据,并将读取的数据发送至处理器。805. The storage controller reads data from the data block indicated by the physical address of the data block corresponding to the offset address to be compared, and sends the read data to the processor.
806.存储控制器判断已经发送至处理器的数据的长度是否等于目标数据的长度,若是,则执行807,若否,则执行808。806. The storage controller judges whether the length of the data sent to the processor is equal to the length of the target data, if yes, execute 807, and if not, execute 808.
807.存储控制器停止目标数据的读取。807. The storage controller stops reading the target data.
808.存储控制器更新待比对偏移地址,以及基于更新后的待比对偏移地址重复步骤803~806。808. The storage controller updates the offset address to be compared, and repeats steps 803-806 based on the updated offset address to be compared.
需要说明的是,待比对偏移地址的更新可以为对当前待比对偏移地址加一。发送至处理器的数据为目标数据。确定的待比对偏移地址对应的数据块逻辑地址为目标数据对应的数据块逻辑地址。It should be noted that the update of the offset address to be compared may be adding one to the current offset address to be compared. The data sent to the processor is object data. The determined logical address of the data block corresponding to the offset address to be compared is the logical address of the data block corresponding to the target data.
在3176KB<目标文件的大小≤11860KB的情况下:In the case of 3176KB<target file size≤11860KB:
若起始偏移地址≤3176KB,则存储控制器读取目标数据的过程与图8所示的原理相似,即将起始偏移地址确定为待比对偏移地址,从929个直接指针指示的目标文件的地址列表中开始匹配。不同的部分在于,若在929个直接指针指示的目标文件的地址列表中找不到与更新后的待比对偏移地址匹配的偏移地址,则在两个一级间接指针指示的目标文件的地址列表中查找。If the starting offset address is less than or equal to 3176KB, then the process of the storage controller reading the target data is similar to the principle shown in Figure 8, that is, the starting offset address is determined as the offset address to be compared, and the 929 direct pointers indicate the Start matching in the address list of the object file. The difference is that if no offset address matching the updated offset address to be compared is found in the address list of the target files indicated by the 929 direct pointers, then the target files indicated by the two first-level indirect pointers in the address list of .
若3176KB<起始偏移地址≤11860KB,则如图9所示,存储控制器读取目标数据的过程可以如下所示:If 3176KB<start offset address≤11860KB, as shown in Figure 9, the process of the storage controller reading the target data can be as follows:
901.存储控制器根据目标索引节点的逻辑地址确定目标索引节点。901. The storage controller determines the target index node according to the logical address of the target index node.
902.存储控制器将起始偏移地址作为待比对偏移地址。902. The storage controller uses the starting offset address as the offset address to be compared.
903.存储控制器根据目标索引节点中的两个一级间接指针确定直接节点。903. The storage controller determines the direct node according to the two first-level indirect pointers in the target index node.
904.存储控制器将待比对偏移地址与直接节点中存储的目标文件的地址列表中的偏移地址进行匹配,以确定待比对偏移地址对应的数据块逻辑地址。904. The storage controller matches the offset address to be compared with the offset address in the address list of the target file stored in the direct node, so as to determine the logical address of the data block corresponding to the offset address to be compared.
905.存储控制器根据待比对偏移地址对应的数据块逻辑地址确定待比对偏移地址对应的数据块物理地址。905. The storage controller determines the physical address of the data block corresponding to the offset address to be compared according to the logical address of the data block corresponding to the offset address to be compared.
906.存储控制器从待比对偏移地址对应的数据块物理地址指示的数据块中读取数据,并将读取的数据发送至处理器。906. The storage controller reads data from the data block indicated by the physical address of the data block corresponding to the offset address to be compared, and sends the read data to the processor.
907.存储控制器判断已经发送至处理器的数据的长度是否等于目标数据的长度,若是,则执行908,若否,则执行909。907. The storage controller judges whether the length of the data sent to the processor is equal to the length of the target data, if yes, go to 908, if not, go to 909.
908.存储控制器停止目标数据的读取。908. The storage controller stops reading the target data.
909.存储控制器更新待比对偏移地址,以及基于更新后的待比对偏移地址重复步骤904~907。909. The storage controller updates the offset address to be compared, and repeats steps 904-907 based on the updated offset address to be compared.
在11860KB<目标文件的大小≤8302452KB的情况下,In the case of 11860KB<target file size≤8302452KB,
若起始偏移地址≤3176KB,则存储控制器读取目标数据的过程与图8所示的原理相似,即将起始偏移地址确定为待比对偏移地址,从929个直接指针指示的目标文件的地址列表中开始匹配待比对偏移地址的数据块逻辑地址。不同的部分在于,若在929个直接指针指 示的目标文件的地址列表中找不到与更新后的待比对偏移地址匹配的偏移地址,则在两个一级间接指针指示的目标文件的地址列表中查找。若在两个一级间接指针指示的目标文件的地址列表中找不到与更新后的待比对偏移地址匹配的偏移地址,则在两个二级间接指针指示的目标文件的地址列表中查找。If the starting offset address is less than or equal to 3176KB, then the process of the storage controller reading the target data is similar to the principle shown in Figure 8, that is, the starting offset address is determined as the offset address to be compared, and the 929 direct pointers indicate the The logical address of the data block starting to match the offset address to be compared in the address list of the target file. The difference is that if no offset address matching the updated offset address to be compared is found in the address list of the target files indicated by the 929 direct pointers, then the target files indicated by the two first-level indirect pointers in the address list of . If no offset address matching the updated offset address to be compared is found in the address lists of the target files indicated by the two first-level indirect pointers, then in the address lists of the target files indicated by the two second-level indirect pointers in the search.
若3176KB<起始偏移地址≤11860KB,则存储控制器读取目标数据的过程与图9所示的原理相似,即将起始偏移地址确定为待比对偏移地址,在两个一级间接指针指示的目标文件的地址列表中开始匹配待比对偏移地址的数据块逻辑地址。不同的部分在于,若在两个一级间接指针指示的目标文件的地址列表中找不到与更新后的待比对偏移地址匹配的偏移地址,则在两个二级间接指针指示的目标文件的地址列表中查找。If 3176KB<start offset address≤11860KB, the process of the storage controller reading the target data is similar to the principle shown in Figure 9, that is, the start offset address is determined as the offset address to be compared, and the two levels The logical address of the data block starting to match the offset address to be compared in the address list of the target file indicated by the indirect pointer. The difference is that if no offset address matching the updated offset address to be compared is found in the address list of the target file indicated by the two first-level indirect pointers, then the two second-level indirect pointers indicate Lookup in the address list of the object file.
若11860KB<起始偏移地址≤8302452KB,则如图10所示,存储控制器读取目标数据的过程可以如下所示:If 11860KB<start offset address≤8302452KB, as shown in Figure 10, the process of the storage controller reading the target data can be as follows:
1001.存储控制器根据目标索引节点的逻辑地址确定目标索引节点。1001. The storage controller determines the target index node according to the logical address of the target index node.
1002.存储控制器将起始偏移地址作为待比对偏移地址。1002. The storage controller uses the starting offset address as the offset address to be compared.
1003.存储控制器根据目标索引节点中的两个二级间接指针确定间接节点,以及从间接节点中确定直接节点的nid。1003. The storage controller determines the indirect node according to the two secondary indirect pointers in the target index node, and determines the nid of the direct node from the indirect nodes.
1004.存储控制器将待比对偏移地址与直接节点(根据直接节点的nid确定)中存储的目标文件的地址列表中的偏移地址进行匹配,以确定待比对偏移地址对应的数据块逻辑地址。1004. The storage controller matches the offset address to be compared with the offset address in the address list of the target file stored in the direct node (determined according to the nid of the direct node), so as to determine the data corresponding to the offset address to be compared block logical address.
1005.存储控制器根据待比对偏移地址对应的数据块逻辑地址确定待比对偏移地址对应的数据块物理地址。1005. The storage controller determines the physical address of the data block corresponding to the offset address to be compared according to the logical address of the data block corresponding to the offset address to be compared.
1006.存储控制器从待比对偏移地址对应的数据块物理地址指示的数据块中读取数据,并将读取的数据发送至处理器。1006. The storage controller reads data from the data block indicated by the physical address of the data block corresponding to the offset address to be compared, and sends the read data to the processor.
1007.存储控制器判断已经发送至处理器的数据的长度是否等于目标数据的长度,若是,则执行1008,若否,则执行1009。1007. The storage controller judges whether the length of the data sent to the processor is equal to the length of the target data, if yes, execute 1008, if not, execute 1009.
1008.存储控制器停止目标数据的读取。1008. The storage controller stops reading the target data.
1009.存储控制器更新待比对偏移地址,以及基于更新后的待比对偏移地址重复步骤1004~1007。1009. The storage controller updates the offset address to be compared, and repeats steps 1004-1007 based on the updated offset address to be compared.
在目标文件的大小>8302452KB的情况下:In the case where the size of the target file is >8302452KB:
若起始偏移地址≤3176KB,则存储控制器读取目标数据的过程与图8所示的原理相似,即将起始偏移地址确定为待比对偏移地址,从929个直接指针指示的目标文件的地址列表中开始匹配待比对偏移地址的数据块逻辑地址。不同的部分在于,若在929个直接指针指示的目标文件的地址列表中找不到与更新后的待比对偏移地址匹配的偏移地址,则在两个一级间接指针指示的目标文件的地址列表中查找。若在两个一级间接指针指示的目标文件的地址列表中找不到与更新后的待比对偏移地址匹配的偏移地址,则在两个二级间接指针指示的目标文件的地址列表中查找。若在两个二级间接指针指示的目标文件的地址列表中找不到与更新后的待比对偏移地址匹配的偏移地址,则在一个三级间接指针指示的目标文件的地址列表中查找。If the starting offset address is less than or equal to 3176KB, then the process of the storage controller reading the target data is similar to the principle shown in Figure 8, that is, the starting offset address is determined as the offset address to be compared, and the 929 direct pointers indicate the The logical address of the data block starting to match the offset address to be compared in the address list of the target file. The difference is that if no offset address matching the updated offset address to be compared is found in the address list of the target files indicated by the 929 direct pointers, then the target files indicated by the two first-level indirect pointers in the address list of . If no offset address matching the updated offset address to be compared is found in the address lists of the target files indicated by the two first-level indirect pointers, then in the address lists of the target files indicated by the two second-level indirect pointers in the search. If no offset address matching the updated offset address to be compared is found in the address list of the target file indicated by the two second-level indirect pointers, then in the address list of the target file indicated by a third-level indirect pointer find.
若3176KB<起始偏移地址≤11860KB,则存储控制器读取目标数据的过程与图9所示的原理相似,即将起始偏移地址确定为待比对偏移地址,从两个一级间接指针指示的目标文件的地址列表中开始匹配待比对偏移地址的数据块逻辑地址。不同的部分在于,若在两个一级间接指针指示的目标文件的地址列表中找不到与更新后的待比对偏移地址匹配的偏移地址,则在两个二级间接指针指示的目标文件的地址列表中查找。若在两个二级间接指针指示的目标文件的地址列表中找不到与更新后的待比对偏移地址匹配的偏移地址,则在一个三级间接指针指示的目标文件的地址列表中查找。If 3176KB<starting offset address≤11860KB, the process of the storage controller reading the target data is similar to the principle shown in Figure 9, that is, the starting offset address is determined as the offset address to be compared, and the two first-level The logical address of the data block starting to match the offset address to be compared in the address list of the target file indicated by the indirect pointer. The difference is that if no offset address matching the updated offset address to be compared is found in the address list of the target file indicated by the two first-level indirect pointers, then the two second-level indirect pointers indicate Lookup in the address list of the object file. If no offset address matching the updated offset address to be compared is found in the address list of the target file indicated by the two second-level indirect pointers, then in the address list of the target file indicated by a third-level indirect pointer find.
若11860KB<起始偏移地址≤8302452KB,则存储控制器读取目标数据的过程与图10所示的原理相似,即将起始偏移地址确定为待比对偏移地址,从两个二级间接指针指示的目标文件的地址列表中开始匹配待比对偏移地址的数据块逻辑地址。若在两个二级间接指针指示的目标文件的地址列表中找不到与更新后的待比对偏移地址匹配的偏移地址,则在一个三级间接指针指示的目标文件的地址列表中查找。If 11860KB<start offset address≤8302452KB, the process of the storage controller reading the target data is similar to the principle shown in Figure 10, that is, the start offset address is determined as the offset address to be compared, and the two secondary The logical address of the data block starting to match the offset address to be compared in the address list of the target file indicated by the indirect pointer. If no offset address matching the updated offset address to be compared is found in the address list of the target file indicated by the two second-level indirect pointers, then in the address list of the target file indicated by a third-level indirect pointer find.
若8302452KB<起始偏移地址。则如图11所示,存储控制器读取目标数据的过程可以如下所示:If 8302452KB<start offset address. Then, as shown in FIG. 11, the process of the storage controller reading the target data may be as follows:
1101.存储控制器根据目标索引节点的逻辑地址确定目标索引节点。1101. The storage controller determines the target index node according to the logical address of the target index node.
1102.存储控制器将起始偏移地址作为待比对偏移地址。1102. The storage controller uses the starting offset address as the offset address to be compared.
1103.存储控制器根据目标索引节点中的三级间接指针确定间接节点,以及从确定的间接节点中确定该间接节点中存储的间接节点的地址,根据间接节点的地址获得直接节点的nid。1103. The storage controller determines the indirect node according to the three-level indirect pointer in the target index node, determines the address of the indirect node stored in the indirect node from the determined indirect node, and obtains the nid of the direct node according to the address of the indirect node.
1104.存储控制器将待比对偏移地址与直接节点(根据直接节点nid确定)中存储的目标文件的地址列表中的偏移地址进行匹配,以确定待比对偏移地址对应的数据块逻辑地址。1104. The storage controller matches the offset address to be compared with the offset address in the address list of the target file stored in the direct node (determined according to the direct node nid), so as to determine the data block corresponding to the offset address to be compared logical address.
1105.存储控制器根据待比对偏移地址对应的数据块逻辑地址确定待比对偏移地址对应的数据块物理地址。1105. The storage controller determines the physical address of the data block corresponding to the offset address to be compared according to the logical address of the data block corresponding to the offset address to be compared.
1106.存储控制器从待比对偏移地址对应的数据块物理地址指示的数据块中读取数据,并将读取的数据发送至处理器。1106. The storage controller reads data from the data block indicated by the physical address of the data block corresponding to the offset address to be compared, and sends the read data to the processor.
1107.存储控制器判断已经发送至处理器的数据的长度是否等于目标数据的长度,若是,则执行1108,若否,则执行1109。1107. The storage controller judges whether the length of the data sent to the processor is equal to the length of the target data, if yes, execute 1108, if not, execute 1109.
1108.存储控制器停止目标数据的读取。1108. The storage controller stops reading the target data.
1109.存储控制器更新待比对偏移地址,以及基于更新后的待比对偏移地址重复步骤1104~1107。1109. The storage controller updates the offset address to be compared, and repeats steps 1104-1107 based on the updated offset address to be compared.
需要说明的是,间接指针指示的目标文件的地址列表指的是间接指针最终指示的直接节点中存储的目标文件的地址列表。间接节点包括但不限于一级间接指针,二级间接指针,三级间接指针。It should be noted that the address list of the target file indicated by the indirect pointer refers to the address list of the target file stored in the direct node finally pointed by the indirect pointer. Indirect nodes include but are not limited to first-level indirect pointers, second-level indirect pointers, and third-level indirect pointers.
由上可知,在上述实施例中,可以根据目标文件的大小和起始偏移地址所指示的起始位置,在直接指针、间接指针中灵活的确定具体从哪一个指针指示的目标文件的地址列表中开始匹配,提高了匹配的效率。As can be seen from the above, in the above embodiment, according to the size of the target file and the starting position indicated by the starting offset address, the address of the target file indicated by which pointer can be flexibly determined among the direct pointer and the indirect pointer Start matching in the list, which improves the efficiency of matching.
本申请还提供了一种文件读取装置,应用于存储控制器,如图12所示,该装置1200 可以包括:获得模块1201、读取模块1202、发送模块1203,其中:The present application also provides a file reading device, which is applied to a storage controller. As shown in FIG. 12, the device 1200 may include: an obtaining module 1201, a reading module 1202, and a sending module 1203, wherein:
获得模块1201,用于通过文件读取接口获得来自处理器的文件读取请求;其中,所述文件读取请求携带目标索引节点的逻辑地址、起始偏移地址和目标数据的长度,所述目标数据为目标文件中的至少一部分数据,所述目标索引节点为所述目标文件的索引节点,所述起始偏移地址用于指示所述目标数据在所述目标文件中的起始位置,所述目标索引节点用于指示所述目标文件中的数据;读取模块1202,用于根据所述目标索引节点的逻辑地址、起始偏移地址和目标数据的长度,从所述目标文件中读取所述目标数据;发送模块1203,用于将所述目标数据发送至所述处理器。Obtaining module 1201, configured to obtain a file read request from a processor through a file read interface; wherein, the file read request carries a logical address of a target index node, a starting offset address, and a length of target data, and the The target data is at least a part of data in the target file, the target index node is the index node of the target file, and the starting offset address is used to indicate the starting position of the target data in the target file, The target index node is used to indicate the data in the target file; the reading module 1202 is used to read the data from the target file according to the logical address of the target index node, the starting offset address and the length of the target data. Read the target data; a sending module 1203, configured to send the target data to the processor.
在一种可能的实现方式中,所述目标索引节点指示所述目标文件的地址列表,其中,所述目标文件的地址列表包括多个偏移地址和多个数据块逻辑地址的一一对应关系;所述读取模块1202,具体用于根据所述目标索引节点的逻辑地址确定所述目标索引节点;根据所述目标数据的长度和所述起始偏移地址,并结合所述目标索引节点指示的所述目标文件的地址列表,确定所述目标数据对应的数据块逻辑地址;根据所述目标数据对应的数据块逻辑地址,读取所述目标数据。In a possible implementation manner, the target index node indicates an address list of the target file, where the address list of the target file includes a one-to-one correspondence between multiple offset addresses and multiple data block logical addresses ; The reading module 1202 is specifically configured to determine the target index node according to the logical address of the target index node; according to the length of the target data and the start offset address, combined with the target index node The indicated address list of the target file determines the logical address of the data block corresponding to the target data; and reads the target data according to the logical address of the data block corresponding to the target data.
在一种可能的实现方式中,所述目标索引节点包括多个直接指针、多个一级间接指针、多个二级间接指针、至少一个三级间接指针;所述指针的优先级由高到低的顺序依次为:所述多个直接指针、所述多个一级间接指针、所述多个二级间接指针、所述至少一个三级间接指针;按照优先级由高到低的顺序,所述多个直接指针、多个一级间接指针、多个二级间接指针、至少一个三级间接指针中的至少一项用于指示所述目标文件的地址列表。In a possible implementation manner, the target index node includes multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer; the priority of the pointers is from high to The lower order is: the plurality of direct pointers, the plurality of first-level indirect pointers, the plurality of second-level indirect pointers, and the at least one third-level indirect pointer; according to the order of priority from high to low, At least one of the multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer is used to indicate the address list of the target file.
在一种可能的实现方式中,所述读取模块1202,具体用于根据所述目标数据的长度和所述起始偏移地址,并基于所述多个直接指针、所述多个一级间接指针、所述多个二级间接指针或所述至少一个三级间接指针中的至少一项所指示的目标文件的地址列表,确定所述目标数据对应的数据块逻辑地址。In a possible implementation manner, the reading module 1202 is specifically configured to, according to the length of the target data and the start offset address, and based on the multiple direct pointers, the multiple primary The indirect pointer, the address list of the target file indicated by at least one of the plurality of second-level indirect pointers or the at least one third-level indirect pointer determines the logical address of the data block corresponding to the target data.
在一种可能的实现方式中,所述目标索引节点中存储所述目标文件的数据;所述读取模块1202,具体用于根据所述目标索引节点的逻辑地址确定所述目标索引节点;根据所述起始偏移地址和所述目标数据的长度,从所述目标索引节点中存储的所述目标文件的数据中读取所述目标数据。In a possible implementation manner, the target index node stores the data of the target file; the reading module 1202 is specifically configured to determine the target index node according to the logical address of the target index node; For the start offset address and the length of the target data, the target data is read from data of the target file stored in the target index node.
在一种可能的实现方式中,所述目标索引节点包括多个直接指针、多个一级间接指针、多个二级间接指针、至少一个三级间接指针;所述指针的优先级由高到低的顺序依次为:所述多个直接指针、所述多个一级间接指针、所述多个二级间接指针、所述至少一个三级间接指针;在所述目标文件的大小小于或等于第一预设值的情况下:所述多个直接指针用于存储所述目标文件的数据;所述读取模块1202,具体用于根据所述起始偏移地址和所述目标数据的长度,从所述多个直接指针中存储的目标文件的数据中读取所述目标数据。In a possible implementation manner, the target index node includes multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer; the priority of the pointers is from high to The lower order is: the plurality of direct pointers, the plurality of first-level indirect pointers, the plurality of second-level indirect pointers, and the at least one third-level indirect pointer; when the size of the target file is less than or equal to In the case of the first preset value: the plurality of direct pointers are used to store the data of the target file; the reading module 1202 is specifically configured to use the starting offset address and the length of the target data , reading the target data from the data of the target file stored in the plurality of direct pointers.
本申请又提供了一种文件读取装置,应用于处理器,如图13所示,该装置1300可以包括:发送模块1301和接收模块1302,其中:The present application further provides a file reading device, which is applied to a processor. As shown in FIG. 13 , the device 1300 may include: a sending module 1301 and a receiving module 1302, wherein:
发送模块1301,用于通过文件读取接口向所述存储控制器发送文件读取请求;其中,所述文件读取请求携带目标索引节点的逻辑地址、起始偏移地址和目标数据的长度,所述目标数据为目标文件中的至少一部分数据,所述目标索引节点为所述目标文件的索引节点, 所述起始偏移地址用于指示所述目标数据在所述目标文件中的起始位置,所述目标索引节点用于指示所述目标文件中的数据;接收模块1302,用于接收所述存储控制器响应于所述文件读取请求返回的所述目标数据。The sending module 1301 is configured to send a file read request to the storage controller through a file read interface; wherein, the file read request carries the logical address of the target index node, the starting offset address and the length of the target data, The target data is at least a part of data in the target file, the target index node is the index node of the target file, and the start offset address is used to indicate the start of the target data in the target file The location, the target index node is used to indicate the data in the target file; the receiving module 1302 is used to receive the target data returned by the storage controller in response to the file read request.
本申请的上述文件读取装置的实现原理和技术效果已经在上文中进行了说明,此处不再赘述。The implementation principles and technical effects of the document reading device of the present application have been described above, and will not be repeated here.
本申请还提供一种计算机可读存储介质,计算机存储介质中存储有计算机程序,所述计算机程序在存储控制器上被执行时,使得所述存储控制器执行上述存储控制器执行的任一种方法实施例的技术方案。The present application also provides a computer-readable storage medium. A computer program is stored in the computer storage medium. When the computer program is executed on the storage controller, the storage controller executes any one of the above-mentioned storage controllers. The technical solution of the method embodiment.
本申请还提供一种计算机可读存储介质,计算机存储介质中存储有计算机程序,所述计算机程序在处理器上被执行时,使得所述处理器执行上述处理器执行的任一种方法实施例的技术方案。The present application also provides a computer-readable storage medium, and a computer program is stored in the computer storage medium, and when the computer program is executed on a processor, the processor is made to perform any one of the method embodiments performed by the above-mentioned processor. technical solutions.
本申请还提供一种计算机程序产品,当所述计算机程序被存储控制器执行时,使存储控制器执行上述存储控制器执行的任一种方法实施例的技术方案。The present application also provides a computer program product, which, when the computer program is executed by the storage controller, causes the storage controller to execute the technical solution of any one of the method embodiments performed by the storage controller above.
本申请还提供一种计算机程序产品,当所述计算机程序被处理器执行时,使处理器执行上述处理器执行的任一种方法实施例的技术方案。The present application also provides a computer program product, which, when the computer program is executed by a processor, causes the processor to execute the technical solution of any one of the method embodiments executed by the processor above.
本申请还提供一种芯片,包括处理器和存储控制器,所述处理器用于执行上述处理器所执行的步骤,存储控制器用于执行上述存储控制器所执行的步骤。The present application also provides a chip, including a processor and a storage controller, where the processor is configured to execute the steps executed by the above-mentioned processor, and the storage controller is configured to execute the steps executed by the above-mentioned storage controller.
进一步地,所述芯片还可以包括通信接口。所述通信接口可以是输入/输出接口、管脚或输入/输出电路等。Further, the chip may further include a communication interface. The communication interface may be an input/output interface, a pin, or an input/output circuit.
在实现过程中,上述方法实施例的各步骤可以通过网卡中的硬件的集成逻辑电路或者软件形式的指令完成。处理器可以是通用处理器、数字信号处理器(digital signal processor,DSP)、特定应用集成电路(application-specific integrated circuit,ASIC)、现场可编程门阵列(field programmable gate array,FPGA)或其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。本申请实施例公开的方法的步骤可以直接体现为硬件编码处理器执行完成,或者用编码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器,处理器读取存储器中的信息,结合其硬件完成上述方法的步骤。In the implementation process, each step of the above-mentioned method embodiment can be completed by an integrated logic circuit of hardware in the network card or an instruction in the form of software. The processor can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other possible Program logic devices, discrete gate or transistor logic devices, discrete hardware components. A general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like. The steps of the methods disclosed in the embodiments of the present application may be directly implemented by a hardware coded processor, or executed by a combination of hardware and software modules in the coded processor. The software module can be located in a mature storage medium in the field such as random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, register. The storage medium is located in the memory, and the processor reads the information in the memory, and completes the steps of the above method in combination with its hardware.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those skilled in the art can appreciate that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed by hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may use different methods to implement the described functions for each specific application, but such implementation should not be regarded as exceeding the scope of the present application.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and brevity of the description, the specific working process of the above-described system, device and unit can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的 划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods may be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or May be integrated into another system, or some features may be ignored, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the functions described above are realized in the form of software function units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions are used to make a computer device (personal computer, server, or network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (read-only memory, ROM), random access memory (random access memory, RAM), magnetic disk or optical disc and other media that can store program codes. .
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above is only a specific embodiment of the application, but the scope of protection of the application is not limited thereto. Any person familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the application. Should be covered within the protection scope of this application. Therefore, the protection scope of the present application should be determined by the protection scope of the claims.

Claims (17)

  1. 一种文件读取方法,应用于存储控制器,其特征在于,包括:A file reading method applied to a storage controller, characterized in that it comprises:
    通过文件读取接口获得来自处理器的文件读取请求;Obtain a file read request from the processor through the file read interface;
    其中,所述文件读取请求携带目标索引节点的逻辑地址、起始偏移地址和目标数据的长度,所述目标数据为目标文件中的至少一部分数据,所述目标索引节点为所述目标文件的索引节点,所述起始偏移地址用于指示所述目标数据在所述目标文件中的起始位置,所述目标索引节点用于指示所述目标文件中的数据;Wherein, the file read request carries the logical address of the target index node, the start offset address and the length of the target data, the target data is at least a part of data in the target file, and the target index node is the index node, the start offset address is used to indicate the start position of the target data in the target file, and the target index node is used to indicate the data in the target file;
    根据所述目标索引节点的逻辑地址、起始偏移地址和目标数据的长度,从所述目标文件中读取所述目标数据;Reading the target data from the target file according to the logical address of the target index node, the start offset address and the length of the target data;
    将所述目标数据发送至所述处理器。The target data is sent to the processor.
  2. 根据权利要求1所述的方法,其特征在于,所述目标索引节点指示所述目标文件的地址列表,其中,所述目标文件的地址列表包括多个偏移地址和多个数据块逻辑地址的一一对应关系;The method according to claim 1, wherein the target index node indicates an address list of the target file, wherein the address list of the target file includes a plurality of offset addresses and a plurality of data block logical addresses one-to-one correspondence;
    所述根据所述目标索引节点的逻辑地址、起始偏移地址和目标数据的长度,从所述目标文件中读取所述目标数据包括:According to the logical address of the target index node, the start offset address and the length of the target data, reading the target data from the target file includes:
    根据所述目标索引节点的逻辑地址确定所述目标索引节点;determining the target index node according to the logical address of the target index node;
    根据所述目标数据的长度和所述起始偏移地址,并结合所述目标索引节点指示的所述目标文件的地址列表,确定所述目标数据对应的数据块逻辑地址;determining the logical address of the data block corresponding to the target data according to the length of the target data and the start offset address, and in combination with the address list of the target file indicated by the target inode;
    根据所述目标数据对应的数据块逻辑地址,读取所述目标数据。The target data is read according to the logical address of the data block corresponding to the target data.
  3. 根据权利要求2所述的方法,其特征在于,所述目标索引节点包括多个直接指针、多个一级间接指针、多个二级间接指针、至少一个三级间接指针;The method according to claim 2, wherein the target index node includes multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer;
    所述指针的优先级由高到低的顺序依次为:所述多个直接指针、所述多个一级间接指针、所述多个二级间接指针、所述至少一个三级间接指针;The priority order of the pointers from high to low is: the multiple direct pointers, the multiple first-level indirect pointers, the multiple second-level indirect pointers, and the at least one third-level indirect pointer;
    按照优先级由高到低的顺序,所述多个直接指针、多个一级间接指针、多个二级间接指针、至少一个三级间接指针中的至少一项用于指示所述目标文件的地址列表。According to the order of priority from high to low, at least one of the multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer is used to indicate the target file address list.
  4. 根据权利要求3所述的方法,其特征在于,所述根据所述目标数据的长度和所述起始偏移地址,并结合所述目标索引节点指示的所述目标文件的地址列表,确定所述目标数据对应的数据块逻辑地址包括:The method according to claim 3, characterized in that, according to the length of the target data and the start offset address, and in combination with the address list of the target file indicated by the target index node, determine the The logical address of the data block corresponding to the target data includes:
    根据所述目标数据的长度和所述起始偏移地址,并基于所述多个直接指针、所述多个一级间接指针、所述多个二级间接指针或所述至少一个三级间接指针中的至少一项所指示的目标文件的地址列表,确定所述目标数据对应的数据块逻辑地址。According to the length of the target data and the start offset address, and based on the plurality of direct pointers, the plurality of first-level indirect pointers, the plurality of second-level indirect pointers, or the at least one third-level indirect The address list of the target file indicated by at least one of the pointers determines the logical address of the data block corresponding to the target data.
  5. 根据权利要求1所述的方法,其特征在于,所述目标索引节点中存储所述目标文件 的数据;The method according to claim 1, wherein the data of the target file is stored in the target index node;
    所述根据所述目标索引节点的逻辑地址、起始偏移地址和目标数据的长度,从所述目标文件中读取所述目标数据包括:According to the logical address of the target index node, the start offset address and the length of the target data, reading the target data from the target file includes:
    根据所述目标索引节点的逻辑地址确定所述目标索引节点;determining the target index node according to the logical address of the target index node;
    根据所述起始偏移地址和所述目标数据的长度,从所述目标索引节点中存储的所述目标文件的数据中读取所述目标数据。Reading the target data from data of the target file stored in the target index node according to the start offset address and the length of the target data.
  6. 根据权利要求5所述的方法,其特征在于,所述目标索引节点包括多个直接指针、多个一级间接指针、多个二级间接指针、至少一个三级间接指针;The method according to claim 5, wherein the target index node includes multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer;
    所述指针的优先级由高到低的顺序依次为:所述多个直接指针、所述多个一级间接指针、所述多个二级间接指针、所述至少一个三级间接指针;The priority order of the pointers from high to low is: the multiple direct pointers, the multiple first-level indirect pointers, the multiple second-level indirect pointers, and the at least one third-level indirect pointer;
    在所述目标文件的大小小于或等于第一预设值的情况下:In the case where the size of the target file is less than or equal to the first preset value:
    所述多个直接指针用于存储所述目标文件的数据;The multiple direct pointers are used to store data of the target file;
    所述根据所述起始偏移地址和所述目标数据的长度,从所述目标索引节点中存储的所述目标文件的数据中读取所述目标数据包括:The reading the target data from the data of the target file stored in the target index node according to the start offset address and the length of the target data includes:
    根据所述起始偏移地址和所述目标数据的长度,从所述多个直接指针中存储的目标文件的数据中读取所述目标数据。Reading the target data from the data of the target file stored in the plurality of direct pointers according to the start offset address and the length of the target data.
  7. 一种文件读取方法,应用于处理器,其特征在于,包括:A file reading method, applied to a processor, is characterized in that, comprising:
    通过文件读取接口向所述存储控制器发送文件读取请求;Sending a file reading request to the storage controller through the file reading interface;
    其中,所述文件读取请求携带目标索引节点的逻辑地址、起始偏移地址和目标数据的长度,所述目标数据为目标文件中的至少一部分数据,所述目标索引节点为所述目标文件的索引节点,所述起始偏移地址用于指示所述目标数据在所述目标文件中的起始位置,所述目标索引节点用于指示所述目标文件中的数据;Wherein, the file read request carries the logical address of the target index node, the start offset address and the length of the target data, the target data is at least a part of data in the target file, and the target index node is the index node, the start offset address is used to indicate the start position of the target data in the target file, and the target index node is used to indicate the data in the target file;
    接收所述存储控制器响应于所述文件读取请求返回的所述目标数据。receiving the target data returned by the storage controller in response to the file read request.
  8. 一种文件读取装置,应用于存储控制器,其特征在于,包括:A file reading device applied to a storage controller, characterized in that it comprises:
    获得模块,用于通过文件读取接口获得来自处理器的文件读取请求;Obtaining a module for obtaining a file reading request from a processor through a file reading interface;
    其中,所述文件读取请求携带目标索引节点的逻辑地址、起始偏移地址和目标数据的长度,所述目标数据为目标文件中的至少一部分数据,所述目标索引节点为所述目标文件的索引节点,所述起始偏移地址用于指示所述目标数据在所述目标文件中的起始位置,所述目标索引节点用于指示所述目标文件中的数据;Wherein, the file read request carries the logical address of the target index node, the start offset address and the length of the target data, the target data is at least a part of data in the target file, and the target index node is the index node, the start offset address is used to indicate the start position of the target data in the target file, and the target index node is used to indicate the data in the target file;
    读取模块,用于根据所述目标索引节点的逻辑地址、起始偏移地址和目标数据的长度,从所述目标文件中读取所述目标数据;A reading module, configured to read the target data from the target file according to the logical address of the target index node, the start offset address and the length of the target data;
    发送模块,用于将所述目标数据发送至所述处理器。A sending module, configured to send the target data to the processor.
  9. 根据权利要求8所述的装置,其特征在于,所述目标索引节点指示所述目标文件的地址列表,其中,所述目标文件的地址列表包括多个偏移地址和多个数据块逻辑地址的一 一对应关系;The device according to claim 8, wherein the target index node indicates an address list of the target file, wherein the address list of the target file includes a plurality of offset addresses and a plurality of data block logical addresses one-to-one correspondence;
    所述读取模块,具体用于根据所述目标索引节点的逻辑地址确定所述目标索引节点;根据所述目标数据的长度和所述起始偏移地址,并结合所述目标索引节点指示的所述目标文件的地址列表,确定所述目标数据对应的数据块逻辑地址;根据所述目标数据对应的数据块逻辑地址,读取所述目标数据。The reading module is specifically configured to determine the target index node according to the logical address of the target index node; according to the length of the target data and the start offset address, combined with the target index node indicated The address list of the target file determines the logical address of the data block corresponding to the target data; reads the target data according to the logical address of the data block corresponding to the target data.
  10. 根据权利要求9所述的装置,其特征在于,所述目标索引节点包括多个直接指针、多个一级间接指针、多个二级间接指针、至少一个三级间接指针;The device according to claim 9, wherein the target index node includes multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer;
    所述指针的优先级由高到低的顺序依次为:所述多个直接指针、所述多个一级间接指针、所述多个二级间接指针、所述至少一个三级间接指针;The priority order of the pointers from high to low is: the multiple direct pointers, the multiple first-level indirect pointers, the multiple second-level indirect pointers, and the at least one third-level indirect pointer;
    按照优先级由高到低的顺序,所述多个直接指针、多个一级间接指针、多个二级间接指针、至少一个三级间接指针中的至少一项用于指示所述目标文件的地址列表。According to the order of priority from high to low, at least one of the multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer is used to indicate the target file address list.
  11. 根据权利要求10所述的装置,其特征在于,所述读取模块,具体用于根据所述目标数据的长度和所述起始偏移地址,并基于所述多个直接指针、所述多个一级间接指针、所述多个二级间接指针或所述至少一个三级间接指针中的至少一项所指示的目标文件的地址列表,确定所述目标数据对应的数据块逻辑地址。The device according to claim 10, wherein the reading module is specifically configured to, according to the length of the target data and the start offset address, and based on the multiple direct pointers, the multiple The address list of the target file indicated by at least one of the first-level indirect pointers, the plurality of second-level indirect pointers, or the at least one third-level indirect pointer determines the logical address of the data block corresponding to the target data.
  12. 根据权利要求8所述的装置,其特征在于,所述目标索引节点中存储所述目标文件的数据;The device according to claim 8, wherein the data of the target file is stored in the target index node;
    所述读取模块,具体用于根据所述目标索引节点的逻辑地址确定所述目标索引节点;根据所述起始偏移地址和所述目标数据的长度,从所述目标索引节点中存储的所述目标文件的数据中读取所述目标数据。The reading module is specifically configured to determine the target index node according to the logical address of the target index node; according to the start offset address and the length of the target data, the The target data is read from data in the target file.
  13. 根据权利要求12所述的装置,其特征在于,所述目标索引节点包括多个直接指针、多个一级间接指针、多个二级间接指针、至少一个三级间接指针;The device according to claim 12, wherein the target index node includes multiple direct pointers, multiple first-level indirect pointers, multiple second-level indirect pointers, and at least one third-level indirect pointer;
    所述指针的优先级由高到低的顺序依次为:所述多个直接指针、所述多个一级间接指针、所述多个二级间接指针、所述至少一个三级间接指针;The priority order of the pointers from high to low is: the multiple direct pointers, the multiple first-level indirect pointers, the multiple second-level indirect pointers, and the at least one third-level indirect pointer;
    在所述目标文件的大小小于或等于第一预设值的情况下:In the case where the size of the target file is less than or equal to the first preset value:
    所述多个直接指针用于存储所述目标文件的数据;The multiple direct pointers are used to store data of the target file;
    所述读取模块,具体用于根据所述起始偏移地址和所述目标数据的长度,从所述多个直接指针中存储的目标文件的数据中读取所述目标数据。The reading module is specifically configured to read the target data from the data of the target file stored in the multiple direct pointers according to the start offset address and the length of the target data.
  14. 一种文件读取装置,应用于处理器,其特征在于,包括:A file reading device applied to a processor, characterized in that it comprises:
    发送模块,用于通过文件读取接口向所述存储控制器发送文件读取请求;A sending module, configured to send a file reading request to the storage controller through the file reading interface;
    其中,所述文件读取请求携带目标索引节点的逻辑地址、起始偏移地址和目标数据的长度,所述目标数据为目标文件中的至少一部分数据,所述目标索引节点为所述目标文件的索引节点,所述起始偏移地址用于指示所述目标数据在所述目标文件中的起始位置,所 述目标索引节点用于指示所述目标文件中的数据;Wherein, the file read request carries the logical address of the target index node, the start offset address and the length of the target data, the target data is at least a part of data in the target file, and the target index node is the index node, the start offset address is used to indicate the start position of the target data in the target file, and the target index node is used to indicate the data in the target file;
    接收模块,用于接收所述存储控制器响应于所述文件读取请求返回的所述目标数据。A receiving module, configured to receive the target data returned by the storage controller in response to the file read request.
  15. 一种计算机可读存储介质,包括计算机程序,所述计算机程序在存储控制器或处理器上被执行时,使得所述存储控制器执行权利要求1~6中任一项所述的方法,或使得所述处理器执行权利要求7所述的方法。A computer-readable storage medium comprising a computer program that, when executed on a storage controller or a processor, causes the storage controller to perform the method of any one of claims 1-6, or causing the processor to perform the method of claim 7.
  16. 一种计算机程序,当所述计算机程序被存储控制器或处理器执行时,用于执行权利要求1~6,或7中任一项所述的方法。A computer program, used to execute the method according to any one of claims 1-6 or 7 when said computer program is executed by a storage controller or a processor.
  17. 一种电子设备,包括:处理器和存储控制器,其中;An electronic device comprising: a processor and a memory controller, wherein;
    所述存储控制器用于执行权利要求1~6中任一项所述的方法;The storage controller is configured to execute the method according to any one of claims 1-6;
    所述处理器用于执行权利要求7所述的方法。The processor is configured to perform the method of claim 7.
PCT/CN2022/074786 2022-01-28 2022-01-28 File reading method and apparatus WO2023141987A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2022/074786 WO2023141987A1 (en) 2022-01-28 2022-01-28 File reading method and apparatus
CN202280004002.0A CN116830096A (en) 2022-01-28 2022-01-28 File reading method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2022/074786 WO2023141987A1 (en) 2022-01-28 2022-01-28 File reading method and apparatus

Publications (1)

Publication Number Publication Date
WO2023141987A1 true WO2023141987A1 (en) 2023-08-03

Family

ID=87470084

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/074786 WO2023141987A1 (en) 2022-01-28 2022-01-28 File reading method and apparatus

Country Status (2)

Country Link
CN (1) CN116830096A (en)
WO (1) WO2023141987A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140304226A1 (en) * 2013-04-04 2014-10-09 Hitachi, Ltd. Storage system
CN105630779A (en) * 2014-10-27 2016-06-01 杭州海康威视系统技术有限公司 Hadoop distributed file system based small file storage method and apparatus
CN105830059A (en) * 2014-11-28 2016-08-03 华为技术有限公司 Fine pitch connector socket
US20200192815A1 (en) * 2018-12-17 2020-06-18 SK Hynix Inc. Data storage device, operation method thereof, and storage system including the same

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140304226A1 (en) * 2013-04-04 2014-10-09 Hitachi, Ltd. Storage system
CN105630779A (en) * 2014-10-27 2016-06-01 杭州海康威视系统技术有限公司 Hadoop distributed file system based small file storage method and apparatus
CN105830059A (en) * 2014-11-28 2016-08-03 华为技术有限公司 Fine pitch connector socket
US20200192815A1 (en) * 2018-12-17 2020-06-18 SK Hynix Inc. Data storage device, operation method thereof, and storage system including the same

Also Published As

Publication number Publication date
CN116830096A (en) 2023-09-29

Similar Documents

Publication Publication Date Title
JP6553649B2 (en) Clustering storage method and apparatus
JP5524144B2 (en) Memory system having a key-value store system
US7689574B2 (en) Index and method for extending and querying index
CN109446362B (en) Graph database structure based on external memory, graph data storage method and device
WO2018064962A1 (en) Data storage method, electronic device and computer non-volatile storage medium
CN110018998B (en) File management method and system, electronic equipment and storage medium
US10210196B2 (en) Data storage device having internal hardware filter, data storage method and data storage system
JP2005267600A5 (en)
WO2018205151A1 (en) Data updating method and storage device
CN103345469A (en) Storing and inquiring method and device of number sets
JP2011215835A (en) Storage device having full-text search function
JP5646775B2 (en) Memory system having a key-value store system
JP6258436B2 (en) Memory system local controller
WO2023141987A1 (en) File reading method and apparatus
JP5833212B2 (en) Memory system having a key-value store system
CN111752941A (en) Data storage method, data access method, data storage device, data access device, server and storage medium
CN112380171B (en) YAFFS file system OOB identification method, terminal device and storage medium
JP6034467B2 (en) system
CN107846327A (en) A kind of processing method and processing device of network management performance data
US20200311030A1 (en) Optimizing file system defrag for deduplicated block storage
US11892951B2 (en) Key packing for flash key value store operations
CN112380174B (en) XFS file system analysis method containing deleted files, terminal device and storage medium
CN116450591B (en) Data processing method, device, computer equipment and storage medium
US11914587B2 (en) Systems and methods for key-based indexing in storage devices
US20230385240A1 (en) Optimizations for data deduplication operations

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 202280004002.0

Country of ref document: CN

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22922827

Country of ref document: EP

Kind code of ref document: A1