WO2016065927A1 - 将数据对象写入ip硬盘的方法、装置及系统 - Google Patents

将数据对象写入ip硬盘的方法、装置及系统 Download PDF

Info

Publication number
WO2016065927A1
WO2016065927A1 PCT/CN2015/083780 CN2015083780W WO2016065927A1 WO 2016065927 A1 WO2016065927 A1 WO 2016065927A1 CN 2015083780 W CN2015083780 W CN 2015083780W WO 2016065927 A1 WO2016065927 A1 WO 2016065927A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
key
written
slice
hard disk
Prior art date
Application number
PCT/CN2015/083780
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 WO2016065927A1 publication Critical patent/WO2016065927A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/067Distributed or networked storage systems, e.g. storage area networks [SAN], network attached storage [NAS]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers

Definitions

  • Embodiments of the present invention relate to a storage technology, and in particular, to a method, an apparatus, and a system for writing a data object to an Internet Protocol (IP) hard disk.
  • IP Internet Protocol
  • An IP hard disk is a storage unit whose object is a storage unit.
  • the IP hard disk uses an IP-based protocol to transfer data of an object using a key-value interface.
  • the server uses the data to be written every time as an object to be written, and allocates a corresponding IP hard disk and a key to the object to be written; wherein the key corresponds to the object to be written; the server will a data write request including the object to be written and a key is sent to the IP hard disk; after receiving the data write request sent by the server, the IP hard disk allocates a storage space of the same size as the object to be written to store the to-be-written The object is stored in association with the key and the object to be written.
  • the server treats each data fragment as a to-be-written object, and assigns a one-to-one key to each data fragment.
  • the hard disk needs to store one key separately for multiple data fragments belonging to the same data object. Therefore, when the data fragmentation is small, there is a problem that the IP hard disk storage space utilization is low.
  • the embodiment of the invention provides a method, a device and a system for writing a data object into an IP hard disk, which are used to solve the problem that when a data object is divided into multiple data fragments, the server divides each data. As a target to be written, each data fragment is assigned a one-to-one key.
  • the IP hard disk needs to store one key for each data fragment belonging to the same data object; when the data fragment is small, the IP hard disk storage space Low utilization rate.
  • An embodiment of the present invention provides a method for writing a data object to an IP hard disk, where the method is applied to a storage system, where the storage system includes at least one server and multiple IP hard disks, and the method is performed by a server, and the data is executed by the server.
  • the object includes a number of data fragments, and the method includes:
  • Generating a first data write request including the data slice to be written, a key corresponding to the data slice to be written, and an offset of the data slice to be written ;
  • the embodiment of the present invention further provides a method for writing a data object to an IP hard disk, where the method is performed by the IP hard disk, the data object includes a plurality of data fragments, and the method includes:
  • the data write request includes: a data slice to be written, a key corresponding to the data slice to be written, and an offset, where the key corresponds to the IP hard disk.
  • the offset is used to indicate a size of a data slice that has been written to the IP hard disk;
  • An embodiment of the present invention provides an apparatus for writing a data object to an IP hard disk, where the device is a server, the data object includes a plurality of data fragments, and the device includes:
  • a data fragment determining module to be written configured to determine a data slice to be sent to be sent; wherein the data object includes a plurality of data fragments;
  • a remaining storage capacity determining module configured to query a first key corresponding to the last sent data fragment and a length of the sent data fragment corresponding to the first key, the first key and the first target IP hard disk Corresponding; determining, according to the length of the sent data fragment corresponding to the first key and the storage capacity of the preset key, the remaining storage capacity corresponding to the first key, where the remaining storage capacity corresponding to the first key is equal to The storage capacity of the key minus the length of the sent data fragment corresponding to the first key;
  • a key determining module configured to determine, according to the first key, a key corresponding to the data segment to be written, if the remaining storage capacity corresponding to the first key is greater than or equal to the length of the data fragment to be written. The key corresponding to the data slice to be written is the same as the first key;
  • An offset determining module configured to determine an offset of the data fragment to be written according to a length of the sent data fragment corresponding to the first key
  • a generating module configured to generate a first data write request, where the first data write request includes the data slice to be written, a key corresponding to the data slice to be written, and the data to be written Offset of the slice;
  • a sending module configured to send the first data write request to the first target IP hard disk.
  • the embodiment of the present invention further provides an apparatus for writing a data object to an IP hard disk
  • the device is an IP hard disk
  • the data object includes a plurality of data fragments
  • the device includes:
  • a receiving module configured to receive a data write request sent by the server, where the data write request includes: a data slice to be written, a key corresponding to the data slice to be written, and an offset, the key and the Corresponding to the IP hard disk, the offset is used to indicate the size of the data slice that has been written to the IP hard disk;
  • a processing module configured to determine, according to the key and the offset, that the to-be-written data fragment is stored in a start address of the IP hard disk, and store the data fragment from the to-be-written data in the IP
  • the storage space corresponding to the start address of the hard disk starts to write the data slice to be written.
  • the embodiment of the present invention further provides a system for writing a data object to an IP hard disk, the data object includes a plurality of data fragments, and the system includes: at least one of the foregoing servers and a plurality of the foregoing IP hard disks.
  • the embodiment of the invention provides a method, a device and a system for writing a data object into an IP hard disk.
  • the server queries the first data corresponding to the last sent data fragment.
  • the first key corresponds to the first target IP hard disk; if the remaining storage capacity corresponding to the first key is greater than or equal to the length of the data fragment to be written, determining the key corresponding to the data fragment to be written
  • the first key is the same; the offset of the data fragment to be written is determined according to the length of the sent data fragment corresponding to the first key; and the data fragment to be written is included, first
  • the data write request of the key and the offset of the data slice to be written is sent to the first target IP hard disk; enabling the server to allocate the same key to the plurality of data fragments belonging to the same data object, so as to avoid the IP hard disk needs to be
  • a plurality of data fragments belonging to the same data object respectively store a
  • FIG. 1 is a schematic diagram of an application scenario of a method for writing a data object to an IP hard disk according to the present invention
  • Embodiment 1 is a flowchart of Embodiment 1 of a method for writing a data object to an IP hard disk according to the present invention
  • Embodiment 3 is a flowchart of Embodiment 2 of a method for writing a data object to an IP hard disk according to the present invention
  • Embodiment 4 is a flowchart of Embodiment 3 of a method for writing a data object to an IP hard disk according to the present invention
  • Embodiment 5 is a flowchart of Embodiment 5 of a method for writing a data object to an IP hard disk according to the present invention
  • Embodiment 7 is a flowchart of Embodiment 7 of a method for writing a data object to an IP hard disk according to the present invention
  • Embodiment 7 is a schematic structural diagram of Embodiment 1 of a server according to the present invention.
  • Embodiment 8 is a schematic structural diagram of Embodiment 5 of a server according to the present invention.
  • Embodiment 9 is a schematic structural diagram of Embodiment 1 of an IP hard disk according to the present invention.
  • Embodiment 2 is a schematic structural diagram of Embodiment 2 of an IP hard disk according to the present invention.
  • Embodiment 4 is a schematic structural diagram of Embodiment 4 of an IP hard disk according to the present invention.
  • Embodiment 5 of an IP hard disk according to the present invention.
  • FIG. 13 is a schematic structural diagram of Embodiment 6 of an IP hard disk according to the present invention.
  • FIG. 14 is a schematic structural diagram of Embodiment 8 of an IP hard disk according to the present invention.
  • FIG. 1 is a schematic diagram of an application scenario of a method for writing a data object to an IP hard disk according to the present invention.
  • the server 11 will each data.
  • the fragment is assigned a one-to-one key for each data fragment; the server 11 sends a data write request including a data fragment and a key corresponding to the data fragment to the IP hard disk 12, IP.
  • the hard disk 12 needs to store one key separately for a plurality of data fragments belonging to the same data object; therefore, when the data fragment is small, there is a problem that the storage space utilization of the IP hard disk 12 is low.
  • one server and three IP hard disks are only examples, and any storage system including at least one server and multiple IP hard disks is an application of the method for writing data objects into an IP hard disk by the present invention. Scenes.
  • Embodiment 1 is a flowchart of Embodiment 1 of a method for writing a data object to an IP hard disk according to the present invention.
  • the execution subject is a server.
  • the method in this embodiment may include:
  • Step 201 Determine a data slice to be sent to be sent.
  • the data object can be a file, a block data, or the like.
  • the server may determine the data fragment to be sent according to user input.
  • the user writes 3 KB of data into an existing file; then the 3 KB of data can be considered to be data fragments to be written.
  • Step 202 Query the first key corresponding to the last sent data fragment and the length of the sent data fragment corresponding to the first key, where the first key corresponds to the first target IP hard disk;
  • the data fragment that has been sent last time belongs to the same data object as the data fragment to be written.
  • one key only corresponds to one IP hard disk, and one IP hard disk can correspond to multiple keys.
  • a data object includes 7 data fragments, and the length of data fragment 1 is 4 KB, the length of data fragment 2 is 2 KB, the length of data fragment 3 is 6 KB, and the length of data fragment 4 is 10 KB.
  • the length of slice 5 is 18 KB, the length of data slice 6 is 5 KB, and the length of data slice 7 4KB:
  • the data slice that has been transmitted last time is the data slice 4. Further, when the key corresponding to the data fragment 1 to the data fragment 4 is key1, the length of the transmitted data fragment corresponding to the key1 is 22 KB.
  • the data slice that has been transmitted last time is the data slice 6. Further, when the key corresponding to the data fragment 1 to the data fragment 5 is key1 and the key corresponding to the data fragment 6 is the key 2, the length of the transmitted data fragment corresponding to the key 2 is 5 KB.
  • Step 203 Determine, according to the length of the sent data fragment corresponding to the first key, and the storage capacity of the preset key, the remaining storage capacity corresponding to the first key, and the remaining storage capacity corresponding to the first key Equal to the storage capacity of the key minus the length of the transmitted data fragment corresponding to the first key;
  • the storage capacity of the preset key is 2 MB
  • the length of the transmitted data fragment corresponding to the first key is 1 MB
  • the remaining storage capacity corresponding to the first key is 1 MB.
  • Step 204 If the remaining storage capacity corresponding to the first key is greater than or equal to the length of the data fragment to be written, determine a key corresponding to the data fragment to be written according to the first key, The key corresponding to the data slice to be written is the same as the first key;
  • Step 205 Determine an offset of the data fragment to be written according to a length of the sent data fragment corresponding to the first key.
  • the offset of the data fragment to be written may be 1 MB.
  • Step 206 Generate a first data write request, where the first data write request includes the data slice to be written, the key corresponding to the data slice to be written, and the data slice to be written. Offset;
  • Step 207 Send the first data write request to the first target IP hard disk.
  • the server treats each data fragment as a to-be-written object, and assigns a one-to-one key to each data fragment, and the server goes to the IP.
  • the data write request sent by the hard disk includes the data fragment and the key corresponding to the data fragment.
  • the server queries the first key corresponding to the last transmitted data fragment and the length of the transmitted data fragment corresponding to the first key.
  • the first key corresponds to the first target IP hard disk; if the remaining storage capacity corresponding to the first key If the length of the data fragment to be written is greater than or equal to the length of the data fragment to be written, it is determined that the key corresponding to the data fragment to be written is the same as the first key; according to the sent data fragment corresponding to the first key Determining an offset of the data slice to be written; and transmitting a data write request including an offset of the data slice to be written, the first key, and the data slice to be written to the first Target IP hard disk.
  • the server assigns each data fragment as a to-be-written object, and assigns a one-to-one key to each data fragment.
  • the data write request sent by the IP hard disk includes the data fragment and the key corresponding to the data fragment; the IP hard disk needs to store one key for each data fragment belonging to the same data object; since the storage key needs to occupy a few KB to The size of the storage space of tens of KB, when the data fragmentation is small, the storage space occupied by the storage key cannot be ignored; and since the plurality of data fragments correspond to different parts of the same data object, it is not necessary for the multiple The data fragments respectively store a key; therefore, there is a problem that the storage capacity of the IP hard disk is low.
  • the server queries the first key corresponding to the last transmitted data fragment and the length of the transmitted data fragment corresponding to the first key.
  • the first key corresponds to the first target IP hard disk; if the remaining storage capacity corresponding to the first key is greater than or equal to the length of the data segment to be written, determining that the data segment to be written corresponds to The key is the same as the first key; the offset of the data fragment to be written is determined according to the length of the sent data fragment corresponding to the first key; and the data fragment to be written is included,
  • the first key and the data write request of the offset of the data slice to be written are sent to the first target IP hard disk; enabling the server to allocate the same key to the plurality of data fragments belonging to the same data object, thereby avoiding the IP hard disk You need to store a key for each data fragment that belongs to the same data object, which reduces the storage space occupied by the IP hard disk storage key and improves the storage space utilization of the IP hard
  • Embodiment 3 is a flowchart of Embodiment 2 of a method for writing a data object to an IP hard disk according to the present invention.
  • the execution subject is a server.
  • the method may further include:
  • Step 301 Determine whether the last transmitted data fragment is a data fragment that is first written to the data object.
  • Step 302 If the last data fragment that has been sent is a data fragment that is first written to the data object, assign the corresponding first key to the most recently sent data fragment.
  • the server may obtain the first key by using a hash algorithm according to the content of the last sent data fragment.
  • Step 303 Generate a second data write request, where the second data write request includes the data fragment of the last sent data, the first key, and the partiality of the last transmitted data fragment. a shift amount; wherein the offset of the last transmitted data fragment is equal to 0;
  • the offset is equal to 0, that is, the IP hard disk is instructed to store the last transmitted data fragment from the starting position of the storage space corresponding to the first key.
  • Step 304 Send the second data write request to the first target IP hard disk.
  • the server when the server determines that the data fragment that has been sent last time is the data fragment for which the data object is first written, the corresponding key and the target IP hard disk are allocated for the last transmitted data fragment, and Sending a data write request including the key, the last sent data fragment, and the offset 0 to the IP hard disk; enabling the server to allocate the key and the IP hard disk when the data object is first written; When the user writes the data object later, the server can determine the key and the IP hard disk corresponding to the data fragment to be written according to the assigned key and the IP hard disk.
  • the target IP hard disk is IP.
  • the key corresponding to the data slice to be written is also key1
  • the data write request corresponding to the data slice to be written is also sent to the IP hard disk 1.
  • FIG. 4 is a flowchart of a third embodiment of a method for writing a data object to an IP hard disk according to the present invention.
  • the execution subject is a server.
  • the method in this embodiment may include:
  • Step 401 Determine a data slice to be sent to be sent.
  • Step 402 Query the first key corresponding to the last sent data fragment and the length of the sent data fragment corresponding to the first key, where the first key corresponds to the first target IP hard disk;
  • step 402 is the same as step 202, and details are not described herein again.
  • Step 403 Determine, according to the length of the sent data fragment corresponding to the first key, and the storage capacity of the preset key, the remaining storage capacity corresponding to the first key, and the remaining storage capacity corresponding to the first key Equal to the storage capacity of the key minus the length of the transmitted data fragment corresponding to the first key;
  • step 403 is the same as step 203, and details are not described herein again.
  • Step 404 If the remaining storage capacity corresponding to the first key is smaller than the length of the data fragment to be written, the data to be written is fragmented according to the remaining storage capacity corresponding to the first key. Dividing into a first sub-segment and a second sub-slice; wherein the length of the first sub-slice is equal to the remaining storage capacity corresponding to the first key;
  • the remaining storage capacity corresponding to the first key is 1 MB
  • the length of the data fragment to be written is 1.5 MB
  • the storage capacity of the preset key is 1 MB
  • the first 1 MB of the data fragment to be written is taken as the first One sub-slice
  • the last 0.5 MB of the data slice to be written is used as the second sub-slice.
  • the remaining storage capacity corresponding to the first key is 0.5 MB
  • the length of the data fragment to be written is 2 MB
  • the storage capacity of the preset key is 1 MB
  • Step 405 Determine a key corresponding to the first sub-segment according to the first key, where a key corresponding to the first sub-slice is the same as the first key;
  • the key corresponding to the first sub-slice is the same as the key corresponding to the last transmitted data fragment.
  • Step 406 Determine an offset of the first sub-slice according to a length of the sent data fragment corresponding to the first key.
  • Step 407 Generate a first sub-data write request, where the first sub-data write request includes an offset of the first sub-slice, the first key, and the first sub-slice;
  • Step 408 Send a first sub-data write request to the first target IP hard disk
  • Step 409 Allocating a corresponding second key to the second sub-segment, and allocating a corresponding second target IP hard disk to the second key;
  • the server may obtain the first key by using a hash algorithm according to content of the second sub-shard.
  • the second sub-slice is sent to the second target IP hard disk for storage, so that Multiple data fragments of the same data object can be stored on the basis of the same key stored on one IP hard disk, and other data fragments can be stored to another IP hard disk corresponding to another key; so that the server reads the data.
  • Data objects can be read simultaneously from multiple IP hard disks; thus, based on improving the storage space utilization of the IP hard disk, the server also reads the data. The efficiency of the object.
  • Step 410 Generate a second sub-data write request, where the second sub-data write request includes the second sub-slice, the second key corresponding to the second sub-segment, and the second sub-slice Offset; wherein the offset of the second sub-slice is equal to 0;
  • Step 411 Send a second sub-data write request to the second target IP hard disk.
  • the server divides the data segment to be written into the first sub-slice and the second sub-slice according to the remaining storage capacity corresponding to the first key; and determines the key and the first sub-slice corresponding to the first sub-slice A key is the same, and a new key is assigned to the second sub-slice; so that when the remaining storage capacity corresponding to the first key is less than the length of the data fragment to be written, the server can split the data fragment to be written, and Send to the corresponding IP hard disk for storage.
  • the method further includes: generating a data read request, where the data read request includes a key and an offset; Sending the data read request to the first target IP hard disk.
  • the data read request may further include a size of the data to be read.
  • the key included in the data read request is the key assigned by the server, for example, the first key in the first embodiment of the method; the offset position included in the data read request may be 0 to the preset key. Any positive integer between the storage capacities.
  • the data read request including the key and the offset is sent to the IP hard disk, so that after the server sends the data to the IP hard disk storage, the server can specify the corresponding key and the offset to implement the key corresponding to the key. Flexible reading of data in the storage space.
  • FIG. 5 is a flowchart of Embodiment 5 of a method for writing a data object to an IP hard disk according to the present invention.
  • the execution body is an IP hard disk.
  • the method in this embodiment may include:
  • Step 501 Receive a data write request sent by the server, where the data write request includes: a data slice to be written, a key corresponding to the data slice to be written, and an offset, the key and the IP Corresponding to the hard disk, the offset is used to indicate the size of the data slice that has been written to the IP hard disk;
  • the data fragment 1 has a length of 4 KB
  • the data The length of the slice 2 is 2 KB
  • the length of the data slice 3 is 6 KB
  • the data slice to be written is the data slice 3
  • the data slice 1, the data slice 2, and the data slice 3 are all written to the IP hard disk 1
  • the offset is 6KB.
  • Step 502 Determine, according to the key and the offset, that the to-be-written data fragment is stored in a start address of the IP hard disk, and store the data fragment to be written in the IP hard disk from the IP hard disk.
  • the storage space corresponding to the start address starts to write the data slice to be written.
  • the data slice to be written is stored in the start address of the IP hard disk. Is 0x400.
  • the IP hard disk receives the data write request including the key and the data slice to be written by the server, and allocates and writes the data to be divided.
  • the storage space of the same size is stored in the storage space to be written, and the key is stored in association with the data fragment to be written, so that the server can obtain the data to be written according to the key when performing data reading. Fragmentation.
  • the IP hard disk receiving server sends a data write request including a data slice to be written, a key, and an offset value, according to the key and the Determining that the data segment to be written is stored in a start address of the IP hard disk, and starting to write from the storage space corresponding to the start address of the IP hard disk to be written data fragment Enter the data slice to be written.
  • the IP hard disk when a data object is divided into a plurality of data fragments, the IP hard disk receives and writes the data to be written after the IP hard disk receives the data write request including the key and the data slice to be written by the server.
  • the storage space with the same fragment size stores the data fragment to be written, and stores the key and the data fragment to be written in association; therefore, the IP hard disk needs to separately store multiple data fragments belonging to the same data object.
  • a key because the storage key needs to occupy a few KB to tens of KB of storage space size, when the data fragmentation is small, the size of the storage space occupied by the storage key can not be ignored; and because the multiple data fragments correspond to the same Different parts of the data object do not need to correspond to different keys for the plurality of data fragments; therefore, there is a problem that the utilization of the IP hard disk storage space is low.
  • the data write request including the data slice to be written, the key, and the offset value sent by the IP hard disk receiving server is received, according to the key and Determining, by the offset, that the data slice to be written is stored at a starting address of the IP hard disk, And writing the to-be-written data slice from the storage space corresponding to the start address of the IP hard disk to be written into the data slice; so that the IP hard disk can be included in the data write request according to the server
  • the offset value is used to store multiple data fragments in a storage space corresponding to a key; so that multiple data fragments can correspond to the same key in the IP hard disk, which reduces the storage space occupied by the IP hard disk storage key and improves the size.
  • the storage space utilization of the IP hard disk is used to store multiple data fragments in a storage space corresponding to a key; so that multiple data fragments can correspond to the same key in the IP hard disk, which reduces the storage space occupied by the IP hard disk storage key and improves the size.
  • the method may further include: receiving a data read request sent by the server, where the data read request includes the key and an offset; The offset reads the data and feeds the read data back to the server.
  • the data read request may further include a size of the data to be read.
  • the key included in the data read request is a key stored in the IP hard disk, for example, the key in the fifth embodiment; the offset position included in the data read request may be 0 to a preset key. Any positive integer between the storage capacities.
  • the IP hard disk receives a data read request sent by the server, and the data read request includes a key; the IP hard disk reads the data according to the key, and feeds the read data to the server.
  • the IP hard disk receives a data read request sent by the server, the data read request includes a key and an offset; the IP hard disk reads data according to the key and the offset, and reads the read data. Data is fed back to the server.
  • the IP hard disk After the IP hard disk receives the data write request sent by the server, including the key and the data fragment to be written, the key is associated with the data to be written and stored; when the IP hard disk receives the server When the data read request including the key is sent, the IP hard disk acquires corresponding data according to the key (that is, the data slice to be written in the data write request) and feeds back to the server; therefore, when a data object is divided When writing multiple data fragments, the server needs to perform a read operation on each key corresponding to each data fragment, so that the data fragment corresponding to the key can be obtained, and the operation is complicated;
  • the IP hard disk after the IP hard disk stores the same key for the plurality of data fragments, the IP hard disk receives the data read request including the key and the offset sent by the server, and the IP hard disk according to the key and the partial The data is read by the shift amount, and the read data is fed back to the server; when the data object is divided into a plurality of data fragments, the server can realize the fragmentation of each data by setting the corresponding offset. Flexible reading and easy operation.
  • the storage capacity corresponding to the key is equal to the preset length L of M times, where M is a positive integer.
  • the storage capacity corresponding to the key is 2 MB and the preset length L is 64 KB, then M is equal to 32. That is, the storage capacity corresponding to the key is divided into 32 segments.
  • FIG. 6 is a flowchart of Embodiment 7 of the method for writing a data object to an IP hard disk according to the present invention. As shown in FIG. 6, step 502 may include:
  • Step 601 Determine, according to the offset and the preset length L, that the data to be written is sliced and stored in an Nth segment storage space in a storage space corresponding to the key; and according to the offset The quantity, N, and the preset length L, determining a remaining storage capacity of the Nth segment storage space;
  • N is a positive integer and M is greater than N;
  • the storage capacity corresponding to the key is 2 MB, and the preset length L is 64 KB, then M is equal to 32. Further, if the offset is 1 MB, N is equal to 17 (that is, the data to be written needs to be sliced. Storing to the 17th segment storage space in the storage space corresponding to the key); further, according to the offset 1MB, N equal to 17 and the preset length L being 2MB, the remaining of the 17th storage space can be determined The storage capacity is 64KB.
  • Step 602 Determine whether the length of the data fragment to be written is greater than the remaining storage capacity of the Nth storage space
  • step 603 If yes, go to step 603; otherwise, go to step 606.
  • Step 603 The data segment to be written is sequentially split into a first sub-slice and a second sub-slice according to the remaining storage capacity of the N-th storage space and a preset length L.
  • the length of the first sub-slice is equal to the remaining storage capacity of the N-th storage space; the length of the second sub-slice is less than or equal to the preset length L;
  • the remaining storage capacity of the Nth storage space is 32 KB
  • the preset length L is 64 KB
  • the size of the data fragment to be written is 94 KB
  • the first 32 KB of the data fragment to be written is taken as the first Sub-slice
  • 62KB after the data to be written is sliced as the second sub-slice.
  • the remaining storage capacity of the Nth storage space is 32 KB
  • the preset length L is 64 KB
  • the size of the data fragment to be written is 120 KB
  • the first 32 KB of the data fragment to be written is taken as the first A sub-segment
  • the middle 64 KB of the data slice to be written is used as the second sub-slice
  • the last 24 KB of the data-segment to be written is the third sub-slice.
  • Step 604 determining that the first sub-segment is stored in a starting address of the IP hard disk as a starting address of a remaining storage capacity of the N-th segment storage space, and remaining storage from the N-th segment storage space The storage space corresponding to the starting address of the capacity starts to be written into the first sub-slice;
  • determining a starting address of the remaining storage capacity of the Nth segment storage space may be: determining, according to the remaining storage capacity of the Nth segment storage space and a preset length L, the Nth segment storage The size of the stored data of the space; determining the start of the remaining storage capacity of the Nth storage space according to the size of the stored data of the Nth storage space and the first address of the storage space of the Nth segment address.
  • Step 605 Allocate the storage space of the (N+1)th segment, and associate the first address of the (N+1)th storage space with the key value, where the size of the (N+1)th storage space is equal to Determining a preset length L; determining that a start address of the second sub-segment stored in the IP hard disk is a first address of the (N+1)th storage space, and from the (N+1)th storage space The storage space corresponding to the first address begins to be written into the second sub-slice;
  • step 605 it ends.
  • Step 606 determining that the starting address of the data hard disk to be written in the IP hard disk is the starting address of the remaining storage capacity of the Nth segment storage space, and the remaining space from the Nth segment storage space The storage space corresponding to the start address of the storage capacity starts to be written into the data slice to be written.
  • the storage capacity corresponding to the key is divided into M segments by the IP hard disk.
  • the method may further include: receiving a data read request sent by the server, where the data read request includes the key and an offset; according to the offset
  • the quantity and the preset length L are determined to start data reading from the data of the Nth segment storage space in the storage space corresponding to the key; according to the association between the key and the first address of each segment storage space a relationship, determining a first address of the Nth segment storage space; determining, according to the offset, the first address of the Nth segment storage space, a starting address of the data to be read; reading according to the requirement The starting address of the data reads the data and feeds the read data back to the server.
  • the data read request may further include a size of the data to be read.
  • the key included in the data read request is a key that has been stored in the IP hard disk, for example, the key in the fifth embodiment; the offset position included in the data read request may be 0 to a preset key. Any positive integer between storage capacities.
  • the IP hard disk after the IP hard disk stores the same key for the plurality of data fragments, the IP hard disk receives the data read request of the key and the offset sent by the server; according to the offset and the preset Length L, determining that data needs to be read from the data of the Nth segment storage space in the storage space corresponding to the key; and determining the Nth segment according to the association relationship between the key and the first address of each segment storage space a first address of the storage space; determining, according to the offset and the first address of the Nth segment of the storage space, a starting address of the data to be read; reading the data according to the starting address of the data to be read, and The read data is fed back to the server; so that when a data object is divided into a plurality of data fragments, the server can realize flexible reading of each data slice by setting a corresponding offset. easy to use.
  • FIG. 7 is a schematic structural diagram of Embodiment 1 of the server of the present invention.
  • the server in this embodiment may include: a data fragmentation determining module 701 to be written, a remaining storage capacity determining module 702, a key determining module 703, and a partial The shift determination module 704, the generation module 705, and the transmission module 706.
  • the data fragmentation determining module 701 is configured to determine a data fragment to be written to be sent.
  • the data object includes a plurality of data fragments.
  • the remaining storage capacity determining module 702 is configured to query the last sent data.
  • the remaining storage capacity corresponding to the first key is determined by the length of the data fragment and the storage capacity of the preset key, and the remaining storage capacity corresponding to the first key is equal to the storage capacity of the key minus the first key.
  • the length of the corresponding sent data fragment; the key determining module 703 is configured to: if the remaining storage capacity corresponding to the first key is greater than or equal to the length of the data fragment to be written, according to the first key Determining a key corresponding to the to-be-written data fragment, the key corresponding to the to-be-written data fragment is the same as the first key, and the offset determining module 704 is configured to: Sent data segmentation Determining an offset of the data slice to be written; a generating module 705, configured to generate a first data write request, where the first data write request includes the data slice to be written, and the to-be-written Write the key corresponding to the data fragment and the number to be written
  • the sending module 706 is configured to send the first data write request to the first target IP hard disk.
  • the server of this embodiment may be used to implement the technical solution of the method embodiment shown in FIG. 2, and the implementation principle and technical effects are similar, and details are not described herein again.
  • the key determining module 703 is further configured to: determine whether the data fragment that has been sent last time is a data fragment that is first written to the data object. If yes, assigning the corresponding first key and the first target IP hard disk to the most recently sent data fragment;
  • the generating module 705 is further configured to: generate a second data write request, where the second data write request includes the last sent data fragment, the first key, and the last time The offset of the transmitted data fragment; wherein the offset of the last transmitted data fragment is equal to 0;
  • the sending module 706 is further configured to: send the second data write request to the first target IP hard disk.
  • the server of this embodiment may be used to implement the technical solution of the method embodiment shown in FIG. 3, and the implementation principle and the technical effect are similar, and details are not described herein again.
  • the key determining module 703 is further configured to:
  • the offset determining module 704 is specifically configured to: send the corresponding corresponding to the first key The length of the sent data fragment determines an offset of the first sub-slice;
  • the generating module 705 is specifically configured to: generate a first sub-data write request, where the first sub-data write request includes the first sub-slice, the first key, and the first sub-segment Transmitting; generating a second sub-data write request, the second sub-data write request including the second sub-slice, the second key corresponding to the second sub-slice, and the second sub-slice Offset; wherein the offset of the second sub-slice is equal to 0;
  • the sending module 706 is specifically configured to: send a first sub-data write request to the first target IP hard disk; and send a second sub-data write request to the second target IP hard disk.
  • the server of this embodiment may be used to implement the technical solution of the method embodiment shown in FIG. 4, and the implementation principle and technical effects are similar, and details are not described herein again.
  • the generating module 705 is further configured to: generate a data read request, where the data read request includes a key and
  • the sending module 706 is further configured to: send the data read request to the first target IP hard disk.
  • the server of this embodiment may be used to perform the technical solution of the fourth embodiment of the method for writing the data object to the IP hard disk.
  • the implementation principle and technical effects are similar, and details are not described herein again.
  • FIG 8 is a schematic structural diagram of Embodiment 5 of the server of the present invention.
  • the server of this embodiment may include: a processor 801 and a transmitter 802;
  • the processor 801 is configured to: determine a data fragment to be sent to be sent;
  • Generating a first data write request including the data slice to be written, a key corresponding to the data slice to be written, and an offset of the data slice to be written ;
  • the transmitter 802 is configured to: send the first data write request to the first target IP hard disk.
  • the server of this embodiment may be used to implement the technical solution of the method embodiment shown in FIG. 2, and the implementation principle and technical effects are similar, and details are not described herein again.
  • the processor 801 is further configured to:
  • the second data write request including an offset of the last transmitted data slice, the first key, and the most recently transmitted data slice; Wherein the offset of the last transmitted data fragment is equal to 0;
  • the transmitter 802 is further configured to: send the second data write request to the first target IP hard disk.
  • the server of this embodiment may be used to implement the technical solution of the method embodiment shown in FIG. 3, and the implementation principle and the technical effect are similar, and details are not described herein again.
  • the processor 801 is further configured to:
  • Generating a first sub-data write request where the first sub-data write request includes an offset of the first sub-slice, the first key, and the first sub-slice; generating a second sub-data a write request, the second sub-data write request includes an offset of the second sub-slice, the second key corresponding to the second sub-slice, and the second sub-slice;
  • the offset of the second sub-slice is equal to 0;
  • the transmitter 802 is specifically configured to: send a first sub-data write request to the first target IP hard disk; and send a second sub-data write request to the second target IP hard disk.
  • the server of this embodiment may be used to implement the technical solution of the method embodiment shown in FIG. 4, and the implementation principle and technical effects are similar, and details are not described herein again.
  • the processor 801 is further configured to: generate a data read request, where the data read request includes a key and The offset 802 is further configured to: send the data read request to the first target IP hard disk.
  • the server of this embodiment may be used to perform the technical solution of the fourth embodiment of the method for writing the data object to the IP hard disk.
  • the implementation principle and technical effects are similar, and details are not described herein again.
  • FIG. 9 is a schematic structural diagram of Embodiment 1 of an IP hard disk according to the present invention.
  • the IP hard disk of this embodiment may include: a receiving module 901 and a processing module 902.
  • the receiving module 901 is configured to receive a data write request sent by the server, where the data write request includes: a data slice to be written, a key corresponding to the data slice to be written, and an offset,
  • the key is associated with the IP hard disk
  • the offset is used to indicate the size of the data fragment that has been written to the IP hard disk
  • the processing module 902 is configured to determine the to-before according to the key and the offset.
  • the write data slice is stored in the start address of the IP hard disk, and the data to be written is written from the storage space corresponding to the start address of the IP hard disk to be written. sheet.
  • the IP hard disk of this embodiment may be used to implement the technical solution of the method embodiment shown in FIG. 5, and the implementation principle and technical effects are similar, and details are not described herein again.
  • FIG. 10 is a schematic structural diagram of Embodiment 2 of an IP hard disk according to the present invention.
  • the IP hard disk of this embodiment is based on the IP hard disk structure shown in FIG. 9, and further includes: Send module 903.
  • the receiving module 901 is further configured to: receive a data read request sent by the server, where the data read request includes the key and an offset; and the processing module 902 is further configured to: according to the key and the offset The data is read; the first sending module 903 is configured to feed back data read by the processing module 902 to the server.
  • the IP hard disk of this embodiment can be used to perform the technical solution of the sixth embodiment of the method for writing a data object to the IP hard disk.
  • the implementation principle and technical effects are similar, and details are not described herein again.
  • the storage capacity corresponding to the key is equal to a preset length L of M times, where M is a positive integer;
  • processing module 902 is specifically configured to:
  • the data segment to be written is sequentially split into the first sub-slice and the second sub-segment according to the remaining storage capacity of the N-th storage space and the preset length L;
  • the length of the first sub-slice is equal to the remaining storage capacity of the N-th storage space;
  • the length of the second sub-slice is less than or equal to the preset length L;
  • a starting address of the first sub-segment stored in the IP hard disk is a starting address of a remaining storage capacity of the N-th segment storage space, and starting from a remaining storage capacity of the N-th segment storage space
  • the storage space corresponding to the start address begins to be written into the first sub-slice
  • the storage space of the (N+1)th segment is allocated, and the first address of the (N+1)th storage space is associated with the key value, where the size of the (N+1)th storage space is equal to the preset Length L; determining that the second sub-slice is stored in the IP hard disk, the starting address is the first address of the (N+1)th storage space, and the first address from the (N+1)th storage space Corresponding storage space begins to be written into the second sub-slice;
  • the starting address of the to-be-written data fragment stored in the IP hard disk is the starting address of the remaining storage capacity of the Nth segment storage space, and the remaining space from the Nth segment storage space The storage space corresponding to the start address of the storage capacity starts to be written into the data slice to be written.
  • the IP hard disk of this embodiment can be used to implement the technical solution of the method embodiment shown in FIG. 6.
  • the implementation principle and technical effects are similar, and details are not described herein again.
  • FIG. 11 is a schematic structural diagram of Embodiment 4 of an IP hard disk according to the present invention.
  • the IP hard disk of this embodiment is based on the IP hard disk structure shown in FIG. 9, and further includes: a second sending module 904.
  • the receiving module 901 is further configured to: receive a data read request sent by the server, where the data read request includes the key and the offset; and the processing module 902 is further configured to: according to the offset and the Determining the length L, determining that data needs to be read from the data of the Nth segment of the storage space corresponding to the key, and performing data reading according to the relationship between the key and the first address of each segment of the storage space.
  • the second sending module 904 is configured to feed back data read by the processing module 902 to the server.
  • the IP hard disk of this embodiment can be used to perform the technical solution of the method for writing the data object into the IP hard disk.
  • the implementation principle and technical effects are similar, and details are not described herein again.
  • FIG. 12 is a schematic structural diagram of Embodiment 5 of an IP hard disk according to the present invention.
  • the IP hard disk of this embodiment may include: a receiver 1201 and a processor 1202.
  • the receiver 1201 is configured to receive a data write request sent by the server, where the data write request includes: a data slice to be written, a key corresponding to the data slice to be written, and an offset, a key corresponding to the IP hard disk, the offset is used to indicate a size of a data slice that has been written to the IP hard disk
  • the processor 1202 is configured to determine the to-be-set according to the key and the offset
  • the write data slice is stored in the start address of the IP hard disk, and the data to be written is written from the storage space corresponding to the start address of the IP hard disk to be written. sheet.
  • the IP hard disk of this embodiment may be used to implement the technical solution of the method embodiment shown in FIG. 5, and the implementation principle and technical effects are similar, and details are not described herein again.
  • FIG. 13 is a schematic structural diagram of Embodiment 6 of an IP hard disk according to the present invention.
  • the IP hard disk of this embodiment is based on the IP hard disk structure shown in FIG. 12, and further includes: a first transmitter 1203. .
  • the receiver 1201 is further configured to: receive a data read request sent by the server, where the data read request includes the key and the offset; the processor 1202 is further configured to: according to the key and the offset Reading data; the first transmitter 1203 is configured to read by the processor 1202 Data is fed back to the server.
  • the IP hard disk of this embodiment can be used to perform the technical solution of the sixth embodiment of the method for writing a data object to the IP hard disk.
  • the implementation principle and technical effects are similar, and details are not described herein again.
  • the storage capacity corresponding to the key is equal to a preset length L of M times, where M is a positive integer;
  • processor 1202 is specifically configured to:
  • the data segment to be written is sequentially split into the first sub-slice and the second sub-segment according to the remaining storage capacity of the N-th storage space and the preset length L;
  • the length of the first sub-slice is equal to the remaining storage capacity of the N-th storage space;
  • the length of the second sub-slice is less than or equal to the preset length L;
  • a starting address of the first sub-segment stored in the IP hard disk is a starting address of a remaining storage capacity of the N-th segment storage space, and starting from a remaining storage capacity of the N-th segment storage space
  • the storage space corresponding to the start address begins to be written into the first sub-slice
  • the storage space of the (N+1)th segment is allocated, and the first address of the (N+1)th storage space is associated with the key value, where the size of the (N+1)th storage space is equal to the preset Length L; determining that the second sub-slice is stored in the IP hard disk, the starting address is the first address of the (N+1)th storage space, and the first address from the (N+1)th storage space Corresponding storage space begins to be written into the second sub-slice;
  • the starting address of the to-be-written data fragment stored in the IP hard disk is the starting address of the remaining storage capacity of the Nth segment storage space, and the remaining storage from the Nth segment storage space The storage space corresponding to the start address of the capacity starts to write the data slice to be written.
  • the IP hard disk of this embodiment can be used to implement the technical solution of the method embodiment shown in FIG. 6.
  • the implementation principle and technical effects are similar, and details are not described herein again.
  • the IP hard disk of this embodiment is based on the IP hard disk structure shown in FIG. 12, and further includes: a second transmitter 1204.
  • the receiver 1201 is further configured to: receive a data read request sent by the server, where the data read request includes the key and an offset;
  • the processor 1202 is further configured to: according to the offset and the Determining the length L, determining that data needs to be read from the data of the Nth segment of the storage space corresponding to the key, and performing data reading according to the relationship between the key and the first address of each segment of the storage space.
  • the second transmitter 1204 is configured to feed back data read by the processor 1202 to the server.
  • the IP hard disk of this embodiment can be used to perform the technical solution of the method for writing the data object into the IP hard disk.
  • the implementation principle and technical effects are similar, and details are not described herein again.
  • the present invention also provides a system for writing a data object to an Internet Protocol IP hard disk, the data object comprising a plurality of data fragments, the system comprising: server embodiment 1, embodiment 2, embodiment 3, or embodiment The server described in the fourth embodiment, and the IP hard disk described in the first embodiment, the second embodiment, the third embodiment, or the fourth embodiment of the IP hard disk.
  • the aforementioned program can be stored in a computer readable storage medium.
  • the program when executed, performs the steps including the foregoing method embodiments; and the foregoing storage medium includes various media 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)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

一种将数据对象写入IP硬盘的方法、装置及系统。当数据对象分为若干个数据分片写入时,服务器(11)通过查询最近一次已发送的数据分片对应的第一key和第一key对应的已发送的数据分片的长度,第一key与第一目标IP硬盘(12)对应;若第一key对应的剩余存储容量大于或等于待写入数据分片的长度,则确定待写入数据分片对应的key与第一key相同;根据第一key对应的已发送的数据分片的长度确定待写入数据分片的偏移量;并将包括待写入数据分片、第一key及待写入数据分片的偏移量的数据写入请求发送至第一目标IP硬盘(12);使得服务器(11)能够对属于同一数据对象的多个数据分片分配同一key,提高了IP硬盘的存储空间利用率。

Description

将数据对象写入IP硬盘的方法、装置及系统
本申请要求于2014年10月30日提交中国专利局、申请号为201410606549.5、发明名称为“将数据对象写入IP硬盘的方法、装置及系统”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明实施例涉及存储技术,尤其涉及一种将数据对象写入互联网协议(IP,Internet Protocol)硬盘的方法、装置及系统。
背景技术
IP硬盘是以对象为存储单位的存储单元,IP硬盘通过IP协议,使用键-值(key-value)接口进行对象的数据传输。
现有技术中,服务器将每一次需要写入的数据都作为一个待写入对象,为该待写入对象分配对应的IP硬盘及key;其中,key与待写入对象一一对应;服务器将包括该待写入对象、key的数据写入请求发送至该IP硬盘;IP硬盘接收到服务器发送的数据写入请求后,分配与该待写入对象的大小相同的存储空间存储该待写入对象,并将key和该待写入对象进行关联存储,从而完成一次数据写入。
但是,现有技术中,当一数据对象分为多个数据分片写入时,服务器将每一数据分片作为一待写入对象,为每一数据分片分配一一对应的key,IP硬盘对属于同一数据对象的多个数据分片需要分别存储一个key;因此,当数据分片较小时,存在IP硬盘存储空间利用率低的问题。
发明内容
本发明实施例提供一种将数据对象写入IP硬盘的方法、装置及系统,用以解决现有技术中当一数据对象分为多个数据分片写入时,服务器将每一数据分片作为一待写入对象,为每一数据分片分配一一对应的key,IP硬盘对属于同一数据对象的多个数据分片需要分别存储一个key;当数据分片较小时,IP硬盘存储空间利用率低的问题。
本发明实施例提供一种将数据对象写入IP硬盘的方法,所述方法应用于存储系统中,所述存储系统包括至少一个服务器和多个IP硬盘,所述方法由服务器执行,所述数据对象包括若干个数据分片,所述方法包括:
确定待发送的待写入数据分片;
查询最近一次已发送的数据分片对应的第一key和所述第一key对应的已发送的数据分片的长度,所述第一key与第一目标IP硬盘对应;
根据所述第一key对应的已发送的数据分片的长度及预设的key的存储容量,确定所述第一key对应的剩余存储容量,所述第一key对应的剩余存储容量等于所述key的存储容量减去所述第一key对应的已发送的数据分片的长度;
若所述第一key对应的剩余存储容量大于或等于所述待写入数据分片的长度,则根据所述第一key确定所述待写入数据分片对应的key,所述待写入数据分片对应的key与所述第一key相同;
根据所述第一key对应的已发送的数据分片的长度确定所述待写入数据分片的偏移量;
生成第一数据写入请求,所述第一数据写入请求包括所述待写入数据分片、所述待写入数据分片对应的key以及所述待写入数据分片的偏移量;
将所述第一数据写入请求发送给所述第一目标IP硬盘。
本发明实施例还提供一种将数据对象写入IP硬盘的方法,所述方法由所述IP硬盘执行,所述数据对象包括若干个数据分片,所述方法包括:
接收服务器发送的数据写入请求,所述数据写入请求包括:待写入数据分片,所述待写入数据分片对应的key以及偏移量,所述key与所述IP硬盘对应,所述偏移量用于指示已写入所述IP硬盘的数据分片的大小;
根据所述key和所述偏移量确定所述待写入数据分片存储在所述IP硬盘的起始地址,并从所述待写入数据分片存储在所述IP硬盘的起始地址对应的存储空间开始写入所述待写入数据分片。
本发明实施例提供一种将数据对象写入IP硬盘的装置,所述装置为服务器,所述数据对象包括若干个数据分片,所述装置包括:
待写入数据分片确定模块,用于确定待发送的待写入数据分片;其中,数据对象包括若干个数据分片;
剩余存储容量确定模块,用于查询最近一次已发送的数据分片对应的第一key和所述第一key对应的已发送的数据分片的长度,所述第一key与第一目标IP硬盘对应;根据所述第一key对应的已发送的数据分片的长度及预设的key的存储容量,确定所述第一key对应的剩余存储容量,所述第一key对应的剩余存储容量等于所述key的存储容量减去所述第一key对应的已发送的数据分片的长度;
key确定模块,用于若所述第一key对应的剩余存储容量大于或等于所述待写入数据分片的长度,则根据所述第一key确定所述待写入数据分片对应的key,所述待写入数据分片对应的key与所述第一key相同;
偏移量确定模块,用于根据所述第一key对应的已发送的数据分片的长度确定所述待写入数据分片的偏移量;
生成模块,用于生成第一数据写入请求,所述第一数据写入请求包括所述待写入数据分片、所述待写入数据分片对应的key以及所述待写入数据分片的偏移量;
发送模块,用于将所述第一数据写入请求发送给所述第一目标IP硬盘。
本发明实施例还提供一种将数据对象写入IP硬盘的装置,所述装置为IP硬盘,所述数据对象包括若干个数据分片,所述装置包括:
接收模块,用于接收服务器发送的数据写入请求,所述数据写入请求包括:待写入数据分片,所述待写入数据分片对应的key以及偏移量,所述key与所述IP硬盘对应,所述偏移量用于指示已写入所述IP硬盘的数据分片的大小;
处理模块,用于根据所述key和所述偏移量确定所述待写入数据分片存储在所述IP硬盘的起始地址,并从所述待写入数据分片存储在所述IP硬盘的起始地址对应的存储空间开始写入所述待写入数据分片。
本发明实施例还提供一种将数据对象写入IP硬盘的系统,所述数据对象包括若干个数据分片,所述系统包括:至少一个上述的服务器和多个上述的IP硬盘。
本发明实施例提供一种将数据对象写入IP硬盘的方法、装置及系统,当数据对象分为若干个数据分片写入时,服务器通过查询最近一次已发送的数据分片对应的第一key和所述第一key对应的已发送的数据分片的长度,所 述第一key与第一目标IP硬盘对应;若所述第一key对应的剩余存储容量大于或等于所述待写入数据分片的长度,则确定所述待写入数据分片对应的key与所述第一key相同;根据所述第一key对应的已发送的数据分片的长度确定所述待写入数据分片的偏移量;并将包括待写入数据分片、第一key及所述待写入数据分片的偏移量的数据写入请求发送至第一目标IP硬盘;使得服务器能够对属于同一数据对象的多个数据分片分配同一key,避免IP硬盘需要对属于同一数据对象的多个数据分片分别存储一个key,减少了IP硬盘存储key所占用的存储空间的大小,提高了IP硬盘的存储空间利用率。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为本发明将数据对象写入IP硬盘的方法的应用场景示意图;
图2为本发明将数据对象写入IP硬盘的方法实施例一的流程图;
图3为本发明将数据对象写入IP硬盘的方法实施例二的流程图;
图4为本发明将数据对象写入IP硬盘的方法实施例三的流程图;
图5为本发明将数据对象写入IP硬盘的方法实施例五的流程图;
图6为本发明将数据对象写入IP硬盘的方法实施例七的流程图;
图7为本发明服务器实施例一的结构示意图;
图8为本发明服务器实施例五的结构示意图;
图9为本发明IP硬盘实施例一的结构示意图;
图10为本发明IP硬盘实施例二的结构示意图;
图11为本发明IP硬盘实施例四的结构示意图;
图12为本发明IP硬盘实施例五的结构示意图;
图13为本发明IP硬盘实施例六的结构示意图;
图14为本发明IP硬盘实施例八的结构示意图。
具体实施方式
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
图1为本发明将数据对象写入IP硬盘的方法的应用场景示意图,如图1所示,存储系统中,当一数据对象分为多个数据分片写入时,服务器11将每一数据分片作为一待写入对象,为每一数据分片分配一一对应的key;服务器11将包括一数据分片及该数据分片对应的key的数据写入请求发送至IP硬盘12,IP硬盘12对属于同一数据对象的多个数据分片需要分别存储一个key;因此,当数据分片较小时,存在IP硬盘12存储空间利用率低的问题。
需要说明的是,图1的应用场景中一个服务器和3个IP硬盘仅为举例,任何包括至少一个服务器和多个IP硬盘的存储系统都为本发明将数据对象写入IP硬盘的方法的应用场景。
图2为本发明将数据对象写入IP硬盘的方法实施例一的流程图,执行主体为服务器,如图2所示,本实施例的方法可以包括:
步骤201、确定待发送的待写入数据分片;
其中,数据对象可以为文件、块数据等。
可选的,服务器可以根据用户输入确定待发送的数据分片。
例如,用户向一已存在文件中写入3KB数据;则可以认为该3KB数据为待写入数据分片。
步骤202、查询最近一次已发送的数据分片对应的第一key和所述第一key对应的已发送的数据分片的长度,所述第一key与第一目标IP硬盘对应;
需要说明的是,所述最近一次已发送的数据分片与所述待写入数据分片属于同一数据对象。
需要说明的是,一个key仅对应一个IP硬盘,一个IP硬盘可以对应多个key。
假设一数据对象包括7个数据分片,且数据分片1的长度为4KB,数据分片2的长度为2KB,数据分片3的长度为6KB,数据分片4的长度为10KB,数据分片5的长度为18KB,数据分片6的长度为5KB,数据分片7的长度 为4KB:
当待写入数据分片为数据分片5时,则最近一次已发送的数据分片为数据分片4。进一步的,当数据分片1~数据分片4对应的key都为key1时,则key1对应的已发送的数据分片的长度为22KB。
当待写入数据分片为数据分片7时,则最近一次已发送的数据分片为数据分片6。进一步的,当数据分片1~数据分片5对应的key都为key1,数据分片6对应的key为key2时,则key2对应的已发送的数据分片的长度为5KB。
步骤203、根据所述第一key对应的已发送的数据分片的长度及预设的key的存储容量,确定所述第一key对应的剩余存储容量,所述第一key对应的剩余存储容量等于所述key的存储容量减去所述第一key对应的已发送的数据分片的长度;
例如,若预设的key的存储容量为2MB,且第一key对应的已发送的数据分片的长度为1MB,则第一key对应的剩余存储容量为1MB。
步骤204、若所述第一key对应的剩余存储容量大于或等于所述待写入数据分片的长度,则根据所述第一key确定所述待写入数据分片对应的key,所述待写入数据分片对应的key与所述第一key相同;
步骤205、根据所述第一key对应的已发送的数据分片的长度确定所述待写入数据分片的偏移量;
例如,若第一key对应已发送的数据分片的长度为1MB,则所述待写入数据分片的偏移量可以为1MB。
步骤206、生成第一数据写入请求,所述第一数据写入请求包括所述待写入数据分片、所述待写入数据分片对应的key以及所述待写入数据分片的偏移量;
步骤207、将所述第一数据写入请求发送给所述第一目标IP硬盘。
现有技术中,当一数据对象分为多个数据分片写入时,服务器将每一数据分片作为一待写入对象,为每一数据分片分配一一对应的key,服务器向IP硬盘发送的数据写入请求包括数据分片及该数据分片对应的key。本发明中,当数据对象分为若干个数据分片写入时,服务器查询最近一次已发送的数据分片对应的第一key和所述第一key对应的已发送的数据分片的长度,所述第一key与第一目标IP硬盘对应;若所述第一key对应的剩余存储容量 大于或等于所述待写入数据分片的长度,则确定所述待写入数据分片对应的key与所述第一key相同;根据所述第一key对应的已发送的数据分片的长度确定所述待写入数据分片的偏移量;并将包括待写入数据分片、第一key及所述待写入数据分片的偏移量的数据写入请求发送至第一目标IP硬盘。
现有技术中,当一数据对象分为多个数据分片写入时,由于服务器将每一数据分片作为一待写入对象,为每一数据分片分配一一对应的key,服务器向IP硬盘发送的数据写入请求包括数据分片及该数据分片对应的key;导致IP硬盘需要对属于同一数据对象的多个数据分片分别存储一个key;由于存储key就需要占据几KB到几十KB的存储空间大小,当数据分片较小时,存储key所占存储空间的大小更加不容忽视;且由于该多个数据分片对应了同一数据对象的不同部分,没有必要为该多个数据分片分别对应存储一个key;因此,存在IP硬盘存储空间利用率低的问题。
本发明中,当数据对象分为若干个数据分片写入时,服务器通过查询最近一次已发送的数据分片对应的第一key和所述第一key对应的已发送的数据分片的长度,所述第一key与第一目标IP硬盘对应;若所述第一key对应的剩余存储容量大于或等于所述待写入数据分片的长度,则确定所述待写入数据分片对应的key与所述第一key相同;根据所述第一key对应的已发送的数据分片的长度确定所述待写入数据分片的偏移量;并将包括待写入数据分片、第一key及所述待写入数据分片的偏移量的数据写入请求发送至第一目标IP硬盘;使得服务器能够对属于同一数据对象的多个数据分片分配同一key,避免IP硬盘需要对属于同一数据对象的多个数据分片分别存储一个key,减少了IP硬盘存储key所占用的存储空间的大小,提高了IP硬盘的存储空间利用率。
图3为本发明将数据对象写入IP硬盘的方法实施例二的流程图,执行主体为服务器,如图3所示,在步骤201之前还可以包括:
步骤301、确定所述最近一次已发送的数据分片是否为对所述数据对象进行首次写入的数据分片;
步骤302、若所述最近一次已发送的数据分片为对所述数据对象的首次写入的数据分片,则为所述最近一次已发送的数据分片分配对应的所述第一key以及所述第一目标IP硬盘;
可选的,服务器可以根据所述最近一次已发送的数据分片的内容通过哈希算法获得所述第一key。
步骤303、生成第二数据写入请求,所述第二数据写入请求包括所述最近一次已发送的数据分片、所述第一key、以及所述最近一次已发送的数据分片的偏移量;其中,所述最近一次已发送的数据分片的偏移量等于0;
其中,偏移量等于0,即指示IP硬盘从所述第一key对应的存储空间的起始位置对最近一次已发送的数据分片进行存储。
步骤304、将所述第二数据写入请求发送给所述第一目标IP硬盘。
本实施例中,通过服务器在确定最近一次已发送的数据分片为对数据对象进行首次写入的数据分片时,为最近一次已发送的数据分片分配对应的key以及目标IP硬盘,并将包括该key、最近一次已发送的数据分片及偏移量为0的数据写入请求发送至IP硬盘;使得服务器能够实现在对数据对象进行首次写入时分配key及IP硬盘;以在用户之后再对该数据对象进行写入时,服务器能够根据已分配的key及IP硬盘,确定待写入数据分片对应的key及IP硬盘。
需要说明的是,若最近一次已发送的数据分片为对数据对象进行首次写入的数据分片,且为所述最近一次已发送的数据分片分配的key为key1、目标IP硬盘为IP硬盘1,则待写入数据分片对应的key也为key1,待写入数据分片对应的数据写入请求也发送至IP硬盘1。
图4为本发明将数据对象写入IP硬盘的方法实施例三的流程图,执行主体为服务器,如图4所示,本实施例的方法可以包括:
步骤401、确定待发送的待写入数据分片;
步骤402、查询最近一次已发送的数据分片对应的第一key和所述第一key对应的已发送的数据分片的长度,所述第一key与第一目标IP硬盘对应;
需要说明的是,步骤402与步骤202相同,在此不再赘述。
步骤403、根据所述第一key对应的已发送的数据分片的长度及预设的key的存储容量,确定所述第一key对应的剩余存储容量,所述第一key对应的剩余存储容量等于所述key的存储容量减去所述第一key对应的已发送的数据分片的长度;
需要说明的是,步骤403与步骤203相同,在此不再赘述。
步骤404、若所述第一key对应的剩余存储容量小于所述待写入数据分片的长度,则:根据所述第一key对应的剩余存储容量,将所述待写入数据分片拆分为第一子分片和第二子分片;其中,所述第一子分片的长度等于所述第一key对应的剩余存储容量;
例如,若第一key对应的剩余存储容量为1MB,待写入数据分片的长度为1.5MB,预设的key的存储容量为1MB,则:将待写入数据分片的前1MB作为第一子分片,将待写入数据分片的后0.5MB作为第二子分片。
又例如,若第一key对应的剩余存储容量为0.5MB,待写入数据分片的长度为2MB,预设的key的存储容量为1MB,则:将待写入数据分片的前0.5MB作为第一子分片,将待写入数据分片的中间1MB作为第二子分片,将待写入数据分片的后0.5MB作为第三子分片。
步骤405、根据所述第一key确定所述第一子分片对应的key,所述第一子分片对应的key与所述第一key相同;
也即,第一子分片对应的key与最近一次已发送的数据分片对应的key相同。
步骤406、根据所述第一key对应的已发送的数据分片的长度确定所述第一子分片的偏移量;
步骤407、生成第一子数据写入请求,所述第一子数据写入请求包括所述第一子分片、所述第一key以及所述第一子分片的偏移量;
步骤408、将第一子数据写入请求发送给所述第一目标IP硬盘;
步骤409、为所述第二子分片分配对应的第二key,并为所述第二key分配对应的第二目标IP硬盘;
可选的,服务器可以根据第二子分片的内容通过哈希算法获得所述第一key。
需要说明的是,通过将长度等于第一key对应的剩余存储容量的第一子分片发送至第一目标IP硬盘进行存储,将第二子分片发送至第二目标IP硬盘进行存储,使得同一数据对象的多个数据分片能够在一部分数据分片对应同一key存储至一IP硬盘的基础上,其他数据分片可以对应另一key存储至另一IP硬盘;以使服务器在读取该数据对象时,能够从多个IP硬盘上同时读取;从而在提高IP硬盘存储空间利用率的基础上,还提高服务器读取数据 对象的效率。
步骤410、生成第二子数据写入请求,所述第二子数据写入请求包括所述第二子分片、所述第二子分片对应的第二key以及所述第二子分片的偏移量;其中,所述第二子分片的偏移量等于0;
步骤411、将第二子数据写入请求发送给所述第二目标IP硬盘。
需要说明的是,步骤405~步骤408与步骤409~步骤411之间并没有先后关系;
本实施例中,通过服务器根据第一key对应的剩余存储容量,将待写入数据分片拆分为第一子分片和第二子分片;确定第一子分片对应的key与第一key相同,并为第二子分片分配新的key;使得当第一key对应的剩余存储容量小于待写入数据分片的长度时,服务器能够对待写入数据分片进行拆分,并发送至相应的IP硬盘进行存储。
数据对象写入IP硬盘的方法实施例四
可选的,在本发明方法实施例一、或方法实施例二、或方法实施例三的基础上,还可以包括:生成数据读取请求,所述数据读取请求包括key和偏移量;将所述数据读取请求发送给所述第一目标IP硬盘。
可选的,数据读取请求中还可以包括所需读取数据的大小。
需要说明的是,数据读取请求中包括的key为服务器已分配的key,例如为方法实施例一中的第一key;数据读取请求中包括的偏移位置可以为0至预设的key的存储容量之间的任意正整数。
本实施例中,通过向IP硬盘发送包括key及偏移量的数据读取请求,使得服务器在将数据发送至IP硬盘存储后,能够通过指定相应的key及偏移量,实现对该key对应的存储空间中数据的灵活读取。
图5为本发明将数据对象写入IP硬盘的方法实施例五的流程图,执行主体为IP硬盘,如图5所示,本实施例的方法可以包括:
步骤501、接收服务器发送的数据写入请求,所述数据写入请求包括:待写入数据分片,所述待写入数据分片对应的key以及偏移量,所述key与所述IP硬盘对应,所述偏移量用于指示已写入所述IP硬盘的数据分片的大小;
例如,若数据对象包括3个数据分片,数据分片1的长度为4KB,数据 分片2的长度为2KB,数据分片3的长度为6KB,且待写入数据分片为数据分片3,数据分片1、数据分片2、数据分片3都写入IP硬盘1,则偏移量为6KB。
步骤502、根据所述key和所述偏移量确定所述待写入数据分片存储在所述IP硬盘的起始地址,并从所述待写入数据分片存储在所述IP硬盘的起始地址对应的存储空间开始写入所述待写入数据分片。
例如,若key对应的存储空间的首地址为0x00,IP硬盘一存储地址对应的存储单元的大小为1B,偏移量为1MB,则待写入数据分片存储在该IP硬盘的起始地址为0x400。
现有技术中,当一数据对象分为多个数据分片写入时,IP硬盘接收到服务器发送的包括key及待写入数据分片的数据写入请求后,分配与待写入数据分片大小相同的存储空间存储该待写入数据分片,并将该key和该待写入数据分片进行关联存储,以使服务器在进行数据读取时能够根据该key获得该待写入数据分片。本发明中,当一数据对象分为多个数据分片写入时,IP硬盘接收服务器发送的包括待写入数据分片、key及偏移值的数据写入请求,根据所述key和所述偏移量确定所述待写入数据分片存储在所述IP硬盘的起始地址,并从所述待写入数据分片存储在所述IP硬盘的起始地址对应的存储空间开始写入所述待写入数据分片。
现有技术中,当一数据对象分为多个数据分片写入时,由于IP硬盘接收到服务器发送的包括key及待写入数据分片的数据写入请求后,分配与待写入数据分片大小相同的存储空间存储该待写入数据分片,并将该key和该待写入数据分片进行关联存储;因此,IP硬盘需要对属于同一数据对象的多个数据分片分别存储一个key;由于存储key就需要占据几KB到几十KB的存储空间大小,当数据分片较小时,存储key所占存储空间的大小更加不容忽视;且由于该多个数据分片对应了同一数据对象的不同部分,没有必要为该多个数据分片分别对应不同的key;因此,存在IP硬盘存储空间利用率低的问题。
本发明中,当一数据对象分为多个数据分片写入时,通过IP硬盘接收服务器发送的包括待写入数据分片、key及偏移值的数据写入请求,根据所述key和所述偏移量确定所述待写入数据分片存储在所述IP硬盘的起始地址, 并从所述待写入数据分片存储在所述IP硬盘的起始地址对应的存储空间开始写入所述待写入数据分片;使得IP硬盘能够根据服务器在数据写入请求中包括的偏移值,将多个数据分片存储至一个key对应的存储空间;使得多个数据分片在IP硬盘中能够对应同一个key,减少了IP硬盘存储key所占用的存储空间的大小,提高了IP硬盘的存储空间利用率。
数据对象写入IP硬盘的方法实施例六
可选的,在本发明方法实施例五的基础上,还可以包括:接收所述服务器发送的数据读取请求,所述数据读取请求包括所述key和偏移量;根据所述key及所述偏移量读取数据,并将所读取的数据反馈给所述服务器。
可选的,数据读取请求中还可以包括所需读取数据的大小。
需要说明的是,数据读取请求中包括的key为IP硬盘中已存储的key,例如为方法实施例五中的key;数据读取请求中包括的偏移位置可以为0至预设的key的存储容量之间的任意正整数。
现有技术中,IP硬盘接收服务器发送的数据读取请求,所述数据读取请求包括key;IP硬盘根据所述key读取数据,并将所读取的数据反馈给服务器。本发明中,IP硬盘接收服务器发送的数据读取请求,所述数据读取请求包括key和偏移量;IP硬盘根据所述key及所述偏移量读取数据,并将所读取的数据反馈给服务器。
现有技术中,由于IP硬盘接收到服务器发送的包括key和待写入数据分片的数据写入请求后,将该key和该待写入数据分片进行关联存储;当IP硬盘接收到服务器发送的包括该key的数据读取请求时,IP硬盘根据该key获取对应的数据(也即,数据写入请求中的待写入数据分片)并反馈给服务器;因此,当一数据对象分为多个数据分片写入时,服务器需要对每一数据分片对应的key分别进行读取操作,才能够获得该key对应的数据分片,操作复杂;
本发明中,在IP硬盘对多个数据分片对应同一个key进行存储后,通过IP硬盘接收服务器发送的包括key和偏移量的数据读取请求,IP硬盘根据所述key及所述偏移量读取数据,并将所读取的数据反馈给服务器;使得当一数据对象分为多个数据分片写入时,服务器能通过设置相应的偏移量即可以实现对各数据分片的灵活读取,操作简单。
数据对象写入IP硬盘的方法实施例七
在本发明数据对象写入IP硬盘的方法实施例五的基础上,可选的,所述key对应的存储容量等于M倍的预设的长度L;其中,M为正整数。
例如,若key对应的存储容量为2MB,预设的长度L为64KB,则M等于32。也即,key对应的存储容量被分为32段。
图6为本发明将数据对象写入IP硬盘的方法实施例七的流程图,如图6所示,步骤502可以包括:
步骤601、根据所述偏移量及预设的长度L,确定需要将所述待写入数据分片存储至所述key对应的存储空间中的第N段存储空间;并根据所述偏移量、N及所述预设的长度L,确定所述第N段存储空间的剩余存储容量;
其中,N为正整数,且M大于N;
例如,若key对应的存储容量为2MB,预设的长度L为64KB,则M等于32;进一步地,若偏移量为1MB,则N等于17(也即,需要将待写入数据分片存储至所述key对应的存储空间中的第17段存储空间);进一步地,根据偏移量为1MB、N等于17和预设的长度L为2MB,则可确定第17段存储空间的剩余存储容量为64KB。
步骤602、确定所述待写入数据分片的长度是否大于所述第N段存储空间的剩余存储容量;
若是,则执行步骤603;否则,执行步骤606。
步骤603、根据所述第N段存储空间的剩余存储容量及预设的长度L,将所述待写入数据分片依次拆分为第一子分片和第二子分片;其中,所述第一子分片的长度等于所述第N段存储空间的剩余存储容量;所述第二子分片的长度小于或等于所述预设的长度L;
例如,若第N段存储空间的剩余存储容量为32KB、预设的长度L为64KB,待写入数据分片的大小为94KB,则将所述待写入数据分片的前32KB作为第一子分片,将所述待写入数据分片后62KB作为第二子分片。
又例如,若第N段存储空间的剩余存储容量为32KB、预设的长度L为64KB,待写入数据分片的大小为120KB,则将所述待写入数据分片的前32KB作为第一子分片,将所述待写入数据分片的中间64KB作为第二子分片,将所述待写入数据分片最后的24KB为第三子分片。
步骤604、确定所述第一子分片存储在所述IP硬盘的起始地址为所述第N段存储空间的剩余存储容量的起始地址,并从所述第N段存储空间的剩余存储容量的起始地址对应的存储空间开始写入所述第一子分片;
可选的,确定所述第N段存储空间的剩余存储容量的起始地址,可以为:根据所述第N段存储空间的剩余存储容量及预设的长度L,确定所述第N段存储空间的已存储数据的大小;根据所述第N段存储空间的已存储数据的大小及所述第N段的存储空间的首地址,确定所述第N段存储空间的剩余存储容量的起始地址。
步骤605、分配第N+1段的存储空间,将所述第N+1段存储空间的首地址与所述key值进行关联存储,其中,所述第N+1段存储空间的大小等于所述预设的长度L;确定所述第二子分片存储在所述IP硬盘的起始地址为所述第N+1段存储空间的首地址,并从所述第N+1段存储空间的首地址对应的存储空间开始写入所述第二子分片;
需要说明的是,步骤605执行完之后则结束。
步骤606、确定所述待写入数据分片存储在所述IP硬盘的起始地址为所述第N段存储空间的剩余存储容量的起始地址,并从所述第N段存储空间的剩余存储容量的起始地址对应的存储空间开始写入所述待写入数据分片。
本实施例,通过IP硬盘将key对应的存储容量分为M段,在进行数据存储时,根据偏移量及预设的长度L,确定需要将待写入数据分片存储至key对应的存储空间中的哪一段(例如第N段)存储空间,并在确定该段存储空间的剩余存储容量小于待写入数据分片的大小时,分配下一段(第N+1段)的存储空间进行存储,使得key对应的存储空间中的每段存储空间仅在需要使用的时候才进行分配,进一步提高了IP硬盘存储空间利用率。
数据对象写入IP硬盘的方法实施例八
可选的,在本发明方法实施例七的基础上,还可以包括:接收所述服务器发送的数据读取请求,所述数据读取请求包括所述key和偏移量;根据所述偏移量及所述预设的长度L,确定需要从所述key对应的存储空间中的第N段存储空间的数据开始,进行数据读取;根据所述key与各段存储空间的首地址的关联关系,确定第N段存储空间的首地址;根据所述偏移量、所述第N段存储空间的首地址,确定需要读取数据的起始地址;根据所述需要读取 数据的起始地址读取数据,并将所读取的数据反馈给所述服务器。
可选的,数据读取请求中还可以包括所需读取数据的大小。
需要说明的是,数据读取请求中包括的key为IP硬盘已存储的key,例如为方法实施例五中的key;数据读取请求中包括的偏移位置可以为0至预设的key的存储容量之间的任意正整数。
本实施例中,在IP硬盘对多个数据分片对应同一个key进行存储后,通过IP硬盘接收服务器发送的数key和偏移量的数据读取请求;根据所述偏移量及预设的长度L,确定需要从所述key对应的存储空间中的第N段存储空间的数据开始,进行数据读取;根据所述key与各段存储空间的首地址的关联关系,确定第N段存储空间的首地址;根据所述偏移量及所述第N段存储空间的首地址,确定需要读取数据的起始地址;根据所述需要读取数据的起始地址读取数据,并将所读取的数据反馈给所述服务器;使得当一数据对象分为多个数据分片写入时,服务器能通过设置相应的偏移量即可以实现对各数据分片的灵活读取,操作简单。
图7为本发明服务器实施例一的结构示意图,如图7所示,本实施例的服务器可以包括:待写入数据分片确定模块701、剩余存储容量确定模块702、key确定模块703、偏移量确定模块704、生成模块705和发送模块706。其中,待写入数据分片确定模块701,用于确定待发送的待写入数据分片;其中,数据对象包括若干个数据分片;剩余存储容量确定模块702,用于查询最近一次已发送的数据分片对应的第一key和所述第一key对应的已发送的数据分片的长度,所述第一key与第一目标IP硬盘对应;根据所述第一key对应的已发送的数据分片的长度及预设的key的存储容量,确定所述第一key对应的剩余存储容量,所述第一key对应的剩余存储容量等于所述key的存储容量减去所述第一key对应的已发送的数据分片的长度;key确定模块703,用于若所述第一key对应的剩余存储容量大于或等于所述待写入数据分片的长度,则根据所述第一key确定所述待写入数据分片对应的key,所述待写入数据分片对应的key与所述第一key相同;偏移量确定模块704,用于根据所述第一key对应的已发送的数据分片的长度确定所述待写入数据分片的偏移量;生成模块705,用于生成第一数据写入请求,所述第一数据写入请求包括所述待写入数据分片、所述待写入数据分片对应的key以及所述待写入数 据分片的偏移量;发送模块706,用于将所述第一数据写入请求发送给所述第一目标IP硬盘。
本实施例的服务器,可以用于执行图2所示方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。
服务器实施例二
在本发明服务器实施例一的基础上,可选的,key确定模块703,还用于:确定所述最近一次已发送的数据分片是否为对所述数据对象进行首次写入的数据分片;若是,则为所述最近一次已发送的数据分片分配对应的所述第一key以及所述第一目标IP硬盘;
相应的,生成模块705,还用于:生成第二数据写入请求,所述第二数据写入请求包括所述最近一次已发送的数据分片、所述第一key、以及所述最近一次已发送的数据分片的偏移量;其中,所述最近一次已发送的数据分片的偏移量等于0;
相应的,发送模块706,还用于:将所述第二数据写入请求发送给所述第一目标IP硬盘。
本实施例的服务器,可以用于执行图3所示方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。
服务器实施例三
在本发明服务器实施例一或服务器实施例二的基础上,可选的,key确定模块703,还用于:
若所述第一key对应的剩余存储容量小于所述待写入数据分片的长度,则:
根据所述第一key对应的剩余存储容量,将所述待写入数据分片拆分为第一子分片和第二子分片;其中,所述第一子分片的长度等于所述第一key对应的剩余存储容量;
根据所述第一key确定所述第一子分片对应的key,所述第一子分片对应的key与所述第一key相同;
为所述第二子分片分配对应的第二key,并为所述第二key分配对应的第二目标IP硬盘;
相应的,偏移量确定模块704,具体用于:根据所述第一key对应的已发 送的数据分片的长度确定所述第一子分片的偏移量;
生成模块705,具体用于:生成第一子数据写入请求,所述第一子数据写入请求包括所述第一子分片、所述第一key以及所述第一子分片的偏移量;生成第二子数据写入请求,所述第二子数据写入请求包括所述第二子分片、所述第二子分片对应的第二key以及所述第二子分片的偏移量;其中,所述第二子分片的偏移量等于0;
发送模块706,具体用于:将第一子数据写入请求发送给所述第一目标IP硬盘;将第二子数据写入请求发送给所述第二目标IP硬盘。
本实施例的服务器,可以用于执行图4所示方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。
服务器实施例四
在本发明服务器实施例一、或服务器实施例二、或服务器实施例三的基础上,可选的,生成模块705,还用于:生成数据读取请求,所述数据读取请求包括key和偏移量;发送模块706,还可以用于:将所述数据读取请求发送给所述第一目标IP硬盘。
本实施例的服务器,可以用于执行将数据对象写入IP硬盘的方法实施例四的技术方案,其实现原理和技术效果类似,此处不再赘述。
图8为本发明服务器实施例五的结构示意图,如图8所示,本实施例的服务器可以包括:处理器801和发送器802;
其中,处理器801,用于:确定待发送的待写入数据分片;
查询最近一次已发送的数据分片对应的第一key和所述第一key对应的已发送的数据分片的长度,所述第一key与第一目标IP硬盘对应;
根据所述第一key对应的已发送的数据分片的长度及预设的key的存储容量,确定所述第一key对应的剩余存储容量,所述第一key对应的剩余存储容量等于所述key的存储容量减去所述第一key对应的已发送的数据分片的长度;
若所述第一key对应的剩余存储容量大于或等于所述待写入数据分片的长度,则根据所述第一key确定所述待写入数据分片对应的key,所述待写入数据分片对应的key与所述第一key相同;
根据所述第一key对应的已发送的数据分片的长度确定所述待写入数据 分片的偏移量;
生成第一数据写入请求,所述第一数据写入请求包括所述待写入数据分片、所述待写入数据分片对应的key以及所述待写入数据分片的偏移量;
发送器802,用于:将所述第一数据写入请求发送给所述第一目标IP硬盘。
本实施例的服务器,可以用于执行图2所示方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。
服务器实施例六
在本发明服务器实施例五的基础上,可选的,处理器801,还用于:
确定所述最近一次已发送的数据分片是否为对所述数据对象进行首次写入的数据分片;若是,则为所述最近一次已发送的数据分片分配对应的所述第一key以及所述第一目标IP硬盘;
生成第二数据写入请求,所述第二数据写入请求包括所述最近一次已发送的数据分片、所述第一key、以及所述最近一次已发送的数据分片的偏移量;其中,所述最近一次已发送的数据分片的偏移量等于0;
相应的,发送器802,还用于:将所述第二数据写入请求发送给所述第一目标IP硬盘。
本实施例的服务器,可以用于执行图3所示方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。
服务器实施例七
在本发明服务器实施例五或服务器实施例六的基础上,可选的,处理器801,还用于:
若所述第一key对应的剩余存储容量小于所述待写入数据分片的长度,则:
根据所述第一key对应的剩余存储容量,将所述待写入数据分片拆分为第一子分片和第二子分片;其中,所述第一子分片的长度等于所述第一key对应的剩余存储容量;
根据所述第一key确定所述第一子分片对应的key,所述第一子分片对应的key与所述第一key相同;
为所述第二子分片分配对应的第二key,并为所述第二key分配对应的第 二目标IP硬盘;
根据所述第一key对应的已发送的数据分片的长度确定所述第一子分片的偏移量;
生成第一子数据写入请求,所述第一子数据写入请求包括所述第一子分片、所述第一key以及所述第一子分片的偏移量;生成第二子数据写入请求,所述第二子数据写入请求包括所述第二子分片、所述第二子分片对应的第二key以及所述第二子分片的偏移量;其中,所述第二子分片的偏移量等于0;
相应的,发送器802具体用于:将第一子数据写入请求发送给所述第一目标IP硬盘;将第二子数据写入请求发送给所述第二目标IP硬盘。
本实施例的服务器,可以用于执行图4所示方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。
服务器实施例八
在本发明服务器实施例五、或服务器实施例六、或服务器实施例七的基础上,可选的,处理器801,还用于:生成数据读取请求,所述数据读取请求包括key和偏移量;发送器802,还用于:将所述数据读取请求发送给所述第一目标IP硬盘。
本实施例的服务器,可以用于执行将数据对象写入IP硬盘的方法实施例四的技术方案,其实现原理和技术效果类似,此处不再赘述。
图9为本发明IP硬盘实施例一的结构示意图,如图9所示,本实施例的IP硬盘可以包括:接收模块901和处理模块902。其中,接收模块901,用于接收服务器发送的数据写入请求,所述数据写入请求包括:待写入数据分片,所述待写入数据分片对应的key以及偏移量,所述key与所述IP硬盘对应,所述偏移量用于指示已写入所述IP硬盘的数据分片的大小;处理模块902,用于根据所述key和所述偏移量确定所述待写入数据分片存储在所述IP硬盘的起始地址,并从所述待写入数据分片存储在所述IP硬盘的起始地址对应的存储空间开始写入所述待写入数据分片。
本实施例的IP硬盘,可以用于执行图5所示方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。
图10为本发明IP硬盘实施例二的结构示意图,如图10所示,本实施例的IP硬盘在图9所示IP硬盘结构的基础上,进一步地,还可以包括:第一 发送模块903。接收模块901还用于:接收所述服务器发送的数据读取请求,所述数据读取请求包括所述key和偏移量;处理模块902还用于:根据所述key及所述偏移量读取数据;该第一发送模块903用于将处理模块902所读取的数据反馈给所述服务器。
本实施例的IP硬盘,可以用于执行将数据对象写入IP硬盘的方法实施例六的技术方案,其实现原理和技术效果类似,此处不再赘述。
IP硬盘实施例三
可选的,在本发明IP硬盘实施例一的基础上,所述key对应的存储容量等于M倍的预设的长度L;其中,M为正整数;
相应的,处理模块902,具体用于:
根据所述偏移量及预设的长度L,确定需要将所述待写入数据分片存储至所述key对应的存储空间中的第N段存储空间;并根据所述偏移量、N及所述预设的长度L,确定所述第N段存储空间的剩余存储容量;其中,N为正整数,且M大于N;
确定所述待写入数据分片的长度是否大于所述第N段存储空间的剩余存储容量;
若是,则根据所述第N段存储空间的剩余存储容量及预设的长度L,将所述待写入数据分片依次拆分为第一子分片和第二子分片;其中,所述第一子分片的长度等于所述第N段存储空间的剩余存储容量;所述第二子分片的长度小于或等于所述预设的长度L;
确定所述第一子分片存储在所述IP硬盘的起始地址为所述第N段存储空间的剩余存储容量的起始地址,并从所述第N段存储空间的剩余存储容量的起始地址对应的存储空间开始写入所述第一子分片;
分配第N+1段的存储空间,将所述第N+1段存储空间的首地址与所述key值进行关联存储,其中,所述第N+1段存储空间的大小等于所述预设的长度L;确定所述第二子分片存储在所述IP硬盘的起始地址为所述第N+1段存储空间的首地址,并从所述第N+1段存储空间的首地址对应的存储空间开始写入所述第二子分片;
否则,确定所述待写入数据分片存储在所述IP硬盘的起始地址为所述第N段存储空间的剩余存储容量的起始地址,并从所述第N段存储空间的剩余 存储容量的起始地址对应的存储空间开始写入所述待写入数据分片。
本实施例的IP硬盘,可以用于执行图6所示方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。
图11为本发明IP硬盘实施例四的结构示意图,如图11所示,本实施例的IP硬盘在图9所示IP硬盘结构的基础上,进一步地,还可以包括:第二发送模块904;接收模块901还用于:接收所述服务器发送的数据读取请求,所述数据读取请求包括所述key和偏移量;处理模块902还用于:根据所述偏移量及所述预设的长度L,确定需要从所述key对应的存储空间中的第N段存储空间的数据开始,进行数据读取;根据所述key与各段存储空间的首地址的关联关系,确定第N段存储空间的首地址;根据所述偏移量、所述第N段存储空间的首地址,确定需要读取数据的起始地址;根据所述需要读取数据的起始地址读取数据;该第二发送模块904用于将处理模块902所读取的数据反馈给所述服务器。
本实施例的IP硬盘,可以用于执行将数据对象写入IP硬盘的方法实施例八的技术方案,其实现原理和技术效果类似,此处不再赘述。
图12为本发明IP硬盘实施例五的结构示意图,如图12所示,本实施例的IP硬盘可以包括:接收器1201和处理器1202。其中,接收器1201,用于接收服务器发送的数据写入请求,所述数据写入请求包括:待写入数据分片,所述待写入数据分片对应的key以及偏移量,所述key与所述IP硬盘对应,所述偏移量用于指示已写入所述IP硬盘的数据分片的大小;处理器1202,用于根据所述key和所述偏移量确定所述待写入数据分片存储在所述IP硬盘的起始地址,并从所述待写入数据分片存储在所述IP硬盘的起始地址对应的存储空间开始写入所述待写入数据分片。
本实施例的IP硬盘,可以用于执行图5所示方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。
图13为本发明IP硬盘实施例六的结构示意图,如图13所示,本实施例的IP硬盘在图12所示IP硬盘结构的基础上,进一步地,还可以包括:第一发送器1203。接收器1201还用于:接收所述服务器发送的数据读取请求,所述数据读取请求包括所述key和偏移量;处理器1202还用于:根据所述key及所述偏移量读取数据;该第一发送器1203,用于将处理器1202所读取的 数据反馈给所述服务器。
本实施例的IP硬盘,可以用于执行将数据对象写入IP硬盘的方法实施例六的技术方案,其实现原理和技术效果类似,此处不再赘述。
IP硬盘实施例七
可选的,在本发明IP硬盘实施例五的基础上,所述key对应的存储容量等于M倍的预设的长度L;其中,M为正整数;
相应的,处理器1202,具体用于:
根据所述偏移量及预设的长度L,确定需要将所述待写入数据分片存储至所述key对应的存储空间中的第N段存储空间;并根据所述偏移量、N及所述预设的长度L,确定所述第N段存储空间的剩余存储容量;其中,N为正整数,且M大于N;
确定所述待写入数据分片的长度是否大于所述第N段存储空间的剩余存储容量;
若是,则根据所述第N段存储空间的剩余存储容量及预设的长度L,将所述待写入数据分片依次拆分为第一子分片和第二子分片;其中,所述第一子分片的长度等于所述第N段存储空间的剩余存储容量;所述第二子分片的长度小于或等于所述预设的长度L;
确定所述第一子分片存储在所述IP硬盘的起始地址为所述第N段存储空间的剩余存储容量的起始地址,并从所述第N段存储空间的剩余存储容量的起始地址对应的存储空间开始写入所述第一子分片;
分配第N+1段的存储空间,将所述第N+1段存储空间的首地址与所述key值进行关联存储,其中,所述第N+1段存储空间的大小等于所述预设的长度L;确定所述第二子分片存储在所述IP硬盘的起始地址为所述第N+1段存储空间的首地址,并从所述第N+1段存储空间的首地址对应的存储空间开始写入所述第二子分片;
否则,确定所述待写入数据分片存储在所述IP硬盘的起始地址为所述第N段存储空间的剩余存储容量的起始地址,并从所述第N段存储空间的剩余存储容量的起始地址对应的存储空间开始写入所述待写入数据分片。
本实施例的IP硬盘,可以用于执行图6所示方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。
图14为本发明IP硬盘实施例八的结构示意图,如图14所示,本实施例的IP硬盘在图12所示IP硬盘结构的基础上,进一步地,还可以包括:第二发送器1204;接收器1201还用于:接收所述服务器发送的数据读取请求,所述数据读取请求包括所述key和偏移量;处理器1202还用于:根据所述偏移量及所述预设的长度L,确定需要从所述key对应的存储空间中的第N段存储空间的数据开始,进行数据读取;根据所述key与各段存储空间的首地址的关联关系,确定第N段存储空间的首地址;根据所述偏移量、所述第N段存储空间的首地址,确定需要读取数据的起始地址;根据所述需要读取数据的起始地址读取数据;该第二发送器1204用于将处理器1202所读取的数据反馈给所述服务器。
本实施例的IP硬盘,可以用于执行将数据对象写入IP硬盘的方法实施例八的技术方案,其实现原理和技术效果类似,此处不再赘述。
本发明还提供一种将数据对象写入互联网协议IP硬盘的系统,所述数据对象包括若干个数据分片,所述系统包括:服务器实施例一、实施例二、实施例三、或实施例四中所述的服务器,以及IP硬盘实施例一、实施例二、实施例三、或实施例四中所述的IP硬盘。
本领域普通技术人员可以理解:实现上述各方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成。前述的程序可以存储于一计算机可读取存储介质中。该程序在执行时,执行包括上述各方法实施例的步骤;而前述的存储介质包括:ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。
最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。

Claims (17)

  1. 一种将数据对象写入互联网协议IP硬盘的方法,其特征在于,所述方法应用于存储系统中,所述存储系统包括至少一个服务器和多个IP硬盘,所述方法由服务器执行,所述数据对象包括若干个数据分片,所述方法包括:
    确定待发送的待写入数据分片;
    查询最近一次已发送的数据分片对应的第一key和所述第一key对应的已发送的数据分片的长度,所述第一key与第一目标IP硬盘对应;
    根据所述第一key对应的已发送的数据分片的长度及预设的key的存储容量,确定所述第一key对应的剩余存储容量,所述第一key对应的剩余存储容量等于所述key的存储容量减去所述第一key对应的已发送的数据分片的长度;
    若所述第一key对应的剩余存储容量大于或等于所述待写入数据分片的长度,则根据所述第一key确定所述待写入数据分片对应的key,所述待写入数据分片对应的key与所述第一key相同;
    根据所述第一key对应的已发送的数据分片的长度确定所述待写入数据分片的偏移量;
    生成第一数据写入请求,所述第一数据写入请求包括所述待写入数据分片、所述待写入数据分片对应的key以及所述待写入数据分片的偏移量;
    将所述第一数据写入请求发送给所述第一目标IP硬盘。
  2. 根据权利要求1所述的方法,其特征在于,所述确定待发送的待写入数据分片之前,还包括:
    确定所述最近一次已发送的数据分片是否为对所述数据对象进行首次写入的数据分片;
    若是,则为所述最近一次已发送的数据分片分配对应的所述第一key以及所述第一目标IP硬盘;
    生成第二数据写入请求,所述第二数据写入请求包括所述最近一次已发送的数据分片、所述第一key、以及所述最近一次已发送的数据分片的偏移量;其中,所述最近一次已发送的数据分片的偏移量等于0;
    将所述第二数据写入请求发送给所述第一目标IP硬盘。
  3. 根据权利要求1或2所述的方法,其特征在于,还包括:
    若所述第一key对应的剩余存储容量小于所述待写入数据分片的长度,则:
    根据所述第一key对应的剩余存储容量,将所述待写入数据分片拆分为第一子分片和第二子分片;其中,所述第一子分片的长度等于所述第一key对应的剩余存储容量;
    根据所述第一key确定所述第一子分片对应的key,所述第一子分片对应的key与所述第一key相同;
    根据所述第一key对应的已发送的数据分片的长度确定所述第一子分片的偏移量;
    生成第一子数据写入请求,所述第一子数据写入请求包括所述第一子分片、所述第一key以及所述第一子分片的偏移量;
    将第一子数据写入请求发送给所述第一目标IP硬盘;
    为所述第二子分片分配对应的第二key,并为所述第二key分配对应的第二目标IP硬盘;
    生成第二子数据写入请求,所述第二子数据写入请求包括所述第二子分片、所述第二子分片对应的第二key以及所述第二子分片的偏移量;其中,所述第二子分片的偏移量等于0;
    将第二子数据写入请求发送给所述第二目标IP硬盘。
  4. 根据权利要求1~3任一项所述的方法,其特征在于,所述将所述第一数据写入请求发送给所述第一目标IP硬盘之后,还包括:
    生成数据读取请求,所述数据读取请求包括key和偏移量;
    将所述数据读取请求发送给所述第一目标IP硬盘。
  5. 一种将数据对象写入互联网协议IP硬盘的方法,其特征在于,所述方法由所述IP硬盘执行,所述数据对象包括若干个数据分片,所述方法包括:
    接收服务器发送的数据写入请求,所述数据写入请求包括:待写入数据分片,所述待写入数据分片对应的key以及偏移量,所述key与所述IP硬盘对应,所述偏移量用于指示已写入所述IP硬盘的数据分片的大小;
    根据所述key和所述偏移量确定所述待写入数据分片存储在所述IP硬盘的起始地址,并从所述待写入数据分片存储在所述IP硬盘的起始地址对应的存储空间开始写入所述待写入数据分片。
  6. 根据权利要求5所述的方法,其特征在于,所述从所述待写入数据分片存储在所述IP硬盘的起始地址对应的存储空间开始写入所述待写入数据分片之后,还包括:
    接收所述服务器发送的数据读取请求,所述数据读取请求包括所述key和偏移量;
    根据所述key及所述偏移量读取数据,并将所读取的数据反馈给所述服务器。
  7. 根据权利要求5所述的方法,其特征在于,所述key对应的存储容量等于M倍的预设的长度L;其中,M为正整数;
    相应的,所述根据所述key和所述偏移量确定所述待写入数据分片存储在所述IP硬盘的起始地址,并从所述待写入数据分片存储在所述IP硬盘的起始地址对应的存储空间开始写入所述待写入数据分片,包括:
    根据所述偏移量及预设的长度L,确定需要将所述待写入数据分片存储至所述key对应的存储空间中的第N段存储空间;并根据所述偏移量、N及所述预设的长度L,确定所述第N段存储空间的剩余存储容量;其中,N为正整数,且M大于N;
    确定所述待写入数据分片的长度是否大于所述第N段存储空间的剩余存储容量;
    若是,则根据所述第N段存储空间的剩余存储容量及预设的长度L,将所述待写入数据分片依次拆分为第一子分片和第二子分片;其中,所述第一子分片的长度等于所述第N段存储空间的剩余存储容量;所述第二子分片的长度小于或等于所述预设的长度L;
    确定所述第一子分片存储在所述IP硬盘的起始地址为所述第N段存储空间的剩余存储容量的起始地址,并从所述第N段存储空间的剩余存储容量的起始地址对应的存储空间开始写入所述第一子分片;
    分配第N+1段的存储空间,将所述第N+1段存储空间的首地址与所述key值进行关联存储,其中,所述第N+1段存储空间的大小等于所述预设的长度L;确定所述第二子分片存储在所述IP硬盘的起始地址为所述第N+1段存储空间的首地址,并从所述第N+1段存储空间的首地址对应的存储空间开始写入所述第二子分片;
    否则,确定所述待写入数据分片存储在所述IP硬盘的起始地址为所述第N段存储空间的剩余存储容量的起始地址,并从所述第N段存储空间的剩余存储容量的起始地址对应的存储空间开始写入所述待写入数据分片。
  8. 根据权利要求7所述的方法,其特征在于,所述从所述待写入数据分片存储在所述IP硬盘的起始地址对应的存储空间开始写入所述待写入数据分片之后,还包括:
    接收所述服务器发送的数据读取请求,所述数据读取请求包括所述key和偏移量;
    根据所述偏移量及所述预设的长度L,确定需要从所述key对应的存储空间中的第N段存储空间的数据开始,进行数据读取;
    根据所述key与各段存储空间的首地址的关联关系,确定第N段存储空间的首地址;
    根据所述偏移量、所述第N段存储空间的首地址,确定需要读取数据的起始地址;
    根据所述需要读取数据的起始地址读取数据,并将所读取的数据反馈给所述服务器。
  9. 一种将数据对象写入互联网协议IP硬盘的装置,所述装置为服务器,其特征在于,所述数据对象包括若干个数据分片,所述装置包括:
    待写入数据分片确定模块,用于确定待发送的待写入数据分片;其中,数据对象包括若干个数据分片;
    剩余存储容量确定模块,用于查询最近一次已发送的数据分片对应的第一key和所述第一key对应的已发送的数据分片的长度,所述第一key与第一目标IP硬盘对应;根据所述第一key对应的已发送的数据分片的长度及预设的key的存储容量,确定所述第一key对应的剩余存储容量,所述第一key对应的剩余存储容量等于所述key的存储容量减去所述第一key对应的已发送的数据分片的长度;
    key确定模块,用于若所述第一key对应的剩余存储容量大于或等于所述待写入数据分片的长度,则根据所述第一key确定所述待写入数据分片对应的key,所述待写入数据分片对应的key与所述第一key相同;
    偏移量确定模块,用于根据所述第一key对应的已发送的数据分片的长 度确定所述待写入数据分片的偏移量;
    生成模块,用于生成第一数据写入请求,所述第一数据写入请求包括所述待写入数据分片、所述待写入数据分片对应的key以及所述待写入数据分片的偏移量;
    发送模块,用于将所述第一数据写入请求发送给所述第一目标IP硬盘。
  10. 根据权利要求9所述的装置,其特征在于,所述key确定模块,还用于:
    确定所述最近一次已发送的数据分片是否为对所述数据对象进行首次写入的数据分片;
    若是,则为所述最近一次已发送的数据分片分配对应的所述第一key以及所述第一目标IP硬盘;
    所述生成模块,还用于:生成第二数据写入请求,所述第二数据写入请求包括所述最近一次已发送的数据分片、所述第一key、以及所述最近一次已发送的数据分片的偏移量;其中,所述最近一次已发送的数据分片的偏移量等于0;
    所述发送模块,还用于:将所述第二数据写入请求发送给所述第一目标IP硬盘。
  11. 根据权利要求9或10所述的装置,其特征在于,所述key确定模块,还用于:
    若所述第一key对应的剩余存储容量小于所述待写入数据分片的长度,则:
    根据所述第一key对应的剩余存储容量,将所述待写入数据分片拆分为第一子分片和第二子分片;其中,所述第一子分片的长度等于所述第一key对应的剩余存储容量;
    根据所述第一key确定所述第一子分片对应的key,所述第一子分片对应的key与所述第一key相同;
    为所述第二子分片分配对应的第二key,并为所述第二key分配对应的第二目标IP硬盘;
    所述偏移量确定模块,具体用于:根据所述第一key对应的已发送的数据分片的长度确定所述第一子分片的偏移量;
    生成模块,具体用于:生成第一子数据写入请求,所述第一子数据写入请求包括所述第一子分片、所述第一key以及所述第一子分片的偏移量;生成第二子数据写入请求,所述第二子数据写入请求包括所述第二子分片、所述第二子分片对应的第二key以及所述第二子分片的偏移量;其中,所述第二子分片的偏移量等于0;
    发送模块,具体用于:将第一子数据写入请求发送给所述第一目标IP硬盘;将第二子数据写入请求发送给所述第二目标IP硬盘。
  12. 根据权利要求9~11任一项所述的装置,其特征在于,所述生成模块,还用于:生成数据读取请求,所述数据读取请求包括key和偏移量;
    所述发送模块,还用于:将所述数据读取请求发送给所述第一目标IP硬盘。
  13. 一种将数据对象写入互联网协议IP硬盘的装置,所述装置为IP硬盘,其特征在于,所述数据对象包括若干个数据分片,所述装置包括:
    接收模块,用于接收服务器发送的数据写入请求,所述数据写入请求包括:待写入数据分片,所述待写入数据分片对应的key以及偏移量,所述key与所述IP硬盘对应,所述偏移量用于指示已写入所述IP硬盘的数据分片的大小;
    处理模块,用于根据所述key和所述偏移量确定所述待写入数据分片存储在所述IP硬盘的起始地址,并从所述待写入数据分片存储在所述IP硬盘的起始地址对应的存储空间开始写入所述待写入数据分片。
  14. 根据权利要求13所述的装置,其特征在于,所述接收模块,还用于:接收所述服务器发送的数据读取请求,所述数据读取请求包括所述key和偏移量;
    所述处理模块,还用于:根据所述key及所述偏移量读取数据;
    所述装置,还包括:第一发送模块,用于将所述处理模块所读取的数据反馈给所述服务器。
  15. 根据权利要求13所述的装置,其特征在于,所述key对应的存储容量等于M倍的预设的长度L;其中,M为正整数;
    所述处理模块,具体用于:
    根据所述偏移量及预设的长度L,确定需要将所述待写入数据分片存储 至所述key对应的存储空间中的第N段存储空间;并根据所述偏移量、N及所述预设的长度L,确定所述第N段存储空间的剩余存储容量;其中,N为正整数,且M大于N;
    确定所述待写入数据分片的长度是否大于所述第N段存储空间的剩余存储容量;
    若是,则根据所述第N段存储空间的剩余存储容量及预设的长度L,将所述待写入数据分片依次拆分为第一子分片和第二子分片;其中,所述第一子分片的长度等于所述第N段存储空间的剩余存储容量;所述第二子分片的长度小于或等于所述预设的长度L;
    确定所述第一子分片存储在所述IP硬盘的起始地址为所述第N段存储空间的剩余存储容量的起始地址,并从所述第N段存储空间的剩余存储容量的起始地址对应的存储空间开始写入所述第一子分片;
    分配第N+1段的存储空间,将所述第N+1段存储空间的首地址与所述key值进行关联存储,其中,所述第N+1段存储空间的大小等于所述预设的长度L;确定所述第二子分片存储在所述IP硬盘的起始地址为所述第N+1段存储空间的首地址,并从所述第N+1段存储空间的首地址对应的存储空间开始写入所述第二子分片;
    否则,确定所述待写入数据分片存储在所述IP硬盘的起始地址为所述第N段存储空间的剩余存储容量的起始地址,并从所述第N段存储空间的剩余存储容量的起始地址对应的存储空间开始写入所述待写入数据分片。
  16. 根据权利要求15所述的装置,其特征在于,所述接收模块,还用于:接收所述服务器发送的数据读取请求,所述数据读取请求包括所述key和偏移量;
    所述处理模块,还用于:根据所述偏移量及所述预设的长度L,确定需要从所述key对应的存储空间中的第N段存储空间的数据开始,进行数据读取;根据所述key与各段存储空间的首地址的关联关系,确定第N段存储空间的首地址;根据所述偏移量、所述第N段存储空间的首地址,确定需要读取数据的起始地址;根据所述需要读取数据的起始地址读取数据;
    所述装置,还包括:第二发送模块,用于将所述处理模块所读取的数据反馈给所述服务器。
  17. 一种将数据对象写入互联网协议IP硬盘的系统,其特征在于,所述数据对象包括若干个数据分片,所述系统包括:至少一个权利要求9~12任一项所述的服务器和多个权利要求13~16任一项所述的IP硬盘。
PCT/CN2015/083780 2014-10-30 2015-07-10 将数据对象写入ip硬盘的方法、装置及系统 WO2016065927A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410606549.5 2014-10-30
CN201410606549.5A CN104461378B (zh) 2014-10-30 2014-10-30 将数据对象写入ip硬盘的方法、装置及系统

Publications (1)

Publication Number Publication Date
WO2016065927A1 true WO2016065927A1 (zh) 2016-05-06

Family

ID=52907507

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/083780 WO2016065927A1 (zh) 2014-10-30 2015-07-10 将数据对象写入ip硬盘的方法、装置及系统

Country Status (2)

Country Link
CN (1) CN104461378B (zh)
WO (1) WO2016065927A1 (zh)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104461378B (zh) * 2014-10-30 2017-09-26 华为技术有限公司 将数据对象写入ip硬盘的方法、装置及系统
CN107491265B (zh) * 2016-06-12 2021-05-25 杭州海康威视数字技术股份有限公司 分配网际协议ip磁盘的方法及装置
CN108021333B (zh) * 2016-11-03 2021-08-24 阿里巴巴集团控股有限公司 随机读写数据的系统、装置及方法
CN110035307A (zh) * 2019-03-08 2019-07-19 视联动力信息技术股份有限公司 一种分片存储方法和装置
CN113791736A (zh) * 2021-09-15 2021-12-14 京东科技信息技术有限公司 数据迁移方法、网卡设备、服务器及数据迁移系统

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102843396A (zh) * 2011-06-22 2012-12-26 中兴通讯股份有限公司 一种分布式缓存系统中的数据写入及读取方法及装置
CN103761190A (zh) * 2013-12-19 2014-04-30 华为技术有限公司 数据处理方法及装置
CN103942012A (zh) * 2014-03-26 2014-07-23 华为技术有限公司 一种读取数据的方法、装置及设备
CN103973810A (zh) * 2014-05-22 2014-08-06 华为技术有限公司 基于互联网协议ip盘的数据处理方法和装置
US20140304525A1 (en) * 2013-04-01 2014-10-09 Nexenta Systems, Inc. Key/value storage device and method
CN104461378A (zh) * 2014-10-30 2015-03-25 华为技术有限公司 将数据对象写入ip硬盘的方法、装置及系统

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7849259B1 (en) * 2007-02-14 2010-12-07 Marvell International Ltd. Disk controller response handler for write commands
JP2010157300A (ja) * 2009-01-05 2010-07-15 Hitachi Kokusai Electric Inc 映像記録装置
CN103929475B (zh) * 2014-03-27 2017-11-24 华为技术有限公司 一种以太网架构的硬盘存储系统及硬盘数据操作方法
CN104023081B (zh) * 2014-06-19 2018-03-13 华为技术有限公司 网协ip硬盘的数据处理方法及ip硬盘
CN104077239B (zh) * 2014-06-24 2017-04-26 华为技术有限公司 Ip硬盘与存储系统,及其数据操作方法

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102843396A (zh) * 2011-06-22 2012-12-26 中兴通讯股份有限公司 一种分布式缓存系统中的数据写入及读取方法及装置
US20140304525A1 (en) * 2013-04-01 2014-10-09 Nexenta Systems, Inc. Key/value storage device and method
CN103761190A (zh) * 2013-12-19 2014-04-30 华为技术有限公司 数据处理方法及装置
CN103942012A (zh) * 2014-03-26 2014-07-23 华为技术有限公司 一种读取数据的方法、装置及设备
CN103973810A (zh) * 2014-05-22 2014-08-06 华为技术有限公司 基于互联网协议ip盘的数据处理方法和装置
CN104461378A (zh) * 2014-10-30 2015-03-25 华为技术有限公司 将数据对象写入ip硬盘的方法、装置及系统

Also Published As

Publication number Publication date
CN104461378B (zh) 2017-09-26
CN104461378A (zh) 2015-03-25

Similar Documents

Publication Publication Date Title
US20230011387A1 (en) Data processing method and nvme storage device
WO2016065927A1 (zh) 将数据对象写入ip硬盘的方法、装置及系统
US20180349396A1 (en) Managing I/O Operations in a Storage Network
US9846642B2 (en) Efficient key collision handling
JP6316974B2 (ja) フラッシュメモリ圧縮
US11874815B2 (en) Key-value storage device and method of operating the same
US20170351737A1 (en) Methods and systems for autonomous memory searching
JP2019057155A (ja) メモリシステムおよび制御方法
TWI706315B (zh) 儲存元件
CN110235098B (zh) 存储系统访问方法及装置
JP5902323B2 (ja) コンテンツ派生データのメモリ内配置方法および装置
JP2018502343A (ja) データを書き込むようにソリッドステートディスクを制御するためのアレイコントローラ、ソリッドステートディスクおよび方法
CN109144406B (zh) 分布式存储系统中元数据存储方法、系统及存储介质
CN109828930A (zh) 键值存储设备和操作键值存储设备的方法
WO2013107029A1 (zh) 一种基于块存储的数据处理方法、装置及系统
CN110199512B (zh) 存储系统中存储设备的管理方法及装置
WO2019080370A1 (zh) 一种数据读写方法、装置和存储服务器
JP2016177688A (ja) データ処理装置、データ処理方法およびコンピュータプログラム
WO2014153931A1 (zh) 文件存储方法、装置、访问客户端及元数据服务器系统
US20160283379A1 (en) Cache flushing utilizing linked lists
CN110199270B (zh) 存储系统中存储设备的管理方法及装置
JP2018504689A5 (zh)
US20220413707A1 (en) Automatic data separation and placement for compressed data in a storage device
JP2016091222A (ja) データ処理装置、データ処理方法およびプログラム
JP5494363B2 (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: 15855594

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

Country of ref document: EP

Kind code of ref document: A1