CN107145301B - Data access method and device based on hybrid disk - Google Patents

Data access method and device based on hybrid disk Download PDF

Info

Publication number
CN107145301B
CN107145301B CN201610118829.0A CN201610118829A CN107145301B CN 107145301 B CN107145301 B CN 107145301B CN 201610118829 A CN201610118829 A CN 201610118829A CN 107145301 B CN107145301 B CN 107145301B
Authority
CN
China
Prior art keywords
write
data
cache
disk
preset number
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
CN201610118829.0A
Other languages
Chinese (zh)
Other versions
CN107145301A (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.)
Sangfor Technologies Co Ltd
Original Assignee
Sangfor 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 Sangfor Technologies Co Ltd filed Critical Sangfor Technologies Co Ltd
Priority to CN201610118829.0A priority Critical patent/CN107145301B/en
Publication of CN107145301A publication Critical patent/CN107145301A/en
Application granted granted Critical
Publication of CN107145301B publication Critical patent/CN107145301B/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/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0629Configuration or reconfiguration of storage systems
    • G06F3/0631Configuration or reconfiguration of storage systems by allocating resources to storage 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/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
    • 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/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0674Disk device

Abstract

The invention discloses a data access method based on a hybrid disk, which comprises the following steps: counting the quantity of discontinuous write caches among sectors with a first preset number according to the sequence of written addresses from a first write cache; when the counted number is larger than a second preset number, reading interval data between the write caches of the sectors with the interval first preset number from the data disk; and combining the write cache among the sectors with the interval first preset number with the interval data to generate a total write cache, and writing the data corresponding to the generated total write cache into a data disc. The invention also provides a data access device based on the hybrid disk. The invention solves the problem that when the address of the write cache is discontinuous, the data can be written into the data disk only by writing operation for many times.

Description

Data access method and device based on hybrid disk
Technical Field
The invention relates to the technical field of data storage, in particular to a data access method and device based on a hybrid disk.
Background
With the maturity of the solid state disk technology, a large number of storage products based on a mixed disk of a mechanical disk and a solid state disk appear in the market at present, one of the products is to use the solid state disk as a cache disk and use the mechanical disk as a data disk, and when data is written, the data is written into the solid state disk firstly for caching and then is transferred to the mechanical disk; and caching the hot spot data in the solid state disk, and directly reading the hot spot data from the solid state disk if the read data is right in the solid state disk.
The solid state disk serves as a high-speed storage medium, and when the solid state disk serves as a high-speed large-capacity cache of a mechanical disk, the performance of a storage product can be greatly improved. The method comprises the steps of firstly caching data of write operation on a solid state disk, namely writing cache, then rewriting data corresponding to the write cache on a mechanical disk, combining a plurality of write caches into a large write cache when addresses of some write caches are continuous or overlapped currently in order to accelerate the speed of rewriting the data on the mechanical disk, then writing the data corresponding to the large write cache on the mechanical disk at one time, and accelerating the speed of rewriting the data from the write cache to a data disk, but when the addresses of the write caches are discontinuous, combining the plurality of write caches cannot be carried out, so that the data can be written into the data disk by writing operation for many times.
Disclosure of Invention
The invention provides a data access method and a data access device based on a hybrid disk, and mainly aims to solve the problem that when the address of a write cache is discontinuous, data can be written into a data disk only by writing operation for many times.
In order to achieve the above object, the present invention provides a data access method based on a hybrid disk, including:
counting the quantity of discontinuous write caches among sectors with a first preset number according to the sequence of written addresses from a first write cache;
when the counted number is larger than a second preset number, reading interval data between the write caches of the sectors with the interval first preset number from the data disk;
and combining the write cache among the sectors with the interval first preset number with the interval data to generate a total write cache, and writing the data corresponding to the generated total write cache into a data disc.
Preferably, the step of merging the write cache between the first preset number of sectors at the interval with the interval data to generate a total write cache, and writing the data corresponding to the generated total write cache to the data disk includes:
according to the quantity of the discontinuous write caches, applying for a space from a system memory, and placing the write caches among the sectors with the interval of the first preset number and the interval data into the space;
combining the write cache between the sectors with the interval first preset number with the interval data in the space to generate a total write cache;
and writing the data corresponding to the generated total write cache into a data disk.
Preferably, before the step of counting, in order of written addresses, the number of discontinuous write buffers between sectors spaced by a first preset number of intervals from the first write buffer, the hybrid disk-based data access method further includes the steps of:
judging whether a plurality of addresses of the write cache are continuous or overlapped;
when the addresses of a plurality of write caches are continuous or overlapped, combining the write caches with continuous or overlapped addresses into one write cache, and writing the data corresponding to the combined write cache into the data disc;
when the addresses of the non-write caches are continuous or overlapped, counting the quantity of discontinuous write caches among sectors separated by a first preset number from the first write cache.
Preferably, after the step of counting the number of discontinuous write buffers spaced by a first preset number of sectors from the first write buffer, the data access method based on the hybrid disk further includes the steps of:
when the counted number is less than or equal to the second preset number, judging whether the cache space in the cache disk is sufficient;
and if the cache space in the cache disk is insufficient, writing the data corresponding to the write cache into the data disk one by one according to the sequence of the written addresses from the first write cache.
Preferably, after the step of determining whether the cache space in the cache disk is sufficient when the counted number is less than or equal to the second preset number, the data access method based on the hybrid disk further includes the steps of:
and if the current cache space in the cache disk is sufficient, continuing to perform the step of counting the number of discontinuous write caches among sectors with a first preset number of intervals according to the sequence of written addresses from the first write cache.
In addition, to achieve the above object, the present invention provides a data access apparatus based on a hybrid disk, including:
the quantity counting module is used for counting the quantity of discontinuous write caches among sectors with a first preset number according to the sequence of written addresses from the first write cache;
the interval reading module is used for reading the interval data among the write caches of the sectors with the interval of the first preset number from the data disk when the counted number is larger than the second preset number;
the data merging module is used for merging the write cache among the sectors with the interval first preset number with the interval data to generate a total write cache;
and the data writing module is used for writing the generated data corresponding to the total write cache into a data disk.
Preferably, the data merging module is further configured to apply for a space from a system memory according to the number of the discontinuous write caches, and place the write caches among the sectors with the first preset number of intervals and the interval data in the space; combining the write cache among the sectors with the interval data in the interval first preset number in the space to generate a total write cache;
and the data writing module is further configured to write the generated data corresponding to the total write cache into a data disk.
Preferably, the hybrid disk-based data access device further includes:
the address judgment module is used for judging whether a plurality of addresses of the write cache are continuous or overlapped;
the data merging module is further configured to merge multiple write caches with consecutive addresses into one write cache when the addresses of the multiple write caches are consecutive;
the data writing module is further configured to write the merged write cache to the data disk;
the quantity counting module is further configured to count the quantity of discontinuous write buffers between sectors spaced by a first preset number from a first write buffer when addresses of no write buffers are continuous or overlapped.
Preferably, the hybrid disk-based data access device further includes:
the cache judging module is used for judging whether the cache space in the cache disk is sufficient or not when the counted number is less than or equal to the second preset number;
and the data writing module is used for writing the data corresponding to the write cache into the data disk one by one according to the sequence of the written addresses from the first write cache if the cache space in the cache disk is insufficient.
Preferably, the quantity counting module is further configured to count, from the first write cache, the quantity of discontinuous write caches among sectors spaced by a first preset number according to the sequence of written addresses if the current cache space in the cache disk is sufficient.
The invention provides a data access method and a device based on a hybrid disk, counting the quantity of discontinuous write caches among sectors with a first preset number according to the sequence of written addresses from a first write cache, reading the interval data among the discontinuous write caches from the data disk when the counted quantity of the discontinuous write caches among the sectors with the first preset number is larger than a second preset number, combining the discontinuous write caches and the interval data to form a total write cache, and writing the corresponding data into the data disk, wherein the invention uses one-time read operation and one-time write cache to replace multiple write caches, does not need to write the discontinuous write caches among the addresses in the cache disk into the data disk one by one, improves the speed of writing data into a mechanical disk from the cache disk, and solves the problem that when the addresses of the write caches are discontinuous, a problem with writing data to a data disc requiring multiple write operations.
Drawings
FIG. 1 is a flow chart of a first embodiment of a hybrid disk-based data access method according to the present invention;
FIG. 2 is a schematic diagram illustrating write caching and interval data splicing in a first embodiment of a hybrid disk-based data access method according to the present invention;
FIG. 3 is a flowchart illustrating a detailed process of reading interval data according to a second embodiment of the hybrid disk-based data access method of the present invention;
FIG. 4 is a functional block diagram of a hybrid disk-based data access device according to a first embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The invention provides a data access method based on a hybrid disk.
Referring to fig. 1, a flow chart of a first embodiment of a hybrid disk-based data access method according to the invention is shown.
In a first embodiment, the hybrid disk-based data access method includes:
step S10, counting the number of discontinuous write buffers between sectors spaced by a first preset number according to the order of the written addresses from the first write buffer.
The method provided by the embodiment is applicable to a hybrid disk, generally, a mechanical disk is taken as a data disk, a high-speed random storage medium is taken as a cache disk, the read-write speed is high, the capacity is large, some hot spot data which are frequently read can be cached in the high-speed cache disk as a read cache, the cache data which correspond to the read operation are directly read from the cache disk, the data to be written are temporarily cached on the cache disk as a write cache, the cache data which correspond to the write operation are cached, and then the write caches are slowly written back on the data disk. Therefore, the cache disk generally contains updated data executed by the current system process, and the data needs to be written into the data disk, but because the data writing speed of the data disk is slow, for the normal operation of the process, the updated data is cached into the cache space of the data disk to form the write cache, but because the data is not completely updated during updating, only part of the data may be updated, and therefore some write caches with discontinuous write addresses are generated.
It should be noted that the cache disk in this embodiment may be a high-speed Random access memory medium, and the high-speed Random access memory medium may be an SSD (Solid State drive) which is mature at present, or an NVRAM (Non-Volatile Random access memory) type memory which is not mature at present but may be widely used in the future.
Therefore, each write buffer in the buffer space contains a physical address to be written to the data disk, and the read/write of the hard disk is represented by a sector as a basic unit, and an absolute sector represented by a cylinder/a head/a sector is generally used as a physical address to indicate a sector, so the physical address is generally represented by a cylinder number → a head number → a sector number, wherein the cylinders are numbered from outside to inside in sequence from 0, i.e., from the first cylinder to the last cylinder, the cylinder is numbered in sequence from 0, 1, 2, and 3 … …, the head is used to determine on which disk surface the data is, from the first head to the last head, the cylinder is numbered in sequence from 1, 2, and 3 … …, the number of sectors indicates that each track has several sectors, and the numbers are numbered in sequence from 1, 2, and 3 … ….
The physical addresses of the disk are arranged in the following way, assuming that 17 sectors per track are taken as an example to illustrate, starting with cylinder 0, head 1, sector 0, the first sector being numbered 0, the remaining sectors on the track being numbered 1 to 16, then 17 sectors with head number 2 and cylinder 0, forming sector numbers from 17 to 33, up to all heads of the cylinder. Then moving to the cylinder 1, the magnetic head 1 and the sector 1 to continue numbering, namely, the sector number, the magnetic head number and the cylinder number are increased continuously. Therefore, when determining whether the write buffers are contiguous, it is determined whether the write buffers are contiguous according to the physical addresses thereof.
Counting the quantity of discontinuous write caches among sectors with a first preset number according to the sequence of written addresses from a first write cache; that is, the first write cache may be used as the current write cache, and the amount of the write caches in the address space of the first preset number of sectors backward from the current write cache is counted, where the first preset number may be set by a user, and in this embodiment, preferably, the first preset number takes 2048 sectors to 6144 sectors, or the first preset number takes 4096 sectors, that is, 2M data.
And step 30, when the counted number is greater than the second preset number, reading the interval data between the write buffers of the sectors with the interval of the first preset number from the data disk.
The first predetermined number of limitations is set primarily because: if the interval sector is large, the interval data in the interval sector is also large, and when the interval data is large, the data required to be read from the data disk is also large, so that even if a plurality of write caches can be combined, because the read-write speed of the data disk is slow, the read operation of reading the interval data is slow, and the performance of the whole read-write cache is low, the number of the interval sectors needs to be limited, so that when the addresses of the write caches are discontinuous, a plurality of write caches are combined into one write cache, and then the write cache is written to the mechanical disk at one time, and the speed of writing the data back from the cache disk to the data disk is increased.
After the statistics is completed, it is determined whether the counted number is greater than a preset number, where a second preset number may be set by a user, and in this embodiment, the second preset number is preferably 3 to 6, or the second preset number is preferably 4. Considering that if the number of discontinuous write buffers capable of being merged currently is too small, the discontinuous write buffers are rather irrevocable, after debugging, the minimum number of write buffers capable of being merged, that is, the second preset number, is determined, and when the number of write buffers capable of being merged is greater than the second preset number, interval data between write buffers that are separated by sectors of the first preset number is read from the data disk.
Step S40, merging the write cache between the sectors with the interval first preset number with the interval data to generate a total write cache, and writing the data corresponding to the generated total write cache into the data disk.
Applying for a sufficiently large space from a memory row, placing interval data between write caches of sectors with intervals of a first preset number read from a data disc and the interval write caches into the applied memory space, splicing the write caches of the sectors with the intervals of the first preset number with the interval data, replacing corresponding original data in the interval data to form a total write cache, and writing the generated data corresponding to the total write cache into the data disc, as shown in fig. 2.
Further, before step S20, the hybrid disk-based data access method further includes the following steps:
judging whether a plurality of addresses of the write cache are continuous or overlapped;
when the addresses of a plurality of write caches are continuous or overlapped, combining the write caches with continuous or overlapped addresses into one write cache, and writing the data corresponding to the combined write cache into the data disk.
When the addresses of the non-write caches are continuous or overlapped, counting the quantity of discontinuous write caches among sectors separated by a first preset number from the first write cache.
Because some addresses of write caches in the cache disk are continuous, for the write caches with continuous addresses, no interval data needs to be read, the write caches can be directly combined into one large write cache, and the corresponding data is directly written into the data disk, therefore, in other embodiments, after the write caches in the cache disk are sorted according to the addresses, it can be firstly determined whether the addresses of a plurality of write caches are continuous or overlapped, there is no limit to the number of the write caches with continuous or overlapped addresses, when there is continuous or overlapped addresses of two or more write caches, the write caches with continuous or overlapped addresses can be combined into one write cache, and the data corresponding to the large write cache formed by combination is written into the data disk.
The data access method based on the hybrid disk provided by the embodiment counts the number of discontinuous write caches among sectors with a first preset number according to the sequence of written addresses from a first write cache, reads the interval data among the discontinuous write caches from the data disk when the counted number of the discontinuous write caches among the sectors with the first preset number is larger than a second preset number, combines the discontinuous write caches and the interval data to form a total write cache, and writes the corresponding data into the data disk, wherein a plurality of write caches are replaced by one-time read operation and one-time write cache, the discontinuous write caches in the cache disk are not required to be independently written into the data disk one by one, the speed of writing the data into the mechanical disk from the cache disk is improved, and the problem that when the addresses of the write caches are discontinuous is solved, a problem with writing data to a data disc requiring multiple write operations.
Referring to fig. 3, a first embodiment of the hybrid disk-based data access method according to the present invention is a second embodiment of the hybrid disk-based data access method according to the present invention. In the present embodiment, the method differs from the first embodiment in that step S20 includes the following refinement steps:
step S21, applying for a space from the system memory according to the number of the discontinuous write caches, and placing the write caches among the sectors with the interval of the first preset number and the interval data into the space;
step S22, merging the write cache between the sectors with the interval first preset number and the interval data in the space to generate a total write cache;
and step S23, writing the data corresponding to the generated total write buffer to a data disk.
Applying for a large enough space from a memory line, placing interval data between write caches of sectors with intervals of a first preset number, which are read from a data disc, into the memory, merging the interval write caches and the interval data, namely splicing the write caches of the sectors with the intervals of the first preset number with the interval data, replacing corresponding original data in the interval data to form a total write cache, and writing the generated data corresponding to the total write cache into the data disc.
Further, after step S10, the hybrid disk based data access method further includes the following steps:
when the counted number is less than or equal to the second preset number, judging whether the cache space in the cache disk is sufficient;
and if the cache space in the cache disk is insufficient, writing the data corresponding to the write cache into the data disk one by one according to the sequence of the written addresses from the first write cache.
Further, after the step of interrupting whether the cache space in the cache disk is sufficient or not, if the current cache space in the cache disk is sufficient, the step of counting the number of discontinuous write caches among sectors with a first preset number of intervals according to the sequence of written addresses from the first write cache is continuously executed.
If the space of the high-speed medium is enough, the write cache which can not be merged can be temporarily stored in the high-speed medium, and merging is carried out when more write caches are stored. If the space of the high-speed medium is not enough, the data corresponding to the write cache arranged according to the addresses are written into the data disk one by one.
According to the data access method based on the hybrid disk, when the interval data to be read is read and cached in the high-speed random access medium, the interval data is read from the high-speed random access medium of the read cache, so that the data reading and writing speed can be further improved.
The invention also provides a data access device based on the hybrid disk.
Fig. 4 is a functional block diagram of a hybrid disk-based data access device according to a first embodiment of the present invention.
In this embodiment, the hybrid disk-based data access device includes:
a quantity counting module 10, configured to count, from the first write cache, the quantity of discontinuous write caches among sectors spaced by a first preset number.
The device provided by the embodiment adopts a hybrid disk, generally takes a mechanical disk as a data disk, takes a high-speed random storage medium as a cache disk, has high reading and writing speed and large capacity, can cache some hot spot data which are frequently read into the high-speed cache disk as a read cache, is cache data corresponding to reading operation, then directly reads from the cache disk, temporarily caches the data to be written on the cache disk as a write cache, is cache data corresponding to writing operation, and then slowly writes the write caches back on the data disk. Therefore, the cache disk generally contains updated data executed by the current system process, and the data needs to be written into the data disk, but because the data writing speed of the data disk is slow, for the normal operation of the process, the updated data is cached into the cache space of the data disk to form the write cache, but because the data is not completely updated during updating, only part of the data may be updated, and therefore some write caches with discontinuous write addresses are generated.
It should be noted that the cache disk in this embodiment may be a high-speed Random access memory medium, and the high-speed Random access memory medium may be an SSD (Solid State drive) which is mature at present, or an NVRAM (Non-Volatile Random access memory) type memory which is not mature at present but may be widely used in the future.
Therefore, each write buffer in the buffer space contains a physical address to be written to the data disk, and the read/write of the hard disk is represented by a sector as a basic unit, and an absolute sector represented by a cylinder/a head/a sector is generally used as a physical address to indicate a sector, so the physical address is generally represented by a cylinder number → a head number → a sector number, wherein the cylinders are numbered from outside to inside in sequence from 0, i.e., from the first cylinder to the last cylinder, the cylinder is numbered in sequence from 0, 1, 2, and 3 … …, the head is used to determine on which disk surface the data is, from the first head to the last head, the cylinder is numbered in sequence from 1, 2, and 3 … …, the number of sectors indicates that each track has several sectors, and the numbers are numbered in sequence from 1, 2, and 3 … ….
The physical addresses of the disk are arranged in the following way, assuming that 17 sectors per track are taken as an example to illustrate, starting with cylinder 0, head 1, sector 0, the first sector being numbered 0, the remaining sectors on the track being numbered 1 to 16, then 17 sectors with head number 2 and cylinder 0, forming sector numbers from 17 to 33, up to all heads of the cylinder. Then moving to the cylinder 1, the magnetic head 1 and the sector 1 to continue numbering, namely, the sector number, the magnetic head number and the cylinder number are increased continuously. Therefore, when determining whether the write buffers are contiguous, it is determined whether the write buffers are contiguous according to the physical addresses thereof.
The quantity counting module 10 counts the quantity of discontinuous write caches among sectors spaced by a first preset number from the first write cache; that is, the first write cache may be used as the current write cache, and the amount of the write caches in the address space of the first preset number of sectors backward from the current write cache is counted, where the first preset number may be set by a user, and in this embodiment, preferably, the first preset number takes 2048 sectors to 6144 sectors, or the first preset number takes 4096 sectors, that is, 2M data.
And the interval reading module 20 is configured to read, from the data disc, the interval data between the write buffers of the sectors with the interval of the first preset number when the counted number is greater than the second preset number.
The first predetermined number of limitations is set primarily because: if the sector of the interval is large, the interval data in the sector is also large, and when the data of the interval is large, the data which needs to be read from the data disk is also large, so that even if a plurality of write caches can be combined, because the read-write speed of the data disk is slow, and the read operation for reading the interval data is slow, the performance of the whole read-write cache is low, the number of the interval sectors needs to be limited, so that when the addresses of the write caches are discontinuous, the write caches are combined into one write cache, and then the write cache is written on the mechanical disk at one time, and the speed of writing the data back from the write cache disk to the data disk is accelerated.
After the counting by the number counting module 10 is completed, it is determined whether the counted number is greater than a preset number, where a second preset number may be set by a user, and in this embodiment, the second preset number is preferably 3 to 6, or the second preset number is preferably 4. Considering that if the number of discontinuous write buffers capable of being merged currently is too small, it is rather irrevocable, and therefore, after debugging, the minimum number of write buffers capable of being merged, that is, the second preset number, is determined, and when the number of write buffers capable of being merged is greater than the second preset number, the interval reading module 20 reads the interval data between the write buffers that are separated by the first preset number of sectors from the data disk.
A data merging module 30, configured to merge the write cache between the sectors with the interval first preset number with the interval data to generate a total write cache;
and a data writing module 40, configured to write the data corresponding to the generated total write buffer to a data disk.
A sufficiently large space is applied from a memory line, the interval data between the write caches of the sectors with the interval first preset number read from the data disk and the write caches of the intervals are placed in the applied memory space, the data merging module 30 splices the write caches of the sectors with the interval data with the interval first preset number, replaces the corresponding original data in the interval data to form a total write cache, and the data writing module 40 writes the generated data corresponding to the total write cache into the data disk, as shown in fig. 2.
Further, the hybrid disk-based data access device further comprises the following modules:
the address judgment module is used for judging whether a plurality of addresses of the write cache are continuous or overlapped;
the data merging module 30 is further configured to merge multiple write buffers with consecutive addresses into one write buffer when there are multiple write buffers with consecutive addresses
And a data writing module 40, further configured to write the merged write buffer to the data disk.
The quantity counting module 10 is further configured to count, when addresses of no write cache are consecutive or overlap, the quantity of discontinuous write caches among sectors spaced by a first preset number from a first write cache.
Since there will be some addresses of the write cache in the cache disk that are consecutive, and there is no interval for the data to be read for these addresses of consecutive write caches, the data merge module 30 can directly merge them into one large write cache, and the data write module 40 writes its corresponding data to the data disk, in other embodiments, after the write caches in the cache disk are sorted according to the addresses, the address judgment module firstly judges whether the addresses of a plurality of write caches are continuous or overlapped, there is no limit to the number of the write caches with continuous or overlapped addresses, when there are two or more write buffer addresses that are consecutive or overlap, the data merging module 30 may merge multiple write buffers with consecutive or overlapping addresses into one write buffer, and the data writing module 40 writes data corresponding to the large write buffer formed by merging into the data disk.
The data access device based on the hybrid disk provided by the embodiment counts the number of discontinuous write caches among sectors with a first preset number according to the sequence of written addresses from a first write cache, reads the interval data among the discontinuous write caches from the data disk when the counted number of the discontinuous write caches among the sectors with the first preset number is larger than a second preset number, combines the discontinuous write caches and the interval data to form a total write cache, and writes the corresponding data into the data disk, uses one-time read operation and one-time write cache to replace multiple write caches, does not need to write the discontinuous write caches among the addresses in the cache disk into the data disk one by one, improves the speed of writing the data into the mechanical disk from the cache disk, and solves the problem that when the addresses of the write caches are discontinuous, a problem with writing data to a data disc requiring multiple write operations.
The first embodiment of the hybrid disk-based data access device according to the present invention proposes the second embodiment of the hybrid disk-based data access device according to the present invention. In this embodiment, the apparatus differs from the first embodiment in that:
the data merging module 30 is further configured to apply for a space from a system memory according to the number of the discontinuous write caches, and place the write caches among the sectors with the interval of the first preset number and the interval data in the space; combining the write cache among the sectors with the interval data in the interval first preset number in the space to generate a total write cache;
and the data writing module 40 is further configured to write the data corresponding to the generated total write cache to a data disk.
The data merging module 30 applies for a sufficiently large space from a memory line, puts interval data between the write caches of the sectors with the interval of the first preset number, which are read from the data disc, into the memory, merges the interval write caches and the interval data, that is, splices the write caches of the sectors with the interval data with the interval of the first preset number, and replaces corresponding original data in the interval data to form a total write cache, and the data writing module 40 writes the generated data corresponding to the total write cache into the data disc.
Further, the hybrid disk-based data access device further comprises the following modules:
the cache judging module is used for judging whether the cache space in the cache disk is sufficient or not when the counted number is less than or equal to the second preset number;
the data writing module 40 is further configured to, if the cache space in the cache disk is insufficient, write data corresponding to the write caches into the data disk one by one according to the written address sequence from the first write cache.
Further, the data sorting module is further configured to, if the current cache space in the cache disk is sufficient, arrange the write caches in the cache disk in an order from small to large of the written physical addresses.
If the space of the high-speed medium is enough, the write cache which can not be merged can be temporarily stored in the high-speed medium, and merging is carried out when more write caches are stored. If the space of the high-speed medium is not enough, the data writing module 40 writes the data corresponding to the address-arranged write cache to the data disk one by one.
In the data access device based on the hybrid disk provided in this embodiment, when the interval data to be read is read and cached in the high-speed random access medium, the interval data is read from the high-speed random access medium of the read cache, so that the data reading and writing speed can be further increased.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (6)

1. A data access method based on a hybrid disk is characterized in that the data access method based on the hybrid disk comprises the following steps:
counting the number of discontinuous write caches among sectors with a first preset number according to the sequence of written addresses from a first write cache, and judging whether the write caches are continuous or not according to physical addresses;
when the counted number is larger than a second preset number, reading interval data between the write caches of the sectors with the interval first preset number from a data disk, wherein the write caches are stored in a cache disk, and the second preset number is the minimum number capable of performing combined write caches;
combining the write cache among the sectors with the interval data of the first preset number to generate a total write cache, and writing the data corresponding to the generated total write cache into a data disc;
the step of merging the write cache between the sectors with the first preset number of intervals with the interval data to generate a total write cache, and writing the data corresponding to the generated total write cache into a data disk includes:
according to the quantity of the discontinuous write caches, applying for a space from a system memory, and placing the write caches among the sectors with the interval of the first preset number and the interval data into the space;
combining the write cache between the sectors with the interval first preset number with the interval data in the space to generate a total write cache;
writing the data corresponding to the generated total write cache into a data disc;
the method for accessing data based on the hybrid disk comprises the following steps that the number of discontinuous write caches among sectors with a first preset number of intervals is counted according to the sequence of written addresses from a first write cache, and whether the discontinuous write caches are continuous or not is judged according to physical addresses, and the method for accessing data based on the hybrid disk further comprises the following steps:
when the counted number is less than or equal to the second preset number, judging whether the cache space in the cache disk is sufficient;
and if the current cache space in the cache disk is sufficient, continuing to perform the step of counting the number of discontinuous write caches among sectors with a first preset number of intervals according to the sequence of written addresses from the first write cache.
2. The hybrid disk-based data access method of claim 1, wherein before the step of counting, in order of written addresses, the number of discontinuous write buffers between a first preset number of sectors from the first write buffer, the hybrid disk-based data access method further comprises the steps of:
judging whether a plurality of addresses of the write cache are continuous or overlapped;
when the addresses of a plurality of write caches are continuous or overlapped, combining the write caches with continuous or overlapped addresses into one write cache, and writing the data corresponding to the combined write cache into the data disc;
when the addresses of the non-write caches are continuous or overlapped, counting the quantity of discontinuous write caches among sectors separated by a first preset number from the first write cache.
3. The hybrid disk-based data access method of any one of claims 1-2, wherein after the step of counting, from the first write cache, the number of discontinuous write caches separated by a first preset number of sectors, the hybrid disk-based data access method further comprises the steps of:
when the counted number is less than or equal to the second preset number, judging whether the cache space in the cache disk is sufficient;
and if the cache space in the cache disk is insufficient, writing the data corresponding to the write cache into the data disk one by one according to the sequence of the written addresses from the first write cache.
4. A hybrid disk based data access device, the hybrid disk based data access device comprising:
the quantity counting module is used for counting the quantity of discontinuous write caches among sectors with a first preset number according to the sequence of written addresses from a first write cache, wherein the write caches are stored in a cache disc and are judged whether to be continuous or not according to physical addresses;
an interval reading module, configured to read, from a data disc, interval data between write caches of sectors at intervals of a first preset number when the counted number is greater than a second preset number, where the second preset number is a minimum number of write caches capable of being merged;
the data merging module is used for merging the write cache among the sectors with the interval first preset number with the interval data to generate a total write cache;
the data writing module is used for writing the generated data corresponding to the total write cache into a data disc;
the data merging module is further configured to apply for a space from a system memory according to the number of the discontinuous write caches, and place the write caches among the sectors with the interval of the first preset number and the interval data in the space; combining the write cache among the sectors with the interval data in the interval first preset number in the space to generate a total write cache;
the data writing module is further configured to write the generated data corresponding to the total write cache into a data disk;
the cache judging module is used for judging whether the cache space in the cache disk is sufficient or not when the counted number is less than or equal to the second preset number;
the quantity counting module is further configured to count, from the first write cache, the quantity of discontinuous write caches among sectors with a first preset number of intervals according to the sequence of written addresses if the current cache space in the cache disk is sufficient.
5. The hybrid disk based data access device of claim 4, further comprising:
the address judgment module is used for judging whether a plurality of addresses of the write cache are continuous or overlapped;
the data merging module is further configured to merge multiple write caches with consecutive addresses into one write cache when the addresses of the multiple write caches are consecutive;
the data writing module is further configured to write the merged write cache to the data disk;
the quantity counting module is further configured to count the quantity of discontinuous write buffers between sectors spaced by a first preset number from a first write buffer when addresses of no write buffers are continuous or overlapped.
6. The hybrid disk-based data access device of any of claims 4-5, further comprising:
the cache judging module is used for judging whether the cache space in the cache disk is sufficient or not when the counted number is less than or equal to the second preset number;
and the data writing module is used for writing the data corresponding to the write cache into the data disk one by one according to the sequence of the written addresses from the first write cache if the cache space in the cache disk is insufficient.
CN201610118829.0A 2016-03-01 2016-03-01 Data access method and device based on hybrid disk Active CN107145301B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610118829.0A CN107145301B (en) 2016-03-01 2016-03-01 Data access method and device based on hybrid disk

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610118829.0A CN107145301B (en) 2016-03-01 2016-03-01 Data access method and device based on hybrid disk

Publications (2)

Publication Number Publication Date
CN107145301A CN107145301A (en) 2017-09-08
CN107145301B true CN107145301B (en) 2020-09-01

Family

ID=59783114

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610118829.0A Active CN107145301B (en) 2016-03-01 2016-03-01 Data access method and device based on hybrid disk

Country Status (1)

Country Link
CN (1) CN107145301B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109062499A (en) * 2018-06-28 2018-12-21 平安科技(深圳)有限公司 Data writing method, device, computer installation and storage medium
CN109376100A (en) * 2018-11-05 2019-02-22 浪潮电子信息产业股份有限公司 A kind of caching wiring method, device, equipment and readable storage medium storing program for executing
CN113076062B (en) * 2021-03-30 2023-01-06 山东英信计算机技术有限公司 Method and equipment for prolonging service life of QLCSSD
CN116521090B (en) * 2023-06-25 2023-09-12 苏州浪潮智能科技有限公司 Data disc-dropping method and device, electronic equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1783034A (en) * 2004-12-02 2006-06-07 富士通株式会社 Storage system and its control method and its programme
CN101334795A (en) * 2008-08-07 2008-12-31 金蝶软件(中国)有限公司 Data storage method and device
CN105260139A (en) * 2015-10-19 2016-01-20 福州瑞芯微电子股份有限公司 Magnetic disk management method and system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9116819B2 (en) * 2012-10-17 2015-08-25 Datadirect Networks, Inc. Reducing metadata in a write-anywhere storage system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1783034A (en) * 2004-12-02 2006-06-07 富士通株式会社 Storage system and its control method and its programme
CN101334795A (en) * 2008-08-07 2008-12-31 金蝶软件(中国)有限公司 Data storage method and device
CN105260139A (en) * 2015-10-19 2016-01-20 福州瑞芯微电子股份有限公司 Magnetic disk management method and system

Also Published As

Publication number Publication date
CN107145301A (en) 2017-09-08

Similar Documents

Publication Publication Date Title
CN106548789B (en) Method and apparatus for operating stacked tile type magnetic recording equipment
US9990276B2 (en) Read-write control method for memory, and corresponding memory and server
CN107145301B (en) Data access method and device based on hybrid disk
CN104115133B (en) For method, system and the equipment of the Data Migration for being combined non-volatile memory device
US10061704B2 (en) Systems and methods for managing cache of a data storage device
CN104699417B (en) Data storage device and data access method thereof
US9489148B2 (en) Selecting between non-volatile memory units having different minimum addressable data unit sizes
KR101678868B1 (en) Apparatus for flash address translation apparatus and method thereof
CN103136121A (en) Cache management method for solid-state disc
CN103049222A (en) RAID5 (redundant array of independent disk 5) write IO optimization processing method
CN106569732B (en) Data migration method and device
CN106293543B (en) It is a kind of that ordered method and device is write based on watt record RAID incidentally recycled
CN103970669A (en) Method for accelerating physical-to-logic address mapping of recycling operation in solid-state equipment
CN103383666B (en) Improve method and system and the cache access method of cache prefetching data locality
CN104503703A (en) Cache processing method and device
JPH04243061A (en) Flexible magnetic disk device
CN108491290B (en) Data writing method and device
CN109375868B (en) Data storage method, scheduling device, system, equipment and storage medium
CN107229580A (en) Sequential stream detection method and apparatus
CN112256198A (en) SSD data reading method and device, readable storage medium and electronic equipment
CN104461930A (en) Cache writing method and device
CN102681788A (en) Memory controller and a controlling method adaptable to dram
CN108491162A (en) A kind of method and device improving performance of storage system
JPH0566999A (en) Cache system for magnetic disk device
CN111880735B (en) Data migration method, device, equipment and storage medium in storage system

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
CB02 Change of applicant information

Address after: Nanshan District Xueyuan Road in Shenzhen city of Guangdong province 518052 No. 1001 Nanshan Chi Park building A1 layer

Applicant after: SANGFOR TECHNOLOGIES Inc.

Address before: Nanshan District Xueyuan Road in Shenzhen city of Guangdong province 518052 No. 1001 Nanshan Chi Park building A1 layer

Applicant before: Sangfor Technologies Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant