[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN112882659A - Information obtaining method and device, electronic equipment and storage medium - Google Patents

Information obtaining method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN112882659A
CN112882659A CN202110220826.9A CN202110220826A CN112882659A CN 112882659 A CN112882659 A CN 112882659A CN 202110220826 A CN202110220826 A CN 202110220826A CN 112882659 A CN112882659 A CN 112882659A
Authority
CN
China
Prior art keywords
information
storage area
disk
target storage
offset information
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.)
Granted
Application number
CN202110220826.9A
Other languages
Chinese (zh)
Other versions
CN112882659B (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.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital Technology 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 Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN202110220826.9A priority Critical patent/CN112882659B/en
Publication of CN112882659A publication Critical patent/CN112882659A/en
Application granted granted Critical
Publication of CN112882659B publication Critical patent/CN112882659B/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/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • 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]

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)
  • Signal Processing For Digital Recording And Reproducing (AREA)

Abstract

The embodiment of the application provides an information obtaining method, an information obtaining device, electronic equipment and a storage medium, which relate to the technical field of computers and comprise the following steps: obtaining offset information of a write pointer of a target storage area, wherein the target storage area is as follows: an area in the magnetic disk for continuously storing data in a data storage order, the obtained offset information being consistent with reference offset information, the reference offset information being: offset information of a write pointer of the target storage area, recorded in the firmware information of the disk, the offset information characterizing: the position indicated by the write pointer of the target storage area and used for writing data to be written is offset relative to the initial writing position of the target storage area; and obtaining the disk information of the target storage area in the disk according to the obtained offset information of the write pointer. Therefore, by applying the information obtaining scheme provided by the embodiment of the application, the extra storage overhead of the disk can be reduced.

Description

Information obtaining method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to an information obtaining method and apparatus, an electronic device, and a storage medium.
Background
As information grows, disks are becoming more widely used to store information. When a magnetic disk is used, it is usually necessary to obtain disk information such as disk occupation space, remaining storage space, whether data is synchronized, and the like of the magnetic disk.
In the related art, in order to obtain the disk information, it is generally necessary to record information of data stored in and taken out of the disk, and determine the disk information based on the information of the data. Taking the remaining storage space as an example, it is usually necessary to record size information of data stored in and retrieved from the disk in the disk, and when the remaining storage space needs to be obtained, the remaining storage space of the disk is calculated according to the size information recorded in the disk and the total storage space of the disk.
Although the disk information can be obtained by applying the prior art, the additional storage overhead of the disk is increased because the information of the data stored in and taken out of the disk needs to be additionally recorded in the disk.
Disclosure of Invention
An object of the embodiments of the present application is to provide an information obtaining method, an information obtaining apparatus, an electronic device, and a storage medium, so as to reduce extra storage overhead of a disk. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present application provides an information obtaining method, where the method includes:
obtaining offset information of a write pointer of a target storage area, wherein the target storage area is as follows: an area in the magnetic disk for continuously storing data in a data storage order, the obtained offset information being consistent with reference offset information, the reference offset information being: offset information of a write pointer of the target storage area, recorded in the firmware information of the disk, the offset information characterizing: the position indicated by the write pointer of the target storage area and used for writing data to be written is offset relative to the initial writing position of the target storage area;
and obtaining the disk information of the target storage area in the disk according to the obtained offset information of the write pointer.
In an embodiment of the application, the obtaining offset information of the write pointer of the target storage area includes:
obtaining offset information of a write pointer of a target storage area cached in a memory, wherein the offset information cached in the memory is updated along with updating of data in the disk, and initial information of the offset information cached in the memory is: before updating the data in the disk, reading offset information from the firmware information of the disk;
or
And obtaining offset information of a write pointer of the target storage area recorded in the firmware information.
In an embodiment of the application, the obtaining, according to the obtained offset information of the write pointer, disk information of a target storage area in the disk includes:
and determining the residual storage space of the target storage area of the magnetic disk according to the obtained offset information of the write pointer and the space size of the target storage area.
In an embodiment of the present application, in a case that the disk is a disk in a disk array, the obtaining, according to the obtained offset information of the write pointer, disk information of a target storage area in the disk includes:
and judging whether the offset information of the write pointer in each target storage area is consistent or not aiming at the target storage area belonging to the same strip in each disk of the disk array, if so, determining that the data state information of the target storage area belonging to the strip is in a synchronous state, and otherwise, determining that the data state information of the target storage area belonging to the strip is in an asynchronous state.
In one embodiment of the present application, the method further comprises:
obtaining the offset information variable quantity of a write pointer of a target storage area in which data updating occurs in a magnetic disk;
and updating the disk information of the target storage area based on the obtained offset information variation.
In a second aspect, an embodiment of the present application provides an information obtaining apparatus, where the apparatus includes:
an offset information obtaining module, configured to obtain offset information of a write pointer of a target storage area, where the target storage area is: an area in the magnetic disk for continuously storing data in a data storage order, the obtained offset information being consistent with reference offset information, the reference offset information being: offset information of a write pointer of the target storage area, recorded in the firmware information of the disk, the offset information characterizing: the position indicated by the write pointer of the target storage area and used for writing data to be written is offset relative to the initial writing position of the target storage area;
and the disk information obtaining module is used for obtaining the disk information of the target storage area in the disk according to the obtained offset information of the write pointer.
In an embodiment of the application, the offset information obtaining module is specifically configured to:
obtaining offset information of a write pointer of a target storage area cached in a memory, wherein the offset information cached in the memory is updated along with updating of data in the disk, and initial information of the offset information cached in the memory is: before updating the data in the disk, reading offset information from the firmware information of the disk;
or
And obtaining offset information of a write pointer of the target storage area recorded in the firmware information.
In an embodiment of the present application, the disk information obtaining module is specifically configured to:
and determining the residual storage space of the target storage area of the magnetic disk according to the obtained offset information of the write pointer and the space size of the target storage area.
In an embodiment of the present application, the disk information obtaining module is specifically configured to:
and under the condition that the magnetic disks are in the magnetic disk array, judging whether offset information of write pointers in each target storage area is consistent or not aiming at the target storage area belonging to the same strip in each magnetic disk of the magnetic disk array, if so, determining that the data state information of the target storage area belonging to the strip is in a synchronous state, and otherwise, determining that the data state information of the target storage area belonging to the strip is in an asynchronous state.
In an embodiment of the present application, the apparatus further includes a disk information updating module, configured to:
obtaining the offset information variable quantity of a write pointer of a target storage area in which data updating occurs in a magnetic disk;
and updating the disk information of the target storage area based on the obtained offset information variation.
In a third aspect, an embodiment of the present application provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor and the communication interface complete communication between the memory and the processor through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of the first aspect when executing a program stored in the memory.
In a fourth aspect, the present application provides a computer-readable storage medium, in which a computer program is stored, and the computer program, when executed by a processor, implements the method steps of any one of the first aspect.
The present invention also provides a computer program product containing instructions, which when run on a computer, causes the computer to execute any of the information obtaining methods described above.
The embodiment of the application has the following beneficial effects:
when the scheme provided by the embodiment of the application is applied to obtain the disk information, firstly, the offset information of the write pointer of the target storage area is obtained, wherein the target storage area is as follows: an area in the magnetic disk for continuously storing data in a data storage order, the obtained offset information being consistent with reference offset information: and offset information of a write pointer of the target storage area, recorded in the firmware information of the magnetic disk, wherein the offset information represents: the position for writing data to be written, which is indicated by the write pointer of the target storage area, is offset from the initial writing position of the target storage area; and obtaining the disk information of the target storage area in the disk according to the obtained offset information of the write pointer. The target storage area supports sequential data writing, and the offset information of the write pointer of the target storage area can represent the offset of the position for writing the data to be written, that is, the offset information can represent the size of the stored data in the target storage area, so that the disk information of the target storage area in the disk can be obtained according to the size of the stored data. The disk information of the target storage area can be obtained according to the offset information of the write pointer, and the firmware information of the disk can record the offset information of the write pointer of the target storage area, so that the offset information of the write pointer is recorded without occupying extra storage overhead in the disk. Therefore, by applying the information obtaining scheme provided by the embodiment of the application, the extra storage overhead of the disk can be reduced.
In addition, because the size information of the data stored in and taken out of the disk does not need to be additionally recorded in the disk, the read-write operation on the disk caused by recording the information can be saved, the overhead of extra computing resources can be saved, and the influence of the read-write operation on the service life of the disk is reduced.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art that other embodiments can be obtained by using the drawings without creative efforts.
Fig. 1 is a schematic flowchart of an information obtaining method according to an embodiment of the present disclosure;
fig. 2 is a schematic diagram of a storage area according to an embodiment of the present disclosure;
FIG. 3 is a schematic diagram of a disk array according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of an information obtaining apparatus according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In order to reduce the additional storage overhead of a disk, embodiments of the present application provide an information obtaining method, an information obtaining apparatus, an electronic device, and a storage medium, which are described in detail below.
Referring to fig. 1, fig. 1 is a schematic flowchart of an information obtaining method provided in an embodiment of the present application, where the method may be applied to electronic devices such as an electronic computer, a file storage server, an NVR (Network Video Recorder), a DVR (Digital Video Recorder), and a Digital Video Recorder. The information obtaining method may include the following steps 101 and 102.
Step 101, obtaining offset information of a write pointer of a target storage area.
Wherein, the target storage area is: and an area in the magnetic disk for successively storing data in a data storage order.
The obtained offset information is consistent with reference offset information, and the reference offset information is: and offset information of a write pointer of the target storage area recorded in the firmware information of the magnetic disk. Specifically, the firmware information of the disk may record offset information of the write pointer of the target storage area in the disk, and the offset information obtained in step 101 is consistent with the offset information of the write pointer of the target storage area recorded in the firmware information.
And (3) representing the offset information: the location indicated by the write pointer of the target storage area for writing the data to be written, offset from the initial write location of the target storage area.
In an embodiment of the present application, the magnetic disk may include a target storage area and a non-target storage area, the target storage area may be used for continuously storing data according to a data storage order, and the non-target storage area may store data randomly.
In addition, only the target storage area may be included in the magnetic disk.
The disk may be a HM-SMR (Host Managed shifted Magnetic Recording) disk that includes a CMR (conventional Magnetic Recording) area and a SMR (shifted Magnetic Recording) area.
Wherein the CMR area may comprise at least one storage area, each storage area supporting random write data.
The SMR area also includes at least one storage area, each storage area supporting sequential writing of data, and each storage area having a write pointer therein, the write pointer being capable of indicating: the position in the storage area for writing data to be written, an offset from the initial writing position of the storage area.
And, the information of the storage area of the SMR area and the information of the write pointer in the HM-SMR disk may be exposed to the outside, that is, the electronic device may retrieve the information. For convenience of description, the storage area is referred to as a target storage area, that is, the target storage area is: areas of the magnetic disk where data are written successively in the data storage order based on the write pointer. The magnetic disk may include one target storage area or a plurality of target storage areas. If the magnetic disk includes a plurality of target storage areas, the space sizes of different target storage areas may be the same or different.
Referring to fig. 2, fig. 2 is a schematic diagram of a storage area according to an embodiment of the present disclosure, as shown in fig. 2, a position indicated by a write pointer is a position to which data is to be written, and since the storage area supports writing data in order, that is, writing data from left to right, the position indicated by the write pointer gradually shifts to the right as the data is written into the storage area. The space to the left of the position indicated by the write pointer in the target storage area is the space where data has been written, and the space to the right is the space where data has not been written. Since the offset of the position indicated by the write pointer from the initial writing position is related to the size of the stored data in the storage area, the offset information can represent the size of the stored data in the storage area.
Specifically, the firmware information of the magnetic disk has offset information of the write pointer of the target storage area recorded therein, and the offset information of the write pointer of the target storage area may be obtained in various ways, so that the obtained offset information coincides with the offset information recorded in the firmware information of the magnetic disk.
For example, offset information of a write pointer of a target storage area recorded in firmware information may be directly read; the read information may be stored in a memory of the electronic device, and offset information of the write pointer may be obtained from the memory. The details will be described later.
In one embodiment of the present application, when the disk is used for the first time, offset information of a write pointer of a target storage area in the disk may be initialized first, so that a position indicated by the write pointer for writing data to be written is at an initial writing position of the target storage area.
And 102, acquiring the disk information of the target storage area in the disk according to the acquired offset information of the write pointer.
The disk information may be one or a combination of more of occupied storage space, remaining storage space, data status information, and the like.
The data state information is used for reflecting: the data in the target storage area is in a synchronized state or a non-synchronized state. In the case where the disk includes a plurality of target storage areas, the synchronization status represents: the offset information of the write pointer of each target storage area in the disk is the same, namely the occupied storage space in each target storage area is the same; and (3) representing the asynchronous state: the offset information of the write pointers of the target storage areas in the respective disks is not identical, i.e. the occupied storage space in the respective target storage areas is not identical.
Specifically, as described above, the offset information of the write pointer may represent the size of the data stored in the target storage area, and therefore, according to the offset information, the disk information of the target storage area of the disk, such as the occupied storage space, the remaining storage space, and the like, may be obtained.
When the scheme provided by the embodiment is applied to obtain the disk information, the target storage area supports sequential data writing, and the offset information of the write pointer of the target storage area can represent the offset of the position for writing the data to be written, that is, the offset information can represent the size of the stored data in the target storage area, so that the disk information of the target storage area in the disk can be obtained according to the size of the stored data. The disk information of the target storage area can be obtained according to the offset information of the write pointer, and the firmware information of the disk can record the offset information of the write pointer of the target storage area, so that the offset information of the write pointer is recorded without occupying extra storage overhead in the disk. Therefore, by applying the information obtaining scheme provided by the embodiment of the application, the extra storage overhead of the disk can be reduced.
In addition, because the size information of the data stored in and taken out of the disk does not need to be additionally recorded in the disk, the read-write operation on the disk caused by recording the information can be saved, the overhead of extra computing resources can be saved, and the influence of the read-write operation on the service life of the disk is reduced.
In an embodiment of the present application, for the step 101, when obtaining the offset information of the write pointer of the target storage area, the following various embodiments may be included, which are respectively described below:
in one embodiment, offset information of a write pointer of a target storage area cached in a memory may be obtained.
The cached offset information in the memory is updated along with the updating of the data in the disk, and the initial information of the cached offset information in the memory is as follows: and before updating the data in the disk, reading the offset information from the firmware information of the disk.
Specifically, the offset information of the write pointer of the target storage area is recorded in the firmware information of the disk, and when the offset information of the write pointer does not exist in the memory of the electronic device, the offset information of the write pointer of the target storage area recorded in the firmware information of the disk before updating data in the disk can be read and cached in the memory as the offset information of the initial write pointer. Therefore, when the disk information of the target storage area needs to be obtained by using the offset information of the write pointer, the offset information can be directly read from the memory, and the information recorded in the disk firmware information is prevented from being frequently read.
When data update occurs in the disk, the offset information of the write pointer indicating the target storage area of the disk is changed, and the offset information of the write pointer recorded in the firmware information of the disk is also changed accordingly. In this case, the offset information recorded in the memory can be directly updated according to the size of the data updated in the disk, and can be kept consistent with the offset information recorded in the firmware information of the disk.
Therefore, the offset information of the write pointer recorded in the disk firmware information is cached in the memory, the offset information recorded in the memory is read and updated, and under the condition that the obtained offset information of the write pointer is consistent with the offset information of the write pointer recorded in the firmware information, on one hand, the efficiency of reading data can be improved, on the other hand, the reading operation on the disk can be reduced, and further the influence on the service life of the disk is reduced.
In an embodiment of the present application, when an electronic device or a software program for obtaining disk information is turned off or restarted, or the electronic device is powered off, the offset information of the write pointer cached in the memory is lost, and in this case, the firmware information of the disk may be read again to obtain the offset information of the write pointer.
In another embodiment, the offset information of the write pointer of the target storage area recorded in the firmware information may also be directly obtained.
Specifically, when it is necessary to obtain the disk information of the target storage area using the offset information of the write pointer, the information may be directly read from the offset information of the write pointer recorded in the firmware information of the disk. When data updating occurs in the disk, the offset information of the write pointer in the target storage area of the disk is changed, and further the offset information of the write pointer recorded in the firmware information of the disk is changed, so that the offset information of the write pointer in the target storage area is read from the firmware information of the disk, the obtained information is higher in accuracy, the offset information of the write pointer does not need to be cached in a memory, and the occupation of the memory can be reduced.
In an embodiment of the present application, for the step 102, when obtaining the disk information, the occupied storage space, the remaining storage space, the data state information, and the like of the target storage area may be obtained, which are described below respectively.
In an embodiment of the present application, when an occupied storage space is obtained, since the offset information of the write pointer can represent the size of data stored in the target storage area, the offset information of the write pointer of the target storage area can be directly used as the occupied storage space of the target storage area.
If the disk includes a plurality of target storage areas, the offset information of the write pointers of each target storage area may be added to obtain the total occupied storage space when the total occupied storage space of all the target storage areas needs to be obtained.
In an embodiment of the present application, when obtaining the remaining storage space, the remaining storage space of the target storage area in the disk may be determined according to the obtained offset information of the write pointer and the space size of the target storage area.
Specifically, for a target storage area, a difference between a space size of the target storage area and offset information of a write pointer may be calculated, so as to obtain a remaining storage space of the target storage area.
If the disk includes a plurality of target storage areas, the remaining storage spaces of the target storage areas can be added to obtain the total remaining storage space under the condition that the total remaining storage space of all the target storage areas needs to be obtained;
for example, when the space sizes of the target storage areas are the same, the space size of each target storage area is represented by Z, the offset information of the write pointer of each target storage area is represented by WP1 and WP2 … … WPn, and the remaining storage space SYn of each target storage area can be calculated according to the following formula:
SYn=Z-WPn
in calculating the total remaining storage space SYz for the target storage area, the following formula may be used for calculation:
SYz=SY1+SY2+……SYn
in addition, when obtaining the total remaining storage space of the target storage area, the total occupied storage space may be subtracted from the total storage space Cz of the target storage area obtained in advance to obtain the total remaining storage space, that is, the total remaining storage space may be calculated according to the following formula:
SYz=Cz-(WP1+WP2……+WPn)
in an embodiment of the present application, when the disk is a disk in a disk array, data state information of the disk array may also be obtained.
Wherein, the disk array is: the storage system comprises an array consisting of a plurality of disks, wherein target storage areas in the disks in the same sequence form a strip. When storing data to the disk array, the data may be divided into x parts on average, and the x parts of data are stored in each disk of the same stripe, where each disk is used to store one part of data, and the value of x may be equal to the number of disks constituting the disk array.
Referring to fig. 3, fig. 3 is a schematic diagram of a disk array according to an embodiment of the present application. Assuming that the disk array is composed of four disks, namely a disk a, a disk b, a disk c, and a disk d, in order, each disk includes N target storage areas, namely, Zone1 and Zone2 … … ZoneN, respectively, the target storage area Zone1 in each disk constitutes a stripe Chunk1, and the target storage area Zone2 in each disk constitutes a stripe Chunk2 … …. When data is stored in the disk array, the data can be equally divided into 4 parts, and the data is stored in four disks belonging to the same stripe respectively.
And judging whether the offset information of the write pointers in each target storage area is consistent or not aiming at the target storage area belonging to the same strip in each disk of the disk array, if so, determining that the data state information of the target storage area belonging to the strip is in a synchronous state, and otherwise, determining that the data state information of the target storage area belonging to the strip is in an asynchronous state.
Specifically, since data is equally divided when the data is stored, and the sizes of the data stored in the respective disks are equal, the offset information of the write pointers of the target storage areas belonging to the same stripe in the respective disks should be kept consistent. When it is determined that the offset information matches each other, the data state information of the slice may be determined to be in a synchronous state. Under the condition that the offset information is inconsistent, it is described that when data is stored, due to reasons such as abnormal power failure of the disk, the data is not completely written into the disk, so that the sizes of the data stored in the disks are unequal, and therefore, it can be determined that the data state information of the target storage region belonging to the stripe is in an asynchronous state, and further, synchronization of the data of the stripe can be initiated.
In an embodiment of the present application, the data state information of the disk array may be detected when a disk is accessed, or when an electronic device or a software program for obtaining disk information is shut down or restarted.
In one embodiment of the present application, in the case where the disk array is composed of HM-SMR disks, the data state information of the disk array may be obtained according to the following steps:
step 1, obtaining offset information of a write pointer of a target storage area of each disk in a disk array;
specifically, offset information of a write pointer of a target storage area cached in the memory may be obtained. The offset information cached in the memory is updated along with the updating of the data in the disk, and the initial information of the offset information cached in the memory is the offset information recorded in the firmware information.
Step 2, selecting a strip of which the data state information is not determined in the disk array, judging whether each storage area belonging to the strip is in an SMR area, if so, executing step 3, otherwise, executing step 4 until each strip in the disk array is traversed;
step 3, determining the data state information of the strip according to the offset information of the write pointer of the target storage area belonging to the strip in each disk, and returning to the step 2;
wherein, for each stripe, in the case that offset information WPa-WPb-WPc … … of the write pointer of each target storage area belonging to the stripe is determined, the data state information of the target storage area belonging to the stripe is determined to be in a synchronous state, otherwise, the data state information of the target storage area belonging to the stripe is determined to be in an asynchronous state;
and 4, reading the data stored in each storage area belonging to the strip, calculating a check value according to the read data, judging whether the check value is consistent with a preset check value or not, if so, determining that the data state information of the target storage area belonging to the strip is in a synchronous state, otherwise, determining that the data state information of the target storage area belonging to the strip is in an asynchronous state, and returning to the step 2.
In an embodiment of the present application, a variation of offset information of a write pointer of a target storage area in a disk where data update occurs may also be obtained, and disk information of the target storage area is updated based on the obtained variation of offset information.
Specifically, when a data update occurs in the disk, a target storage area where the data update occurs and a variation amount of offset information of a write pointer of the target storage area may be determined, and the disk information may be updated based on the pointer information variation amount.
For example, assuming that the remaining storage space of the disk is 100M, and 10M data is newly stored in a target storage area, it may be determined that the variation of the offset information of the write pointer of the target storage area is increased by 10M, and further, it may be determined that the remaining storage space of the disk is decreased by 10M and is 90M.
Therefore, when data updating occurs in the disk, all target storage areas in the disk do not need to be counted, and only the disk information needs to be updated based on the target storage areas where the data updating occurs, so that the efficiency of obtaining the disk information can be improved.
Referring to fig. 4, fig. 4 is a schematic structural diagram of an information obtaining apparatus provided in an embodiment of the present application, where the apparatus includes:
an offset information obtaining module 401, configured to obtain offset information of a write pointer of a target storage area, where the target storage area is: an area in the magnetic disk for continuously storing data in a data storage order, the obtained offset information being consistent with reference offset information, the reference offset information being: offset information of a write pointer of the target storage area, recorded in the firmware information of the disk, the offset information characterizing: the position indicated by the write pointer of the target storage area and used for writing data to be written is offset relative to the initial writing position of the target storage area;
a disk information obtaining module 402, configured to obtain disk information of a target storage area in the disk according to the obtained offset information of the write pointer.
In an embodiment of the application, the offset information obtaining module 401 is specifically configured to:
obtaining offset information of a write pointer of a target storage area cached in a memory, wherein the offset information cached in the memory is updated along with updating of data in the disk, and initial information of the offset information cached in the memory is: before updating the data in the disk, reading offset information from the firmware information of the disk;
or
And obtaining offset information of a write pointer of the target storage area recorded in the firmware information.
In an embodiment of the present application, the disk information obtaining module 402 is specifically configured to:
and determining the residual storage space of the target storage area of the magnetic disk according to the obtained offset information of the write pointer and the space size of the target storage area.
In an embodiment of the present application, the disk information obtaining module 402 is specifically configured to:
and under the condition that the magnetic disks are in the magnetic disk array, judging whether offset information of write pointers in each target storage area is consistent or not aiming at the target storage area belonging to the same strip in each magnetic disk of the magnetic disk array, if so, determining that the data state information of the target storage area belonging to the strip is in a synchronous state, and otherwise, determining that the data state information of the target storage area belonging to the strip is in an asynchronous state.
In an embodiment of the present application, the apparatus further includes a disk information updating module, configured to:
obtaining the offset information variable quantity of a write pointer of a target storage area in which data updating occurs in a magnetic disk;
and updating the disk information of the target storage area based on the obtained offset information variation.
When the scheme provided by the above embodiment is applied to obtain the disk information, the offset information of the write pointer of the target storage area is obtained first, where the target storage area is: an area in the magnetic disk for continuously storing data in a data storage order, the obtained offset information being consistent with reference offset information: and offset information of a write pointer of the target storage area, recorded in the firmware information of the magnetic disk, wherein the offset information represents: the position for writing data to be written, which is indicated by the write pointer of the target storage area, is offset from the initial writing position of the target storage area; and obtaining the disk information of the target storage area in the disk according to the obtained offset information of the write pointer. The target storage area supports sequential data writing, and the offset information of the write pointer of the target storage area can represent the offset of the position for writing the data to be written, that is, the offset information can represent the size of the stored data in the target storage area, so that the disk information of the target storage area in the disk can be obtained according to the size of the stored data. The disk information of the target storage area can be obtained according to the offset information of the write pointer, and the firmware information of the disk can record the offset information of the write pointer of the target storage area, so that the offset information of the write pointer is recorded without occupying extra storage overhead in the disk. Therefore, by applying the information obtaining scheme provided by the above embodiment, the extra storage overhead of the disk can be reduced.
In addition, because the size information of the data stored in and taken out of the disk does not need to be additionally recorded in the disk, the read-write operation on the disk caused by recording the information can be saved, the overhead of extra computing resources can be saved, and the influence of the read-write operation on the service life of the disk is reduced.
The embodiment of the present application further provides an electronic device, as shown in fig. 5, which includes a processor 501, a communication interface 502, a memory 503 and a communication bus 504, wherein the processor 501, the communication interface 502 and the memory 503 complete mutual communication through the communication bus 504,
a memory 503 for storing a computer program;
the processor 501 is configured to implement the information obtaining method when executing the program stored in the memory 503.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
In yet another embodiment provided by the present application, a computer-readable storage medium is further provided, in which a computer program is stored, and the computer program realizes the steps of any one of the above information obtaining methods when executed by a processor.
In yet another embodiment provided by the present application, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform any of the information obtaining methods of the above embodiments.
When the scheme provided by the above embodiment is applied to obtain the disk information, the offset information of the write pointer of the target storage area is obtained first, where the target storage area is: an area in the magnetic disk for continuously storing data in a data storage order, the obtained offset information being consistent with reference offset information: and offset information of a write pointer of the target storage area, recorded in the firmware information of the magnetic disk, wherein the offset information represents: the position for writing data to be written, which is indicated by the write pointer of the target storage area, is offset from the initial writing position of the target storage area; and obtaining the disk information of the target storage area in the disk according to the obtained offset information of the write pointer. The target storage area supports sequential data writing, and the offset information of the write pointer of the target storage area can represent the offset of the position for writing the data to be written, that is, the offset information can represent the size of the stored data in the target storage area, so that the disk information of the target storage area in the disk can be obtained according to the size of the stored data. The disk information of the target storage area can be obtained according to the offset information of the write pointer, and the firmware information of the disk can record the offset information of the write pointer of the target storage area, so that the offset information of the write pointer is recorded without occupying extra storage overhead in the disk. Therefore, by applying the information obtaining scheme provided by the above embodiment, the extra storage overhead of the disk can be reduced.
In addition, because the size information of the data stored in and taken out of the disk does not need to be additionally recorded in the disk, the read-write operation on the disk caused by recording the information can be saved, the overhead of extra computing resources can be saved, and the influence of the read-write operation on the service life of the disk is reduced.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the application to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, apparatus embodiments, electronic device embodiments, computer-readable storage medium embodiments, and computer program product embodiments are substantially similar to method embodiments and therefore are described with relative ease, as appropriate, with reference to the partial description of the method embodiments.
The above description is only for the preferred embodiment of the present application and is not intended to limit the scope of the present application. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims (10)

1. An information obtaining method, characterized in that the method comprises:
obtaining offset information of a write pointer of a target storage area, wherein the target storage area is as follows: an area in the magnetic disk for continuously storing data in a data storage order, the obtained offset information being consistent with reference offset information, the reference offset information being: offset information of a write pointer of the target storage area, recorded in the firmware information of the disk, the offset information characterizing: the position indicated by the write pointer of the target storage area and used for writing data to be written is offset relative to the initial writing position of the target storage area;
and obtaining the disk information of the target storage area in the disk according to the obtained offset information of the write pointer.
2. The method of claim 1, wherein obtaining offset information of a write pointer of a target storage area comprises:
obtaining offset information of a write pointer of a target storage area cached in a memory, wherein the offset information cached in the memory is updated along with updating of data in the disk, and initial information of the offset information cached in the memory is: before updating the data in the disk, reading offset information from the firmware information of the disk;
or
And obtaining offset information of a write pointer of the target storage area recorded in the firmware information.
3. The method of claim 1, wherein obtaining the disk information of the target storage area in the disk according to the obtained offset information of the write pointer comprises:
and determining the residual storage space of the target storage area of the magnetic disk according to the obtained offset information of the write pointer and the space size of the target storage area.
4. The method according to claim 1, wherein in a case where the disk is a disk in a disk array, the obtaining disk information of a target storage area in the disk according to the obtained offset information of the write pointer includes:
and judging whether the offset information of the write pointer in each target storage area is consistent or not aiming at the target storage area belonging to the same strip in each disk of the disk array, if so, determining that the data state information of the target storage area belonging to the strip is in a synchronous state, and otherwise, determining that the data state information of the target storage area belonging to the strip is in an asynchronous state.
5. The method according to any one of claims 1-4, further comprising:
obtaining the offset information variable quantity of a write pointer of a target storage area in which data updating occurs in a magnetic disk;
and updating the disk information of the target storage area based on the obtained offset information variation.
6. An information obtaining apparatus, characterized in that the apparatus comprises:
an offset information obtaining module, configured to obtain offset information of a write pointer of a target storage area, where the target storage area is: an area in the magnetic disk for continuously storing data in a data storage order, the obtained offset information being consistent with reference offset information, the reference offset information being: offset information of a write pointer of the target storage area, recorded in the firmware information of the disk, the offset information characterizing: the position indicated by the write pointer of the target storage area and used for writing data to be written is offset relative to the initial writing position of the target storage area;
and the disk information obtaining module is used for obtaining the disk information of the target storage area in the disk according to the obtained offset information of the write pointer.
7. The apparatus of claim 6, wherein the offset information obtaining module is specifically configured to:
obtaining offset information of a write pointer of a target storage area cached in a memory, wherein the offset information cached in the memory is updated along with updating of data in the disk, and initial information of the offset information cached in the memory is: before updating the data in the disk, reading offset information from the firmware information of the disk;
or
And obtaining offset information of a write pointer of the target storage area recorded in the firmware information.
8. The apparatus according to claim 6 or 7, wherein the disk information obtaining module is specifically configured to:
determining the residual storage space of the target storage area of the magnetic disk according to the obtained offset information of the write pointer and the space size of the target storage area;
the disk information obtaining module is specifically configured to:
under the condition that the magnetic disk is a magnetic disk in a magnetic disk array, judging whether offset information of a write pointer in each target storage area is consistent or not aiming at target storage areas belonging to the same strip in each magnetic disk of the magnetic disk array, if so, determining that data state information of the target storage area belonging to the strip is in a synchronous state, otherwise, determining that the data state information of the target storage area belonging to the strip is in an asynchronous state;
the apparatus further comprises a disk information update module configured to:
obtaining the offset information variable quantity of a write pointer of a target storage area in which data updating occurs in a magnetic disk;
and updating the disk information of the target storage area based on the obtained offset information variation.
9. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any one of claims 1 to 5 when executing a program stored in the memory.
10. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of the claims 1-5.
CN202110220826.9A 2021-02-26 2021-02-26 Information obtaining method and device, electronic equipment and storage medium Active CN112882659B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110220826.9A CN112882659B (en) 2021-02-26 2021-02-26 Information obtaining method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110220826.9A CN112882659B (en) 2021-02-26 2021-02-26 Information obtaining method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112882659A true CN112882659A (en) 2021-06-01
CN112882659B CN112882659B (en) 2023-05-02

Family

ID=76054880

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110220826.9A Active CN112882659B (en) 2021-02-26 2021-02-26 Information obtaining method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112882659B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115080950A (en) * 2022-07-20 2022-09-20 深圳竹云科技股份有限公司 Identity information processing method and device, computer equipment and storage medium

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1627429A (en) * 2003-11-28 2005-06-15 株式会社东芝 Apparatus for magnetic recording and method for measuring the offset amount
US20060026368A1 (en) * 2004-07-30 2006-02-02 Fujitsu Limited Storage device
US20090259800A1 (en) * 2008-04-15 2009-10-15 Adtron, Inc. Flash management using sequential techniques
US20110138144A1 (en) * 2009-12-04 2011-06-09 Fujitsu Limited Computer program, apparatus, and method for managing data
CN103136215A (en) * 2011-11-24 2013-06-05 腾讯科技(深圳)有限公司 Data read-write method and device of storage system
US20140297946A1 (en) * 2013-03-28 2014-10-02 Fujitsu Limited Storage system and method for managing storage apparatuses
US20150095573A1 (en) * 2013-08-09 2015-04-02 Huawei Technologies Co., Ltd. File processing method and storage device
US20190362752A1 (en) * 2018-05-22 2019-11-28 Kabushiki Kaisha Toshiba Magnetic disk device and read/write processing method
US10720177B1 (en) * 2019-04-08 2020-07-21 Seagate Technology Llc Mode hop mitigation solutions in a heat-assisted magnetic recording head

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1627429A (en) * 2003-11-28 2005-06-15 株式会社东芝 Apparatus for magnetic recording and method for measuring the offset amount
US20060026368A1 (en) * 2004-07-30 2006-02-02 Fujitsu Limited Storage device
US20090259800A1 (en) * 2008-04-15 2009-10-15 Adtron, Inc. Flash management using sequential techniques
US20110138144A1 (en) * 2009-12-04 2011-06-09 Fujitsu Limited Computer program, apparatus, and method for managing data
CN103136215A (en) * 2011-11-24 2013-06-05 腾讯科技(深圳)有限公司 Data read-write method and device of storage system
US20140297946A1 (en) * 2013-03-28 2014-10-02 Fujitsu Limited Storage system and method for managing storage apparatuses
US20150095573A1 (en) * 2013-08-09 2015-04-02 Huawei Technologies Co., Ltd. File processing method and storage device
US20190362752A1 (en) * 2018-05-22 2019-11-28 Kabushiki Kaisha Toshiba Magnetic disk device and read/write processing method
US10720177B1 (en) * 2019-04-08 2020-07-21 Seagate Technology Llc Mode hop mitigation solutions in a heat-assisted magnetic recording head

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115080950A (en) * 2022-07-20 2022-09-20 深圳竹云科技股份有限公司 Identity information processing method and device, computer equipment and storage medium
CN115080950B (en) * 2022-07-20 2022-11-15 深圳竹云科技股份有限公司 Identity information processing method and device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN112882659B (en) 2023-05-02

Similar Documents

Publication Publication Date Title
US9892005B2 (en) System and method for object-based continuous data protection
CN111737265B (en) Block data access method, block data storage method and device
CN108459826B (en) Method and device for processing IO (input/output) request
CN110765076B (en) Data storage method, device, electronic equipment and storage medium
CN106649145B (en) Method and system for updating cache strategy in self-adaption mode
JP2017079053A (en) Methods and systems for improving storage journaling
CN109902034B (en) Snapshot creating method and device, electronic equipment and machine-readable storage medium
CN113220239A (en) Erasing and writing method, device and equipment for flash storage and readable storage medium
CN112181902B (en) Database storage method and device and electronic equipment
CN115562587A (en) Data storage method, device and equipment applied to storage medium and storage medium
US20170344475A1 (en) Efficient pointer swizzling for persistent objects
CN106095331B (en) Control method for internal resources of fixed large file
CN112882659B (en) Information obtaining method and device, electronic equipment and storage medium
CN105808451B (en) Data caching method and related device
CN106528322A (en) Methods and systems to detect silent corruption of data
US20150067192A1 (en) System and method for adjusting sas addresses of sas expanders
CN105830067B (en) A kind of file information processing method, device and document handling apparatus, system
CN109445715B (en) Bad block processing method and device for combined block
US10949359B2 (en) Optimizing cache performance with probabilistic model
CN111209304B (en) Data processing method, device and system
CN111435285B (en) Data writing method and device for storage volume, electronic equipment and machine-readable storage medium
CN114296635A (en) Cache elimination method and device of cache data, terminal and storage medium
CN112684981B (en) Method, system and device for recording read operation of solid state disk and readable storage medium
CN111897692A (en) File recording method and device, electronic equipment and storage medium
CN112882867B (en) Index information storage method and device and storage equipment

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