CN111435285B - Data writing method and device for storage volume, electronic equipment and machine-readable storage medium - Google Patents

Data writing method and device for storage volume, electronic equipment and machine-readable storage medium Download PDF

Info

Publication number
CN111435285B
CN111435285B CN201910030254.0A CN201910030254A CN111435285B CN 111435285 B CN111435285 B CN 111435285B CN 201910030254 A CN201910030254 A CN 201910030254A CN 111435285 B CN111435285 B CN 111435285B
Authority
CN
China
Prior art keywords
write request
storage volume
data
value
writing
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN201910030254.0A
Other languages
Chinese (zh)
Other versions
CN111435285A (en
Inventor
唐建军
王婵娟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Macrosan Technologies Co Ltd
Original Assignee
Macrosan Technologies Co Ltd
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 Macrosan Technologies Co Ltd filed Critical Macrosan Technologies Co Ltd
Priority to CN201910030254.0A priority Critical patent/CN111435285B/en
Publication of CN111435285A publication Critical patent/CN111435285A/en
Application granted granted Critical
Publication of CN111435285B publication Critical patent/CN111435285B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0604Improving or facilitating administration, e.g. storage management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • G06F3/0656Data buffering arrangements

Abstract

The application provides a data writing method and device for a storage volume, an electronic device and a machine-readable storage medium. In the application, an application program has a write request for the storage volume, and a first write request and a second write request of the application program for the storage volume are acquired; creating a continuous state table corresponding to the storage volume, wherein the continuous state table is used for marking continuous states of the second write request and the first write request, and possible values of the continuous states include: the default value is the second state; if the table entry in the continuous state table in the first state reaches a preset threshold, pre-writing all-zero data on the storage volume is executed, so that data pre-writing is flexibly performed according to a storage IO flow model, and the storage performance is greatly improved.

Description

Data writing method and device for storage volume, electronic equipment and machine-readable storage medium
Technical Field
The present application relates to the field of storage technologies, and in particular, to a method and an apparatus for writing data to a storage volume, an electronic device, and a machine-readable storage medium.
Background
There are some specific applications in the storage domain, and when it accesses the storage volume, the storage model followed is: if the application never writes data to the physical space of the storage volume, the data read by the application from the physical space of the storage volume is expected to be all zeros. Such as: a new virtualization feature vvols (vsphere APIs for Virtual volumes) application of VMware (Virtual Machine ware) is a representative of this type of application program. It can be seen that this type of application does not require pre-initialization of the data stored in the physical space on the storage volume, thereby providing further optimization possibilities for reducing the performance loss of the storage volume.
Disclosure of Invention
The application provides a data writing method of a storage volume, an application program has a writing request to the storage volume, wherein the writing request at least comprises a starting address, a data length and data content, a physical space corresponding to the storage volume comprises one or more blocks, the blocks refer to a plurality of intervals with the same size and dividing the storage volume according to a preset capacity size, and the method comprises the following steps:
acquiring a first write request and a second write request of the application program for the storage volume;
creating a continuous state table corresponding to the storage volume, wherein the continuous state table is used for marking continuous states of the second write request and the first write request, and possible values of the continuous states include: the default value is the second state;
and if the table entry in the continuous state table in the first state reaches a preset threshold value, executing pre-writing all-zero data on the storage volume.
Optionally, the storage volume stores metadata, where the metadata is used to mark whether data of one or more blocks included in a physical space corresponding to the storage volume is in a state of having zero written, and possible values of the metadata include: the first value or the second value, and the default value is the second value.
Optionally, while obtaining the second write request for the storage volume, the method further includes:
acquiring a third write request aiming at the storage volume from a write request cache queue corresponding to the storage volume, wherein the write request cache queue is used for caching concurrent write requests of a plurality of application programs aiming at the storage volume;
and if the continuous state of the third write request and the second write request is the first state, merging the third write request and the second write request, and executing the merged write request.
Optionally, the executing the pre-written all-zero data on the storage volume includes:
creating a pre-written write request, and setting the data content of the pre-written write request to be all zero;
acquiring a starting address A and a data length L of the pre-written write request, wherein A is a starting address of a block next to a block occupied by the second write request, and L is a preset threshold;
and writing the data content of the pre-written write request to a corresponding first physical space in the storage volume based on the initial address and the data length of the pre-written write request.
Optionally, after performing the pre-writing of all-zero data on the storage volume, the method further includes:
and updating the value of the metadata of the one or more blocks contained in the first physical space, which corresponds to the storage volume, to be a first value.
Optionally, the merging the third write request and the second write request, and executing the merged write request includes:
merging the data contents of the third write request and the second write request to obtain a merged write request, wherein the initial address of the merged write request is the smaller of the initial addresses of the third write request and the second write request, and the data length of the merged write request is the sum of the data lengths of the third write request and the second write request;
obtaining values of metadata corresponding to one or more blocks contained in the second physical space corresponding to the merged write request in the storage volume based on the initial address and the data length of the merged write request;
and if the value of the metadata is the first value, executing the combined write request, and writing the data content of the combined write request into the second physical space.
Optionally, the method further includes:
if the value of the metadata is a second value, checking whether the merged write request corresponds to the second physical space and is aligned to a block;
if not, completing the block of the merged write request to obtain a completed write request, wherein the data content corresponding to the completed block of the completed write request is all zero;
writing the data content of the completed writing request to the second physical space based on the initial address and the data length of the completed writing request;
and updating the value of the metadata of the one or more blocks contained in the second physical space, which corresponds to the storage volume, to be a first value.
Optionally, after the data content of the merged write request is written to the second physical space, the method further includes:
and returning corresponding write request completion responses to the second write request and the third write request respectively.
The application further provides a data writing device for a storage volume, an application program has a writing request for the storage volume, the writing request at least includes a start address, a data length and data content, a physical space corresponding to the storage volume includes one or more blocks, the blocks refer to intervals with the same size, divided by preset capacity sizes, of the storage volume, and the device includes:
the acquisition module is used for acquiring a first write request and a second write request of the application program for the storage volume;
a processing module, configured to create a continuous state table corresponding to the storage volume, where the continuous state table is used to mark continuous states of the second write request and the first write request, and possible values of the continuous states include: the default value is the second state; and if the table entry in the continuous state table in the first state reaches a preset threshold value, executing pre-writing all-zero data on the storage volume.
Optionally, the storage volume stores metadata, where the metadata is used to mark whether data of one or more blocks included in a physical space corresponding to the storage volume is in a state of having zero written, and possible values of the metadata include: the first value or the second value, and the default value is the second value.
Optionally, while obtaining the second write request for the storage volume, the method further includes:
the obtaining module is further configured to obtain a third write request for the storage volume from a write request cache queue corresponding to the storage volume, where the write request cache queue is used to cache concurrent write requests of multiple application programs for the storage volume;
the processing module is further configured to merge the third write request and the second write request and execute the merged write request if the continuous status of the third write request and the second write request is the first status.
Optionally, the executing the pre-written all-zero data on the storage volume, where the processing module further includes:
creating a pre-written write request, and setting the data content of the pre-written write request to be all zero;
acquiring a starting address A and a data length L of the pre-written write request, wherein A is a starting address of a block next to a block occupied by the second write request, and L is a preset threshold;
and writing the data content of the pre-written write request to a corresponding first physical space in the storage volume based on the initial address and the data length of the pre-written write request.
Optionally, after performing the pre-writing of all-zero data on the storage volume, the processing module further includes:
and updating the value of the metadata of the one or more blocks contained in the first physical space, which corresponds to the storage volume, to be a first value.
Optionally, the merging the third write request with the second write request, and executing the merged write request, where the processing module further includes:
merging the data contents of the third write request and the second write request to obtain a merged write request, wherein the initial address of the merged write request is the smaller of the initial addresses of the third write request and the second write request, and the data length of the merged write request is the sum of the data lengths of the third write request and the second write request;
obtaining values of metadata corresponding to one or more blocks contained in the second physical space corresponding to the merged write request in the storage volume based on the initial address and the data length of the merged write request;
and if the value of the metadata is the first value, executing the combined write request, and writing the data content of the combined write request into the second physical space.
Optionally, the processing module further includes:
if the value of the metadata is a second value, checking whether the merged write request corresponds to the second physical space and is aligned to a block;
if not, completing the block of the merged write request to obtain a completed write request, wherein the data content corresponding to the completed block of the completed write request is all zero;
writing the data content of the completed writing request to the second physical space based on the initial address and the data length of the completed writing request;
and updating the value of the metadata of the one or more blocks contained in the second physical space, which corresponds to the storage volume, to be a first value.
Optionally, after the data content of the merged write request is written to the second physical space, the method further includes:
and the response module is used for respectively returning corresponding write request completion responses to the second write request and the third write request.
The application also provides an electronic device, which comprises a communication interface, a processor, a memory and a bus, wherein the communication interface, the processor and the memory are mutually connected through the bus;
the memory stores machine-readable instructions, and the processor executes the method by calling the machine-readable instructions.
The present application also provides a machine-readable storage medium having stored thereon machine-readable instructions which, when invoked and executed by a processor, implement the above-described method.
Through the embodiment, the application program has the writing request to the storage volume, and acquires the first writing request and the second writing request of the application program for the storage volume; creating a continuous state table corresponding to the storage volume, wherein the continuous state table is used for marking continuous states of the second write request and the first write request, and possible values of the continuous states include: the default value is the second state; if the table entry in the continuous state table in the first state reaches a preset threshold, pre-writing all-zero data on the storage volume is executed, so that data pre-writing is flexibly performed according to a storage IO flow model, and the storage performance is greatly improved.
Drawings
FIG. 1 is a flowchart of a method for writing data to a storage volume according to an exemplary embodiment.
FIG. 2 is a flow chart of writing data for a storage volume provided by an exemplary embodiment.
FIG. 3 is a block diagram of a data writing apparatus for a storage volume provided in an exemplary embodiment.
Fig. 4 is a hardware block diagram of an electronic device according to an exemplary embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this application and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It is to be understood that although the terms first, second, third, etc. may be used herein to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present application. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
In order to make those skilled in the art better understand the technical solution in the embodiment of the present application, a brief description will be given below of a related technology for writing data to a storage volume according to the embodiment of the present application.
In some scenarios, based on the application described in the background art, if the application never writes data in the physical space of the storage volume, in the prior art, a background zero writing function of the storage volume is usually used to implement that when the application reads the physical space of the storage volume in which data is not written, the returned data is all zeros, where the background zero writing function of the storage volume means that after the storage volume is associated with the application, and before the application triggers to read data from the physical space of the storage volume in which data is not written, the storage device automatically writes all data contents of the physical space of the storage volume in which data is not written to be zeros in the background, specifically: constructing N write requests, wherein each write request comprises all-zero data and the length of the corresponding all-zero data, and determining an N value according to the capacity of a physical space to be written with the all-zero data; and realizing the background zero writing function of the storage volume according to the N writing requests. As can be seen from the above, the prior art scheme has the disadvantage that if the capacity of the physical space in the storage volume in which data is not written is large, it takes a long time to complete the background zero writing of the storage volume; in addition, in the background zero writing process of the storage volume, more resources are consumed, so that the traffic pressure of the storage IO is increased, and the delay of the storage IO of other application programs is possibly abnormally increased.
Based on this, the present application provides a data writing scheme for a storage volume, where the scheme is applied to a storage device, and when an application program has a write request for the storage volume managed by the storage device, where the write request at least includes a start address, a data length, and a data content, a physical space corresponding to the storage volume includes one or more blocks, where the blocks refer to a plurality of intervals with the same size, where the intervals are obtained by dividing the storage volume by a preset capacity size, and the scheme includes: acquiring a first write request and a second write request of the application program for the storage volume; creating a continuous state table corresponding to the storage volume, wherein the continuous state table is used for marking continuous states of the second write request and the first write request, and possible values of the continuous states include: the default value is the second state; and if the table entry in the continuous state table in the first state reaches a preset threshold value, executing pre-writing all-zero data on the storage volume. The data pre-writing is flexibly carried out according to the storage IO flow model, and the storage performance is greatly improved.
The present application is described below with reference to specific embodiments and specific application scenarios.
Referring to fig. 1, fig. 1 is a block diagram illustrating a data writing method for a storage volume, applied to a storage device according to an embodiment of the present disclosure; an application program has a writing request for the storage volume, wherein the writing request at least comprises a starting address, a data length and data content, a physical space corresponding to the storage volume comprises one or more blocks, wherein the blocks refer to a plurality of intervals with the same size and dividing the storage volume according to a preset capacity size, and the method comprises the following steps:
and 102, acquiring a first write request and a second write request of the application program for the storage volume.
The application program herein refers to an application program similar to that described in the above background art, such as: the new virtualization characteristic Vtools of the VMware is applied, and specific application programs are not limited in the application. The storage volume is a LUN (Logical Unit Number) associated with the application, accessible by the application, and managed by the storage device, where the LUN is an entity that provides storage services to the outside by the storage device. The storage volume, that is, the LUN, has a corresponding physical space including one or more blocks, where the blocks refer to a plurality of intervals with the same size, which are obtained by dividing the storage volume according to a preset capacity size, for example: the block size is 512KB (Kilobyte), and the capacity of the physical space corresponding to the storage volume is 100GB (Gigabyte), so that the storage volume is composed of 204800 blocks. The application program has a write request to the storage volume, wherein the write request at least includes a start address, a data length and a data content, the start address is used for marking a certain write request of the application program to write the data content to a storage position of a physical space corresponding to the storage volume, and the data length is the length of the data content.
In addition, a certain physical space reserved by the storage volume is used for storing metadata, where the metadata is used to mark whether data of one or more blocks included in the physical space corresponding to the storage volume is in a "zero written" state, and possible values of the metadata include: the first value or the second value, and the default value is the second value. Specifically, for example: the capacity of a physical space corresponding to the storage volume is 101GB, wherein 1GB of the physical space is used for storing metadata, 100GB of the physical space is used for dividing into 204800 blocks according to a block size of 512KB, wherein a state of whether data of each block of the 204800 blocks is zero written is correspondingly marked by one metadata, and possible values of each metadata include: "written zeros" or "unwritten zeros", the default value for each metadata is "unwritten zeros".
The storage device acquires a first write request and a second write request of the application program for the storage volume, wherein the first write request and the second write request refer to write requests triggered by the same application program, and the second write request is later than the first write request in time sequence; the first write request and the second write request may be a single write request or multiple write requests, and the application is not particularly limited.
Step 104, creating a continuous state table corresponding to the storage volume, where the continuous state table is used to mark continuous states of the second write request and the first write request, and possible values of the continuous states include: the first state or the second state, and the default value is the second state.
Specifically, the storage device creates a continuous state table corresponding to the storage volume, where the continuous state table is used for marking the continuous state of the second write request and the first write request. Taking the second write request and the first write request as a single write request as an example, for example: the starting address A2, the data length L2 and the data content D2 of the second write request, the starting address A1, the data length L1 and the data content D1 of the first write request; the continuous state here means that a2 is a1+ L1, that is, the start address a2 when the second write request writes data to the data content D2 is the sum of the start address a1 and the data length L1 for the first write request to the data content D1. The continuous state table may be implemented based on a bitmap file, where each bit in the bitmap file, that is, the entry of the continuous state table, is used to indicate possible values of the continuous state, including: continuous (bit is 1) or discontinuous (bit is 0), and each bit default value is discontinuous (bit is 0). The total number of bits in the bitmap file is, for example, the statistical number of two adjacent write requests similar to the first write request in the second write request, such as: the storage device obtains 101 write requests in a preset period, if every two adjacent write request pairs are 100, the total number of bit bits in the bitmap file is 100.
And 106, if the table entry in the first state in the continuous state table reaches a preset threshold, executing pre-writing all-zero data on the storage volume.
Specifically, continuing to perform the example based on the example in the step 104, the storage device monitors the continuous state record of the continuous state table, that is, monitors the bitmap file, where the total number of bits in the bitmap file is 100, and detects whether the number of bits with a value of 1 in the bitmap file reaches 70, or whether the ratio of the number of bits with a value of 1 in the bitmap file to the total number of bits of 100 reaches 70%, where the above process is only one example possibility, and a specific preset threshold value or a specific preset threshold value is not limited in this application.
Based on the above process, if the continuous entries in the continuous state table reach the preset threshold, the storage device performs pre-writing all-zero data on the storage volume, including: creating a pre-written write request, and setting the data content of the pre-written write request to be all zero; acquiring a starting address A and a data length L of the pre-written write request, wherein A is a starting address of a block next to a block occupied by the second write request, and L is a preset threshold; and writing the data content of the pre-written write request to a corresponding first physical space in the storage volume based on the initial address and the data length of the pre-written write request. After the pre-writing all-zero data is executed on the storage volume, the storage device updates the value of the metadata of the storage volume corresponding to one or more blocks contained in the first physical space to be a first value.
Specifically, for example: an application program prepares to write data to blocks 8 to 11 of a physical space corresponding to the storage volume in response to a write request R from the storage volume. The storage device creates a pre-written write request for the storage volume, where the pre-written write request is a write request before the write request R, and the pre-written write request writes zero in advance in a block 8 to a block 11 of a corresponding physical space in the storage volume, where the block 8 to the block 11 is written to corresponding to the write request R, that is, the first physical space is a physical space of a corresponding block 8 to a block 11 in the storage volume; and setting the values of the metadata corresponding to the blocks 8 to 11 written in the physical space corresponding to the write request R to be "written with zero" in advance, when the write request R is triggered, the storage device may directly write and store the data content of the write request R, which is called as pre-write.
The storage device obtains a start address a and a data length L of the pre-written write request, where a is a start address of a block next to a block occupied by the second write request, such as: if the second write request corresponds to blocks 3 to 4 of the physical space corresponding to the storage volume to be written, wherein A is the initial address of the block 5, and L is the corresponding length of 8 blocks; the storage device sets the data content of the pre-written write request to be all zero based on the initial address A and the data length L of the pre-written write request, and writes the data content to a physical space corresponding to 8 block lengths in total, corresponding to the blocks 5 to 12 in the storage volume; after the pre-writing of all-zero data is performed on the storage volume, the storage device updates values of metadata corresponding to the blocks 5 to 12 in the storage volume, wherein the value of the metadata corresponding to each block is set to be "zero written".
To this end, the flow shown in fig. 1 is completed, and as can be seen from the flow shown in fig. 1, the storage device acquires a first write request and a second write request of the application program for the storage volume; creating a continuous state table corresponding to the storage volume, wherein the continuous state table is used for marking continuous states of the second write request and the first write request, and possible values of the continuous states include: the default value is the second state; and if the table entry in the continuous state table in the first state reaches a preset threshold value, executing pre-writing all-zero data on the storage volume.
By applying the embodiment of the application, when the storage IO flow model of the write request of the application program to the storage volume is obtained and written sequentially, data can be flexibly pre-written according to the storage IO flow model, and the storage performance is greatly improved.
Optionally, the present application further provides another embodiment of a data writing method for a storage volume. While the storage device obtains the second write request for the storage volume in step 102, the storage device obtains a third write request for the storage volume from a write request cache queue corresponding to the storage volume, where the write request cache queue is used to cache concurrent write requests of multiple applications for the storage volume; and if the continuous state of the third write request and the second write request is the first state, the storage device merges the third write request and the second write request.
Specifically, in some scenarios, when the application program in step 102 is making a second write request to the storage volume, there may be a third write request to the storage volume by other similar application programs, where the third write request may be a single write request or multiple write requests of one or more other similar application programs, and the present application is not limited in particular. Taking a third write request as a single write request as an example, if the continuous states of the third write request and the second write request are continuous, and the meaning of the continuous state is consistent with the meaning of the continuous state in step 102, which is not described herein again, the storage device merges the third write request and the second write request into a new write request.
Based on the above process, the storage device obtains the write request after executing the merge, and completes a flow of writing data of the storage volume, as illustrated in fig. 2, the following steps are executed:
step 202, obtain the merged write request.
And the storage device merges the data contents of the third write request and the second write request to obtain a merged write request, wherein the initial address of the merged write request is the smaller of the initial addresses of the third write request and the second write request, and the data length of the merged write request is the sum of the data lengths of the third write request and the second write request.
Specifically, for example: the starting address A2, the data length L2 and the data content D2 of the second write request, and the starting address A3, the data length L3 and the data content D3 of the third write request; the continuous state of the third write request and the second write request refers to a condition that A3 is a2+ L2 or a2 is A3+ L3, and taking a2 is smaller than A3 as an example, the start address of the merged write request is a2, the data length is L2, the sum L23 of L3, and the data content is D2 and D3 which are spliced together to obtain D23.
And 204, acquiring a value of metadata corresponding to the second physical space of the storage volume based on the combined write request.
And the storage equipment acquires the value of the metadata corresponding to one or more blocks contained in the second physical space corresponding to the merged write request in the storage volume based on the initial address and the data length of the merged write request.
Specifically, continuing with the example of step 202, based on the merged write request T having the starting address a2 and the data length L23, the storage device writes data to the blocks 20 to 30 of the physical space of the storage volume, that is, the second physical space is the corresponding physical space of the blocks 20 to 30 of the storage volume; the storage device obtains values of metadata corresponding to blocks 20 to 30 correspondingly included in the physical space to be written in the storage volume corresponding to the write request T, for example: the values of the metadata corresponding to the blocks 20 to 30 may be all "written zeros" or all "unwritten zeros".
And step 206, executing the merged write request based on the value taking condition of the metadata.
Optionally, in an embodiment 1 shown, if the value of the metadata is a first value, the storage device executes the merged write request, and writes the data content of the merged write request into the second physical space.
Specifically, continuing with the example shown in step 204, if the value of the metadata is "zero written", the storage device executes the merged write request T, and writes the data content D23 of the merged write request into the blocks 20 to 30 included in the physical space of the storage volume, that is, the second physical space corresponding to the storage volume with the start address of a2 and the data length of L23.
Optionally, in another shown embodiment 2, if the value of the metadata is a second value, the storage device checks whether the merged write request corresponds to the second physical space and is block aligned; if not, completing the block of the merged write request to obtain a completed write request, wherein the data content corresponding to the completed block of the completed write request is all zero; writing the data content of the completed writing request to the second physical space based on the initial address and the data length of the completed writing request; and updating the value of the metadata of the one or more blocks contained in the second physical space, which corresponds to the storage volume, to be a first value.
Specifically, continuing with the example shown in the above step as an example, if the value of the metadata is "unwritten zero", the storage device checks whether the data content D23 of the write request T is chunk aligned, where chunk aligned means whether the data capacity of D23 is an integer multiple of one chunk capacity, such as: one block size is 512KB and the data size of D23 is 5632KB, then the data size of D23 occupies exactly 11 blocks in its entirety, i.e. block alignment. For another example: one block size is 512KB, the data size of D23 is 5121KB, then the data size of D23 occupies 10 blocks completely, the 11 th block occupies only 1KB, and there is 511KB of unoccupied space, i.e. the blocks are not aligned. If the data content D23 blocks of the write request T are aligned, that is, the data capacity of D23 occupies exactly 11 blocks completely, the storage device executes the merged write request T, which is executed in the manner described in the above embodiment 1 and is not described again in detail; if the data content D23 blocks of the write request T are not aligned, for example: if the data capacity of D23 is 5121KB, the data capacity of D23 completely occupies 10 blocks, the 11 th block only occupies 1KB, and the 511KB space is not occupied, the storage device completes the remaining 511KB space in the 11 th block and sets the corresponding data content to all zeros; the storage device writes the data content of the completed write request, i.e., D23 and 511KB all-zero data, into a physical space of 11 block lengths in total, i.e., a second physical space, corresponding to the blocks 20 to 30 included in the production volume.
Optionally, in another illustrated embodiment, after the data content of the merged write request is written to the second physical space, corresponding write request completion responses are respectively returned for the second write request and the third write request.
Specifically, as described in the steps of the two embodiments (embodiment 1 and embodiment 2), after the data content of the write request T is written to the second physical space of the blocks 20 to 30 correspondingly included in the production volume, the storage device respectively returns corresponding write request completion responses to the plurality of application programs triggering the second write request and the third write request.
By applying the embodiment of the application, when the storage IO traffic model of the write request of the application program to the storage volume is obtained and written in the concurrent sequence, data write merging, block alignment and data zero padding are flexibly performed according to the storage IO traffic model, and the storage performance is greatly improved.
FIG. 3 is a block diagram of a data writing apparatus for a storage volume according to an exemplary embodiment of the present application. Corresponding to the foregoing method embodiment, the present application further provides an embodiment of a data writing device for a storage volume, where an application program has a writing request for the storage volume, where the writing request at least includes a start address, a data length, and a data content, and a physical space corresponding to the storage volume includes one or more blocks, where the blocks refer to a plurality of intervals with the same size that divide the storage volume according to a preset capacity size, and please refer to an example 30 of a data writing device for a storage volume illustrated in fig. 3, where the device includes:
an obtaining module 301, configured to obtain a first write request and a second write request of the application program for the storage volume;
a processing module 302, configured to create a continuous state table corresponding to the storage volume, where the continuous state table is used to mark continuous states of the second write request and the first write request, and possible values of the continuous states include: the default value is the second state; and if the table entry in the continuous state table in the first state reaches a preset threshold value, executing pre-writing all-zero data on the storage volume.
In this embodiment, the storage volume stores metadata, where the metadata is used to mark whether data of one or more blocks included in a physical space corresponding to the storage volume is in a zero-written state, and possible values of the metadata include: the first value or the second value, and the default value is the second value.
In this embodiment, while obtaining the second write request for the storage volume, the method further includes:
the obtaining module 301 further obtains a third write request for the storage volume from a write request cache queue corresponding to the storage volume, where the write request cache queue is used to cache concurrent write requests of multiple application programs for the storage volume;
the processing module 302 further merges the third write request and the second write request if the continuous status of the third write request and the second write request is the first status, and executes the merged write request.
In this embodiment, the performing pre-write all-zero data on the storage volume, and the processing module 302 further includes:
creating a pre-written write request, and setting the data content of the pre-written write request to be all zero;
acquiring a starting address A and a data length L of the pre-written write request, wherein A is a starting address of a block next to a block occupied by the second write request, and L is a preset threshold;
and writing the data content of the pre-written write request to a corresponding first physical space in the storage volume based on the initial address and the data length of the pre-written write request.
In this embodiment, after performing pre-write all-zero data on the storage volume, the processing module 302 further includes:
and updating the value of the metadata of the one or more blocks contained in the first physical space, which corresponds to the storage volume, to be a first value.
In this embodiment, the merging the third write request with the second write request, and executing the merged write request, where the processing module 302 further includes:
merging the data contents of the third write request and the second write request to obtain a merged write request, wherein the initial address of the merged write request is the smaller of the initial addresses of the third write request and the second write request, and the data length of the merged write request is the sum of the data lengths of the third write request and the second write request;
obtaining values of metadata corresponding to one or more blocks contained in the second physical space corresponding to the merged write request in the storage volume based on the initial address and the data length of the merged write request;
and if the value of the metadata is the first value, executing the combined write request, and writing the data content of the combined write request into the second physical space.
In this embodiment, the processing module 302 further includes:
if the value of the metadata is a second value, checking whether the merged write request corresponds to the second physical space and is aligned to a block;
if not, completing the block of the merged write request to obtain a completed write request, wherein the data content corresponding to the completed block of the completed write request is all zero;
writing the data content of the completed writing request to the second physical space based on the initial address and the data length of the completed writing request;
and updating the value of the metadata of the one or more blocks contained in the second physical space, which corresponds to the storage volume, to be a first value.
In this embodiment, after the data content of the merged write request is written to the second physical space, the method further includes:
a response module 303, configured to return, for the second write request and the third write request, a corresponding write request completion response respectively.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, wherein the modules described as separate parts may or may not be physically separate, and the parts displayed as modules may or may not be physical modules, may be located in one place, or may be distributed on a plurality of network modules. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of the application. One of ordinary skill in the art can understand and implement it without inventive effort.
The systems, devices, modules or modules illustrated in the above embodiments may be implemented by a computer chip or an entity, or by an article of manufacture with certain functionality. A typical implementation device is a computer, which may take the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email messaging device, game console, tablet computer, wearable device, or a combination of any of these devices.
The embodiment of the storage volume data writing device of the present application can be applied to the electronic device shown in fig. 4. The device embodiments may be implemented by software, or by hardware, or by a combination of hardware and software. Taking a software implementation as an example, as a logical device, the device is a machine executable instruction formed by reading a corresponding computer program instruction in a machine readable storage medium through a processor of the electronic device where the device is located and then running the computer program instruction. In terms of hardware, as shown in fig. 4, a hardware structure diagram of an electronic device where a data writing apparatus for a storage volume is located in the present application is shown, except for the processor, the communication interface, the bus and the machine-readable storage medium shown in fig. 4, the electronic device where the apparatus is located in the embodiment may also include other hardware according to an actual function of the electronic device, which is not described again.
Correspondingly, an embodiment of the present application further provides a hardware structure of an electronic device of the apparatus shown in fig. 3, please refer to fig. 4, and fig. 4 is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. The apparatus comprises: a communication interface 401, a processor 402, a machine-readable storage medium 403, and a bus 404; the communication interface 401, the processor 402 and the machine-readable storage medium 403 are configured to communicate with each other via a bus 404. The communication interface 401 is used for performing network communication. The processor 402 may be a Central Processing Unit (CPU), and the processor 402 may execute machine-readable instructions stored in a machine-readable storage medium 403 to implement the methods described above.
The machine-readable storage medium 403 referred to herein may be any electronic, magnetic, optical, or other physical storage device that can contain or store information such as executable instructions, data, and the like. For example, the machine-readable storage medium may be: volatile memory, non-volatile memory, or similar storage media. In particular, the machine-readable storage medium 403 may be a RAM (random Access Memory), a flash Memory, a storage drive (e.g., a hard disk drive), a solid state disk, any type of storage disk (e.g., a compact disk, a DVD, etc.), or similar storage medium, or a combination thereof.
Up to this point, the description of the hardware configuration shown in fig. 4 is completed.
Further, the present application provides a machine-readable storage medium, such as machine-readable storage medium 403 in fig. 4, including machine-executable instructions, which can be executed by processor 402 in the data processing apparatus to implement the data processing method described above.
The implementation process of the functions and actions of each unit in the above device is specifically described in the implementation process of the corresponding step in the above method, and is not described herein again.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It will be understood that the present application is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the application is limited only by the appended claims.
The above description is only exemplary of the present application and should not be taken as limiting the present application, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the scope of protection of the present application.

Claims (18)

1. A method for writing data of a storage volume is characterized in that an application program has a writing request for the storage volume, wherein the writing request at least comprises a starting address, a data length and data content, a physical space corresponding to the storage volume comprises one or more blocks, wherein the blocks refer to a plurality of intervals with the same size and are obtained by dividing the storage volume according to a preset capacity size, and the method comprises the following steps:
acquiring a first write request and a second write request of the application program for the storage volume in a preset period; wherein the second write request is later in time sequence than the first write request;
creating a continuous state table corresponding to the storage volume, wherein the continuous state table is used for marking continuous states of the second write request and the first write request, the continuous states are a first state or a second state, and a default value is the second state;
and if the table entry in the continuous state table in the first state reaches a preset threshold value, executing pre-writing all-zero data on the storage volume.
2. The method according to claim 1, wherein the storage volume stores metadata, wherein the metadata is used to mark whether data of one or more blocks included in the physical space corresponding to the storage volume is in a zero-written state, the metadata is a first value or a second value, and a default value is the second value.
3. The method of claim 2, further comprising, while obtaining the second write request to the storage volume:
acquiring a third write request aiming at the storage volume from a write request cache queue corresponding to the storage volume, wherein the write request cache queue is used for caching concurrent write requests of a plurality of application programs aiming at the storage volume;
and if the continuous state of the third write request and the second write request is the first state, merging the third write request and the second write request, and executing the merged write request.
4. The method of claim 2, wherein the performing pre-write all-zero data on the storage volume comprises:
creating a pre-written write request, and setting the data content of the pre-written write request to be all zero;
acquiring a starting address A and a data length L of the pre-written write request, wherein A is a starting address of a block next to a block occupied by the second write request, and L is a preset length threshold;
and writing the data content of the pre-written write request to a corresponding first physical space in the storage volume based on the initial address and the data length of the pre-written write request.
5. The method of claim 4, further comprising, after the performing pre-writing all-zero data on the storage volume:
and updating the value of the metadata of the one or more blocks contained in the first physical space, which corresponds to the storage volume, to be a first value.
6. The method of claim 3, wherein merging the third write request with the second write request, and wherein executing the merged write request comprises:
merging the data contents of the third write request and the second write request to obtain a merged write request, wherein the initial address of the merged write request is the smaller of the initial addresses of the third write request and the second write request, and the data length of the merged write request is the sum of the data lengths of the third write request and the second write request;
obtaining values of metadata corresponding to one or more blocks contained in the second physical space corresponding to the merged write request in the storage volume based on the initial address and the data length of the merged write request;
and if the value of the metadata is the first value, executing the combined write request, and writing the data content of the combined write request into the second physical space.
7. The method of claim 6, further comprising:
if the value of the metadata is a second value, checking whether the merged write request corresponds to the second physical space and is aligned to a block;
if not, completing the block of the merged write request to obtain a completed write request, wherein the data content corresponding to the completed block of the completed write request is all zero;
writing the data content of the completed writing request to the second physical space based on the initial address and the data length of the completed writing request;
and updating the value of the metadata of the one or more blocks contained in the second physical space, which corresponds to the storage volume, to be a first value.
8. The method according to claim 6 or 7, wherein after the data content of the merged write request is written to the second physical space, further comprising:
and returning corresponding write request completion responses to the second write request and the third write request respectively.
9. A data writing device of a storage volume is characterized in that an application program has a writing request to the storage volume, wherein the writing request at least comprises a starting address, a data length and data content, a physical space corresponding to the storage volume comprises one or more blocks, wherein the blocks refer to a plurality of intervals with the same size and are used for dividing the storage volume according to a preset capacity size, and the device comprises:
the acquisition module is used for acquiring a first write request and a second write request of the application program for the storage volume in a preset period; wherein the second write request is later in time sequence than the first write request;
the processing module is used for creating a continuous state table corresponding to the storage volume, wherein the continuous state table is used for marking the continuous states of the second write request and the first write request, the continuous states are first states or second states, and a default value is a second state; and if the table entry in the continuous state table in the first state reaches a preset threshold value, executing pre-writing all-zero data on the storage volume.
10. The apparatus according to claim 9, wherein the storage volume stores metadata, the metadata is used to mark whether data of one or more blocks included in the physical space corresponding to the storage volume is in a zero-written state, the metadata is a first value or a second value, and a default value is the second value.
11. The apparatus of claim 10, further comprising, while obtaining the second write request to the storage volume:
the obtaining module is further configured to obtain a third write request for the storage volume from a write request cache queue corresponding to the storage volume, where the write request cache queue is used to cache concurrent write requests of multiple application programs for the storage volume;
the processing module is further configured to merge the third write request and the second write request and execute the merged write request if the continuous status of the third write request and the second write request is the first status.
12. The apparatus of claim 10, wherein the means for performing pre-write all-zero data on the storage volume further comprises:
creating a pre-written write request, and setting the data content of the pre-written write request to be all zero;
acquiring a starting address A and a data length L of the pre-written write request, wherein A is a starting address of a block next to a block occupied by the second write request, and L is a preset length threshold;
and writing the data content of the pre-written write request to a corresponding first physical space in the storage volume based on the initial address and the data length of the pre-written write request.
13. The apparatus of claim 12, wherein after the performing the pre-write all-zeros data on the storage volume, the processing module further comprises:
and updating the value of the metadata of the one or more blocks contained in the first physical space, which corresponds to the storage volume, to be a first value.
14. The apparatus of claim 11, wherein the means for merging the third write request with the second write request and executing the merged write request further comprises:
merging the data contents of the third write request and the second write request to obtain a merged write request, wherein the initial address of the merged write request is the smaller of the initial addresses of the third write request and the second write request, and the data length of the merged write request is the sum of the data lengths of the third write request and the second write request;
obtaining values of metadata corresponding to one or more blocks contained in the second physical space corresponding to the merged write request in the storage volume based on the initial address and the data length of the merged write request;
and if the value of the metadata is the first value, executing the combined write request, and writing the data content of the combined write request into the second physical space.
15. The apparatus of claim 14, wherein the processing module further comprises:
if the value of the metadata is a second value, checking whether the merged write request corresponds to the second physical space and is aligned to a block;
if not, completing the block of the merged write request to obtain a completed write request, wherein the data content corresponding to the completed block of the completed write request is all zero;
writing the data content of the completed writing request to the second physical space based on the initial address and the data length of the completed writing request;
and updating the value of the metadata of the one or more blocks contained in the second physical space, which corresponds to the storage volume, to be a first value.
16. The apparatus according to claim 14 or 15, further comprising, after the data content of the merged write request is written to the second physical space:
and the response module is used for respectively returning corresponding write request completion responses to the second write request and the third write request.
17. An electronic device is characterized by comprising a communication interface, a processor, a memory and a bus, wherein the communication interface, the processor and the memory are connected with each other through the bus;
the memory has stored therein machine-readable instructions, the processor executing the method of any of claims 1 to 8 by calling the machine-readable instructions.
18. A machine-readable storage medium having stored thereon machine-readable instructions which, when invoked and executed by a processor, carry out the method of any of claims 1 to 8.
CN201910030254.0A 2019-01-14 2019-01-14 Data writing method and device for storage volume, electronic equipment and machine-readable storage medium Active CN111435285B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910030254.0A CN111435285B (en) 2019-01-14 2019-01-14 Data writing method and device for storage volume, electronic equipment and machine-readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910030254.0A CN111435285B (en) 2019-01-14 2019-01-14 Data writing method and device for storage volume, electronic equipment and machine-readable storage medium

Publications (2)

Publication Number Publication Date
CN111435285A CN111435285A (en) 2020-07-21
CN111435285B true CN111435285B (en) 2022-04-22

Family

ID=71579981

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910030254.0A Active CN111435285B (en) 2019-01-14 2019-01-14 Data writing method and device for storage volume, electronic equipment and machine-readable storage medium

Country Status (1)

Country Link
CN (1) CN111435285B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104268036A (en) * 2014-10-13 2015-01-07 浪潮电子信息产业股份有限公司 Snapshot volume reading method based on zero copy
US9176675B1 (en) * 2013-12-05 2015-11-03 Emc Corporation Fast-zeroing in a file system
US10037157B1 (en) * 2016-12-22 2018-07-31 EMC IP Holding Company LLC Techniques for migrating to a thinly-provisioned logical disk without writing zero blocks

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8275970B2 (en) * 2008-05-15 2012-09-25 Microsoft Corp. Optimizing write traffic to a disk
JP5712713B2 (en) * 2011-03-18 2015-05-07 富士通株式会社 Control device, control method, and storage device
US9323943B2 (en) * 2013-04-30 2016-04-26 Hewlett Packard Enterprise Development Lp Decrypt and encrypt data of storage device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9176675B1 (en) * 2013-12-05 2015-11-03 Emc Corporation Fast-zeroing in a file system
CN104268036A (en) * 2014-10-13 2015-01-07 浪潮电子信息产业股份有限公司 Snapshot volume reading method based on zero copy
US10037157B1 (en) * 2016-12-22 2018-07-31 EMC IP Holding Company LLC Techniques for migrating to a thinly-provisioned logical disk without writing zero blocks

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
一种改进的RAID 后台初始化技术;宋戈;《计算机与数字工程》;20100331;1-18 *

Also Published As

Publication number Publication date
CN111435285A (en) 2020-07-21

Similar Documents

Publication Publication Date Title
JP5647203B2 (en) Memory page management
CN109902034B (en) Snapshot creating method and device, electronic equipment and machine-readable storage medium
US9710283B2 (en) System and method for pre-storing small data files into a page-cache and performing reading and writing to the page cache during booting
CN109804359A (en) For the system and method by write back data to storage equipment
CN109614055B (en) Snapshot creating method and device, electronic equipment and machine-readable storage medium
CN109710587A (en) Data hierarchy method, system, equipment and medium based on Ceph
TW201941197A (en) Hybrid memory system
US10198352B2 (en) Efficient pointer swizzling for persistent objects
CN111158602A (en) Data layered storage method, data reading method, storage host and storage system
KR20220125198A (en) Data additional writing method, apparatus, electronic device, storage medium and computer programs
US11237761B2 (en) Management of multiple physical function nonvolatile memory devices
CN112925606A (en) Memory management method, device and equipment
CN112015343B (en) Cache space management method and device of storage volume and electronic equipment
CN107102900B (en) Management method of shared memory space
CN109739688B (en) Snapshot resource space management method and device and electronic equipment
CN109727629B (en) Method and system for wear leveling using multiple gap progress fields
CN111435285B (en) Data writing method and device for storage volume, electronic equipment and machine-readable storage medium
CN111435331B (en) Data writing method and device for storage volume, electronic equipment and machine-readable storage medium
CN104252415B (en) Method and system for redistributing data
CN115168259A (en) Data access method, device, equipment and computer readable storage medium
CN114610654A (en) Solid-state storage device and method for writing data into solid-state storage device
CN111913664B (en) Data writing method and device
CN110287064B (en) Method and device for restoring disk data and electronic equipment
KR20220088274A (en) Computing System including Per-core journal structure
US20160140034A1 (en) Devices and methods for linked list array hardware implementation

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant