CN103473184B - The caching method of file system and system - Google Patents

The caching method of file system and system Download PDF

Info

Publication number
CN103473184B
CN103473184B CN201310331403.XA CN201310331403A CN103473184B CN 103473184 B CN103473184 B CN 103473184B CN 201310331403 A CN201310331403 A CN 201310331403A CN 103473184 B CN103473184 B CN 103473184B
Authority
CN
China
Prior art keywords
data
file system
metadata
caching
ranges
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.)
Expired - Fee Related
Application number
CN201310331403.XA
Other languages
Chinese (zh)
Other versions
CN103473184A (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.)
Ramaxel Technology Shenzhen Co Ltd
Original Assignee
Ramaxel Technology Shenzhen 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 Ramaxel Technology Shenzhen Co Ltd filed Critical Ramaxel Technology Shenzhen Co Ltd
Priority to CN201310331403.XA priority Critical patent/CN103473184B/en
Publication of CN103473184A publication Critical patent/CN103473184A/en
Application granted granted Critical
Publication of CN103473184B publication Critical patent/CN103473184B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Memory System Of A Hierarchy Structure (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present invention is applicable to storing technology field, it is provided that the caching method of a kind of file system, is realized by solid state hard disc, and described method includes: configure the ranges of logical addresses of the metadata of described file system;Obtain all IO of the block device at described file system place;Judge whether the address realm of described IO has with the ranges of logical addresses of described metadata to intersect;Intersect if the address realm of described IO has with the ranges of logical addresses of described metadata, then cache the data of described IO.The present invention also correspondingly provides the caching system of a kind of file system.Whereby, present invention may determine that the I/O data captured the need of caching, thus the I O process speed of accelerating file system.

Description

The caching method of file system and system
Technical field
The present invention relates to technical field of memory, particularly relate to caching method and the system of a kind of file system.
Background technology
Solid state hard disc (SSD) uses flash memory as storage medium, and reading speed relative mechanical hard disk is faster.Gu State hard disk is almost 0 without magnetic head, tracking time.The speed persistently write is the most surprising, is not only embodied in Persistently in read-write, random read-write speed is also exceedingly fast, the tracking time one of modal 7200 turns of mechanical hard disks As be 12-14 millisecond, and solid state hard disc can easily reach 0.1 millisecond even lower!
SSD is widely used in storage market, its application model except the replacement as mechanical hard disk, Can also be using SSD as caching, it is common that as block device (basic feature of block device be each piece can be only Standing on other block and read and write, disk is modal block device) caching.But in such a mode, which kind of number Being stored in SSD according to needs is a difficult problem, and tracing it to its cause is that the caching for block device loses application up and down Literary composition, it is impossible to accurately find " focus " data.
In file system, metadata have recorded the information of file system and the information of file, these information Frequently can be accessed by file system, this can cause a large amount of random IO, for mechanical hard disk, substantial amounts of with The machine tracking time will have a strong impact on disk system, thus cause application IO based on file system slow in reacting.
In summary, existing file caching method and system, there will naturally be inconvenience in actual use and lack Fall into, it is therefore necessary to improved.
Summary of the invention
For above-mentioned defect, it is an object of the invention to provide caching method and the system of a kind of file system, Can determine that the I/O data captured the need of caching, thus the I O process speed of accelerating file system.
To achieve these goals, the present invention provides the caching method of a kind of file system, passes through solid state hard disc Realizing, described method includes:
Configure the ranges of logical addresses of the metadata of described file system;
Obtain the IO of the block device at described file system place;
Judge whether the address realm of described IO has with the ranges of logical addresses of described metadata to intersect;
Intersect if the address realm of described IO has with the ranges of logical addresses of described metadata, then cache described IO Data.
The caching method of the file system according to the present invention, patrolling of the metadata of the described file system of described configuration Collect address realm step to include:
The metadata address scope of described file system is obtained by third party's instrument;
Record the metadata address scope of described file system.
The caching method of the file system according to the present invention, the block device at described acquisition described file system place The step of all IO include:
Described IO is obtained by the driving of block device described in amendment kernel.
The caching method of the file system according to the present invention, if the address realm of described IO and described unit number According to ranges of logical addresses have crossing, then the step of the data caching described IO includes:
If the write order for data that described IO carries, then directly by described data write caching;
If the read command for data that described IO carries, and hit described data in the buffer, the most directly return IO;
If the read command for data that described IO carries, and the most miss described data, then by described IO distributes described block device, and described data are replicated when returning by described IO, and the data of described duplication are write Enter to described caching.
The present invention also provides for the caching system of a kind of file system, is realized by solid state hard disc, described caching system System includes:
Metadata configurations module, for configuring the ranges of logical addresses of the metadata of described file system;
IO acquisition module, for obtaining the IO of the block device at described file system place;
Address judgment module, for judging the address realm of described IO and the ranges of logical addresses of described metadata Whether have crossing;
Data cache module, has phase for the address realm of described IO with the ranges of logical addresses of described metadata During friendship, cache the data of described IO.
The caching system of the file system according to the present invention, caching system farther includes, file system analysis Module, for obtaining the metadata address scope of described file system by third party's instrument;
Described metadata configurations module is further used for recording the metadata address scope of described file system.
The caching system of the file system according to the present invention, described IO acquisition module is further used for by amendment The driving of block device described in kernel obtains described IO.
The caching system of the file system according to the present invention, if the write order for data that described IO carries, then Data cache module is directly by described data write caching;
If the read command for data that described IO carries, and hit described data in the buffer, the most directly return IO;
If the read command for data that described IO carries, and the most miss described data, then by described IO distributes described block device, and described data are replicated when returning by described IO, and described data cache module is by institute The data stating duplication are written to described caching.
The present invention by using solid state hard disc as buffer structure, its can analyze acquisition block device in file system Metadata ranges of logical addresses, when file system has I/O command, obtain file system place block set This standby IO, and judge whether the address realm of described IO has phase with the ranges of logical addresses of described metadata Hand over, if having crossing, then I/O data is cached, otherwise directly IO is distributed block device, whereby, this Bright may determine that the I/O data to capture the need of caching, thus the I O process speed of accelerating file system.
Accompanying drawing explanation
Fig. 1 is the structural representation of the caching system of one embodiment of the invention;
Fig. 2 is the caching method flow chart of the file system of one embodiment of the invention;
Fig. 3 is the I O process flow chart of another embodiment of the present invention.
Detailed description of the invention
In order to make the purpose of the present invention, technical scheme and advantage clearer, below in conjunction with accompanying drawing and reality Execute example, the present invention is further elaborated.Only should be appreciated that specific embodiment described herein Only in order to explain the present invention, it is not intended to limit the present invention.
Seeing Fig. 1, the invention provides the caching system of a kind of file system, this caching system 100 is by solid State hard disk (SSD) realizes, and it at least includes:
Metadata configurations module 10, for configuring the ranges of logical addresses of the metadata of described file system.
Preferably, the metadata of file system directly can be joined by the present invention by metadata configurations module 10 Put ranges of logical addresses, it is also possible to analyze module 11 analysis acquisition file system by presetting a file system After metadata ranges of logical addresses, then recorded the logical address model of this metadata by metadata configurations module 10 Enclose.Concrete, file system analyzes module 11 can pass through third party's instrument such as winHex, dumpe2fs etc. Obtain the metadata address scope of described file system.
IO acquisition module 20, for obtaining the IO of the block device at described file system place.
The present invention realizes capturing IO by the driving of amendment kernel Central Plains block device, with linux operating system is Example: obtain, by open original equipment file, the gendisk that equipment is corresponding, then by change gendisk Make_request_fn function address in request_queue can realize.
Address judgment module 30, for judging the address realm of described IO and the logical address model of described metadata Whether have crossing, the most then transfer to data cache module 40 to process, otherwise directly send IO with charge free block if enclosing Equipment performs.
Data cache module 40, has with the ranges of logical addresses of described metadata for the address realm of described IO When intersecting, cache the data of described IO.
Concrete, if the write order for data that described IO carries, then data cache module is directly by described number According to write caching;If the read command for data that described IO carries, and hit described data in the buffer, then Directly return IO;If the read command for data that described IO carries, and the most miss described data, Described IO then distributes described block device, and described data are replicated when returning by described IO, and described data are delayed The data of described duplication are written to described caching by storing module.
In the concrete application of the present invention, caching can be automatically write by using the data that temperature is higher, under When once receiving the IO read/write command of corresponding data, directly can obtain this data from caching, accelerate file The system processing speed to IO.
See Fig. 2, the invention provides the caching method of a kind of file system, its by as shown in Figure 1 be System 100 realization, system 100 is framework based on solid state hard disc, and the method includes:
Step S201, configures the ranges of logical addresses of the metadata of described file system.
The present invention can directly configure ranges of logical addresses to the metadata of file system, it is also possible to by presetting After analyzing the metadata ranges of logical addresses of acquisition file system, re-record the ranges of logical addresses of this metadata. Concrete, the metadata logical address for file system can pass through third party's instrument such as winHex, dumpe2fs Deng realization.
Step S202, obtains the IO of the block device at described file system place.
The present invention realizes capturing IO by the driving of amendment kernel Central Plains block device, with linux operating system is Example: obtain, by open original equipment file, the gendisk that equipment is corresponding, then by change gendisk Make_request_fn function address in request_queue can realize.
Step S203, it is judged that whether the address realm of described IO has phase with the ranges of logical addresses of described metadata Hand over, the most then perform step S204, otherwise perform step S205.
Step S204, caches the data of described IO.
Step S205, sends described IO block device with charge free and processes.
In the concrete application of the present invention, caching can be automatically write by using the data that temperature is higher, under When once receiving the IO read/write command of corresponding data, directly can obtain this data from caching, accelerate file The system processing speed to IO.
See Fig. 3, be the I O process flow process of one embodiment of the invention offer, comprising:
Step S301, it is judged that whether the address realm of IO has with the ranges of logical addresses of metadata intersects, if so, Then perform step S302, otherwise perform step S305.
Step S302, it is judged that whether IO is read command, if then performing step S303, otherwise judges this number According to for write order, and perform step S304.
Step S303, it is judged that the read command data of described IO are hit the most in the buffer, if then returning IO Order, otherwise performs step S305.
Step S304, by I/O command data write caching.
Step S305, is redirected to target device by I/O data.
Further, also include after step S305: described data are replicated when returning by described IO, and The data of described duplication are written in caching.Whereby, when again receiving the IO read command of identical data, These data can be directly hit, improve IO speed.
In sum, the present invention by using solid state hard disc as buffer structure, it can analyze acquisition block device The metadata ranges of logical addresses of middle file system, when file system has I/O command, obtains file system This IO of the block device at place, and judge the address realm of described IO and the ranges of logical addresses of described metadata Whether have crossing, if having crossing, then I/O data is cached, otherwise directly IO is distributed block device, borrow This, present invention may determine that the I/O data captured the need of caching, thus the IO of accelerating file system Processing speed.
Certainly, the present invention also can have other various embodiments, without departing substantially from present invention spirit and the feelings of essence thereof Under condition, those of ordinary skill in the art work as can make various corresponding change and deformation according to the present invention, but These change accordingly and deform the protection domain that all should belong to appended claims of the invention.

Claims (6)

1. a caching method for file system, is realized by solid state hard disc, it is characterised in that described method Including:
Configure the ranges of logical addresses of the metadata of described file system;
Obtain the IO of the block device at described file system place;
Judge whether the address realm of described IO has with the ranges of logical addresses of described metadata to intersect;
Intersect if the address realm of described IO has with the ranges of logical addresses of described metadata, then cache described IO Data;
The ranges of logical addresses step of the metadata of the described file system of described configuration includes:
The metadata address scope of described file system is obtained by third party's instrument;
Record the metadata address scope of described file system;Or
The described metadata of described file system is directly configured ranges of logical addresses.
The caching method of file system the most according to claim 1, it is characterised in that described acquisition institute The step of the IO stating the block device at file system place includes:
Described IO is obtained by the driving of block device described in amendment kernel.
The caching method of file system the most according to claim 1, it is characterised in that if described The address realm of IO has with the ranges of logical addresses of described metadata and intersects, then cache the step of the data of described IO Suddenly include:
If the write order for data that described IO carries, then directly by described data write caching;
If the read command for data that described IO carries, and hit described data in the buffer, the most directly return IO;
If the read command for data that described IO carries, and the most miss described data, then by described IO distributes described block device, and described data are replicated when returning by described IO, and the data of described duplication are write Enter to described caching.
4. a caching system for file system, is realized by solid state hard disc, it is characterised in that described caching System includes:
Metadata configurations module, for configuring the ranges of logical addresses of the metadata of described file system;
IO acquisition module, for obtaining the IO of the block device at described file system place;
Address judgment module, for judging the address realm of described IO and the ranges of logical addresses of described metadata Whether have crossing;Data cache module, for address realm and the logical address of described metadata of described IO When scope has crossing, cache the data of described IO;
File system analyzes module, for being obtained the metadata address of described file system by third party's instrument Scope;
Described metadata configurations module is further used for recording the metadata address scope of described file system;
Described metadata configurations module directly configures logical address model to the described metadata of described file system Enclose.
The caching system of file system the most according to claim 4, it is characterised in that described IO obtains Delivery block is further used for obtaining described IO by the driving of block device described in amendment kernel.
The caching system of file system the most according to claim 4, it is characterised in that
If the write order for data that described IO carries, then data cache module is directly by slow for the write of described data Deposit;
If the read command for data that described IO carries, and hit described data in the buffer, the most directly return IO;
If the read command for data that described IO carries, and the most miss described data, then by described IO distributes described block device, and described data are replicated when returning by described IO, and described data cache module is by institute The data stating duplication are written to described caching.
CN201310331403.XA 2013-08-01 2013-08-01 The caching method of file system and system Expired - Fee Related CN103473184B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310331403.XA CN103473184B (en) 2013-08-01 2013-08-01 The caching method of file system and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310331403.XA CN103473184B (en) 2013-08-01 2013-08-01 The caching method of file system and system

Publications (2)

Publication Number Publication Date
CN103473184A CN103473184A (en) 2013-12-25
CN103473184B true CN103473184B (en) 2016-08-10

Family

ID=49798046

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310331403.XA Expired - Fee Related CN103473184B (en) 2013-08-01 2013-08-01 The caching method of file system and system

Country Status (1)

Country Link
CN (1) CN103473184B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107797759B (en) * 2016-09-05 2021-05-18 北京忆恒创源科技有限公司 Method, device and driver for accessing cache information

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1766853A (en) * 2004-10-28 2006-05-03 国际商业机器公司 System and method for direct deposit using locking cache
CN102024044A (en) * 2010-12-08 2011-04-20 华为技术有限公司 Distributed file system
CN102696010A (en) * 2009-09-08 2012-09-26 弗森-艾奥公司 Apparatus, system, and method for caching data on a solid-state storage device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102693230B (en) * 2011-03-23 2015-12-09 伊姆西公司 For the file system of storage area network

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1766853A (en) * 2004-10-28 2006-05-03 国际商业机器公司 System and method for direct deposit using locking cache
CN102696010A (en) * 2009-09-08 2012-09-26 弗森-艾奥公司 Apparatus, system, and method for caching data on a solid-state storage device
CN102024044A (en) * 2010-12-08 2011-04-20 华为技术有限公司 Distributed file system

Also Published As

Publication number Publication date
CN103473184A (en) 2013-12-25

Similar Documents

Publication Publication Date Title
US11868257B2 (en) Cache write overlap handling
KR102584018B1 (en) Apparatus, system and method for caching compressed data background
CN105159622B (en) A kind of method and system reducing SSD read-write IO time delay
US9348747B2 (en) Solid state memory command queue in hybrid device
US20160092361A1 (en) Caching technologies employing data compression
US9069474B2 (en) Retention based defecting in a hybrid memory system
CN105183374B (en) A kind of data read-write method and mainboard
CN103543955A (en) Method and system for reading cache with solid state disk as equipment and solid state disk
AU2006331830A1 (en) Optimizing write and wear performance for a memory
CN106569732B (en) Data migration method and device
CN112799595B (en) Data processing method, device and storage medium
CN112130769B (en) Mechanical hard disk data processing method, device, equipment and medium
US20260023689A1 (en) Systems, methods, and apparatus for accessing data in versions of memory pages
CN110321081B (en) Flash memory read caching method and system
CN103473184B (en) The caching method of file system and system
US10031689B2 (en) Stream management for storage devices
Liu et al. Raf: A random access first cache management to improve SSD-based disk cache
CN103049395B (en) The method of buffer memory device data and system thereof
CN110515861A (en) Storage device and method for processing flash command
US10268386B2 (en) Data storage device including temporary storage locations
JP2003241904A5 (en)
US9785563B1 (en) Read command processing for data storage system based on previous writes
JP5953245B2 (en) Information processing system
CN103777900A (en) Method for having access to disc array through partition remapping
KR101831126B1 (en) The controlling method of the data processing apparatus in storage

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20160810