WO2015039496A1 - 一种worm追加写判断方法及存储设备 - Google Patents

一种worm追加写判断方法及存储设备 Download PDF

Info

Publication number
WO2015039496A1
WO2015039496A1 PCT/CN2014/083042 CN2014083042W WO2015039496A1 WO 2015039496 A1 WO2015039496 A1 WO 2015039496A1 CN 2014083042 W CN2014083042 W CN 2014083042W WO 2015039496 A1 WO2015039496 A1 WO 2015039496A1
Authority
WO
WIPO (PCT)
Prior art keywords
write operation
write
file
current
pointer position
Prior art date
Application number
PCT/CN2014/083042
Other languages
English (en)
French (fr)
Inventor
仇锋利
彭勇
宛涌
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2015039496A1 publication Critical patent/WO2015039496A1/zh

Links

Classifications

    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11BINFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
    • G11B20/00Signal processing not specific to the method of recording or reproducing; Circuits therefor
    • G11B20/10Digital recording or reproducing
    • G11B20/12Formatting, e.g. arrangement of data block or words on the record carriers
    • G11B20/1217Formatting, e.g. arrangement of data block or words on the record carriers on discs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/1805Append-only file systems, e.g. using logs or journals to store data
    • G06F16/181Append-only file systems, e.g. using logs or journals to store data providing write once read many [WORM] semantics
    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11BINFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
    • G11B20/00Signal processing not specific to the method of recording or reproducing; Circuits therefor
    • G11B20/10Digital recording or reproducing
    • G11B2020/10898Overwriting or replacing recorded data
    • G11B2020/10907Overwriting or replacing recorded data using pseudo-overwriting, i.e. virtually or logically overwriting data on WORM media by remapping recorded blocks to alternate areas

Definitions

  • the present invention relates to the field of communications, and in particular, to a WORM (Wr i te once Read Read many) additional write determination method and a storage device.
  • WORM Wired i te once Read Read many
  • WORM is a data storage method that can only be written once but allows multiple reads. It can effectively prevent data from being accidentally deleted, rewritten or changed. As a result, many business units rely on WORM storage to store critical data and prevent critical data from being altered or deleted.
  • a file saved in WORM format (that is, a WORM file) cannot be overwritten, so the protection scope of the WORM file is considered to be [0, original file size].
  • the operation of the WORM file mainly includes modification writing and additional writing.
  • the modified writing refers to the modification of the data within the protection scope of the WORM file for a certain writing operation, and the modification of the WORM file is not allowed; the additional writing refers to a certain time.
  • the data to be written by the write operation is outside the scope of the WORM file protection, and additional writes to the WORM file are allowed.
  • the user equipment When the user equipment writes data to the file system of the storage device, it first sends an OPEN instruction to the file system of the storage device to notify the file system of the storage device to prepare for data writing, and then receives the data sent by the user equipment. After the I TE command, the data of this write operation can be written into the WORM file when it is judged that the write operation is an additional write to the WORM file.
  • Another method is to judge according to the location of the file pointer. After receiving the WRITE instruction, the file system of the storage device starts to write from the current file pointer position after scheduling, if the current file pointer position is within the protection range of the previously written WORM file. It is considered to be a modified write, otherwise it is an additional write. If the file system of the storage device does not perform file pointer scheduling during the two write operations, the write operation will start from the initial position of the file. At this time, if the second write contains the first content.
  • the second write operation is actually an additional write, but the file system of the storage device detects that the pointer of the second write operation is within the protection scope of the first written WORM file, thus incorrectly
  • the second write operation is judged to be a modified write, and it is impossible to accurately determine that the second write operation is an additional write, which causes the write operation to fail.
  • the embodiment of the present invention provides a WORM additional write determination method and a storage device, which can more accurately determine whether a write operation to a WORM file is an additional write.
  • a WORM additional write determination method including:
  • a write range of the current write operation Determining, according to the WRI TE instruction, a write range of the current write operation, where a write range of the write operation is greater than or equal to a start pointer position value of the current write operation, and is smaller than Equal to the start pointer position value of the current write operation plus the data size of the current write operation;
  • the method further includes: if it is detected that there is no intersection, determining that the current write operation is an additional write.
  • the method further includes:
  • the obtaining the starting pointer position of the current write operation includes:
  • the obtained start pointer position of the current write operation is the end position of the WORM file.
  • the obtained start pointer position of the current write operation is The starting position of the WORM file.
  • the method further includes:
  • the obtained start pointer position of the current write operation is the target pointer position in the SEEK instruction.
  • the method further includes:
  • the obtained start pointer position of the current write operation is the end position of the WORM file in the SEEK instruction.
  • the method further includes:
  • the data of the current write operation is written from the start pointer position of the current write operation.
  • a storage device including:
  • An obtaining unit configured to obtain a starting pointer position of the current writing operation
  • a receiving unit configured to receive a write WR I TE command sent by the user equipment, where the I TE instruction carries a data size of the current write operation
  • An identification unit configured to identify a write range of the current write operation according to a WR I TE instruction received by the receiving unit, where a write range of the write operation is greater than or equal to a start of the current write operation The pointer position value is less than or equal to the start pointer position value of the current write operation plus the data size of the current write operation; a detecting unit, configured to detect whether a protection range of the WORM file and an input range of the current write operation recognized by the identifying unit have an intersection;
  • the detecting unit is further configured to: after detecting the intersection, detecting whether the current write operation is the same as the data of the WORM file in the intersection portion;
  • a determining unit configured to: when the detecting unit detects that the current write operation is the same as the data of the WORM file in the intersection portion, determining that the current write operation is an additional write; detecting, by the detecting unit When the current write operation is different from the data of the WORM file in the intersection portion, it is determined that the current write operation is a modified write.
  • the determining unit is further configured to: when the detecting unit detects that there is no intersection, determine that the current write operation is an additional write.
  • the obtaining unit is further configured to obtain the location before obtaining the start pointer position of the current write operation.
  • An OPEN instruction is sent by the user equipment, where the OPEN instruction carries a file open identifier;
  • the obtaining unit is specifically configured to: when the file open identifier carries an additional write identifier, obtain a start pointer position of the current write operation as an end position of the WORM file.
  • the start pointer position of the current write operation obtained by the obtaining unit is the WORM file. starting point
  • the receiving unit is further configured to: after the obtaining unit obtains an OPEN command sent by the user equipment, does not carry an additional write in the file open identifier. When the identifier is received, receiving a SEEK instruction sent by the user equipment, where the SEEK instruction carries a target pointer position;
  • the obtaining unit is specifically configured to obtain, from the SEEK instruction received by the receiving unit, a starting pointer position of the current writing operation, where the starting pointer position of the current writing operation is the target The position of the pointer.
  • the receiving unit is further configured to: after the obtaining unit obtains an OPEN command sent by the user equipment, carrying an additional write in the file open identifier And receiving, in the case of being converted, the SEEK instruction sent by the user equipment, where the SEEK instruction carries an end position of the WORM file; then, the obtaining unit is specifically used to receive the SEEK from the receiving unit The start pointer position of the current write operation is obtained in the instruction, and the start pointer position of the current write operation is the end position of the WORM file.
  • the first possible implementation of the first aspect, the second possible implementation of the first aspect, the third possible implementation of the first aspect, the fourth possible aspect of the first aspect The implementation manner or the fifth possible implementation manner of the first aspect, in a sixth possible implementation manner,
  • the writing unit is configured to write the current write at a start pointer position of the current write operation obtained from the obtaining unit after the determining unit determines that the current write operation is an additional write Operational data.
  • the WORM additional write determination method and the storage device provided by the embodiment of the present invention obtain the write range of the current write operation according to the obtained start pointer position of the current write operation and the data size of the current write operation, and then detect the WORM file. Whether there is an intersection between the protection range of the write operation and the write range of the current write operation. If there is an intersection, it is detected whether the data of the current write operation and the WORM file are the same in the intersection part, and if the same, the current write operation is determined. In the case of an additional write, the write operation is determined to be a modified write. Thus, in the case where the additional write identifier is converted, the method provided by the embodiment of the present invention can determine the write operation according to the start pointer position of the write operation.
  • the method provided by the embodiment of the present invention may be based on the data of the intersection portion. Is it the same, to accurately determine whether the write operation to the WORM file is an additional write, so the method provided by the embodiment of the present invention can Scene It is more accurate to judge whether the write operation to the WORM file is an additional write.
  • FIG. 1 is a schematic flow chart of a WORM additional write determination method according to Embodiment 1 of the present invention.
  • FIG. 2 is a schematic flow chart of a WORM additional write determination method according to Embodiment 2 of the present invention.
  • FIG. 3 is a schematic diagram of a WORM additional write process according to the present invention.
  • FIG. 4 is a structural block diagram of a storage device according to Embodiment 3 of the present invention.
  • FIG. 5 is a structural block diagram of another storage device according to Embodiment 3 of the present invention
  • FIG. 6 is a structural block diagram of a storage device according to Embodiment 3 of the present invention.
  • An embodiment of the present invention provides a WORM additional write determination method. As shown in FIG. 1, the method includes the following steps:
  • the user device When the user device writes data to the file system of the storage device, it first sends an OPEN command to the file system of the storage device to notify the file system of the storage device to prepare for data writing.
  • the OPEN instruction sent by the user equipment to the storage device has an additional write identifier
  • the OPEN instruction carries a file open identifier
  • the file open identifier carries an additional identifier.
  • the additional write identifier in the file open identifier is converted by the client of the storage device, and the server of the storage device is The additional write identifier is not received.
  • the file system of the storage device may obtain the current time according to the SEEK command that is sent by the user equipment and carries the start pointer position of the current write operation. The starting pointer position of the write operation.
  • the starting pointer position of the current write operation sent by the user equipment is the end position of the WORM file. If the additional write identifier is not converted in another scenario and is sent to the server of the storage device, the storage device considers that the write operation is an additional write, and the file system of the storage device obtains the current write. The starting pointer position of the operation is the end position of the WORM file.
  • the start pointer position of the current write operation is the WORM file. a start position; if the user equipment sends an SEEK instruction to the storage device, the start pointer position of the current write operation is a pointer position carried in the SEEK instruction.
  • the user equipment sends an OPEN instruction to the file system of the storage device to notify the file system of the storage device to prepare for data writing, and may send an SEEK instruction to the file system of the storage device to notify the start pointer position of the write operation.
  • the SEEK instruction may not be sent.
  • the SEEK instruction is sent according to the needs of the user, and is not limited herein.
  • the user equipment sends a WR I TE command to the file system of the storage device to notify the file system of the storage device to start data writing, and the I TE command carries the data of the current write operation. size.
  • the write range of the write operation is greater than or equal to the start pointer position value of the current write operation, and is less than or equal to the start pointer position value of the current write operation plus the current write The size of the data for the operation.
  • the storage method of the WORM file is single-write and multi-read, and the original content of the WORM file is not allowed to be changed.
  • the write operation of the WORM file by the user equipment is divided into modified write and additional write, where the additional write permission is allowed, and the modified write is not allowed. Therefore, the protection scope of the WORM file refers to a size greater than or equal to 0 and less than or equal to the size of the original WORM file. .
  • the file system of the storage device may detect whether there is an intersection between the protection scope of the WORM file and the write range of the write operation, and if the protection scope of the WORM file is detected and the write range of the write operation is intersected. Then, step 105 is performed. If it is detected that the protection range of the WORM file and the write range of the current write operation do not intersect, step 106 is performed.
  • step 1 If yes, proceed to step 1 06. If not, proceed to step 107.
  • the file system of the storage device can write the data of the current write operation.
  • the additional write label carried by the OPEN instruction can be converted by the client of the storage device.
  • the method provided by the embodiment of the present invention can obtain the start pointer position of the write operation as the end position of the WORM file, so that the server of the storage device can determine the write.
  • the operation is an additional write; if the start pointer position of a write operation is the start position of the WORM file, and the written content includes the original content of the WORM file, the method provided by the embodiment of the present invention can identify the WORM The intersection of the protection scope of the file and the writing range of the current write operation is [0, the size of the original content of the WORM file], and then the data of the intersection portion is detected, and the write operation can be judged as Additional writing.
  • the WORM additional write determination method provided by the embodiment of the present invention can more accurately determine whether the write operation to the WORM file is an additional write in various scenarios.
  • An embodiment of the present invention provides a WORM additional write determination method. As shown in FIG. 2, the method includes the following steps:
  • the user equipment sends an OPEN instruction to the storage device, where the OPEN instruction carries a file open identifier.
  • the user device When the user device writes data to the file system of the storage device, it first sends an OPEN command to the file system of the storage device to notify the file system of the storage device server to prepare for data writing.
  • the OPEN instruction carries a file open identifier, and the file open identifier may carry an additional write identifier.
  • the additional write identifier is converted by the client of the storage device, so that the server of the storage device does not receive the additional write. logo.
  • obtaining the write operation includes two cases: if the additional write identifier is not converted, the start pointer of the write operation can be obtained.
  • the location is the end position of the WORM file; if in some scenarios (such as in the scenario where the NFS V 3 protocol is applied), the file is opened in the identifier.
  • the additional write identifier is converted by the client of the storage device, and then receives the SEEK command sent by the user device, where the SEEK command carries the end position of the WORM file, so that the obtained write operation starts
  • the start pointer position is the end position of the WORM file in the SEEK instruction.
  • obtaining the write operation includes two cases: if the user equipment does not send the SEEK instruction to transfer the pointer, the start of the write operation is obtained.
  • a pointer position is a starting position of the WORM file; if the user equipment sends a SEEK instruction, where the SEEK instruction carries a target pointer position, obtaining a starting pointer position of the current write operation is in the SEEK instruction The target pointer position.
  • the start pointer position of this write operation can be obtained by the OPEN instruction or the SEEK instruction sent by the user equipment.
  • a WR I TE instruction is sent to the file system of the storage device to notify the file system of the storage device. Data writing begins, and the WR I TE instruction carries the data size of the current write operation.
  • the write range of the write operation is greater than or equal to the start pointer position value of the current write operation, and is less than or equal to the start pointer position value of the current write operation plus the current write operation.
  • Data size After receiving the WR I TE command sent by the user equipment, the data size of the current write operation carried in the WR I TE command can be obtained, and then the start pointer position of the current write operation obtained in step 202 can be obtained. The write range of this write operation.
  • the file pointer for this write operation is 51 2 , WR I TE instruction
  • the size of this write operation carried in this write is 1024 bytes.
  • the write range of this write operation is greater than or equal to 512 and less than or equal to 512 plus 1024, that is, the write range is [512, 1536].
  • the WORM file is stored in a single-write multi-read manner, and the original content of the WORM file is not allowed to be changed.
  • the write operation of the WORM file by the user equipment is divided into modified write and additional write.
  • the additional write is allowed, and the modified write is not allowed. Therefore, the protection scope of the WORM file refers to a value greater than or equal to 0 and less than or equal to the original WORM file. size.
  • the protection scope of the WORM file is [0, 1 024]
  • the write range of the write operation is [512, 1536]
  • step 206 is performed, and if no intersection is detected, step 208 is performed.
  • step 207 If yes, proceed to step 207. If not, proceed to step 208.
  • the file system of the storage device can write the write to the current write Operational data. For example, as shown in FIG. 3, the file system of the storage device detects that the intersection of the current write operation and the WORM file protection range is B [512, 1 024], and the storage device can detect the WORM file and the present The write operation is the same as the data in Part B, so that it can be judged that the write operation is an additional write.
  • the storage device server writes the data of the current write operation from the start pointer position of the current write operation. For example, as shown in FIG. 3, the storage device writes 1024 bytes of data B+C of the current write operation from 512, and finally obtains the content A+B+ after the write operation. C, did not modify the original content A+B.
  • the additional write identifier carried by the OPEN instruction may be converted by the client of the storage device, and the method provided by the embodiment of the present invention may obtain the start pointer position of the write operation as described.
  • the end position of the WORM file so that the server of the storage device can judge that the write operation is an additional write; if the start pointer position of a write operation is the start position of the WORM file, and the written content includes WORM
  • the original content of the file the method provided by the embodiment of the present invention, can identify that the protection scope of the WORM file and the intersection of the write range of the current write operation are [0, the size of the original content of the WORM file], and then detect Just like the data in the intersection part, you can judge that the write operation is an additional write.
  • the WORM additional write determination method provided by the embodiment of the present invention can more accurately determine whether the write operation to the WORM file is an additional write in various scenarios.
  • the embodiment of the present invention provides a storage device.
  • the storage device includes: an obtaining unit 401, a receiving unit 402, an identifying unit 403, a detecting unit 404, and a determining unit 405.
  • the obtaining unit 401 is configured to obtain a starting pointer position of the current writing operation; the receiving unit 402, For receiving a write WRITE command sent by the user equipment, where the ITE instruction carries the data size of the current write operation; the identifying unit 403 is configured to identify the current write operation according to the WRITE command received by the receiving unit 402.
  • the detecting unit 404 configured to detect whether the protection range of the WORM file and the writing range of the current write operation recognized by the identifying unit 403 have an intersection; the detecting unit 404 is further configured to: After the intersection, the data of the current write operation and the WORM file in the intersection portion is detected.
  • the determining unit 405 is configured to detect the current write operation and the WORM file at the detecting unit 404.
  • the detecting unit 404 detects the data of the current write operation and the intersection portion of the WORM file.
  • the determining unit 405 is further configured to: when the detecting unit 404 detects that there is no intersection, determine that the current write operation is an additional write.
  • the obtaining unit 401 is further configured to: before the obtaining unit 401 obtains the starting pointer position of the current writing operation, obtaining an OPEN instruction sent by the user equipment, where the OPEN instruction carries a file opening identifier;
  • the obtaining unit 401 is specifically configured to: when the file open identifier carries an additional write identifier, obtain a start pointer position of the current write operation as an end position of the WORM file.
  • the obtaining unit 401 is specifically configured to: when the file open identifier does not carry the additional write identifier, obtain the start pointer position of the current write operation as the start position of the WORM file.
  • the receiving unit 402 is further configured to: after the obtaining unit 401 obtains the OPEN command sent by the user equipment, when the file open identifier does not carry the additional write identifier, receive the SEEK instruction sent by the user equipment, The target pointer position is carried in the SEEK instruction; Then, the obtaining unit 401 is specifically configured to obtain a start pointer position of the current write operation from the SEEK instruction received by the receiving unit 402, where the target pointer position is carried in the SEEK instruction.
  • the writing unit 406 is further configured to: after the determining unit 405 determines that the current write operation is an additional write, obtain the obtained from the obtaining unit 401. At the start pointer position of this write operation, the data of the current write operation is written.
  • the embodiment of the invention further provides a storage device, as shown in FIG. 6, comprising: a receiving interface 601, a memory 602, a processor 603, and a disk 604.
  • the storage device may also include a common component such as a baseband processing component, a medium-frequency processing component, and an input-output storage device, and the embodiment of the present invention does not impose any limitation herein.
  • the memory 603 stores a set of program code
  • the processor 602 is configured to call the program code stored in the memory 603 for performing the following operations:
  • the processor 603 is configured to obtain a start pointer position of the current write operation.
  • the processor 603 receives a write WRI TE command sent by the user equipment by using the receiving interface 601, where the WR ITE instruction carries the write operation.
  • the processor 603 is further configured to identify, according to the WRI TE instruction received by the receiving interface, a write range of the current write operation, where a write range of the write operation is greater than or equal to the
  • the start pointer position value of the second write operation is less than or equal to the start pointer position value of the current write operation plus the data size of the current write operation; the processor 603 is further configured to detect the protection of the WORM file.
  • the processor 603 is further configured to: after the intersection is detected, detect the current write operation and the WORM file Whether the data in the intersection portion is the same; the processor 603 is further configured to: when the detecting unit detects that the current write operation is the same as the data of the WORM file in the intersection portion, determining the current write operation Is additionally written; the detecting unit detects the write operation is at the intersection of a WORM file data portion is not the same, the determination is to modify the write operation is a write.
  • a disk 604, configured to: after the processor 603 determines that the current write operation is an additional write, the current write operation obtained from the processor 603 is at a start pointer position on the disk 604, at the disk The data of the current write operation is written on 604.
  • the processor 603 is further configured to: when the processor 603 detects that there is no intersection, determine that the current write operation is an additional write.
  • the processor 603 is further configured to: before the processor 603 obtains the start pointer position of the current write operation, obtain an open OPEN command sent by the user equipment, where the OPEN instruction carries a file open identifier;
  • the processor 603 is specifically configured to: when the file open identifier carries an additional write identifier, obtain a start pointer position of the current write operation as an end position of the WORM file.
  • the processor 603 is specifically configured to: when the file open identifier does not carry the additional write identifier, obtain the start pointer position of the current write operation as the start position of the WORM file.
  • the processor 603 is further configured to: after obtaining the OPEN command sent by the user equipment, when the file open identifier does not carry the additional write identifier, receive the SEEK command sent by the user equipment by using the receiving interface 601
  • the SEEK instruction carries a target pointer position.
  • the processor 603 is specifically configured to obtain a start pointer position of the current write operation from the SEEK instruction received by the receiving interface 601, where the current write operation is performed.
  • the starting pointer position is the target pointer position.
  • the processor 603 is further configured to: after obtaining the OPEN command sent by the user equipment, in the case that the file open identifier carries an additional write identifier but is converted, the receiving interface 601 receives the The SEEK instruction sent by the user equipment, where the SEEK instruction carries the end position of the WORM file; then, the processor 603 is specifically configured to obtain the start of the current write operation from the SEEK instruction received by the receiving interface 601.
  • the pointer position, the start pointer position of the current write operation is the end position of the WORM file.
  • the storage device provided by the embodiment of the present invention according to the obtained start pointer of the current write operation The location and the data size of this write operation, get the write range of this write operation, and then detect
  • the method provided by the embodiment of the present invention may be based on the intersection between the two. Whether the data of the WORM file is an additional write can be more accurately determined in various scenarios.
  • the foregoing method includes the steps of the foregoing method embodiments; and the foregoing storage medium includes: a medium that can store program codes, such as a ROM, a RAM, a magnetic disk, or an optical disk.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Signal Processing (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

提供了一种WORM追加写判断方法及存储设备,涉及通信领域,可以更加准确地判断对WORM文件的写操作是否是追加写。所述方法具体包括:获得本次写操作的起始指针位置;接收用户设备发送的写WRITE指令,所述WRITE指令中携带有本次写操作的数据大小;根据所述WRITE指令识别所述本次写操作的写入范围;检测WORM文件的保护范围和所述本次写操作的写入范围是否有交集;若检测到有交集,则检测所述本次写操作与所述WORM文件在交集部分的数据是否一样;若是,则判断所述本次写操作是追加写;若不是,则判断所述本次写操作是修改写。

Description

一种 WORM追加写判断方法及存储设备
本申请要求于 2013 年 9 月 23 日提交中国专利局、 申请号 201310436864.3、 发明名称为 "一种 WORM 追加写判断方法及存储设备" 的中国专利申请的优先权, 其全部内容通过引用结合在本申请中。
技术领域
本发明涉及通信领域, 尤其涉及一种 WORM ( Wr i te once Read many , 单写多读) 追加写判断方法及存储设备。
背景技术
WORM是一种只能单次写入但允许多次读取的数据存储方式,能有效 避免数据被意外删除、 重写或更改。 因此, 许多企业单位依赖 WORM 存 储来存储关键数据, 防止关键数据遭到更改或删除。 以 WORM 形式保存 的文件 (即 WORM文件) 不能被改写, 因此认为 WORM文件的保护范围是 [ 0, 原始文件大小] 。 对 WORM文件的操作主要有修改写和追加写, 修改 写指的是某次写操作要修改 WORM文件保护范围之内的数据, 对于 WORM 文件修改写是不允许的;追加写指的是某次写操作要写入的数据在 WORM 文件保护范围之外, 对于 WORM文件追加写是允许的。
用户设备在向存储设备的文件系统写入数据时, 会先向所述存储设 备的文件系统发送 OPEN 指令, 通知所述存储设备的文件系统准备进行 数据写入, 然后在接收到用户设备发送的 I TE指令后, 就可以在判断 出本次写操作是对 WORM文件的追加写时将本次写操作的数据写入 WORM 文件中。
现有技术判断本次写操作是否为追加写的方法主要有两种。 一种是 根据文件打开标识来判断, 用户设备发送的 OPEN 指令中携带有文件打 开标识。 如果该文件打开标识携带了追加写标识, 则存储设备的文件系 统就会判断出本次写操作为追加写操作, 否则, 就认为是修改写, 不允 许本次写操作。 但是, 在应用本方法时, 有的网络协议如 NFS ( Ne twork F i l e Sys tem,网络文件系统) V3中存储设备上的客户端会对 OPEN指令中携带的文件打开标识进行转换,不会将文件打开标识下发到 存储设备的服务端, 存储设备的服务端在写文件时就无法判断此次写操 作是否是追加写, 导致存储设备的服务端不会按照追加写模式写文件。
另一种方法是根据文件指针位置来判断, 存储设备的文件系统接收 到 WRITE指令后会从调度后当前文件指针位置开始写入, 如果当前文件 指针位置在先前写入的 WORM 文件的保护范围内, 就认为是修改写, 否 则就是追加写。 如果存储设备的文件系统在进行的两次写操作时, 都没 有进行文件指针调度, 则两次写操作都会从文件初始位置开始写入, 此 时, 若第二次写入的内容包含第一次写入的内容, 则第二次写操作实际 上是追加写, 但是存储设备的文件系统检测出第二次写操作的指针在第 一次写入的 WORM 文件的保护范围内, 因此错误地将第二次写操作判断 为修改写, 无法准确判断出第二次写操作为追加写, 导致写操作无法进 行。
发明内容
本发明的实施例提供一种 WORM 追加写判断方法及存储设备, 可以 更加准确地判断对 WORM文件的写操作是否是追加写。
为达到上述目的, 本发明的实施例釆用如下技术方案:
第一方面, 公开了一种 WORM追加写判断方法, 包括:
获得本次写操作的起始指针位置;
接收用户设备发送的写 WRI TE指令, 所述 I TE指令中携带有本次 写操作的数据大小;
根据所述 WRI TE指令识别所述本次写操作的写入范围, 其中, 所述 写操作的写入范围是大于等于所述本次写操作的起始指针位置值, 小于 等于所述本次写操作的起始指针位置值加上所述本次写操作的数据大 小;
检测 WORM 文件的保护范围和所述本次写操作的写入范围是否有交 若检测到有交集, 则检测所述本次写操作与所述 WORM 文件在交集 部分的数据是否一样;
若一样, 则判断所述本次写操作是追加写; 若不一样, 则判断所述 本次写操作是修改写。
结合第一方面, 在第一种可能的实现方式中, 所述方法还包括: 若检测到没有交集, 则判断所述本次写操作是追加写。
结合第一方面或第一方面的第一种可能的实现方式, 在第二种可能 的实现方式中, 所述获得本次写操作的起始指针位置之前, 所述方法还 包括:
获得所述用户设备发送的打开 OPEN指令, 所述 OPEN指令中携带有 文件打开标识;
则, 所述获得本次写操作的起始指针位置, 包括:
若所述文件打开标识中携带有追加写标识, 则获得的本次写操作的 起始指针位置为所述 WORM文件的结束位置。
结合第一方面的第二种可能的实现方式, 在第三种可能的实现方式 中, 若所述文件打开标识中没有携带追加写标识, 则获得的本次写操作 的起始指针位置为所述 WORM文件的起始位置。
结合第一方面的第二种可能的实现方式, 在第四种可能的实现方式 中, 所述接收所述用户设备发送的 OPEN 指令之后, 若所述文件打开标 识中没有携带追加写标识, 则所述方法还包括:
接收所述用户设备发送的 SEEK指令, 所述 SEEK指令中携带有目标 指针位置;
则, 获得的本次写操作的起始指针位置为所述 SEEK 指令中的所述 目标指针位置。
结合第一方面的第二种可能的实现方式, 在第五种可能的实现方式 中, 所述接收所述用户设备发送的 OPEN 指令之后, 若所述文件打开标 识中携带有追加写标识但被转化掉的情况下, 所述方法还包括:
接收所述用户设备发送的 SEEK指令, 所述 SEEK指令中携带有所述 WORM文件的结束位置;
则, 获得的本次写操作的起始指针位置为所述 SEEK 指令中的所述 WORM文件的结束位置。
结合第一方面、 第一方面的第一种可能的实现方式、 第一方面的第 二种可能的实现方式、 第一方面的第三种可能的实现方式、 第一方面的 第四种可能的实现方式或第一方面的第五种可能的实现方式, 在第六种 可能的实现方式中, 在判断所述本次写操作是追加写之后, 所述方法还 包括:
从所述本次写操作的起始指针位置处, 写入所述本次写操作的数 据。
第二方面, 公开了一种存储设备, 包括:
获得单元, 用于获得本次写操作的起始指针位置;
接收单元, 用于接收用户设备发送的写 WR I TE指令, 所述 I TE指 令中携带有本次写操作的数据大小;
识别单元, 用于根据所述接收单元接收的 WR I TE指令识别所述本次 写操作的写入范围, 其中, 所述写操作的写入范围是大于等于所述本次 写操作的起始指针位置值, 小于等于所述本次写操作的起始指针位置值 加上所述本次写操作的数据大小; 检测单元, 用于检测 WORM 文件的保护范围和所述识别单元识别出 的本次写操作的写入范围是否有交集;
所述检测单元还用于, 在检测到有交集后, 检测所述本次写操作与 所述 WORM文件在交集部分的数据是否一样;
判断单元,用于在所述检测单元检测到所述本次写操作与所述 WORM 文件在交集部分的数据一样时, 判断所述本次写操作是追加写; 在所述 检测单元检测到所述本次写操作与所述 WORM 文件在交集部分的数据不 一样时, 判断所述本次写操作是修改写。
结合第二方面,在第一种可能的实现方式中,所述判断单元还用于, 在所述检测单元检测到没有交集时, 判断所述本次写操作是追加写。
结合第二方面、 第二方面的第一种可能的实现方式, 在第二种可能 的实现方式中, 所述获得单元还用于, 在获得本次写操作的起始指针位 置之前, 获得所述用户设备发送的打开 OPEN指令, 所述 OPEN指令中携 带有文件打开标识;
所述获得单元具体用于, 在所述文件打开标识中携带有追加写标识 时, 获得本次写操作的起始指针位置为所述 WORM文件的结束位置。
结合第二方面, 在第三种可能的实现方式中, 在所述文件打开标识 中没有携带追加写标识时, 所述获得单元获得的本次写操作的起始指针 位置为所述 WORM文件的起始位置
结合第二方面,在第四种可能的实现方式中,所述接收单元还用于, 在所述获得单元获得所述用户设备发送的 OPEN 指令之后, 在所述文件 打开标识中没有携带追加写标识时, 接收所述用户设备发送的 SEEK 指 令, 所述 SEEK指令中携带有目标指针位置;
则, 所述获得单元具体用于, 从接收单元接收的 SEEK 指令中获得 本次写操作的起始指针位置, 所述本次写操作的起始指针位置为所述目 标指针位置。
结合第二方面,在第五种可能的实现方式中,所述接收单元还用于, 在所述获得单元获得所述用户设备发送的 OPEN 指令之后, 在所述文件 打开标识中携带有追加写标识但被转化掉的情况下, 接收所述用户设备 发送的 SEEK指令, 所述 SEEK指令中携带有所述 WORM文件的结束位置; 则, 所述获得单元具体用于, 从接收单元接收的 SEEK 指令中获得 本次写操作的起始指针位置, 所述本次写操作的起始指针位置为所述 WORM文件的结束位置。
结合第一方面、 第一方面的第一种可能的实现方式、 第一方面的第 二种可能的实现方式、 第一方面的第三种可能的实现方式、 第一方面的 第四种可能的实现方式或第一方面的第五种可能的实现方式, 在第六种 可能的实现方式中, 还包括写入单元;
所述写入单元, 用于在所述判断单元判断所述本次写操作是追加写 之后, 从所述获得单元获得的本次写操作的起始指针位置处, 写入所述 本次写操作的数据。
本发明实施例提供的 WORM 追加写判断方法和存储设备, 根据获得 的本次写操作的起始指针位置和本次写操作的数据大小, 获得本次写操 作的写入范围, 然后检测 WORM 文件的保护范围和本次写操作的写入范 围是否有交集, 若有交集, 则检测所述本次写操作与所述 WORM 文件在 交集部分的数据是否一样, 若一样, 则判断本次写操作为追加写, 否则 判断本次写操作为修改写, 这样, 在追加写标识被转换掉的情况下, 本 发明实施例提供的方法可以根据本次写操作的起始指针位置判断本次 写操作是否为追加写, 在没有追加写标识, 且本次写操作的写入范围与 所述 WORM 文件的保护范围有交集的情况下, 本发明实施例提供的方法 可以根据两者在交集部分的数据是否一样, 来准确地判断对 WORM 文件 的写操作是否是追加写, 故本发明实施例提供的方法就可以在各种场景 下更加准确地判断对 WORM文件的写操作是否是追加写。
附图说明
图 1为本发明实施例 1提供的一种 WORM追加写判断方法流程示意 图;
图 2为本发明实施例 2提供的一种 WORM追加写判断方法流程示意 图;
图 3为本发明提供的一种 WORM追加写过程示意图;
图 4为本发明实施例 3提供的一种存储设备的结构框图;
图 5为本发明实施例 3提供的另一种存储设备的结构框图; 图 6为本发明实施例 3提供的一种存储设备的结构框图。
具体实施方式
下面将结合本发明实施例中的附图, 对本发明实施例中的技术方案 进行清楚、 完整地描述, 显然, 所描述的实施例仅仅是本发明一部分实 施例, 而不是全部的实施例。 基于本发明中的实施例, 本领域普通技术 人员在没有做出创造性劳动前提下所获得的所有其他实施例, 都属于本 发明保护的范围。
实施例 1 :
本发明实施例提供了一种 WORM追加写判断方法, 如图 1 所示, 所 述方法包括以下步骤:
101、 获得本次写操作的起始指针位置。
用户设备在向存储设备的文件系统写入数据时, 会先向所述存储设 备的文件系统发送 OPEN 指令, 通知所述存储设备的文件系统准备进行 数据写入。
在用户设备向存储设备发送的 OPEN指令中有追加写标识的情况下, 所述 OPEN 指令中携带有文件打开标识, 所述文件打开标识中携带追加 写标识, 若因为在某些场景下 (如在应用了 NFS V 3 协议的场景下) , 所述文件打开标识中的追加写标识被存储设备的客户端转化, 所述存储 设备的服务端就不会接收到所述追加写标识, 此时, 所述存储设备的文 件系统可以根据用户设备随后发送的, 携带有所述本次写操作的起始指 针位置的 SEEK 指令来获得所述本次写操作的起始指针位置, 这时, 用 户设备发送的本次写操作的起始指针位置为 WORM 文件的结束位置。 若 在其他场景下该追加写标识未被转化, 并发送给了所述存储设备的服务 端, 则所述存储设备会认为本次写操作为追加写, 则存储设备的文件系 统获得本次写操作的起始指针位置为所述 WORM文件的结束位置。
在用户设备向存储设备发送的 OPEN 指令中没有追加写标识的情况 下, 若所述用户设备没有向所述存储设备发送 SEEK 指令, 则本次写操 作的起始指针位置为所述 WORM 文件的起始位置; 若所述用户设备向所 述存储设备发送 SEEK指令, 则本次写操作的起始指针位置为所述 SEEK 指令中携带的指针位置。
1 02、 接收用户设备发送的 WR I TE指令, 所述 I TE指令中携带有 本次写操作的数据大小。
用户设备向存储设备的文件系统发送 OPEN 指令, 通知所述存储设 备的文件系统准备进行数据写入, 可以向所述存储设备的文件系统发送 SEEK指令, 通知本次写操作的起始指针位置, 也可以不发送 SEEK指令, 在这里, 所述 SEEK 指令是根据用户的需要来发送的, 在此不做限定。 在此之后, 所述用户设备就会向所述存储设备的文件系统发送 WR I TE指 令, 通知所述存储设备的文件系统开始进行数据写入, 所述 I TE指令 携带本次写操作的数据大小。
1 03、 根据所述 W R I T E指令识别所述本次写操作的写入范围。
其中, 所述写操作的写入范围是大于等于所述本次写操作的起始指 针位置值, 小于等于所述本次写操作的起始指针位置值加上所述本次写 操作的数据大小。
104、 检测 WORM文件的保护范围和所述本次写操作的写入范围是否 有交集。
所述 WORM文件的存储方式是单写多读, 不允许改变 WORM文件的原 有内容。 用户设备对 WORM 文件的写操作分为修改写和追加写, 其中追 加写允许的, 修改写是不允许的, 故所述 WORM 文件的保护范围指的是 大于等于 0小于等于原始 WORM文件的大小。
存储设备的文件系统可以检测 WORM 文件的保护范围和所述本次写 操作的写入范围是否有交集, 若检测到所述 WORM 文件的保护范围和所 述本次写操作的写入范围有交集, 则进行步骤 105 , 若检测到所述 WORM 文件的保护范围和所述本次写操作的写入范围没有交集, 则进行步骤 106。
105、 检测所述本次写操作与所述 WORM文件在交集部分的数据是否 一样。
若一样, 则进行步骤 1 06 , 若不一样, 则进行步骤 107。
106、 判断所述本次写操作是追加写。
若检测到所述本次写操作与所述 WORM文件在交集部分的数据一样 , 则判断本次写操是在原有 WORM 文件中的数据的基础上进行的追加写, 允许执行本次写操作, 所述存储设备的文件系统就可以写入所述本次写 操作的数据。
107、 判断所述本次写操作是修改写。
若检测到所述本次写操作与所述 WORM 文件在交集部分的数据不一 样, 则判断本次写操是对原有 WORM 文件中的数据的修改写, 所述存储 设备的文件系统不允许执行本次写操作。
在一些场景下, 例如 NFS V3协议, 所述 OPEN指令携带的追加写标 识会被存储设备的客户端转化, 本发明实施例提供的方法, 可以获得本 次写操作的起始指针位置为所述 WORM 文件的结束位置, 这样存储设备 的服务端就可以判断此次写操作为追加写; 若某次写操作的起始指针位 置为所述 WORM文件的起始位置, 且写入的内容包括 WORM文件的原有内 容, 本发明实施例提供的方法, 可以识别出 WORM 文件的保护范围和所 述本次写操作的写入范围的交集就是 [ 0 , WORM文件原有内容的大小] , 进而检测出二者在交集部分的数据一样, 就可以判断此次写操作为追加 写。 本发明实施例提供的 WORM 追加写判断方法, 可以在各种场景下更 加准确地判断对 WORM文件的写操作是否是追加写。
实施例 2 :
本发明实施例提供了一种 WORM追加写判断方法, 如图 2所示, 所 述方法包括以下步骤:
201、 用户设备发送 OPEN指令给存储设备, 所述 OPEN指令携带文 件打开标识。
用户设备在向存储设备的文件系统写入数据时, 会先向所述存储设 备的文件系统发送 OPEN 指令, 通知所述存储设备服务端的文件系统准 备进行数据写入。 所述 OPEN 指令中携带有文件打开标识, 所述文件打 开标识可能会携带追加写标识。 但在某些场景下 (如在应用了 NFS V3 协议的场景下) , 所述追加写标识会被存储设备的客户端转化, 这样所 述存储设备的服务端就不会接收到所述追加写标识。
202、 获得本次写操作的起始指针位置。
在用户设备向存储设备发送的 OPEN指令中有追加写标识的情况下, 获得本次写操作包括两种情况: 若所述追加写标识没有被转化, 就可以 获得本次写操作的起始指针位置为所述 WORM 文件的结束位置; 若在某 些场景下 (如在应用了 NFS V 3 协议的场景下) , 所述文件打开标识中 的追加写标识被存储设备的客户端转化, 这时就会接收所述用户设备发 送的 SEEK指令, 所述 SEEK指令中携带有所述 WORM文件的结束位置, 这样获得的本次写操作的起始指针位置为所述 SEEK指令中的所述 WORM 文件的结束位置。
在用户设备向存储设备发送的 OPEN 指令中没有追加写标识的情况 下, 获得本次写操作包括两种情况: 若所述用户设备没有发送 SEEK 指 令调动指针, 则获得本次写操作的起始指针位置为所述 WORM 文件的起 始位置; 若所述用户设备发送 SEEK指令, 所述 SEEK指令中携带有目标 指针位置, 则获得本次写操作的起始指针位置为所述 SEEK 指令中的所 述目标指针位置。
总之, 通过用户设备发送的 OPEN指令或者 SEEK指令就可以获得本 次写操作的起始指针位置。
203、 接收用户设备发送的 WR I TE指令, 所述 I TE指令中携带有 本次写操作的数据大小。
当用户设备向所述存储设备服务端的文件系统发送的 OPEN 指令, 或者, OPEN指令和 SEEK指令后, 就会向所述存储设备的文件系统发送 WR I TE 指令, 通知所述存储设备的文件系统开始进行数据写入, 所述 WR I TE指令携带本次写操作的数据大小。
204、 根据所述 WR I TE指令识别所述本次写操作的写入范围。
在这里, 所述写操作的写入范围是大于等于所述本次写操作的起始 指针位置值, 小于等于所述本次写操作的起始指针位置值加上所述本次 写操作的数据大小。 接收到用户设备发送的 WR I TE指令后, 就可以获得 所述 WR I TE指令中携带的本次写操作的数据大小, 然后结合步骤 202所 获得本次写操作的起始指针位置就可以得到本次写操作的写入范围。
示例的, 如图 3所示, 本次写操作的文件指针是 51 2 , WR I TE指令 中携带的本次写操作的大小为 1024 字节, 则本次写操作的写入范围是 大于等于 512小于等于 512加上 1024 , 即写入范围为 [512 , 1536] 。
205、 检测 WORM文件的保护范围和所述本次写操作的写入范围是否 有交集。
这里, 所述 WORM文件的存储方式是单写多读, 不允许改变 WORM文 件的原有内容。 用户设备对 WORM 文件的写操作分为修改写和追加写, 其中追加写是允许的, 修改写是不允许的, 故所述 WORM 文件的保护范 围指的是大于等于 0小于等于原始 WORM文件的大小。
示例的, 如图 3所示, 所述 WORM文件的保护范围是 [ 0, 1 024] , 而 本次写操作的写入范围为 [512 , 1536] , 故可以检测到 WORM 文件的保护 范围和所述本次写操作的写入范围是有交集的, 所以交集部分为 [512, 1 024] 。
若检测到有交集, 则进行步骤 206 , 若检测到没有交集, 则进行步 骤 208。
206、 检测所述本次写操作与所述 WORM文件在交集部分的数据是否 一样。
若一样, 则进行步骤 207 , 若不一样, 则进行步骤 208。
207、 判断所述本次写操作是修改写。
若检测到所述本次写操作与所述 WORM 文件在交集部分的数据不一 样, 则判断本次写操是对原有 WORM 文件中的数据的修改写, 所述存储 设备不允许执行本次写操作。
208、 判断所述本次写操作是追加写。
若检测到所述本次写操作与所述 WORM文件在交集部分的数据一样 , 则判断本次写操是在原有 WORM 文件中的数据的基础上进行的追加写, 允许执行本次写操作, 所述存储设备的文件系统就可以写入所述本次写 操作的数据。 示例的, 如图 3所示, 存储设备的文件系统检测出本次写 操作和 WORM文件保护范围的交集部分是 B [512, 1 024] ,所述存储设备可 以检测出所述 WORM文件与本次写操作在 B部分 的数据一样, 这样就可 以判断出所述本次写操作是追加写。
209、 从所述本次写操作的起始指针位置处, 写入所述本次写操作 的数据。
若所述存储设备判断出所述本次写操作是追加写时, 所述存储设备 服务端就会从所述本次写操作的起始指针位置处, 写入所述本次写操作 的数据, 示例的, 如图 3所示, 所述存储设备从 512开始写入所述本次 写操作的 1024 字节的数据 B+C , 最终得到本次写操作写入后的内容 A+B+C , 并未对原始内容 A+B进行修改。
在一些场景下, 例如 NFS V3协议, 所述 OPEN指令携带的追加写标 识会被存储设备的客户端转化, 本发明实施例提供的方法, 可以获得本 次写操作的起始指针位置为所述 WORM 文件的结束位置, 这样存储设备 的服务端就可以判断此次写操作为追加写; 若某次写操作的起始指针位 置为所述 WORM文件的起始位置, 且写入的内容包括 WORM文件的原有内 容, 本发明实施例提供的方法, 可以识别出 WORM 文件的保护范围和所 述本次写操作的写入范围的交集就是 [ 0 , WORM文件原有内容的大小] , 进而检测出二者在交集部分的数据一样, 就可以判断此次写操作为追加 写。 本发明实施例提供的 WORM 追加写判断方法, 可以在各种场景下更 加准确地判断对 WORM文件的写操作是否是追加写。
实施例 3 :
本发明实施例提供了一种存储设备, 如图 4所示, 包括: 获得单元 401、 接收单元 402、 识别单元 403、 检测单元 404和判断单元 405。
获得单元 401 ,用于获得本次写操作的起始指针位置;接收单元 402 , 用于接收用户设备发送的写 WRITE指令, 所述 ITE指令中携带有本次 写操作的数据大小; 识别单元 403 , 用于根据所述接收单元 402接收的 WRITE指令识别所述本次写操作的写入范围, 其中, 所述写操作的写入 范围是大于等于所述本次写操作的起始指针位置值, 小于等于所述本次 写操作的起始指针位置值加上所述本次写操作的数据大小; 检测单元 404 , 用于检测 WORM文件的保护范围和所述识别单元 403识别出的本次 写操作的写入范围是否有交集; 所述检测单元 404还用于, 在检测到有 交集后, 检测所述本次写操作与所述 WORM 文件在交集部分的数据是否 一样; 判断单元 405 , 用于在所述检测单元 404检测到所述本次写操作 与所述 WORM 文件在交集部分的数据一样时, 判断所述本次写操作是追 加写; 在所述检测单元 404检测到所述本次写操作与所述 WORM文件在 交集部分的数据不一样时, 判断所述本次写操作是修改写。
判断单元 405还用于, 在所述检测单元 404检测到没有交集时, 判 断所述本次写操作是追加写。
所述获得单元 401还用于, 在所述获得单元 401获得本次写操作的 起始指针位置之前,获得所述用户设备发送的打开 OPEN指令,所述 OPEN 指令中携带有文件打开标识;
所述获得单元 401具体用于, 在所述文件打开标识中携带有追加写 标识时, 获得本次写操作的起始指针位置为所述 WORM文件的结束位置。
所述获得单元 401具体用于, 在所述文件打开标识中没有携带追加 写标识时, 获得本次写操作的起始指针位置为所述 WORM 文件的起始位 置。
所述接收单元 402还用于, 在所述获得单元 401获得所述用户设备 发送的 OPEN指令之后, 在所述文件打开标识中没有携带追加写标识时, 接收所述用户设备发送的 SEEK指令, 所述 SEEK指令中携带有目标指针 位置; 则, 所述获得单元 401具体用于, 从接收单元 402接收的 SEEK指 令中获得本次写操作的起始指针位置, 所述 SEEK 指令中携带有目标指 针位置。
可选的, 如图 5所示, 还包括写入单元 406 , 所述写入单元 406用 于在所述判断单元 405判断所述本次写操作是追加写之后, 从所述获得 单元 401获得的本次写操作的起始指针位置处, 写入所述本次写操作的 数据。
本发明实施例还提供了一种存储设备, 如图 6所示, 包括: 接收接 口 601 , 存储器 602 , 处理器 603 , 和磁盘 604。 当然, 存储设备还可以 包括基带处理部件、 中射频处理部件、 输入输出存储设备等通用部件, 本发明实施例在此不做任何限制。 其中, 存储器 603中存储一组程序代 码, 且处理器 602用于调用存储器 603中存储的程序代码, 用于执行以 下操作:
所述处理器 603 , 用于获得本次写操作的起始指针位置所述处理器 603通过接收接口 601接收用户设备发送的写 WRI TE指令, 所述 WR ITE 指令中携带有本次写操作的数据大小; 所述处理器 603 , 还用于根据所 述接收接口接收的 WRI TE指令识别所述本次写操作的写入范围, 其中, 所述写操作的写入范围是大于等于所述本次写操作的起始指针位置值, 小于等于所述本次写操作的起始指针位置值加上所述本次写操作的数 据大小; 所述处理器 603 , 还用于检测 WORM文件的保护范围和所述处理 器 603识别出的本次写操作的写入范围是否有交集; 所述处理器 603还 用于, 在检测到有交集后, 检测所述本次写操作与所述 WORM 文件在交 集部分的数据是否一样; 所述处理器 603还用于, 在所述检测单元检测 到所述本次写操作与所述 WORM 文件在交集部分的数据一样时, 判断所 述本次写操作是追加写; 在所述检测单元检测到所述本次写操作与所述 WORM文件在交集部分的数据不一样时, 判断所述本次写操作是修改写。 磁盘 604 , 用于在所述处理器 603判断所述本次写操作是追加写之后, 从所述处理器 603获得的本次写操作在磁盘 604上的起始指针位置处, 在所述磁盘 604上写入所述本次写操作的数据。
所述处理器 603还用于, 在所述处理器 603检测到没有交集时, 判 断所述本次写操作是追加写。
所述处理器 603还用于, 在所述处理器 603获得本次写操作的起始 指针位置之前, 获得所述用户设备发送的打开 OPEN指令, 所述 OPEN指 令中携带有文件打开标识; 所述处理器 603具体用于, 在所述文件打开 标识中携带有追加写标识时, 获得本次写操作的起始指针位置为所述 WORM文件的结束位置。
所述处理器 603具体用于, 在所述文件打开标识中没有携带追加写 标识时, 获得本次写操作的起始指针位置为所述 WORM文件的起始位置。
所述处理器 603还用于, 在获得所述用户设备发送的 OPEN指令之 后, 在所述文件打开标识中没有携带追加写标识时, 通过所述接收接口 601接收所述用户设备发送的 SEEK指令, 所述 SEEK指令中携带有目标 指针位置; 则, 所述处理器 603具体用于, 从接收接口 601接收的 SEEK 指令中获得本次写操作的起始指针位置, 所述本次写操作的起始指针位 置为所述目标指针位置。
所述处理器 603还用于, 在获得所述用户设备发送的 OPEN指令之 后, 在所述文件打开标识中携带有追加写标识但被转化掉的情况下, 通 过所述接收接口 601接收所述用户设备发送的 SEEK指令, 所述 SEEK指 令中携带有所述 WORM文件的结束位置; 则, 所述处理器 603具体用于, 从接收接口 601接收的 SEEK指令中获得本次写操作的起始指针位置, 所述本次写操作的起始指针位置为所述 WORM文件的结束位置。
本发明实施例提供的存储设备, 根据获得的本次写操作的起始指针 位置和本次写操作的数据大小, 获得本次写操作的写入范围, 然后检测
WORM文件的保护范围和本次写操作的写入范围是否有交集, 若有交集, 则检测所述本次写操作与所述 WORM 文件在交集部分的数据是否一样, 若一样, 则判断本次写操作为追加写, 否则判断本次写操作为修改写, 这样, 在追加写标识被转换掉的情况下, 本发明实施例提供的方法可以 根据本次写操作的起始指针位置判断本次写操作是否为追加写, 在没有 追加写标识, 且本次写操作的写入范围与所述 WORM 文件的保护范围有 交集的情况下, 本发明实施例提供的方法可以根据两者在交集部分的数 据是否一样, 来准确地判断对 WORM 文件的写操作是否是追加写, 故本 发明实施例提供的方法就可以在各种场景下更加准确地判断对 WORM 文 件的写操作是否是追加写。
本领域普通技术人员可以理解: 实现上述方法实施例的全部或部分 步骤可以通过程序指令相关的硬件来完成, 前述的程序可以存储于一计 算机可读取存储介质中, 该程序在执行时, 执行包括上述方法实施例的 步骤; 而前述的存储介质包括: R0M、 RAM , 磁碟或者光盘等各种可以存 储程序代码的介质。
以上所述, 仅为本发明的具体实施方式, 但本发明的保护范围并不 局限于此, 任何熟悉本技术领域的技术人员在本发明揭露的技术范围 内, 可轻易想到变化或替换, 都应涵盖在本发明的保护范围之内。 因此, 本发明的保护范围应所述以权利要求的保护范围为准。

Claims

权利要求
1、 一种单写多读 WORM追加写判断方法, 其特征在于, 包括: 获得本次写操作的起始指针位置;
接收用户设备发送的写 WRI TE指令,所述 WRI TE指令中携带有本 次写操作的数据大小;
根据所述 WRI TE指令识别所述本次写操作的写入范围, 其中, 所 述写操作的写入范围是大于等于所述本次写操作的起始指针位置值, 小于等于所述本次写操作的起始指针位置值加上所述本次写操作的 数据大小;
检测 WORM文件的保护范围和所述本次写操作的写入范围是否有 交集;
若检测到有交集, 则检测所述本次写操作与所述 WORM文件在交 集部分的数据是否一样;
若一样, 则判断所述本次写操作是追加写; 若不一样, 则判断所 述本次写操作是修改写。
2、 根据权利要求 1所述的方法, 其特征在于, 所述方法还包括: 若检测到没有交集, 则判断所述本次写操作是追加写。
3、 根据权利要求 1或 2所述的方法, 其特征在于, 所述获得本 次写操作的起始指针位置之前, 所述方法还包括:
获得所述用户设备发送的打开 OPEN指令,所述 OPEN指令中携带 有文件打开标识;
则, 所述获得本次写操作的起始指针位置, 包括:
若所述文件打开标识中携带有追加写标识,则获得的本次写操作 的起始指针位置为所述 WORM文件的结束位置。
4、 根据权利要求 3所述的方法, 其特征在于, 若所述文件打开 标识中没有携带追加写标识,则获得的本次写操作的起始指针位置为 所述 WORM文件的起始位置。
5、 根据权利要求 3所述的方法, 其特征在于, 所述接收所述用 户设备发送的 OPEN指令之后, 若所述文件打开标识中没有携带追加 写标识, 则所述方法还包括:
接收所述用户设备发送的 SEEK指令,所述 SEEK指令中携带有目 标指针位置;
则, 获得的本次写操作的起始指针位置为所述 SEEK指令中的所 述目标指针位置。
6、 根据权利要求 3所述的方法, 其特征在于, 所述获得所述用 户设备发送的 OPEN指令之后, 在所述文件打开标识中携带有追加写 标识但被转化掉的情况下, 所述方法还包括:
接收所述用户设备发送的 SEEK指令,所述 SEEK指令中携带有所 述 WORM文件的结束位置;
则, 获得的本次写操作的起始指针位置为所述 SEEK指令中的所 述 WORM文件的结束位置。
7、 根据权利要求 1-6任意一项所述的方法, 其特征在于, 在判 断所述本次写操作是追加写之后, 所述方法还包括:
从所述本次写操作的起始指针位置处,写入所述本次写操作的数 据。
8、 一种存储设备, 其特征在于, 包括:
获得单元, 用于获得本次写操作的起始指针位置;
接收单元, 用于接收用户设备发送的写 WRITE指令, 所述 ITE 指令中携带有本次写操作的数据大小;
识别单元,用于根据所述接收单元接收的 WRI TE指令识别所述本 次写操作的写入范围, 其中, 所述写操作的写入范围是大于等于所述 本次写操作的起始指针位置值,小于等于所述本次写操作的起始指针 位置值加上所述本次写操作的数据大小;
检测单元, 用于检测 WORM文件的保护范围和所述识别单元识别 出的本次写操作的写入范围是否有交集;
所述检测单元还用于, 在检测到有交集后, 检测所述本次写操 作与所述 WORM文件在交集部分的数据是否一样;
判断单元, 用于在所述检测单元检测到所述本次写操作与所述 WORM文件在交集部分的数据一样时, 判断所述本次写操作是追加写; 在所述检测单元检测到所述本次写操作与所述 WORM文件在交集部分 的数据不一样时, 判断所述本次写操作是修改写。
9、 根据权利要求 8所述的存储设备, 其特征在于, 所述判断单 元还用于, 在所述检测单元检测到没有交集时, 判断所述本次写操作 是追加写。
1 0、 根据权利要求 8或 9所述的存储设备, 其特征在于, 所述获 得单元还用于, 在获得本次写操作的起始指针位置之前, 获得所述用 户设备发送的打开 OPEN指令,所述 OPEN指令中携带有文件打开标识; 所述获得单元具体用于,在所述文件打开标识中携带有追加写标 识时 ,获得本次写操作的起始指针位置为所述 WORM文件的结束位置。
1 1、 根据权利要求 1 0所述的存储设备, 其特征在于, 所述获得 单元具体用于, 在所述文件打开标识中没有携带追加写标识时, 获得 本次写操作的起始指针位置为所述 W 0 R M文件的起始位置。
1 2、 根据权利要求 1 0所述的存储设备, 其特征在于, 所述接收 单元还用于, 在所述获得单元获得所述用户设备发送的 OPEN指令之 后, 在所述文件打开标识中没有携带追加写标识时, 接收所述用户设 备发送的 SEEK指令, 所述 SEEK指令中携带有目标指针位置;
则, 所述获得单元具体用于, 从接收单元接收的 SEEK指令中获 得本次写操作的起始指针位置,所述本次写操作的起始指针位置为所 述目标指针位置。
1 3、 根据权利要求 1 0所述的存储设备, 其特征在于, 所述接收 单元还用于, 在所述获得单元获得所述用户设备发送的 OPEN指令之 后, 在所述文件打开标识中携带有追加写标识但被转化掉的情况下, 接收所述用户设备发送的 SEEK指令, 所述 SEEK指令中携带有所述 WORM文件的结束位置;
则, 所述获得单元具体用于, 从接收单元接收的 SEEK指令中获 得本次写操作的起始指针位置,所述本次写操作的起始指针位置为所 述 WORM文件的结束位置。
1 4、根据权利要求 8 - 1 3任意一项所述的存储设备, 其特征在于, 还包括写入单元;
所述写入单元,用于在所述判断单元判断所述本次写操作是追加 写之后, 从所述获得单元获得的本次写操作的起始指针位置处, 写入 所述本次写操作的数据。
PCT/CN2014/083042 2013-09-23 2014-07-25 一种worm追加写判断方法及存储设备 WO2015039496A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310436864.3 2013-09-23
CN201310436864.3A CN103500092B (zh) 2013-09-23 2013-09-23 一种worm追加写判断方法及存储设备

Publications (1)

Publication Number Publication Date
WO2015039496A1 true WO2015039496A1 (zh) 2015-03-26

Family

ID=49865307

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/083042 WO2015039496A1 (zh) 2013-09-23 2014-07-25 一种worm追加写判断方法及存储设备

Country Status (2)

Country Link
CN (1) CN103500092B (zh)
WO (1) WO2015039496A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103500092B (zh) * 2013-09-23 2017-01-18 华为技术有限公司 一种worm追加写判断方法及存储设备
CN109492425B (zh) * 2018-09-30 2021-12-28 南京中铁信息工程有限公司 一种在分布式文件系统上的worm一写多读技术应用方法

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1783342A (zh) * 2004-10-29 2006-06-07 国际商业机器公司 用于使用wmrm存储器实现可靠的worm存储器的系统和方法
CN1952869A (zh) * 2005-10-21 2007-04-25 国际商业机器公司 用于将数据写入到存储介质的保护分区的设备、系统和方法
CN101278289A (zh) * 2005-10-05 2008-10-01 国际商业机器公司 提供对象以支持worm存储设备中的数据结构的系统和方法
CN101996237A (zh) * 2010-10-09 2011-03-30 成都市华为赛门铁克科技有限公司 存储区域网络设备的写命令处理方法、设备及系统
CN103500092A (zh) * 2013-09-23 2014-01-08 华为技术有限公司 一种worm追加写判断方法及存储设备

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102779180B (zh) * 2012-06-29 2015-09-09 华为技术有限公司 数据存储系统的操作处理方法,数据存储系统

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1783342A (zh) * 2004-10-29 2006-06-07 国际商业机器公司 用于使用wmrm存储器实现可靠的worm存储器的系统和方法
CN101278289A (zh) * 2005-10-05 2008-10-01 国际商业机器公司 提供对象以支持worm存储设备中的数据结构的系统和方法
CN1952869A (zh) * 2005-10-21 2007-04-25 国际商业机器公司 用于将数据写入到存储介质的保护分区的设备、系统和方法
CN101996237A (zh) * 2010-10-09 2011-03-30 成都市华为赛门铁克科技有限公司 存储区域网络设备的写命令处理方法、设备及系统
CN103500092A (zh) * 2013-09-23 2014-01-08 华为技术有限公司 一种worm追加写判断方法及存储设备

Also Published As

Publication number Publication date
CN103500092A (zh) 2014-01-08
CN103500092B (zh) 2017-01-18

Similar Documents

Publication Publication Date Title
CN109597568B (zh) 一种数据存储方法、装置、终端设备及存储介质
US8996828B2 (en) Systems and methods for migrating data
CN111414334A (zh) 基于云技术的文件分片上传方法、装置、设备及存储介质
WO2015074467A1 (zh) 一种数据更新方法、装置、系统及存储介质
JP5873571B2 (ja) アプリケーション・データを処理するための方法及び計算ノード
US9298592B2 (en) Testing a software interface for a streaming hardware device
WO2019227427A1 (zh) 文件下载方法、装置及设备/终端/服务器
US20140006558A1 (en) Method and device for resuming file download
WO2014180297A1 (zh) 报文处理方法和装置
US20130318262A1 (en) Data Transmission Method and Apparatus
AU2017265064A1 (en) Access to data on a remote device
CN107817962B (zh) 一种远程控制方法、装置、控制服务器及存储介质
WO2015039496A1 (zh) 一种worm追加写判断方法及存储设备
CN113961836A (zh) 页面跳转方法、装置、电子设备及存储介质
CN107862035B (zh) 会议记录的网络读取方法、装置、智能平板和存储介质
CN114296646A (zh) 基于io业务的缓存方法、装置、服务器和存储介质
CN108595270B (zh) 一种内存资源的回收方法及装置
KR101772129B1 (ko) 콘텐츠 무결성을 검증하는 지능형 스토리지 시스템
CN108446144A (zh) 一种应用程序启动方法、装置、终端及存储介质
US20150301764A1 (en) Hard Disk and Methods for Forwarding and Acquiring Data by Hard Disk
US20160055609A1 (en) Graphics processing method, system, and apparatus
WO2014106464A1 (zh) Sd卡和访问sd卡的设备及方法
WO2018113353A1 (zh) 一种软件升级方法及装置
WO2021056910A1 (zh) 一种通信方法、系统、设备及计算机可读存储介质
JP2015072531A (ja) テスト支援方法、テスト支援装置およびプログラム

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: 14846720

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: 14846720

Country of ref document: EP

Kind code of ref document: A1