WO2016206070A1 - File updating method and storage device - Google Patents

File updating method and storage device Download PDF

Info

Publication number
WO2016206070A1
WO2016206070A1 PCT/CN2015/082442 CN2015082442W WO2016206070A1 WO 2016206070 A1 WO2016206070 A1 WO 2016206070A1 CN 2015082442 W CN2015082442 W CN 2015082442W WO 2016206070 A1 WO2016206070 A1 WO 2016206070A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
data
update
read
block number
Prior art date
Application number
PCT/CN2015/082442
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/CN2015/082442 priority Critical patent/WO2016206070A1/en
Priority to CN201580001153.0A priority patent/CN107430546B/en
Publication of WO2016206070A1 publication Critical patent/WO2016206070A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation

Definitions

  • the present invention relates to the field of file systems, and in particular, to a file update method and a storage device.
  • each file contains file metadata and actual data.
  • the file metadata includes file permissions (rxw) in Linux, file attributes (owner, group, time parameters, etc.) and save files. Data storage location.
  • the file system usually stores the two pieces of data in different blocks, the permissions and attributes are placed in the index node, and the actual data is placed in the data block.
  • the index node records the attributes of the file.
  • a file occupies an index node and records the location of the data block where the data of the file is located.
  • each index node and data block are numbered, and each file occupies an index node, the index node has a pointer to a logical block number of a data block for storing file data. Therefore, if the index node of the file can be found, then the logical block number of the data block storing the data can naturally be known, and the actual data of the file at the physical address can be read by the logical block number.
  • the invention provides a file updating method, which can reduce the modification of the metadata when updating the file data of the file system, and has a simple method and can improve the update efficiency of the file data.
  • a first aspect of the embodiments of the present invention provides a file update method, which may include:
  • Receiving a file update request where the file update request carries a file identifier of the first file, a first file offset, and second data, where the second data is used to update the first data in the first file; Allocating an idle data block to the second data according to a size of the second data;
  • the method may further include:
  • Reading the data to be read according to the physical address of the data to be read.
  • the method further includes:
  • the update flag bit in the index node of the first file is set to have an update, and the update flag bit is used to determine an update status of the first file.
  • the method further includes:
  • the method further includes:
  • the update flag bit is used to determine an update status of the second file.
  • the second aspect of the embodiment of the present invention further provides an apparatus, which may include:
  • a receiving module configured to receive a file update request, where the file update request carries a file identifier of the first file, a first file offset, and second data, where the second data is used to update the first file First data;
  • An allocating module configured to allocate an idle data block to the second data according to the size of the second data
  • a writing module configured to write the second data into the allocated data block
  • a determining module configured to determine, according to the first file offset, a file block number of the first data, where the file block number is used to identify a logical location of the first data
  • a recording module configured to record, in a file update table pointed by the first pointer in the index node of the first file, a file block number of the first data and a logical block number of a data block storing the second data Corresponding relationship, the logical block number is used to point to a physical address storing the second data;
  • the state setting module sets the state of the first data to be invalid in a file state table pointed by the second pointer in the index node.
  • the receiving module is further configured to receive a file read request, where the file read request carries a file identifier of the second file and a second file offset;
  • the determining module is further configured to determine an index node of the second file according to the file identifier of the second file;
  • the storage device may further include:
  • a searching module configured to determine, according to a file update table pointed by the first pointer in the index node of the second file, a logical block number corresponding to a file block number of the data to be read;
  • a reading module configured to determine a physical address of the data to be read according to a logical block number corresponding to the file block number of the data to be read, and read the data to be read according to the physical address of the data to be read .
  • the status setting module is further configured to set an update flag bit in the index node of the first file to be updated, and the update flag bit is used to determine an update status of the first file.
  • the determining module is further configured to:
  • the update flag bit is used to determine an update status of the second file.
  • the third aspect of the embodiment of the present invention further provides a storage device, where the file system is established, and the storage device may include:
  • a memory for storing file data
  • a controller configured to receive a file update request, where the file update request carries a file identifier of the first file, a first file offset, and second data, where the second data is used for updating The first data in the file;
  • the controller is also used to:
  • Reading the data to be read according to the physical address of the data to be read.
  • the controller is further configured to:
  • the update flag bit in the index node of the first file is set to have an update, and the update flag bit is used to determine an update status of the first file.
  • the controller is further configured to:
  • Determining the second according to an update flag bit in an index node of the second file before determining a state of the data to be read according to a file state table pointed to by a second pointer in the index node of the second file The file has an update, and the update flag is used to determine an update status of the second file.
  • the embodiment of the present invention has the following advantages: the embodiment of the present invention has a first update pointer and a second pointer to the two tables in the index node because the file update table and the file state table are set.
  • the update table stores the correspondence between the file block number of the file and the logical block number.
  • the second data is first stored in the allocated free data block to determine the file block number of the first data, and then Determining an index node according to the first file, determining a file update table and a file status table, and then recording, in the file update table, a correspondence between a file block number of the first data and a logical block number of the data block storing the second data, It is possible to correspond to the new logical block number by the file block number, and After the status of the first data is set to invalid in the file status table, the data update operation can be completed.
  • the metadata modification can be reduced when the file data of the file system is updated, and the copying and disk fragmentation of the data block can be reduced. And the method is simple, and the update efficiency of the file data can be improved.
  • FIG. 1 is a schematic diagram of a storage system to which a file update method in an embodiment of the present invention is applied;
  • FIG. 2 is a diagram showing a file system update state of a conventional copy-on-write technique
  • FIG. 3 is a diagram of an embodiment of a file update method according to an embodiment of the present invention.
  • FIG. 4 is a diagram showing another embodiment of a file updating method according to an embodiment of the present invention.
  • FIG. 5 is a diagram of another embodiment of a file update method according to an embodiment of the present invention.
  • FIG. 6 is a diagram of an embodiment of a storage device according to an embodiment of the present invention.
  • FIG. 7 is a diagram of another embodiment of a storage device according to an embodiment of the present invention.
  • FIG. 8 is a schematic structural diagram of a storage device according to an embodiment of the present invention.
  • Figure 9 is a diagram showing another embodiment of a storage device in an embodiment of the present invention.
  • the embodiment of the invention provides a file updating method and a storage device, which are used to solve the problem that the metadata modified by the existing COW file system is more complicated and complicated, which leads to low efficiency and excessive disk fragmentation. The problem.
  • FIG. 2 is a schematic structural diagram of a storage system according to an embodiment of the present invention.
  • the storage system is connected to a server 101 through a channel switch 102.
  • the storage system includes at least one storage device 103.
  • the channel switch 102 Each of the at least one storage device 103 is connected to the storage device 103.
  • the file system module 1011 for managing the storage device is further disposed in the server 101.
  • the system controls the storage device 103 through the file system module 1011 in the server 101 in cooperation with the channel switch 102, such as the file system module 1011 reading data from the storage device 103 through the Fibre Channel switch 102 or to the storage device.
  • 103 stores data.
  • the channel switch 102 can be a Fibre Channel switch or other channel switch capable of supporting a larger bandwidth, as long as there is sufficient bandwidth between the server 101 and the storage device 103 to transmit data.
  • the embodiment of the present invention can also be applied to DAS Direct-Attached Storage, SAN Storage Area Network, and network connection.
  • the application scenario of the embodiment of the present invention is not limited herein.
  • FIG. 2 is a file system update state diagram of a conventional copy-on-write technology.
  • point A is a file system tree.
  • Root node, C node and E node are indexes pointing to the data block where the data in the file is located Node, when it is necessary to update the data block pointed to by the C node, the update data is written into the free new data block, and a new index node C' node is generated, and the C' node points to the new data block.
  • the number of the B nodes may be more than one, such as having a B node and a D node at the same time, and the B node and the D node are at the same level.
  • the B node points to the C node and the E node at the same time, and the D node points to the F node.
  • the F node and the C node and the E node are both the index nodes pointing to the data block where the data in the file is located.
  • the A node does not directly point to the C node, but first points to the B node, and then the B node points to the C node. Therefore, when updating, it starts from the C node, first establishes the C' node, and then establishes the pointing to the C' node. The B' node, while the B' node points to the E node, and finally establishes the A' node pointing to the B' node, and the A' node points to the D node. Finally, the A node pointed to by the super block is changed to point to the A' node, and the data is completed. Update.
  • each modification of the user data will result in the copying and modification of a batch of related metadata blocks (such as C node, B node and A node).
  • the file system will not update the index node in situ (eg C nodes) and indirect pointers (such as Node B) must be copied and modified in a new location.
  • the file system must force all blocks to be completely written to disk, which results in large delays, inefficiencies in the update operation, and invalid old blocks each time a new block of data needs to be allocated, which can result in a lot of disk fragmentation. .
  • FIG. 3 is a schematic flowchart of a method for updating a file according to an embodiment of the present invention.
  • the method may be executed by the server 101 in the storage system shown in FIG. 1 or by a file system module in a storage device.
  • the file update request carries a file identifier of the first file, a first file offset, and second data, and the second data is used to update the first data in the file.
  • the file system After receiving the file update request, the file system allocates an idle data block for the second data according to the size of the second data to facilitate writing the second data.
  • the second data is written into the allocated data block.
  • the file block number is used to identify the logical location of the first data, the file identifier can be used to determine the update file, and then the file block number of the first data can be obtained by the file offset.
  • the file block number is that the file is divided into several file blocks according to a fixed value of the preset file block size when storing, such as the first file here, and each file block is set to one.
  • the file block number, and the first file offset is a specific value, which is used to determine the file block number corresponding to the first data to be updated, that is, when determining the file block number, only the corresponding first file offset needs to be known.
  • the shift amount can be calculated by the first file offset and the preset fixed value.
  • the logical position corresponds to a specific point on the X axis, which is the starting point of the logical position
  • the file block number corresponds to a segment of the line on the X axis
  • the length of the line segment is The size of the file block
  • the first file offset is a specific point
  • the file block number corresponding to the line segment is determined by judging the line segment in which the point falls.
  • the index node of the first file can be determined according to the file identifier of the first file.
  • a first pointer is set in the index node of the first file, the first pointer points to the file update table, and the first pointer in the index node can be determined according to the index node of the first file, so that the file update table can be determined, and the table is updated.
  • the correspondence between the file block number of the file and the logical block number is stored.
  • the file block number and storage of the first data can be recorded in the file update table.
  • Corresponding relationship of the logical block numbers of the data blocks of the second data so that the logical block numbers corresponding to the second data correspond to the file block numbers corresponding to the first data.
  • a second pointer is disposed in the index node of the first file, the second pointer points to the file state table, and the file state table is determined according to the second pointer, and the file state table stores a state for indicating validity of the data.
  • the status of the first data is set to invalid to indicate that the first data has been updated.
  • the index node since the file update table and the file status table are set, the index node has a first pointer and a second pointer to the two tables, and the update table stores the file block number and the logical block number of the file. Correspondence relationship.
  • the second data is first stored in the allocated free data block, the file block number of the first data is determined, and then the index node is determined according to the first file, and the file update table and the file status table are determined.
  • the correspondence between the file block number of the first data and the logical block number of the data block storing the second data is recorded in the file update table, so that the file block number corresponds to the new logical block number, and then the file status is achieved.
  • the status of the first data is set to be invalid, and the data update operation can be completed.
  • the modification of the metadata can be reduced when the file data of the file system is updated, and the method is simple, and the file data can be improved.
  • the update efficiency and can reduce the copy of the data block and disk fragmentation, and ultimately achieve the purpose of improving the efficiency of the update operation.
  • the update flag bit can be used to quickly identify whether the file corresponding to the index node is updated. It should be noted that the setting mode of the state in the file state table is more important, which directly affects whether the file system can quickly find the state of locating the first data. One of the setting modes is described below, which can improve the efficiency of the first data of the file system. .
  • the file status table in which the status of each data is recorded is arranged in the order of the file block number. Since the file block number is determined when the file is stored, the file block number is not determined. The corresponding logical block number is changed, so that the state of the data can be quickly obtained after the file block number of the data is known, and the state of the data is arranged in the order of the file block number, and the number can be known. According to the file block number, the state of quickly finding the data is beneficial to improve the efficiency of file update. For the first data, the efficiency of the file system setting the state corresponding to the first data can be improved, thereby improving the efficiency of file update. .
  • the state of the data arranged in the order of the file block number is adopted, and when the second data is substituted for the first data and the state needs to be set to be invalid, the file of the first data is first passed.
  • the block number looks up the state of the first data corresponding to the file block number in the file status table, and then sets the state of the first data to be invalid.
  • an update flag bit may also be set in the index node to indicate that the data corresponding to the index node is updated; please refer to FIG. 4, which is another implementation of the file update method in the embodiment of the present invention. As shown in FIG. 4, in addition to the file update method shown in FIG. 3, steps 401 to 407 are similar to steps 301 to 307, and the file update method further includes
  • the update flag is used to determine the update status of the first file.
  • the update flag can be used to quickly identify whether the file corresponding to the index node is updated, although the identifier of the data in the file status table can be known. Whether there is data update, but there are two disadvantages. One is that the file status table needs to be determined by the second pointer in the index node of the first file, and the invalid identifier in the file status table is determined. Therefore, in the manner of the foregoing step 408, it is possible to directly learn from the index node of the first file whether the file corresponding to the index node is updated, and it is not necessary to determine the file state table by using the second pointer, thereby greatly improving the execution efficiency of the file system update. .
  • FIG. 5 is a schematic diagram of another embodiment of a method for updating a file according to an embodiment of the present invention.
  • the method for reading data in the method for updating a file according to an embodiment of the present invention is as shown in FIG. 5 , and the update method in this embodiment may also be used.
  • the update method in this embodiment may also be used.
  • the file read request carries the file identifier of the second file and the second file offset.
  • the file read request is sent to the file system.
  • the index node corresponding to the second file is first determined according to the second file, so as to query the actual storage location of the data to be read according to the index node.
  • the file block number of the data to be read can be determined by the second file offset for subsequent use.
  • the status of the data to be read in the file status table is determined.
  • the subsequent steps are performed.
  • the file update table is determined according to the first pointer of the index node, and then the logical block number corresponding to the file block number of the data to be read is determined by the file update table.
  • the physical address of the actual storage location of the data to be read may be determined according to the correspondence between the logical block number and the physical address.
  • Read data to be read according to a physical address of the data to be read.
  • the data stored in the physical disk can be read from the physical address, and the data reading process is completed.
  • the data to be read is updated data, that is, whether the state of the data to be read is invalid, and determining the file block by using the index node of the second file.
  • a chart and determining a state of the data to be read therein, such as an invalid identifier, indicating that the data corresponding to the state is erroneous data through the existing read, and at this time, the file update table is determined by the index node of the second file, Find the location of the file block number corresponding to the data to be read in the file update table, and then find the updated logical block number of the data to be read, and read the physical disk to be read by the physical address corresponding to the logical block number.
  • Data is taken, and the data is first read when reading by the solution of the embodiment of the present invention. The judgment is made, and then the subsequent reading operation is performed according to the judgment result. Since the data storage location on the index node is not directly read, when the reading is performed, the data reading error does not occur, and the reading table is read by reading.
  • the logic block number reads the manner of the data to be read, further increasing the achievability of the file update method of the embodiment of the present invention.
  • the file update table and the file status table are set, and since the index node has the first pointer and the second pointer pointing to the two tables, when reading the data to be read, for the two types of data to be read, That is, the updated data and the unupdated data are different in reading manner, that is, when determining that the state of the data to be read is invalid and non-invalid, there are two different ways:
  • the data to be read is the updated data
  • the data is read in the manner shown in steps 501 to 507 above. If the data to be read is unupdated data, the third pointer in the index node is pointed. The data block position reads the data to be read.
  • the file system reads the data by searching for the third pointer in the index node corresponding to the data to be read, and reading the data block position pointed by the third pointer. The data to be read.
  • the data block position pointed by the third pointer in the index node can be read and read. data.
  • the update table is first determined by the index node, and then the logical block number corresponding to the file block number of the data to be read is searched from the update table, and then passed.
  • the logical block number reads the data to be read on the physical block corresponding to the logical block number, and the two reading modes can be arbitrarily set to one of them.
  • the data processing method may further include: before determining, according to the file state table pointed by the second pointer in the index node of the second file, the data processing method:
  • the update flag is used to determine an update status of the second file, and when it is determined that there is an update, triggering the second pointer of the index node according to the second file to determine the file status table.
  • this update flag bit is to know whether the data corresponding to the index node is updated only by reading the index node, without first reading the file status table, and then searching the file status table.
  • the data processing method may further include: in step 504, before determining the state of the data to be read according to the file state table pointed by the second pointer in the index node of the second file, the data processing method may further include:
  • the second file is determined to be non-updated according to the update flag bit in the index node of the second file.
  • the data pointer pointing to the actual location of the data in the index node of the second file is directly acquired, and the data to be read on the physical address is read by the pointer.
  • the data pointer when reading the data to be read, if the index node of the second file corresponds to more data, the data pointer can also be used as the intermediate pointer to point to the actual pointer, and then the actual pointer points to the actual data to be read. .
  • the data to be read may also be read in the manner of steps 504 to 507, and the selection may be performed according to the requirement of the read data.
  • FIG. 6 is an embodiment of the storage device in the embodiment of the present invention, and FIG. 6 provides A storage device can include:
  • the receiving module 601 is configured to receive a file update request, where the file update request carries a file identifier of the first file, a first file offset, and second data, where the second data is used to update the first data in the first file;
  • the allocating module 602 is configured to allocate idle data blocks to the second data according to the size of the second data
  • a writing module 603, configured to write the second data into the allocated data block
  • a determining module 604 configured to determine a file block number of the first data according to the first file offset, where the file block number is used to identify a logical position of the first data;
  • a recording module 605 configured to record, in a file update table pointed by the first pointer in the index node of the first file, a correspondence between a file block number of the first data and a logical block number of the data block storing the second data, the logic block The number is used to point to the physical address where the second data is stored;
  • the state setting module 606 sets the state of the first data to be invalid in the file state table pointed to by the second pointer in the index node.
  • the index node since the file update table and the file state table are set, the index node has a first pointer and a second pointer pointing to the two tables, and the update table stores the file with the file. Corresponding relationship between the block number and the logical block number.
  • the second data is first stored in the allocated idle memory by the assigning module 602 through the writing module 603.
  • the file block number of the first data is determined by the determining module 604, and then the index node determines the file update table and the file status table according to the first file, and the first data is recorded in the file update table by the recording module 605.
  • the file status table in which the status of each data is recorded is arranged in the order of the file block number. Since the file block number is determined when the file is stored, the logical block number corresponding to the file block number is not used. The change is changed, so that the state of the data can be quickly obtained after knowing the file block number of the data.
  • By arranging the state of the data in the order of the file block number it is possible to quickly find the state of the data in the case of knowing the file block number of the data, which is advantageous for improving the efficiency of file update.
  • the efficiency of the file system setting the state corresponding to the first data can be improved, thereby improving the efficiency of file update.
  • the state setting module 606 is further configured to set the update flag bit in the index node of the first file to be updated.
  • the update flag is used to determine the update status of the first file.
  • the purpose of the state setting module 606 is to quickly identify whether the file corresponding to the index node is updated by using the update flag, although the status in the file status table can also be used to know whether there is data update, but the disadvantages are Two points, one of which is to determine the file status table through the second pointer in the index node of the first file, and determine the invalid identifier in the file status table. Therefore, the state setting module 606 can directly learn whether the file corresponding to the index node has an update from the index node of the first file, and does not need to determine the file state table by using the second pointer, thereby greatly improving the execution efficiency of the file system update.
  • FIG. 7 is stored in the embodiment of the present invention.
  • FIG. 7 provides a storage device for reading data, wherein
  • the receiving module 701 is further configured to receive a file read request, where the file read request carries a file identifier of the second file and a second file offset;
  • the determining module 704 is further configured to determine an index node of the second file according to the file identifier of the second file; determine a file block number of the data to be read according to the second file offset; and use a second one of the index nodes according to the second file
  • the file status table pointed to by the pointer determines that the status of the data to be read is invalid
  • the storage device also includes:
  • the searching module 707 is configured to determine, according to the file update table pointed to by the first pointer in the index node of the second file, a logical block number corresponding to the file block number of the data to be read;
  • the reading module 708 is configured to determine a physical address of the data to be read according to the logical block number corresponding to the file block number of the data to be read, and read the data to be read according to the physical address of the data to be read.
  • the receiving module 704 When the storage device in the embodiment of the present invention actually reads data, the receiving module 704 first receives the file reading request, and then the determining module 704 determines the index node of the second file according to the file identifier of the second file. Then, the determining module 704 determines the file block number of the data to be read according to the second file offset. Before reading the data to be read, it is necessary to determine whether the data to be read is updated data, that is, to determine the pending reading. Whether the state of the data is invalid, the determining module 704 determines the file block text chart according to the index node of the second file, and determines the state of the data to be read therein, and if it is invalid, it indicates that the data corresponding to the state passes the current state.
  • the search module 707 determines the file update table according to the index node of the second file, and finds the location of the file block number corresponding to the data to be read in the file update table, thereby finding the to-be-read. Taking the updated logical block number of the data, and then the reading module 708 determines the physicality of the data to be read according to the logical block number corresponding to the file block number of the data to be read. Address, and reads data to be read on a physical disk to the physical address corresponding to this logical block number.
  • the read data is first determined during reading, and then the subsequent read operation is performed according to the judgment result, since the data storage location on the index node is not directly read, so the read is performed.
  • the file updating method of the embodiment of the present invention is further increased. The achievability.
  • the determining module 704 is further configured to determine that the second file is updated according to the update flag bit in the index node of the second file.
  • the update flag is used to determine the update status of the second file.
  • the determination module 704 determines the file status table according to the second pointer of the index node of the second file.
  • this update flag bit is to know whether the data corresponding to the index node is updated only by reading the index node, without first reading the file status table, and then searching the file status table. In the state of the data to be read corresponding to the file block number of the data to be read, it is judged whether there is an update by the state, thereby saving data reading time and improving data reading efficiency.
  • FIG. 8 is a schematic structural diagram of a storage device according to an embodiment of the present invention.
  • a file system is established in the device, and the storage device 8 includes:
  • a memory 801 configured to store file data
  • the controller 802 is connected to the memory, and is configured to receive a file update request, where the file update request carries a file identifier of the first file, a first file offset, and second data, where the second data is used to update the file.
  • First data carries a file identifier of the first file, a first file offset, and second data, where the second data is used to update the file.
  • Corresponding relationship between a file block number of the first data and a logical block number of the data block storing the second data is recorded in the file update table pointed to by the first pointer in the index node of the first file, and the logical block number is used to point to the storage The physical address of the second data;
  • the state of the first data is set to be invalid in the file state table pointed to by the second pointer in the index node.
  • the memory 801 is used to store file data.
  • the controller 802 firstly The second data is stored in the allocated free data block, and the file block number of the first data is determined, and then the controller 802 determines the index node according to the first file, determines the file update table and the file status table, and then the controller 802 is in the file.
  • the correspondence between the file block number of the first data and the logical block number of the data block storing the second data is recorded in the update table, so that the file block number corresponds to the new logical block number, and then the controller 802 is in the file.
  • the state table the state of the first data is set to be invalid, and the data update operation is completed.
  • controller 802 may also perform a data reading operation, wherein the controller 802 may also perform the following operations:
  • the data to be read is read according to the physical address of the data to be read.
  • the file read request is first received by the controller 802, and then the controller 802 determines the second file according to the file identifier of the second file. The index node of the file, and then the controller 802 determines the file block number of the data to be read according to the second file offset. Before reading the data to be read, it is necessary to determine whether the data to be read is updated.
  • Data that is, determining whether the state of the data to be read is invalid, may be determined by the controller 802 according to the index node of the second file, and determining the state of the data to be read therein, if it is invalid, indicating The data corresponding to the status is erroneous data read by the existing one.
  • the controller 802 determines the file update table according to the index node of the second file, and finds the position of the file block number corresponding to the data to be read in the file update table. And then find the updated logical block of the data to be read.
  • controller 802 determines the physical address of the data to be read according to the logical block number corresponding to the file block number of the data to be read, and the controller 802 reads the physical address on the physical disk through the physical address corresponding to the logical block number. The data to be read.
  • controller 802 is further configured to:
  • the update flag bit in the index node of the first file is set to have an update, and the update flag bit is used to determine an update status of the first file.
  • the controller 802 can quickly identify whether the file corresponding to the index node is updated by using the update flag bit.
  • the status of the data in the file status table can be used to know whether there is data update, there are two disadvantages.
  • One is that the file status table needs to be determined by the second pointer in the index node of the first file, and the invalid identifier in the file status table is determined. Therefore, if the controller 802 can directly learn from the index node of the first file whether the file corresponding to the index node has an update, and does not need to determine the file state table by using the second pointer, the execution efficiency of the file system update is greatly improved.
  • controller 802 is further configured to:
  • the controller 802 determines that the second file is updated according to the update flag bit in the index node of the second file, and the update flag is used to determine the second file. update status. Therefore, if this step is used to update the update flag, it indicates that the second file has been updated.
  • the existing read mode may not read the data to be read. Therefore, it is necessary to first go to the file status table to determine the pending read. The state of the data is fetched, and then the manner in which the data to be read is read is determined, thereby improving the execution efficiency of the file system update.
  • a communication interface and a cache are further disposed in the storage device 8 in the embodiment of the present invention, where: the communication interface 803 is configured to allow the storage device to communicate with the external device;
  • the cache 804 is used for data interaction between the controller and the memory, and the cache is set between the controller and the storage.
  • the communication interface 803 is connected to the controller 802, and is used for the storage device and the external device.
  • the line communication may be a physical wired interface such as an Ethernet interface or a fiber interface, or may be a wireless interface, which is determined by a specific application scenario of the storage device, and is not limited.
  • the cache 804 serves as a buffer between the memory 801 and the controller 802. Since the rate of the file data of the controller 802 is much larger than the read data of the memory 801, the cache 804 is read between the memory 801 and the controller 802, and the cache 804 is read. The rate at which the data is fetched is much larger than the memory 801, and is smaller than the rate at which the controller 802 reads the data. Therefore, by setting the buffer 804, the data that needs to be operated is read from the memory 801 into the cache 804 in advance, and then The controller 801 operates to greatly improve the reading efficiency of the data, thereby improving the operating efficiency of the storage device.
  • FIG. 9 is in the embodiment of the present invention.
  • FIG. 9 is in the embodiment of the present invention.
  • FIG. 9 is in the embodiment of the present invention.
  • a single cache 904 or multiple caches 904 are used, the purpose is to serve as a buffer between the controller and the memory.
  • a cache 904 is preferably configured for each of the memories 901.
  • a large buffer may be configured for the plurality of memories 904.
  • the specific settings may be set according to other conditions, such as the rate of the buffer 904 and the controller 902 respectively. That is, the ratio of the memory 901.
  • the cache 904 can be a level one cache 904, or a multi-level cache 904 can be employed, wherein the closer to the cache 904 of the controller 902, the higher the rate at which data is accessed.
  • the embodiment of the invention further provides a computer program product for data processing, comprising a computer readable storage medium storing program code, the program code comprising instructions for executing the method flow described in any one of the foregoing method embodiments.
  • a person skilled in the art can understand that the foregoing storage medium includes: a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a random access memory (RAM), a solid state disk (SSD), or a nonvolatile.
  • a non-transitory machine readable medium that can store program code, such as a non-volatile memory.
  • each component in the above embodiment may have another division manner in actual implementation.
  • multiple modules or components may be combined or integrated into another device, or some features may be omitted or not performed.
  • the coupling or direct coupling or communication connection of the components shown or discussed may be through some communication interface, indirect coupling or communication connection of the modules, and may include electrical, mechanical, or other forms of connection.

Abstract

The present invention relates to the field of file systems, and in particular, to a file updating method and a storage device. The method may comprise: receiving a file updating request, and writing second data into an allocated data block; determining a file block number of first data according to a first file offset; determining an index node of a first file according to a file identifier of the first file; recording, in a file updating table to which a first pointer in the index node of the first file points, a correspondence between the file block number of the first data and a logic block number of a data block for storing the second data, the logic block number being used for pointing to a physical address for storing the second data; and setting the state of the first data to invalid in a file state table to which a second pointer in the index node points. By means of the solution in the embodiments of the present invention, during data updating, because no content and no indirect block pointer in an index node need to be modified, modification of metadata during updating of file data of a file system can be reduced, thus improving the updating efficiency of the file data.

Description

一种文件更新方法及存储设备File update method and storage device 技术领域Technical field
本发明涉及文件系统领域,尤其涉及的是一种文件更新方法及存储设备。The present invention relates to the field of file systems, and in particular, to a file update method and a storage device.
背景技术Background technique
在linux操作系统的文件系统中,每个文件包含文件元数据和实际数据,文件元数据包括Linux中的文件权限(rxw)、文件属性(所有者,群组、时间参数等)以及保存文件实际数据存储位置。文件系统通常会将这两部分数据分别存放在不同的块,权限与属性放置到索引节点中,至于实际数据则放置到数据块中。另外还有一个超级块(super block)会记录整个文件系统的的整体信息。索引节点记录文件的属性,一个文件占用一个索引节点,同时记录此文件的数据所在的数据块位置。In the file system of the Linux operating system, each file contains file metadata and actual data. The file metadata includes file permissions (rxw) in Linux, file attributes (owner, group, time parameters, etc.) and save files. Data storage location. The file system usually stores the two pieces of data in different blocks, the permissions and attributes are placed in the index node, and the actual data is placed in the data block. There is also a super block that records the overall information of the entire file system. The index node records the attributes of the file. A file occupies an index node and records the location of the data block where the data of the file is located.
由于每个索引节点与数据块都有编号,而每个文件都会占用一个索引节点,索引节点内设有指向用于存储文件数据的数据块的逻辑块号的指针。因此,如果能找到文件的索引节点的话,那么自然也就能获知存放数据的数据块的逻辑块号,也就能够通过逻辑块号读出物理地址上该文件的实际数据。Since each index node and data block are numbered, and each file occupies an index node, the index node has a pointer to a logical block number of a data block for storing file data. Therefore, if the index node of the file can be found, then the logical block number of the data block storing the data can naturally be known, and the actual data of the file at the physical address can be read by the logical block number.
现有文件系统以树的方式组织文件的数据块。当一个文件需要更新时,会根据要更新的文件中的更新数据分配新的数据块,并且将链接旧数据块的指针指向更新后的数据块,由于修改了指针,从而存储指针的数据块也必须进行更新。当一组一致的更新写到磁盘之后,根数据块自动更新为指向新的树,该新的树包含最新的分配信息。Existing file systems organize data blocks of files in a tree manner. When a file needs to be updated, a new data block is allocated according to the update data in the file to be updated, and the pointer of the old data block is pointed to the updated data block. Since the pointer is modified, the data block of the pointer is also stored. Must be updated. After a consistent set of updates is written to disk, the root block is automatically updated to point to the new tree, which contains the latest allocation information.
然而,由于每次更新操作要强制重分配,并且进行更新更新数据后,需要将指向旧数据块的指针指向存储更新数据的数据块,空间开销大,涉及要修改的元数据比较多,比较复杂,效率低。However, since each update operation is forced to be re-allocated, and the update data is updated, the pointer to the old data block needs to be pointed to the data block storing the update data, and the space overhead is large, and the metadata involved to be modified is relatively large and complicated. ,low efficiency.
发明内容Summary of the invention
本发明提供了一种文件更新方法,能够在更新文件系统的文件数据时减少元数据的修改,并且方法简单,能够提高文件数据的更新效率。 The invention provides a file updating method, which can reduce the modification of the metadata when updating the file data of the file system, and has a simple method and can improve the update efficiency of the file data.
本发明实施例第一方面提供了一种文件更新方法,可包括:A first aspect of the embodiments of the present invention provides a file update method, which may include:
接收文件更新请求,所述文件更新请求中携带有第一文件的文件标识、第一文件偏移量以及第二数据,所述第二数据用于更新所述第一文件中的第一数据;根据所述第二数据的大小为所述第二数据分配空闲的数据块;Receiving a file update request, where the file update request carries a file identifier of the first file, a first file offset, and second data, where the second data is used to update the first data in the first file; Allocating an idle data block to the second data according to a size of the second data;
将所述第二数据写入已分配的所述数据块中;Writing the second data into the allocated data block;
根据所述第一文件偏移量确定所述第一数据的文件块号,所述文件块号用于标识所述第一数据的逻辑位置;Determining, according to the first file offset, a file block number of the first data, where the file block number is used to identify a logical location of the first data;
根据所述第一文件的文件标识确定所述第一文件的索引节点;Determining an index node of the first file according to the file identifier of the first file;
在所述第一文件的索引节点中的第一指针指向的文件更新表中记录所述第一数据的文件块号与存储所述第二数据的数据块的逻辑块号的对应关系,所述逻辑块号用于指向存储所述第二数据的物理地址;Corresponding relationship between a file block number of the first data and a logical block number of a data block storing the second data is recorded in a file update table pointed to by the first pointer in the index node of the first file, a logical block number is used to point to a physical address storing the second data;
在所述索引节点中的第二指针指向的文件状态表中将所述第一数据的状态设置为无效。Setting a state of the first data to be invalid in a file status table pointed to by the second pointer in the index node.
结合第一方面,在第一方面的第一种可能的实现方式中,所述方法还可包括:In conjunction with the first aspect, in a first possible implementation of the first aspect, the method may further include:
接收文件读取请求,所述文件读取请求中携带有第二文件的文件标识和第二文件偏移量;Receiving a file read request, where the file read request carries a file identifier of the second file and a second file offset;
根据所述第二文件的文件标识确定所述第二文件的索引节点;Determining an index node of the second file according to the file identifier of the second file;
根据所述第二文件偏移量确定待读取数据的文件块号;Determining, according to the second file offset, a file block number of the data to be read;
根据所述第二文件的索引节点中的第二指针指向的文件状态表确定所述待读取数据的状态为无效;Determining, according to the file status table pointed by the second pointer in the index node of the second file, that the status of the data to be read is invalid;
根据所述第二文件的所述索引节点中的第一指针指向的文件更新表确定所述待读取数据的文件块号对应的逻辑块号;Determining, according to the file update table pointed by the first pointer in the index node of the second file, a logical block number corresponding to the file block number of the data to be read;
根据所述待读取数据的文件块号对应的逻辑块号确定待读取数据的物理地址;Determining, according to a logical block number corresponding to the file block number of the data to be read, a physical address of the data to be read;
根据所述待读取数据的物理地址读取所述待读取数据。Reading the data to be read according to the physical address of the data to be read.
结合第一方面,在第一方面的第二种可能的实现方式中,所述方法还包括:In conjunction with the first aspect, in a second possible implementation manner of the first aspect, the method further includes:
将所述第一文件的索引节点中的更新标志位设置为有更新,所述更新标志位用于确定所述第一文件的更新状态。 The update flag bit in the index node of the first file is set to have an update, and the update flag bit is used to determine an update status of the first file.
结合第一方面的第一种可能的实现方式,在第一方面的第三种可能的实现方式中,所述法还包括:In conjunction with the first possible implementation of the first aspect, in a third possible implementation of the first aspect, the method further includes:
所述根据所述第二文件的索引节点中的第二指针指向的文件状态表确定所述待读取数据的状态之前,所述方法还包括:Before determining the state of the data to be read according to the file status table pointed to by the second pointer in the index node of the second file, the method further includes:
根据所述第二文件的索引节点中的更新标志位确定所述第二文件有更新,所述更新标志位用于确定所述第二文件的更新状态。Determining that the second file has an update according to an update flag bit in the index node of the second file, the update flag bit is used to determine an update status of the second file.
本发明实施例第二方面还提供一种设备,可包括:The second aspect of the embodiment of the present invention further provides an apparatus, which may include:
接收模块,用于接收文件更新请求,所述文件更新请求中携带有第一文件的文件标识、第一文件偏移量以及第二数据,所述第二数据用于更新所述第一文件中的第一数据;a receiving module, configured to receive a file update request, where the file update request carries a file identifier of the first file, a first file offset, and second data, where the second data is used to update the first file First data;
分配模块,用于根据所述第二数据的大小为所述第二数据分配空闲的数据块;An allocating module, configured to allocate an idle data block to the second data according to the size of the second data;
写入模块,用于将所述第二数据写入已分配的所述数据块中;a writing module, configured to write the second data into the allocated data block;
确定模块,用于根据所述第一文件偏移量确定所述第一数据的文件块号,所述文件块号用于标识所述第一数据的逻辑位置;a determining module, configured to determine, according to the first file offset, a file block number of the first data, where the file block number is used to identify a logical location of the first data;
并根据所述第一文件的文件标识确定所述第一文件的索引节点;And determining, according to the file identifier of the first file, an index node of the first file;
记录模块,用于在所述第一文件的索引节点中的第一指针指向的文件更新表中记录所述第一数据的文件块号与存储所述第二数据的数据块的逻辑块号的对应关系,所述逻辑块号用于指向存储所述第二数据的物理地址;a recording module, configured to record, in a file update table pointed by the first pointer in the index node of the first file, a file block number of the first data and a logical block number of a data block storing the second data Corresponding relationship, the logical block number is used to point to a physical address storing the second data;
状态设置模块,在所述索引节点中的第二指针指向的文件状态表中将所述第一数据的状态设置为无效。The state setting module sets the state of the first data to be invalid in a file state table pointed by the second pointer in the index node.
结合第二方面,在第二方面的第一种可能的实现方式中,In conjunction with the second aspect, in a first possible implementation of the second aspect,
所述接收模块,还用于接收文件读取请求,所述文件读取请求中携带有第二文件的文件标识和第二文件偏移量;The receiving module is further configured to receive a file read request, where the file read request carries a file identifier of the second file and a second file offset;
所述确定模块,还用于根据所述第二文件的文件标识确定所述第二文件的索引节点;The determining module is further configured to determine an index node of the second file according to the file identifier of the second file;
根据所述第二文件偏移量确定待读取数据的文件块号;Determining, according to the second file offset, a file block number of the data to be read;
根据所述第二文件的索引节点中的第二指针指向的文件状态表确定所述待读取数据的状态为无效; Determining, according to the file status table pointed by the second pointer in the index node of the second file, that the status of the data to be read is invalid;
所述存储设备还可包括:The storage device may further include:
查找模块,用于根据所述第二文件的所述索引节点中的第一指针指向的文件更新表确定所述待读取数据的文件块号对应的逻辑块号;a searching module, configured to determine, according to a file update table pointed by the first pointer in the index node of the second file, a logical block number corresponding to a file block number of the data to be read;
读取模块,用于根据所述待读取数据的文件块号对应的逻辑块号确定待读取数据的物理地址,并根据所述待读取数据的物理地址读取所述待读取数据。a reading module, configured to determine a physical address of the data to be read according to a logical block number corresponding to the file block number of the data to be read, and read the data to be read according to the physical address of the data to be read .
结合第二方面,在第二方面的第二种可能的实现方式中,In conjunction with the second aspect, in a second possible implementation of the second aspect,
所述状态设置模块,还用于将所述第一文件的索引节点中的更新标志位设置为有更新,所述更新标志位用于确定所述第一文件的更新状态。The status setting module is further configured to set an update flag bit in the index node of the first file to be updated, and the update flag bit is used to determine an update status of the first file.
结合第二方面的第一种可能的实现方式,在第二方面的第三种可能的实现方式中,In conjunction with the first possible implementation of the second aspect, in a third possible implementation of the second aspect,
所述确定模块还用于:The determining module is further configured to:
根据所述第二文件的索引节点中的更新标志位确定所述第二文件有更新,所述更新标志位用于确定所述第二文件的更新状态。Determining that the second file has an update according to an update flag bit in the index node of the second file, the update flag bit is used to determine an update status of the second file.
本发明实施例第三方面还提供一种存储设备,该存储设备中建立有文件系统,该存储设备可包括:The third aspect of the embodiment of the present invention further provides a storage device, where the file system is established, and the storage device may include:
存储器,用于存储文件数据;a memory for storing file data;
控制器,与所述存储器连接,用于接收文件更新请求,所述文件更新请求中携带有第一文件的文件标识、第一文件偏移量以及第二数据,所述第二数据用于更新所述文件中的第一数据;a controller, configured to receive a file update request, where the file update request carries a file identifier of the first file, a first file offset, and second data, where the second data is used for updating The first data in the file;
在存储器中根据所述第二数据的大小为所述第二数据分配空闲的数据块;Allocating an idle data block to the second data according to a size of the second data in a memory;
通过缓存将所述第二数据写入存储器中已分配的所述数据块中;Writing the second data into the allocated data block in the memory by caching;
根据所述文件偏移量确定存储器中所述第一数据的文件块号,所述文件块号用于标识所述第一数据的逻辑位置;Determining, according to the file offset, a file block number of the first data in the memory, where the file block number is used to identify a logical location of the first data;
根据所述第一文件的文件标识确定存储器中所述第一文件的索引节点;Determining, according to the file identifier of the first file, an index node of the first file in the memory;
在所述第一文件的索引节点中的第一指针指向的文件更新表中记录所述第一数据的文件块号与存储所述第二数据的数据块的逻辑块号的对应关系,所述逻辑块号用于指向存储所述第二数据的物理地址;Corresponding relationship between a file block number of the first data and a logical block number of a data block storing the second data is recorded in a file update table pointed to by the first pointer in the index node of the first file, a logical block number is used to point to a physical address storing the second data;
在所述索引节点中的第二指针指向的文件状态表中将所述第一数据的状态设置为无效。 Setting a state of the first data to be invalid in a file status table pointed to by the second pointer in the index node.
结合第三方面,在第三方面的第一种可能的实现方式中,In conjunction with the third aspect, in a first possible implementation of the third aspect,
所述控制器还用于:The controller is also used to:
接收文件读取请求,所述文件读取请求中携带有第二文件的文件标识和第二文件偏移量;Receiving a file read request, where the file read request carries a file identifier of the second file and a second file offset;
根据所述第二文件的文件标识确定所述第二文件的索引节点;Determining an index node of the second file according to the file identifier of the second file;
根据所述第二文件偏移量确定待读取数据的文件块号;Determining, according to the second file offset, a file block number of the data to be read;
根据所述第二文件的索引节点中的第二指针指向的文件状态表确定所述待读取数据的状态为无效;Determining, according to the file status table pointed by the second pointer in the index node of the second file, that the status of the data to be read is invalid;
根据所述第二文件的所述索引节点中的第一指针指向的文件更新表确定所述待读取数据的文件块号对应的逻辑块号;Determining, according to the file update table pointed by the first pointer in the index node of the second file, a logical block number corresponding to the file block number of the data to be read;
根据所述待读取数据的文件块号对应的逻辑块号确定待读取数据的物理地址;Determining, according to a logical block number corresponding to the file block number of the data to be read, a physical address of the data to be read;
根据所述待读取数据的物理地址读取所述待读取数据。Reading the data to be read according to the physical address of the data to be read.
结合第三方面,在第三方面的第二种可能的实现方式中,所述控制器还用于:In conjunction with the third aspect, in a second possible implementation manner of the third aspect, the controller is further configured to:
将所述第一文件的索引节点中的更新标志位设置为有更新,所述更新标志位用于确定所述第一文件的更新状态。The update flag bit in the index node of the first file is set to have an update, and the update flag bit is used to determine an update status of the first file.
结合第三方面的第一种可能的实现方式,在第三方面的第二种可能的实现方式中,所述控制器还用于:In conjunction with the first possible implementation of the third aspect, in a second possible implementation of the third aspect, the controller is further configured to:
在根据所述第二文件的索引节点中的第二指针指向的文件状态表确定所述待读取数据的状态之前,根据所述第二文件的索引节点中的更新标志位确定所述第二文件有更新,所述更新标志位用于确定所述第二文件的更新状态。Determining the second according to an update flag bit in an index node of the second file before determining a state of the data to be read according to a file state table pointed to by a second pointer in the index node of the second file The file has an update, and the update flag is used to determine an update status of the second file.
从以上技术方案可以看出,本发明实施例具有以下优点:本发明实施例由于设置了文件更新表和文件状态表,在索引节点中具有指向这两个表的第一指针和第二指针,该更新表会存储有文件的文件块号与逻辑块号的对应关系,在更新数据时,首先将将第二数据存入分配的空闲的数据块中,确定第一数据的文件块号,而后根据第一文件确定索引节点,确定文件更新表和文件状态表,而后在文件更新表中记录下第一数据的文件块号与存储所述第二数据的数据块的逻辑块号的对应关系,即可实现通过文件块号与新的逻辑块号相对应,而 后在文件状态表中将第一数据的状态设置为无效,即可完成数据的更新操作。通过本发明实施例方案在更新数据时由于不需要修改索引节点的任何内容和任何间接块指针,从而能够在更新文件系统的文件数据时减少元数据的修改,减少数据块的拷贝和磁盘碎片,并且方法简单,能够提高文件数据的更新效率。As can be seen from the above technical solutions, the embodiment of the present invention has the following advantages: the embodiment of the present invention has a first update pointer and a second pointer to the two tables in the index node because the file update table and the file state table are set. The update table stores the correspondence between the file block number of the file and the logical block number. When updating the data, the second data is first stored in the allocated free data block to determine the file block number of the first data, and then Determining an index node according to the first file, determining a file update table and a file status table, and then recording, in the file update table, a correspondence between a file block number of the first data and a logical block number of the data block storing the second data, It is possible to correspond to the new logical block number by the file block number, and After the status of the first data is set to invalid in the file status table, the data update operation can be completed. When the data is updated by the embodiment of the present invention, since it is not necessary to modify any content of the index node and any indirect block pointer, the metadata modification can be reduced when the file data of the file system is updated, and the copying and disk fragmentation of the data block can be reduced. And the method is simple, and the update efficiency of the file data can be improved.
附图说明DRAWINGS
图1为适用本发明实施例中文件更新方法的存储系统示意图;1 is a schematic diagram of a storage system to which a file update method in an embodiment of the present invention is applied;
图2是传统具有写时拷贝技术的文件系统更新状态图;2 is a diagram showing a file system update state of a conventional copy-on-write technique;
图3为本发明实施例中文件更新方法的一个实施例图;FIG. 3 is a diagram of an embodiment of a file update method according to an embodiment of the present invention; FIG.
图4为本发明实施例中文件更新方法的另一个实施例图;4 is a diagram showing another embodiment of a file updating method according to an embodiment of the present invention;
图5为本发明实施例中文件更新方法的另一个实施例图;FIG. 5 is a diagram of another embodiment of a file update method according to an embodiment of the present invention; FIG.
图6为本发明实施例中存储设备的一个实施例图;FIG. 6 is a diagram of an embodiment of a storage device according to an embodiment of the present invention; FIG.
图7为本发明实施例中存储设备的另一个实施例图;FIG. 7 is a diagram of another embodiment of a storage device according to an embodiment of the present invention; FIG.
图8为本发明实施例中存储设备的结构示意图;FIG. 8 is a schematic structural diagram of a storage device according to an embodiment of the present invention;
图9是本发明实施例中存储设备的另一个实施例图。Figure 9 is a diagram showing another embodiment of a storage device in an embodiment of the present invention.
具体实施方式detailed description
本发明实施例提供了一种文件更新方法及存储设备,用于解决现有基于COW文件系统更新数据时修改的元数据比较多,比较复杂,而导致效率低,并且会导致过多的磁盘碎片的问题。The embodiment of the invention provides a file updating method and a storage device, which are used to solve the problem that the metadata modified by the existing COW file system is more complicated and complicated, which leads to low efficiency and excessive disk fragmentation. The problem.
为了使本技术领域的人员更好地理解本发明方案,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分的实施例,而不是全部的实施例。The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is an embodiment of the invention, but not all of the embodiments.
本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的实施例能够以除了在这里图示或描述的内容以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或模块的过程、方法、系统、产品或设备不必限于清楚 地列出的那些步骤或模块,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或模块。The terms "first", "second", "third", "fourth", etc. (if present) in the specification and claims of the present invention and the above figures are used to distinguish similar objects without being used for Describe a specific order or order. It is to be understood that the data so used may be interchanged where appropriate so that the embodiments described herein can be implemented in a sequence other than what is illustrated or described herein. In addition, the terms "comprises" and "comprises" and "comprises", and any variations thereof, are intended to cover a non-exclusive inclusion. For example, a process, method, system, product, or device that comprises a series of steps or modules is not necessarily limited Those steps or modules listed are included, but may include other steps or modules not explicitly listed or inherent to such processes, methods, products or devices.
图2为本发明实施例提供的一种存储系统结构示意图,请参阅图1,该存储系统通过通道交换器102与服务器101相连接,该存储系统包括至少一个存储设备103,该通道交换器102与至少一个存储设备103分别连接,其中,服务器101内还设有用于管理存储设备的文件系统模块1011。该系统在工作时通过服务器101内的文件系统模块1011配合通道交换器102对存储设备103进行控制,如文件系统模块1011通过光纤通道交换器102从存储设备103内读取数据或是向存储设备103存储数据。2 is a schematic structural diagram of a storage system according to an embodiment of the present invention. Referring to FIG. 1, the storage system is connected to a server 101 through a channel switch 102. The storage system includes at least one storage device 103. The channel switch 102 Each of the at least one storage device 103 is connected to the storage device 103. The file system module 1011 for managing the storage device is further disposed in the server 101. The system controls the storage device 103 through the file system module 1011 in the server 101 in cooperation with the channel switch 102, such as the file system module 1011 reading data from the storage device 103 through the Fibre Channel switch 102 or to the storage device. 103 stores data.
本领域技术人员可以知道,该通道交换器102可以是光纤通道交换器或是其他能够支持较大带宽的通道交换器,只要保证服务器101与存储设备103之间具有足够的带宽传输数据即可。Those skilled in the art can know that the channel switch 102 can be a Fibre Channel switch or other channel switch capable of supporting a larger bandwidth, as long as there is sufficient bandwidth between the server 101 and the storage device 103 to transmit data.
本领域技术人员可以知道,除了图2所示的存储系统之外,本发明实施例还可以应用于直连式存储(DAS Direct-Attached Storage)、存储区域网络(SAN Storage Area Network)和网络接入存储(NAS Network-Attached Storage)等类型的存储系统中,在此不对本发明实施例的应用场景进行限制。A person skilled in the art can understand that, in addition to the storage system shown in FIG. 2, the embodiment of the present invention can also be applied to DAS Direct-Attached Storage, SAN Storage Area Network, and network connection. In the storage system of the type of the storage (NAS Network-Attached Storage), the application scenario of the embodiment of the present invention is not limited herein.
当然,除前述开放式阵列存储系统外,当然还有一些非阵列存储系统,简单如个人计算机也可作为一种存储系统。Of course, in addition to the aforementioned open array storage system, there are of course some non-array storage systems, such as a personal computer as a storage system.
本领域技术人员可以知道,当这些存储系统中正在运行的操作系统发生系统故障时,其中的文件系统为了在故障恢复后能正常工作必须维持一致性。为了使文件系统达到这一效果,现有技术采用写时拷贝技术进行所有数据更新操作,即在存储设备上构建一个新的文件系统视图,当所有更新都安全写入磁盘后,新的文件系统视图才变为有效。采用这种写时拷贝技术的文件系统每次更新存储设备上数据时,先在空闲的数据块(即未使用的数据块)中分配一个新数据块块,将更新数据写入这个新的数据块,当更新数据写入成功之后,再更新相关的元数据结构指向新的数据块。Those skilled in the art will appreciate that when a system failure occurs in an operating system running in these storage systems, the file system therein must maintain consistency in order to function properly after the failure recovery. In order for the file system to achieve this effect, the prior art uses a copy-on-write technique for all data update operations, ie, constructing a new file system view on the storage device, and when all updates are safely written to disk, the new file system The view becomes valid. A file system using such a copy-on-write technique allocates a new block of data in an idle block (ie, an unused block) and writes the update data to the new data each time the data on the storage device is updated. Block, after the update data is successfully written, update the relevant metadata structure to point to the new data block.
下面以一个现有技术中文件系统的进行数据更新的场景进行描述,请参阅图2,图2是传统具有写时拷贝技术的文件系统更新状态图,在该图中,A点是文件系统树的根节点,C节点和E节点是指向文件中数据所在数据块的索引 节点,当需要对C节点指向的数据块进行更新时,更新数据会被写入空闲的新数据块中,同时会产生一个新的索引节点C’节点,该C’节点指向该新数据块,而由于写时拷贝技术,也会分配一个空闲的数据块给C’节点,而由于A节点需要指向C’节点,则A节点也需要进行修改,同样,由于写时拷贝技术,此时会产生一个新的A’节点指向C’节点,同时A’节点也指向E节点,此时文件系统会为A’节点分配空闲的新数据块,最后将超级块原本指向的A节点改为指向A’节点,完成数据的更新。The following describes the scenario of data update in the file system of the prior art. Please refer to FIG. 2. FIG. 2 is a file system update state diagram of a conventional copy-on-write technology. In the figure, point A is a file system tree. Root node, C node and E node are indexes pointing to the data block where the data in the file is located Node, when it is necessary to update the data block pointed to by the C node, the update data is written into the free new data block, and a new index node C' node is generated, and the C' node points to the new data block. Due to the copy-on-write technique, an idle data block is also allocated to the C' node, and since the A node needs to point to the C' node, the A node also needs to be modified. Similarly, due to the copy-on-write technique, this will occur. A new A' node points to the C' node, and the A' node also points to the E node. At this time, the file system allocates a new free data block for the A' node, and finally points the A node pointed to by the super block to point to A'. Node, complete the update of the data.
需要说明的是,A节点和C节点之间还可具有间接节点B节点,该B节点的数量可以使可以是一个以上,如同时具有B节点和D节点,B节点和D节点处于同一层级,B节点同时指向C节点和E节点,D节点指向F节点,F节点与C节点和E节点同为指向文件中数据所在数据块的索引节点,此时,当需要对C节点指向的数据块进行更新时,A节点不直接指向C节点,而是首先指向B节点,再由B节点指向C节点,因此,在更新时,会从C节点开始,首先建立C’节点,而后建立指向C’节点的B’节点,同时B’节点指向E节点,最后建立指向B’节点的A’节点,同时A’节点指向D节点,最后将超级块原本指向的A节点改为指向A’节点,完成数据更新。It should be noted that there may be an indirect Node B node between the A node and the C node, and the number of the B nodes may be more than one, such as having a B node and a D node at the same time, and the B node and the D node are at the same level. The B node points to the C node and the E node at the same time, and the D node points to the F node. The F node and the C node and the E node are both the index nodes pointing to the data block where the data in the file is located. At this time, when the data block pointed to by the C node needs to be performed, When updating, the A node does not directly point to the C node, but first points to the B node, and then the B node points to the C node. Therefore, when updating, it starts from the C node, first establishes the C' node, and then establishes the pointing to the C' node. The B' node, while the B' node points to the E node, and finally establishes the A' node pointing to the B' node, and the A' node points to the D node. Finally, the A node pointed to by the super block is changed to point to the A' node, and the data is completed. Update.
可见,由于用户数据每次修改会导致一批相关元数据块(如C节点、B节点和A节点)的拷贝和修改,由于写时拷贝技术,文件系统不会原位更新修改索引节点(如C节点)和间接指针(如B节点),必须在一个新的位置拷贝和修改。并且在提交超级块时,文件系统必须迫使所有块完全写入磁盘,这样导致更新操作延迟大、效率低,和由于每次需要分配新的数据块,旧数据块无效,这样会导致很多磁盘碎片。It can be seen that each modification of the user data will result in the copying and modification of a batch of related metadata blocks (such as C node, B node and A node). Due to the copy-on-write technology, the file system will not update the index node in situ (eg C nodes) and indirect pointers (such as Node B) must be copied and modified in a new location. And when submitting a superblock, the file system must force all blocks to be completely written to disk, which results in large delays, inefficiencies in the update operation, and invalid old blocks each time a new block of data needs to be allocated, which can result in a lot of disk fragmentation. .
为了解决上述问题,本发明实施例中提供一种文件更新方法,该方法可以应用与图1所示的应用场景中。请参阅图3,图3为本发明实施例中文件更新方法的一个流程示意图,该方法可以由图1所示的存储系统中的服务器101来执行也可由存储设备内的文件系统模块来执行,可包括以下内容:In order to solve the above problem, a file update method is provided in the embodiment of the present invention, and the method can be applied to the application scenario shown in FIG. 1. Referring to FIG. 3, FIG. 3 is a schematic flowchart of a method for updating a file according to an embodiment of the present invention. The method may be executed by the server 101 in the storage system shown in FIG. 1 or by a file system module in a storage device. Can include the following:
301、接收文件更新请求。301. Receive a file update request.
在需要进行数据更新时,需要通过文件系统对数据进行处理,需要向文件系统发送文件更新请求,而文件系统会接收到来自其他应用或是系统的这种文 件更新请求,文件更新请求中携带有第一文件的文件标识、第一文件偏移量以及第二数据,第二数据用于更新文件中的第一数据。When data update is required, the data needs to be processed through the file system, and a file update request needs to be sent to the file system, and the file system receives such a text from other applications or systems. The file update request carries a file identifier of the first file, a first file offset, and second data, and the second data is used to update the first data in the file.
302、根据第二数据的大小为第二数据分配空闲的数据块。302. Allocate an idle data block to the second data according to the size of the second data.
文件系统在接收到文件更新请求后,会根据第二数据的大小为第二数据分配空闲的数据块以便于写入第二数据。After receiving the file update request, the file system allocates an idle data block for the second data according to the size of the second data to facilitate writing the second data.
303、将第二数据写入已分配的数据块中。303. Write the second data into the allocated data block.
在分配好空闲的数据块后,将第二数据写入已分配的数据块中。After the free data block is allocated, the second data is written into the allocated data block.
304、根据文件偏移量确定第一数据的文件块号。304. Determine a file block number of the first data according to the file offset.
文件块号用于标识第一数据的逻辑位置,通过文件标识可确定更新文件,而后通过文件偏移量能够获取第一数据的文件块号。The file block number is used to identify the logical location of the first data, the file identifier can be used to determine the update file, and then the file block number of the first data can be obtained by the file offset.
需要说明的时,文件块号为文件在存储时按照预先设置的文件块大小的固定值将文件分为若干块文件块,如此处的第一文件即是如此,而每一文件块均设置一个文件块号,而第一文件偏移量为一个具体的值,用于确定要更新的第一数据所对应的文件块号,即在确定文件块号时,仅需获知对应的第一文件偏移量,通过该第一文件偏移量以及预先设置的固定值即可计算出对应的文件块号。When it is necessary to explain, the file block number is that the file is divided into several file blocks according to a fixed value of the preset file block size when storing, such as the first file here, and each file block is set to one. The file block number, and the first file offset is a specific value, which is used to determine the file block number corresponding to the first data to be updated, that is, when determining the file block number, only the corresponding first file offset needs to be known. The shift amount can be calculated by the first file offset and the preset fixed value.
举例来说,若将文件总体作为X轴,则逻辑位置对应X轴上具体的一个点,该点作为该逻辑位置的起点,而文件块号对应X轴上的一段线段,该线段的长度为文件块的大小;而第一文件偏移量则为具体的一个点,通过判断该点具体落入的线段来判断该线段对应的文件块号。For example, if the file population is taken as the X axis, the logical position corresponds to a specific point on the X axis, which is the starting point of the logical position, and the file block number corresponds to a segment of the line on the X axis, and the length of the line segment is The size of the file block; the first file offset is a specific point, and the file block number corresponding to the line segment is determined by judging the line segment in which the point falls.
305、根据第一文件的文件标识确定第一文件的索引节点;305. Determine an index node of the first file according to the file identifier of the first file.
由于在磁盘上存储的所有的文件都具有对应的索引节点,因此能够根据第一文件的文件标识确定第一文件的索引节点。Since all the files stored on the disk have corresponding index nodes, the index node of the first file can be determined according to the file identifier of the first file.
306、在第一文件的索引节点中的第一指针指向的文件更新表中记录第一数据的文件块号与存储第二数据的数据块的逻辑块号的对应关系。306. Record a correspondence between a file block number of the first data and a logical block number of the data block storing the second data in a file update table pointed to by the first pointer in the index node of the first file.
第一文件的索引节点中设置有第一指针,该第一指针指向文件更新表,能够根据第一文件的索引节点确定索引节点中的第一指针,从而能够确定文件更新表,并且更新表中存储有文件的文件块号与逻辑块号的对应关系。A first pointer is set in the index node of the first file, the first pointer points to the file update table, and the first pointer in the index node can be determined according to the index node of the first file, so that the file update table can be determined, and the table is updated. The correspondence between the file block number of the file and the logical block number is stored.
在确定更新表后,即可在文件更新表中记录下第一数据的文件块号与存储 第二数据的数据块的逻辑块号的对应关系,从而使第二数据所对应的逻辑块号与第一数据所对应的文件块号相对应。After determining the update table, the file block number and storage of the first data can be recorded in the file update table. Corresponding relationship of the logical block numbers of the data blocks of the second data, so that the logical block numbers corresponding to the second data correspond to the file block numbers corresponding to the first data.
307、在索引节点中的第二指针指向的文件状态表中将第一数据的状态设置为无效。307. Set a state of the first data to be invalid in a file state table pointed to by the second pointer in the index node.
第一文件的索引节点中设置有第二指针,该第二指针指向文件状态表,根据第二指针确定文件状态表,文件状态表中存储有用于指示数据有效性的状态。A second pointer is disposed in the index node of the first file, the second pointer points to the file state table, and the file state table is determined according to the second pointer, and the file state table stores a state for indicating validity of the data.
在确定文件状态表后,会将第一数据的状态设置为无效,以指示该第一数据已被更新。After determining the file status table, the status of the first data is set to invalid to indicate that the first data has been updated.
本发明实施例由于设置了文件更新表和文件状态表,在索引节点中具有指向这两个表的第一指针和第二指针,该更新表会存储有文件的文件块号与逻辑块号的对应关系。在更新数据时,首先将第二数据存入分配的空闲的数据块中,确定第一数据的文件块号,而后根据第一文件确定索引节点,确定文件更新表和文件状态表。在文件更新表中记录下第一数据的文件块号与存储第二数据的数据块的逻辑块号的对应关系,即可实现通过文件块号与新的逻辑块号相对应,而后在文件状态表中将第一数据的状态设置为无效,即可完成数据的更新操作。通过本发明实施例方案在更新数据时由于不需要修改索引节点的任何内容和任何间接块指针,从而能够在更新文件系统的文件数据时减少元数据的修改,并且方法简单,能够提高文件数据的更新效率,并且能够减少数据块的拷贝和磁盘碎片,最终达到提高更新操作效率的目的。In the embodiment of the present invention, since the file update table and the file status table are set, the index node has a first pointer and a second pointer to the two tables, and the update table stores the file block number and the logical block number of the file. Correspondence relationship. When updating the data, the second data is first stored in the allocated free data block, the file block number of the first data is determined, and then the index node is determined according to the first file, and the file update table and the file status table are determined. The correspondence between the file block number of the first data and the logical block number of the data block storing the second data is recorded in the file update table, so that the file block number corresponds to the new logical block number, and then the file status is achieved. In the table, the status of the first data is set to be invalid, and the data update operation can be completed. When the data is updated by the embodiment of the present invention, since it is not necessary to modify any content of the index node and any indirect block pointer, the modification of the metadata can be reduced when the file data of the file system is updated, and the method is simple, and the file data can be improved. The update efficiency, and can reduce the copy of the data block and disk fragmentation, and ultimately achieve the purpose of improving the efficiency of the update operation.
本发明实施例中,由于设置了文件更新表和文件状态表,在设置更新标志位后能够通过该更新标志位快速识别该索引节点对应的文件是否有更新。需要说明的是,文件状态表中状态的设置方式较为重要,其直接影响文件系统是否能够快速查找定位第一数据的状态,下面介绍其中一种设置方式,能提高文件系统定位第一数据的效率。In the embodiment of the present invention, since the file update table and the file status table are set, after the update flag bit is set, the update flag bit can be used to quickly identify whether the file corresponding to the index node is updated. It should be noted that the setting mode of the state in the file state table is more important, which directly affects whether the file system can quickly find the state of locating the first data. One of the setting modes is described below, which can improve the efficiency of the first data of the file system. .
作为可选的,在文件第一次存储时,记录有各数据的状态的文件状态表按照文件块号的顺序进行排列,由于文件块号为文件存储时就确定的,不会因为文件块号对应的逻辑块号的改变而改变,因此能在获知数据的文件块号后能迅速获取数据的状态,采用文件块号的顺序对数据的状态进行排列,能在获知数 据的文件块号的情形下,快速查找数据的状态,有利于提高文件更新的效率,对于第一数据来说,能够提高文件系统设置第一数据对应的状态的效率,从而提高文件更新的效率。Optionally, when the file is stored for the first time, the file status table in which the status of each data is recorded is arranged in the order of the file block number. Since the file block number is determined when the file is stored, the file block number is not determined. The corresponding logical block number is changed, so that the state of the data can be quickly obtained after the file block number of the data is known, and the state of the data is arranged in the order of the file block number, and the number can be known. According to the file block number, the state of quickly finding the data is beneficial to improve the efficiency of file update. For the first data, the efficiency of the file system setting the state corresponding to the first data can be improved, thereby improving the efficiency of file update. .
举例来说,在文件状态表中采用按照文件块号的顺序进行排列的数据的状态的方式,在具有第二数据替换第一数据而需要将状态设置为无效时,首先通过第一数据的文件块号查找文件状态表中对应该文件块号的第一数据的状态,再将该第一数据的状态设置为无效即可。For example, in the file state table, the state of the data arranged in the order of the file block number is adopted, and when the second data is substituted for the first data and the state needs to be set to be invalid, the file of the first data is first passed. The block number looks up the state of the first data corresponding to the file block number in the file status table, and then sets the state of the first data to be invalid.
需要说明的是,在本发明实施例中还可在索引节点中设置更新标志位以表示该索引节点对应的数据有更新;请参阅图4,为本发明实施例中文件更新方法的另一个实施例图,如图4所示,除包含图3所示的文件更新方法,即步骤401至步骤407与步骤301至步骤307相类似,该文件更新方法还包括,It should be noted that, in the embodiment of the present invention, an update flag bit may also be set in the index node to indicate that the data corresponding to the index node is updated; please refer to FIG. 4, which is another implementation of the file update method in the embodiment of the present invention. As shown in FIG. 4, in addition to the file update method shown in FIG. 3, steps 401 to 407 are similar to steps 301 to 307, and the file update method further includes
408、将第一文件的索引节点中的更新标志位设置为有更新。408. Set an update flag bit in an index node of the first file to be updated.
其中,更新标志位用于确定第一文件的更新状态。The update flag is used to determine the update status of the first file.
可以理解的是,在设置更新标志位后,在确定索引节点后,能够通过该更新标志位快速识别该索引节点对应的文件是否有更新,虽然通过文件状态表中的数据的标识也能得知是否具有数据更新,但缺点有两点,其一是需要通过第一文件的索引节点中的第二指针确定文件状态表,并确定文件状态表中的无效的标识。因此采用上述步骤408的方式,能够直接从第一文件的索引节点中获知该索引节点对应的文件是否有更新,而无需通过第二指针确定文件状态表,从而大大提高了文件系统更新的执行效率。It can be understood that after the update flag is set, after the index node is determined, the update flag can be used to quickly identify whether the file corresponding to the index node is updated, although the identifier of the data in the file status table can be known. Whether there is data update, but there are two disadvantages. One is that the file status table needs to be determined by the second pointer in the index node of the first file, and the invalid identifier in the file status table is determined. Therefore, in the manner of the foregoing step 408, it is possible to directly learn from the index node of the first file whether the file corresponding to the index node is updated, and it is not necessary to determine the file state table by using the second pointer, thereby greatly improving the execution efficiency of the file system update. .
需要说明的是,在完成文件的更新后,应用程序或是操作系统需要读取文件时,会由文件系统进行读取文件。It should be noted that, after the file is updated, when the application or the operating system needs to read the file, the file system will read the file.
请参阅图5,为本发明实施例中文件更新方法的另一个实施例图,主要描述本发明实施例文件更新方法中数据读取的方法如图5所示,本实施例中更新方法还可包括:FIG. 5 is a schematic diagram of another embodiment of a method for updating a file according to an embodiment of the present invention. The method for reading data in the method for updating a file according to an embodiment of the present invention is as shown in FIG. 5 , and the update method in this embodiment may also be used. include:
501、接收文件读取请求。501. Receive a file read request.
文件读取请求中携带有第二文件的文件标识和第二文件偏移量,在应用程序或是操作系统需要读取文件时,会向文件系统发送文件读取请求。The file read request carries the file identifier of the second file and the second file offset. When the application or the operating system needs to read the file, the file read request is sent to the file system.
502、根据第二文件的文件标识确定第二文件的索引节点。 502. Determine an index node of the second file according to the file identifier of the second file.
接收到文件读取请求后,首先会根据第二文件确定与第二文件对应的索引节点,以便于根据该索引节点查询待读取数据的实际存储位置。After receiving the file read request, the index node corresponding to the second file is first determined according to the second file, so as to query the actual storage location of the data to be read according to the index node.
503、根据第二文件偏移量确定待读取数据的文件块号。503. Determine a file block number of the data to be read according to the second file offset.
当确定第二文件后,即可通过第二文件偏移量确定待读取数据的文件块号,以便于后续使用。After determining the second file, the file block number of the data to be read can be determined by the second file offset for subsequent use.
504、根据第二文件的索引节点中的第二指针指向的文件状态表确定待读取数据的状态为无效。504. Determine, according to the file status table pointed by the second pointer in the index node of the second file, that the status of the data to be read is invalid.
在通过索引节点的第二指针确定了文件状态表后,会对文件状态表中对应待读取数据的状态进行确定,当确定待读取数据的状态为无效时,进行后续步骤。After the file status table is determined by the second pointer of the index node, the status of the data to be read in the file status table is determined. When it is determined that the status of the data to be read is invalid, the subsequent steps are performed.
505、根据第二文件的索引节点中的第一指针指向的文件更新表确定待读取数据的文件块号对应的逻辑块号。505. Determine, according to the file update table pointed to by the first pointer in the index node of the second file, a logical block number corresponding to the file block number of the data to be read.
在确定待读取数据对应的状态为无效时,会根据索引节点的第一指针确定文件更新表,而后通过文件更新表确定确定待读取数据的文件块号对应的逻辑块号。When it is determined that the state corresponding to the data to be read is invalid, the file update table is determined according to the first pointer of the index node, and then the logical block number corresponding to the file block number of the data to be read is determined by the file update table.
506、根据待读取数据的文件块号对应的逻辑块号确定待读取数据的物理地址。506. Determine a physical address of the data to be read according to a logical block number corresponding to the file block number of the data to be read.
在获取到待读取数据的逻辑块号后,可根据逻辑块号与物理地址的对应关系确定待读取数据的实际存储位置的物理地址。After obtaining the logical block number of the data to be read, the physical address of the actual storage location of the data to be read may be determined according to the correspondence between the logical block number and the physical address.
507、根据待读取数据的物理地址读取待读取数据。507. Read data to be read according to a physical address of the data to be read.
在获取到物理地址后,即可从该物理地址读取存储在物理盘的数据,完成数据的读取过程。After the physical address is obtained, the data stored in the physical disk can be read from the physical address, and the data reading process is completed.
需要说明的是,在实际读取数据时,需要先判断待读取数据是否为更新过的数据,即判断待读取数据的状态是否为无效,可通过第二文件的索引节点确定文件块文图表,并在其中确定待读取数据的状态,如为无效标识时,则表示此状态对应的数据通过现有读取的为错误数据,此时通过第二文件的索引节点确定文件更新表,在文件更新表中找到待读取数据对应的文件块号的位置,进而找到该待读取数据更新后的逻辑块号,并通过此逻辑块号对应的物理地址读取物理盘上的待读取数据,通过本发明实施例方案在读取时首先对待读取数据 进行判断,而后根据判断结果进行后续读取操作,由于不会直接读取索引节点上的数据存储位置,因此在读取时,不会出现数据读取错误的情况,并且通过读取更新表中的逻辑块号读取待读取数据的方式,进一步增加本发明实施例文件更新方法的可实现性。It should be noted that, when actually reading data, it is necessary to first determine whether the data to be read is updated data, that is, whether the state of the data to be read is invalid, and determining the file block by using the index node of the second file. a chart, and determining a state of the data to be read therein, such as an invalid identifier, indicating that the data corresponding to the state is erroneous data through the existing read, and at this time, the file update table is determined by the index node of the second file, Find the location of the file block number corresponding to the data to be read in the file update table, and then find the updated logical block number of the data to be read, and read the physical disk to be read by the physical address corresponding to the logical block number. Data is taken, and the data is first read when reading by the solution of the embodiment of the present invention. The judgment is made, and then the subsequent reading operation is performed according to the judgment result. Since the data storage location on the index node is not directly read, when the reading is performed, the data reading error does not occur, and the reading table is read by reading. The logic block number reads the manner of the data to be read, further increasing the achievability of the file update method of the embodiment of the present invention.
由于设置了文件更新表和文件状态表,并且由于索引节点中具有指向这两个表的第一指针和第二指针,在读取待读取数据时,对于待读取数据的两种类型,即更新过的数据和未更新过的数据在读取方式上是不同的,即,当确定待读取数据的状态为无效和非无效时具有两种不同的方式:Since the file update table and the file status table are set, and since the index node has the first pointer and the second pointer pointing to the two tables, when reading the data to be read, for the two types of data to be read, That is, the updated data and the unupdated data are different in reading manner, that is, when determining that the state of the data to be read is invalid and non-invalid, there are two different ways:
其中若待读取数据为更新过的数据时,其数据的读取方式如上述步骤501至507所示,若待读取数据为未更新过的数据时,通过索引节点中的第三指针指向的数据块位置读取待读取数据。If the data to be read is the updated data, the data is read in the manner shown in steps 501 to 507 above. If the data to be read is unupdated data, the third pointer in the index node is pointed. The data block position reads the data to be read.
即此处若待读取数据的状态不为无效时,文件系统读取数据的方式为查找待读取数据对应的索引节点中的第三指针,由第三指针指向的数据块位置读取该待读取数据。That is, if the state of the data to be read is not invalid, the file system reads the data by searching for the third pointer in the index node corresponding to the data to be read, and reading the data block position pointed by the third pointer. The data to be read.
可以理解的是,由于在判断出待读取数据的状态不为无效时,标识待读取数据未被更新过,即可通过索引节点中的第三指针指向的数据块位置读取待读取数据。It can be understood that, since it is determined that the data to be read is not invalid when it is determined that the data to be read is not updated, the data block position pointed by the third pointer in the index node can be read and read. data.
需要说明的是,在待读取数据的状态不为无效的情况下,,首先通过索引节点确定更新表,而后从更新表中查找待读取数据的文件块号对应的逻辑块号,再通过逻辑块号读取逻辑块号对应的物理块上的待读取数据,此两种读取方式可任意设为其中一种。It should be noted that, in the case that the state of the data to be read is not invalid, the update table is first determined by the index node, and then the logical block number corresponding to the file block number of the data to be read is searched from the update table, and then passed. The logical block number reads the data to be read on the physical block corresponding to the logical block number, and the two reading modes can be arbitrarily set to one of them.
其中,作为可选的,在步骤504,即在根据第二文件的索引节点中的第二指针指向的文件状态表确定待读取数据的状态之前该数据处理方法还可包括:Optionally, in step 504, the data processing method may further include: before determining, according to the file state table pointed by the second pointer in the index node of the second file, the data processing method:
根据第二文件的索引节点中的更新标志位确定第二文件有更新;Determining that the second file is updated according to the update flag bit in the index node of the second file;
更新标志位用于确定第二文件的更新状态,当确定为有更新时,触发根据第二文件的索引节点的第二指针确定文件状态表。The update flag is used to determine an update status of the second file, and when it is determined that there is an update, triggering the second pointer of the index node according to the second file to determine the file status table.
可以理解的是,设置此更新标志位的目的在于给仅通过对索引节点的读取,即可获知该索引节点对应的数据是否有更新,而不必先读取文件状态表,而后搜索文件状态表中待读取数据的文件块号对应的待读取数据的状态,通过 该状态判断是否有更新,从而能够节省数据读取时间,提高数据读取的效率。It can be understood that the purpose of setting this update flag bit is to know whether the data corresponding to the index node is updated only by reading the index node, without first reading the file status table, and then searching the file status table. The state of the data to be read corresponding to the file block number of the data to be read, This state determines whether there is an update, thereby saving data reading time and improving data reading efficiency.
作为可选的,在步骤504,即在根据第二文件的索引节点中的第二指针指向的文件状态表确定待读取数据的状态之前,该数据处理方法还可包括:Optionally, the data processing method may further include: in step 504, before determining the state of the data to be read according to the file state table pointed by the second pointer in the index node of the second file, the data processing method may further include:
根据第二文件的索引节点中的更新标志位确定第二文件无更新。The second file is determined to be non-updated according to the update flag bit in the index node of the second file.
当确定更新标志位为无更新时,则采用直接获取第二文件的索引节点中的指向数据实际位置的数据指针,并通过该指针读取物理地址上的待读取数据。When it is determined that the update flag is no update, the data pointer pointing to the actual location of the data in the index node of the second file is directly acquired, and the data to be read on the physical address is read by the pointer.
其中,在进行待读取数据的读取时,若第二文件的索引节点对应的数据较多,数据指针也可作为中间指针指向的是实际指针,再由实际指针指向实际的待读取数据。Wherein, when reading the data to be read, if the index node of the second file corresponds to more data, the data pointer can also be used as the intermediate pointer to point to the actual pointer, and then the actual pointer points to the actual data to be read. .
需要说明的是,当确定更新标志位为无更新时,也可采用步骤步骤504至步骤507的方式读取待读取数据,具体根据读取数据的需求进行选择即可。It should be noted that, when it is determined that the update flag is no update, the data to be read may also be read in the manner of steps 504 to 507, and the selection may be performed according to the requirement of the read data.
上面介绍了本发明实施例中文件更新方法的实施方式,下面对本发明实施例中的存储设备进行介绍,请参阅图6,图6是本发明实施例中存储设备的一个实施例,图6提供的一种存储设备可包括:The foregoing describes the implementation of the file update method in the embodiment of the present invention. The following describes the storage device in the embodiment of the present invention. Referring to FIG. 6, FIG. 6 is an embodiment of the storage device in the embodiment of the present invention, and FIG. 6 provides A storage device can include:
接收模块601,用于接收文件更新请求,文件更新请求中携带有第一文件的文件标识、第一文件偏移量以及第二数据,第二数据用于更新第一文件中的第一数据;The receiving module 601 is configured to receive a file update request, where the file update request carries a file identifier of the first file, a first file offset, and second data, where the second data is used to update the first data in the first file;
分配模块602,用于根据第二数据的大小为第二数据分配空闲的数据块;The allocating module 602 is configured to allocate idle data blocks to the second data according to the size of the second data;
写入模块603,用于将第二数据写入已分配的数据块中;a writing module 603, configured to write the second data into the allocated data block;
确定模块604,用于根据第一文件偏移量确定第一数据的文件块号,文件块号用于标识第一数据的逻辑位置;a determining module 604, configured to determine a file block number of the first data according to the first file offset, where the file block number is used to identify a logical position of the first data;
并用于根据第一文件的文件标识确定第一文件的索引节点;And determining, according to the file identifier of the first file, an index node of the first file;
记录模块605,用于在第一文件的索引节点中的第一指针指向的文件更新表中记录第一数据的文件块号与存储第二数据的数据块的逻辑块号的对应关系,逻辑块号用于指向存储第二数据的物理地址;a recording module 605, configured to record, in a file update table pointed by the first pointer in the index node of the first file, a correspondence between a file block number of the first data and a logical block number of the data block storing the second data, the logic block The number is used to point to the physical address where the second data is stored;
状态设置模块606,在索引节点中的第二指针指向的文件状态表中将第一数据的状态设置为无效。The state setting module 606 sets the state of the first data to be invalid in the file state table pointed to by the second pointer in the index node.
本发明实施例中存储设备中由于设置了文件更新表和文件状态表,在索引节点中具有指向这两个表的第一指针和第二指针,该更新表会存储有文件的文 件块号与逻辑块号的对应关系,在更新数据时,在通过第一接收模块601接收到文件更新请求后,首先通过分配模块602将第二数据通过写入模块603存入分配的空闲的数据块中,并由确定模块604确定第一数据的文件块号,而后根据第一文件确定索引节点确定文件更新表和文件状态表,通过记录模块605在文件更新表中记录下第一数据的文件块号与存储第二数据的数据块的逻辑块号的对应关系,即可实现通过文件块号与新的逻辑块号相对应,而后通过状态设置模块606在文件状态表中将第一数据的状态设置为无效,即可完成数据的更新操作。通过本发明实施例方案在更新数据时由于不需要修改索引节点的任何内容和任何间接块指针,从而能够在更新文件系统的文件数据时减少元数据的修改,并且方法简单,能够提高文件数据的更新效率。并且能够减少数据块的拷贝和磁盘碎片,最终达到提高更新操作效率的目的。In the storage device of the embodiment of the present invention, since the file update table and the file state table are set, the index node has a first pointer and a second pointer pointing to the two tables, and the update table stores the file with the file. Corresponding relationship between the block number and the logical block number. When the data update request is received by the first receiving module 601, the second data is first stored in the allocated idle memory by the assigning module 602 through the writing module 603. In the data block, the file block number of the first data is determined by the determining module 604, and then the index node determines the file update table and the file status table according to the first file, and the first data is recorded in the file update table by the recording module 605. Corresponding relationship between the file block number and the logical block number of the data block storing the second data, so that the file block number corresponds to the new logical block number, and then the first data is set in the file status table by the state setting module 606. The status is set to invalid, and the data update operation can be completed. When the data is updated by the embodiment of the present invention, since it is not necessary to modify any content of the index node and any indirect block pointer, the modification of the metadata can be reduced when the file data of the file system is updated, and the method is simple, and the file data can be improved. Update efficiency. And it can reduce the copy of the data block and disk fragmentation, and finally achieve the purpose of improving the efficiency of the update operation.
其中,需要说明的是,Among them, it needs to be explained that
在文件第一次存储时,记录有各数据的状态的文件状态表按照文件块号的顺序进行排列,由于文件块号为文件存储时就确定的,不会因为文件块号对应的逻辑块号的改变而改变,因此能在获知数据的文件块号后能迅速获取数据的状态。采用文件块号的顺序对数据的状态进行排列,能在获知数据的文件块号的情形下,快速查找数据的状态,有利于提高文件更新的效率。对于第一数据来说,能够提高文件系统设置第一数据对应的状态的效率,从而提高文件更新的效率。When the file is stored for the first time, the file status table in which the status of each data is recorded is arranged in the order of the file block number. Since the file block number is determined when the file is stored, the logical block number corresponding to the file block number is not used. The change is changed, so that the state of the data can be quickly obtained after knowing the file block number of the data. By arranging the state of the data in the order of the file block number, it is possible to quickly find the state of the data in the case of knowing the file block number of the data, which is advantageous for improving the efficiency of file update. For the first data, the efficiency of the file system setting the state corresponding to the first data can be improved, thereby improving the efficiency of file update.
作为可选的,在图6所示的存储设备的基础上,状态设置模块606,还用于将第一文件的索引节点中的更新标志位设置为有更新。Optionally, on the basis of the storage device shown in FIG. 6, the state setting module 606 is further configured to set the update flag bit in the index node of the first file to be updated.
其中,更新标志位用于确定第一文件的更新状态。The update flag is used to determine the update status of the first file.
由此可见,采用状态设置模块606的目的在于能够通过该更新标志位快速识别该索引节点对应的文件是否有更新,虽然通过文件状态表中的状态也能得知是否具有数据更新,但缺点有两点,其一是需要通过第一文件的索引节点中的第二指针确定文件状态表,并确定文件状态表中的无效的标识。因此采用状态设置模块606能够直接从第一文件的索引节点中获知该索引节点对应的文件是否有更新,而无需通过第二指针确定文件状态表,从而大大提高了文件系统更新的执行效率。 It can be seen that the purpose of the state setting module 606 is to quickly identify whether the file corresponding to the index node is updated by using the update flag, although the status in the file status table can also be used to know whether there is data update, but the disadvantages are Two points, one of which is to determine the file status table through the second pointer in the index node of the first file, and determine the invalid identifier in the file status table. Therefore, the state setting module 606 can directly learn whether the file corresponding to the index node has an update from the index node of the first file, and does not need to determine the file state table by using the second pointer, thereby greatly improving the execution efficiency of the file system update.
需要说明的是,本发明实施例中的存储设备不仅在写入数据上十分方便,在读取数据时也能快速准确的读取,如图7所示,图7为本发明实施例中存储设备的另一实施例图,如图7所示提供一种存储设备,应用于数据的读取,其中,It should be noted that the storage device in the embodiment of the present invention is not only convenient for writing data, but also can be quickly and accurately read when reading data, as shown in FIG. 7, FIG. 7 is stored in the embodiment of the present invention. Another embodiment of the device, as shown in FIG. 7, provides a storage device for reading data, wherein
接收模块701,还用于接收文件读取请求,文件读取请求中携带有第二文件的文件标识和第二文件偏移量;The receiving module 701 is further configured to receive a file read request, where the file read request carries a file identifier of the second file and a second file offset;
确定模块704,还用于根据第二文件的文件标识确定第二文件的索引节点;根据第二文件偏移量确定待读取数据的文件块号;根据第二文件的索引节点中的第二指针指向的文件状态表确定待读取数据的状态为无效;The determining module 704 is further configured to determine an index node of the second file according to the file identifier of the second file; determine a file block number of the data to be read according to the second file offset; and use a second one of the index nodes according to the second file The file status table pointed to by the pointer determines that the status of the data to be read is invalid;
该存储设备还包括:The storage device also includes:
查找模块707,用于根据第二文件的索引节点中的第一指针指向的文件更新表确定待读取数据的文件块号对应的逻辑块号;The searching module 707 is configured to determine, according to the file update table pointed to by the first pointer in the index node of the second file, a logical block number corresponding to the file block number of the data to be read;
读取模块708,用于根据待读取数据的文件块号对应的逻辑块号确定待读取数据的物理地址,并根据待读取数据的物理地址读取待读取数据。The reading module 708 is configured to determine a physical address of the data to be read according to the logical block number corresponding to the file block number of the data to be read, and read the data to be read according to the physical address of the data to be read.
本发明实施例中的存储设备在实际读取数据时,首先会由接收模块704接收文件读取请求,而后,会由确定模块704根据第二文件的文件标识确定第二文件的索引节点,接下来再由确定模块704根据第二文件偏移量确定待读取数据的文件块号,在读取待读取数据之前,需要先判断待读取数据是否为更新过的数据,即判断待读取数据的状态是否为无效,可由确定模块704根据第二文件的索引节点确定文件块文图表,并在其中确定待读取数据的状态,如为无效时,则表示此状态对应的数据通过现有读取的为错误数据,此时由查找模块707根据第二文件的索引节点确定文件更新表,并在文件更新表中找到待读取数据对应的文件块号的位置,进而找到该待读取数据更新后的逻辑块号,而后由读取模块708根据待读取数据的文件块号对应的逻辑块号确定待读取数据的物理地址,并通过此逻辑块号对应的物理地址读取物理盘上的待读取数据。When the storage device in the embodiment of the present invention actually reads data, the receiving module 704 first receives the file reading request, and then the determining module 704 determines the index node of the second file according to the file identifier of the second file. Then, the determining module 704 determines the file block number of the data to be read according to the second file offset. Before reading the data to be read, it is necessary to determine whether the data to be read is updated data, that is, to determine the pending reading. Whether the state of the data is invalid, the determining module 704 determines the file block text chart according to the index node of the second file, and determines the state of the data to be read therein, and if it is invalid, it indicates that the data corresponding to the state passes the current state. If the erroneous data is read, the search module 707 determines the file update table according to the index node of the second file, and finds the location of the file block number corresponding to the data to be read in the file update table, thereby finding the to-be-read. Taking the updated logical block number of the data, and then the reading module 708 determines the physicality of the data to be read according to the logical block number corresponding to the file block number of the data to be read. Address, and reads data to be read on a physical disk to the physical address corresponding to this logical block number.
由此可见,通过本发明实施例方案在读取时首先对待读取数据进行判断,而后根据判断结果进行后续读取操作,由于不会直接读取索引节点上的数据存储位置,因此在读取时,不会出现数据读取错误的情况,并且通过读取更新表中的逻辑块号读取待读取数据的方式,进一步增加本发明实施例文件更新方法 的可实现性。It can be seen that, by using the solution of the embodiment of the present invention, the read data is first determined during reading, and then the subsequent read operation is performed according to the judgment result, since the data storage location on the index node is not directly read, so the read is performed. When the data reading error does not occur, and the manner of reading the data to be read by reading the logical block number in the update table, the file updating method of the embodiment of the present invention is further increased. The achievability.
需要说明的是,在图7所示的存储设备中,It should be noted that, in the storage device shown in FIG. 7,
确定模块704、还用于根据第二文件的索引节点中的更新标志位确定第二文件有更新。The determining module 704 is further configured to determine that the second file is updated according to the update flag bit in the index node of the second file.
其中,更新标志位用于确定第二文件的更新状态,当确定模块704确定为有更新时,会触发确定模块704根据第二文件的索引节点的第二指针确定文件状态表。The update flag is used to determine the update status of the second file. When the determination module 704 determines that there is an update, the determination module 704 determines the file status table according to the second pointer of the index node of the second file.
可以理解的是,设置此更新标志位的目的在于给仅通过对索引节点的读取,即可获知该索引节点对应的数据是否有更新,而不必先读取文件状态表,而后搜索文件状态表中的待读取数据的文件块号对应的待读取数据的状态,通过状态判断是否有更新,从而能够节省数据读取时间,提高数据读取的效率。It can be understood that the purpose of setting this update flag bit is to know whether the data corresponding to the index node is updated only by reading the index node, without first reading the file status table, and then searching the file status table. In the state of the data to be read corresponding to the file block number of the data to be read, it is judged whether there is an update by the state, thereby saving data reading time and improving data reading efficiency.
上面对本发明实施例中的存储设备进行了介绍,下面对本发明实施例中的另一种存储设备进行介绍,如图8所示,图8是本发明实施例中存储设备的结构示意图,该存储设备中建立有文件系统,该存储设备8包括:The storage device in the embodiment of the present invention is described above. The following describes another storage device in the embodiment of the present invention. As shown in FIG. 8, FIG. 8 is a schematic structural diagram of a storage device according to an embodiment of the present invention. A file system is established in the device, and the storage device 8 includes:
存储器801,用于存储文件数据;a memory 801, configured to store file data;
控制器802,与所述存储器连接,用于接收文件更新请求,文件更新请求中携带有第一文件的文件标识、第一文件偏移量以及第二数据,第二数据用于更新文件中的第一数据;The controller 802 is connected to the memory, and is configured to receive a file update request, where the file update request carries a file identifier of the first file, a first file offset, and second data, where the second data is used to update the file. First data;
在存储器中根据第二数据的大小为第二数据分配空闲的数据块;Allocating an idle data block to the second data according to the size of the second data in the memory;
通过缓存将第二数据写入存储器中已分配的数据块中;Writing the second data into the allocated data block in the memory through the cache;
根据文件偏移量确定存储器中第一数据的文件块号,文件块号用于标识第一数据的逻辑位置;Determining, according to the file offset, a file block number of the first data in the memory, the file block number being used to identify a logical location of the first data;
根据第一文件的文件标识确定存储器中第一文件的索引节点;Determining an index node of the first file in the memory according to the file identifier of the first file;
在第一文件的索引节点中的第一指针指向的文件更新表中记录第一数据的文件块号与存储第二数据的数据块的逻辑块号的对应关系,逻辑块号用于指向存储第二数据的物理地址;Corresponding relationship between a file block number of the first data and a logical block number of the data block storing the second data is recorded in the file update table pointed to by the first pointer in the index node of the first file, and the logical block number is used to point to the storage The physical address of the second data;
在索引节点中的第二指针指向的文件状态表中将第一数据的状态设置为无效。The state of the first data is set to be invalid in the file state table pointed to by the second pointer in the index node.
其中,存储器801用于存储文件数据,在更新数据时,控制器802首先将 第二数据存入分配的空闲的数据块中,并确定第一数据的文件块号,而后控制器802根据第一文件确定索引节点,确定文件更新表和文件状态表,而后控制器802在文件更新表中记录下第一数据的文件块号与存储第二数据的数据块的逻辑块号的对应关系,即可实现通过文件块号与新的逻辑块号相对应,而后控制器802在文件状态表中将第一数据的状态设置为无效,即可完成数据的更新操作,通过本发明实施例方案在更新数据时由于不需要修改索引节点的任何内容和任何间接块指针,从而减少数据块的拷贝和磁盘碎片,最终达到提高更新操作效率的目的。The memory 801 is used to store file data. When updating data, the controller 802 firstly The second data is stored in the allocated free data block, and the file block number of the first data is determined, and then the controller 802 determines the index node according to the first file, determines the file update table and the file status table, and then the controller 802 is in the file. The correspondence between the file block number of the first data and the logical block number of the data block storing the second data is recorded in the update table, so that the file block number corresponds to the new logical block number, and then the controller 802 is in the file. In the state table, the state of the first data is set to be invalid, and the data update operation is completed. When the data is updated by the solution of the embodiment of the present invention, since the content of the index node and any indirect block pointers do not need to be modified, the data block is reduced. The copy and disk fragmentation ultimately achieve the purpose of improving the efficiency of the update operation.
需要说明的是,控制器802除上述执行数据更新的操作外,作为可选的,还可执行数据的读取操作,其中,该控制器802还可执行如下操作:It should be noted that, in addition to the foregoing operations of performing data update, the controller 802 may also perform a data reading operation, wherein the controller 802 may also perform the following operations:
接收文件读取请求,文件读取请求中携带有第二文件的文件标识和第二文件偏移量;Receiving a file read request, where the file read request carries a file identifier of the second file and a second file offset;
根据第二文件的文件标识确定第二文件的索引节点;Determining an index node of the second file according to the file identifier of the second file;
根据第二文件偏移量确定待读取数据的文件块号;Determining a file block number of the data to be read according to the second file offset;
根据第二文件的索引节点中的第二指针指向的文件状态表确定待读取数据的状态为无效;Determining, according to the file status table pointed by the second pointer in the index node of the second file, that the status of the data to be read is invalid;
根据第二文件的索引节点中的第一指针指向的文件更新表确定待读取数据的文件块号对应的逻辑块号;Determining, according to the file update table pointed to by the first pointer in the index node of the second file, a logical block number corresponding to the file block number of the data to be read;
根据待读取数据的文件块号对应的逻辑块号确定待读取数据的物理地址;Determining a physical address of the data to be read according to a logical block number corresponding to a file block number of the data to be read;
根据待读取数据的物理地址读取待读取数据。The data to be read is read according to the physical address of the data to be read.
可以理解的是,本发明实施例中的存储设备8在实际读取数据时,首先会由控制器802接收文件读取请求,而后,会由控制器802根据第二文件的文件标识确定第二文件的索引节点,接下来再由控制器802根据第二文件偏移量确定待读取数据的文件块号,在读取待读取数据之前,需要先判断待读取数据是否为更新过的数据,即判断待读取数据的状态是否为无效,可由控制器802根据第二文件的索引节点确定文件块文图表,并在其中确定待读取数据的状态,如为无效时,则表示此状态对应的数据通过现有读取的为错误数据,此时由控制器802根据第二文件的索引节点确定文件更新表,并在文件更新表中找到待读取数据对应的文件块号的位置,进而找到该待读取数据更新后的逻辑块 号,而后由控制器802根据待读取数据的文件块号对应的逻辑块号确定待读取数据的物理地址,并由控制器802通过此逻辑块号对应的物理地址读取物理盘上的待读取数据。It can be understood that, when the storage device 8 in the embodiment of the present invention actually reads data, the file read request is first received by the controller 802, and then the controller 802 determines the second file according to the file identifier of the second file. The index node of the file, and then the controller 802 determines the file block number of the data to be read according to the second file offset. Before reading the data to be read, it is necessary to determine whether the data to be read is updated. Data, that is, determining whether the state of the data to be read is invalid, may be determined by the controller 802 according to the index node of the second file, and determining the state of the data to be read therein, if it is invalid, indicating The data corresponding to the status is erroneous data read by the existing one. At this time, the controller 802 determines the file update table according to the index node of the second file, and finds the position of the file block number corresponding to the data to be read in the file update table. And then find the updated logical block of the data to be read. And then the controller 802 determines the physical address of the data to be read according to the logical block number corresponding to the file block number of the data to be read, and the controller 802 reads the physical address on the physical disk through the physical address corresponding to the logical block number. The data to be read.
需要说明的是,控制器802除上述执行数据更新和数据读取的操作外,作为可选的,所述控制器还用于:It should be noted that, in addition to the foregoing operations of performing data update and data reading, the controller 802 is further configured to:
将第一文件的索引节点中的更新标志位设置为有更新,更新标志位用于确定所述第一文件的更新状态。The update flag bit in the index node of the first file is set to have an update, and the update flag bit is used to determine an update status of the first file.
由此可见,控制器802能够通过该更新标志位快速识别该索引节点对应的文件是否有更新,虽然通过文件状态表中的数据的状态也能得知是否具有数据更新,但缺点有两点,其一是需要通过第一文件的索引节点中的第二指针确定文件状态表,并确定文件状态表中的无效的标识。因此若控制器802能够直接从第一文件的索引节点中获知该索引节点对应的文件是否有更新,而无需通过第二指针确定文件状态表,从而大大提高了文件系统更新的执行效率。It can be seen that the controller 802 can quickly identify whether the file corresponding to the index node is updated by using the update flag bit. Although the status of the data in the file status table can be used to know whether there is data update, there are two disadvantages. One is that the file status table needs to be determined by the second pointer in the index node of the first file, and the invalid identifier in the file status table is determined. Therefore, if the controller 802 can directly learn from the index node of the first file whether the file corresponding to the index node has an update, and does not need to determine the file state table by using the second pointer, the execution efficiency of the file system update is greatly improved.
需要说明的是,控制器802除上述执行数据更新和数据读取的操作外,作为可选的,所述控制器还用于:It should be noted that, in addition to the foregoing operations of performing data update and data reading, the controller 802 is further configured to:
在根据第二文件的索引节点中的第二指针指向的文件状态表确定待读取数据的状态之前,根据第二文件的索引节点中的更新标志位确定第二文件有更新,更新标志位用于确定第二文件的更新状态。Before determining the state of the data to be read according to the file state table pointed to by the second pointer in the index node of the second file, determining that the second file is updated according to the update flag bit in the index node of the second file, and updating the flag bit Determine the update status of the second file.
由此可见,控制器802在文件状态表确定待读取数据的状态之前,会根据第二文件的索引节点中的更新标志位确定第二文件有更新,更新标志位用于确定第二文件的更新状态。因此,采用此步骤若在更新标志位有更新时,表示第二文件已经被更新过,采用现有的读取方式可能读取不到待读取数据,因此需要先去文件状态表确定待读取数据的状态,而后在确定待读取数据的读取方式,从而能够提高文件系统更新的执行效率。It can be seen that, before the file status table determines the status of the data to be read, the controller 802 determines that the second file is updated according to the update flag bit in the index node of the second file, and the update flag is used to determine the second file. update status. Therefore, if this step is used to update the update flag, it indicates that the second file has been updated. The existing read mode may not read the data to be read. Therefore, it is necessary to first go to the file status table to determine the pending read. The state of the data is fetched, and then the manner in which the data to be read is read is determined, thereby improving the execution efficiency of the file system update.
作为可选的,本发明实施例中的存储设备8内还设置了通讯接口和缓存,其中:通讯接口803,用于供存储设备与外界设备进行通讯;Optionally, a communication interface and a cache are further disposed in the storage device 8 in the embodiment of the present invention, where: the communication interface 803 is configured to allow the storage device to communicate with the external device;
缓存804,用于供控制器和存储器之间进行数据交互,缓存设置于控制器和存储之间。The cache 804 is used for data interaction between the controller and the memory, and the cache is set between the controller and the storage.
其中,通讯接口803与控制器802相连接,用于供存储设备与外界设备进 行通讯,其可以是以太网接口和光纤接口等物理有线接口,也可以是无线接口,具体视采用存储设备的具体应用场景而定,具体不作限定。The communication interface 803 is connected to the controller 802, and is used for the storage device and the external device. The line communication may be a physical wired interface such as an Ethernet interface or a fiber interface, or may be a wireless interface, which is determined by a specific application scenario of the storage device, and is not limited.
缓存804作为存储器801与控制器802之间的缓冲,由于控制器802文件数据的速率远大于存储器801的读取数据,因此在存储器801与控制器802之间的设置缓存804,该缓存804读取数据的速率远大于存储器801,而又小于控制器802的的读取数据的速率,因此通过设置该缓存804,将需要进行操作的数据预先从存储器801中读取至缓存804中,再由控制器801进行操作,能大大提高数据的读取效率,进而提高存储设备的运行效率。The cache 804 serves as a buffer between the memory 801 and the controller 802. Since the rate of the file data of the controller 802 is much larger than the read data of the memory 801, the cache 804 is read between the memory 801 and the controller 802, and the cache 804 is read. The rate at which the data is fetched is much larger than the memory 801, and is smaller than the rate at which the controller 802 reads the data. Therefore, by setting the buffer 804, the data that needs to be operated is read from the memory 801 into the cache 804 in advance, and then The controller 801 operates to greatly improve the reading efficiency of the data, thereby improving the operating efficiency of the storage device.
需要说明的是,除如图8所示的存储设备的结构示意图中,多个存储器801公用一个缓存804的方式外,还可采用如图9所示的方式,图9为本发明实施例中存储设备的另一个实施例图,其中,存储设备9中的每个存储器901均分别使用一个缓存904,而后所有的缓存904均连接至控制器902。It should be noted that, in addition to the manner in which the plurality of memories 801 share one cache 804, the manner shown in FIG. 9 may be adopted, and FIG. 9 is in the embodiment of the present invention. Another embodiment of a storage device in which each memory 901 in storage device 9 uses a cache 904, respectively, and all caches 904 are then coupled to controller 902.
需要说明的是,不论是采用单个缓存904还是多个缓存904,其目的都在于作为控制器与存储器之间的缓冲,当存储器901非常多时,则倾向于为每个存储器901分别配置一个缓存904,当存储器904的数量不是很多时,可采用对多个存储器904配置一个较大的缓存即可,当然,具体设置时还会根据其他条件来进行设置,如缓存904的速率分别与控制器902即存储器901的比值。It should be noted that whether a single cache 904 or multiple caches 904 are used, the purpose is to serve as a buffer between the controller and the memory. When the memory 901 is very large, a cache 904 is preferably configured for each of the memories 901. When the number of the memory 904 is not large, a large buffer may be configured for the plurality of memories 904. Of course, the specific settings may be set according to other conditions, such as the rate of the buffer 904 and the controller 902 respectively. That is, the ratio of the memory 901.
除此之外,该缓存904可以是一级缓存904,也可采用多级缓存904,其中,越靠近控制器902的缓存904存取数据的速率越高。In addition, the cache 904 can be a level one cache 904, or a multi-level cache 904 can be employed, wherein the closer to the cache 904 of the controller 902, the higher the rate at which data is accessed.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。A person skilled in the art can clearly understand that for the convenience and brevity of the description, the specific working process of the system, the device and the unit described above can refer to the corresponding process in the foregoing method embodiment, and details are not described herein again.
本发明实施例还提供一种数据处理的计算机程序产品,包括存储了程序代码的计算机可读存储介质,所述程序代码包括的指令用于执行前述任意一个方法实施例所述的方法流程。本领域普通技术人员可以理解,前述的存储介质包括:U盘、移动硬盘、磁碟、光盘、随机存储器(Random-Access Memory,RAM)、固态硬盘(Solid State Disk,SSD)或者非易失性存储器(non-volatile memory)等各种可以存储程序代码的非短暂性的(non-transitory)机器可读介质。 The embodiment of the invention further provides a computer program product for data processing, comprising a computer readable storage medium storing program code, the program code comprising instructions for executing the method flow described in any one of the foregoing method embodiments. A person skilled in the art can understand that the foregoing storage medium includes: a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a random access memory (RAM), a solid state disk (SSD), or a nonvolatile. A non-transitory machine readable medium that can store program code, such as a non-volatile memory.
需要说明的是,本申请所提供的实施例仅仅是示意性的。例如,上述实施例中各部件的划分,实际实现时还可以有另外的划分方式。例如多个模块或组件可以结合或者可以集成到另一个设备中,或一些特征可以忽略,或不执行。另外,所显示或讨论的部件相互之间的耦合或直接耦合或通信连接可以是通过一些通信接口、模块的间接耦合或通信连接,可以包括电性连接、机械连接或其它的连接形式。It should be noted that the embodiments provided in the present application are merely illustrative. For example, the division of each component in the above embodiment may have another division manner in actual implementation. For example, multiple modules or components may be combined or integrated into another device, or some features may be omitted or not performed. In addition, the coupling or direct coupling or communication connection of the components shown or discussed may be through some communication interface, indirect coupling or communication connection of the modules, and may include electrical, mechanical, or other forms of connection.
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。在本发明实施例、权利要求以及附图中揭示的特征可以独立存在也可以组合存在。在本发明实施例中以硬件形式描述的特征可以通过软件来执行,反之亦然。在此不做限定。 It will be apparent to those skilled in the art that, for the convenience and brevity of the description, in the above embodiments, the description of each embodiment has its own emphasis, and the parts which are not described in detail in a certain embodiment can be referred to other implementations. A description of the example. Features disclosed in the embodiments of the invention, the claims, and the drawings may exist independently or in combination. Features described in hardware in the embodiments of the present invention may be implemented by software, and vice versa. There is no limit here.

Claims (12)

  1. 一种文件更新方法,所述方法应用于建立有文件系统的存储设备中,其特征在于,包括:A method for updating a file, the method being applied to a storage device having a file system, comprising:
    接收文件更新请求,所述文件更新请求中携带有第一文件的文件标识、第一文件偏移量以及第二数据,所述第二数据用于更新所述第一文件中的第一数据;根据所述第二数据的大小为所述第二数据分配空闲的数据块;Receiving a file update request, where the file update request carries a file identifier of the first file, a first file offset, and second data, where the second data is used to update the first data in the first file; Allocating an idle data block to the second data according to a size of the second data;
    将所述第二数据写入已分配的所述数据块中;Writing the second data into the allocated data block;
    根据所述第一文件偏移量确定所述第一数据的文件块号,所述文件块号用于标识所述第一数据的逻辑位置;Determining, according to the first file offset, a file block number of the first data, where the file block number is used to identify a logical location of the first data;
    根据所述第一文件的文件标识确定所述第一文件的索引节点;Determining an index node of the first file according to the file identifier of the first file;
    在所述第一文件的索引节点中的第一指针指向的文件更新表中记录所述第一数据的文件块号与存储所述第二数据的数据块的逻辑块号的对应关系,所述逻辑块号用于指向存储所述第二数据的物理地址;Corresponding relationship between a file block number of the first data and a logical block number of a data block storing the second data is recorded in a file update table pointed to by the first pointer in the index node of the first file, a logical block number is used to point to a physical address storing the second data;
    在所述索引节点中的第二指针指向的文件状态表中将所述第一数据的状态设置为无效。Setting a state of the first data to be invalid in a file status table pointed to by the second pointer in the index node.
  2. 根据权利要求1所述的文件更新方法,其特征在于,所述方法还包括:The method for updating a file according to claim 1, wherein the method further comprises:
    接收文件读取请求,所述文件读取请求中携带有第二文件的文件标识和第二文件偏移量;Receiving a file read request, where the file read request carries a file identifier of the second file and a second file offset;
    根据所述第二文件的文件标识确定所述第二文件的索引节点;Determining an index node of the second file according to the file identifier of the second file;
    根据所述第二文件偏移量确定待读取数据的文件块号;Determining, according to the second file offset, a file block number of the data to be read;
    根据所述第二文件的索引节点中的第二指针指向的文件状态表确定所述待读取数据的状态为无效;Determining, according to the file status table pointed by the second pointer in the index node of the second file, that the status of the data to be read is invalid;
    根据所述第二文件的所述索引节点中的第一指针指向的文件更新表确定所述待读取数据的文件块号对应的逻辑块号;Determining, according to the file update table pointed by the first pointer in the index node of the second file, a logical block number corresponding to the file block number of the data to be read;
    根据所述待读取数据的文件块号对应的逻辑块号确定待读取数据的物理地址;Determining, according to a logical block number corresponding to the file block number of the data to be read, a physical address of the data to be read;
    根据所述待读取数据的物理地址读取所述待读取数据。Reading the data to be read according to the physical address of the data to be read.
  3. 根据权利要求1所述的文件更新方法,其特征在于,所述方法还包括:The method for updating a file according to claim 1, wherein the method further comprises:
    将所述第一文件的索引节点中的更新标志位设置为有更新,所述更新标志 位用于确定所述第一文件的更新状态。Setting an update flag bit in the index node of the first file to have an update, the update flag The bit is used to determine an update status of the first file.
  4. 根据权利要求2所述的文件更新方法,其特征在于,所述根据所述第二文件的索引节点中的第二指针指向的文件状态表确定所述待读取数据的状态之前,所述方法还包括:The file updating method according to claim 2, wherein the method determines the state of the data to be read according to a file state table pointed to by a second pointer in the index node of the second file Also includes:
    根据所述第二文件的索引节点中的更新标志位确定所述第二文件有更新,所述更新标志位用于确定所述第二文件的更新状态。Determining that the second file has an update according to an update flag bit in the index node of the second file, the update flag bit is used to determine an update status of the second file.
  5. 一种存储设备,其特征在于,包括:A storage device, comprising:
    接收模块,用于接收文件更新请求,所述文件更新请求中携带有第一文件的文件标识、第一文件偏移量以及第二数据,所述第二数据用于更新所述第一文件中的第一数据;a receiving module, configured to receive a file update request, where the file update request carries a file identifier of the first file, a first file offset, and second data, where the second data is used to update the first file First data;
    分配模块,用于根据所述第二数据的大小为所述第二数据分配空闲的数据块;An allocating module, configured to allocate an idle data block to the second data according to the size of the second data;
    写入模块,用于将所述第二数据写入已分配的所述数据块中;a writing module, configured to write the second data into the allocated data block;
    确定模块,用于根据所述第一文件偏移量确定所述第一数据的文件块号,所述文件块号用于标识所述第一数据的逻辑位置,并根据所述第一文件的文件标识确定所述第一文件的索引节点;a determining module, configured to determine, according to the first file offset, a file block number of the first data, where the file block number is used to identify a logical location of the first data, and according to the first file The file identifier determines an index node of the first file;
    记录模块,用于在所述第一文件的索引节点中的第一指针指向的文件更新表中记录所述第一数据的文件块号与存储所述第二数据的数据块的逻辑块号的对应关系,所述逻辑块号用于指向存储所述第二数据的物理地址;a recording module, configured to record, in a file update table pointed by the first pointer in the index node of the first file, a file block number of the first data and a logical block number of a data block storing the second data Corresponding relationship, the logical block number is used to point to a physical address storing the second data;
    状态设置模块,在所述索引节点中的第二指针指向的文件状态表中将所述第一数据的状态设置为无效。The state setting module sets the state of the first data to be invalid in a file state table pointed by the second pointer in the index node.
  6. 根据权利要求5所述的存储设备,其特征在于:A storage device according to claim 5, wherein:
    所述接收模块,还用于接收文件读取请求,所述文件读取请求中携带有第二文件的文件标识和第二文件偏移量;The receiving module is further configured to receive a file read request, where the file read request carries a file identifier of the second file and a second file offset;
    所述确定模块,还用于根据所述第二文件的文件标识确定所述第二文件的索引节点,根据所述第二文件偏移量确定待读取数据的文件块号,根据所述第二文件的索引节点中的第二指针指向的文件状态表确定所述待读取数据的状态为无效;The determining module is further configured to determine an index node of the second file according to the file identifier of the second file, and determine a file block number of the data to be read according to the second file offset, according to the a file status table pointed to by the second pointer in the index node of the second file determines that the state of the data to be read is invalid;
    所述存储设备还包括: The storage device further includes:
    查找模块,用于根据所述第二文件的所述索引节点中的第一指针指向的文件更新表确定所述待读取数据的文件块号对应的逻辑块号;a searching module, configured to determine, according to a file update table pointed by the first pointer in the index node of the second file, a logical block number corresponding to a file block number of the data to be read;
    读取模块,用于根据所述待读取数据的文件块号对应的逻辑块号确定待读取数据的物理地址,并根据所述待读取数据的物理地址读取所述待读取数据。a reading module, configured to determine a physical address of the data to be read according to a logical block number corresponding to the file block number of the data to be read, and read the data to be read according to the physical address of the data to be read .
  7. 根据权利要求5所述的存储设备,其特征在于:A storage device according to claim 5, wherein:
    所述状态设置模块,还用于将所述第一文件的索引节点中的更新标志位设置为有更新,所述更新标志位用于确定所述第一文件的更新状态。The status setting module is further configured to set an update flag bit in the index node of the first file to be updated, and the update flag bit is used to determine an update status of the first file.
  8. 根据权利要求6所述的存储设备,其特征在于,所述确定模块还用于:The storage device according to claim 6, wherein the determining module is further configured to:
    根据所述第二文件的索引节点中的更新标志位确定所述第二文件有更新,所述更新标志位用于确定所述第二文件的更新状态。Determining that the second file has an update according to an update flag bit in the index node of the second file, the update flag bit is used to determine an update status of the second file.
  9. 一种存储设备,其特征在于:所述存储设备中建立有文件系统,所述存储设备包括:A storage device is characterized in that: a file system is established in the storage device, and the storage device includes:
    存储器,用于存储文件数据;a memory for storing file data;
    控制器,与所述存储器连接,用于接收文件更新请求,所述文件更新请求中携带有第一文件的文件标识、第一文件偏移量以及第二数据,所述第二数据用于更新所述文件中的第一数据;a controller, configured to receive a file update request, where the file update request carries a file identifier of the first file, a first file offset, and second data, where the second data is used for updating The first data in the file;
    在存储器中根据所述第二数据的大小为所述第二数据分配空闲的数据块;Allocating an idle data block to the second data according to a size of the second data in a memory;
    通过缓存将所述第二数据写入存储器中已分配的所述数据块中;Writing the second data into the allocated data block in the memory by caching;
    根据所述文件偏移量确定存储器中所述第一数据的文件块号,所述文件块号用于标识所述第一数据的逻辑位置;Determining, according to the file offset, a file block number of the first data in the memory, where the file block number is used to identify a logical location of the first data;
    根据所述第一文件的文件标识确定存储器中所述第一文件的索引节点;Determining, according to the file identifier of the first file, an index node of the first file in the memory;
    在所述第一文件的索引节点中的第一指针指向的文件更新表中记录所述第一数据的文件块号与存储所述第二数据的数据块的逻辑块号的对应关系,所述逻辑块号用于指向存储所述第二数据的物理地址;Corresponding relationship between a file block number of the first data and a logical block number of a data block storing the second data is recorded in a file update table pointed to by the first pointer in the index node of the first file, a logical block number is used to point to a physical address storing the second data;
    在所述索引节点中的第二指针指向的文件状态表中将所述第一数据的状态设置为无效。Setting a state of the first data to be invalid in a file status table pointed to by the second pointer in the index node.
  10. 根据权利要求9所述的存储设备,其特征在于,所述控制器还用于:The storage device according to claim 9, wherein the controller is further configured to:
    接收文件读取请求,所述文件读取请求中携带有第二文件的文件标识和第二文件偏移量; Receiving a file read request, where the file read request carries a file identifier of the second file and a second file offset;
    根据所述第二文件的文件标识确定所述第二文件的索引节点;Determining an index node of the second file according to the file identifier of the second file;
    根据所述第二文件偏移量确定待读取数据的文件块号;Determining, according to the second file offset, a file block number of the data to be read;
    根据所述第二文件的索引节点中的第二指针指向的文件状态表确定所述待读取数据的状态为无效;Determining, according to the file status table pointed by the second pointer in the index node of the second file, that the status of the data to be read is invalid;
    根据所述第二文件的所述索引节点中的第一指针指向的文件更新表确定所述待读取数据的文件块号对应的逻辑块号;Determining, according to the file update table pointed by the first pointer in the index node of the second file, a logical block number corresponding to the file block number of the data to be read;
    根据所述待读取数据的文件块号对应的逻辑块号确定待读取数据的物理地址;Determining, according to a logical block number corresponding to the file block number of the data to be read, a physical address of the data to be read;
    根据所述待读取数据的物理地址读取所述待读取数据。Reading the data to be read according to the physical address of the data to be read.
  11. 根据权利要求9所述的存储设备,其特征在于,所述控制器还用于:The storage device according to claim 9, wherein the controller is further configured to:
    将所述第一文件的索引节点中的更新标志位设置为有更新,所述更新标志位用于确定所述第一文件的更新状态。The update flag bit in the index node of the first file is set to have an update, and the update flag bit is used to determine an update status of the first file.
  12. 根据权利要求10所述的存储设备,其特征在于,所述控制器还用于:The storage device according to claim 10, wherein the controller is further configured to:
    在根据所述第二文件的索引节点中的第二指针指向的文件状态表确定所述待读取数据的状态之前,根据所述第二文件的索引节点中的更新标志位确定所述第二文件有更新,所述更新标志位用于确定所述第二文件的更新状态。 Determining the second according to an update flag bit in an index node of the second file before determining a state of the data to be read according to a file state table pointed to by a second pointer in the index node of the second file The file has an update, and the update flag is used to determine an update status of the second file.
PCT/CN2015/082442 2015-06-26 2015-06-26 File updating method and storage device WO2016206070A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2015/082442 WO2016206070A1 (en) 2015-06-26 2015-06-26 File updating method and storage device
CN201580001153.0A CN107430546B (en) 2015-06-26 2015-06-26 File updating method and storage device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2015/082442 WO2016206070A1 (en) 2015-06-26 2015-06-26 File updating method and storage device

Publications (1)

Publication Number Publication Date
WO2016206070A1 true WO2016206070A1 (en) 2016-12-29

Family

ID=57584605

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/082442 WO2016206070A1 (en) 2015-06-26 2015-06-26 File updating method and storage device

Country Status (2)

Country Link
CN (1) CN107430546B (en)
WO (1) WO2016206070A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20220226735A1 (en) * 2019-05-31 2022-07-21 Sony Interactive Entertainment Inc. Information processing device

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109164977B (en) * 2018-07-23 2022-01-11 中国建设银行股份有限公司 Data storage system and method, and storage medium
CN111444138B (en) * 2019-01-16 2024-03-15 深圳市茁壮网络股份有限公司 File local modification method and system
CN110162525B (en) * 2019-04-17 2023-09-26 平安科技(深圳)有限公司 B+ tree-based read-write conflict resolution method, device and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1619600A2 (en) * 2004-07-19 2006-01-25 Microsoft Corporation Remote file updates through remote protocol
CN103049539A (en) * 2012-12-25 2013-04-17 华为技术有限公司 Method and device for storing file data in file system
CN103440204A (en) * 2013-08-28 2013-12-11 华为技术有限公司 Method for updating file system and storage device

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS62172427A (en) * 1986-01-24 1987-07-29 Nec Corp Secondary indexing device
TWI544334B (en) * 2012-05-30 2016-08-01 慧榮科技股份有限公司 Data storage device and operating method thereof

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1619600A2 (en) * 2004-07-19 2006-01-25 Microsoft Corporation Remote file updates through remote protocol
CN103049539A (en) * 2012-12-25 2013-04-17 华为技术有限公司 Method and device for storing file data in file system
CN103440204A (en) * 2013-08-28 2013-12-11 华为技术有限公司 Method for updating file system and storage device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20220226735A1 (en) * 2019-05-31 2022-07-21 Sony Interactive Entertainment Inc. Information processing device

Also Published As

Publication number Publication date
CN107430546A (en) 2017-12-01
CN107430546B (en) 2020-04-21

Similar Documents

Publication Publication Date Title
US9996542B2 (en) Cache management in a computerized system
US10983955B2 (en) Data unit cloning in memory-based file systems
US11301379B2 (en) Access request processing method and apparatus, and computer device
TWI828901B (en) Software implemented using circuit and method for key-value stores
US20140095555A1 (en) File management device and method for storage system
US20150113230A1 (en) Directory storage method and query method, and node controller
US9430492B1 (en) Efficient scavenging of data and metadata file system blocks
US11030092B2 (en) Access request processing method and apparatus, and computer system
CN107329704B (en) Cache mirroring method and controller
AU2013403132A1 (en) Data storage method, data storage apparatus, and storage device
WO2016206070A1 (en) File updating method and storage device
WO2018076633A1 (en) Remote data replication method, storage device and storage system
TW201830249A (en) Method, memory system and article for maximized dedupable memory
US9524236B1 (en) Systems and methods for performing memory management based on data access properties
US10768829B2 (en) Opportunistic use of streams for storing data on a solid state device
US9569113B2 (en) Data storage device and operating method thereof
CN108958657B (en) Data storage method, storage device and storage system
CN109508140B (en) Storage resource management method and device, electronic equipment and system
US20150261436A1 (en) Flexible storage block for a solid state drive (ssd)-based file system
CN111625477B (en) Processing method and device for read request for accessing erase block
US11586353B2 (en) Optimized access to high-speed storage device
EP4220414A1 (en) Storage controller managing different types of blocks, operating method thereof, and operating method of storage device including the same
WO2022021280A1 (en) Storage controller, storage control method, solid state disk and storage system
US20230112221A1 (en) System and method to conserve device lifetime for snapshot generation
US10936543B1 (en) Metadata protected sparse block set for SSD cache space management

Legal Events

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

Ref document number: 15895970

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15895970

Country of ref document: EP

Kind code of ref document: A1